Various updates and fixes for namespace change
This commit is contained in:
@@ -1 +0,0 @@
|
||||
../Smarty
|
||||
@@ -23,11 +23,6 @@ extract($_POST, EXTR_SKIP);
|
||||
// set output to quiet for load of classes & session settings
|
||||
ob_start();
|
||||
require("config.inc");
|
||||
|
||||
// login class, DB connections & Admin class, Smarty extension
|
||||
foreach (array ('Login', 'Admin.Backend', 'Smarty.Extend') as $class) {
|
||||
_spl_autoload('Class.'.$class.'.inc');
|
||||
}
|
||||
//------------------------------ library include end
|
||||
|
||||
//------------------------------ basic variable settings start
|
||||
@@ -50,17 +45,15 @@ if (array_key_exists('action', $_POST) && $_POST['action'] != 'download_csv') {
|
||||
|
||||
//------------------------------ class init start
|
||||
// login & page access check
|
||||
$login = new login($DB_CONFIG[LOGIN_DB], $lang);
|
||||
$login = new CoreLibs\ACL\Login($DB_CONFIG[LOGIN_DB], $lang);
|
||||
// post login lang check
|
||||
if ($_SESSION['DEFAULT_LANG']) {
|
||||
$lang = $_SESSION['DEFAULT_LANG'];
|
||||
}
|
||||
// create smarty object
|
||||
$smarty = new SmartyML($lang);
|
||||
$smarty = new CoreLibs\Template\SmartyExtend($lang);
|
||||
// create new DB class
|
||||
$cms = new AdminBackend($DB_CONFIG[MAIN_DB], $lang);
|
||||
// set search path to the default DB schema
|
||||
$cms->db_exec("SET search_path TO ".DB_SCHEMA);
|
||||
$cms = new CoreLibs\Admin\Backend($DB_CONFIG[MAIN_DB], $lang);
|
||||
// the menu show flag (what menu to show)
|
||||
$cms->menu_show_flag = 'main';
|
||||
// db nfo
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../libs/
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$DEBUG_ALL_OVERRIDE = 0; // set to 1 to debug on live/remote server locations
|
||||
$DEBUG_ALL = 1;
|
||||
$PRINT_ALL = 1;
|
||||
@@ -14,18 +16,26 @@ DEFINE('SET_SESSION_NAME', EDIT_SESSION_NAME);
|
||||
|
||||
echo "DIR: ".DIR."<br>ROOT: ".ROOT."<br>BASE: ".BASE."<br>";
|
||||
|
||||
$lang = 'en_utf8';
|
||||
$lang = 'ja_utf8';
|
||||
$base = new CoreLibs\Admin\Backend($DB_CONFIG[MAIN_DB], $lang);
|
||||
ob_end_flush();
|
||||
|
||||
print "Start time: ".$base->runningTime()."<br>";
|
||||
print "ByteStringFormat: ".$base->ByteStringFormat(1234567.12)."<br>";
|
||||
print "byteStringFormat: ".$base->byteStringFormat(1234567.12)."<br>";
|
||||
print "get_page_name: ".$base->get_page_name()."<br>";
|
||||
print "getPageName: ".$base->getPageName()."<br>";
|
||||
|
||||
print "DB Info: ".$base->dbInfo(1);
|
||||
print "DB Info: ".$base->dbInfo(1)."<br>";
|
||||
|
||||
ob_end_flush();
|
||||
|
||||
print "End Time: ".$base->runningTime()."<br>";
|
||||
print "Run Time: ".$base->runningTime()."<br>";
|
||||
|
||||
print "Lang: ".$base->l->__getLang().", MO File: ".$base->l->__getMoFile()."<br>";
|
||||
print "Translate test: Year -> ".$base->l->__('Year')."<br>";
|
||||
|
||||
// end error print
|
||||
print $base->printErrorMsg();
|
||||
|
||||
# __END__
|
||||
|
||||
BIN
www/layout/admin/default/lang/ja_utf8.mo
Normal file
BIN
www/layout/admin/default/lang/ja_utf8.mo
Normal file
Binary file not shown.
Binary file not shown.
@@ -10,11 +10,11 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Project Version\n"
|
||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@e-graphics.com\n"
|
||||
"POT-Creation-Date: 2005-08-09 09:26+0900\n"
|
||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@e-graphics.com>\n"
|
||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#********************************************************************
|
||||
# AUTHOR: Clemens Schwaighofer
|
||||
# CREATED: 2007/04/18
|
||||
# CREATED: 2018/03/28
|
||||
# SHORT DESCRIPTION:
|
||||
# Backend Japanese Messages file for gettext
|
||||
# to craete: msgfmt -o ja.mo messages_ja.po
|
||||
@@ -10,14 +10,54 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Project Version\n"
|
||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@e-graphics.com\n"
|
||||
"POT-Creation-Date: 2007-04-18 17:40+0900\n"
|
||||
"Report-Msgid-Bugs-To: clemens.schwaighofer@egplusww.com\n"
|
||||
"POT-Creation-Date: 2018-03-28 10:40+0900\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@e-graphics.com>\n"
|
||||
"Language-Team: E-GRAPHICS COMMUNICATIONS Japan <info.jp@egplusww.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
msgstr "はい"
|
||||
|
||||
msgid "No"
|
||||
msgstr "いいえ"
|
||||
|
||||
# Basic date info
|
||||
msgid "Year"
|
||||
msgstr "年"
|
||||
|
||||
msgid "Month"
|
||||
msgstr "月"
|
||||
|
||||
msgid "Day"
|
||||
msgstr "日"
|
||||
|
||||
msgid "Hour"
|
||||
msgstr "時"
|
||||
|
||||
msgid "Minute"
|
||||
msgstr "分"
|
||||
|
||||
msgid "Mon"
|
||||
msgstr "月"
|
||||
|
||||
msgid "Tue"
|
||||
msgstr "火"
|
||||
|
||||
msgid "Wed"
|
||||
msgstr "水"
|
||||
|
||||
msgid "Thu"
|
||||
msgstr "木"
|
||||
|
||||
msgid "Fri"
|
||||
msgstr "金"
|
||||
|
||||
msgid "Sat"
|
||||
msgstr "土"
|
||||
|
||||
msgid "Sun"
|
||||
msgstr "日"
|
||||
|
||||
@@ -478,8 +478,8 @@ class Login extends \CoreLibs\DB\IO
|
||||
$q .= "AND eu.edit_user_id = ".$this->euid." AND filename = '".$this->page_name."' AND eg.enabled = 1 AND epa.enabled = 1";
|
||||
$res = $this->dbReturnRow($q);
|
||||
// unset mem limit if debug is set to 1
|
||||
// if (($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] || $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) && ini_get('memory_limit') != -1)
|
||||
// ini_set('memory_limit', -1);
|
||||
// if (($GLOBALS["DEBUG_ALL"] || $GLOBALS["DB_DEBUG"] || $_SESSION["DEBUG_ALL"] || $_SESSION["DB_DEBUG"]) && ini_get('memory_limit') != -1)
|
||||
// ini_set('memory_limit', -1);
|
||||
if ($res["filename"] == $this->page_name) {
|
||||
$this->permission_okay = 1;
|
||||
} else {
|
||||
|
||||
@@ -63,7 +63,6 @@ class Backend extends \CoreLibs\DB\IO
|
||||
$this->l = new \CoreLibs\Language\L10n($lang);
|
||||
|
||||
// init the database class
|
||||
// $this->db_io($db_config, $debug, $db_debug, $echo, $print);
|
||||
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
|
||||
|
||||
// internal
|
||||
@@ -149,13 +148,6 @@ class Backend extends \CoreLibs\DB\IO
|
||||
$this->db_exec($q, 'NULL');
|
||||
}
|
||||
|
||||
|
||||
// ==================================
|
||||
// ALL THE PAGE RIGHTS/USER RIGHTS/ETC need to fixed and put into one
|
||||
// proper settings have to be done with the defined top down rights flow
|
||||
// ==================================
|
||||
// all ACLs are set in the login class
|
||||
|
||||
// METHOD: adbTopMenu
|
||||
// PARAMS: level
|
||||
// RETURN: returns an array for the top menu with all correct settings
|
||||
@@ -258,7 +250,7 @@ class Backend extends \CoreLibs\DB\IO
|
||||
// DESC : creates out of a normal db_return array an assoc array
|
||||
public function adbAssocArray($db_array, $key, $value)
|
||||
{
|
||||
return $this->GenAssocArray($db_array, $key, $value);
|
||||
return $this->genAssocArray($db_array, $key, $value);
|
||||
}
|
||||
|
||||
// REMARK: below function has moved to "Class.Basic"
|
||||
@@ -268,7 +260,7 @@ class Backend extends \CoreLibs\DB\IO
|
||||
// DESC : converts bytes into formated string with KB, MB, etc
|
||||
public function adbByteStringFormat($number)
|
||||
{
|
||||
return $this->ByteStringFormat($number);
|
||||
return $this->byteStringFormat($number);
|
||||
}
|
||||
|
||||
// REMARK: below function has moved to "Class.Basic"
|
||||
@@ -283,7 +275,7 @@ class Backend extends \CoreLibs\DB\IO
|
||||
// DESC : converts picture to a thumbnail with max x and max y size
|
||||
public function adbCreateThumbnail($pic, $size_x, $size_y, $dummy = false, $path = "", $cache = "")
|
||||
{
|
||||
return $this->CreateThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
|
||||
return $this->createThumbnail($pic, $size_x, $size_y, $dummy, $path, $cache);
|
||||
}
|
||||
|
||||
// METHOD: adbMsg
|
||||
@@ -340,67 +332,30 @@ class Backend extends \CoreLibs\DB\IO
|
||||
|
||||
// METHOD: adbPrintDateTime
|
||||
// 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
|
||||
// minute steps, can be 1 (default), 5, 10, etc, if invalid (outside 1h range, it falls back to 1min)
|
||||
// suffix: additional info printed after the date time variable in the drop down,
|
||||
// also used for ID in the on change JS call
|
||||
// minute steps: can be 1 (default), 5, 10, etc, if invalid (outside 1h range,
|
||||
// it falls back to 1min)
|
||||
// name pos back: default false, if set to true, the name will be printend
|
||||
// after the drop down and not before the drop down
|
||||
// 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 function adbPrintDateTime($year, $month, $day, $hour, $min, $suffix = '', $min_steps = 1)
|
||||
// NOTE : Basic class holds exact the same, except the Year/Month/Day/etc strings
|
||||
// are translated in this call
|
||||
public function adbPrintDateTime($year, $month, $day, $hour, $min, $suffix = '', $min_steps = 1, $name_pos_back = false)
|
||||
{
|
||||
// if suffix given, add _ before
|
||||
if ($suffix) {
|
||||
$suffix = '_'.$suffix;
|
||||
// get the build layout
|
||||
$html_time = $this->printDateTime($year, $month, $day, $hour, $min, $suffix, $min_steps, $name_pos_back);
|
||||
// translate the strings inside
|
||||
foreach (array('Year ', 'Month ', 'Day ', 'Hour ', 'Minute ') as $_time) {
|
||||
$html_time = str_replace($_time, $this->l->__(str_replace(' ', '', $_time)).' ', $html_time);
|
||||
}
|
||||
if ($min_steps < 1 || $min_steps > 59) {
|
||||
$min_steps = 1;
|
||||
// replace week days in short
|
||||
foreach (array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun') as $_date) {
|
||||
$html_time = str_replace('('.$_date.')', '('.$this->l->__($_date).')', $html_time);
|
||||
}
|
||||
|
||||
$on_change_call = 'dt_list(\''.$suffix.'\');';
|
||||
|
||||
// always be 1h ahead (for safety)
|
||||
$timestamp = time() + 3600; // in seconds
|
||||
|
||||
// the max year is this year + 1;
|
||||
$max_year = date("Y", $timestamp) + 1;
|
||||
|
||||
// preset year, month, ...
|
||||
$year = (!$year) ? date("Y", $timestamp) : $year;
|
||||
$month = (!$month) ? date("m", $timestamp) : $month;
|
||||
$day = (!$day) ? date("d", $timestamp) : $day;
|
||||
$hour = (!$hour) ? date("H", $timestamp) : $hour;
|
||||
$min = (!$min) ? date("i", $timestamp) : $min; // add to five min?
|
||||
// max days in selected month
|
||||
$days_in_month = date("t", strtotime($year."-".$month."-".$day." ".$hour.":".$min.":0"));
|
||||
|
||||
// from now to ?
|
||||
$string = $this->l->__('Year').' ';
|
||||
$string .= '<select id="year'.$suffix.'" name="year'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = date("Y"); $i <= $max_year; $i ++) {
|
||||
$string .= '<option value="'.$i.'" '.(($year == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> '.$this->l->__('Month').' ';
|
||||
$string .= '<select id="month'.$suffix.'" name="month'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 1; $i <= 12; $i ++) {
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($month == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> '.$this->l->__('Day').' ';
|
||||
$string .= '<select id="day'.$suffix.'" name="day'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 1; $i <= $days_in_month; $i ++) {
|
||||
// set weekday text based on current month ($month) and year ($year)
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($day == $i) ? 'selected' : '').'>'.$i.' ('.$this->l->__(date('D', mktime(0, 0, 0, $month, $i, $year))).')</option>';
|
||||
}
|
||||
$string .= '</select> '.$this->l->__('Hour').' ';
|
||||
$string .= '<select id="hour'.$suffix.'" name="hour'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 0; $i <= 23; $i ++) {
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($hour == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> '.$this->l->__('Minute').' ';
|
||||
$string .= '<select id="min'.$suffix.'" name="min'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 0; $i <= 59; $i += $min_steps) {
|
||||
$string .= '<option value="'.(( $i < 10) ? '0'.$i : $i).'" '.(($min == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select>';
|
||||
// return the datetime select string
|
||||
return $string;
|
||||
// return the datetime select string with strings translated
|
||||
return $html_time;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* error_id
|
||||
* error_string
|
||||
*
|
||||
* PUBLIC METHOD:S
|
||||
* PUBLIC METHODS
|
||||
* debug -> calls with "level", "string" and flag to turn off (0) the newline at the end
|
||||
* debug_for -> sets debug on/off for a type (error, echo, print) for a certain level
|
||||
* print_error_msg -> prints out the error message, optional parameter is a header prefix
|
||||
@@ -60,7 +60,7 @@
|
||||
* crypt* -> encrypt and decrypt login string data, used by Login class
|
||||
* setFormToken/validateFormToken -> form protection with token
|
||||
*
|
||||
* PRIVATE METHOD:S
|
||||
* PRIVATE METHODS
|
||||
* fdebug_fp -> opens and closes file, called from fdebug method
|
||||
* write_error_msg -> writes error msg to file if requested
|
||||
*
|
||||
@@ -130,8 +130,8 @@ class Basic
|
||||
public $log_per_page = 0; // set, will split log per called file
|
||||
public $log_per_run = 0; // create a new log file per run (time stamp + unique ID)
|
||||
|
||||
public $starttime; // start time if time debug is used
|
||||
public $endtime; // end time if time debug is used
|
||||
private $starttime; // start time if time debug is used
|
||||
private $endtime; // end time if time debug is used
|
||||
|
||||
public $email_regex; // regex var for email check
|
||||
public $keitai_email_regex; // regex var for email check
|
||||
@@ -360,7 +360,7 @@ class Basic
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
// GENERAL METHOD:S
|
||||
// GENERAL METHODS
|
||||
// *************************************************************
|
||||
|
||||
// METHOD: db_io_info
|
||||
@@ -413,6 +413,16 @@ class Basic
|
||||
return $running_time;
|
||||
}
|
||||
|
||||
// METHOD: resetRunningtime
|
||||
// PARAMS: none
|
||||
// RETURN: none
|
||||
// DESC : resets start & end time for runningTime call
|
||||
public function resetRunningTime()
|
||||
{
|
||||
$this->starttime = '';
|
||||
$this->endtime = '';
|
||||
}
|
||||
|
||||
// METHOD: printTime
|
||||
// WAS : print_time
|
||||
// PARAMS: $set_microtime, 0 shows none, default (-1) shows all, positive number is for rounding
|
||||
@@ -458,7 +468,7 @@ class Basic
|
||||
private function fdebugFP($flag = '')
|
||||
{
|
||||
if (!$this->debug_fp || $flag == 'o') {
|
||||
$fn = ROOT.LOG.$this->debug_filename;
|
||||
$fn = BASE.LOG.$this->debug_filename;
|
||||
$this->debug_fp = @fopen($fn, 'a');
|
||||
} elseif ($this->debug_fp || $flag == 'c') {
|
||||
fclose($this->debug_fp);
|
||||
@@ -621,7 +631,7 @@ class Basic
|
||||
// init output variable
|
||||
$output = $error_string; // output formated error string to output file
|
||||
// init base file path
|
||||
$fn = ROOT.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
||||
$fn = BASE.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
||||
// log ID prefix settings, if not valid, replace with empty
|
||||
if (preg_match("/^[A-Za-z0-9]+$/", $this->log_file_id)) {
|
||||
$rpl_string = '_'.$this->log_file_id;
|
||||
@@ -691,10 +701,11 @@ class Basic
|
||||
// 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,
|
||||
// to use it call with set_error_handler(array("Basic", "ErrorHandler"));
|
||||
// NOTE : this will only catch any additional erros created AFTER the set_error_handler was set,
|
||||
// so mostly no strict/notices from the classes are visible
|
||||
public static function errorHandler($type, $message, $file, $line, $context)
|
||||
// also, this currently returns true, which will invoke the standard PHP error reporter too
|
||||
public static function errorHandler($type, $message, $file, $line)
|
||||
{
|
||||
// error levels for PHP
|
||||
// values based on 5.3
|
||||
@@ -717,11 +728,12 @@ class Basic
|
||||
30719 => 'E_ALL' // 6143 in 5.2, 2047 in previous versions
|
||||
);
|
||||
|
||||
$fn = ROOT.LOG.'php_errors-'.date('Y-m-d').'.log';
|
||||
$fn = BASE.LOG.'php_errors-'.date('Y-m-d').'.log';
|
||||
$output = '['.Basic::print_time().'] {'.Basic::get_page_name().'} ['.$file.'] <'.$line.'> ['.$error_level[$type].'|'.$type.']: '.$message."\n";
|
||||
$fp = fopen($fn, 'a');
|
||||
fwrite($fp, $output);
|
||||
fclose($fp);
|
||||
// if set to false the PHP error reporter will be called after this
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1030,7 @@ class Basic
|
||||
if (($result = Basic::arraySearchSimple($_value, $key, $value)) !== false) {
|
||||
return $result;
|
||||
}
|
||||
} elseif ($_key == $key && $_value = $value) {
|
||||
} elseif ($_key == $key && $_value == $value) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1026,6 +1038,54 @@ class Basic
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
if (!is_array($haystack)) {
|
||||
return false;
|
||||
}
|
||||
$found = array ();
|
||||
foreach ($needle as $element) {
|
||||
if (in_array($element, $haystack)) {
|
||||
$found[] = $element;
|
||||
}
|
||||
}
|
||||
if (count($found) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return $found;
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
if ($key && $value && (($set_only && $db_array[$i][$value]) || (!$set_only))) {
|
||||
$ret_array[$db_array[$i][$key]] = $db_array[$i][$value];
|
||||
} elseif (!$key && $value) {
|
||||
$ret_array[] = $db_array[$i][$value];
|
||||
} elseif ($key && !$value) {
|
||||
$ret_array[$db_array[$i][$key]] = $i;
|
||||
}
|
||||
}
|
||||
return $ret_array;
|
||||
}
|
||||
|
||||
// METHOD: __mbMimeEncode
|
||||
// WAS : _mb_mime_encode
|
||||
// PARAMS: string to encode, encoding to encode in
|
||||
@@ -1085,6 +1145,9 @@ class Basic
|
||||
$number = trim($number);
|
||||
$last = strtolower($number[strlen($number) - 1]);
|
||||
switch ($last) {
|
||||
case 't':
|
||||
$number *= 1024;
|
||||
// no break, calc down next level
|
||||
case 'g':
|
||||
$number *= 1024;
|
||||
// no break: if we have giga we do first multiplication before the others
|
||||
@@ -1105,10 +1168,9 @@ class Basic
|
||||
public static function dateStringFormat($timestamp, $show_micro = true)
|
||||
{
|
||||
list ($timestamp, $ms) = explode('.', round($timestamp, 4));
|
||||
$string = date("Y-m-d H:i:s", $timestamp);
|
||||
if ($show_micro) {
|
||||
$string = date("Y-m-d H:i:s", $timestamp).' '.$ms.'ms';
|
||||
} else {
|
||||
$string = date("Y-m-d H:i:s", $timestamp);
|
||||
$string .= ' '.$ms.'ms';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
@@ -1176,26 +1238,6 @@ class Basic
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
if ($key && $value && (($set_only && $db_array[$i][$value]) || (!$set_only))) {
|
||||
$ret_array[$db_array[$i][$key]] = $db_array[$i][$value];
|
||||
} elseif (!$key && $value) {
|
||||
$ret_array[] = $db_array[$i][$value];
|
||||
} elseif ($key && !$value) {
|
||||
$ret_array[$db_array[$i][$key]] = $i;
|
||||
}
|
||||
}
|
||||
return $ret_array;
|
||||
}
|
||||
|
||||
// METHOD: checkDate
|
||||
// WAS : CheckDate
|
||||
// PARAMS: date (YYYY-MM-DD)
|
||||
@@ -1339,12 +1381,12 @@ class Basic
|
||||
if ($cache_source) {
|
||||
$tmp_src = $cache_source;
|
||||
} else {
|
||||
$tmp_src = ROOT.TMP;
|
||||
$tmp_src = BASE.TMP;
|
||||
}
|
||||
// check if pic has a path, and override next sets
|
||||
if (strstr($pic, '/') === false) {
|
||||
if (!$path) {
|
||||
$path = ROOT;
|
||||
$path = BASE;
|
||||
}
|
||||
$filename = $path.MEDIA.PICTURES.$pic;
|
||||
} else {
|
||||
@@ -1432,14 +1474,6 @@ class Basic
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
// *** DEPRICATED CALL ***
|
||||
// should be removed later
|
||||
public function checkConvert($string, $from_encoding, $to_encoding)
|
||||
{
|
||||
$this->debug('DEPRICATED CALL', 'Depricated call for method: checkConvert [NOW: checkConvertEncoding]');
|
||||
return $this->checkConvertEncoding($string, $from_encoding, $to_encoding);
|
||||
}
|
||||
|
||||
// METHOD: checkConvertEncoding
|
||||
// PARAMS: string: string to test
|
||||
// from_encoding: source encoding of this string
|
||||
@@ -1936,34 +1970,6 @@ class Basic
|
||||
return '#'.$red.$green.$blue;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
if (!is_array($haystack)) {
|
||||
return false;
|
||||
}
|
||||
$found = array ();
|
||||
foreach ($needle as $element) {
|
||||
if (in_array($element, $haystack)) {
|
||||
$found[] = $element;
|
||||
}
|
||||
}
|
||||
if (count($found) == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return $found;
|
||||
}
|
||||
}
|
||||
|
||||
// METHOD: getEmailType
|
||||
// PARAMS: email, short == false
|
||||
// RETURN: string for email type, eg "pc", "docomo", etc
|
||||
@@ -2004,16 +2010,22 @@ class Basic
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// name_pos_back: default false, if set to true, the name will be printend
|
||||
// after the drop down and not before the drop down
|
||||
// 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)
|
||||
public static function printDateTime($year, $month, $day, $hour, $min, $suffix = '', $min_steps = 1, $name_pos_back = false)
|
||||
{
|
||||
// if suffix given, add _ before
|
||||
if ($suffix) {
|
||||
$suffix = '_'.$suffix;
|
||||
}
|
||||
if ($min_steps < 1 || $min_steps > 59) {
|
||||
$min_steps = 1;
|
||||
}
|
||||
|
||||
$on_change_call = 'dt_list(\''.$suffix.'\');';
|
||||
|
||||
@@ -2033,33 +2045,62 @@ class Basic
|
||||
$days_in_month = date("t", strtotime($year."-".$month."-".$day." ".$hour.":".$min.":0"));
|
||||
|
||||
// from now to ?
|
||||
$string = 'Year ';
|
||||
if ($name_pos_back === false) {
|
||||
$string = 'Year ';
|
||||
}
|
||||
$string .= '<select id="year'.$suffix.'" name="year'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = date("Y"); $i <= $max_year; $i ++) {
|
||||
$string .= '<option value="'.$i.'" '.(($year == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> Month ';
|
||||
$string .= '</select> ';
|
||||
if ($name_pos_back === true) {
|
||||
$string .= 'Year ';
|
||||
}
|
||||
if ($name_pos_back === false) {
|
||||
$string .= 'Month ';
|
||||
}
|
||||
$string .= '<select id="month'.$suffix.'" name="month'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 1; $i <= 12; $i ++) {
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($month == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> Day ';
|
||||
$string .= '</select> ';
|
||||
if ($name_pos_back === true) {
|
||||
$string .= 'Month ';
|
||||
}
|
||||
if ($name_pos_back === false) {
|
||||
$string .= 'Day ';
|
||||
}
|
||||
$string .= '<select id="day'.$suffix.'" name="day'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 1; $i <= $days_in_month; $i ++) {
|
||||
// set weekday text based on current month ($month) and year ($year)
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($day == $i) ? 'selected' : '').'>'.$i.' ('.$this->l->__(date('D', mktime(0, 0, 0, $month, $i, $year))).')</option>';
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($day == $i) ? 'selected' : '').'>'.$i.' ('.date('D', mktime(0, 0, 0, $month, $i, $year)).')</option>';
|
||||
}
|
||||
$string .= '</select> ';
|
||||
if ($name_pos_back === true) {
|
||||
$string .= 'Day ';
|
||||
}
|
||||
if ($name_pos_back === false) {
|
||||
$string .= 'Hour ';
|
||||
}
|
||||
$string .= '</select> Hour ';
|
||||
$string .= '<select id="hour'.$suffix.'" name="hour'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 0; $i <= 23; $i += $min_steps) {
|
||||
$string .= '<option value="'.(($i < 10) ? '0'.$i : $i).'" '.(($hour == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select> Minute ';
|
||||
$string .= '</select> ';
|
||||
if ($name_pos_back === true) {
|
||||
$string .= 'Hour ';
|
||||
}
|
||||
if ($name_pos_back === false) {
|
||||
$string .= 'Minute ';
|
||||
}
|
||||
$string .= '<select id="min'.$suffix.'" name="min'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||
for ($i = 0; $i <= 59; $i ++) {
|
||||
$string .= '<option value="'.(( $i < 10) ? '0'.$i : $i).'" '.(($min == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||
}
|
||||
$string .= '</select>';
|
||||
if ($name_pos_back === true) {
|
||||
$string .= ' Minute ';
|
||||
}
|
||||
// return the datetime select string
|
||||
return $string;
|
||||
}
|
||||
@@ -2095,7 +2136,17 @@ class Basic
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
// COMPATIBILITY METHOD:S
|
||||
// *** DEPRICATED CALL ***
|
||||
// *************************************************************
|
||||
// should be removed later
|
||||
public function checkConvert($string, $from_encoding, $to_encoding)
|
||||
{
|
||||
error_log('DEPRECATED CALL: '.__METHOD__.', '.__FILE__.':'.__LINE__.', '.debug_backtrace()[0]['file'].':'.debug_backtrace()[0]['line']);
|
||||
return $this->checkConvertEncoding($string, $from_encoding, $to_encoding);
|
||||
}
|
||||
|
||||
// *************************************************************
|
||||
// *** COMPATIBILITY METHODS ***
|
||||
// those methods are deprecated function call names
|
||||
// they exist for backwards compatibility only
|
||||
// *************************************************************
|
||||
|
||||
@@ -47,7 +47,7 @@ class PgSQL
|
||||
{
|
||||
private $last_error_query;
|
||||
private $dbh;
|
||||
// public $currval_query;
|
||||
// public $currval_query;
|
||||
|
||||
// METHOD: __construct
|
||||
// PARAMS: none
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
* Update: Clemens Schwaighofer
|
||||
* Date: 2012.9.5 [stacked output]
|
||||
* Date: 2013.2.21 [proper class formatting]
|
||||
* Date: 2017.4.13 [no output fix with cache overload]
|
||||
* Date: 2018.3.28 [PHPCS + namespace]
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -302,7 +304,7 @@ class ProgressBar
|
||||
|
||||
public function setLabelPosition($name, $left, $top, $width, $height, $align = '')
|
||||
{
|
||||
// print "SET POSITION[$name]: $left<br>";
|
||||
// print "SET POSITION[$name]: $left<br>";
|
||||
// if this is percent, we ignore anything, it is auto positioned
|
||||
if ($this->label[$name]['type'] != 'percent') {
|
||||
foreach (array('top', 'left', 'width', 'height') as $pos_name) {
|
||||
@@ -361,7 +363,7 @@ class ProgressBar
|
||||
if ($this->label[$name]['type'] == 'percent') {
|
||||
$this->label[$name]['top'] = round(($this->height - intval($size)) / log($this->height - intval($size), 7), 0) - $this->pedding;
|
||||
}
|
||||
// print "HEIGHT: ".$this->height.", Size: ".intval($size).", Pedding: ".$this->pedding.", Calc: ".round($this->height - intval($size)).", Log: ".log($this->height - intval($size), 7)."<br>";
|
||||
// print "HEIGHT: ".$this->height.", Size: ".intval($size).", Pedding: ".$this->pedding.", Calc: ".round($this->height - intval($size)).", Log: ".log($this->height - intval($size), 7)."<br>";
|
||||
// then set like usual
|
||||
$this->label[$name]['font-size'] = intval($size);
|
||||
if ($family != '') {
|
||||
@@ -385,7 +387,7 @@ class ProgressBar
|
||||
public function setLabelValue($name, $value)
|
||||
{
|
||||
$this->label[$name]['value'] = $value;
|
||||
// print "NAME[$name], Status: ".$this->status.": ".$value."<Br>";
|
||||
// print "NAME[$name], Status: ".$this->status.": ".$value."<Br>";
|
||||
if ($this->status != 'new') {
|
||||
echo '<script type="text/JavaScript">PBlabelText'.$this->code.'("'.$name.'","'.$this->label[$name]['value'].'");</script>'."\n";
|
||||
$this->__flushCache();
|
||||
@@ -479,7 +481,7 @@ class ProgressBar
|
||||
$js .= ' }'."\n";
|
||||
$js .= '}'."\n";
|
||||
|
||||
//print "DUMP LABEL: <br><pre>".print_r($this->label, 1)."</pre><br>";
|
||||
// print "DUMP LABEL: <br><pre>".print_r($this->label, 1)."</pre><br>";
|
||||
foreach ($this->label as $name => $data) {
|
||||
// set what type of move we do
|
||||
$move_prefix = $data['type'] == 'button' ? 'margin' : 'padding';
|
||||
@@ -524,7 +526,7 @@ class ProgressBar
|
||||
break;
|
||||
case 'percent':
|
||||
// only one inner percent
|
||||
// print "STYLE[$name]: ".$style_lbl."<br>";
|
||||
// print "STYLE[$name]: ".$style_lbl."<br>";
|
||||
if (!$html_percent) {
|
||||
$html_percent = '<div id="plbl'.$name.$this->code.'" style="'.$style_lbl.'width:'.$data['width'].'px;line-height:1;text-shadow: 0 0 .2em white, 0 0 .5em white;">'.$this->__calculatePercent($this->step).'%</div>'."\n";
|
||||
}
|
||||
@@ -666,3 +668,6 @@ class ProgressBar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user