Core libs clean up
- end comments from # to // - clean up not initialzed vars and wrong named vars
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
/********************************************************************
|
||||
* AUTHOR: Clemens Schwaighofer
|
||||
* CREATED: 2005/07/19
|
||||
@@ -7,45 +7,55 @@
|
||||
* HISTORY:
|
||||
*********************************************************************/
|
||||
|
||||
$day_short[1] = "Mon";
|
||||
$day_short[2] = "Tue";
|
||||
$day_short[3] = "Wed";
|
||||
$day_short[4] = "Thu";
|
||||
$day_short[5] = "Fri";
|
||||
$day_short[6] = "Sat";
|
||||
$day_short[7] = "Sun";
|
||||
$day_short = array (
|
||||
1 => 'Mon',
|
||||
2 => 'Tue',
|
||||
3 => 'Wed',
|
||||
4 => 'Thu',
|
||||
5 => 'Fri',
|
||||
6 => 'Sat',
|
||||
7 => 'Sun'
|
||||
);
|
||||
|
||||
$day_long[1] = "Monday";
|
||||
$day_long[2] = "Tuesday";
|
||||
$day_long[3] = "Wednesday";
|
||||
$day_long[4] = "Thursday";
|
||||
$day_long[5] = "Friday";
|
||||
$day_long[6] = "Saturday";
|
||||
$day_long[7] = "Sunday";
|
||||
$day_long = array (
|
||||
1 => 'Monday',
|
||||
2 => 'Tuesday',
|
||||
3 => 'Wednesday',
|
||||
4 => 'Thursday',
|
||||
5 => 'Friday',
|
||||
6 => 'Saturday',
|
||||
7 => 'Sunday'
|
||||
);
|
||||
|
||||
// monate
|
||||
$month_long[1] = "January";
|
||||
$month_long[2] = "February";
|
||||
$month_long[3] = "March";
|
||||
$month_long[4] = "April";
|
||||
$month_long[5] = "May";
|
||||
$month_long[6] = "June";
|
||||
$month_long[7] = "July";
|
||||
$month_long[8] = "August";
|
||||
$month_long[9] = "September";
|
||||
$month_long[10] = "October";
|
||||
$month_long[11] = "November";
|
||||
$month_long[12] = "December";
|
||||
// months
|
||||
$month_long = array (
|
||||
1 => 'January',
|
||||
2 => 'February',
|
||||
3 => 'March',
|
||||
4 => 'April',
|
||||
5 => 'May',
|
||||
6 => 'June',
|
||||
7 => 'July',
|
||||
8 => 'August',
|
||||
9 => 'September',
|
||||
10 => 'October',
|
||||
11 => 'November',
|
||||
12 => 'December'
|
||||
);
|
||||
|
||||
$month_short[1] = "Jan";
|
||||
$month_short[2] = "Feb";
|
||||
$month_short[3] = "Mar";
|
||||
$month_short[4] = "Apr";
|
||||
$month_short[5] = "May";
|
||||
$month_short[6] = "Jun";
|
||||
$month_short[7] = "Jul";
|
||||
$month_short[8] = "Aug";
|
||||
$month_short[9] = "Sep";
|
||||
$month_short[10] = "Oct";
|
||||
$month_short[11] = "Nov";
|
||||
$month_short[12] = "Dec";
|
||||
$month_short = array (
|
||||
1 => 'Jan',
|
||||
2 => 'Feb',
|
||||
3 => 'Mar',
|
||||
4 => 'Apr',
|
||||
5 => 'May',
|
||||
6 => 'Jun',
|
||||
7 => 'Jul',
|
||||
8 => 'Aug',
|
||||
9 => 'Sep',
|
||||
10 => 'Oct',
|
||||
11 => 'Nov',
|
||||
12 => 'Dec'
|
||||
);
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -10,3 +10,5 @@
|
||||
// print debug messages
|
||||
echo $login->printErrorMsg();
|
||||
echo $cms->printErrorMsg();
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -94,3 +94,5 @@ if ((TARGET == 'live' || TARGET == 'remote') && !$DEBUG_ALL_OVERRIDE) {
|
||||
$cms->print_output_all = 0;
|
||||
}
|
||||
$cms->DATA['JS_DEBUG'] = DEBUG;
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -144,4 +144,4 @@ if (!file_exists($smarty->getTemplateDir()[0].DS.$TEMPLATE_TRANSLATE)) {
|
||||
$cms->debug("LANGUAGE", "SL: ".$_SESSION['DEFAULT_CHARSET']." | ".$_SESSION['LANG']." | ".$_SESSION['DEFAULT_LANG']);
|
||||
$cms->debug("TEMPLATE", "P: ".$smarty->getTemplateDir()[0]);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -101,4 +101,4 @@ if (is_dir(BASE.CACHE)) {
|
||||
}
|
||||
$smarty->display($MASTER_TEMPLATE_NAME, $TEMPLATE.$lang, $TEMPLATE.$lang);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -325,4 +325,4 @@ $smarty->display('edit_body.tpl');
|
||||
echo $login->printErrorMsg();
|
||||
echo $form->printErrorMsg();
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_access = array (
|
||||
"table_array" => array (
|
||||
"edit_access_id" => array (
|
||||
@@ -95,4 +96,4 @@ $edit_access = array (
|
||||
)
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_groups = array (
|
||||
"table_array" => array (
|
||||
"edit_group_id" => array (
|
||||
@@ -98,4 +99,4 @@ $edit_groups = array (
|
||||
)
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_languages=array (
|
||||
"table_array" => array (
|
||||
"edit_language_id" => array (
|
||||
@@ -71,4 +72,4 @@ $edit_languages=array (
|
||||
"table_name" => "edit_language"
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_menu_group = array (
|
||||
"table_array" => array (
|
||||
"edit_menu_group_id" => array (
|
||||
@@ -36,4 +37,4 @@ $edit_menu_group = array (
|
||||
)
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_pages = array (
|
||||
"table_array" => array (
|
||||
"edit_page_id" => array (
|
||||
@@ -176,4 +177,4 @@ $edit_pages = array (
|
||||
) // element list
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_schemes = array (
|
||||
"table_array" => array (
|
||||
"edit_scheme_id" => array (
|
||||
@@ -53,4 +54,4 @@ $edit_schemes = array (
|
||||
)
|
||||
); // main array
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_users = array (
|
||||
"table_array" => array (
|
||||
"edit_user_id" => array (
|
||||
@@ -257,4 +258,4 @@ $edit_users = array (
|
||||
)
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
$edit_visible_group = array (
|
||||
"table_array" => array (
|
||||
"edit_visible_group_id" => array (
|
||||
@@ -29,4 +30,4 @@ $edit_visible_group = array (
|
||||
)
|
||||
);
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -1192,4 +1192,4 @@ EOM;
|
||||
}
|
||||
} // close class
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -359,4 +359,4 @@ class Backend extends \CoreLibs\DB\IO
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -419,6 +419,7 @@ class Basic
|
||||
{
|
||||
unset($string);
|
||||
list($major, $minor, $patchlvl) = explode(".", $this->class_info[$class_name]["class_version"]);
|
||||
$string = '';
|
||||
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Name: <b>".$this->class_info[$class_name]["class_name"]."</b><br>";
|
||||
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Author: <b>".$this->class_info[$class_name]["class_author"]."</b><br>";
|
||||
$string .= "<b>-Class-info-[".$class_name."]-></b> Class Version: <b>".$this->class_info[$class_name]["class_version"]."</b><br>";
|
||||
@@ -1196,6 +1197,7 @@ class Basic
|
||||
$pos = 0;
|
||||
$split = 36; // after 36 single bytes characters, if then comes MB, it is broken
|
||||
// has to 2 x 36 < 74 so the mb_encode_mimeheader 74 hardcoded split does not get triggered
|
||||
$_string = '';
|
||||
while ($pos < mb_strlen($string, $encoding)) {
|
||||
$output = mb_strimwidth($string, $pos, $split, "", $encoding);
|
||||
$pos += mb_strlen($output, $encoding);
|
||||
@@ -1786,6 +1788,7 @@ class Basic
|
||||
}
|
||||
// max should be 63 for this case
|
||||
$max_rand = count($chars) - 1;
|
||||
$salt_string = '';
|
||||
// create the salt part
|
||||
for ($i = 1; $i <= $nSize; $i ++) {
|
||||
$salt_string .= $chars[mt_rand(0, $max_rand)];
|
||||
@@ -2490,4 +2493,4 @@ class Basic
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -133,6 +133,7 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
public function dbDumpArray($write = 0)
|
||||
{
|
||||
reset($this->table_array);
|
||||
$string = '';
|
||||
foreach ($this->table_array as $column => $data_array) {
|
||||
$string .= "<b>".$column."</b> -> ".$data_array["value"]."<br>";
|
||||
}
|
||||
@@ -200,20 +201,21 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
$q .= $this->pk_name." = ".$this->table_array[$this->pk_name]["value"]." ";
|
||||
// delete files and build FK query
|
||||
reset($this->table_array);
|
||||
$q_where = '';
|
||||
foreach ($this->table_array as $column => $data_array) {
|
||||
// suchen nach bildern und lschen ...
|
||||
if ($this->table_array[$column]["file"] && file_exists($this->table_array[$column]["url"].$this->table_array[$column]["value"])) {
|
||||
if (file_exists($this->table_array[$column]["path"].$this->table_array[$column]["value"])) {
|
||||
unlink($this->table_array[$column]["path"].$this->table_array[$column]["value"]);
|
||||
}
|
||||
$dateiname = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
||||
if (file_exists($this->table_array[$column]["path"].$dateiname)) {
|
||||
unlink($this->table_array[$column]["path"].$dateiname);
|
||||
$file_name = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
||||
if (file_exists($this->table_array[$column]["path"].$file_name)) {
|
||||
unlink($this->table_array[$column]["path"].$file_name);
|
||||
}
|
||||
}
|
||||
|
||||
// if we have a foreign key
|
||||
if ($this->table_array[$column]["fk"]) {
|
||||
// zusammenstellen der FKs
|
||||
// create FK constraint checks
|
||||
if ($q_where) {
|
||||
$q_where .= " AND ";
|
||||
}
|
||||
@@ -251,6 +253,8 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
return $this->table_array;
|
||||
}
|
||||
reset($this->table_array);
|
||||
$q_select = '';
|
||||
$q_where = '';
|
||||
// create select part & addition FK part
|
||||
foreach ($this->table_array as $column => $data_array) {
|
||||
if ($q_select) {
|
||||
@@ -326,6 +330,9 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
}
|
||||
|
||||
reset($this->table_array);
|
||||
$q_data = '';
|
||||
$q_vars = '';
|
||||
$q_where = '';
|
||||
foreach ($this->table_array as $column => $data_array) {
|
||||
/********************************* START FILE *************************************/
|
||||
// file upload
|
||||
@@ -338,9 +345,9 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
if (file_exists($this->table_array[$column]["path"].$this->table_array[$column]["value"])) {
|
||||
unlink($this->table_array[$column]["path"].$this->table_array[$column]["value"]);
|
||||
}
|
||||
$dateiname = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
||||
if (file_exists($this->table_array[$column]["path"].$dateiname)) {
|
||||
unlink($this->table_array[$column]["path"].$dateiname);
|
||||
$file_name = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
||||
if (file_exists($this->table_array[$column]["path"].$file_name)) {
|
||||
unlink($this->table_array[$column]["path"].$file_name);
|
||||
}
|
||||
$this->table_array[$column]["value"] = "";
|
||||
} else {
|
||||
@@ -355,20 +362,19 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
$ext = end($filename_parts);
|
||||
array_splice($filename_parts, -1, 1);
|
||||
$name = str_replace(" ", "_", implode(".", $filename_parts));
|
||||
//echo "PK: $pk_ids_file<br>";
|
||||
$dateiname = $name.$pk_ids_file.".".$ext;
|
||||
//echo "Dn: $dateiname";
|
||||
copy($this->table_array[$column]["tmp"], $this->table_array[$column]["path"].$dateiname);
|
||||
$file_name = $name.".".$ext;
|
||||
//echo "Dn: $file_name";
|
||||
copy($this->table_array[$column]["tmp"], $this->table_array[$column]["path"].$file_name);
|
||||
// automatisch thumbnail generieren, geht nur mit convert (ImageMagic!!!), aber nur bei bild ..
|
||||
if (strtolower($ext) == "jpeg" || strtolower($ext) == "jpg" || strtolower($ext) == "gif" || strtolower($ext) == "png") {
|
||||
$dateiname_tn = $name.$pk_ids_file."_tn.".$ext;
|
||||
$eingang = $this->table_array[$column]["path"].$dateiname;
|
||||
$ausgang = $this->table_array[$column]["path"].$dateiname_tn;
|
||||
$file_name_tn = $name."_tn.".$ext;
|
||||
$eingang = $this->table_array[$column]["path"].$file_name;
|
||||
$ausgang = $this->table_array[$column]["path"].$file_name_tn;
|
||||
$com = "convert -geometry 115 $eingang $ausgang";
|
||||
exec($com);
|
||||
$this->table_array[$column]["value"] = $dateiname_tn;
|
||||
$this->table_array[$column]["value"] = $file_name_tn;
|
||||
} else {
|
||||
$this->table_array[$column]["value"] = $dateiname;
|
||||
$this->table_array[$column]["value"] = $file_name;
|
||||
}
|
||||
} elseif (file_exists($this->table_array[$column]["path"].$this->table_array[$column]["value"])) {
|
||||
// mach gar nix, wenn bild schon da ???
|
||||
@@ -546,4 +552,4 @@ class ArrayIO extends \CoreLibs\DB\IO
|
||||
}
|
||||
} // end of class
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -511,6 +511,7 @@ class IO extends \CoreLibs\Basic
|
||||
// NOTE : used in db_dump_data only
|
||||
private function __printArray($array)
|
||||
{
|
||||
$string = '';
|
||||
foreach ($array as $key => $value) {
|
||||
$string .= $this->nbsp.'<b>'.$key.'</b> => ';
|
||||
if (is_array($value)) {
|
||||
@@ -977,6 +978,7 @@ class IO extends \CoreLibs\Basic
|
||||
} else {
|
||||
$array = $this->cursor_ext;
|
||||
}
|
||||
$string = '';
|
||||
if (is_array($array)) {
|
||||
$this->nbps = '';
|
||||
$string .= $this->__printArray($array);
|
||||
@@ -1816,6 +1818,7 @@ class IO extends \CoreLibs\Basic
|
||||
// DESC : this is only needed for Postgresql. Converts postgresql arrays to PHP
|
||||
public function dbArrayParse($text)
|
||||
{
|
||||
$output = array ();
|
||||
return $this->db_functions->__dbArrayParse($text, $output);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class PgSQL
|
||||
{
|
||||
$result = pg_execute($this->dbh, $name, $data);
|
||||
if (!$result) {
|
||||
$this->last_error_query = $query;
|
||||
$this->last_error_query = $name;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -428,4 +428,4 @@ class PgSQL
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -45,4 +45,4 @@ class CachedFileReader extends CoreLibs\Language\Core\StringReader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -88,4 +88,4 @@ class FileReader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -146,8 +146,8 @@ class GetTextReader
|
||||
private function load_tables()
|
||||
{
|
||||
if (is_array($this->cache_translations) &&
|
||||
is_array($this->table_originals) &&
|
||||
is_array($this->table_translations)) {
|
||||
is_array($this->table_originals) &&
|
||||
is_array($this->table_translations)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -457,4 +457,4 @@ class GetTextReader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -51,4 +51,4 @@ class StreamReader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -64,4 +64,4 @@ class StringReader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -323,7 +323,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$this->table_array = array ();
|
||||
}
|
||||
reset($this->table_array);
|
||||
$string .= "<b>TABLE ARRAY DUMP:</b> ".$this->table_name."<br>";
|
||||
$string = "<b>TABLE ARRAY DUMP:</b> ".$this->table_name."<br>";
|
||||
foreach ($this->table_array as $key => $value) {
|
||||
$string .= "<b>$key</b>: ".$value["value"]."<br>";
|
||||
}
|
||||
@@ -557,7 +557,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
if ($res[$this->int_pk_name] == $this->table_array[$this->int_pk_name]["value"]) {
|
||||
$pk_selected = $res[$this->int_pk_name];
|
||||
}
|
||||
unset($t_string);
|
||||
$t_string = '';
|
||||
for ($i = 0, $i_max = count($this->field_array); $i < $i_max; $i ++) {
|
||||
if ($t_string) {
|
||||
$t_string .= ", ";
|
||||
@@ -1013,7 +1013,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
// do optional error checks like for normal fields
|
||||
// currently active: unique/alphanumeric
|
||||
if ($data_rray['error_check']) {
|
||||
if ($data_array['error_check']) {
|
||||
foreach (explode('|', $value["error_check"]) as $error_check) {
|
||||
switch ($error_check) {
|
||||
// check unique, check if field in table is not yet exist
|
||||
@@ -1314,6 +1314,9 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
// go through all submitted data
|
||||
// for ($i = 0; $i < count($_POST[$el_name]); $i ++)
|
||||
for ($i = 0; $i < $max; $i ++) {
|
||||
$q_data[$i] = '';
|
||||
$q_names[$i] = '';
|
||||
$q_values[$i] = '';
|
||||
// if we have enable name & delete set, then only insert/update those which are flagged as active
|
||||
// check if mandatory field is set, if not set "do not write flag"
|
||||
if ($data_array["mandatory"] && !$_POST[$prfx.$el_name][$i]) {
|
||||
@@ -1718,4 +1721,4 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
}
|
||||
} // end of class
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -527,7 +527,7 @@ class ProgressBar
|
||||
case 'percent':
|
||||
// only one inner percent
|
||||
// print "STYLE[$name]: ".$style_lbl."<br>";
|
||||
if (!$html_percent) {
|
||||
if (!isset($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";
|
||||
}
|
||||
break;
|
||||
@@ -669,4 +669,4 @@ class ProgressBar
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -29,4 +29,4 @@ class SmartyExtend extends SmartyBC
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -28,4 +28,4 @@ class qqUploadedFileForm
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -43,4 +43,4 @@ class qqUploadedFileXhr
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -109,4 +109,4 @@ class qqFileUploader
|
||||
}
|
||||
}
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
@@ -108,3 +108,5 @@ function MyErrorHandler($type, $message, $file, $line, $context)
|
||||
|
||||
// init the error handler
|
||||
set_error_handler("MyErrorHandler");
|
||||
|
||||
// __END__
|
||||
|
||||
@@ -54,4 +54,4 @@ if (class_exists('Autoload', false) === false) {
|
||||
spl_autoload_register('Autoloader\Autoload::load', true, true);
|
||||
} // end check for already defined
|
||||
|
||||
# __END__
|
||||
// __END__
|
||||
|
||||
Reference in New Issue
Block a user