Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9eb78f40fd | ||
|
|
f599033a38 | ||
|
|
61f1b92bad |
@@ -4,6 +4,7 @@
|
|||||||
$DEBUG_ALL = 1;
|
$DEBUG_ALL = 1;
|
||||||
$PRINT_ALL = 1;
|
$PRINT_ALL = 1;
|
||||||
$DB_DEBUG = 1;
|
$DB_DEBUG = 1;
|
||||||
|
$LOG_PER_RUN = 1;
|
||||||
|
|
||||||
define('USE_DATABASE', true);
|
define('USE_DATABASE', true);
|
||||||
require("header.inc");
|
require("header.inc");
|
||||||
|
|||||||
@@ -119,10 +119,12 @@
|
|||||||
private $log_file_name_ext = 'log'; // use this for date rotate
|
private $log_file_name_ext = 'log'; // use this for date rotate
|
||||||
public $log_max_filesize = 0; // set in kilobytes
|
public $log_max_filesize = 0; // set in kilobytes
|
||||||
private $log_print_file = 'error_msg##LEVEL####CLASS####PAGENAME####DATE##';
|
private $log_print_file = 'error_msg##LEVEL####CLASS####PAGENAME####DATE##';
|
||||||
|
private $log_file_unique_id; // a unique ID set only once for call derived from this class
|
||||||
public $log_print_file_date = 1; // if set add Y-m-d and do automatic daily rotation
|
public $log_print_file_date = 1; // if set add Y-m-d and do automatic daily rotation
|
||||||
public $log_per_level = 0; // set, it will split per level (first parameter in debug call)
|
public $log_per_level = 0; // set, it will split per level (first parameter in debug call)
|
||||||
public $log_per_class = 0; // set, will split log per class
|
public $log_per_class = 0; // set, will split log per class
|
||||||
public $log_per_page = 0; // set, will split log per called file
|
public $log_per_page = 0; // set, will split log per called file
|
||||||
|
public $log_per_run = 0; // create a new log file per run (time stamp + unique ID)
|
||||||
|
|
||||||
public $starttime; // start time if time debug is used
|
public $starttime; // start time if time debug is used
|
||||||
public $endtime; // end time if time debug is used
|
public $endtime; // end time if time debug is used
|
||||||
@@ -215,6 +217,18 @@
|
|||||||
if (isset($GLOBALS['PRINT_ALL']))
|
if (isset($GLOBALS['PRINT_ALL']))
|
||||||
$this->print_output_all = $GLOBALS['PRINT_ALL'];
|
$this->print_output_all = $GLOBALS['PRINT_ALL'];
|
||||||
|
|
||||||
|
// GLOBAL rules for log writing
|
||||||
|
if (isset($GLOBALS['LOG_PRINT_FILE_DATE']))
|
||||||
|
$this->log_print_file_date = $GLOBALS['LOG_PRINT_FILE_DATE'];
|
||||||
|
if (isset($GLOBALS['LOG_PER_LEVEL']))
|
||||||
|
$this->log_per_level = $GLOBALS['LOG_PER_LEVEL'];
|
||||||
|
if (isset($GLOBALS['LOG_PER_CLASS']))
|
||||||
|
$this->log_per_class = $GLOBALS['LOG_PER_CLASS'];
|
||||||
|
if (isset($GLOBALS['LOG_PER_PAGE']))
|
||||||
|
$this->log_per_page = $GLOBALS['LOG_PER_PAGE'];
|
||||||
|
if (isset($GLOBALS['LOG_PER_RUN']))
|
||||||
|
$this->log_per_run = $GLOBALS['LOG_PER_RUN'];
|
||||||
|
|
||||||
// set the regex for checking emails
|
// set the regex for checking emails
|
||||||
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,6}){1}$";
|
$this->email_regex = "^[A-Za-z0-9!#$%&'*+-\/=?^_`{|}~][A-Za-z0-9!#$%:\(\)&'*+-\/=?^_`{|}~\.]{0,63}@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]{1,})*\.([a-zA-Z]{2,6}){1}$";
|
||||||
// this is for error check parts in where the email regex failed
|
// this is for error check parts in where the email regex failed
|
||||||
@@ -326,7 +340,7 @@
|
|||||||
// this has to be changed, not returned here, this is the last class to close
|
// this has to be changed, not returned here, this is the last class to close
|
||||||
// return $this->error_msg;
|
// return $this->error_msg;
|
||||||
// close open file handles
|
// close open file handles
|
||||||
$this->fdebug_fp('c');
|
// $this->fdebug_fp('c');
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
@@ -598,7 +612,18 @@
|
|||||||
// init base file path
|
// init base file path
|
||||||
$fn = ROOT.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
$fn = ROOT.LOG.$this->log_print_file.'.'.$this->log_file_name_ext;
|
||||||
|
|
||||||
$rpl_string = !$this->log_print_file_date ? '' : '_'.date('Y-m-d'); // add date to file
|
if ($this->log_per_run)
|
||||||
|
{
|
||||||
|
if ($GLOBALS['LOG_FILE_UNIQUE_ID'])
|
||||||
|
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
||||||
|
if (!$this->log_file_unique_id)
|
||||||
|
$GLOBALS['LOG_FILE_UNIQUE_ID'] = $this->log_file_unique_id = date('Y-m-d_His').'_U_'.substr(hash('sha1', uniqid(mt_rand(), true)), 0, 8);
|
||||||
|
$rpl_string = '_'.$this->log_file_unique_id; // add 8 char unique string
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rpl_string = !$this->log_print_file_date ? '' : '_'.date('Y-m-d'); // add date to file
|
||||||
|
}
|
||||||
$fn = str_replace('##DATE##', $rpl_string, $fn); // create output filename
|
$fn = str_replace('##DATE##', $rpl_string, $fn); // create output filename
|
||||||
|
|
||||||
$rpl_string = !$this->log_per_level ? '' : '_'.$level; // if request to write to one file
|
$rpl_string = !$this->log_per_level ? '' : '_'.$level; // if request to write to one file
|
||||||
|
|||||||
@@ -344,6 +344,7 @@
|
|||||||
$this->error_string['30'] = 'Query call in a possible endless loop. Was called more than '.$this->MAX_QUERY_CALL.' times';
|
$this->error_string['30'] = 'Query call in a possible endless loop. Was called more than '.$this->MAX_QUERY_CALL.' times';
|
||||||
$this->error_string['31'] = 'Could not fetch PK after query insert';
|
$this->error_string['31'] = 'Could not fetch PK after query insert';
|
||||||
$this->error_string['32'] = 'Multiple PK return as array';
|
$this->error_string['32'] = 'Multiple PK return as array';
|
||||||
|
$this->error_string['33'] = 'returning PK was not found';
|
||||||
$this->error_string['40'] = 'Query async call failed.';
|
$this->error_string['40'] = 'Query async call failed.';
|
||||||
$this->error_string['41'] = 'Connection is busy with a different query. Cannot execute.';
|
$this->error_string['41'] = 'Connection is busy with a different query. Cannot execute.';
|
||||||
$this->error_string['42'] = 'Cannot check for async query, none has been started yet.';
|
$this->error_string['42'] = 'Cannot check for async query, none has been started yet.';
|
||||||
@@ -779,6 +780,13 @@
|
|||||||
$this->insert_id = $this->insert_id[0][$this->pk_name];
|
$this->insert_id = $this->insert_id[0][$this->pk_name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif (count($this->insert_id) == 0)
|
||||||
|
{
|
||||||
|
// failed to get insert id
|
||||||
|
$this->insert_id = '';
|
||||||
|
$this->warning_id = 33;
|
||||||
|
$this->_db_error($this->cursor, '[db_exec]');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// this warning handling is only for pgsql
|
// this warning handling is only for pgsql
|
||||||
// we returned an array of PKs instread of a single one
|
// we returned an array of PKs instread of a single one
|
||||||
|
|||||||
@@ -90,6 +90,9 @@
|
|||||||
// DESC : cunstroctuor, does ALL, opens db, works through connection checks, closes itself
|
// DESC : cunstroctuor, does ALL, opens db, works through connection checks, closes itself
|
||||||
public function __construct($db_config, $lang = 'en_utf8', $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
|
public function __construct($db_config, $lang = 'en_utf8', $debug = 0, $db_debug = 0, $echo = 1, $print = 0)
|
||||||
{
|
{
|
||||||
|
// log login data for this class only
|
||||||
|
$this->log_per_class = 1;
|
||||||
|
|
||||||
// create db connection and init base class
|
// create db connection and init base class
|
||||||
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
|
parent::__construct($db_config, $debug, $db_debug, $echo, $print);
|
||||||
|
|
||||||
@@ -100,9 +103,6 @@
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// log login data for this class only
|
|
||||||
$this->log_per_class = 1;
|
|
||||||
|
|
||||||
// get the language sub class & init it
|
// get the language sub class & init it
|
||||||
_spl_autoload('Class.l10n.inc');
|
_spl_autoload('Class.l10n.inc');
|
||||||
$this->l = new l10n($lang);
|
$this->l = new l10n($lang);
|
||||||
@@ -1015,7 +1015,7 @@ EOM;
|
|||||||
}
|
}
|
||||||
$q .= "'".session_id()."', ";
|
$q .= "'".session_id()."', ";
|
||||||
$q .= "'".$this->db_escape_string($this->action)."', '".$this->db_escape_string($this->username)."', NULL, '".$this->db_escape_string($this->login_error)."', NULL, NULL, '".$this->db_escape_string($this->permission_okay)."', NULL)";
|
$q .= "'".$this->db_escape_string($this->action)."', '".$this->db_escape_string($this->username)."', NULL, '".$this->db_escape_string($this->login_error)."', NULL, NULL, '".$this->db_escape_string($this->permission_okay)."', NULL)";
|
||||||
$this->db_exec($q);
|
$this->db_exec($q, 'NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
// METHOD: login_check_edit_access_id
|
// METHOD: login_check_edit_access_id
|
||||||
|
|||||||
Reference in New Issue
Block a user