White space fixes
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
$DB_DEBUG = 1;
|
$DB_DEBUG = 1;
|
||||||
|
|
||||||
if ($DEBUG_ALL)
|
if ($DEBUG_ALL)
|
||||||
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
error_reporting(E_ALL | E_STRICT | E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR);
|
||||||
|
|
||||||
define('USE_DATABASE', true);
|
define('USE_DATABASE', true);
|
||||||
// sample config
|
// sample config
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* - edit_pages.php
|
* - edit_pages.php
|
||||||
* - edit_schemes.php
|
* - edit_schemes.php
|
||||||
* - edit_users.php
|
* - edit_users.php
|
||||||
* - edit_visible_group.php
|
* - edit_visible_group.php
|
||||||
* HISTORY:
|
* HISTORY:
|
||||||
* 2005/06/30 (cs) remove color settings, they are in CSS File now
|
* 2005/06/30 (cs) remove color settings, they are in CSS File now
|
||||||
* 2005/06/22 (cs) moved load of config array into form class, set lang and lang is must set var for form class; removed the page name setting, moved it into the form class, remove all HTML from main page
|
* 2005/06/22 (cs) moved load of config array into form class, set lang and lang is must set var for form class; removed the page name setting, moved it into the form class, remove all HTML from main page
|
||||||
@@ -107,15 +107,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// log backend data
|
// log backend data
|
||||||
// data part creation
|
// data part creation
|
||||||
$data = array (
|
$data = array (
|
||||||
'_SESSION' => $_SESSION,
|
'_SESSION' => $_SESSION,
|
||||||
'_GET' => $_GET,
|
'_GET' => $_GET,
|
||||||
'_POST' => $_POST,
|
'_POST' => $_POST,
|
||||||
'_FILES' => $_FILES
|
'_FILES' => $_FILES
|
||||||
);
|
);
|
||||||
// log action
|
// log action
|
||||||
EditLog('Edit Submit', serialize($data));
|
EditLog('Edit Submit', serialize($data));
|
||||||
|
|
||||||
$form->form_procedure_load(${$form->archive_pk_name});
|
$form->form_procedure_load(${$form->archive_pk_name});
|
||||||
$form->form_procedure_new();
|
$form->form_procedure_new();
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
$smarty->setTemplateDir(TEMPLATES.DEFAULT_TEMPLATE);
|
$smarty->setTemplateDir(TEMPLATES.DEFAULT_TEMPLATE);
|
||||||
$DATA['css'] = CSS.DEFAULT_TEMPLATE;
|
$DATA['css'] = CSS.DEFAULT_TEMPLATE;
|
||||||
$DATA['js'] = JS.DEFAULT_TEMPLATE;
|
$DATA['js'] = JS.DEFAULT_TEMPLATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// order name is _always_ order_number for the edit interface
|
// order name is _always_ order_number for the edit interface
|
||||||
|
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
if ($_FILES['file_up']['name'])
|
if ($_FILES['file_up']['name'])
|
||||||
{
|
{
|
||||||
$mime_type = $_FILES['file_up']['type'];
|
$mime_type = $_FILES['file_up']['type'];
|
||||||
$file_size = $_FILES['file_up']['size'];
|
$file_size = $_FILES['file_up']['size'];
|
||||||
$file_name = $_FILES['file_up']['name'];
|
$file_name = $_FILES['file_up']['name'];
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
if (!is_dir($cms->pictures))
|
if (!is_dir($cms->pictures))
|
||||||
$cms->pictures = LAYOUT.DEFAULT_TEMPLATE.PICTURES.'/';
|
$cms->pictures = LAYOUT.DEFAULT_TEMPLATE.PICTURES.'/';
|
||||||
if (!is_dir($cms->cache_pictures))
|
if (!is_dir($cms->cache_pictures))
|
||||||
$cms->cache_pictures = LAYOUT.DEFAULT_TEMPLATE.CACHE.IMAGES.'/';
|
$cms->cache_pictures = LAYOUT.DEFAULT_TEMPLATE.CACHE.IMAGES.'/';
|
||||||
|
|
||||||
// if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch
|
// if the template_dir is != DEFAULT_TEMPLATE, then try to make a lang switch
|
||||||
// if the default lang is not like the lang given, switch lang
|
// if the default lang is not like the lang given, switch lang
|
||||||
|
|||||||
@@ -366,7 +366,8 @@
|
|||||||
$string = $this->l->__('Year').' ';
|
$string = $this->l->__('Year').' ';
|
||||||
$string .= '<select id="year'.$suffix.'" name="year'.$suffix.'" onChange="'.$on_change_call.'">';
|
$string .= '<select id="year'.$suffix.'" name="year'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||||
for ($i = date("Y"); $i <= $max_year; $i ++)
|
for ($i = date("Y"); $i <= $max_year; $i ++)
|
||||||
{ $string .= '<option value="'.$i.'" '.(($year == $i) ? 'selected' : '').'>'.$i.'</option>';
|
{
|
||||||
|
$string .= '<option value="'.$i.'" '.(($year == $i) ? 'selected' : '').'>'.$i.'</option>';
|
||||||
}
|
}
|
||||||
$string .= '</select> '.$this->l->__('Month').' ';
|
$string .= '</select> '.$this->l->__('Month').' ';
|
||||||
$string .= '<select id="month'.$suffix.'" name="month'.$suffix.'" onChange="'.$on_change_call.'">';
|
$string .= '<select id="month'.$suffix.'" name="month'.$suffix.'" onChange="'.$on_change_call.'">';
|
||||||
|
|||||||
@@ -36,11 +36,11 @@
|
|||||||
* PUBLIC METHODS
|
* PUBLIC METHODS
|
||||||
* debug -> calls with "level", "string" and flag to turn off (0) the newline at the end
|
* 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
|
* 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
|
* print_error_msg -> prints out the error message, optional parameter is a header prefix
|
||||||
* fdebug -> prints line directly to debug_file.log in tmp
|
* fdebug -> prints line directly to debug_file.log in tmp
|
||||||
*
|
*
|
||||||
* print_time -> prints time + microtime, optional flag to turn off (0) microtime printout
|
* print_time -> prints time + microtime, optional flag to turn off (0) microtime printout
|
||||||
* basic -> constructor
|
* basic -> constructor
|
||||||
* _basic -> desconstructor
|
* _basic -> desconstructor
|
||||||
* info -> info about that class
|
* info -> info about that class
|
||||||
* running_time -> prints out the time of start/end (automatically called on created and error printout
|
* running_time -> prints out the time of start/end (automatically called on created and error printout
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
"class_version" => "0.9.0",
|
"class_version" => "0.9.0",
|
||||||
"class_created" => "2003-03-24",
|
"class_created" => "2003-03-24",
|
||||||
"class_author" => 'Clemens "Gullevek" Schwaighofer (.at)'
|
"class_author" => 'Clemens "Gullevek" Schwaighofer (.at)'
|
||||||
);
|
);
|
||||||
|
|
||||||
// set the page name
|
// set the page name
|
||||||
$this->page_name = $this->get_page_name();
|
$this->page_name = $this->get_page_name();
|
||||||
@@ -530,8 +530,8 @@
|
|||||||
$traces = debug_backtrace();
|
$traces = debug_backtrace();
|
||||||
// extended info (later)
|
// extended info (later)
|
||||||
/*
|
/*
|
||||||
* $file = $trace[$level]['file'];
|
* $file = $trace[$level]['file'];
|
||||||
* $line = $trace[$level]['line'];
|
* $line = $trace[$level]['line'];
|
||||||
* $object = $trace[$level]['object'];
|
* $object = $trace[$level]['object'];
|
||||||
* if (is_object($object)) { $object = get_class($object); }
|
* if (is_object($object)) { $object = get_class($object); }
|
||||||
*
|
*
|
||||||
@@ -664,7 +664,7 @@
|
|||||||
// to use it call with set_error_handler(array("baisc", "ErrorHandler"));
|
// 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
|
// 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
|
// error levels for PHP
|
||||||
// values based on 5.3
|
// values based on 5.3
|
||||||
$error_level = array (
|
$error_level = array (
|
||||||
@@ -683,7 +683,7 @@
|
|||||||
4096 => 'E_RECOVERABLE_ERROR', // since 5.2
|
4096 => 'E_RECOVERABLE_ERROR', // since 5.2
|
||||||
8192 => 'E_DEPRICATED', // since 5.3
|
8192 => 'E_DEPRICATED', // since 5.3
|
||||||
16384 => 'E_USER_DEPRICATED', // since 5.3
|
16384 => 'E_USER_DEPRICATED', // since 5.3
|
||||||
30719 => 'E_ALL' // 6143 in 5.2, 2047 in previous versions
|
30719 => 'E_ALL' // 6143 in 5.2, 2047 in previous versions
|
||||||
);
|
);
|
||||||
|
|
||||||
$fn = ROOT.LOG.'php_errors-'.date('Y-m-d').'.log';
|
$fn = ROOT.LOG.'php_errors-'.date('Y-m-d').'.log';
|
||||||
@@ -733,7 +733,7 @@
|
|||||||
// tries to find mailto:user@bubu.at and changes it into -> <a href="mailto:user@bubu.at">E-Mail senden</a>
|
// tries to find mailto:user@bubu.at and changes it into -> <a href="mailto:user@bubu.at">E-Mail senden</a>
|
||||||
// or tries to take any url (http, ftp, etc) and transform it into a valid URL
|
// 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
|
// the string is in the format: some url|name#css|, same for email
|
||||||
public function magic_links($string, $target = "_blank")
|
public function magic_links($string, $target = "_blank")
|
||||||
{
|
{
|
||||||
$output = $string;
|
$output = $string;
|
||||||
$protList = array("http", "https", "ftp", "news", "nntp");
|
$protList = array("http", "https", "ftp", "news", "nntp");
|
||||||
@@ -761,13 +761,13 @@
|
|||||||
// _1: URL or email
|
// _1: URL or email
|
||||||
// _2: atag (>)
|
// _2: atag (>)
|
||||||
// _3: (_1) part of url or email [main url or email pre @ part]
|
// _3: (_1) part of url or email [main url or email pre @ part]
|
||||||
// _4: (_2) parameters of url or email post @ part
|
// _4: (_2) parameters of url or email post @ part
|
||||||
// _5: (_3) parameters of url or tld part of email
|
// _5: (_3) parameters of url or tld part of email
|
||||||
// _7: link name/email link name
|
// _7: link name/email link name
|
||||||
// _9: style sheet class
|
// _9: style sheet class
|
||||||
$self = $this;
|
$self = $this;
|
||||||
// $this->debug('URL', 'Before: '.$output);
|
// $this->debug('URL', 'Before: '.$output);
|
||||||
$output = preg_replace_callback("/(href=\")?(\>)?\b($protRegex)([\w\.\-?&=+%#~,;\/]+)\b([\.\-?&=+%#~,;\/]*)(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
$output = preg_replace_callback("/(href=\")?(\>)?\b($protRegex)([\w\.\-?&=+%#~,;\/]+)\b([\.\-?&=+%#~,;\/]*)(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
||||||
function ($matches) use ($self)
|
function ($matches) use ($self)
|
||||||
{
|
{
|
||||||
return @$self->create_url($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
|
return @$self->create_url($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
|
||||||
@@ -775,17 +775,17 @@
|
|||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
// find email-addresses, but not mailto prefix ones
|
// find email-addresses, but not mailto prefix ones
|
||||||
$output = preg_replace_callback("/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
$output = preg_replace_callback("/(mailto:)?(\>)?\b([\w\.-]+)@([\w\.\-]+)\.([a-zA-Z]{2,4})\b(\|([^\||^#]+)(#([^\|]+))?\|)?/",
|
||||||
function ($matches) use ($self)
|
function ($matches) use ($self)
|
||||||
{
|
{
|
||||||
return @$self->create_email($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
|
return @$self->create_email($matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[7], $matches[9]);
|
||||||
},
|
},
|
||||||
$output
|
$output
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->debug('URL', 'After: '.$output);
|
$this->debug('URL', 'After: '.$output);
|
||||||
// // we have one slashes after the Protocol -> internal link no domain, strip out the proto
|
// // we have one slashes after the Protocol -> internal link no domain, strip out the proto
|
||||||
// $output = preg_replace("/($protRegex)\/(.*)/e", "\\2", $ouput);
|
// $output = preg_replace("/($protRegex)\/(.*)/e", "\\2", $ouput);
|
||||||
// $this->debug('URL', "$output");
|
// $this->debug('URL', "$output");
|
||||||
|
|
||||||
// post processing
|
// post processing
|
||||||
@@ -798,7 +798,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// METHOD create_url [INTERNAL]
|
// METHOD create_url [INTERNAL]
|
||||||
// PARAMS url link, anchor tag (define both type or 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
|
// _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
|
// target: link target, name: name for the url, if not given _2 + _3 is used
|
||||||
// class: style sheet
|
// class: style sheet
|
||||||
@@ -813,7 +813,7 @@
|
|||||||
if (preg_match("/\/\/$/", $_1) && preg_match("/^\//", $_2))
|
if (preg_match("/\/\/$/", $_1) && preg_match("/^\//", $_2))
|
||||||
{
|
{
|
||||||
$_1 = '';
|
$_1 = '';
|
||||||
$target = '';
|
$target = '';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -943,7 +943,7 @@
|
|||||||
// haystack (search in)
|
// haystack (search in)
|
||||||
// key: the key to look for in
|
// key: the key to look for in
|
||||||
// path: recursive call for previous path
|
// path: recursive call for previous path
|
||||||
// RETURN all array elements paths where the element was found
|
// RETURN all array elements paths where the element was found
|
||||||
// DESCRIPTION
|
// DESCRIPTION
|
||||||
// recursive array search function, which returns all found not only the first one
|
// 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 array_search_recursive_all($needle, $haystack, $key, $path = NULL)
|
||||||
@@ -993,20 +993,20 @@
|
|||||||
// DESCRIPTION
|
// DESCRIPTION
|
||||||
// array search simple. looks for key, value combination, if found, returns true
|
// array search simple. looks for key, value combination, if found, returns true
|
||||||
public static function array_search_simple($array, $key, $value)
|
public static function array_search_simple($array, $key, $value)
|
||||||
{
|
{
|
||||||
if (!is_array($array))
|
if (!is_array($array))
|
||||||
$array = array ();
|
$array = array ();
|
||||||
foreach ($array as $_key => $_value)
|
foreach ($array as $_key => $_value)
|
||||||
{
|
{
|
||||||
// if value is an array, we search
|
// if value is an array, we search
|
||||||
if (is_array($_value))
|
if (is_array($_value))
|
||||||
{
|
{
|
||||||
// call recursive, and return result if it is true, else continue
|
// call recursive, and return result if it is true, else continue
|
||||||
if (($result = basic::array_search_simple($_value, $key, $value)) !== false)
|
if (($result = basic::array_search_simple($_value, $key, $value)) !== false)
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
elseif ($_key == $key && $_value = $value)
|
elseif ($_key == $key && $_value = $value)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1571,7 +1571,7 @@
|
|||||||
// RETURN: random string
|
// RETURN: random string
|
||||||
// DESC: creates a random string from alphanumeric characters: A-Z a-z 0-9 ./
|
// DESC: creates a random string from alphanumeric characters: A-Z a-z 0-9 ./
|
||||||
private function cryptSaltString($nSize = 22)
|
private function cryptSaltString($nSize = 22)
|
||||||
{
|
{
|
||||||
// A-Z is 65,90
|
// A-Z is 65,90
|
||||||
// a-z is 97,122
|
// a-z is 97,122
|
||||||
// 0-9 is 48,57
|
// 0-9 is 48,57
|
||||||
@@ -1580,7 +1580,7 @@
|
|||||||
$max = array (57, 90, 122);
|
$max = array (57, 90, 122);
|
||||||
$chars = array ();
|
$chars = array ();
|
||||||
for ($i = 0; $i < count($min); $i ++)
|
for ($i = 0; $i < count($min); $i ++)
|
||||||
{
|
{
|
||||||
for ($j = $min[$i]; $j <= $max[$i]; $j ++)
|
for ($j = $min[$i]; $j <= $max[$i]; $j ++)
|
||||||
{
|
{
|
||||||
$chars[] = chr($j);
|
$chars[] = chr($j);
|
||||||
@@ -1590,9 +1590,9 @@
|
|||||||
$max_rand = count($chars) - 1;
|
$max_rand = count($chars) - 1;
|
||||||
// create the salt part
|
// create the salt part
|
||||||
for ($i = 1; $i <= $nSize; $i ++)
|
for ($i = 1; $i <= $nSize; $i ++)
|
||||||
{
|
{
|
||||||
$salt_string .= $chars[mt_rand(0, $max_rand)];
|
$salt_string .= $chars[mt_rand(0, $max_rand)];
|
||||||
}
|
}
|
||||||
return $salt_string;
|
return $salt_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1759,12 +1759,12 @@
|
|||||||
$L = round((($MAX + $MIN) / 2) * 100);
|
$L = round((($MAX + $MIN) / 2) * 100);
|
||||||
|
|
||||||
if ($MIN == $MAX)
|
if ($MIN == $MAX)
|
||||||
{
|
{
|
||||||
// H, S, L
|
// H, S, L
|
||||||
return array(0, 0, $L);
|
return array(0, 0, $L);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// HUE to 0~360
|
// HUE to 0~360
|
||||||
if ($r == $MAX)
|
if ($r == $MAX)
|
||||||
$HUE = ($g - $b) / ($MAX - $MIN);
|
$HUE = ($g - $b) / ($MAX - $MIN);
|
||||||
@@ -1797,11 +1797,11 @@
|
|||||||
return array($l * 255, $l * 255, $l * 255);
|
return array($l * 255, $l * 255, $l * 255);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$m2 = ($l < 0.5) ? $l * ($s + 1) : ($l + $s) - ($l * $s);
|
$m2 = ($l < 0.5) ? $l * ($s + 1) : ($l + $s) - ($l * $s);
|
||||||
$m1 = $l * 2 - $m2;
|
$m1 = $l * 2 - $m2;
|
||||||
$hue = function ($base) use ($m1, $m2)
|
$hue = function ($base) use ($m1, $m2)
|
||||||
{
|
{
|
||||||
// base = hue, hue > 360 (1) - 360 (1), else < 0 + 360 (1)
|
// base = hue, hue > 360 (1) - 360 (1), else < 0 + 360 (1)
|
||||||
$base = ($base < 0) ? $base + 1 : (($base > 1) ? $base - 1 : $base);
|
$base = ($base < 0) ? $base + 1 : (($base > 1) ? $base - 1 : $base);
|
||||||
// 6: 60, 2: 180, 3: 240
|
// 6: 60, 2: 180, 3: 240
|
||||||
@@ -1869,13 +1869,13 @@
|
|||||||
// DESC: guesses the email type (mostly for mobile) from the domain
|
// 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)
|
// if second is set to true, it will return short naming scheme (only provider)
|
||||||
public function getEmailType($email, $short = false)
|
public function getEmailType($email, $short = false)
|
||||||
{
|
{
|
||||||
// trip if there is no email address
|
// trip if there is no email address
|
||||||
if (!$email)
|
if (!$email)
|
||||||
return "invalid";
|
return "invalid";
|
||||||
// loop until we match a mobile type, return this first found type
|
// loop until we match a mobile type, return this first found type
|
||||||
foreach ($this->mobile_email_type as $email_regex => $email_type)
|
foreach ($this->mobile_email_type as $email_regex => $email_type)
|
||||||
{
|
{
|
||||||
if (preg_match("/$email_regex/", $email))
|
if (preg_match("/$email_regex/", $email))
|
||||||
{
|
{
|
||||||
if ($short)
|
if ($short)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
* PUBLIC VARIABLES
|
* PUBLIC VARIABLES
|
||||||
*
|
*
|
||||||
* PRIVATE VARIABLES
|
* PRIVATE VARIABLES
|
||||||
*
|
*
|
||||||
* PUBLIC METHODS
|
* PUBLIC METHODS
|
||||||
*
|
*
|
||||||
* PRIVATE METHODS
|
* PRIVATE METHODS
|
||||||
@@ -123,14 +123,14 @@
|
|||||||
$text = str_replace('>', '>', $text);
|
$text = str_replace('>', '>', $text);
|
||||||
$text = str_replace('&', '&', $text);
|
$text = str_replace('&', '&', $text);
|
||||||
$text = str_replace('"', '"', $text);
|
$text = str_replace('"', '"', $text);
|
||||||
$text = str_replace(''', "'", $text);
|
$text = str_replace(''', "'", $text);
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD db_dump_array
|
// METHOD db_dump_array
|
||||||
// PARAMS none
|
// PARAMS none
|
||||||
// RETURN returns the current array
|
// RETURN returns the current array
|
||||||
// DESC dumps the current data
|
// DESC dumps the current data
|
||||||
public function db_dump_array($write = 0)
|
public function db_dump_array($write = 0)
|
||||||
{
|
{
|
||||||
reset($this->table_array);
|
reset($this->table_array);
|
||||||
@@ -220,11 +220,11 @@
|
|||||||
if (file_exists($this->table_array[$column]["path"].$dateiname))
|
if (file_exists($this->table_array[$column]["path"].$dateiname))
|
||||||
unlink($this->table_array[$column]["path"].$dateiname);
|
unlink($this->table_array[$column]["path"].$dateiname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->table_array[$column]["fk"])
|
if ($this->table_array[$column]["fk"])
|
||||||
{
|
{
|
||||||
// zusammenstellen der FKs
|
// zusammenstellen der FKs
|
||||||
if ($q_where)
|
if ($q_where)
|
||||||
$q_where .= " AND ";
|
$q_where .= " AND ";
|
||||||
$q_where .= $column." = ".$this->table_array[$column]["value"];
|
$q_where .= $column." = ".$this->table_array[$column]["value"];
|
||||||
}
|
}
|
||||||
@@ -235,13 +235,13 @@
|
|||||||
// attach fk row if there ...
|
// attach fk row if there ...
|
||||||
if ($q_where)
|
if ($q_where)
|
||||||
$q .= " AND ".$q_where;
|
$q .= " AND ".$q_where;
|
||||||
// if 0, error
|
// if 0, error
|
||||||
unset ($this->pk_id);
|
unset ($this->pk_id);
|
||||||
if (!$this->db_exec($q))
|
if (!$this->db_exec($q))
|
||||||
{
|
{
|
||||||
$this->error_id=22;
|
$this->error_id=22;
|
||||||
$this->_db_error();
|
$this->_db_error();
|
||||||
}
|
}
|
||||||
return $this->table_array;
|
return $this->table_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,11 +257,11 @@
|
|||||||
if (!$this->db_check_pk_set())
|
if (!$this->db_check_pk_set())
|
||||||
return $this->table_array;
|
return $this->table_array;
|
||||||
reset($this->table_array);
|
reset($this->table_array);
|
||||||
// create select part & addition FK part
|
// create select part & addition FK part
|
||||||
while (list($column, $data_array)=each($this->table_array))
|
while (list($column, $data_array)=each($this->table_array))
|
||||||
{
|
{
|
||||||
if ($q_select)
|
if ($q_select)
|
||||||
$q_select .= ", ";
|
$q_select .= ", ";
|
||||||
$q_select .= $column;
|
$q_select .= $column;
|
||||||
|
|
||||||
// check FK ...
|
// check FK ...
|
||||||
@@ -272,7 +272,7 @@
|
|||||||
$q_where .= $column .= " = ".$this->table_array[$column]["value"];
|
$q_where .= $column .= " = ".$this->table_array[$column]["value"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$q = "SELECT ";
|
$q = "SELECT ";
|
||||||
$q .= $q_select;
|
$q .= $q_select;
|
||||||
$q .= " FROM ".$this->table_name." WHERE ";
|
$q .= " FROM ".$this->table_name." WHERE ";
|
||||||
@@ -284,7 +284,7 @@
|
|||||||
if ($this->db_exec($q))
|
if ($this->db_exec($q))
|
||||||
{
|
{
|
||||||
if ($res = $this->db_fetch_array())
|
if ($res = $this->db_fetch_array())
|
||||||
{
|
{
|
||||||
reset($this->table_array);
|
reset($this->table_array);
|
||||||
while (list($column, $data_array) = each($this->table_array))
|
while (list($column, $data_array) = each($this->table_array))
|
||||||
{
|
{
|
||||||
@@ -326,7 +326,7 @@
|
|||||||
{
|
{
|
||||||
if (is_array($table_array))
|
if (is_array($table_array))
|
||||||
$this->table_array = $table_array;
|
$this->table_array = $table_array;
|
||||||
// PK ID check
|
// PK ID check
|
||||||
// if ($this->pk_id && !$this->table_array[$this->pk_name]["value"])
|
// if ($this->pk_id && !$this->table_array[$this->pk_name]["value"])
|
||||||
// $this->table_array[$this->pk_name]["value"]=$this->pk_id;
|
// $this->table_array[$this->pk_name]["value"]=$this->pk_id;
|
||||||
// checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR!
|
// checken ob PKs gesetzt, wenn alle -> update, wenn keiner -> insert, wenn ein paar -> ERROR!
|
||||||
@@ -351,7 +351,7 @@
|
|||||||
unset($this->table_array[$column]["delete"]);
|
unset($this->table_array[$column]["delete"]);
|
||||||
if (file_exists($this->table_array[$column]["path"].$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"]);
|
unlink($this->table_array[$column]["path"].$this->table_array[$column]["value"]);
|
||||||
$dateiname = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
$dateiname = str_replace("_tn", "", $this->table_array[$column]["value"]);
|
||||||
if (file_exists($this->table_array[$column]["path"].$dateiname))
|
if (file_exists($this->table_array[$column]["path"].$dateiname))
|
||||||
unlink($this->table_array[$column]["path"].$dateiname);
|
unlink($this->table_array[$column]["path"].$dateiname);
|
||||||
$this->table_array[$column]["value"] = "";
|
$this->table_array[$column]["value"] = "";
|
||||||
@@ -376,7 +376,7 @@
|
|||||||
copy($this->table_array[$column]["tmp"], $this->table_array[$column]["path"].$dateiname);
|
copy($this->table_array[$column]["tmp"], $this->table_array[$column]["path"].$dateiname);
|
||||||
// automatisch thumbnail generieren, geht nur mit convert (ImageMagic!!!), aber nur bei bild ..
|
// 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")
|
if (strtolower($ext) == "jpeg" || strtolower($ext) == "jpg" || strtolower($ext) == "gif" || strtolower($ext) == "png")
|
||||||
{
|
{
|
||||||
$dateiname_tn = $name.$pk_ids_file."_tn.".$ext;
|
$dateiname_tn = $name.$pk_ids_file."_tn.".$ext;
|
||||||
$eingang = $this->table_array[$column]["path"].$dateiname;
|
$eingang = $this->table_array[$column]["path"].$dateiname;
|
||||||
$ausgang = $this->table_array[$column]["path"].$dateiname_tn;
|
$ausgang = $this->table_array[$column]["path"].$dateiname_tn;
|
||||||
@@ -403,7 +403,7 @@
|
|||||||
$this->table_array[$column]["value"] = $this->table_array[$column]["HIDDEN_value"];
|
$this->table_array[$column]["value"] = $this->table_array[$column]["HIDDEN_value"];
|
||||||
if (!$insert)
|
if (!$insert)
|
||||||
{
|
{
|
||||||
if (strlen($q_data))
|
if (strlen($q_data))
|
||||||
$q_data .= ", ";
|
$q_data .= ", ";
|
||||||
$q_data .= $column." = ";
|
$q_data .= $column." = ";
|
||||||
}
|
}
|
||||||
@@ -453,7 +453,7 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
|
|||||||
// NOW get PK, and FK settings (FK only for update query)
|
// NOW get PK, and FK settings (FK only for update query)
|
||||||
// get it at the end, cause now we can be more sure of no double IDs, etc
|
// get it at the end, cause now we can be more sure of no double IDs, etc
|
||||||
reset($this->table_array);
|
reset($this->table_array);
|
||||||
// create select part & addition FK part
|
// create select part & addition FK part
|
||||||
while (list($column, $data_array) = each($this->table_array))
|
while (list($column, $data_array) = each($this->table_array))
|
||||||
{
|
{
|
||||||
// check FK ...
|
// check FK ...
|
||||||
@@ -491,7 +491,7 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
|
|||||||
{
|
{
|
||||||
$q = "INSERT INTO ".$this->table_name." ";
|
$q = "INSERT INTO ".$this->table_name." ";
|
||||||
$q .= "(".$q_vars.") ";
|
$q .= "(".$q_vars.") ";
|
||||||
$q .= "VALUES (".$q_data.")";
|
$q .= "VALUES (".$q_data.")";
|
||||||
// write primary key too
|
// write primary key too
|
||||||
/* if ($q_data)
|
/* if ($q_data)
|
||||||
$q .= ", ";
|
$q .= ", ";
|
||||||
@@ -504,7 +504,7 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
|
|||||||
{
|
{
|
||||||
$this->error_id = 22;
|
$this->error_id = 22;
|
||||||
$this->_db_error();
|
$this->_db_error();
|
||||||
}
|
}
|
||||||
// set primary key
|
// set primary key
|
||||||
if ($insert)
|
if ($insert)
|
||||||
{
|
{
|
||||||
@@ -513,6 +513,6 @@ $this->debug('write_check', "[$column][".$this->table_array[$column]["value"]."]
|
|||||||
}
|
}
|
||||||
// return the table if needed
|
// return the table if needed
|
||||||
return $this->table_array;
|
return $this->table_array;
|
||||||
}
|
}
|
||||||
} // end of class
|
} // end of class
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
* but let me know if u made changes, and please don't redistribute it
|
* but let me know if u made changes, and please don't redistribute it
|
||||||
* with your name on it ...
|
* with your name on it ...
|
||||||
* SHORT DESCRIPTON:
|
* SHORT DESCRIPTON:
|
||||||
* 2013/10/10, prepare/excute were added, including auto RETURNING primary key if
|
* 2013/10/10, prepare/excute were added, including auto RETURNING primary key if
|
||||||
* possible for any INSERT query in exec or prepare/execute, better debugging and
|
* possible for any INSERT query in exec or prepare/execute, better debugging and
|
||||||
* data dumping. Proper string escape wrapper, special db exec writer for complex
|
* data dumping. Proper string escape wrapper, special db exec writer for complex
|
||||||
* array inserts in auto calls. boolean converter from postresql to php
|
* array inserts in auto calls. boolean converter from postresql to php
|
||||||
*
|
*
|
||||||
* 2003/12/08, one major change: renamed db_exec_ext to db_return, as it has not
|
* 2003/12/08, one major change: renamed db_exec_ext to db_return, as it has not
|
||||||
* much in common with the normal db_exec wrapper, as it was written only for
|
* much in common with the normal db_exec wrapper, as it was written only for
|
||||||
* SELECT statements and better handling of those.
|
* SELECT statements and better handling of those.
|
||||||
*
|
*
|
||||||
* 2002/12/20, extended the "simple" functionality to what I wanted
|
* 2002/12/20, extended the "simple" functionality to what I wanted
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
* $mixed db_return_row($query)
|
* $mixed db_return_row($query)
|
||||||
* - gibt die erste Zeile zurück (als array)
|
* - gibt die erste Zeile zurück (als array)
|
||||||
* $array_of_hashes db_return_array($query)
|
* $array_of_hashes db_return_array($query)
|
||||||
* - return an array of hashes with all data
|
* - return an array of hashes with all data
|
||||||
* db_close()
|
* db_close()
|
||||||
* - closes db connection and writes error_msg to global error_msg
|
* - closes db connection and writes error_msg to global error_msg
|
||||||
* db_cursor_pos($query)
|
* db_cursor_pos($query)
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
* 2004/07/15 (cs) changed the deconstructor to call _basic deconstructor
|
* 2004/07/15 (cs) changed the deconstructor to call _basic deconstructor
|
||||||
* 2003-06-20: added a '3' flag to db_return so NO caching is done at all (if array might get too big)
|
* 2003-06-20: added a '3' flag to db_return so NO caching is done at all (if array might get too big)
|
||||||
* 2003-06-19: made the error messages in DEBUG output red so they are better to see
|
* 2003-06-19: made the error messages in DEBUG output red so they are better to see
|
||||||
* 2003-06-09: never started class_basic, insert this, for mobile phone detection
|
* 2003-06-09: never started class_basic, insert this, for mobile phone detection
|
||||||
* 2003-04-10: moved the error handling out of the db_pgsql.inc back to db_io class
|
* 2003-04-10: moved the error handling out of the db_pgsql.inc back to db_io class
|
||||||
* 2003-04-09: major change as db_io does not hold any DB specific calls anymore,
|
* 2003-04-09: major change as db_io does not hold any DB specific calls anymore,
|
||||||
* those are loaded dynamically during class start, from a include
|
* those are loaded dynamically during class start, from a include
|
||||||
@@ -193,14 +193,14 @@
|
|||||||
* changed the "shape" of class info vars to fit into extend modell
|
* changed the "shape" of class info vars to fit into extend modell
|
||||||
* 2003-02-13: in db_exec the setting for the last insert id was still via the function,
|
* 2003-02-13: in db_exec the setting for the last insert id was still via the function,
|
||||||
* changed this to call the internal PHP mysql command.
|
* changed this to call the internal PHP mysql command.
|
||||||
* 2003-01-28: ugly bug within creating the field_names. The array was not reseted
|
* 2003-01-28: ugly bug within creating the field_names. The array was not reseted
|
||||||
* before, and so the field for the db_exec where not correct.
|
* before, and so the field for the db_exec where not correct.
|
||||||
* 2003-01-16: fixed a "select" check in db_exec,
|
* 2003-01-16: fixed a "select" check in db_exec,
|
||||||
* added a privet method for checking query of INSERT, UPDATE, DELETE
|
* added a privet method for checking query of INSERT, UPDATE, DELETE
|
||||||
* 2003-01-09: code cleanups and more inline documentation
|
* 2003-01-09: code cleanups and more inline documentation
|
||||||
* 2003-01-08: renamed db_exec_ext to db_return for obious reasons
|
* 2003-01-08: renamed db_exec_ext to db_return for obious reasons
|
||||||
* added a "check for select query" for all db_return* methods
|
* added a "check for select query" for all db_return* methods
|
||||||
* 2003-01-08: db_return gets another functionality: if u use 1 or 2 as reset value,
|
* 2003-01-08: db_return gets another functionality: if u use 1 or 2 as reset value,
|
||||||
* the cursor will be reset BEFORE the read and no chaced data will be read.
|
* the cursor will be reset BEFORE the read and no chaced data will be read.
|
||||||
* if you use 2, the md5 array will be kept so next read with no flag is cached,
|
* if you use 2, the md5 array will be kept so next read with no flag is cached,
|
||||||
* wheres with 1, the data gets DESTROYED at the end of the read
|
* wheres with 1, the data gets DESTROYED at the end of the read
|
||||||
@@ -210,9 +210,9 @@
|
|||||||
* 2003-01-07: fixed a small bug in return_array as he mixed up the order if you used
|
* 2003-01-07: fixed a small bug in return_array as he mixed up the order if you used
|
||||||
* SELECT * FROM ...
|
* SELECT * FROM ...
|
||||||
* 2002-12-26: changed strstr to stristr 'couse not everyone types SELECT, etc in capitals
|
* 2002-12-26: changed strstr to stristr 'couse not everyone types SELECT, etc in capitals
|
||||||
* 2002-12-24: moved the debug output in db_return to the call if,
|
* 2002-12-24: moved the debug output in db_return to the call if,
|
||||||
* so it is only printed once
|
* so it is only printed once
|
||||||
* 2002-12-20: added db_dump_data function for printing out all data in
|
* 2002-12-20: added db_dump_data function for printing out all data in
|
||||||
* cursor_ext (or from one query in it)
|
* cursor_ext (or from one query in it)
|
||||||
* 2002-12-20: testing and implemtenting of session storing the class (not fully tested!)
|
* 2002-12-20: testing and implemtenting of session storing the class (not fully tested!)
|
||||||
* documenting all the functions and some code cleenup
|
* documenting all the functions and some code cleenup
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
* more complex (array based IO fkts) moved into a seperate file
|
* more complex (array based IO fkts) moved into a seperate file
|
||||||
* 2002-12-16: further reconstruction ...
|
* 2002-12-16: further reconstruction ...
|
||||||
* 2002-12-10: further improvment in changing db_mysql to a class
|
* 2002-12-10: further improvment in changing db_mysql to a class
|
||||||
* 2002-10-18: renamed lesen to db_read, speichern to db_save and
|
* 2002-10-18: renamed lesen to db_read, speichern to db_save and
|
||||||
* loeschen to db_delete
|
* loeschen to db_delete
|
||||||
* 19.08.2002: 1 convertiert < > " & ĵ in original
|
* 19.08.2002: 1 convertiert < > " & ĵ in original
|
||||||
* HTML zeichen zurück (für htmlspecialcharsfct)
|
* HTML zeichen zurück (für htmlspecialcharsfct)
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
* addslashes (1=ja,0=nein/default)
|
* addslashes (1=ja,0=nein/default)
|
||||||
* 04.04.2002: FK added to lesen()
|
* 04.04.2002: FK added to lesen()
|
||||||
* 10.07.2001: simple return row function geschrieben
|
* 10.07.2001: simple return row function geschrieben
|
||||||
* 03.07.2001: kein Thumbnail erzeugen wenn Datei nicht:
|
* 03.07.2001: kein Thumbnail erzeugen wenn Datei nicht:
|
||||||
* JPG/JPEG/GIF/PNG als Endung hat
|
* JPG/JPEG/GIF/PNG als Endung hat
|
||||||
* 22.06.2001: Mozilla Fix für File upload
|
* 22.06.2001: Mozilla Fix für File upload
|
||||||
* 10.05.2001: alle fkt haben "db_" als pre zur identifizierung
|
* 10.05.2001: alle fkt haben "db_" als pre zur identifizierung
|
||||||
@@ -266,12 +266,12 @@
|
|||||||
// FOR BELOW: (This should be private and only readable through some method)
|
// FOR BELOW: (This should be private and only readable through some method)
|
||||||
// cursor array for cached readings
|
// cursor array for cached readings
|
||||||
public $cursor_ext; // hash of hashes
|
public $cursor_ext; // hash of hashes
|
||||||
// per query vars
|
// per query vars
|
||||||
public $cursor; // actual cursor (DBH)
|
public $cursor; // actual cursor (DBH)
|
||||||
public $num_rows; // how many rows have been found
|
public $num_rows; // how many rows have been found
|
||||||
public $num_fields; // how many fields has the query
|
public $num_fields; // how many fields has the query
|
||||||
public $field_names; // array with the field names of the current query
|
public $field_names; // array with the field names of the current query
|
||||||
public $insert_id; // last inserted ID
|
public $insert_id; // last inserted ID
|
||||||
// other vars
|
// other vars
|
||||||
private $nbsp = ''; // used by print_array recursion function
|
private $nbsp = ''; // used by print_array recursion function
|
||||||
// error & warning id
|
// error & warning id
|
||||||
@@ -391,10 +391,10 @@
|
|||||||
// RETURN: true on successfull connect, false if failed
|
// RETURN: true on successfull connect, false if failed
|
||||||
// DESC:
|
// DESC:
|
||||||
// internal connection function. Used to connect to the DB if there is no connection done yet.
|
// internal connection function. Used to connect to the DB if there is no connection done yet.
|
||||||
// Called before any execute
|
// Called before any execute
|
||||||
private function _connect_to_db()
|
private function _connect_to_db()
|
||||||
{
|
{
|
||||||
// generate connect string
|
// generate connect string
|
||||||
$this->dbh = $this->db_functions->_db_connect($this->db_host, $this->db_user, $this->db_pwd, $this->db_name, $this->db_port, $this->db_ssl);
|
$this->dbh = $this->db_functions->_db_connect($this->db_host, $this->db_user, $this->db_pwd, $this->db_name, $this->db_port, $this->db_ssl);
|
||||||
// if no dbh here, we couldn't connect to the DB itself
|
// if no dbh here, we couldn't connect to the DB itself
|
||||||
if (!$this->dbh)
|
if (!$this->dbh)
|
||||||
@@ -410,7 +410,7 @@
|
|||||||
$this->error_id = 15;
|
$this->error_id = 15;
|
||||||
$this->_db_error();
|
$this->_db_error();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// set search path if needed
|
// set search path if needed
|
||||||
if ($this->db_schema)
|
if ($this->db_schema)
|
||||||
{
|
{
|
||||||
@@ -511,14 +511,14 @@
|
|||||||
if ($id)
|
if ($id)
|
||||||
$prefix .= '[<span style="color: #920069;">'.$id.'</span>] ';
|
$prefix .= '[<span style="color: #920069;">'.$id.'</span>] ';
|
||||||
if ($type)
|
if ($type)
|
||||||
$prefix .= '{<span style="font-style: italic; color: #3f0092;">'.$type.'</span>} ';
|
$prefix .= '{<span style="font-style: italic; color: #3f0092;">'.$type.'</span>} ';
|
||||||
if ($prefix)
|
if ($prefix)
|
||||||
$prefix .= '- ';
|
$prefix .= '- ';
|
||||||
$this->debug($debug_id, $prefix.$error_string, true);
|
$this->debug($debug_id, $prefix.$error_string, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD _db_error
|
// METHOD _db_error
|
||||||
// PARAMS cursor -> current cursor for pg_result_error, mysql uses dbh, pg_last_error too,
|
// PARAMS cursor -> current cursor for pg_result_error, mysql uses dbh, pg_last_error too,
|
||||||
// but pg_result_error is more accurate
|
// but pg_result_error is more accurate
|
||||||
// msg -> optional message
|
// msg -> optional message
|
||||||
// RETURN none
|
// RETURN none
|
||||||
@@ -593,7 +593,7 @@
|
|||||||
// METHOD _db_return_table
|
// METHOD _db_return_table
|
||||||
// PARAMS insert/select/update/delete query
|
// PARAMS insert/select/update/delete query
|
||||||
// RETURN array with schema and table
|
// RETURN array with schema and table
|
||||||
// DESC extracts schema and table from the query, if no schema returns just empty string
|
// DESC extracts schema and table from the query, if no schema returns just empty string
|
||||||
private function _db_return_table($query)
|
private function _db_return_table($query)
|
||||||
{
|
{
|
||||||
if (preg_match("/^SELECT /i", $query))
|
if (preg_match("/^SELECT /i", $query))
|
||||||
@@ -854,7 +854,7 @@
|
|||||||
|
|
||||||
// METHOD db_dump_data
|
// METHOD db_dump_data
|
||||||
// PARAMS query -> if given, only from this quey (if found)
|
// PARAMS query -> if given, only from this quey (if found)
|
||||||
// RETURN formated string with all the data in the array
|
// RETURN formated string with all the data in the array
|
||||||
// DESC dumps ALL data for this query, OR if no query given all in cursor_ext array
|
// DESC dumps ALL data for this query, OR if no query given all in cursor_ext array
|
||||||
public function db_dump_data($query = 0)
|
public function db_dump_data($query = 0)
|
||||||
{
|
{
|
||||||
@@ -878,11 +878,11 @@
|
|||||||
// if set to 2, the data will be read new and cached (wheres 1 reads new AND destroys at end of read)
|
// if set to 2, the data will be read new and cached (wheres 1 reads new AND destroys at end of read)
|
||||||
// -> if set to 3, after EACH row, the data will be reset, no caching is done except for basic (count, etc)
|
// -> if set to 3, after EACH row, the data will be reset, no caching is done except for basic (count, etc)
|
||||||
// RETURN res mixed (array/hash)
|
// RETURN res mixed (array/hash)
|
||||||
// DESC single running function, if called creates md5 from
|
// DESC single running function, if called creates md5 from
|
||||||
// query string and so can itself call exec/return calls
|
// query string and so can itself call exec/return calls
|
||||||
// caches data, so next time called with IDENTICAL (!!!!)
|
// caches data, so next time called with IDENTICAL (!!!!)
|
||||||
// [this means 1:1 bit to bit identical query] returns cached
|
// [this means 1:1 bit to bit identical query] returns cached
|
||||||
// data, or with reset flag set calls data from DB again
|
// data, or with reset flag set calls data from DB again
|
||||||
public function db_return($query, $reset = 0)
|
public function db_return($query, $reset = 0)
|
||||||
{
|
{
|
||||||
if (!$query)
|
if (!$query)
|
||||||
@@ -915,7 +915,7 @@
|
|||||||
$this->_db_error('', $this->cursor_ext[$md5]['query']);
|
$this->_db_error('', $this->cursor_ext[$md5]['query']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it is a call with reset in it we reset the cursor, so we get an uncached return
|
// if it is a call with reset in it we reset the cursor, so we get an uncached return
|
||||||
// but only for the FIRST call (pos == 0)
|
// but only for the FIRST call (pos == 0)
|
||||||
if ($reset && !$this->cursor_ext[$md5]['pos'])
|
if ($reset && !$this->cursor_ext[$md5]['pos'])
|
||||||
@@ -966,7 +966,7 @@
|
|||||||
} // only go if NO cursor exists
|
} // only go if NO cursor exists
|
||||||
|
|
||||||
// if cursor exists ...
|
// if cursor exists ...
|
||||||
if ($this->cursor_ext[$md5]['cursor'])
|
if ($this->cursor_ext[$md5]['cursor'])
|
||||||
{
|
{
|
||||||
if ($this->cursor_ext[$md5]['firstcall'] == 1)
|
if ($this->cursor_ext[$md5]['firstcall'] == 1)
|
||||||
{
|
{
|
||||||
@@ -987,7 +987,7 @@
|
|||||||
$this->cursor_ext[$md5]['read_rows'] = 0;
|
$this->cursor_ext[$md5]['read_rows'] = 0;
|
||||||
}
|
}
|
||||||
// read data for further work ... but only if necessarry
|
// read data for further work ... but only if necessarry
|
||||||
if ($this->cursor_ext[$md5]['read_rows'] == $this->cursor_ext[$md5]['num_rows'])
|
if ($this->cursor_ext[$md5]['read_rows'] == $this->cursor_ext[$md5]['num_rows'])
|
||||||
$return = 0;
|
$return = 0;
|
||||||
else
|
else
|
||||||
$return = $this->_db_convert_encoding($this->db_functions->_db_fetch_array($this->cursor_ext[$md5]['cursor']));
|
$return = $this->_db_convert_encoding($this->db_functions->_db_fetch_array($this->cursor_ext[$md5]['cursor']));
|
||||||
@@ -1002,7 +1002,7 @@
|
|||||||
$this->cursor_ext[$md5]['cursor'] = 1;
|
$this->cursor_ext[$md5]['cursor'] = 1;
|
||||||
$return = 0;
|
$return = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// unset return value ...
|
// unset return value ...
|
||||||
unset($return);
|
unset($return);
|
||||||
@@ -1012,7 +1012,7 @@
|
|||||||
$field_value = $this->cursor_ext[$md5][$this->cursor_ext[$md5]['pos']][$this->cursor_ext[$md5]['field_names'][$i]];
|
$field_value = $this->cursor_ext[$md5][$this->cursor_ext[$md5]['pos']][$this->cursor_ext[$md5]['field_names'][$i]];
|
||||||
$return[$i] = $field_value;
|
$return[$i] = $field_value;
|
||||||
$return[$this->cursor_ext[$md5]['field_names'][$i]] = $field_value;
|
$return[$this->cursor_ext[$md5]['field_names'][$i]] = $field_value;
|
||||||
}
|
}
|
||||||
$this->cursor_ext[$md5]['pos'] ++;
|
$this->cursor_ext[$md5]['pos'] ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1043,7 +1043,7 @@
|
|||||||
{
|
{
|
||||||
while (list($field_name, $data) = each($return))
|
while (list($field_name, $data) = each($return))
|
||||||
{
|
{
|
||||||
$temp[$field_name] = $data;
|
$temp[$field_name] = $data;
|
||||||
}
|
}
|
||||||
$this->cursor_ext[$md5][] = $temp;
|
$this->cursor_ext[$md5][] = $temp;
|
||||||
}
|
}
|
||||||
@@ -1073,16 +1073,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// METHOD db_exec
|
// METHOD db_exec
|
||||||
// PARAMS query -> the query, if not given, the query class var will be used
|
// PARAMS query -> the query, if not given, the query class var will be used
|
||||||
// (if this was not set, method will quit with a 0 (failure)
|
// (if this was not set, method will quit with a 0 (failure)
|
||||||
// pk_name -> optional primary key name, for insert id return if the pk name is very different
|
// pk_name -> optional primary key name, for insert id return if the pk name is very different
|
||||||
// if pk name is table name and _id, pk_name is not needed to be set
|
// if pk name is table name and _id, pk_name is not needed to be set
|
||||||
// if NULL is given here, no RETURNING will be auto added
|
// if NULL is given here, no RETURNING will be auto added
|
||||||
// RETURN cursor for this query
|
// RETURN cursor for this query
|
||||||
// DESC executes the query and returns & sets the internal cursor
|
// DESC executes the query and returns & sets the internal cursor
|
||||||
// fruthermore this functions also sets varios other vars
|
// fruthermore this functions also sets varios other vars
|
||||||
// like num_rows, num_fields, etc depending on query
|
// like num_rows, num_fields, etc depending on query
|
||||||
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
||||||
// read from the database for the PK NAME
|
// read from the database for the PK NAME
|
||||||
public function db_exec($query = 0, $pk_name = '')
|
public function db_exec($query = 0, $pk_name = '')
|
||||||
{
|
{
|
||||||
@@ -1105,7 +1105,7 @@
|
|||||||
// pk_name -> optional primary key name, only used with insert for returning call
|
// pk_name -> optional primary key name, only used with insert for returning call
|
||||||
// RETURN true if async query was sent ok, false if error happened
|
// RETURN true if async query was sent ok, false if error happened
|
||||||
// DESC executres the query async so other methods can be run during this
|
// DESC executres the query async so other methods can be run during this
|
||||||
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
||||||
// read from the database for the PK NAME
|
// read from the database for the PK NAME
|
||||||
// NEEDS db_check_async
|
// NEEDS db_check_async
|
||||||
public function db_exec_async($query, $pk_name = '')
|
public function db_exec_async($query, $pk_name = '')
|
||||||
@@ -1294,7 +1294,7 @@
|
|||||||
// PARAMS $stm_name, $query, $pk_name: optional
|
// PARAMS $stm_name, $query, $pk_name: optional
|
||||||
// RETURN false on error
|
// RETURN false on error
|
||||||
// DESC prepares a query
|
// DESC prepares a query
|
||||||
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
// for INSERT INTO queries it is highly recommended to set the pk_name to avoid an additional
|
||||||
// read from the database for the PK NAME
|
// read from the database for the PK NAME
|
||||||
public function db_prepare($stm_name, $query, $pk_name = '')
|
public function db_prepare($stm_name, $query, $pk_name = '')
|
||||||
{
|
{
|
||||||
@@ -1469,7 +1469,7 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
|
|||||||
// RETURN database version as string
|
// RETURN database version as string
|
||||||
// DESC return current database version
|
// DESC return current database version
|
||||||
public function db_version()
|
public function db_version()
|
||||||
{
|
{
|
||||||
return $this->db_functions->_db_version();
|
return $this->db_functions->_db_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1479,7 +1479,7 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
|
|||||||
// RETURN true/false
|
// RETURN true/false
|
||||||
// DESC returns boolean true or false if the string matches the database version
|
// DESC returns boolean true or false if the string matches the database version
|
||||||
public function db_compare_version($compare)
|
public function db_compare_version($compare)
|
||||||
{
|
{
|
||||||
// compare has =, >, < prefix, and gets stripped, if the rest is not X.Y format then error
|
// compare has =, >, < prefix, and gets stripped, if the rest is not X.Y format then error
|
||||||
preg_match("/^([<>=]{1,2})(\d{1,2})\.(\d{1,2})/", $compare, $matches);
|
preg_match("/^([<>=]{1,2})(\d{1,2})\.(\d{1,2})/", $compare, $matches);
|
||||||
$compare = $matches[1];
|
$compare = $matches[1];
|
||||||
@@ -1496,7 +1496,7 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
|
|||||||
$return = false;
|
$return = false;
|
||||||
// compare
|
// compare
|
||||||
switch ($compare)
|
switch ($compare)
|
||||||
{
|
{
|
||||||
case '=':
|
case '=':
|
||||||
if ($to_version == $version)
|
if ($to_version == $version)
|
||||||
$return = true;
|
$return = true;
|
||||||
@@ -1662,7 +1662,7 @@ $this->debug('ExecuteData', 'ERROR in STM['.$stm_name.'|'.$this->prepare_cursor[
|
|||||||
$seconds = $matches[4] != '00' ? preg_replace('/^0/', '', $matches[4]) : '';
|
$seconds = $matches[4] != '00' ? preg_replace('/^0/', '', $matches[4]) : '';
|
||||||
$milliseconds = $matches[6];
|
$milliseconds = $matches[6];
|
||||||
|
|
||||||
return $prefix.($hour ? $hour.'h ' : '').($minutes ? $minutes.'m ' : '').($seconds ? $seconds.'s' : '').($show_micro && $milliseconds? ' '.$milliseconds.'ms' : '');
|
return $prefix.($hour ? $hour.'h ' : '').($minutes ? $minutes.'m ' : '').($seconds ? $seconds.'s' : '').($show_micro && $milliseconds? ' '.$milliseconds.'ms' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD: db_array_parse
|
// METHOD: db_array_parse
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
* "pk_name" => the pk_name of the table for the drop down
|
* "pk_name" => the pk_name of the table for the drop down
|
||||||
* "input_name" => the text field name in the table for the drop down
|
* "input_name" => the text field name in the table for the drop down
|
||||||
* "input_value" => the $name of input_name (must be same)
|
* "input_value" => the $name of input_name (must be same)
|
||||||
* "order_by" => "order bY" string for drop_down_db(_input) if no query given but fields set
|
* "order_by" => "order bY" string for drop_down_db(_input) if no query given but fields set
|
||||||
* "query" => for drop_down_db/array if no outer query given
|
* "query" => for drop_down_db/array if no outer query given
|
||||||
* "preset" => value to preset when array is unset (available for all types)
|
* "preset" => value to preset when array is unset (available for all types)
|
||||||
* "element_list" => array ( "true", "false") - MUST (!) be set for binary
|
* "element_list" => array ( "true", "false") - MUST (!) be set for binary
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
* "cols" => "nr" - only available for "textarea"
|
* "cols" => "nr" - only available for "textarea"
|
||||||
* "error_check" => "custom/email/date/number/unique" - 1) more will come
|
* "error_check" => "custom/email/date/number/unique" - 1) more will come
|
||||||
* "error_regex" => "regex" - if error_check is custom regex here
|
* "error_regex" => "regex" - if error_check is custom regex here
|
||||||
* "error_example" => "text" - example input text for error_check (only custom right now)
|
* "error_example" => "text" - example input text for error_check (only custom right now)
|
||||||
* "empty" => "value/text" - ONLY for view. If no data found, set this value
|
* "empty" => "value/text" - ONLY for view. If no data found, set this value
|
||||||
* --- file:
|
* --- file:
|
||||||
* "save_dir" => "directory where it should be saved to
|
* "save_dir" => "directory where it should be saved to
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
* "output_name" => "Printed out next to multiple select field",
|
* "output_name" => "Printed out next to multiple select field",
|
||||||
* "mandatory" => 1/0 for must be selected,
|
* "mandatory" => 1/0 for must be selected,
|
||||||
* "select_size" => size of multiple select field,
|
* "select_size" => size of multiple select field,
|
||||||
* "query" => "the query to load the multiple select field
|
* "query" => "the query to load the multiple select field
|
||||||
* (select id, concat_ws(" ",name_a, name_b) from reference_table)",
|
* (select id, concat_ws(" ",name_a, name_b) from reference_table)",
|
||||||
* "selected" => $var_name for name="xx" in multiple select
|
* "selected" => $var_name for name="xx" in multiple select
|
||||||
* ),
|
* ),
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
* delete
|
* delete
|
||||||
* 2003-06-12: adapted class to register_global_vars off
|
* 2003-06-12: adapted class to register_global_vars off
|
||||||
* 2003-06-10: in procedure_delete function I added "protected" variable clause, so if this field exists
|
* 2003-06-10: in procedure_delete function I added "protected" variable clause, so if this field exists
|
||||||
* in the DB and is set, you are not able to delete [at the moment used for admin edit user
|
* in the DB and is set, you are not able to delete [at the moment used for admin edit user
|
||||||
* in DB]
|
* in DB]
|
||||||
* 2003-05-30: _temp for drop_down_db was added always and not only for same_db
|
* 2003-05-30: _temp for drop_down_db was added always and not only for same_db
|
||||||
* 2003-05-28: added drop_down_db_same_db for drop down/input combinations going into the same DB.
|
* 2003-05-28: added drop_down_db_same_db for drop down/input combinations going into the same DB.
|
||||||
@@ -201,14 +201,14 @@
|
|||||||
* 2003-03-04: drop_down_array value for option was left from array and
|
* 2003-03-04: drop_down_array value for option was left from array and
|
||||||
* not right
|
* not right
|
||||||
* 2003-02-27: added another check in unset if reference array exists
|
* 2003-02-27: added another check in unset if reference array exists
|
||||||
* 2003-02-26: change form to extend db_array_io and created load, save,
|
* 2003-02-26: change form to extend db_array_io and created load, save,
|
||||||
* delete functions removed all reference table functions,
|
* delete functions removed all reference table functions,
|
||||||
* except show function rewrite config array
|
* except show function rewrite config array
|
||||||
* re-wrote the class info vars into array
|
* re-wrote the class info vars into array
|
||||||
* 2003-02-25: added reference table functions
|
* 2003-02-25: added reference table functions
|
||||||
* 2002-10-22: create this class so creating basic and medium form pages
|
* 2002-10-22: create this class so creating basic and medium form pages
|
||||||
* can be handled easy.
|
* can be handled easy.
|
||||||
* with a given config file the class handles error checks,
|
* with a given config file the class handles error checks,
|
||||||
* save data, loads data, etc
|
* save data, loads data, etc
|
||||||
*********************************************************************/
|
*********************************************************************/
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
// start the array_io class which will start db_io ...
|
// start the array_io class which will start db_io ...
|
||||||
parent::__construct($db_config, $config_array["table_array"], $config_array["table_name"], $debug, $db_debug, $echo, $print);
|
parent::__construct($db_config, $config_array["table_array"], $config_array["table_name"], $debug, $db_debug, $echo, $print);
|
||||||
// here should be a check if the config_array is correct ...
|
// here should be a check if the config_array is correct ...
|
||||||
//
|
//
|
||||||
$this->field_array = $config_array["show_fields"];
|
$this->field_array = $config_array["show_fields"];
|
||||||
$this->load_query = $config_array["load_query"];
|
$this->load_query = $config_array["load_query"];
|
||||||
$this->archive_pk_name = "a_".$this->pk_name;
|
$this->archive_pk_name = "a_".$this->pk_name;
|
||||||
@@ -281,7 +281,7 @@
|
|||||||
{
|
{
|
||||||
$this->reference_array[$key] = $value;
|
$this->reference_array[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_array($config_array["element_list"]))
|
if (is_array($config_array["element_list"]))
|
||||||
{
|
{
|
||||||
while (list($key, $value) = each($config_array["element_list"]))
|
while (list($key, $value) = each($config_array["element_list"]))
|
||||||
@@ -479,7 +479,7 @@
|
|||||||
{
|
{
|
||||||
$this->form_error_check();
|
$this->form_error_check();
|
||||||
if (!$this->error)
|
if (!$this->error)
|
||||||
{
|
{
|
||||||
$this->form_save_table_array();
|
$this->form_save_table_array();
|
||||||
}
|
}
|
||||||
$this->yes = 1;
|
$this->yes = 1;
|
||||||
@@ -602,7 +602,7 @@
|
|||||||
{
|
{
|
||||||
$pk_ids[] = $res[$this->int_pk_name];
|
$pk_ids[] = $res[$this->int_pk_name];
|
||||||
if ($res[$this->int_pk_name] == $this->table_array[$this->int_pk_name]["value"])
|
if ($res[$this->int_pk_name] == $this->table_array[$this->int_pk_name]["value"])
|
||||||
{
|
{
|
||||||
$pk_selected = $res[$this->int_pk_name];
|
$pk_selected = $res[$this->int_pk_name];
|
||||||
}
|
}
|
||||||
unset($t_string);
|
unset($t_string);
|
||||||
@@ -635,7 +635,7 @@
|
|||||||
if ($this->group_level_user <= $this->security_level["new"])
|
if ($this->group_level_user <= $this->security_level["new"])
|
||||||
{
|
{
|
||||||
if ($this->yes && !$hide_new_checkbox)
|
if ($this->yes && !$hide_new_checkbox)
|
||||||
{
|
{
|
||||||
$show_checkbox = 1;
|
$show_checkbox = 1;
|
||||||
}
|
}
|
||||||
// set type of new name
|
// set type of new name
|
||||||
@@ -658,12 +658,12 @@
|
|||||||
if ($this->group_level_user <= $this->security_level["save"])
|
if ($this->group_level_user <= $this->security_level["save"])
|
||||||
{
|
{
|
||||||
$seclevel_okay = 1;
|
$seclevel_okay = 1;
|
||||||
if (!$this->table_array[$this->int_pk_name]["value"])
|
if (!$this->table_array[$this->int_pk_name]["value"])
|
||||||
{
|
{
|
||||||
$save = $this->l->__("Save");
|
$save = $this->l->__("Save");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$save = $this->l->__("Update");
|
$save = $this->l->__("Update");
|
||||||
}
|
}
|
||||||
// print the old_school hidden if requestet
|
// print the old_school hidden if requestet
|
||||||
@@ -714,7 +714,7 @@
|
|||||||
$data['output'][] = $this->table_array[$element_name]["element_list"][$i];
|
$data['output'][] = $this->table_array[$element_name]["element_list"][$i];
|
||||||
$data['name'] = $element_name;
|
$data['name'] = $element_name;
|
||||||
if (($i && $this->table_array[$element_name]["value"]) || (!$i && !$this->table_array[$element_name]["value"]))
|
if (($i && $this->table_array[$element_name]["value"]) || (!$i && !$this->table_array[$element_name]["value"]))
|
||||||
$data['checked'] = $this->table_array[$element_name]["value"];
|
$data['checked'] = $this->table_array[$element_name]["value"];
|
||||||
|
|
||||||
if ($i)
|
if ($i)
|
||||||
$data['separator'] = '';
|
$data['separator'] = '';
|
||||||
@@ -839,7 +839,7 @@
|
|||||||
// for media / not yet implemented
|
// for media / not yet implemented
|
||||||
if ($this->table_array[$element_name]["type"] == "media")
|
if ($this->table_array[$element_name]["type"] == "media")
|
||||||
{
|
{
|
||||||
//media::insert_file($element_name,$this->table_array[$element_name]["value"],$query);
|
//media::insert_file($element_name,$this->table_array[$element_name]["value"],$query);
|
||||||
}
|
}
|
||||||
// order button
|
// order button
|
||||||
if ($this->table_array[$element_name]["type"] == "order")
|
if ($this->table_array[$element_name]["type"] == "order")
|
||||||
@@ -889,7 +889,7 @@
|
|||||||
foreach (explode('|', $value["error_check"]) as $error_check)
|
foreach (explode('|', $value["error_check"]) as $error_check)
|
||||||
{
|
{
|
||||||
switch ($error_check)
|
switch ($error_check)
|
||||||
{
|
{
|
||||||
case "number":
|
case "number":
|
||||||
if (!preg_match("/^[0-9]+(['\,','.']?[0-9]+)*$/", $this->table_array[$key]["value"]))
|
if (!preg_match("/^[0-9]+(['\,','.']?[0-9]+)*$/", $this->table_array[$key]["value"]))
|
||||||
$this->msg .= sprintf($this->l->__("Please enter a vailid Number for the <b>%s</b> Field!<br>"), $this->table_array[$key]["output_name"]);
|
$this->msg .= sprintf($this->l->__("Please enter a vailid Number for the <b>%s</b> Field!<br>"), $this->table_array[$key]["output_name"]);
|
||||||
@@ -952,15 +952,15 @@
|
|||||||
} // for each error to check
|
} // for each error to check
|
||||||
}
|
}
|
||||||
// if mandatory && no input
|
// if mandatory && no input
|
||||||
else if ($value["mandatory"] &&
|
else if ($value["mandatory"] &&
|
||||||
(
|
(
|
||||||
// for all "normal" fields
|
// for all "normal" fields
|
||||||
($this->table_array[$key]["type"] != "password" && $this->table_array[$key]["type"] != "drop_down_db_input" && !$this->table_array[$key]["value"]) ||
|
($this->table_array[$key]["type"] != "password" && $this->table_array[$key]["type"] != "drop_down_db_input" && !$this->table_array[$key]["value"]) ||
|
||||||
// for drop_down_db_input check if one of both fields filled
|
// for drop_down_db_input check if one of both fields filled
|
||||||
($this->table_array[$key]["type"] == "drop_down_db_input" && !$this->table_array[$key]["input_value"] && !$this->table_array[$key]["value"]) ||
|
($this->table_array[$key]["type"] == "drop_down_db_input" && !$this->table_array[$key]["input_value"] && !$this->table_array[$key]["value"]) ||
|
||||||
// for password
|
// for password
|
||||||
($this->table_array[$key]["type"] == "password" && !$this->table_array[$key]["value"] && !$this->table_array[$key]["HIDDEN_value"])
|
($this->table_array[$key]["type"] == "password" && !$this->table_array[$key]["value"] && !$this->table_array[$key]["HIDDEN_value"])
|
||||||
)
|
)
|
||||||
) // main if end
|
) // main if end
|
||||||
{
|
{
|
||||||
//$this->debug('form', "A: ".$this->table_array[$key]["type"]." -- ".$this->table_array[$key]["input_value"]." -- ".$this->table_array[$key]["value"]);
|
//$this->debug('form', "A: ".$this->table_array[$key]["type"]." -- ".$this->table_array[$key]["input_value"]." -- ".$this->table_array[$key]["value"]);
|
||||||
@@ -994,9 +994,9 @@
|
|||||||
if ($this->reference_array[$key]["mandatory"] && !$this->reference_array[$key]["selected"][0])
|
if ($this->reference_array[$key]["mandatory"] && !$this->reference_array[$key]["selected"][0])
|
||||||
$this->msg .= sprintf($this->l->__("Please select at least one Element from field <b>%s</b>!<br>"), $this->reference_array[$key]["output_name"]);
|
$this->msg .= sprintf($this->l->__("Please select at least one Element from field <b>%s</b>!<br>"), $this->reference_array[$key]["output_name"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$this->debug('edit_error', "QS: <pre>".print_r($_POST, 1)."</pre>");
|
//$this->debug('edit_error', "QS: <pre>".print_r($_POST, 1)."</pre>");
|
||||||
if (is_array($this->element_list))
|
if (is_array($this->element_list))
|
||||||
{
|
{
|
||||||
// check the mandatory stuff
|
// check the mandatory stuff
|
||||||
// if mandatory, check that at least on pk exists or if at least the mandatory field is filled
|
// if mandatory, check that at least on pk exists or if at least the mandatory field is filled
|
||||||
@@ -1159,7 +1159,7 @@
|
|||||||
// if preset var present preset
|
// if preset var present preset
|
||||||
if (isset($this->table_array[$key]["preset"]))
|
if (isset($this->table_array[$key]["preset"]))
|
||||||
$this->table_array[$key]["value"] = $this->table_array[$key]["preset"];
|
$this->table_array[$key]["value"] = $this->table_array[$key]["preset"];
|
||||||
}
|
}
|
||||||
if (is_array($this->reference_array))
|
if (is_array($this->reference_array))
|
||||||
{
|
{
|
||||||
if (!is_array($this->reference_array))
|
if (!is_array($this->reference_array))
|
||||||
@@ -1211,7 +1211,7 @@
|
|||||||
|
|
||||||
// METHOD form_save_table_array
|
// METHOD form_save_table_array
|
||||||
// PARAMS addslashes - if one, passes 1 to the db_write function
|
// PARAMS addslashes - if one, passes 1 to the db_write function
|
||||||
// RETURN none
|
// RETURN none
|
||||||
// DESC save a table, reference and all input fields
|
// DESC save a table, reference and all input fields
|
||||||
public function form_save_table_array($addslashes = 0)
|
public function form_save_table_array($addslashes = 0)
|
||||||
{
|
{
|
||||||
@@ -1232,11 +1232,11 @@
|
|||||||
$q = "SELECT ".$this->table_array[$key]["pk_name"]." FROM ".$this->table_array[$key]["table_name"]." WHERE LCASE(".$this->table_array[$key]["input_name"].") = '".$this->db_escape_string(strtolower($this->table_array[$key]["input_value"]))."'";
|
$q = "SELECT ".$this->table_array[$key]["pk_name"]." FROM ".$this->table_array[$key]["table_name"]." WHERE LCASE(".$this->table_array[$key]["input_name"].") = '".$this->db_escape_string(strtolower($this->table_array[$key]["input_value"]))."'";
|
||||||
// if a where was given, add here
|
// if a where was given, add here
|
||||||
if ($this->table_array[$key]["where"])
|
if ($this->table_array[$key]["where"])
|
||||||
$q .= " AND ".$this->table_array[$key]["where"];
|
$q .= " AND ".$this->table_array[$key]["where"];
|
||||||
list($pk_name_temp) = $this->db_return_row($q);
|
list($pk_name_temp) = $this->db_return_row($q);
|
||||||
if ($this->num_rows >= 1)
|
if ($this->num_rows >= 1)
|
||||||
{
|
{
|
||||||
$this->table_array[$key]["value"] = $pk_name_temp;
|
$this->table_array[$key]["value"] = $pk_name_temp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1298,7 +1298,7 @@
|
|||||||
//if a slash at the end (if not add slash)
|
//if a slash at the end (if not add slash)
|
||||||
if (!preg_match("|/$|", $this->table_array[$key]["save_dir"]))
|
if (!preg_match("|/$|", $this->table_array[$key]["save_dir"]))
|
||||||
$this->table_array[$key]["save_dir"] .= "/";
|
$this->table_array[$key]["save_dir"] .= "/";
|
||||||
if (move_uploaded_file($GLOBALS["_FILES"][$key."_file"]['tmp_name'], $this->table_array[$key]["save_dir"].$GLOBALS["_FILES"][$key."_file"]['name']))
|
if (move_uploaded_file($GLOBALS["_FILES"][$key."_file"]['tmp_name'], $this->table_array[$key]["save_dir"].$GLOBALS["_FILES"][$key."_file"]['name']))
|
||||||
{
|
{
|
||||||
// make it unique with a unique number at the beginning
|
// make it unique with a unique number at the beginning
|
||||||
$this->table_array[$key]["value"] = uniqid(rand(), 1)."_".$GLOBALS["_FILES"][$key."_file"]['name'];
|
$this->table_array[$key]["value"] = uniqid(rand(), 1)."_".$GLOBALS["_FILES"][$key."_file"]['name'];
|
||||||
@@ -1333,7 +1333,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// $this->table_array[$key]["HIDDEN_value"] =
|
// $this->table_array[$key]["HIDDEN_value"] =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // go through each field
|
} // go through each field
|
||||||
@@ -1498,7 +1498,7 @@ $this->debug('edit', "Pos[$i] => ".$type[$i]." Q: ".$q."<br>");
|
|||||||
}
|
}
|
||||||
$this->warning = 1;
|
$this->warning = 1;
|
||||||
$this->msg = $this->l->__("Dataset has been saved!<Br>");
|
$this->msg = $this->l->__("Dataset has been saved!<Br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD form_delete_table_array
|
// METHOD form_delete_table_array
|
||||||
// PARAMS none
|
// PARAMS none
|
||||||
@@ -1737,7 +1737,7 @@ $this->debug('edit', "Pos[$i] => ".$type[$i]." Q: ".$q."<br>");
|
|||||||
// if we have a radio group, set a bit different
|
// if we have a radio group, set a bit different
|
||||||
if ($data['element_list'][$prfx.$el_name] == 'radio_group')
|
if ($data['element_list'][$prfx.$el_name] == 'radio_group')
|
||||||
$_data[$prfx.$el_name] = ($res[$el_name]) ? ($res[$el_name] - 1) : 0;
|
$_data[$prfx.$el_name] = ($res[$el_name]) ? ($res[$el_name] - 1) : 0;
|
||||||
else
|
else
|
||||||
$_data[$prfx.$el_name] = $_POST[$prfx.$el_name][$pos];
|
$_data[$prfx.$el_name] = $_POST[$prfx.$el_name][$pos];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -179,7 +179,7 @@
|
|||||||
$_SESSION['DEFAULT_ACL_LIST'] = $this->default_acl_list;
|
$_SESSION['DEFAULT_ACL_LIST'] = $this->default_acl_list;
|
||||||
|
|
||||||
// if username & password & !$euid start login
|
// if username & password & !$euid start login
|
||||||
$this->login_login_user();
|
$this->login_login_user();
|
||||||
// checks if $euid given check if user is okay for that side
|
// checks if $euid given check if user is okay for that side
|
||||||
$this->login_check_permissions();
|
$this->login_check_permissions();
|
||||||
// logsout user
|
// logsout user
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
{
|
{
|
||||||
parent::__destruct();
|
parent::__destruct();
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD: login_login_user
|
// METHOD: login_login_user
|
||||||
// PARAMS: none
|
// PARAMS: none
|
||||||
// RETURN: none
|
// RETURN: none
|
||||||
@@ -820,11 +820,11 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD: login_set_templates
|
// METHOD: login_set_templates
|
||||||
// PARAMS:
|
// PARAMS:
|
||||||
// RETURN: none
|
// RETURN: none
|
||||||
// DESC : checks if there are external templates, if not uses internal fallback ones
|
// DESC : checks if there are external templates, if not uses internal fallback ones
|
||||||
private function login_set_templates()
|
private function login_set_templates()
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ class ProgressBar
|
|||||||
$bar = $this->height;
|
$bar = $this->height;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid divison through 0
|
// avoid divison through 0
|
||||||
if ($this->max - $this->min == 0)
|
if ($this->max - $this->min == 0)
|
||||||
$this->max ++;
|
$this->max ++;
|
||||||
@@ -557,7 +556,6 @@ class ProgressBar
|
|||||||
$this->_setStep($step);
|
$this->_setStep($step);
|
||||||
|
|
||||||
$js = '';
|
$js = '';
|
||||||
|
|
||||||
$new_position = $this->_calculatePosition($this->step);
|
$new_position = $this->_calculatePosition($this->step);
|
||||||
if ($new_position['width'] != $this->position['width'] && ($this->direction == 'right' || $this->direction == 'left'))
|
if ($new_position['width'] != $this->position['width'] && ($this->direction == 'right' || $this->direction == 'left'))
|
||||||
{
|
{
|
||||||
@@ -576,7 +574,6 @@ class ProgressBar
|
|||||||
$js .= 'PBposition'.$this->code.'("height",'.$new_position['height'].');';
|
$js .= 'PBposition'.$this->code.'("height",'.$new_position['height'].');';
|
||||||
}
|
}
|
||||||
$this->position = $new_position;
|
$this->position = $new_position;
|
||||||
|
|
||||||
foreach($this->label as $name => $data)
|
foreach($this->label as $name => $data)
|
||||||
{
|
{
|
||||||
if (array_key_exists('type', $data))
|
if (array_key_exists('type', $data))
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
// read in the Smarty class for definition
|
// read in the Smarty class for definition
|
||||||
// use smarty BC for backwards compability
|
// use smarty BC for backwards compability
|
||||||
// try to include file from LIBS path, or from normal path
|
// try to include file from LIBS path, or from normal path
|
||||||
_spl_autoload('SmartyBC.class.php');
|
_spl_autoload('SmartyBC.class.php');
|
||||||
|
|
||||||
class SmartyML extends SmartyBC
|
class SmartyML extends SmartyBC
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?
|
<?
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* AUTHOR: Clemens Schwaighofer
|
* AUTHOR: Clemens Schwaighofer
|
||||||
* CREATED: 2011/2/8
|
* CREATED: 2011/2/8
|
||||||
* DESCRIPTION: pre function to collect all non critical errors into a log file if possible
|
* DESCRIPTION: pre function to collect all non critical errors into a log file if possible
|
||||||
* include this file at the very beginning of the script to get the notices, strict, etc messages.
|
* include this file at the very beginning of the script to get the notices, strict, etc messages.
|
||||||
* error etc will still be written to the log/display
|
* error etc will still be written to the log/display
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
4096 => 'E_RECOVERABLE_ERROR',
|
4096 => 'E_RECOVERABLE_ERROR',
|
||||||
8192 => 'E_DEPRICATED',
|
8192 => 'E_DEPRICATED',
|
||||||
16384 => 'E_USER_DEPRICATED',
|
16384 => 'E_USER_DEPRICATED',
|
||||||
30719 => 'E_ALL'
|
30719 => 'E_ALL'
|
||||||
);
|
);
|
||||||
|
|
||||||
// get the current page name (strip path)
|
// get the current page name (strip path)
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
}
|
}
|
||||||
// if write to log is on
|
// if write to log is on
|
||||||
// simplified, remove datetime for log file
|
// simplified, remove datetime for log file
|
||||||
if (ini_get('log_errors'))
|
if (ini_get('log_errors'))
|
||||||
error_log('{'.$page_temp.'} ['.$file.'] <'.$line.'> ['.$error_level[$type].'|'.$type.']: '.$message);
|
error_log('{'.$page_temp.'} ['.$file.'] <'.$line.'> ['.$error_level[$type].'|'.$type.']: '.$message);
|
||||||
}
|
}
|
||||||
// return true, to avoid that php calls its own error stuff
|
// return true, to avoid that php calls its own error stuff
|
||||||
|
|||||||
@@ -8,21 +8,21 @@ class qqUploadedFileXhr {
|
|||||||
* Save the file to the specified path
|
* Save the file to the specified path
|
||||||
* @return boolean TRUE on success
|
* @return boolean TRUE on success
|
||||||
*/
|
*/
|
||||||
function save($path) {
|
function save($path) {
|
||||||
$input = fopen("php://input", "r");
|
$input = fopen("php://input", "r");
|
||||||
$temp = tmpfile();
|
$temp = tmpfile();
|
||||||
$realSize = stream_copy_to_stream($input, $temp);
|
$realSize = stream_copy_to_stream($input, $temp);
|
||||||
fclose($input);
|
fclose($input);
|
||||||
|
|
||||||
if ($realSize != $this->getSize()){
|
if ($realSize != $this->getSize()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = fopen($path, "w");
|
$target = fopen($path, "w");
|
||||||
fseek($temp, 0, SEEK_SET);
|
fseek($temp, 0, SEEK_SET);
|
||||||
stream_copy_to_stream($temp, $target);
|
stream_copy_to_stream($temp, $target);
|
||||||
fclose($target);
|
fclose($target);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function getName() {
|
function getName() {
|
||||||
@@ -30,17 +30,17 @@ class qqUploadedFileXhr {
|
|||||||
}
|
}
|
||||||
function getSize() {
|
function getSize() {
|
||||||
if (isset($_SERVER["CONTENT_LENGTH"])){
|
if (isset($_SERVER["CONTENT_LENGTH"])){
|
||||||
return (int)$_SERVER["CONTENT_LENGTH"];
|
return (int)$_SERVER["CONTENT_LENGTH"];
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Getting content length is not supported.');
|
throw new Exception('Getting content length is not supported.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle file uploads via regular form post (uses the $_FILES array)
|
* Handle file uploads via regular form post (uses the $_FILES array)
|
||||||
*/
|
*/
|
||||||
class qqUploadedFileForm {
|
class qqUploadedFileForm {
|
||||||
/**
|
/**
|
||||||
* Save the file to the specified path
|
* Save the file to the specified path
|
||||||
* @return boolean TRUE on success
|
* @return boolean TRUE on success
|
||||||
@@ -64,44 +64,44 @@ class qqFileUploader {
|
|||||||
private $sizeLimit = 10485760;
|
private $sizeLimit = 10485760;
|
||||||
private $file;
|
private $file;
|
||||||
|
|
||||||
function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
|
function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){
|
||||||
$allowedExtensions = array_map("strtolower", $allowedExtensions);
|
$allowedExtensions = array_map("strtolower", $allowedExtensions);
|
||||||
|
|
||||||
$this->allowedExtensions = $allowedExtensions;
|
$this->allowedExtensions = $allowedExtensions;
|
||||||
$this->sizeLimit = $sizeLimit;
|
$this->sizeLimit = $sizeLimit;
|
||||||
|
|
||||||
$this->checkServerSettings();
|
$this->checkServerSettings();
|
||||||
|
|
||||||
if (isset($_GET['qqfile'])) {
|
if (isset($_GET['qqfile'])) {
|
||||||
$this->file = new qqUploadedFileXhr();
|
$this->file = new qqUploadedFileXhr();
|
||||||
} elseif (isset($_FILES['qqfile'])) {
|
} elseif (isset($_FILES['qqfile'])) {
|
||||||
$this->file = new qqUploadedFileForm();
|
$this->file = new qqUploadedFileForm();
|
||||||
} else {
|
} else {
|
||||||
$this->file = false;
|
$this->file = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkServerSettings(){
|
private function checkServerSettings(){
|
||||||
$postSize = $this->toBytes(ini_get('post_max_size'));
|
$postSize = $this->toBytes(ini_get('post_max_size'));
|
||||||
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
|
$uploadSize = $this->toBytes(ini_get('upload_max_filesize'));
|
||||||
|
|
||||||
if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
|
if ($postSize < $this->sizeLimit || $uploadSize < $this->sizeLimit){
|
||||||
$size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
|
$size = max(1, $this->sizeLimit / 1024 / 1024) . 'M';
|
||||||
die("{'error':'increase post_max_size and upload_max_filesize to $size'}");
|
die("{'error':'increase post_max_size and upload_max_filesize to $size'}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function toBytes($str){
|
private function toBytes($str){
|
||||||
$val = trim($str);
|
$val = trim($str);
|
||||||
$last = strtolower($str[strlen($str)-1]);
|
$last = strtolower($str[strlen($str)-1]);
|
||||||
switch($last) {
|
switch($last) {
|
||||||
case 'g': $val *= 1024;
|
case 'g': $val *= 1024;
|
||||||
case 'm': $val *= 1024;
|
case 'm': $val *= 1024;
|
||||||
case 'k': $val *= 1024;
|
case 'k': $val *= 1024;
|
||||||
}
|
}
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns array('success'=>true) or array('error'=>'error message')
|
* Returns array('success'=>true) or array('error'=>'error message')
|
||||||
*/
|
*/
|
||||||
@@ -109,21 +109,21 @@ class qqFileUploader {
|
|||||||
if (!is_writable($uploadDirectory)){
|
if (!is_writable($uploadDirectory)){
|
||||||
return array('error' => "Server error. Upload directory isn't writable.");
|
return array('error' => "Server error. Upload directory isn't writable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->file){
|
if (!$this->file){
|
||||||
return array('error' => 'No files were uploaded.');
|
return array('error' => 'No files were uploaded.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$size = $this->file->getSize();
|
$size = $this->file->getSize();
|
||||||
|
|
||||||
if ($size == 0) {
|
if ($size == 0) {
|
||||||
return array('error' => 'File is empty');
|
return array('error' => 'File is empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($size > $this->sizeLimit) {
|
if ($size > $this->sizeLimit) {
|
||||||
return array('error' => 'File is too large');
|
return array('error' => 'File is too large');
|
||||||
}
|
}
|
||||||
|
|
||||||
$pathinfo = pathinfo($this->file->getName());
|
$pathinfo = pathinfo($this->file->getName());
|
||||||
$filename = $pathinfo['filename'];
|
$filename = $pathinfo['filename'];
|
||||||
//$filename = md5(uniqid());
|
//$filename = md5(uniqid());
|
||||||
@@ -133,7 +133,7 @@ class qqFileUploader {
|
|||||||
$these = implode(', ', $this->allowedExtensions);
|
$these = implode(', ', $this->allowedExtensions);
|
||||||
return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
|
return array('error' => 'File has an invalid extension, it should be one of '. $these . '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$replaceOldFile){
|
if(!$replaceOldFile){
|
||||||
/// don't overwrite previous files that were uploaded
|
/// don't overwrite previous files that were uploaded
|
||||||
while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
|
while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
|
||||||
@@ -141,17 +141,17 @@ class qqFileUploader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->uploadFileName = $uploadDirectory . $filename . '.' . $ext;
|
$this->uploadFileName = $uploadDirectory . $filename . '.' . $ext;
|
||||||
$this->uploadFileExt = $ext;
|
$this->uploadFileExt = $ext;
|
||||||
|
|
||||||
if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){
|
if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){
|
||||||
return array('success'=>true);
|
return array('success'=>true);
|
||||||
} else {
|
} else {
|
||||||
return array('error'=> 'Could not save uploaded file.' .
|
return array('error'=> 'Could not save uploaded file.' .
|
||||||
'The upload was cancelled, or server error encountered');
|
'The upload was cancelled, or server error encountered');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* 2004/09/30 (cs) layout cleanup
|
* 2004/09/30 (cs) layout cleanup
|
||||||
* /
|
* /
|
||||||
|
|
||||||
/* collection of PostgreSQL wrappers
|
* collection of PostgreSQL wrappers
|
||||||
* REQUIRES 5.x PHP!!!
|
* REQUIRES 5.x PHP!!!
|
||||||
*
|
*
|
||||||
* pg_prepare
|
* pg_prepare
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* HISTORY:
|
* HISTORY:
|
||||||
* /
|
* /
|
||||||
|
|
||||||
/* collection of PostgreSQL wrappers
|
/* collection of PostgreSQL wrappers
|
||||||
* REQUIRES 5.x PHP with compiled pdo pgsql (--with-pdo-pgsql)
|
* REQUIRES 5.x PHP with compiled pdo pgsql (--with-pdo-pgsql)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user