merge with 1.5.0_english

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8287 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2011-04-08 06:20:12 +00:00
commit 0943470d5f
219 changed files with 6420 additions and 8700 deletions

View file

@ -2,7 +2,7 @@
/**
* @file config/config.inc.php
* @author NHN (developers@xpressengine.com)
* @brief 기본적으로 사용하는 class파일의 include 환경 설정을
* @brief set the include of the class file and other environment configurations
**/
@error_reporting(E_ALL ^ E_NOTICE);
@ -10,13 +10,13 @@
if(!defined('__ZBXE__')) exit();
/**
* @brief XE의 전체 버전 표기
* 파일의 수정이 없더라도 공식 릴리즈시에 수정되어 함께 배포되어야
* @brief display XE's full version
* Even The file should be revised when releasing altough no change is made
**/
define('__ZBXE_VERSION__', '1.5.0');
/**
* @brief zbXE가 설치된 장소의 base path를 구함
* @brief The base path to where you installed zbXE Wanted
**/
define('_XE_PATH_', str_replace('config/config.inc.php', '', str_replace('\\', '/', __FILE__)));
@ -26,8 +26,8 @@
ini_set('session.use_only_cookies', 0);
/**
* @brief 기본 설정에 우선하는 사용자 설정 파일
* config/config.user.inc.php 파일에 아래 내용을 저장하면
* @brief user configuration files which override the default settings
* save the following information into config/config.user.inc.php
* <?php
* define('__DEBUG__', 0);
* define('__DEBUG_OUTPUT__', 0);
@ -45,75 +45,75 @@
}
/**
* @brief 디버깅 메시지 출력 (비트 )
* 0 : 디버그 메시지를 생성/ 출력하지 않음
* 1 : debugPrint() 함수를 통한 메시지 출력
* 2 : 소요시간, Request/Response info 출력
* 4 : DB 쿼리 내역 출력
* @brief output debug message(bit value)
* 0: generate debug messages/not display
* 1: display messages through debugPrint() function
* 2: output execute time, Request/Response info
* 4: output DB query history
**/
if(!defined('__DEBUG__')) define('__DEBUG__', 0);
/**
* @brief 디버그 메세지의 출력 장소
* 0 : files/_debug_message.php 연결하여 출력
* 1 : HTML 최하단에 주석으로 출력 (Response Method가 HTML )
* 2 : Firebug 콘솔에 출력 (PHP 4 & 5. Firebug/FirePHP 플러그인 필요)
* @brief output location of debug message
* 0: connect to the files/_debug_message.php and output
* 1: HTML output as a comment on the bottom (when response method is the HTML)
* 2: Firebug console output (PHP 4 & 5. Firebug/FirePHP plug-in required)
**/
if(!defined('__DEBUG_OUTPUT__')) define('__DEBUG_OUTPUT__', 0);
/**
* @brief FirePHP 콘솔 브라우저 주석 출력 보안
* 0 : 제한 없음 (권장하지 않음)
* 1 : 지정한 IP 주소에만 허용
* @brief output comments of the firePHP console and browser
* 0: No limit (not recommended)
* 1: Allow only specified IP addresses
**/
if(!defined('__DEBUG_PROTECT__')) define('__DEBUG_PROTECT__', 1);
if(!defined('__DEBUG_PROTECT_IP__')) define('__DEBUG_PROTECT_IP__', '127.0.0.1');
/**
* @brief DB 오류 메세지 출력 정의
* 0 : 출력하지 않음
* 1 : files/_debug_db_query.php 연결하여 출력
* @brief DB error message definition
* 0: No output
* 1: files/_debug_db_query.php connected to the output
**/
if(!defined('__DEBUG_DB_OUTPUT__')) define('__DEBUG_DB_OUTPUT__', 0);
/**
* @brief DB 쿼리중 정해진 시간을 넘기는 쿼리의 로그 남김
* 0 : 로그를 남기지 않음
* 0 이상 : 단위를 초로 하여 지정된 이상의 실행시간이 걸린 쿼리를 로그로 남김
* 로그파일은 ./files/_db_slow_query.php 파일로 저장됨
* @brief Query log for only timeout query among DB queries
* 0: Do not leave a log
* = 0: leave a log when the slow query takes over specified seconds
* Log file is saved as ./files/_db_slow_query.php file
**/
if(!defined('__LOG_SLOW_QUERY__')) define('__LOG_SLOW_QUERY__', 0);
/**
* @brief DB 쿼리 정보를 남김
* 0 : 쿼리에 정보를 추가하지 않음
* 1 : XML Query ID 쿼리 주석으로 남김
* @brief Leave DB query information
* 0: Do not add information to the query
* 1: Comment the XML Query ID
**/
if(!defined('__DEBUG_QUERY__')) define('__DEBUG_QUERY__', 0);
/**
* @brief ob_gzhandler를 이용한 압축 기능을 강제로 사용하거나 끄는 옵션
* 0 : 사용하지 않음
* 1 : 사용함
* 대부분의 서버에서는 문제가 없는데 특정 서버군에서 압축전송시 IE에서 오동작을 일으키는경우가 있음
* @brief option to enable/disable a compression feature using ob_gzhandler
* 0: Not used
* 1: Enabled
* Only particular servers may have a problem in IE browser when sending a compression
**/
if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 1);
/**
* @brief php unit test (경로/tests/index.php) 실행 유무 지정
* 0 : 사용하지 않음
* 1 : 사용함
* @brief decide to use/not use the php unit test (Path/tests/index.php)
* 0: Not used
* 1: Enabled
**/
if(!defined('__ENABLE_PHPUNIT_TEST__')) define('__ENABLE_PHPUNIT_TEST__', 0);
/**
* @brief __PROXY_SERVER__ 대상 서버를 거쳐서 외부 요청을 하도록 하는 서버의 정보를 가지고 있음
* FileHandler::getRemoteResource 에서 상수를 사용함
* @brief __PROXY_SERVER__ has server information to request to the external through the target server
* FileHandler:: getRemoteResource uses the constant
**/
if(!defined('__PROXY_SERVER__')) define('__PROXY_SERVER__', null);
/**
* @brief Firebug 콘솔 출력 사용시 관련 파일 require
* @brief Require specific files when using Firebug console output
**/
if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) {
require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
@ -129,15 +129,15 @@
if(!defined('__XE_LOADED_CLASS__')){
/**
* @brief 간단하게 사용하기 위한 함수 정의한 파일 require
* @brief Require a function-defined-file for simple use
**/
require(_XE_PATH_.'config/func.inc.php');
if(__DEBUG__) define('__StartTime__', getMicroTime());
/**
* @brief 기본적인 class 파일 include
* @TODO : PHP5 기반으로 바꾸게 되면 _autoload() 이용할 있기에 제거 대상
* @brief include the class files
* @TODO : When _autoload() can be used for PHP5 based applications, it will be removed.
**/
if(__DEBUG__) define('__ClassLoadStartTime__', getMicroTime());
require(_XE_PATH_.'classes/object/Object.class.php');

View file

@ -2,13 +2,13 @@
/**
* @file config/func.inc.php
* @author NHN (developers@xpressengine.com)
* @brief 편의 목적으로 만든 함수라이브러리 파일
* @brief function library files for convenience
**/
if(!defined('__ZBXE__')) exit();
/**
* @brief php5에 대비하여 clone 정의
* @brief define clone for php5
**/
if (version_compare(phpversion(), '5.0') < 0) {
eval('
@ -19,7 +19,7 @@
}
/**
* @brief iconv 함수가 없을 경우 함수를 만들어서 오류가 생기지 않도록 정의
* @brief define an empty function to avoid errors when iconv function doesn't exist
**/
if(!function_exists('iconv')) {
eval('
@ -74,8 +74,8 @@
) ;
/**
* @brief ModuleHandler::getModuleObject($module_name, $type) 쓰기 쉽게 함수로 선언
* @param module_name 모듈이름
* @brief define a function to use ModuleHandler::getModuleObject ($module_name, $type)
* @param module_name
* @param type disp, proc, controller, class
* @param kind admin, null
* @return module instance
@ -85,8 +85,8 @@
}
/**
* @brief module의 controller 객체 생성용
* @param module_name 모듈이름
* @brief create a controller instance of the module
* @param module_name
* @return module controller instance
**/
function &getController($module_name) {
@ -94,8 +94,8 @@
}
/**
* @brief module의 admin controller 객체 생성용
* @param module_name 모듈이름
* @brief create a controller instance of the module
* @param module_name
* @return module admin controller instance
**/
function &getAdminController($module_name) {
@ -103,8 +103,8 @@
}
/**
* @brief module의 view 객체 생성용
* @param module_name 모듈이름
* @brief create a view instance of the module
* @param module_name
* @return module view instance
**/
function &getView($module_name) {
@ -112,8 +112,8 @@
}
/**
* @brief module의 mobile 객체 생성용
* @param module_name 모듈이름
* @brief create a view instance of the module
* @param module_name
* @return module mobile instance
**/
function &getMobile($module_name) {
@ -130,8 +130,8 @@
}
/**
* @brief module의 model 객체 생성용
* @param module_name 모듈이름
* @brief create a model instance of the module
* @param module_name
* @return module model instance
**/
function &getModel($module_name) {
@ -139,8 +139,8 @@
}
/**
* @brief module의 admin model 객체 생성용
* @param module_name 모듈이름
* @brief create an admin model instance of the module
* @param module_name
* @return module admin model instance
**/
function &getAdminModel($module_name) {
@ -148,8 +148,8 @@
}
/**
* @brief module의 api 객체 생성용
* @param module_name 모듈이름
* @brief create an api instance of the module
* @param module_name
* @return module api class instance
**/
function &getAPI($module_name) {
@ -157,8 +157,8 @@
}
/**
* @brief module의 wap 객체 생성용
* @param module_name 모듈이름
* @brief create a wap instance of the module
* @param module_name
* @return module wap class instance
**/
function &getWAP($module_name) {
@ -166,8 +166,8 @@
}
/**
* @brief module의 상위 class 객체 생성용
* @param module_name 모듈이름
* @brief create a class instance of the module
* @param module_name
* @return module class instance
**/
function &getClass($module_name) {
@ -175,10 +175,10 @@
}
/**
* @brief DB::executeQuery() alias
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
* @param args object 변수로 선언된 인자값
* @return 처리결과
* @brief the alias of DB::executeQuery()
* @param query_id (module name.query XML file)
* @param argument values of args object
* @return results
**/
function executeQuery($query_id, $args = null) {
$oDB = &DB::getInstance();
@ -186,10 +186,10 @@
}
/**
* @brief DB::executeQuery() 결과값을 무조건 배열로 처리하도록 하는 함수
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
* @param args object 변수로 선언된 인자값
* @return 처리결과
* @brief function to handle the result of DB::executeQuery() as an array
* @param query_id(module name.query XML file)
* @param argument values of args object
* @return results
**/
function executeQueryArray($query_id, $args = null) {
$oDB = &DB::getInstance();
@ -201,7 +201,7 @@
}
/**
* @brief DB::getNextSequence() alias
* @brief DB:: alias of getNextSequence()
* @return big int
**/
function getNextSequence() {
@ -210,14 +210,14 @@
}
/**
* @brief Context::getUrl() 쓰기 쉽게 함수로 선언
* @brief define a function to use Context::getUrl()
* @return string
*
* getUrl() 현재 요청된 RequestURI에 주어진 인자의 값으로 변형하여 url을 리턴한다\n
* 1. 인자는 (key, value)... 형식으로 주어져야 한다.\n
* ex) getUrl('key1','val1', 'key2', '') : key1, key2를 val1과 '' 변형\n
* 2. 아무런 인자가 없으면 argument를 제외한 url을 리턴
* 3. 인자값이 '' 이면 RequestUri에다가 추가된 args_list로 url을 만듬
* getUrl() returns the URL transformed from given arguments of RequestURI\n
* 1. argument format follows as (key, value).\.
* ex) getUrl('key1', 'val1', 'key2',''): transform key1 and key2 to val1 and '' respectively\n
* 2. returns URL without the argument if no argument is given.
* 3. URL made of args_list added to RequestUri if the first argument value is ''.
**/
function getUrl() {
$num_args = func_num_args();
@ -238,8 +238,8 @@
}
/**
* @brief getUrl() 값에 request uri를 추가하여 reutrn
* full url얻기 위함
* @brief return the value adding request uri to getUrl()
* to get the full url
**/
function getFullUrl() {
$num_args = func_num_args();
@ -271,11 +271,12 @@
}
/**
* @brief Context::getUrl() 쓰기 쉽게 함수로 선언
* @brief Context:: getUrl() function is declared as easier to write
* @return string
*
* getSiteUrl() 지정된 도메인에 대해 주어진 인자의 값으로 변형하여 url을 리턴한다\n
* 인자는 도메인(http://등이 제외된)+path 여야 .
* getSiteUrl() returns the URL by transforming the given argument value of domain\n
* The first argument should consist of domain("http://" not included) and path
*
**/
function getSiteUrl() {
$num_args = func_num_args();
@ -302,8 +303,8 @@
}
/**
* @brief getSiteUrl() 값에 request uri를 추가하여 reutrn
* full url얻기 위함
* @brief return the value adding request uri to the getSiteUrl()
* To get the full url
**/
function getFullSiteUrl() {
$num_args = func_num_args();
@ -324,17 +325,17 @@
}
/**
* @brief 가상사이트의 Domain이 url형식인지 site id인지 return
* @brief return if domain of the virtual site is url type or id type
**/
function isSiteID($domain) {
return preg_match('/^([a-z0-9\_]+)$/i', $domain);
}
/**
* @brief 주어진 문자를 주어진 크기로 자르고 잘라졌을 경우 주어진 꼬리를
* @param string 자를 문자열
* @param cut_size 주어진 문자열을 자를 크기
* @param tail 잘라졌을 경우 문자열의 제일 뒤에 붙을 꼬리
* @brief put a given tail after trimming string to the specified size
* @param the original string to trim
* @param cut_size: the size to be
* @param tail: tail to put in the end of the string after trimming
* @return string
**/
function cut_str($string,$cut_size=0,$tail = '...') {
@ -388,8 +389,8 @@
}
/**
* @brief YYYYMMDDHHIISS 형식의 시간값을 unix time으로 변경
* @param str YYYYMMDDHHIISS 형식의 시간값
* @brief YYYYMMDDHHIISS format changed to unix time value
* @param str: time value in format of YYYYMMDDHHIISS
* @return int
**/
function ztime($str) {
@ -410,7 +411,7 @@
}
/**
* @brief YmdHis의 시간 형식을 지금으로 부터 몇분/몇시간전, 1 이상 차이나면 format string return
* @brief If the recent post within a day, output format of YmdHis is "min/hours ago from now". If not within a day, it return format string.
**/
function getTimeGap($date, $format = 'Y.m.d') {
$gap = time() - ztime($date);
@ -425,7 +426,7 @@
}
/**
* @brief 월이름을 return
* @brief Name of the month return
**/
function getMonthName($month, $short = true) {
$short_month = array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
@ -434,17 +435,16 @@
}
/**
* @brief YYYYMMDDHHIISS 형식의 시간값을 원하는 시간 포맷으로 변형
* @param string|int str YYYYMMDDHHIISS 형식의 시간
* @param string format php date()함수의 시간 포맷
* @param bool conversion 언어에 따라 날짜 포맷의 자동변환 여부
* @brief change the time format YYYYMMDDHHIISS to the user defined format
* @param string|int str is YYYYMMDDHHIISS format time values
* @param string format is time format of php date() function
* @param bool conversion means whether to convert automatically according to the language
* @return string
**/
function zdate($str, $format = 'Y-m-d H:i:s', $conversion=true) {
// 대상 시간이 없으면 null return
// return null if no target time is specified
if(!$str) return;
// 언어권에 따라서 지정된 날짜 포맷을 변경
// convert the date format according to the language
if($conversion == true) {
switch(Context::getLangType()) {
case 'en' :
@ -462,7 +462,7 @@
}
}
// 년도가 1970년 이전이면 별도 처리
// If year value is less than 1970, handle it separately.
if((int)substr($str,0,4) < 1970) {
$hour = (int)substr($str,8,2);
$min = (int)substr($str,10,2);
@ -493,11 +493,10 @@
$string = strtr($format, $trans);
} else {
// 1970년 이후라면 ztime()함수로 unixtime을 구하고 date함수로 처리
// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument.
$string = date($format, ztime($str));
}
// 요일, am/pm을 각 언어에 맞게 변경
// change day and am/pm for each language
$unit_week = Context::getLang('unit_week');
$unit_meridiem = Context::getLang('unit_meridiem');
$string = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),$unit_week, $string);
@ -511,8 +510,8 @@
* @param display_line boolean flag whether to print seperator (default:true)
* @return none
*
* ./files/_debug_message.php 파일에 $buff 내용을 출력한다.
* tail -f ./files/_debug_message.php 하여 계속 살펴 있다
* Display $buff contents into the file ./files/_debug_message.php.
* You can see the file on your prompt by command: tail-f./files/_debug_message.php
**/
function debugPrint($debug_output = null, $display_option = true, $file = '_debug_message.php') {
if(!(__DEBUG__ & 1)) return;
@ -533,11 +532,9 @@
{
$label = sprintf('[%s:%d] ', $file_name, $line_num);
}
// FirePHP 옵션 체크
// Check a FirePHP option
if($display_option === 'TABLE') $label = $display_option;
// __DEBUG_PROTECT__ 옵션으로 지정된 IP와 접근 IP가 동일한지 체크
// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
$label = null;
@ -579,9 +576,9 @@
}
/**
* @brief 첫번째 인자로 오는 object var에서 2번째 object의 var들을 제거
* @param target_obj object
* @param del_obj object의 vars에서 del_obj의 vars를 제거한다
* @brief Delete the second object vars from the first argument
* @param target_obj is an original object
* @param del_obj is object vars to delete from the original object
* @return object
**/
function delObjectVars($target_obj, $del_obj) {
@ -607,7 +604,7 @@
}
/**
* @brief php5 이상에서 error_handing을 debugPrint로 변경
* @brief change error_handing to debugPrint on php5 higher
* @param errno
* @param errstr
* @return file
@ -625,9 +622,9 @@
}
/**
* @brief 주어진 숫자를 주어진 크기로 recursive하게 잘라줌
* @param no 주어진 숫자
* @param size 잘라낼 크기
* @brief Trim a given number to a fiven size recursively
* @param no : a given number
* @param size : a given digits
**/
function getNumberingPath($no, $size=3) {
$mod = pow(10, $size);
@ -637,22 +634,22 @@
}
/**
* @brief 한글이 들어간 url의 decode
* @brief decode the URL in Korean
**/
function url_decode($str) {
return preg_replace('/%u([[:alnum:]]{4})/', '&#x\\1;',$str);
}
/**
* @brief 해킹 시도로 의심되는 코드들을 미리 차단
* @brief Pre-block the codes which may be hacking attempts
**/
function removeHackTag($content) {
// 특정 태그들을 일반 문자로 변경
// change the specific tags to the common texts
$content = preg_replace('/<(\/?)(iframe|script|meta|style|applet|link|base|html|body)/is', '&lt;$1$2', $content);
/**
* 이미지나 동영상등의 태그에서 src에 관리자 세션을 악용하는 코드를 제거
* - 취약점 제보 : 김상원님
* Remove codes to abuse the admin session in src by tags of imaages and video postings
* - Issue reported by Sangwon Kim
**/
$content = preg_replace_callback("!<(/?)([a-z]+)(.*?)>!is", removeSrcHack, $content);
@ -690,7 +687,7 @@
$xml_doc = $oXmlParser->parse($buff);
if(!$xml_doc) return sprintf("<%s>", $tag);
// src값에 module=admin이라는 값이 입력되어 있으면 이 값을 무효화 시킴
// invalidate the value if src value is module = admin.
$src = $xml_doc->attrs->src;
$dynsrc = $xml_doc->attrs->dynsrc;
$lowsrc = $xml_doc->attrs->lowsrc;
@ -748,7 +745,7 @@
}
/**
* @brief attribute의 value를 " 로 둘러싸도록 처리하는 함수
* @brief function to enclose attribute values to double quotes(")
**/
function fixQuotation($matches) {
$key = $matches[1];
@ -774,8 +771,7 @@
return $output;
}
// hexa값을 RGB로 변환
// convert hexa value to RGB
if(!function_exists('hexrgb')) {
function hexrgb($hexstr) {
$int = hexdec($hexstr);
@ -788,9 +784,9 @@
}
/**
* @brief mysql old_password php 구현 함수
* 제로보드4나 기타 mysql4.1 이전의 old_password()함수를 데이터의 사용을 위해서
* mysql의 password.c 소스 참조해서 구현함
* @brief php function for mysql old_password()
* provides backward compatibility for zero board4 which uses old_password() of mysql 4.1 earlier versions.
* the function implemented by referring to the source codes of password.c file in mysql
**/
function mysql_pre4_hash_password($password) {
$nr = 1345345333;
@ -816,7 +812,7 @@
}
/**
* 현재 요청받은 스크립트 경로를 return
* return the requested script path
**/
function getScriptPath() {
static $url = null;
@ -825,7 +821,7 @@
}
/**
* javascript의 escape의 php unescape 함수
* php unescape function of javascript's escape
* Function converts an Javascript escaped string back into a string with specified charset (default is UTF-8).
* Modified function from http://pure-essence.net/stuff/code/utf8RawUrlDecode.phps
**/