15 if(!function_exists(
'iconv'))
18 function iconv($in_charset, $out_charset, $str)
30 '-1200' =>
'[GMT -12:00] Baker Island Time',
31 '-1100' =>
'[GMT -11:00] Niue Time, Samoa Standard Time',
32 '-1000' =>
'[GMT -10:00] Hawaii-Aleutian Standard Time, Cook Island Time',
33 '-0930' =>
'[GMT -09:30] Marquesas Islands Time',
34 '-0900' =>
'[GMT -09:00] Alaska Standard Time, Gambier Island Time',
35 '-0800' =>
'[GMT -08:00] Pacific Standard Time',
36 '-0700' =>
'[GMT -07:00] Mountain Standard Time',
37 '-0600' =>
'[GMT -06:00] Central Standard Time',
38 '-0500' =>
'[GMT -05:00] Eastern Standard Time',
39 '-0400' =>
'[GMT -04:00] Atlantic Standard Time',
40 '-0330' =>
'[GMT -03:30] Newfoundland Standard Time',
41 '-0300' =>
'[GMT -03:00] Amazon Standard Time, Central Greenland Time',
42 '-0200' =>
'[GMT -02:00] Fernando de Noronha Time, South Georgia & the South Sandwich Islands Time',
43 '-0100' =>
'[GMT -01:00] Azores Standard Time, Cape Verde Time, Eastern Greenland Time',
44 '0000' =>
'[GMT 00:00] Western European Time, Greenwich Mean Time',
45 '+0100' =>
'[GMT +01:00] Central European Time, West African Time',
46 '+0200' =>
'[GMT +02:00] Eastern European Time, Central African Time',
47 '+0300' =>
'[GMT +03:00] Moscow Standard Time, Eastern African Time',
48 '+0330' =>
'[GMT +03:30] Iran Standard Time',
49 '+0400' =>
'[GMT +04:00] Gulf Standard Time, Samara Standard Time',
50 '+0430' =>
'[GMT +04:30] Afghanistan Time',
51 '+0500' =>
'[GMT +05:00] Pakistan Standard Time, Yekaterinburg Standard Time',
52 '+0530' =>
'[GMT +05:30] Indian Standard Time, Sri Lanka Time',
53 '+0545' =>
'[GMT +05:45] Nepal Time',
54 '+0600' =>
'[GMT +06:00] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time',
55 '+0630' =>
'[GMT +06:30] Cocos Islands Time, Myanmar Time',
56 '+0700' =>
'[GMT +07:00] Indochina Time, Krasnoyarsk Standard Time',
57 '+0800' =>
'[GMT +08:00] China Standard Time, Australian Western Standard Time, Irkutsk Standard Time',
58 '+0845' =>
'[GMT +08:45] Southeastern Western Australia Standard Time',
59 '+0900' =>
'[GMT +09:00] Korea Standard Time, Japan Standard Time',
60 '+0930' =>
'[GMT +09:30] Australian Central Standard Time',
61 '+1000' =>
'[GMT +10:00] Australian Eastern Standard Time, Vladivostok Standard Time',
62 '+1030' =>
'[GMT +10:30] Lord Howe Standard Time',
63 '+1100' =>
'[GMT +11:00] Solomon Island Time, Magadan Standard Time',
64 '+1130' =>
'[GMT +11:30] Norfolk Island Time',
65 '+1200' =>
'[GMT +12:00] New Zealand Time, Fiji Time, Kamchatka Standard Time',
66 '+1245' =>
'[GMT +12:45] Chatham Islands Time',
67 '+1300' =>
'[GMT +13:00] Tonga Time, Phoenix Islands Time',
68 '+1400' =>
'[GMT +14:00] Line Island Time'
79 function getModule($module_name, $type =
'view', $kind =
'')
92 return getModule($module_name,
'controller');
103 return getModule($module_name,
'controller',
'admin');
125 return getModule($module_name,
'mobile');
136 return getModule($module_name,
'view',
'admin');
158 return getModule($module_name,
'model',
'admin');
206 return $oDB->executeQuery($query_id,
$args, $arg_columns);
222 $output = $oDB->executeQuery($query_id,
$args, $arg_columns);
239 $seq = $oDB->getNextSequence();
253 if(isset($_SESSION[
'seq']))
255 if(!is_array($_SESSION[
'seq'])) {
256 $_SESSION[
'seq'] = array($_SESSION[
'seq']);
258 $arr_seq = $_SESSION[
'seq'];
261 $_SESSION[
'seq'] = $arr_seq;
272 if(!isset($_SESSION[
'seq']))
276 if(!in_array($seq, $_SESSION[
'seq']))
299 $num_args = func_num_args();
300 $args_list = func_get_args();
307 return preg_replace(
'@\berror_return_url=[^&]*|\w+=(?:&|$)@',
'', $url);
318 $num_args = func_num_args();
319 $args_list = func_get_args();
330 return preg_replace(
'@\berror_return_url=[^&]*|\w+=(?:&|$)@',
'', $url);
341 $num_args = func_num_args();
342 $args_list = func_get_args();
353 return preg_replace(
'@\berror_return_url=[^&]*|\w+=(?:&|$)@',
'', $url);
363 $num_args = func_num_args();
364 $args_list = func_get_args();
372 if(strncasecmp(
'http', $url, 4) !== 0)
374 preg_match(
'/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
375 return substr($match[0], 0, -1) . $url;
387 $num_args = func_num_args();
388 $args_list = func_get_args();
396 if(strncasecmp(
'http', $url, 4) !== 0)
398 preg_match(
'/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
400 return substr($match[0], 0, -1) . $url;
413 $num_args = func_num_args();
414 $args_list = func_get_args();
421 $domain = array_shift($args_list);
422 $num_args = count($args_list);
435 $num_args = func_num_args();
436 $args_list = func_get_args();
443 $domain = array_shift($args_list);
444 $num_args = count($args_list);
456 $num_args = func_num_args();
457 $args_list = func_get_args();
465 $domain = array_shift($args_list);
466 $num_args = count($args_list);
469 if(strncasecmp(
'http', $url, 4) !== 0)
471 preg_match(
'/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
472 return substr($match[0], 0, -1) . $url;
484 $protocol = $_SERVER[
'HTTPS'] ==
'on' ?
'https://' :
'http://';
485 $url = $protocol . $_SERVER[
'HTTP_HOST'] . preg_replace(
'/[<>"]/',
'', $_SERVER[
'REQUEST_URI']);
486 return htmlspecialchars($url, ENT_COMPAT,
'UTF-8', FALSE);
497 return preg_match(
'/^([a-zA-Z0-9\_]+)$/', $domain);
508 function cut_str($string, $cut_size = 0, $tail =
'...')
510 if($cut_size < 1 || !$string)
515 if(
$GLOBALS[
'use_mb_strimwidth'] || function_exists(
'mb_strimwidth'))
517 $GLOBALS[
'use_mb_strimwidth'] = TRUE;
518 return mb_strimwidth($string, 0, $cut_size + 4, $tail,
'utf-8');
521 $chars = array(12, 4, 3, 5, 7, 7, 11, 8, 4, 5, 5, 6, 6, 4, 6, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 8, 6, 8, 6, 10, 8, 8, 9, 8, 8, 7, 9, 8, 3, 6, 7, 7, 11, 8, 9, 8, 9, 8, 8, 7, 8, 8, 10, 8, 8, 8, 6, 11, 6, 6, 6, 4, 7, 7, 7, 7, 7, 3, 7, 7, 3, 3, 6, 3, 9, 7, 7, 7, 7, 4, 7, 3, 7, 6, 10, 6, 6, 7, 6, 6, 6, 9);
522 $max_width = $cut_size * $chars[0] / 2;
525 $string_length = strlen($string);
529 while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
531 $c = ord(substr($string, $idx, 1));
535 $char_width += (int) $chars[$c - 32];
538 else if(191 < $c && $c < 224)
540 $char_width += $chars[4];
545 $char_width += $chars[0];
550 $output = substr($string, 0, $idx);
551 if(strlen(
$output) < $string_length)
579 $server_time_zone = date(
"O");
580 if($server_time_zone < 0)
589 $c_hour = substr($server_time_zone, 1, 2) * $so;
590 $c_min = substr($server_time_zone, 3, 2) * $so;
592 $g_min = $t_min - $c_min;
593 $g_hour = $t_hour - $c_hour;
595 $gap = $g_min * 60 + $g_hour * 60 * 60;
611 if (strlen($str) === 9 || (strlen($str) === 10 && $str <= 2147483647))
616 $hour = (int) substr($str, 8, 2);
617 $min = (int) substr($str, 10, 2);
618 $sec = (int) substr($str, 12, 2);
619 $year = (int) substr($str, 0, 4);
620 $month = (int) substr($str, 4, 2);
621 $day = (int) substr($str, 6, 2);
622 if(strlen($str) <= 8)
631 return mktime($hour, $min, $sec, $month ? $month : 1, $day ? $day : 1, $year) + $gap;
643 $gap = $_SERVER[
'REQUEST_TIME'] +
zgap() -
ztime($date);
648 $buff = sprintf($lang_time_gap[
'min'], (
int) ($gap / 60) + 1);
650 elseif($gap < 60 * 60)
652 $buff = sprintf($lang_time_gap[
'mins'], (
int) ($gap / 60) + 1);
654 elseif($gap < 60 * 60 * 2)
656 $buff = sprintf($lang_time_gap[
'hour'], (
int) ($gap / 60 / 60) + 1);
658 elseif($gap < 60 * 60 * 24)
660 $buff = sprintf($lang_time_gap[
'hours'], (
int) ($gap / 60 / 60) + 1);
664 $buff =
zdate($date, $format);
679 $short_month = array(
'',
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec');
680 $long_month = array(
'',
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December');
681 return !$short ? $long_month[$month] : $short_month[$month];
692 function zdate($str, $format =
'Y-m-d H:i:s', $conversion = TRUE)
700 if($conversion == TRUE)
706 if($format ==
'Y-m-d')
710 elseif($format ==
'Y-m-d H:i:s')
712 $format =
'M d, Y H:i:s';
714 elseif($format ==
'Y-m-d H:i')
716 $format =
'M d, Y H:i';
720 if($format ==
'Y-m-d')
724 elseif($format ==
'Y-m-d H:i:s')
726 $format =
'H:i:s d-m-Y';
728 elseif($format ==
'Y-m-d H:i')
730 $format =
'H:i d-m-Y';
737 if((
int) substr($str, 0, 4) < 1970)
739 $hour = (int) substr($str, 8, 2);
740 $min = (int) substr($str, 10, 2);
741 $sec = (int) substr($str, 12, 2);
742 $year = (int) substr($str, 0, 4);
743 $month = (int) substr($str, 4, 2);
744 $day = (int) substr($str, 6, 2);
748 'y' => sprintf(
'%02d', $year % 100),
749 'm' => sprintf(
'%02d', $month),
751 'd' => sprintf(
'%02d', $day),
754 'H' => sprintf(
'%02d', $hour),
756 'h' => sprintf(
'%02d', $hour % 12),
757 'i' => sprintf(
'%02d', $min),
758 's' => sprintf(
'%02d', $sec),
763 $string = strtr($format, $trans);
768 $string = date($format,
ztime($str));
773 $string = str_replace(array(
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'), $unit_week, $string);
774 $string = str_replace(array(
'am',
'pm',
'AM',
'PM'), $unit_meridiem, $string);
787 for($i = 0, $c = strlen($email); $i < $c; $i++)
789 $return .=
'&#' . (rand(0, 1) == 0 ? ord($email[$i]) :
'X' . dechex(ord($email[$i]))) .
';';
805 function debugPrint($debug_output = NULL, $display_option = TRUE, $file =
'_debug_message.php')
815 $bt = debug_backtrace();
818 $bt_debug_print = array_shift($bt);
819 $bt_called_function = array_shift($bt);
821 $file_name = str_replace(
_XE_PATH_,
'', $bt_debug_print[
'file']);
822 $line_num = $bt_debug_print[
'line'];
823 $function = $bt_called_function[
'class'] . $bt_called_function[
'type'] . $bt_called_function[
'function'];
825 if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION,
'6.0.0') === -1)
829 $firephp = FirePHP::getInstance(TRUE);
831 $type = FirePHP::INFO;
836 if($display_option ===
'TABLE')
838 $label = $display_option;
840 if($display_option ===
'ERROR')
842 $type = $display_option;
845 if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER[
'REMOTE_ADDR'])
847 $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';
851 $firephp->fb($debug_output, $label, $type);
855 if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER[
'REMOTE_ADDR'])
863 $debug_file =
_XE_PATH_ .
'files/' . $file;
865 if(!file_exists($debug_file)) $print[] =
'<?php exit() ?>';
867 if($display_option === TRUE || $display_option ===
'ERROR')
869 $print[] = sprintf(
"[%s %s:%d] %s() - mem(%s)", date(
'Y-m-d H:i:s'), $file_name, $line_num, $function,
FileHandler::filesize(memory_get_usage()));;
870 $print[] = str_repeat(
'=', 80);
872 $type = gettype($debug_output);
873 if(!in_array($type, array(
'array',
'object',
'resource')))
875 if($display_option ===
'ERROR')
877 $print[] =
'ERROR : ' . var_export($debug_output, TRUE);
881 $print[] =
'DEBUG : ' . $type .
'(' . var_export($debug_output, TRUE) .
')';
886 $print[] =
'DEBUG : ' . trim(preg_replace(
'/\r?\n/',
"\n" .
' ', print_r($debug_output,
true)));
888 $backtrace_args = defined(
'\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
889 $backtrace = debug_backtrace($backtrace_args);
891 if(count($backtrace) > 1 && $backtrace[1][
'function'] ===
'debugPrint' && !$backtrace[1][
'class'])
893 array_shift($backtrace);
895 foreach($backtrace as $val)
897 $print[] =
' - ' . $val[
'file'] .
' : ' . $val[
'line'];
900 @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
911 if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__)
return;
913 static $log_filename = array(
914 'query' =>
'files/_slowlog_query.php',
915 'trigger' =>
'files/_slowlog_trigger.php',
916 'addon' =>
'files/_slowlog_addon.php',
917 'widget' =>
'files/_slowlog_widget.php'
921 $log_file =
_XE_PATH_ . $log_filename[$type];
924 $buff[] =
'<?php exit(); ?>';
927 if($type ==
'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
929 $buff[] =
"\tCaller : " .
$obj->caller;
930 $buff[] =
"\tCalled : " .
$obj->called;
932 else if($type ==
'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
934 $buff[] =
"\tAddon : " .
$obj->called;
935 $buff[] =
"\tCalled position : " .
$obj->caller;
937 else if($type ==
'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
939 $buff[] =
"\tWidget : " .
$obj->called;
941 else if($type ==
'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
944 $buff[] =
$obj->query;
945 $buff[] =
"\tQuery ID : " .
$obj->query_id;
946 $buff[] =
"\tCaller : " .
$obj->caller;
947 $buff[] =
"\tConnection : " .
$obj->connection;
956 $buff[] = sprintf(
"\t%0.6f sec", $elapsed_time);
957 $buff[] = PHP_EOL . PHP_EOL;
958 file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
963 $trigger_args =
$obj;
964 $trigger_args->_log_type = $type;
965 $trigger_args->_elapsed_time = $elapsed_time;
975 $trigger_args =
new stdClass();
976 $trigger_args->_log_type =
'flush';
977 $trigger_args->_elapsed_time = 0;
988 list($time1, $time2) = explode(
' ', microtime());
989 return (
float) $time1 + (float) $time2;
1001 if(!is_object($target_obj))
1005 if(!is_object($del_obj))
1010 $target_vars = get_object_vars($target_obj);
1011 $del_vars = get_object_vars($del_obj);
1013 $target = array_keys($target_vars);
1014 $del = array_keys($del_vars);
1015 if(!count($target) || !count($del))
1020 $return_obj =
new stdClass();
1022 $target_count = count($target);
1023 for($i = 0; $i < $target_count; $i++)
1025 $target_key = $target[$i];
1026 if(!in_array($target_key, $del))
1028 $return_obj->{$target_key} = $target_obj->{$target_key};
1037 $del_vars = array(
'error_return_url',
'success_return_url',
'ruleset',
'xe_validator_id');
1039 foreach($del_vars as $var)
1041 if(is_array($vars)) unset($vars[$var]);
1042 else if(is_object($vars)) unset($vars->$var);
1063 $errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
1064 if(!in_array($errno, $errors))
1069 $output = sprintf(
"Fatal error : %s - %d", $file, $line);
1070 $output .= sprintf(
"%d - %s", $errno, $errstr);
1083 $mod = pow(10, $size);
1084 $output = sprintf(
'%0' . $size .
'd/', $no % $mod);
1100 return preg_replace(
'/%u([[:alnum:]]{4})/',
'&#x\\1;', $str);
1105 require_once(
_XE_PATH_ .
'classes/security/Purifier.class.php');
1111 $oPurifier->setConfig(
'HTML.Nofollow',
true);
1114 $oPurifier->purify($content);
1125 require_once(
_XE_PATH_ .
'classes/security/EmbedFilter.class.php');
1127 $oEmbedFilter->check($content);
1132 $content = preg_replace(
'@<(\/?(?:html|body|head|title|meta|base|link|script|style|applet)(/*).*?>)@i',
'<$1', $content);
1138 $content = preg_replace_callback(
'@<(/?)([a-z]+[0-9]?)((?>"[^"]*"|\'[^\']*\'|[^>])*?\b(?:on[a-z]+|data|style|background|href|(?:dyn|low)?src)\s*=[\s\S]*?)(/?)($|>|<)@i',
'removeSrcHack', $content);
1154 $content = preg_replace(
'/(<(?:img|div)(?:[^>]*))(widget)(?:(=([^>]*?)>))/is',
'$1blocked-widget$3', $content);
1167 require_once(
_XE_PATH_ .
'classes/security/UploadFileFilter.class.php');
1179 $content = preg_replace(
'@<(/?)xmp.*?>@i',
'<\1xmp>', $content);
1181 if(($start_xmp = strrpos($content,
'<xmp>')) !== FALSE)
1183 if(($close_xmp = strrpos($content,
'</xmp>')) === FALSE)
1185 $content .=
'</xmp>';
1187 else if($close_xmp < $start_xmp)
1189 $content .=
'</xmp>';
1204 $tag = strtolower($match[2]);
1209 return "<{$match[1]}xmp>";
1217 $match[4] =
' ' . $match[4];
1221 if(preg_match_all(
'/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1223 foreach($m[1] as $idx => $name)
1225 if(strlen($name) >= 2 && substr_compare($name,
'on', 0, 2) === 0)
1230 $val = preg_replace_callback(
'/&#(?:x([a-fA-F0-9]+)|0*(\d+));/',
function($n) {
return chr($n[1] ? (
'0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]);
1231 $val = preg_replace(
'/^\s+|[\t\n\r]+/',
'', $val);
1233 if(preg_match(
'/^[a-z]+script:/i', $val))
1238 $attrs[$name] = $val;
1242 $filter_arrts = array(
'style',
'src',
'href');
1244 if($tag ===
'object') array_push($filter_arrts,
'data');
1245 if($tag ===
'param') array_push($filter_arrts,
'value');
1247 foreach($filter_arrts as $attr)
1249 if(!isset($attrs[$attr]))
continue;
1251 $attr_value = rawurldecode($attrs[$attr]);
1252 $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
1253 $attr_value = preg_replace(
'/\s+|[\t\n\r]+/',
'', $attr_value);
1254 if(preg_match(
'@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !==
'procFileDownload')
1256 unset($attrs[$attr]);
1260 if(isset($attrs[
'style']) && preg_match(
'@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs[
'style']))
1262 unset($attrs[
'style']);
1266 foreach($attrs as $name => $val)
1268 if($tag ==
'object' || $tag ==
'embed' || $tag ==
'a')
1270 $attribute = strtolower(trim($name));
1271 if($attribute ==
'data' || $attribute ==
'src' || $attribute ==
'href')
1273 if(stripos($val,
'data:') === 0)
1282 $attribute = strtolower(trim($name));
1283 if(stripos($val,
'data:') === 0)
1288 $val = str_replace(
'"',
'"', $val);
1289 $attr[] = $name .
"=\"{$val}\"";
1291 $attr = count($attr) ?
' ' . implode(
' ', $attr) :
'';
1293 return "<{$match[1]}{$tag}{$attr}{$match[4]}>";
1297 if(!function_exists(
'hexrgb'))
1306 function hexrgb($hexstr)
1308 $int = hexdec($hexstr);
1310 return array(
'red' => 0xFF & ($int >> 0x10),
1311 'green' => 0xFF & ($int >> 0x8),
1312 'blue' => 0xFF & $int);
1331 settype($password,
"string");
1333 for($i = 0; $i < strlen($password); $i++)
1335 if($password[$i] ==
' ' || $password[$i] ==
'\t')
1339 $tmp = ord($password[$i]);
1340 $nr ^= ((($nr & 63) + $add) * $tmp) + ($nr << 8);
1341 $nr2 += ($nr2 << 8) ^ $nr;
1344 $result1 = sprintf(
"%08lx", $nr & ((1 << 31) - 1));
1345 $result2 = sprintf(
"%08lx", $nr2 & ((1 << 31) - 1));
1347 if($result1 ==
'80000000')
1351 if($result2 ==
'80000000')
1356 return sprintf(
"%08lx%08lx", $nr, $nr2);
1369 $script_path = filter_var($_SERVER[
'SCRIPT_NAME'], FILTER_SANITIZE_STRING);
1370 $url = str_ireplace(
'/tools/',
'/', preg_replace(
'/index.php.*/i',
'', str_replace(
'\\',
'/', $script_path)));
1382 return str_replace(
'<',
'<', preg_replace(
'/[<>"]/',
'', $_SERVER[
'REQUEST_URI']));
1397 $len = strlen($source);
1400 $charAt = substr($source, $pos, 1);
1404 $charAt = substr($source, $pos, 1);
1409 $unicodeHexVal = substr($source, $pos, 4);
1410 $unicode = hexdec($unicodeHexVal);
1417 $hexVal = substr($source, $pos, 2);
1418 $decodedStr .= chr(hexdec($hexVal));
1424 $decodedStr .= $charAt;
1445 return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1449 return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1453 return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1466 function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)
1470 $string = urldecode($string);
1473 $sample = iconv(
'utf-8',
'utf-8', $string);
1474 $is_utf8 = (md5($sample) === md5($string));
1478 $string = urldecode($string);
1483 return ($is_utf8) ? $string : iconv(
'euc-kr',
'utf-8', $string);
1497 switch(gettype($data))
1500 return $data ?
'true' :
'false';
1505 return '"' . strtr($data, array(
'\\' =>
'\\\\',
'"' =>
'\\"')) .
'"';
1507 $data = get_object_vars($data);
1510 $key = array_keys($data);
1521 foreach($data as $k => $v)
1523 $arr[] = ($rel ?
'"' . strtr($k, array(
'\\' =>
'\\\\',
'"' =>
'\\"')) .
'":' :
'') .
json_encode2($v);
1526 return $rel ?
'{' . join(
',', $arr) .
'}' :
'[' . join(
',', $arr) .
']';
1542 $agent = $_SERVER[
'HTTP_USER_AGENT'];
1545 $check_agent = array(
'bot',
'spider',
'spyder',
'crawl',
'http://',
'google',
'yahoo',
'slurp',
'yeti',
'daum',
'teoma',
'fish',
'hanrss',
'facebook',
'yandex',
'infoseek',
'askjeeves',
'stackrambler');
1550 foreach($check_agent as $str)
1552 if(stristr($agent, $str) != FALSE)
1580 if($writer_member_srl)
1582 $oMemberModel =
getModel(
'member');
1583 $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);
1584 if($member_info->is_admin ==
"Y")
1589 $security_msg =
"<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" .
Context::getLang(
'security_warning_embed') .
"</p></div>";
1590 $content = preg_replace(
'/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content);
1591 $content = preg_replace(
'/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content);
1592 $content = preg_replace(
'/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content);
1605 static $required =
false;
1611 if(version_compare(PHP_VERSION,
"5.3.0") < 0)
1613 set_include_path(
_XE_PATH_ .
"libs/PEAR" . PATH_SEPARATOR . get_include_path());
1617 set_include_path(
_XE_PATH_ .
"libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1625 if($_SERVER[
'REQUEST_METHOD'] !=
'POST')
1631 $referer = $_SERVER[
"HTTP_REFERER"];
1633 if(strpos($default_url,
'xn--') !== FALSE && strpos($referer,
'xn--') === FALSE)
1635 require_once(
_XE_PATH_ .
'libs/idna_convert/idna_convert.class.php');
1637 $referer =
$IDN->encode($referer);
1640 $default_url = parse_url($default_url);
1641 $referer = parse_url($referer);
1646 if($siteModuleInfo->site_srl == 0)
1648 if($default_url[
'host'] !== $referer[
'host'])
1655 $virtualSiteInfo =
$oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1656 if(strtolower($virtualSiteInfo->domain) != strtolower(
Context::get(
'vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer[
'host'])))
1674 foreach($menu AS $key=>$value)
1676 if(!$value[
'isShow'])
1680 if(is_array($value[
'list']) && count($value[
'list']) > 0)
1690 if($requestKey != $dbKey)
1692 $arrayUrl = parse_url(
Context::get(
'success_return_url'));
1693 if($arrayUrl[
'query'])
1695 parse_str($arrayUrl[
'query'], $parsedStr);
1697 if(isset($parsedStr[$key]))
1699 $parsedStr[$key] = $requestKey;
1700 $successReturnUrl .= $arrayUrl[
'path'].
'?'.http_build_query($parsedStr);
1714 echo
'<!DOCTYPE html>
1717 <meta charset="utf-8" />
1729 echo
'</body></html>';
1745 echo
'<script type="text/javascript">
1747 alert("' . $msg .
'");
1759 echo
'<script type="text/javascript">
1774 $reloadScript = $isOpener ?
'window.opener.location.reload()' :
'document.location.reload()';
1776 echo
'<script type="text/javascript">
1778 ' . $reloadScript .
'
1786 return preg_match(
'!\$user_lang->([a-z0-9\_]+)$!is', trim($str));
1799 function escape($str, $double_escape =
true, $escape_defined_lang_code =
false)
1803 $flags = ENT_QUOTES | ENT_SUBSTITUTE;
1804 return htmlspecialchars($str, $flags,
'UTF-8', $double_escape);
1818 return preg_replace(
'/[^a-zA-Z0-9_.#\/-]/',
'', $str);
1832 $flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE;
1833 $str = json_encode((
string)$str, $flags);
1834 return substr($str, 1, strlen($str) - 2);
1849 return str_replace(array(
'\\0',
'\\"'), array(
'',
'"'), addslashes($str));
1864 return str_replace(array(
'\\0',
"\\'",
'$'), array(
'',
"'",
'\\$'), addslashes($str));
1883 if ($limit < 1) $limit = null;
1885 $split = preg_split(
'/(?<!' . preg_quote($escape_char,
'/') .
')' . preg_quote($delimiter,
'/') .
'/', $str, $limit);
1886 foreach ($split as $piece)
1888 if (trim($piece) !==
'')
1890 $result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece));
explode_with_escape($delimiter, $str, $limit=0, $escape_char= '\\')
getUrl($num_args=0, $args_list=array(), $domain=null, $encode=TRUE, $autoEncode=FALSE)
& getModuleInstance($module, $type= 'view', $kind= '')
getController($module_name)
getNumberingPath($no, $size=3)
handleError($errno, $errstr, $file, $line)
zdate($str, $format= 'Y-m-d H:i:s', $conversion=TRUE)
changeValueInUrl($key, $requestKey, $dbKey, $urlName= 'success_return_url')
recurciveExposureCheck(&$menu)
if(!function_exists('hexrgb')) mysql_pre4_hash_password($password)
blockWidgetCode($content)
stripEmbedTagForAdmin(&$content, $writer_member_srl)
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
debugPrint($debug_output=NULL, $display_option=TRUE, $file= '_debug_message.php')
set($key, $val, $set_to_get_vars=0)
getRequestUriByServerEnviroment()
delObjectVars($target_obj, $del_obj)
getMonthName($month, $short=TRUE)
filter($ip_list, $ip=NULL)
& getMobile($module_name)
getEncodeEmailAddress($email)
getAdminModel($module_name)
getInstance($db_type=NULL)
getAdminView($module_name)
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
detectUTF8($string, $return_convert=FALSE, $urldecode=TRUE)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
getTimeGap($date, $format= 'Y.m.d')
getAdminController($module_name)
cut_str($string, $cut_size=0, $tail= '...')
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
writeSlowlog($type, $elapsed_time, $obj)
utf8RawUrlDecode($source)
escape($str, $double_escape=true, $escape_defined_lang_code=false)
getModule($module_name, $type= 'view', $kind= '')
triggerCall($trigger_name, $called_position, &$obj)
static check($file, $filename=null)