';
- $error_string .= '[
'.$this->print_time().'] ';
+ $error_string .= '[
'.$this->printTime().'] ';
$error_string .= '[
'.$level.'] ';
$error_string .= '[
'.$this->host_name.'] ';
$error_string .= '[
'.$this->page_name.'] ';
@@ -509,10 +670,10 @@ class basic
$string = preg_replace("/(<\/?)(\w+)([^>]*>)/", "", $string);
}
// same string put for print (no html crap inside)
- $error_string_print = '['.$this->print_time().'] ['.$this->host_name.'] ['.$this->get_page_name(2).'] ['.$this->running_uid.'] {'.get_class($this).'} <'.$level.'> - '.$string;
+ $error_string_print = '['.$this->printTime().'] ['.$this->host_name.'] ['.$this->getPageName(2).'] ['.$this->running_uid.'] {'.get_class($this).'} <'.$level.'> - '.$string;
$error_string_print .= "\n";
// write to file if set
- $this->write_error_msg($level, $error_string_print);
+ $this->writeErrorMsg($level, $error_string_print);
// write to error level
if (($this->echo_output[$level] || $this->echo_output_all) && !$this->echo_output_not[$level]) {
$this->error_msg[$level] .= $error_string;
@@ -520,12 +681,13 @@ class basic
}
}
- // METHOD: get_caller_method
- // PARAMS: none (optional later: which level to deb ug)
- // RETURN: null or the function that called the function where this methid is called
- // DESC : if there is a need to find out which parent method called a child method, eg for debugging, this function does this
- // call this method in the child method and you get the parent function that called it
- public function get_caller_method($level = 2)
+ // METHOD getCallerMethod
+ // WAS get_caller_method
+ // PARAMS none (optional later: which level to deb ug)
+ // RETURN null or the function that called the function where this methid is called
+ // DESC if there is a need to find out which parent method called a child method, eg for debugging, this function does this
+ // call this method in the child method and you get the parent function that called it
+ public function getCallerMethod($level = 2)
{
$traces = debug_backtrace();
// extended info (later)
@@ -544,12 +706,13 @@ class basic
return null;
}
- // METHOD merge_errors
+ // METHOD mergeErrors
+ // WAS merge_errors
// PARAMS error array
// RETURN none
// DESC merges the given error array with the one from this class
// only merges visible ones
- public function merge_errors($error_msg = array ())
+ public function mergeErrors($error_msg = array ())
{
if (!is_array($error_msg)) {
$error_msg = array ();
@@ -559,19 +722,20 @@ class basic
}
}
- // METHOD print_error_msg
+ // METHOD printErrorMsg
+ // WAS print_error_msg
// PARAMS $string: prefix string for header
// RETURN error msg for all levels
// DESCRIPTION
// prints out the error string
- public function print_error_msg($string = '')
+ public function printErrorMsg($string = '')
{
$string_output = '';
if ($this->debug_output_all) {
if ($this->error_msg_prefix) {
$string = $this->error_msg_prefix;
}
- $script_end = $this->running_time();
+ $script_end = $this->runningTime();
while (list($level, $temp_debug_output) = each($this->error_msg)) {
if (($this->debug_output[$level] || $this->debug_output_all) && !$this->debug_output_not[$level]) {
if (($this->echo_output[$level] || $this->echo_output_all) && !$this->echo_output_not[$level]) {
@@ -592,12 +756,13 @@ class basic
return $string_output;
}
- // METHOD write_error_msg
+ // METHOD writeErrorMsg
+ // WAS write_error_msg
// PARAMS $level: the level to write
// RETURN none
// DESCRIPTION
// writes error msg data to file for current level
- private function write_error_msg($level, $error_string)
+ private function writeErrorMsg($level, $error_string)
{
if (($this->debug_output[$level] || $this->debug_output_all) && !$this->debug_output_not[$level]) {
// only write if write is requested
@@ -639,7 +804,7 @@ class basic
$rpl_string = !$this->log_per_class ? '' : '_'.get_class($this); // set sub class settings
$fn = str_replace('##CLASS##', $rpl_string, $fn); // create output filename
- $rpl_string = !$this->log_per_page ? '' : '_'.$this->get_page_name(1); // if request to write to one file
+ $rpl_string = !$this->log_per_page ? '' : '_'.$this->getPageName(1); // if request to write to one file
$fn = str_replace('##PAGENAME##', $rpl_string, $fn); // create output filename
// write to file
@@ -659,13 +824,14 @@ class basic
}
}
- // METHOD reset_error_msg
+ // METHOD resetErrorMsg
+ // WAS reset_error_msg
// PARAMS level -> optional level
// RETURN none
// DESC unsests the error message array
// can be used if writing is primary to file
// if no level given resets all
- public function reset_error_msg($level = '')
+ public function resetErrorMsg($level = '')
{
if (!$level) {
unset($this->error_msg);
@@ -674,14 +840,15 @@ class basic
}
}
- // METHOD ErrorHandler
+ // METHOD errorHandler
+ // WAS ErrorHandler
// PARAMS none
// RETURN none
// DESC catch function to handle all errors that are not handled by php itself
// eg all errors that would be surpressed are written to a log file if this function is enabled
// to use it call with set_error_handler(array("baisc", "ErrorHandler"));
// NOTE: this will only catch any additional erros created AFTER the set_error_hanlder was set, so mostly no strict/notices from the classes are visible
- public static function ErrorHandler($type, $message, $file, $line, $context)
+ public static function errorHandler($type, $message, $file, $line, $context)
{
// error levels for PHP
// values based on 5.3
@@ -712,12 +879,13 @@ class basic
return false;
}
- // METHOD print_ar
+ // METHOD printAr
+ // WAS print_ar
// PARAMS $array
// RETURN string html formatted
// DESCRIPTION
// prints a html formatted (pre) array
- public static function print_ar($array)
+ public static function printAr($array)
{
return "
".print_r($array, 1)."
";
}
@@ -743,14 +911,15 @@ class basic
}
}
- // METHOD magic_links
+ // METHOD magicLinks
+ // WAS magic_links
// PARAMS string: data to transform to a valud HTML url, target: default _blank
// RETURN correctly formed html url link
// DESCRIPTION
// tries to find mailto:user@bubu.at and changes it into ->
E-Mail senden
// or tries to take any url (http, ftp, etc) and transform it into a valid URL
// the string is in the format: some url|name#css|, same for email
- public function magic_links($string, $target = "_blank")
+ public function magicLinks($string, $target = "_blank")
{
$output = $string;
$protList = array("http", "https", "ftp", "news", "nntp");
@@ -786,7 +955,7 @@ class basic
$output = preg_replace_callback(
"/(href=\")?(\>)?\b($protRegex)([\w\.\-?&=+%#~,;\/]+)\b([\.\-?&=+%#~,;\/]*)(\|([^\||^#]+)(#([^\|]+))?\|)?/",
function ($matches) use ($self) {
- return @$self->create_url($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
+ return @$self->createUrl($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
},
$output
);
@@ -794,7 +963,7 @@ class basic
$output = preg_replace_callback(
"/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
function ($matches) use ($self) {
- return @$self->create_email($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
+ return @$self->createEmail($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
},
$output
);
@@ -813,7 +982,8 @@ class basic
return $output;
}
- // METHOD create_url [INTERNAL]
+ // METHOD createUrl [INTERNAL]
+ // WAS create_url
// PARAMS url link, anchor tag (define both type or url),
// _1, _2, _3 = part of thel URL, if atag is set, _1 is not used
// target: link target, name: name for the url, if not given _2 + _3 is used
@@ -822,7 +992,7 @@ class basic
// DESCRIPTION
// internal function, called by the magic url create functions.
// checks if title $_4 exists, if not, set url as title
- private function create_url($href, $atag, $_1, $_2, $_3, $name, $class)
+ private function createUrl($href, $atag, $_1, $_2, $_3, $name, $class)
{
// $this->debug('URL', "1: $_1 - 2: $_2 - $_3 - atag: $atag - name: $name - class: $class");
// if $_1 ends with //, then we strip $_1 complete & target is also blanked (its an internal link)
@@ -842,14 +1012,15 @@ class basic
}
}
- // METHOD create_email [INTERNAL]
- // PARAMS: email address, atag (define type of url)
+ // METHOD createEmail [INTERNAL]
+ // WAS create_email
+ // PARAMS email address, atag (define type of url)
// _1, _2, _3: parts of the email _1 before @, _2 after @, 3_ tld
// title: name for the link, if not given use email
// class: style sheet
// DESCRIPTION
// internal function for createing email, returns data to magic_url method
- private function create_email($mailto, $atag, $_1, $_2, $_3, $title, $class)
+ private function createEmail($mailto, $atag, $_1, $_2, $_3, $title, $class)
{
$email = $_1."@".$_2.".".$_3;
if (!$mailto && !$atag) {
@@ -861,12 +1032,13 @@ class basic
}
}
- // METHOD get_host_name
+ // METHOD getHostName
+ // WAS get_host_name
// PARAMS none
// RETURN host name
// DESCRIPTION
// get the host name without the port as given by the SELF var
- public function get_host_name()
+ public function getHostName()
{
$port = '';
if ($_SERVER['HTTP_HOST'] && preg_match("/:/", $_SERVER['HTTP_HOST'])) {
@@ -880,14 +1052,15 @@ class basic
return $host_name;
}
- // METHOD get_page_name
+ // METHOD getPageName
+ // WAS get_page_name
// PARAMS 1: strip page file name extension
// 0: keep filename as is
// 2: keep filename as is, but add dirname too
// RETURN filename
// DESCRIPTION
// get the page name of the curronte page:
- public static function get_page_name($strip_ext = 0)
+ public static function getPageName($strip_ext = 0)
{
// get the file info
$page_temp = pathinfo($_SERVER["PHP_SELF"]);
@@ -900,18 +1073,20 @@ class basic
}
}
- // METHOD get_file_name_ending
+ // METHOD getFilenameEnding
+ // WAS get_filename_ending
// PARAMS filename
// RETURN extension of the file name
// DESCRIPTION
// quick return the extension of the given file name
- public static function get_filename_ending($filename)
+ public static function getFilenameEnding($filename)
{
$page_temp = pathinfo($filename);
return $page_temp['extension'];
}
- // METHOD array_search_recursive
+ // METHOD arraySearchRecursive
+ // WAS array_search_recursive
// PARAMS needle (search for)
// haystack (search in)
// key_lookin: the key to look out for, default empty
@@ -919,7 +1094,7 @@ class basic
// DESCRIPTION
// searches key = value in an array / array
// only returns the first one found
- public static function array_search_recursive($needle, $haystack, $key_lookin = "")
+ public static function arraySearchRecursive($needle, $haystack, $key_lookin = "")
{
$path = null;
if (!is_array($haystack)) {
@@ -937,7 +1112,7 @@ class basic
//echo "FOO FOUND $needle | $key | $val
";
$path[] = $key;
break;
- } elseif (is_array($val) && $path = basic::array_search_recursive($needle, $val, $key_lookin)) {
+ } elseif (is_array($val) && $path = basic::arraySearchRecursive($needle, $val, $key_lookin)) {
//echo "BAS FOUND $needle | ".print_r($path)."
";
array_unshift($path, $key);
break;
@@ -947,7 +1122,8 @@ class basic
return $path;
}
- // METHOD array_search_recursive_all
+ // METHOD arraySearchRecursiveAll
+ // WAS array_search_recursive_all
// PARAMS needle (search for)
// haystack (search in)
// key: the key to look for in
@@ -955,7 +1131,7 @@ class basic
// RETURN all array elements paths where the element was found
// DESCRIPTION
// recursive array search function, which returns all found not only the first one
- public static function array_search_recursive_all($needle, $haystack, $key, $path = null)
+ public static function arraySearchRecursiveAll($needle, $haystack, $key, $path = null)
{
if (!isset($path['level'])) {
$path['level'] = 0;
@@ -983,7 +1159,7 @@ class basic
// we will up a level
$path['level'] += 1;
// call recursive
- $path = basic::array_search_recursive_all($needle, $_value, $key, $path);
+ $path = basic::arraySearchRecursiveAll($needle, $_value, $key, $path);
}
}
// cut all that is >= level
@@ -993,12 +1169,13 @@ class basic
return $path;
}
- // METHOD array_search_simple
+ // METHOD arraySearchSimple
+ // WAS array_search_simple
// PARAMS array (search in), key (key to search in), value (what to find
// RETURN true on found, false on not found
// DESCRIPTION
// array search simple. looks for key, value combination, if found, returns true
- public static function array_search_simple($array, $key, $value)
+ public static function arraySearchSimple($array, $key, $value)
{
if (!is_array($array)) {
$array = array ();
@@ -1007,7 +1184,7 @@ class basic
// if value is an array, we search
if (is_array($_value)) {
// call recursive, and return result if it is true, else continue
- if (($result = basic::array_search_simple($_value, $key, $value)) !== false) {
+ if (($result = basic::arraySearchSimple($_value, $key, $value)) !== false) {
return $result;
}
} elseif ($_key == $key && $_value = $value) {
@@ -1018,12 +1195,13 @@ class basic
return false;
}
- // METHOD _mb_mime_encode
+ // METHOD __mbMimeEncode
+ // WAS _mb_mime_encode
// PARAMS string to encode, encoding to encode in
// RETURN encoded string
// DESCRIPTION
// wrapper function for mb mime convert, for correct conversion with long strings
- public static function _mb_mime_encode($string, $encoding)
+ public static function __mbMimeEncode($string, $encoding)
{
// set internal encoding, so the mimeheader encode works correctly
mb_internal_encoding($encoding);
@@ -1051,11 +1229,12 @@ class basic
return $string;
}
- // METHOD: ByteStringFormat
- // PARAMS: int bytes, boolean for space, default is set
- // RETURN: string
- // DESC: converts bytes into formated string with KB, MB, etc
- public static function ByteStringFormat($number, $space = true)
+ // METHOD byteStringFormat
+ // WAS ByteStringFormat
+ // PARAMS int bytes, boolean for space, default is set
+ // RETURN string
+ // DESC converts bytes into formated string with KB, MB, etc
+ public static function byteStringFormat($number, $space = true)
{
if (is_numeric($number) && $number > 0) {
// labels in order of size
@@ -1066,11 +1245,12 @@ class basic
return $number;
}
- // METHOD: StringByteFormat
- // PARAMS: string
- // RETURN: int
- // DESC: calculates the bytes based on a string with nnG, nnM, etc
- public static function StringByteFormat($number)
+ // METHOD stringByteFormat
+ // WAS StringByteFormat
+ // PARAMS string
+ // RETURN int
+ // DESC calculates the bytes based on a string with nnG, nnM, etc
+ public static function stringByteFormat($number)
{
$number = trim($number);
$last = strtolower($number[strlen($number) - 1]);
@@ -1087,11 +1267,12 @@ class basic
return $number;
}
- // METHOD: DateStringFormat
- // PARAMS: unix timestamp, true/false to show microtime
- // RETURN: string formated date+time in Y-M-D h:m:s
- // DESC : a simple wrapper for the date format
- public static function DateStringFormat($timestamp, $show_micro = true)
+ // METHOD dateStringFormat
+ // WAS DateStringFormat
+ // PARAMS unix timestamp, true/false to show microtime
+ // RETURN string formated date+time in Y-M-D h:m:s
+ // DESC a simple wrapper for the date format
+ public static function dateStringFormat($timestamp, $show_micro = true)
{
list ($timestamp, $ms) = explode('.', round($timestamp, 4));
if ($show_micro) {
@@ -1102,11 +1283,12 @@ class basic
return $string;
}
- // METHOD: TimeStringFormat
- // PARAMS: seconds
- // RETURN: formated time string
- // DESC: formats a timestamp into time from. not a date
- public static function TimeStringFormat($timestamp, $show_micro = true)
+ // METHOD timeStringFormat
+ // WAS TimeStringFormat
+ // PARAMS seconds
+ // RETURN formated time string
+ // DESC formats a timestamp into time from. not a date
+ public static function timeStringFormat($timestamp, $show_micro = true)
{
// check if the timestamp has any h/m/s/ms inside, if yes skip
if (!preg_match("/(h|m|s|ms)/", $timestamp)) {
@@ -1137,12 +1319,13 @@ class basic
return $time_string;
}
- // METHOD: StringToTime
- // PARAMS: TimeStringFormat string
- // RETURN: timestamp with microseconds
- // DESC : does a reverse of the TimeStringFormat and converts the string from
+ // METHOD stringToTime
+ // WAS StringToTime
+ // PARAMS TimeStringFormat string
+ // RETURN timestamp with microseconds
+ // DESC does a reverse of the TimeStringFormat and converts the string from
// xd xh xm xs xms to a timestamp.microtime format
- public static function StringToTime($timestring)
+ public static function stringToTime($timestring)
{
$timestamp = '';
if (preg_match("/(d|h|m|s|ms)/", $timestring)) {
@@ -1163,11 +1346,12 @@ class basic
}
}
- // METHOD: GenAssocArray
- // PARAMS: db array, key, value part, flag if set all or only set
- // RETURN: returns and associative array
- // DESC: creates out of a normal db_return array an assoc array
- public static function GenAssocArray($db_array, $key, $value, $set_only = 0)
+ // METHOD genAssocArray
+ // WAS GenAssocArray
+ // PARAMS db array, key, value part, flag if set all or only set
+ // RETURN returns and associative array
+ // DESC creates out of a normal db_return array an assoc array
+ public static function genAssocArray($db_array, $key, $value, $set_only = 0)
{
for ($i = 0; $i < count($db_array); $i ++) {
// if no key then we make an order reference
@@ -1182,11 +1366,12 @@ class basic
return $ret_array;
}
- // METHOD: CheckDate
- // PARAMS: date (YYYY-MM-DD)
- // RETURN: true if valid date, false if date not valid
- // DESC: splits & checks date, wrap around for check_date function
- public static function CheckDate($date)
+ // METHOD checkDate
+ // WAS CheckDate
+ // PARAMS date (YYYY-MM-DD)
+ // RETURN true if valid date, false if date not valid
+ // DESC splits & checks date, wrap around for check_date function
+ public static function checkDate($date)
{
list ($year, $month, $day) = preg_split("/[\/-]/", $date);
if (!$year || !$month || !$day) {
@@ -1198,11 +1383,12 @@ class basic
return true;
}
- // METHOD: CheckDateTime
- // PARAMS: date (YYYY-MM-DD) + time (HH:MM:SS), SS can be dropped
- // RETURN: true if valid date, false if date not valid
- // DESC: splits & checks date, wrap around for check_date function
- public static function CheckDateTime($datetime)
+ // METHOD checkDateTime
+ // WAS CheckDateTime
+ // PARAMS date (YYYY-MM-DD) + time (HH:MM:SS), SS can be dropped
+ // RETURN true if valid date, false if date not valid
+ // DESC splits & checks date, wrap around for check_date function
+ public static function checkDateTime($datetime)
{
list ($year, $month, $day, $hour, $min, $sec) = preg_split("/[\/\- :]/", $datetime);
if (!$year || !$month || !$day) {
@@ -1220,11 +1406,12 @@ class basic
return true;
}
- // METHOD: CompareDate
- // PARAMS: start_date, end_date (both: YYYY-MM-DD)
- // RETURN: -1 if the first date is smaller the last, 0 if both are equal, 1 if the end date is bigger than the last
- // DESC: splits & checks date, wrap around for check_date function
- public static function CompareDate($start_date, $end_date)
+ // METHOD compareDate
+ // WAS CompareDate
+ // PARAMS start_date, end_date (both: YYYY-MM-DD)
+ // RETURN -1 if the first date is smaller the last, 0 if both are equal, 1 if the end date is bigger than the last
+ // DESC splits & checks date, wrap around for check_date function
+ public static function compareDate($start_date, $end_date)
{
// pre check for empty or wrong
if ($start_date == '--' || $end_date == '--' || !$start_date || !$end_date) {
@@ -1261,11 +1448,12 @@ class basic
}
}
- // METHOD: CompareDateTime
- // PARAMS: start_datetime, end_datetime (both YYYY-MM-DD HH:mm:ss)
- // RETURN: -1 if the first date is smaller the last, 0 if both are equal, 1 if the end date is bigger than the last
- // DESC : compares the two dates + times. if seconds missing in one set, add :00, converts / to -
- public static function CompareDateTime($start_datetime, $end_datetime)
+ // METHOD compareDateTime
+ // WAS CompareDateTime
+ // PARAMS start_datetime, end_datetime (both YYYY-MM-DD HH:mm:ss)
+ // RETURN -1 if the first date is smaller the last, 0 if both are equal, 1 if the end date is bigger than the last
+ // DESC compares the two dates + times. if seconds missing in one set, add :00, converts / to -
+ public static function compareDateTime($start_datetime, $end_datetime)
{
// pre check for empty or wrong
if ($start_date == '--' || $end_date == '--' || !$start_date || !$end_date) {
@@ -1284,11 +1472,12 @@ class basic
}
}
- // METHOD: ArrayToString
- // PARAMS: array, connect char
- // RETRUN: string
- // DESC: wrapper for join, but checks if input is an array and if not returns null
- public static function ArrayToString($array, $connect_char)
+ // METHOD arrayToString
+ // WAS ArrayToString
+ // PARAMS array, connect char
+ // RETRUN string
+ // DESC wrapper for join, but checks if input is an array and if not returns null
+ public static function arrayToString($array, $connect_char)
{
if (is_array($array)) {
return join($connect_char, $array);
@@ -1297,17 +1486,18 @@ class basic
}
}
- // METHOD: CreateThumbnail
- // PARAMS: pic -> picture where from we create a thumbnail
- // x -> max x size of thumbnail
- // y -> max y size of thumbnail
- // dummy -> empty, or file_type to show an icon instead of nothing if file is not found
- // path -> if source start is not ROOT path, if empty ROOT is choosen
- // cache -> cache path, if not given TMP is used
- // clear cache -> if set to true, will create thumb all the tame
- // RETURN: thumbnail name
- // DESC: converts picture to a thumbnail with max x and max y size
- public static function CreateThumbnail($pic, $size_x, $size_y, $dummy = "", $path = "", $cache_source = "", $clear_cache = false)
+ // METHOD createThumbnail
+ // WAS CreateThumbnail
+ // PARAMS pic -> picture where from we create a thumbnail
+ // x -> max x size of thumbnail
+ // y -> max y size of thumbnail
+ // dummy -> empty, or file_type to show an icon instead of nothing if file is not found
+ // path -> if source start is not ROOT path, if empty ROOT is choosen
+ // cache -> cache path, if not given TMP is used
+ // clear cache -> if set to true, will create thumb all the tame
+ // RETURN thumbnail name
+ // DESC converts picture to a thumbnail with max x and max y size
+ public static function createThumbnail($pic, $size_x, $size_y, $dummy = "", $path = "", $cache_source = "", $clear_cache = false)
{
// get image type flags
$image_types = array (
@@ -1420,22 +1610,22 @@ class basic
return $this->checkConvertEncoding($string, $from_encoding, $to_encoding);
}
- // METHOD: checkConvertEncoding
- // PARAMS: string: string to test
- // from_encoding: source encoding of this string
- // to_encoding: target encoding of this string
- // RETURN: false if no problem
- // on error, return array with characters that failed in the convert
- // DESC: test if a string can be safely convert between encodings. mostly utf8 to shift jis
- // the default compare has a possibility of failure, especially with windows
- // it is recommended to the following in the script which uses this method:
- // mb_substitute_character(0x2234);
- // $class->mbErrorChar = '∴';
- // if check to Shift JIS
- // if check to ISO-2022-JP
- // if check to ISO-2022-JP-MS
- // set three dots (∴) as wrong character for correct convert error detect
- // (this char is used, because it is one of the least used ones)
+ // METHOD checkConvertEncoding
+ // PARAMS string: string to test
+ // from_encoding: source encoding of this string
+ // to_encoding: target encoding of this string
+ // RETURN false if no problem
+ // on error, return array with characters that failed in the convert
+ // DESC test if a string can be safely convert between encodings. mostly utf8 to shift jis
+ // the default compare has a possibility of failure, especially with windows
+ // it is recommended to the following in the script which uses this method:
+ // mb_substitute_character(0x2234);
+ // $class->mbErrorChar = '∴';
+ // if check to Shift JIS
+ // if check to ISO-2022-JP
+ // if check to ISO-2022-JP-MS
+ // set three dots (∴) as wrong character for correct convert error detect
+ // (this char is used, because it is one of the least used ones)
public function checkConvertEncoding($string, $from_encoding, $to_encoding)
{
// convert to target encoding and convert back
@@ -1482,11 +1672,12 @@ class basic
return $string;
}
- // METHOD: _crc32b
- // PARAMS: string
- // RETURN: old (wrong) crc32b hash
- // DESC: checks php version and if >=5.2.7 it will flip the string
- public function _crc32b($string)
+ // METHOD __crc32b
+ // WAS _crc32b
+ // PARAMS string
+ // RETURN old (wrong) crc32b hash
+ // DESC checks php version and if >=5.2.7 it will flip the string
+ public function __crc32b($string)
{
// do normal hash crc32b
$string = hash('crc32b', $string);
@@ -1498,26 +1689,28 @@ class basic
return $string;
}
- // METHOD: _sha1_short
- // PARAMS: string, flag to use sha
- // RETURN: sha1 short (9 chars), but current calls _crc32b
- // DESC : replacement for _crc32b call
- public function _sha1_short($string, $use_sha = false)
+ // METHOD __sha1Short
+ // WAS _sha1_short
+ // PARAMS string, flag to use sha
+ // RETURN sha1 short (9 chars), but current calls __crc32b
+ // DESC replacement for __crc32b call
+ public function __sha1Short($string, $use_sha = false)
{
if ($use_sha) {
return substr(hash('sha1', $string), 0, 9);
} else {
- return $this->_crc32b($string);
+ return $this->__crc32b($string);
}
}
- // METHOD: _hash
- // PARAMS: string, type of hash to use
- // RETURN: hashed string
- // DESC : replacemend for _crc32b call (alternate)
- // defaults to adler 32, fnv132, fnv1a32, joaat
- // all that create 8 char long hashes
- public function _hash($string, $hash_type = 'adler32')
+ // METHOD __hash
+ // WAS _hash
+ // PARAMS string, type of hash to use
+ // RETURN hashed string
+ // DESC replacemend for __crc32b call (alternate)
+ // defaults to adler 32, fnv132, fnv1a32, joaat
+ // all that create 8 char long hashes
+ public function __hash($string, $hash_type = 'adler32')
{
if (!in_array($hash_type, array('adler32', 'fnv132', 'fnv1a32', 'joaat'))) {
$hash_type = 'adler32';
@@ -1525,10 +1718,10 @@ class basic
return hash($hash_type, $string);
}
- // METHOD: checkPHPVersion
- // PARAMS: $min_version: minimum version. in format x, x.y or x.y.z
- // $max_version: default empty, else in same format as min version
- // RETURN: true if ok, false if not matching version
+ // METHOD checkPHPVersion
+ // PARAMS $min_version: minimum version. in format x, x.y or x.y.z
+ // $max_version: default empty, else in same format as min version
+ // RETURN true if ok, false if not matching version
public static function checkPHPVersion($min_version, $max_version = '')
{
// exit with false if the min/max strings are wrong
@@ -1570,12 +1763,12 @@ class basic
return false;
}
- // METHOD: cryptInit
- // PARAMS: none
- // RETURN: none
- // DESC: inits crypt settings for the crypt functions
- // this function NEEDS (!) to be called BEFORE any of the crypt functions is called
- // there is no auto init for this at the moment
+ // METHOD cryptInit
+ // PARAMS none
+ // RETURN none
+ // DESC inits crypt settings for the crypt functions
+ // this function NEEDS (!) to be called BEFORE any of the crypt functions is called
+ // there is no auto init for this at the moment
private function cryptInit()
{
// SET CRYPT SALT PREFIX:
@@ -1616,10 +1809,10 @@ class basic
}
}
- // METHOD: cryptSaltString
- // PARAMS: random string length, default is 22 (for blowfish crypt)
- // RETURN: random string
- // DESC: creates a random string from alphanumeric characters: A-Z a-z 0-9 ./
+ // METHOD cryptSaltString
+ // PARAMS random string length, default is 22 (for blowfish crypt)
+ // RETURN random string
+ // DESC creates a random string from alphanumeric characters: A-Z a-z 0-9 ./
private function cryptSaltString($nSize = 22)
{
// A-Z is 65,90
@@ -1643,10 +1836,10 @@ class basic
return $salt_string;
}
- // METHOD: cryptString
- // PARAMS: string to be crypted (one way)
- // RETURN: encrypted string
- // DESC: encrypts the string with blowfish and returns the full string + salt part that needs to be stored somewhere (eg DB)
+ // METHOD cryptString
+ // PARAMS string to be crypted (one way)
+ // RETURN encrypted string
+ // DESC encrypts the string with blowfish and returns the full string + salt part that needs to be stored somewhere (eg DB)
public function cryptString($string)
{
// the crypt prefix is set in the init of the class
@@ -1654,11 +1847,11 @@ class basic
return crypt($string, $this->cryptSaltPrefix.$this->cryptSaltString($this->cryptSaltSize).$this->cryptSaltSuffix);
}
- // METHOD: verifyCryptString
- // PARAMS: plain string (eg password)
- // full crypted string (from cryptString
- // RETURN: true on matching or false for not matching
- // DESC: compares the string with the crypted one, is counter method to cryptString
+ // METHOD verifyCryptString
+ // PARAMS plain string (eg password)
+ // full crypted string (from cryptString
+ // RETURN true on matching or false for not matching
+ // DESC compares the string with the crypted one, is counter method to cryptString
public function verifyCryptString($string, $crypt)
{
// the full crypted string needs to be passed on to the salt, so the init (for blowfish) and salt are passed on
@@ -1671,10 +1864,10 @@ class basic
// *** COLORS ***
- // METHOD: hex2rgb
- // PARAMS: hexstring, flag to return as string (true/false), string seperator: default: ,
- // RETURN: array with RGB or a string with the seperator
- // DESC: converts a hex RGB color to the int numbers
+ // METHOD hex2rgb
+ // PARAMS hexstring, flag to return as string (true/false), string seperator: default: ,
+ // RETURN array with RGB or a string with the seperator
+ // DESC converts a hex RGB color to the int numbers
public static function hex2rgb($hexStr, $returnAsString = false, $seperator = ',')
{
$hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); // Gets a proper hex string
@@ -1696,10 +1889,10 @@ class basic
return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; // returns the rgb string or the associative array
}
- // METHOD: rgb2hex
- // PARAMS: red, green, blue (0-255)
- // RETURN: string with hex rgb color plus # in front
- // DESC: converts the rgb values from int data to the valid rgb html hex string
+ // METHOD rgb2hex
+ // PARAMS red, green, blue (0-255)
+ // RETURN string with hex rgb color plus # in front
+ // DESC converts the rgb values from int data to the valid rgb html hex string
public static function rgb2hex($red, $green, $blue)
{
$hex_color = '#';
@@ -1710,10 +1903,10 @@ class basic
return $hex_color;
}
- // METHOD: rgb2hsb
- // PARAMS: red, green, blue (0-255)
- // RETURN: array with hue (0-360), sat (0-100%), brightness/value (0-100%)
- // DESC : converts RGB to HSB/V values
+ // METHOD rgb2hsb
+ // PARAMS red, green, blue (0-255)
+ // RETURN array with hue (0-360), sat (0-100%), brightness/value (0-100%)
+ // DESC converts RGB to HSB/V values
public static function rgb2hsb($r, $g, $b)
{
// check that rgb is from 0 to 255
@@ -1745,10 +1938,10 @@ class basic
return array(round($HUE), round((($MAX - $MIN) / $MAX) * 100), round($MAX * 100));
}
- // METHOD: hsb2rgb
- // PARAMS: hue (0-360), saturation (0-1), brightness/value (0-1)
- // RETURN: array with red, blue, green
- // DESC : converts HSB/V to RGB values RGB is full INT
+ // METHOD hsb2rgb
+ // PARAMS hue (0-360), saturation (0-1), brightness/value (0-1)
+ // RETURN array with red, blue, green
+ // DESC converts HSB/V to RGB values RGB is full INT
public static function hsb2rgb($H, $S, $V)
{
// check that H is 0 to 359, 360 = 0
@@ -1813,10 +2006,10 @@ class basic
return array(round($red * 255), round($gre * 255), round($blu * 255));
}
- // METHOD: rgb2hsl
- // PARAMS: red, blue, green (all 0-255)
- // RETURN: array with hue (0-360), saturation (0-100%) and luminance (0-100%)
- // DESC : converts a RGB (0-255) to HSL
+ // METHOD rgb2hsl
+ // PARAMS red, blue, green (all 0-255)
+ // RETURN array with hue (0-360), saturation (0-100%) and luminance (0-100%)
+ // DESC converts a RGB (0-255) to HSL
public static function rgb2hsl($r, $g, $b)
{
// check that rgb is from 0 to 255
@@ -1855,12 +2048,12 @@ class basic
}
}
- // METHOD: hsl2rgb
- // PARAMS: hue: 0-360 (degrees)
- // saturation: 0-1
- // luminance: 0-1
- // RETURN: array with RGB as full int
- // DESC : converts an HSL to RGB
+ // METHOD hsl2rgb
+ // PARAMS hue: 0-360 (degrees)
+ // saturation: 0-1
+ // luminance: 0-1
+ // RETURN array with RGB as full int
+ // DESC converts an HSL to RGB
public static function hsl2rgb($h, $s, $l)
{
$h = (1 / 360) * $h; // calc to internal convert value for hue
@@ -1892,10 +2085,10 @@ class basic
}
}
- // METHOD: rgb2html
- // PARAMS: red, green, blue
- // RETRUN: valid # prefix hex html color string
- // DESC : converts and int RGB to the HTML color string in hex format
+ // METHOD rgb2html
+ // PARAMS red, green, blue
+ // RETRUN valid # prefix hex html color string
+ // DESC converts and int RGB to the HTML color string in hex format
public static function rgb2html($red, $green, $blue)
{
// check that each color is between 0 and 255
@@ -1912,12 +2105,13 @@ class basic
return '#'.$red.$green.$blue;
}
- // METHOD: in_array_any
- // PARAMS: needle: array
- // haystack: array
- // RETURN: found elements: array
- // DESC: search for the needle array elements in haystack and return the ones found as an array, is there nothing found, it returns FALSE (boolean)
- public static function in_array_any($needle, $haystack)
+ // METHOD inArrayAny
+ // WAS in_array_any
+ // PARAMS needle: array
+ // haystack: array
+ // RETURN found elements: array
+ // DESC search for the needle array elements in haystack and return the ones found as an array, is there nothing found, it returns FALSE (boolean)
+ public static function inArrayAny($needle, $haystack)
{
if (!is_array($needle)) {
return false;
@@ -1938,11 +2132,11 @@ class basic
}
}
- // METHOD: getEmailType
- // PARAMS: email, short == false
- // RETURN: string for email type, eg "pc", "docomo", etc
- // DESC: guesses the email type (mostly for mobile) from the domain
- // if second is set to true, it will return short naming scheme (only provider)
+ // METHOD getEmailType
+ // PARAMS email, short == false
+ // RETURN string for email type, eg "pc", "docomo", etc
+ // DESC guesses the email type (mostly for mobile) from the domain
+ // if second is set to true, it will return short naming scheme (only provider)
public function getEmailType($email, $short = false)
{
// trip if there is no email address
@@ -1967,21 +2161,21 @@ class basic
}
}
- // METHOD: getShortEmailType
- // PARAMS: long email type (not email)
- // RETURN: short email type
- // DESC : gets the short email type from a long email type
+ // METHOD getShortEmailType
+ // PARAMS long email type (not email)
+ // RETURN short email type
+ // DESC gets the short email type from a long email type
public function getShortEmailType($email_type)
{
return $this->mobile_email_type_short[$email_type];
}
- // METHOD: printDateTime
- // PARAMS: year, month, day, hour, min: the date and time values
- // suffix: additional info printed after the date time variable in the drop down, also used for ID in the on change JS call
- // min_steps: default is 1 (minute), can set to anything, is used as sum up from 0
- // RETURN: HTML formated strings for drop down lists of date and time
- // DESC: print the date/time drop downs, used in any queue/send/insert at date/time place
+ // METHOD printDateTime
+ // PARAMS year, month, day, hour, min: the date and time values
+ // suffix: additional info printed after the date time variable in the drop down, also used for ID in the on change JS call
+ // min_steps: default is 1 (minute), can set to anything, is used as sum up from 0
+ // RETURN HTML formated strings for drop down lists of date and time
+ // DESC print the date/time drop downs, used in any queue/send/insert at date/time place
public static function printDateTime($year, $month, $day, $hour, $min, $suffix = '', $min_steps = 1)
{
// if suffix given, add _ before
@@ -2038,19 +2232,19 @@ class basic
return $string;
}
- // METHOD: htmlent
- // PARAMS: string to encode
- // RETURN: encoded string
- // DESC : full wrapper for html entities
+ // METHOD htmlent
+ // PARAMS string to encode
+ // RETURN encoded string
+ // DESC full wrapper for html entities
public function htmlent($string)
{
return htmlentities($string, ENT_COMPAT|ENT_HTML401, 'UTF-8', false);
}
- // METHOD: setFormToken
- // PARAMS: session name, if not set then default is form_token
- // RETURN: form token
- // DESC : sets a form token in a session and returns form token
+ // METHOD setFormToken
+ // PARAMS session name, if not set then default is form_token
+ // RETURN form token
+ // DESC sets a form token in a session and returns form token
public function setFormToken($name = 'form_token')
{
// current hard set to sha256
@@ -2059,12 +2253,14 @@ class basic
return $token;
}
- // METHOD: validateFormToken
- // PARAMS: form token, session name (default form_token)
- // RETURN: true or false
- // DESC : checks if the form token matches the session set form token
+ // METHOD validateFormToken
+ // PARAMS form token, session name (default form_token)
+ // RETURN true or false
+ // DESC checks if the form token matches the session set form token
public function validateFormToken($token, $name = 'form_token')
{
return $_SESSION[$name] === $token;
}
}
+
+# __END__
diff --git a/www/libs/Class.DB.Array.IO.inc b/www/lib/CoreLibs/DB/Extended/ArrayIO.inc
similarity index 100%
rename from www/libs/Class.DB.Array.IO.inc
rename to www/lib/CoreLibs/DB/Extended/ArrayIO.inc
diff --git a/www/libs/Class.DB.IO.inc b/www/lib/CoreLibs/DB/IO.inc
similarity index 100%
rename from www/libs/Class.DB.IO.inc
rename to www/lib/CoreLibs/DB/IO.inc
diff --git a/www/libs/db_pgsql.inc b/www/lib/CoreLibs/DB/SQL/PgSQL.inc
similarity index 100%
rename from www/libs/db_pgsql.inc
rename to www/lib/CoreLibs/DB/SQL/PgSQL.inc
diff --git a/www/libs/TRAIT_db_pgsql.inc b/www/lib/CoreLibs/DB/SQL/TRAIT_db_pgsql.inc
similarity index 100%
rename from www/libs/TRAIT_db_pgsql.inc
rename to www/lib/CoreLibs/DB/SQL/TRAIT_db_pgsql.inc
diff --git a/www/libs/db_pgsql_pdo.inc b/www/lib/CoreLibs/DB/SQL/db_pgsql_pdo.inc
similarity index 100%
rename from www/libs/db_pgsql_pdo.inc
rename to www/lib/CoreLibs/DB/SQL/db_pgsql_pdo.inc
diff --git a/www/lib/CoreLibs/Language/Core/FileReader.inc b/www/lib/CoreLibs/Language/Core/FileReader.inc
new file mode 100755
index 00000000..56ad959d
--- /dev/null
+++ b/www/lib/CoreLibs/Language/Core/FileReader.inc
@@ -0,0 +1,71 @@
+fr_length = filesize($filename);
+ $this->fr_pos = 0;
+ $this->fr_fd = fopen($filename, 'rb');
+ if (!$this->fr_fd) {
+ $this->error = 3; // Cannot read file, probably permissions
+ return false;
+ }
+ } else {
+ $this->error = 2; // File doesn't exist
+ return false;
+ }
+ }
+
+ public function read($bytes)
+ {
+ if ($bytes) {
+ fseek($this->fr_fd, $this->fr_pos);
+
+ // PHP 5.1.1 does not read more than 8192 bytes in one fread()
+ // the discussions at PHP Bugs suggest it's the intended behaviour
+ $data = '';
+ while ($bytes > 0) {
+ $chunk = fread($this->fr_fd, $bytes);
+ $data .= $chunk;
+ $bytes -= strlen($chunk);
+ }
+ $this->fr_pos = ftell($this->fr_fd);
+
+ return $data;
+ } else {
+ return '';
+ }
+ }
+
+ public function seekto($pos)
+ {
+ fseek($this->fr_fd, $pos);
+ $this->fr_pos = ftell($this->fr_fd);
+ return $this->fr_pos;
+ }
+
+ public function currentpos()
+ {
+ return $this->fr_pos;
+ }
+
+ public function length()
+ {
+ return $this->fr_length;
+ }
+
+ public function close()
+ {
+ fclose($this->fr_fd);
+ }
+}
+
+# __END__
diff --git a/www/libs/gettext.php b/www/lib/CoreLibs/Language/Core/GetTextReader.inc
old mode 100644
new mode 100755
similarity index 99%
rename from www/libs/gettext.php
rename to www/lib/CoreLibs/Language/Core/GetTextReader.inc
index 751deee7..f0f77eaa
--- a/www/libs/gettext.php
+++ b/www/lib/CoreLibs/Language/Core/GetTextReader.inc
@@ -20,6 +20,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+namespace CoreLibs\Language\Core;
+
/**
* Provides a simple gettext replacement that works independently from
* the system's gettext abilities.
@@ -32,7 +34,7 @@
* second parameter in the constructor (e.g. whenusing very large MO files
* that you don't want to keep in memory)
*/
-class gettext_reader
+class GetTextReader
{
// public:
public $error = 0; // public variable that holds error code (0 if no error)
@@ -244,7 +246,7 @@ class gettext_reader
if ($cmp == 0) {
// string is exactly in the middle => return it
return $half;
- } else if ($cmp < 0) {
+ } elseif ($cmp < 0) {
// The string is in the upper half
return $this->find_string($string, $start, $half);
} else {
@@ -454,3 +456,5 @@ class gettext_reader
}
}
}
+
+# __END__
\ No newline at end of file
diff --git a/www/libs/streams.php b/www/lib/CoreLibs/Language/Core/streams.php
similarity index 100%
rename from www/libs/streams.php
rename to www/lib/CoreLibs/Language/Core/streams.php
diff --git a/www/libs/Class.l10n.inc b/www/lib/CoreLibs/Language/l10.inc
similarity index 100%
rename from www/libs/Class.l10n.inc
rename to www/lib/CoreLibs/Language/l10.inc
diff --git a/www/libs/Class.Form.Generate.inc b/www/lib/CoreLibs/Output/Form/Generate.inc
similarity index 100%
rename from www/libs/Class.Form.Generate.inc
rename to www/lib/CoreLibs/Output/Form/Generate.inc
diff --git a/www/libs/Class.Progressbar.inc b/www/lib/CoreLibs/Output/Progressbar.inc
similarity index 100%
rename from www/libs/Class.Progressbar.inc
rename to www/lib/CoreLibs/Output/Progressbar.inc
diff --git a/www/libs/Class.Smarty.Extend.inc b/www/lib/CoreLibs/Template/SmartyExtend.Inc
similarity index 100%
rename from www/libs/Class.Smarty.Extend.inc
rename to www/lib/CoreLibs/Template/SmartyExtend.Inc
diff --git a/www/lib/CoreLibs/Upload/Core/qqUploadedFileForm.inc b/www/lib/CoreLibs/Upload/Core/qqUploadedFileForm.inc
new file mode 100755
index 00000000..2c58a26e
--- /dev/null
+++ b/www/lib/CoreLibs/Upload/Core/qqUploadedFileForm.inc
@@ -0,0 +1,31 @@
+getSize()) {
+ return false;
+ }
+
+ $target = fopen($path, "w");
+ fseek($temp, 0, SEEK_SET);
+ stream_copy_to_stream($temp, $target);
+ fclose($target);
+
+ return true;
+ }
+ public function getName()
+ {
+ return $_GET['qqfile'];
+ }
+ public function getSize()
+ {
+ if (isset($_SERVER["CONTENT_LENGTH"])) {
+ return (int)$_SERVER["CONTENT_LENGTH"];
+ } else {
+ throw new Exception('Getting content length is not supported.');
+ }
+ }
+}
+
+# __END__
diff --git a/www/libs/FileUploader.inc b/www/lib/CoreLibs/Upload/qqFileUploader.inc
old mode 100644
new mode 100755
similarity index 68%
rename from www/libs/FileUploader.inc
rename to www/lib/CoreLibs/Upload/qqFileUploader.inc
index b45e464d..d926119e
--- a/www/libs/FileUploader.inc
+++ b/www/lib/CoreLibs/Upload/qqFileUploader.inc
@@ -1,71 +1,9 @@
getSize()) {
- return false;
- }
-
- $target = fopen($path, "w");
- fseek($temp, 0, SEEK_SET);
- stream_copy_to_stream($temp, $target);
- fclose($target);
-
- return true;
- }
- public function getName()
- {
- return $_GET['qqfile'];
- }
- public function getSize()
- {
- if (isset($_SERVER["CONTENT_LENGTH"])) {
- return (int)$_SERVER["CONTENT_LENGTH"];
- } else {
- throw new Exception('Getting content length is not supported.');
- }
- }
-}
-
-/**
- * Handle file uploads via regular form post (uses the $_FILES array)
- */
-class qqUploadedFileForm
-{
- /**
- * Save the file to the specified path
- * @return boolean TRUE on success
- */
- public function save($path)
- {
- if (!move_uploaded_file($_FILES['qqfile']['tmp_name'], $path)) {
- return false;
- }
- return true;
- }
- public function getName()
- {
- return $_FILES['qqfile']['name'];
- }
- public function getSize()
- {
- return $_FILES['qqfile']['size'];
- }
-}
+use \CoreLibs\Upload\Core\qqUploadedFileForm;
+use \CoreLibs\Upload\Core\qqUploadedFileXhr;
class qqFileUploader
{
@@ -170,3 +108,5 @@ class qqFileUploader
}
}
}
+
+# __END__
diff --git a/www/libs/Error.Handling.inc b/www/lib/Error.Handling.inc
similarity index 100%
rename from www/libs/Error.Handling.inc
rename to www/lib/Error.Handling.inc
diff --git a/www/libs/Fonts/GeosansLight.ttf b/www/lib/Fonts/GeosansLight.ttf
similarity index 100%
rename from www/libs/Fonts/GeosansLight.ttf
rename to www/lib/Fonts/GeosansLight.ttf
diff --git a/www/libs/Fonts/MankSans.ttf b/www/lib/Fonts/MankSans.ttf
similarity index 100%
rename from www/libs/Fonts/MankSans.ttf
rename to www/lib/Fonts/MankSans.ttf
diff --git a/www/libs/Fonts/Silkscreen.ttf b/www/lib/Fonts/Silkscreen.ttf
similarity index 100%
rename from www/libs/Fonts/Silkscreen.ttf
rename to www/lib/Fonts/Silkscreen.ttf
diff --git a/www/libs/Fonts/pf_arma_five.ttf b/www/lib/Fonts/pf_arma_five.ttf
similarity index 100%
rename from www/libs/Fonts/pf_arma_five.ttf
rename to www/lib/Fonts/pf_arma_five.ttf
diff --git a/www/libs/Fonts/tahoma.ttf b/www/lib/Fonts/tahoma.ttf
similarity index 100%
rename from www/libs/Fonts/tahoma.ttf
rename to www/lib/Fonts/tahoma.ttf
diff --git a/www/lib/Smarty b/www/lib/Smarty
new file mode 120000
index 00000000..7156d2dc
--- /dev/null
+++ b/www/lib/Smarty
@@ -0,0 +1 @@
+smarty-3.1.30/
\ No newline at end of file
diff --git a/www/libs/pChart b/www/lib/pChart
similarity index 100%
rename from www/libs/pChart
rename to www/lib/pChart
diff --git a/www/libs/pChart2.1.4/class/pBarcode128.class.php b/www/lib/pChart2.1.4/class/pBarcode128.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pBarcode128.class.php
rename to www/lib/pChart2.1.4/class/pBarcode128.class.php
diff --git a/www/libs/pChart2.1.4/class/pBarcode39.class.php b/www/lib/pChart2.1.4/class/pBarcode39.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pBarcode39.class.php
rename to www/lib/pChart2.1.4/class/pBarcode39.class.php
diff --git a/www/libs/pChart2.1.4/class/pBubble.class.php b/www/lib/pChart2.1.4/class/pBubble.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pBubble.class.php
rename to www/lib/pChart2.1.4/class/pBubble.class.php
diff --git a/www/libs/pChart2.1.4/class/pCache.class.php b/www/lib/pChart2.1.4/class/pCache.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pCache.class.php
rename to www/lib/pChart2.1.4/class/pCache.class.php
diff --git a/www/libs/pChart2.1.4/class/pData.class.php b/www/lib/pChart2.1.4/class/pData.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pData.class.php
rename to www/lib/pChart2.1.4/class/pData.class.php
diff --git a/www/libs/pChart2.1.4/class/pDraw.class.php b/www/lib/pChart2.1.4/class/pDraw.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pDraw.class.php
rename to www/lib/pChart2.1.4/class/pDraw.class.php
diff --git a/www/libs/pChart2.1.4/class/pImage.class.php b/www/lib/pChart2.1.4/class/pImage.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pImage.class.php
rename to www/lib/pChart2.1.4/class/pImage.class.php
diff --git a/www/libs/pChart2.1.4/class/pIndicator.class.php b/www/lib/pChart2.1.4/class/pIndicator.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pIndicator.class.php
rename to www/lib/pChart2.1.4/class/pIndicator.class.php
diff --git a/www/libs/pChart2.1.4/class/pPie.class.php b/www/lib/pChart2.1.4/class/pPie.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pPie.class.php
rename to www/lib/pChart2.1.4/class/pPie.class.php
diff --git a/www/libs/pChart2.1.4/class/pRadar.class.php b/www/lib/pChart2.1.4/class/pRadar.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pRadar.class.php
rename to www/lib/pChart2.1.4/class/pRadar.class.php
diff --git a/www/libs/pChart2.1.4/class/pScatter.class.php b/www/lib/pChart2.1.4/class/pScatter.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pScatter.class.php
rename to www/lib/pChart2.1.4/class/pScatter.class.php
diff --git a/www/libs/pChart2.1.4/class/pSplit.class.php b/www/lib/pChart2.1.4/class/pSplit.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pSplit.class.php
rename to www/lib/pChart2.1.4/class/pSplit.class.php
diff --git a/www/libs/pChart2.1.4/class/pSpring.class.php b/www/lib/pChart2.1.4/class/pSpring.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pSpring.class.php
rename to www/lib/pChart2.1.4/class/pSpring.class.php
diff --git a/www/libs/pChart2.1.4/class/pStock.class.php b/www/lib/pChart2.1.4/class/pStock.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pStock.class.php
rename to www/lib/pChart2.1.4/class/pStock.class.php
diff --git a/www/libs/pChart2.1.4/class/pSurface.class.php b/www/lib/pChart2.1.4/class/pSurface.class.php
similarity index 100%
rename from www/libs/pChart2.1.4/class/pSurface.class.php
rename to www/lib/pChart2.1.4/class/pSurface.class.php
diff --git a/www/libs/pChart2.1.4/data/128B.db b/www/lib/pChart2.1.4/data/128B.db
similarity index 100%
rename from www/libs/pChart2.1.4/data/128B.db
rename to www/lib/pChart2.1.4/data/128B.db
diff --git a/www/libs/pChart2.1.4/data/39.db b/www/lib/pChart2.1.4/data/39.db
similarity index 100%
rename from www/libs/pChart2.1.4/data/39.db
rename to www/lib/pChart2.1.4/data/39.db
diff --git a/www/libs/pChart2.1.4/fonts/Bedizen.ttf b/www/lib/pChart2.1.4/fonts/Bedizen.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/Bedizen.ttf
rename to www/lib/pChart2.1.4/fonts/Bedizen.ttf
diff --git a/www/libs/pChart2.1.4/fonts/Forgotte.ttf b/www/lib/pChart2.1.4/fonts/Forgotte.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/Forgotte.ttf
rename to www/lib/pChart2.1.4/fonts/Forgotte.ttf
diff --git a/www/libs/pChart2.1.4/fonts/GeosansLight.ttf b/www/lib/pChart2.1.4/fonts/GeosansLight.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/GeosansLight.ttf
rename to www/lib/pChart2.1.4/fonts/GeosansLight.ttf
diff --git a/www/libs/pChart2.1.4/fonts/MankSans.ttf b/www/lib/pChart2.1.4/fonts/MankSans.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/MankSans.ttf
rename to www/lib/pChart2.1.4/fonts/MankSans.ttf
diff --git a/www/libs/pChart2.1.4/fonts/Silkscreen.ttf b/www/lib/pChart2.1.4/fonts/Silkscreen.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/Silkscreen.ttf
rename to www/lib/pChart2.1.4/fonts/Silkscreen.ttf
diff --git a/www/libs/pChart2.1.4/fonts/advent_light.ttf b/www/lib/pChart2.1.4/fonts/advent_light.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/advent_light.ttf
rename to www/lib/pChart2.1.4/fonts/advent_light.ttf
diff --git a/www/libs/pChart2.1.4/fonts/calibri.ttf b/www/lib/pChart2.1.4/fonts/calibri.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/calibri.ttf
rename to www/lib/pChart2.1.4/fonts/calibri.ttf
diff --git a/www/libs/pChart2.1.4/fonts/pf_arma_five.ttf b/www/lib/pChart2.1.4/fonts/pf_arma_five.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/pf_arma_five.ttf
rename to www/lib/pChart2.1.4/fonts/pf_arma_five.ttf
diff --git a/www/libs/pChart2.1.4/fonts/verdana.ttf b/www/lib/pChart2.1.4/fonts/verdana.ttf
similarity index 100%
rename from www/libs/pChart2.1.4/fonts/verdana.ttf
rename to www/lib/pChart2.1.4/fonts/verdana.ttf
diff --git a/www/libs/pChart2.1.4/palettes/autumn.color b/www/lib/pChart2.1.4/palettes/autumn.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/autumn.color
rename to www/lib/pChart2.1.4/palettes/autumn.color
diff --git a/www/libs/pChart2.1.4/palettes/blind.color b/www/lib/pChart2.1.4/palettes/blind.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/blind.color
rename to www/lib/pChart2.1.4/palettes/blind.color
diff --git a/www/libs/pChart2.1.4/palettes/evening.color b/www/lib/pChart2.1.4/palettes/evening.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/evening.color
rename to www/lib/pChart2.1.4/palettes/evening.color
diff --git a/www/libs/pChart2.1.4/palettes/kitchen.color b/www/lib/pChart2.1.4/palettes/kitchen.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/kitchen.color
rename to www/lib/pChart2.1.4/palettes/kitchen.color
diff --git a/www/libs/pChart2.1.4/palettes/light.color b/www/lib/pChart2.1.4/palettes/light.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/light.color
rename to www/lib/pChart2.1.4/palettes/light.color
diff --git a/www/libs/pChart2.1.4/palettes/navy.color b/www/lib/pChart2.1.4/palettes/navy.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/navy.color
rename to www/lib/pChart2.1.4/palettes/navy.color
diff --git a/www/libs/pChart2.1.4/palettes/shade.color b/www/lib/pChart2.1.4/palettes/shade.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/shade.color
rename to www/lib/pChart2.1.4/palettes/shade.color
diff --git a/www/libs/pChart2.1.4/palettes/spring.color b/www/lib/pChart2.1.4/palettes/spring.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/spring.color
rename to www/lib/pChart2.1.4/palettes/spring.color
diff --git a/www/libs/pChart2.1.4/palettes/summer.color b/www/lib/pChart2.1.4/palettes/summer.color
similarity index 100%
rename from www/libs/pChart2.1.4/palettes/summer.color
rename to www/lib/pChart2.1.4/palettes/summer.color
diff --git a/www/smarty-3.1.27/.gitattributes b/www/lib/smarty-3.1.30/.gitattributes
similarity index 100%
rename from www/smarty-3.1.27/.gitattributes
rename to www/lib/smarty-3.1.30/.gitattributes
diff --git a/www/smarty-3.1.27/.gitignore b/www/lib/smarty-3.1.30/.gitignore
similarity index 100%
rename from www/smarty-3.1.27/.gitignore
rename to www/lib/smarty-3.1.30/.gitignore
diff --git a/www/smarty-3.1.27/.travis.yml b/www/lib/smarty-3.1.30/.travis.yml
similarity index 100%
rename from www/smarty-3.1.27/.travis.yml
rename to www/lib/smarty-3.1.30/.travis.yml
diff --git a/www/lib/smarty-3.1.30/Autoloader.php b/www/lib/smarty-3.1.30/Autoloader.php
new file mode 100644
index 00000000..e8885532
--- /dev/null
+++ b/www/lib/smarty-3.1.30/Autoloader.php
@@ -0,0 +1,107 @@
+ 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',);
+
+ /**
+ * Registers Smarty_Autoloader backward compatible to older installations.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not.
+ */
+ public static function registerBC($prepend = false)
+ {
+ /**
+ * register the class autoloader
+ */
+ if (!defined('SMARTY_SPL_AUTOLOAD')) {
+ define('SMARTY_SPL_AUTOLOAD', 0);
+ }
+ if (SMARTY_SPL_AUTOLOAD &&
+ set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false
+ ) {
+ $registeredAutoLoadFunctions = spl_autoload_functions();
+ if (!isset($registeredAutoLoadFunctions[ 'spl_autoload' ])) {
+ spl_autoload_register();
+ }
+ } else {
+ self::register($prepend);
+ }
+ }
+
+ /**
+ * Registers Smarty_Autoloader as an SPL autoloader.
+ *
+ * @param bool $prepend Whether to prepend the autoloader or not.
+ */
+ public static function register($prepend = false)
+ {
+ self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR;
+ self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR :
+ self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR;
+ if (version_compare(phpversion(), '5.3.0', '>=')) {
+ spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend);
+ } else {
+ spl_autoload_register(array(__CLASS__, 'autoload'));
+ }
+ }
+
+ /**
+ * Handles auto loading of classes.
+ *
+ * @param string $class A class name.
+ */
+ public static function autoload($class)
+ {
+ $_class = strtolower($class);
+ if (strpos($_class, 'smarty') !== 0) {
+ return;
+ }
+ $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php';
+ if (is_file($file)) {
+ include $file;
+ } else if (isset(self::$rootClasses[ $_class ])) {
+ $file = self::$SMARTY_DIR . self::$rootClasses[ $_class ];
+ if (is_file($file)) {
+ include $file;
+ }
+ }
+ return;
+ }
+}
diff --git a/www/smarty-3.1.27/Smarty.class.php b/www/lib/smarty-3.1.30/Smarty.class.php
similarity index 54%
rename from www/smarty-3.1.27/Smarty.class.php
rename to www/lib/smarty-3.1.30/Smarty.class.php
index 1f0f2634..8d18450e 100644
--- a/www/smarty-3.1.27/Smarty.class.php
+++ b/www/lib/smarty-3.1.30/Smarty.class.php
@@ -21,13 +21,13 @@
* smarty-discussion-subscribe@googlegroups.com
*
* @link http://www.smarty.net/
- * @copyright 2015 New Digital Group, Inc.
- * @copyright 2015 Uwe Tews
+ * @copyright 2016 New Digital Group, Inc.
+ * @copyright 2016 Uwe Tews
* @author Monte Ohrt
* @author Uwe Tews
* @author Rodney Rehm
* @package Smarty
- * @version 3.1.27
+ * @version 3.1.30
*/
/**
@@ -79,7 +79,7 @@ if (!defined('SMARTY_RESOURCE_DATE_FORMAT')) {
*/
if (!class_exists('Smarty_Autoloader', false)) {
if (!class_exists('Smarty_Internal_Data', true)) {
- require_once 'Autoloader.php';
+ require_once dirname(__FILE__) . '/Autoloader.php';
Smarty_Autoloader::registerBC();
}
}
@@ -87,20 +87,30 @@ if (!class_exists('Smarty_Autoloader', false)) {
/**
* Load always needed external class files
*/
-
if (!class_exists('Smarty_Internal_Data', false)) {
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
}
+require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php';
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php';
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php';
require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php';
+require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php';
/**
* This is the main Smarty class
*
* @package Smarty
+ *
+ * The following methods will be dynamically loaded by the extension handler when they are called.
+ * They are located in a corresponding Smarty_Internal_Method_xxxx class
+ *
+ * @method int clearAllCache(int $exp_time = null, string $type = null)
+ * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null)
+ * @method int compileAllTemplates(string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null)
+ * @method int compileAllConfig(string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null)
+ * @method int clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
*/
class Smarty extends Smarty_Internal_TemplateBase
{
@@ -111,18 +121,22 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
- const SMARTY_VERSION = '3.1.27';
+ const SMARTY_VERSION = '3.1.30';
/**
* define variable scopes
*/
- const SCOPE_LOCAL = 0;
+ const SCOPE_LOCAL = 1;
- const SCOPE_PARENT = 1;
+ const SCOPE_PARENT = 2;
- const SCOPE_ROOT = 2;
+ const SCOPE_TPL_ROOT = 4;
- const SCOPE_GLOBAL = 3;
+ const SCOPE_ROOT = 8;
+
+ const SCOPE_SMARTY = 16;
+
+ const SCOPE_GLOBAL = 32;
/**
* define caching modes
@@ -134,7 +148,7 @@ class Smarty extends Smarty_Internal_TemplateBase
const CACHING_LIFETIME_SAVED = 2;
/**
- * define constant for clearing cache files be saved expiration datees
+ * define constant for clearing cache files be saved expiration dates
*/
const CLEAR_EXPIRED = - 1;
@@ -191,6 +205,18 @@ class Smarty extends Smarty_Internal_TemplateBase
const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler';
+ /**
+ * Resource caching modes
+ * (not used since 3.1.30)
+ */
+ const RESOURCE_CACHE_OFF = 0;
+
+ const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules
+
+ const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects
+
+ const RESOURCE_CACHE_ON = 4; // cache source and compiled resources
+
/**#@-*/
/**
@@ -199,14 +225,14 @@ class Smarty extends Smarty_Internal_TemplateBase
public static $global_tpl_vars = array();
/**
- * error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors()
+ * error handler returned by set_error_handler() in Smarty::muteExpectedErrors()
*/
public static $_previous_error_handler = null;
/**
* contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors()
*/
- public static $_muted_directories = array('./templates_c/' => null, './cache/' => null);
+ public static $_muted_directories = array();
/**
* Flag denoting if Multibyte String functions are available
@@ -239,7 +265,7 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
/**
- * auto literal on delimiters with whitspace
+ * auto literal on delimiters with whitespace
*
* @var boolean
*/
@@ -253,7 +279,7 @@ class Smarty extends Smarty_Internal_TemplateBase
public $error_unassigned = false;
/**
- * look up relative filepaths in include_path
+ * look up relative file path in include_path
*
* @var boolean
*/
@@ -264,21 +290,56 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @var array
*/
- private $template_dir = array('./templates/');
+ protected $template_dir = array('./templates/');
+
+ /**
+ * flags for normalized template directory entries
+ *
+ * @var array
+ */
+ protected $_processedTemplateDir = array();
+
+ /**
+ * flag if template_dir is normalized
+ *
+ * @var bool
+ */
+ public $_templateDirNormalized = false;
/**
* joined template directory string used in cache keys
*
* @var string
*/
- public $joined_template_dir = './templates/';
+ public $_joined_template_dir = null;
+
+ /**
+ * config directory
+ *
+ * @var array
+ */
+ protected $config_dir = array('./configs/');
+
+ /**
+ * flags for normalized template directory entries
+ *
+ * @var array
+ */
+ protected $_processedConfigDir = array();
+
+ /**
+ * flag if config_dir is normalized
+ *
+ * @var bool
+ */
+ public $_configDirNormalized = false;
/**
* joined config directory string used in cache keys
*
* @var string
*/
- public $joined_config_dir = './configs/';
+ public $_joined_config_dir = null;
/**
* default template handler
@@ -306,28 +367,42 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @var string
*/
- private $compile_dir = './templates_c/';
+ protected $compile_dir = './templates_c/';
+
+ /**
+ * flag if template_dir is normalized
+ *
+ * @var bool
+ */
+ public $_compileDirNormalized = false;
/**
* plugins directory
*
* @var array
*/
- private $plugins_dir = null;
+ protected $plugins_dir = array();
+
+ /**
+ * flag if plugins_dir is normalized
+ *
+ * @var bool
+ */
+ public $_pluginsDirNormalized = false;
/**
* cache directory
*
* @var string
*/
- private $cache_dir = './cache/';
+ protected $cache_dir = './cache/';
/**
- * config directory
+ * flag if template_dir is normalized
*
- * @var array
+ * @var bool
*/
- private $config_dir = array('./configs/');
+ public $_cacheDirNormalized = false;
/**
* force template compiling?
@@ -364,13 +439,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $merge_compiled_includes = false;
- /**
- * template inheritance merge compiled includes
- *
- * @var boolean
- */
- public $inheritance_merge_compiled_includes = true;
-
/**
* force cache file creation
*
@@ -425,16 +493,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $allow_php_templates = false;
- /**
- * Should compiled-templates be prevented from being called directly?
- * {@internal
- * Currently used by Smarty_Internal_Template only.
- * }}
- *
- * @var boolean
- */
- public $direct_access_security = true;
-
/**#@-*/
/**
* debug mode
@@ -478,13 +536,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $error_reporting = null;
- /**
- * Internal flag for getTags()
- *
- * @var boolean
- */
- public $get_used_tags = false;
-
/**#@+
* config var settings
*/
@@ -524,7 +575,7 @@ class Smarty extends Smarty_Internal_TemplateBase
public $compile_locking = true;
/**
- * Controls whether cache resources should emply locking mechanism
+ * Controls whether cache resources should use locking mechanism
*
* @var boolean
*/
@@ -555,13 +606,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $caching_type = 'file';
- /**
- * internal config properties
- *
- * @var array
- */
- public $properties = array();
-
/**
* config type
*
@@ -569,34 +613,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $default_config_type = 'file';
- /**
- * cached template objects
- *
- * @var array
- */
- public $source_objects = array();
-
- /**
- * cached template objects
- *
- * @var array
- */
- public $template_objects = array();
-
- /**
- * enable resource caching
- *
- * @var bool
- */
- public $resource_caching = false;
-
- /**
- * enable template resource caching
- *
- * @var bool
- */
- public $template_resource_caching = true;
-
/**
* check If-Modified-Since headers
*
@@ -611,13 +627,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $registered_plugins = array();
- /**
- * plugin search order
- *
- * @var array
- */
- public $plugin_search_order = array('function', 'block', 'compiler', 'class');
-
/**
* registered objects
*
@@ -646,13 +655,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $registered_resources = array();
- /**
- * resource handler cache
- *
- * @var array
- */
- public $_resource_handlers = array();
-
/**
* registered cache resources
*
@@ -660,13 +662,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $registered_cache_resources = array();
- /**
- * cache resource handler cache
- *
- * @var array
- */
- public $_cacheresource_handlers = array();
-
/**
* autoload filter
*
@@ -688,13 +683,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $escape_html = false;
- /**
- * global internal smarty vars
- *
- * @var array
- */
- public static $_smarty_vars = array();
-
/**
* start time for execution time calculation
*
@@ -702,27 +690,6 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public $start_time = 0;
- /**
- * default file permissions
- *
- * @var int
- */
- public $_file_perms = 0644;
-
- /**
- * default dir permissions
- *
- * @var int
- */
- public $_dir_perms = 0771;
-
- /**
- * block tag hierarchy
- *
- * @var array
- */
- public $_tag_stack = array();
-
/**
* required by the compiler for BC
*
@@ -738,11 +705,36 @@ class Smarty extends Smarty_Internal_TemplateBase
public $_parserdebug = false;
/**
- * Cache of is_file results of loadPlugin()
+ * This object type (Smarty = 1, template = 2, data = 4)
*
- * @var array
+ * @var int
*/
- public $_is_file_cache = array();
+ public $_objType = 1;
+
+ /**
+ * Debug object
+ *
+ * @var Smarty_Internal_Debug
+ */
+ public $_debug = null;
+
+ /**
+ * removed properties
+ *
+ * @var string[]
+ */
+ private $obsoleteProperties = array('resource_caching', 'template_resource_caching', 'direct_access_security',
+ '_dir_perms', '_file_perms', 'plugin_search_order',
+ 'inheritance_merge_compiled_includes', 'resource_cache_mode',);
+
+ /**
+ * List of private properties which will call getter/setter on a direct access
+ *
+ * @var string[]
+ */
+ private $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir',
+ 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir',
+ 'cache_dir' => 'CacheDir',);
/**#@-*/
@@ -751,89 +743,24 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function __construct()
{
+ parent::__construct();
if (is_callable('mb_internal_encoding')) {
mb_internal_encoding(Smarty::$_CHARSET);
}
$this->start_time = microtime(true);
- // check default dirs for overloading
- if ($this->template_dir[0] !== './templates/' || isset($this->template_dir[1])) {
- $this->setTemplateDir($this->template_dir);
- }
- if ($this->config_dir[0] !== './configs/' || isset($this->config_dir[1])) {
- $this->setConfigDir($this->config_dir);
- }
- if ($this->compile_dir !== './templates_c/') {
- unset(self::$_muted_directories['./templates_c/']);
- $this->setCompileDir($this->compile_dir);
- }
- if ($this->cache_dir !== './cache/') {
- unset(self::$_muted_directories['./cache/']);
- $this->setCacheDir($this->cache_dir);
- }
- if (isset($this->plugins_dir)) {
- $this->setPluginsDir($this->plugins_dir);
- } else {
- $this->setPluginsDir(SMARTY_PLUGINS_DIR);
- }
- if (isset($_SERVER['SCRIPT_NAME'])) {
- Smarty::$global_tpl_vars['SCRIPT_NAME'] = new Smarty_Variable($_SERVER['SCRIPT_NAME']);
+
+ if (isset($_SERVER[ 'SCRIPT_NAME' ])) {
+ Smarty::$global_tpl_vars[ 'SCRIPT_NAME' ] = new Smarty_Variable($_SERVER[ 'SCRIPT_NAME' ]);
}
// Check if we're running on windows
Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
-
// let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8
if (Smarty::$_CHARSET !== 'UTF-8') {
Smarty::$_UTF8_MODIFIER = '';
}
}
- /**
- * fetches a rendered Smarty template
- *
- * @param string $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- * @param bool $display true: display, false: fetch
- * @param bool $merge_tpl_vars not used - left for BC
- * @param bool $no_output_filter not used - left for BC
- *
- * @throws Exception
- * @throws SmartyException
- * @return string rendered template output
- */
- public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)
- {
- if ($cache_id !== null && is_object($cache_id)) {
- $parent = $cache_id;
- $cache_id = null;
- }
- if ($parent === null) {
- $parent = $this;
- }
- // get template object
- $_template = is_object($template) ? $template : $this->createTemplate($template, $cache_id, $compile_id, $parent, false);
- // set caching in template object
- $_template->caching = $this->caching;
- // fetch template content
- return $_template->render(true, false, $display);
- }
-
- /**
- * displays a Smarty template
- *
- * @param string $template the resource handle of the template file or template object
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- */
- public function display($template = null, $cache_id = null, $compile_id = null, $parent = null)
- {
- // display template
- $this->fetch($template, $cache_id, $compile_id, $parent, true);
- }
-
/**
* Check if a template resource exists
*
@@ -843,76 +770,9 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function templateExists($resource_name)
{
- // create template object
- $save = $this->template_objects;
- $tpl = new $this->template_class($resource_name, $this);
- // check if it does exists
- $result = $tpl->source->exists;
- $this->template_objects = $save;
-
- return $result;
- }
-
- /**
- * Returns a single or all global variables
- *
- * @param string $varname variable name or null
- *
- * @return string variable value or or array of variables
- */
- public function getGlobal($varname = null)
- {
- if (isset($varname)) {
- if (isset(self::$global_tpl_vars[$varname])) {
- return self::$global_tpl_vars[$varname]->value;
- } else {
- return '';
- }
- } else {
- $_result = array();
- foreach (self::$global_tpl_vars AS $key => $var) {
- $_result[$key] = $var->value;
- }
-
- return $_result;
- }
- }
-
- /**
- * Empty cache folder
- *
- * @param integer $exp_time expiration time
- * @param string $type resource type
- *
- * @return integer number of cache files deleted
- */
- public function clearAllCache($exp_time = null, $type = null)
- {
- // load cache resource and call clearAll
- $_cache_resource = Smarty_CacheResource::load($this, $type);
- Smarty_CacheResource::invalidLoadedCache($this);
-
- return $_cache_resource->clearAll($this, $exp_time);
- }
-
- /**
- * Empty cache for a specific template
- *
- * @param string $template_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time
- * @param string $type resource type
- *
- * @return integer number of cache files deleted
- */
- public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
- {
- // load cache resource and call clear
- $_cache_resource = Smarty_CacheResource::load($this, $type);
- Smarty_CacheResource::invalidLoadedCache($this);
-
- return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);
+ // create source object
+ $source = Smarty_Template_Source::load(null, $this, $resource_name);
+ return $source->exists;
}
/**
@@ -925,24 +785,7 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function enableSecurity($security_class = null)
{
- if ($security_class instanceof Smarty_Security) {
- $this->security_policy = $security_class;
-
- return $this;
- } elseif (is_object($security_class)) {
- throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security.");
- }
- if ($security_class == null) {
- $security_class = $this->security_class;
- }
- if (!class_exists($security_class)) {
- throw new SmartyException("Security class '$security_class' is not defined");
- } elseif ($security_class !== 'Smarty_Security' && !is_subclass_of($security_class, 'Smarty_Security')) {
- throw new SmartyException("Class '$security_class' must extend Smarty_Security.");
- } else {
- $this->security_policy = new $security_class($this);
- }
-
+ Smarty_Security::enableSecurity($this, $security_class);
return $this;
}
@@ -962,16 +805,20 @@ class Smarty extends Smarty_Internal_TemplateBase
* Set template directory
*
* @param string|array $template_dir directory(s) of template sources
+ * @param bool $isConfig true for config_dir
*
- * @return Smarty current Smarty instance for chaining
+ * @return \Smarty current Smarty instance for chaining
*/
- public function setTemplateDir($template_dir)
+ public function setTemplateDir($template_dir, $isConfig = false)
{
- $this->template_dir = array();
- foreach ((array) $template_dir as $k => $v) {
- $this->template_dir[$k] = rtrim($v, '/\\') . DS;
+ if ($isConfig) {
+ $this->config_dir = array();
+ $this->_processedConfigDir = array();
+ } else {
+ $this->template_dir = array();
+ $this->_processedTemplateDir = array();
}
- $this->joined_template_dir = join(' # ', $this->template_dir);
+ $this->addTemplateDir($template_dir, null, $isConfig);
return $this;
}
@@ -980,30 +827,67 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param string|array $template_dir directory(s) of template sources
* @param string $key of the array element to assign the template dir to
+ * @param bool $isConfig true for config_dir
*
* @return Smarty current Smarty instance for chaining
- * @throws SmartyException when the given template directory is not valid
*/
- public function addTemplateDir($template_dir, $key = null)
+ public function addTemplateDir($template_dir, $key = null, $isConfig = false)
{
- $this->_addDir('template_dir', $template_dir, $key);
- $this->joined_template_dir = join(' # ', $this->template_dir);
+ if ($isConfig) {
+ $processed = &$this->_processedConfigDir;
+ $dir = &$this->config_dir;
+ $this->_configDirNormalized = false;
+ } else {
+ $processed = &$this->_processedTemplateDir;
+ $dir = &$this->template_dir;
+ $this->_templateDirNormalized = false;
+ }
+ if (is_array($template_dir)) {
+ foreach ($template_dir as $k => $v) {
+ if (is_int($k)) {
+ // indexes are not merged but appended
+ $dir[] = $v;
+ } else {
+ // string indexes are overridden
+ $dir[ $k ] = $v;
+ unset($processed[ $key ]);
+ }
+ }
+ } else {
+ if ($key !== null) {
+ // override directory at specified index
+ $dir[ $key ] = $template_dir;
+ unset($processed[ $key ]);
+ } else {
+ // append new directory
+ $dir[] = $template_dir;
+ }
+ }
return $this;
}
/**
* Get template directories
*
- * @param mixed $index index of directory to get, null to get all
+ * @param mixed $index index of directory to get, null to get all
+ * @param bool $isConfig true for config_dir
*
- * @return array|string list of template directories, or directory of $index
+ * @return array list of template directories, or directory of $index
*/
- public function getTemplateDir($index = null)
+ public function getTemplateDir($index = null, $isConfig = false)
{
- if ($index !== null) {
- return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null;
+ if ($isConfig) {
+ $dir = &$this->config_dir;
+ } else {
+ $dir = &$this->template_dir;
}
- return (array) $this->template_dir;
+ if ($isConfig ? !$this->_configDirNormalized : !$this->_templateDirNormalized) {
+ $this->_nomalizeTemplateConfig($isConfig);
+ }
+ if ($index !== null) {
+ return isset($dir[ $index ]) ? $dir[ $index ] : null;
+ }
+ return $dir;
}
/**
@@ -1015,12 +899,7 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function setConfigDir($config_dir)
{
- $this->config_dir = array();
- foreach ((array) $config_dir as $k => $v) {
- $this->config_dir[$k] = rtrim($v, '/\\') . DS;
- }
- $this->joined_config_dir = join(' # ', $this->config_dir);
- return $this;
+ return $this->setTemplateDir($config_dir, true);
}
/**
@@ -1033,9 +912,7 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function addConfigDir($config_dir, $key = null)
{
- $this->_addDir('config_dir', $config_dir, $key);
- $this->joined_config_dir = join(' # ', $this->config_dir);
- return $this;
+ return $this->addTemplateDir($config_dir, $key, true);
}
/**
@@ -1043,14 +920,11 @@ class Smarty extends Smarty_Internal_TemplateBase
*
* @param mixed $index index of directory to get, null to get all
*
- * @return array|string configuration directory
+ * @return array configuration directory
*/
public function getConfigDir($index = null)
{
- if ($index !== null) {
- return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null;
- }
- return (array) $this->config_dir;
+ return $this->getTemplateDir($index, true);
}
/**
@@ -1062,27 +936,25 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function setPluginsDir($plugins_dir)
{
- $this->plugins_dir = array();
- $this->addPluginsDir($plugins_dir);
+ $this->plugins_dir = (array) $plugins_dir;
+ $this->_pluginsDirNormalized = false;
return $this;
}
/**
* Adds directory of plugin files
*
- * @param $plugins_dir
+ * @param null|array $plugins_dir
*
* @return Smarty current Smarty instance for chaining
*/
public function addPluginsDir($plugins_dir)
{
- // make sure we're dealing with an array
- $this->plugins_dir = (array) $this->plugins_dir;
- foreach ((array) $plugins_dir as $v) {
- $this->plugins_dir[] = rtrim($v, '/\\') . DS;
+ if (empty($this->plugins_dir)) {
+ $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
}
- $this->plugins_dir = array_unique($this->plugins_dir);
- $this->_is_file_cache = array();
+ $this->plugins_dir = array_merge($this->plugins_dir, (array) $plugins_dir);
+ $this->_pluginsDirNormalized = false;
return $this;
}
@@ -1093,11 +965,24 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function getPluginsDir()
{
- return (array) $this->plugins_dir;
+ if (empty($this->plugins_dir)) {
+ $this->plugins_dir[] = SMARTY_PLUGINS_DIR;
+ $this->_pluginsDirNormalized = false;
+ }
+ if (!$this->_pluginsDirNormalized) {
+ if (!is_array($this->plugins_dir)) {
+ $this->plugins_dir = (array) $this->plugins_dir;
+ }
+ foreach ($this->plugins_dir as $k => $v) {
+ $this->plugins_dir[ $k ] = $this->_realpath(rtrim($v, "/\\") . DS, true);
+ }
+ $this->_cache[ 'plugin_files' ] = array();
+ $this->_pluginsDirNormalized = true;
+ }
+ return $this->plugins_dir;
}
/**
- * Set compile directory
*
* @param string $compile_dir directory to store compiled templates in
*
@@ -1105,11 +990,8 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function setCompileDir($compile_dir)
{
- $this->compile_dir = rtrim($compile_dir, '/\\') . DS;
- if (!isset(Smarty::$_muted_directories[$this->compile_dir])) {
- Smarty::$_muted_directories[$this->compile_dir] = null;
- }
-
+ $this->_normalizeDir('compile_dir', $compile_dir);
+ $this->_compileDirNormalized = true;
return $this;
}
@@ -1120,6 +1002,10 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function getCompileDir()
{
+ if (!$this->_compileDirNormalized) {
+ $this->_normalizeDir('compile_dir', $this->compile_dir);
+ $this->_compileDirNormalized = true;
+ }
return $this->compile_dir;
}
@@ -1132,10 +1018,8 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function setCacheDir($cache_dir)
{
- $this->cache_dir = rtrim($cache_dir, '/\\') . DS;
- if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {
- Smarty::$_muted_directories[$this->cache_dir] = null;
- }
+ $this->_normalizeDir('cache_dir', $cache_dir);
+ $this->_cacheDirNormalized = true;
return $this;
}
@@ -1146,177 +1030,54 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function getCacheDir()
{
+ if (!$this->_cacheDirNormalized) {
+ $this->_normalizeDir('cache_dir', $this->cache_dir);
+ $this->_cacheDirNormalized = true;
+ }
return $this->cache_dir;
}
/**
- * add directories to given property name
+ * Normalize and set directory string
*
- * @param string $dirName directory property name
- * @param string|array $dir directory string or array of strings
- * @param mixed $key optional key
+ * @param string $dirName cache_dir or compile_dir
+ * @param string $dir filepath of folder
*/
- private function _addDir($dirName, $dir, $key = null)
+ private function _normalizeDir($dirName, $dir)
{
- // make sure we're dealing with an array
- $this->$dirName = (array) $this->$dirName;
+ $this->{$dirName} = $this->_realpath(rtrim($dir, "/\\") . DS, true);
+ if (!isset(Smarty::$_muted_directories[ $this->{$dirName} ])) {
+ Smarty::$_muted_directories[ $this->{$dirName} ] = null;
+ }
+ }
- if (is_array($dir)) {
- foreach ($dir as $k => $v) {
- if (is_int($k)) {
- // indexes are not merged but appended
- $this->{$dirName}[] = rtrim($v, '/\\') . DS;
- } else {
- // string indexes are overridden
- $this->{$dirName}[$k] = rtrim($v, '/\\') . DS;
- }
- }
+ /**
+ * Normalize template_dir or config_dir
+ *
+ * @param bool $isConfig true for config_dir
+ *
+ */
+ private function _nomalizeTemplateConfig($isConfig)
+ {
+ if ($isConfig) {
+ $processed = &$this->_processedConfigDir;
+ $dir = &$this->config_dir;
} else {
- if ($key !== null) {
- // override directory at specified index
- $this->{$dirName}[$key] = rtrim($dir, '/\\') . DS;
- } else {
- // append new directory
- $this->{$dirName}[] = rtrim($dir, '/\\') . DS;
+ $processed = &$this->_processedTemplateDir;
+ $dir = &$this->template_dir;
+ }
+ if (!is_array($dir)) {
+ $dir = (array) $dir;
+ }
+ foreach ($dir as $k => $v) {
+ if (!isset($processed[ $k ])) {
+ $dir[ $k ] = $v = $this->_realpath(rtrim($v, "/\\") . DS, true);
+ $processed[ $k ] = true;
}
}
- }
-
- /**
- * Set default modifiers
- *
- * @param array|string $modifiers modifier or list of modifiers to set
- *
- * @return Smarty current Smarty instance for chaining
- */
- public function setDefaultModifiers($modifiers)
- {
- $this->default_modifiers = (array) $modifiers;
-
- return $this;
- }
-
- /**
- * Add default modifiers
- *
- * @param array|string $modifiers modifier or list of modifiers to add
- *
- * @return Smarty current Smarty instance for chaining
- */
- public function addDefaultModifiers($modifiers)
- {
- if (is_array($modifiers)) {
- $this->default_modifiers = array_merge($this->default_modifiers, $modifiers);
- } else {
- $this->default_modifiers[] = $modifiers;
- }
-
- return $this;
- }
-
- /**
- * Get default modifiers
- *
- * @return array list of default modifiers
- */
- public function getDefaultModifiers()
- {
- return $this->default_modifiers;
- }
-
- /**
- * Set autoload filters
- *
- * @param array $filters filters to load automatically
- * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters'
- * keys as the appropriate types
- *
- * @return Smarty current Smarty instance for chaining
- */
- public function setAutoloadFilters($filters, $type = null)
- {
- if ($type !== null) {
- $this->autoload_filters[$type] = (array) $filters;
- } else {
- $this->autoload_filters = (array) $filters;
- }
-
- return $this;
- }
-
- /**
- * Add autoload filters
- *
- * @param array $filters filters to load automatically
- * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters'
- * keys as the appropriate types
- *
- * @return Smarty current Smarty instance for chaining
- */
- public function addAutoloadFilters($filters, $type = null)
- {
- if ($type !== null) {
- if (!empty($this->autoload_filters[$type])) {
- $this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);
- } else {
- $this->autoload_filters[$type] = (array) $filters;
- }
- } else {
- foreach ((array) $filters as $key => $value) {
- if (!empty($this->autoload_filters[$key])) {
- $this->autoload_filters[$key] = array_merge($this->autoload_filters[$key], (array) $value);
- } else {
- $this->autoload_filters[$key] = (array) $value;
- }
- }
- }
-
- return $this;
- }
-
- /**
- * Get autoload filters
- *
- * @param string $type type of filter to get autoloads for. Defaults to all autoload filters
- *
- * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type
- * was specified
- */
- public function getAutoloadFilters($type = null)
- {
- if ($type !== null) {
- return isset($this->autoload_filters[$type]) ? $this->autoload_filters[$type] : array();
- }
-
- return $this->autoload_filters;
- }
-
- /**
- * return name of debugging template
- *
- * @return string
- */
- public function getDebugTemplate()
- {
- return $this->debug_tpl;
- }
-
- /**
- * set the debug template
- *
- * @param string $tpl_name
- *
- * @return Smarty current Smarty instance for chaining
- * @throws SmartyException if file is not readable
- */
- public function setDebugTemplate($tpl_name)
- {
- if (!is_readable($tpl_name)) {
- throw new SmartyException("Unknown file '{$tpl_name}'");
- }
- $this->debug_tpl = $tpl_name;
-
- return $this;
+ $isConfig ? $this->_configDirNormalized = true : $this->_templateDirNormalized = true;
+ $isConfig ? $this->_joined_config_dir = join('#', $this->config_dir) :
+ $this->_joined_template_dir = join('#', $this->template_dir);
}
/**
@@ -1342,33 +1103,36 @@ class Smarty extends Smarty_Internal_TemplateBase
} else {
$data = null;
}
- $_templateId = $this->getTemplateId($template, $cache_id, $compile_id);
- if (isset($this->template_objects[$_templateId])) {
- if ($do_clone) {
- $tpl = clone $this->template_objects[$_templateId];
- $tpl->smarty = clone $tpl->smarty;
- } else {
- $tpl = $this->template_objects[$_templateId];
- }
- $tpl->parent = $parent;
- $tpl->tpl_vars = array();
- $tpl->config_vars = array();
+ $_templateId = $this->_getTemplateId($template, $cache_id, $compile_id);
+ $tpl = null;
+ if ($this->caching && isset($this->_cache[ 'isCached' ][ $_templateId ])) {
+ $tpl = $do_clone ? clone $this->_cache[ 'isCached' ][ $_templateId ] :
+ $this->_cache[ 'isCached' ][ $_templateId ];
+ $tpl->tpl_vars = $tpl->config_vars = array();
+ } else if (!$do_clone && isset($this->_cache[ 'tplObjects' ][ $_templateId ])) {
+ $tpl = clone $this->_cache[ 'tplObjects' ][ $_templateId ];
} else {
- $tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id);
- if ($do_clone) {
- $tpl->smarty = clone $tpl->smarty;
- }
+ /* @var Smarty_Internal_Template $tpl */
+ $tpl = new $this->template_class($template, $this, null, $cache_id, $compile_id, null, null);
$tpl->templateId = $_templateId;
}
+ if ($do_clone) {
+ $tpl->smarty = clone $tpl->smarty;
+ }
+ $tpl->parent = $parent ? $parent : $this;
// fill data if present
if (!empty($data) && is_array($data)) {
// set up variable values
foreach ($data as $_key => $_val) {
- $tpl->tpl_vars[$_key] = new Smarty_Variable($_val);
+ $tpl->tpl_vars[ $_key ] = new Smarty_Variable($_val);
}
}
- if ($this->debugging) {
- Smarty_Internal_Debug::register_template($tpl);
+ if ($this->debugging || $this->debugging_ctrl == 'URL') {
+ $tpl->smarty->_debug = new Smarty_Internal_Debug();
+ // check URL debugging control
+ if (!$this->debugging && $this->debugging_ctrl == 'URL') {
+ $tpl->smarty->_debug->debugUrl($tpl->smarty);
+ }
}
return $tpl;
}
@@ -1386,126 +1150,97 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function loadPlugin($plugin_name, $check = true)
{
- // if function or class exists, exit silently (already loaded)
- if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
- return true;
+ return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check);
+ }
+
+ /**
+ * Get unique template id
+ *
+ * @param string $template_name
+ * @param null|mixed $cache_id
+ * @param null|mixed $compile_id
+ * @param null $caching
+ * @param \Smarty_Internal_Template $template
+ *
+ * @return string
+ */
+ public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null,
+ Smarty_Internal_Template $template = null)
+ {
+ $template_name = (strpos($template_name, ':') === false) ? "{$this->default_resource_type}:{$template_name}" :
+ $template_name;
+ $cache_id = $cache_id === null ? $this->cache_id : $cache_id;
+ $compile_id = $compile_id === null ? $this->compile_id : $compile_id;
+ $caching = (int) ($caching === null ? $this->caching : $caching);
+
+ if ((isset($template) && strpos($template_name, ':.') !== false) || $this->allow_ambiguous_resources) {
+ $_templateId =
+ Smarty_Resource::getUniqueTemplateName((isset($template) ? $template : $this), $template_name) .
+ "#{$cache_id}#{$compile_id}#{$caching}";
+ } else {
+ $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}";
}
- // Plugin name is expected to be: Smarty_[Type]_[Name]
- $_name_parts = explode('_', $plugin_name, 3);
- // class name must have three parts to be valid plugin
- // count($_name_parts) < 3 === !isset($_name_parts[2])
- if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
- throw new SmartyException("plugin {$plugin_name} is not a valid name format");
+ if (isset($_templateId[ 150 ])) {
+ $_templateId = sha1($_templateId);
}
- // if type is "internal", get plugin from sysplugins
- if (strtolower($_name_parts[1]) == 'internal') {
- $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
- if (isset($this->_is_file_cache[$file]) ? $this->_is_file_cache[$file] : $this->_is_file_cache[$file] = is_file($file)) {
- require_once($file);
- return $file;
- } else {
- return false;
+ return $_templateId;
+ }
+
+ /**
+ * Normalize path
+ * - remove /./ and /../
+ * - make it absolute if required
+ *
+ * @param string $path file path
+ * @param bool $realpath if true - convert to absolute
+ * false - convert to relative
+ * null - keep as it is but remove /./ /../
+ *
+ * @return string
+ */
+ public function _realpath($path, $realpath = null)
+ {
+ $nds = DS == '/' ? '\\' : '/';
+ // normalize DS
+ $path = str_replace($nds, DS, $path);
+ preg_match('%^(?(?:[[:alpha:]]:[\\\\]|/|[\\\\]{2}[[:alpha:]]+|[[:print:]]{2,}:[/]{2}|[\\\\])?)(?(?:[[:print:]]*))$%',
+ $path, $parts);
+ $path = $parts[ 'path' ];
+ if ($parts[ 'root' ] == '\\') {
+ $parts[ 'root' ] = substr(getcwd(), 0, 2) . $parts[ 'root' ];
+ } else {
+ if ($realpath !== null && !$parts[ 'root' ]) {
+ $path = getcwd() . DS . $path;
}
}
- // plugin filename is expected to be: [type].[name].php
- $_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
-
- $_stream_resolve_include_path = function_exists('stream_resolve_include_path');
-
- // loop through plugin dirs and find the plugin
- foreach ($this->getPluginsDir() as $_plugin_dir) {
- $names = array($_plugin_dir . $_plugin_filename, $_plugin_dir . strtolower($_plugin_filename),);
- foreach ($names as $file) {
- if (isset($this->_is_file_cache[$file]) ? $this->_is_file_cache[$file] : $this->_is_file_cache[$file] = is_file($file)) {
- require_once($file);
- return $file;
- }
- if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
- // try PHP include_path
- if ($_stream_resolve_include_path) {
- $file = stream_resolve_include_path($file);
- } else {
- $file = Smarty_Internal_Get_Include_Path::getIncludePath($file);
- }
-
- if ($file !== false) {
- require_once($file);
-
- return $file;
- }
- }
+ // remove noop 'DS DS' and 'DS.DS' patterns
+ $path = preg_replace('#([\\\\/]([.]?[\\\\/])+)#', DS, $path);
+ // resolve '..DS' pattern, smallest first
+ if (strpos($path, '..' . DS) != false &&
+ preg_match_all('#(([.]?[\\\\/])*([.][.])[\\\\/]([.]?[\\\\/])*)+#', $path, $match)
+ ) {
+ $counts = array();
+ foreach ($match[ 0 ] as $m) {
+ $counts[] = (int) ((strlen($m) - 1) / 3);
+ }
+ sort($counts);
+ foreach ($counts as $count) {
+ $path = preg_replace('#(([\\\\/]([.]?[\\\\/])*[^\\\\/.]+){' . $count .
+ '}[\\\\/]([.]?[\\\\/])*([.][.][\\\\/]([.]?[\\\\/])*){' . $count . '})(?=[^.])#',
+ DS, $path);
}
}
- // no plugin loaded
- return false;
+
+ return $parts[ 'root' ] . $path;
}
/**
- * Compile all template files
- *
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
- *
- * @return integer number of template files recompiled
+ * Empty template objects cache
*/
- public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+ public function _clearTemplateCache()
{
- return Smarty_Internal_Utility::compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, $this);
- }
-
- /**
- * Compile all config files
- *
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
- *
- * @return integer number of template files recompiled
- */
- public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
- {
- return Smarty_Internal_Utility::compileAllConfig($extension, $force_compile, $time_limit, $max_errors, $this);
- }
-
- /**
- * Delete compiled template file
- *
- * @param string $resource_name template name
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time
- *
- * @return integer number of template files deleted
- */
- public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
- {
- return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);
- }
-
- /**
- * Return array of tag/attributes of all tags used by an template
- *
- * @param Smarty_Internal_Template $template
- *
- * @return array of tag/attributes
- */
- public function getTags(Smarty_Internal_Template $template)
- {
- return Smarty_Internal_Utility::getTags($template);
- }
-
- /**
- * Run installation test
- *
- * @param array $errors Array to write errors into, rather than outputting them
- *
- * @return boolean true if setup is fine, false if something is wrong
- */
- public function testInstall(&$errors = null)
- {
- return Smarty_Internal_TestInstall::testInstall($this, $errors);
+ $this->_cache[ 'isCached' ] = array();
+ $this->_cache[ 'tplObjects' ] = array();
}
/**
@@ -1524,38 +1259,6 @@ class Smarty extends Smarty_Internal_TemplateBase
$this->use_sub_dirs = $use_sub_dirs;
}
- /**
- * @param boolean $caching
- */
- public function setCaching($caching)
- {
- $this->caching = $caching;
- }
-
- /**
- * @param int $cache_lifetime
- */
- public function setCacheLifetime($cache_lifetime)
- {
- $this->cache_lifetime = $cache_lifetime;
- }
-
- /**
- * @param string $compile_id
- */
- public function setCompileId($compile_id)
- {
- $this->compile_id = $compile_id;
- }
-
- /**
- * @param string $cache_id
- */
- public function setCacheId($cache_id)
- {
- $this->cache_id = $cache_id;
- }
-
/**
* @param int $error_reporting
*/
@@ -1653,11 +1356,29 @@ class Smarty extends Smarty_Internal_TemplateBase
}
/**
- * Class destructor
+ * @param string $default_resource_type
*/
- public function __destruct()
+ public function setDefaultResourceType($default_resource_type)
{
- // intentionally left blank
+ $this->default_resource_type = $default_resource_type;
+ }
+
+ /**
+ * @param string $caching_type
+ */
+ public function setCachingType($caching_type)
+ {
+ $this->caching_type = $caching_type;
+ }
+
+ /**
+ * Test install
+ *
+ * @param null $errors
+ */
+ public function testInstall(&$errors = null)
+ {
+ Smarty_Internal_TestInstall::testInstall($this, $errors);
}
/**
@@ -1671,15 +1392,17 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function __get($name)
{
- $allowed = array('template_dir' => 'getTemplateDir', 'config_dir' => 'getConfigDir',
- 'plugins_dir' => 'getPluginsDir', 'compile_dir' => 'getCompileDir',
- 'cache_dir' => 'getCacheDir',);
-
- if (isset($allowed[$name])) {
- return $this->{$allowed[$name]}();
+ if (isset($this->accessMap[ $name ])) {
+ $method = 'get' . $this->accessMap[ $name ];
+ return $this->{$method}();
+ } elseif (isset($this->_cache[ $name ])) {
+ return $this->_cache[ $name ];
+ } elseif (in_array($name, $this->obsoleteProperties)) {
+ return null;
} else {
trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
}
+ return null;
}
/**
@@ -1692,14 +1415,17 @@ class Smarty extends Smarty_Internal_TemplateBase
*/
public function __set($name, $value)
{
- $allowed = array('template_dir' => 'setTemplateDir', 'config_dir' => 'setConfigDir',
- 'plugins_dir' => 'setPluginsDir', 'compile_dir' => 'setCompileDir',
- 'cache_dir' => 'setCacheDir',);
-
- if (isset($allowed[$name])) {
- $this->{$allowed[$name]}($value);
+ if (isset($this->accessMap[ $name ])) {
+ $method = 'set' . $this->accessMap[ $name ];
+ $this->{$method}($value);
+ } elseif (in_array($name, $this->obsoleteProperties)) {
+ return;
} else {
- trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
+ if (is_object($value) && method_exists($value, $name)) {
+ $this->$name = $value;
+ } else {
+ trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
+ }
}
}
@@ -1714,18 +1440,18 @@ class Smarty extends Smarty_Internal_TemplateBase
* @param $errline
* @param $errcontext
*
- * @return boolean
+ * @return bool|void
*/
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
$_is_muted_directory = false;
// add the SMARTY_DIR to the list of muted directories
- if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
+ if (!isset(Smarty::$_muted_directories[ SMARTY_DIR ])) {
$smarty_dir = realpath(SMARTY_DIR);
if ($smarty_dir !== false) {
- Smarty::$_muted_directories[SMARTY_DIR] = array('file' => $smarty_dir,
- 'length' => strlen($smarty_dir),);
+ Smarty::$_muted_directories[ SMARTY_DIR ] =
+ array('file' => $smarty_dir, 'length' => strlen($smarty_dir),);
}
}
@@ -1736,26 +1462,27 @@ class Smarty extends Smarty_Internal_TemplateBase
$file = realpath($key);
if ($file === false) {
// this directory does not exist, remove and skip it
- unset(Smarty::$_muted_directories[$key]);
+ unset(Smarty::$_muted_directories[ $key ]);
continue;
}
$dir = array('file' => $file, 'length' => strlen($file),);
}
- if (!strncmp($errfile, $dir['file'], $dir['length'])) {
+ if (!strncmp($errfile, $dir[ 'file' ], $dir[ 'length' ])) {
$_is_muted_directory = true;
break;
}
}
-
// pass to next error handler if this error did not occur inside SMARTY_DIR
// or the error was within smarty but masked to be ignored
if (!$_is_muted_directory || ($errno && $errno & error_reporting())) {
if (Smarty::$_previous_error_handler) {
- return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline, $errcontext);
+ return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline,
+ $errcontext);
} else {
return false;
}
}
+ return;
}
/**
diff --git a/www/smarty-3.1.27/SmartyBC.class.php b/www/lib/smarty-3.1.30/SmartyBC.class.php
similarity index 94%
rename from www/smarty-3.1.27/SmartyBC.class.php
rename to www/lib/smarty-3.1.30/SmartyBC.class.php
index 76dd8bd0..3955e4f2 100644
--- a/www/smarty-3.1.27/SmartyBC.class.php
+++ b/www/lib/smarty-3.1.30/SmartyBC.class.php
@@ -31,7 +31,7 @@
require_once(dirname(__FILE__) . '/Smarty.class.php');
/**
- * Smarty Backward Compatability Wrapper Class
+ * Smarty Backward Compatibility Wrapper Class
*
* @package Smarty
*/
@@ -44,14 +44,20 @@ class SmartyBC extends Smarty
*/
public $_version = self::SMARTY_VERSION;
+ /**
+ * This is an array of directories where trusted php scripts reside.
+ *
+ * @var array
+ */
+ public $trusted_dir = array();
+
/**
* Initialize new SmartyBC object
*
- * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
*/
- public function __construct(array $options = array())
+ public function __construct()
{
- parent::__construct($options);
+ parent::__construct();
}
/**
@@ -101,7 +107,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters custom function
+ * Unregister custom function
*
* @param string $function name of template function
*/
@@ -122,7 +128,8 @@ class SmartyBC extends Smarty
* @throws SmartyException
* @internal param array $block_functs list of methods that are block format
*/
- public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+ public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true,
+ $block_methods = array())
{
settype($allowed, 'array');
settype($smarty_args, 'boolean');
@@ -130,7 +137,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters object
+ * Unregister object
*
* @param string $object name of template object
*/
@@ -153,7 +160,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters block function
+ * Unregister block function
*
* @param string $block name of template function
*/
@@ -175,7 +182,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters compiler function
+ * Unregister compiler function
*
* @param string $function name of template function
*/
@@ -196,7 +203,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters modifier
+ * Unregister modifier
*
* @param string $modifier name of template modifier
*/
@@ -217,7 +224,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters a resource
+ * Unregister a resource
*
* @param string $type name of resource
*/
@@ -238,7 +245,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters a prefilter function
+ * Unregister a prefilter function
*
* @param callable $function
*/
@@ -259,7 +266,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters a postfilter function
+ * Unregister a postfilter function
*
* @param callable $function
*/
@@ -280,7 +287,7 @@ class SmartyBC extends Smarty
}
/**
- * Unregisters an outputfilter function
+ * Unregister an outputfilter function
*
* @param callable $function
*/
diff --git a/www/smarty-3.1.27/debug.tpl b/www/lib/smarty-3.1.30/debug.tpl
similarity index 95%
rename from www/smarty-3.1.27/debug.tpl
rename to www/lib/smarty-3.1.30/debug.tpl
index 5b09c5bd..5526cbca 100644
--- a/www/smarty-3.1.27/debug.tpl
+++ b/www/lib/smarty-3.1.30/debug.tpl
@@ -128,7 +128,7 @@
${$vars@key}
{if isset($vars['nocache'])}Nocache{/if}
- {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var:10:80 nofilter}{/if}
+ {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if}
|
Value{$vars['value']|debug_print_var:10:80 nofilter} |
{if isset($vars['attributes'])}Attributes{$vars['attributes']|debug_print_var nofilter} {/if} |
@@ -141,7 +141,7 @@
{foreach $config_vars as $vars}
#{$vars@key}#
- {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var:10:80 nofilter}{/if}
+ {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if}
|
{$vars['value']|debug_print_var:10:80 nofilter} |
@@ -152,9 +152,9 @@