Core libs clean up
- end comments from # to // - clean up not initialzed vars and wrong named vars
This commit is contained in:
@@ -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