Fixes for the E_NOTICE fix update
- reference save was not 100% correct with isset/empty checks - more missing fixes in admin_*inc files for non edit_* pages - non edit page menu build fix - fix non set smart core vars - add update SQL for fixing missing cuid in edit_* tables
This commit is contained in:
@@ -541,12 +541,13 @@ class Login extends \CoreLibs\DB\IO
|
||||
} // user has permission to THIS page
|
||||
} // user was not enabled or other login error
|
||||
if ($this->login_error) {
|
||||
$login_error_date_first = '';
|
||||
if ($res['login_error_count'] == 0) {
|
||||
$login_error_date_first = ', login_error_date_first = NOW()';
|
||||
$login_error_date_first = ", login_error_date_first = NOW()";
|
||||
}
|
||||
// update login error count for this user
|
||||
$q = "UPDATE edit_user ";
|
||||
$q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() $login_error_date_first ";
|
||||
$q .= "SET login_error_count = login_error_count + 1, login_error_date_last = NOW() ".$login_error_date_first." ";
|
||||
$q .= "WHERE edit_user_id = ".$res['edit_user_id'];
|
||||
$this->dbExec($q);
|
||||
// totally lock the user if error max is reached
|
||||
|
||||
@@ -159,9 +159,12 @@ class Backend extends \CoreLibs\DB\IO
|
||||
}
|
||||
|
||||
// get the session pages array
|
||||
$pages = $_SESSION["PAGES"];
|
||||
if (!is_array($pages)) {
|
||||
$pages = array ();
|
||||
$PAGES = $_SESSION['PAGES'];
|
||||
if (!isset($PAGES) || !is_array($PAGES)) {
|
||||
$PAGES = array ();
|
||||
}
|
||||
foreach ($PAGES as $PAGE_CUID => $PAGE_DATA) {
|
||||
$pages[] = $PAGE_DATA;
|
||||
}
|
||||
// $this->debug('pages', $this->print_ar($pages));
|
||||
// if flag is 0, then we show all, else, we show only the matching flagges array points
|
||||
@@ -170,10 +173,10 @@ class Backend extends \CoreLibs\DB\IO
|
||||
for ($i = 0, $iMax = count($pages); $i < $iMax; $i ++) {
|
||||
$show = 0;
|
||||
// is it visible in the menu & is it online
|
||||
if ($pages[$i]["menu"] && $pages[$i]["online"]) {
|
||||
if ($pages[$i]['menu'] && $pages[$i]['online']) {
|
||||
// check if it falls into our flag if we have a flag
|
||||
if ($flag) {
|
||||
foreach ($pages[$i]["visible"] as $name => $key) {
|
||||
foreach ($pages[$i]['visible'] as $name => $key) {
|
||||
if ($key == $flag) {
|
||||
$show = 1;
|
||||
}
|
||||
@@ -185,43 +188,51 @@ class Backend extends \CoreLibs\DB\IO
|
||||
|
||||
if ($show) {
|
||||
// if it is popup, write popup arrayound
|
||||
if ($pages[$i]["popup"]) {
|
||||
$type = "popup";
|
||||
if (isset($pages[$i]['popup']) && $pages[$i]['popup']) {
|
||||
$type = 'popup';
|
||||
} else {
|
||||
$type = "normal";
|
||||
$type = 'normal';
|
||||
$pages[$i]['popup'] = 0;
|
||||
}
|
||||
$query_string = '';
|
||||
if (count($pages[$i]["query"])) {
|
||||
for ($j = 0, $jMax = count($pages[$i]["query"]); $j < $jMax; $j ++) {
|
||||
if (count($pages[$i]['query'])) {
|
||||
for ($j = 0, $jMax = count($pages[$i]['query']); $j < $jMax; $j ++) {
|
||||
if (strlen($query_string)) {
|
||||
$query_string .= "&";
|
||||
$query_string .= '&';
|
||||
}
|
||||
$query_string .= $pages[$i]["query"][$j]["name"]."=";
|
||||
if (!$pages[$i]["query"][$j]["dynamic"]) {
|
||||
$query_string .= urlencode($pages[$i]["query"][$j]["value"]);
|
||||
$query_string .= $pages[$i]['query'][$j]['name'].'=';
|
||||
if (!$pages[$i]['query'][$j]['dynamic']) {
|
||||
$query_string .= urlencode($pages[$i]['query'][$j]['value']);
|
||||
} else {
|
||||
$query_string .= $_GET[$pages[$i]["query"][$j]["value"]] ? urlencode($_GET[$pages[$i]["query"][$j]["value"]]) : urlencode($_POST[$pages[$i]["query"][$j]["value"]]);
|
||||
$query_string .= $_GET[$pages[$i]['query'][$j]['value']] ? urlencode($_GET[$pages[$i]['query'][$j]['value']]) : urlencode($_POST[$pages[$i]['query'][$j]['value']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$url = $pages[$i]["filename"];
|
||||
$url = $pages[$i]['filename'];
|
||||
if (strlen($query_string)) {
|
||||
$url .= "?".$query_string;
|
||||
$url .= '?'.$query_string;
|
||||
}
|
||||
$name = $pages[$i]["page_name"];
|
||||
$name = $pages[$i]['page_name'];
|
||||
// if page name matchs -> set selected flag
|
||||
$selected = 0;
|
||||
if ($this->getPageName() == $pages[$i]["filename"]) {
|
||||
if ($this->getPageName() == $pages[$i]['filename']) {
|
||||
$selected = 1;
|
||||
$this->page_name = $name;
|
||||
}
|
||||
// last check, is this menu point okay to show
|
||||
$enabled = 0;
|
||||
if ($this->adbShowMenuPoint($pages[$i]["filename"])) {
|
||||
if ($this->adbShowMenuPoint($pages[$i]['filename'])) {
|
||||
$enabled = 1;
|
||||
}
|
||||
// write in to view menu array
|
||||
array_push($this->menu, array("name" => $this->l->__($name), "url" => $url, "selected" => $selected, "enabled" => $enabled, "type" => $type));
|
||||
array_push($this->menu, array(
|
||||
'name' => $this->l->__($name),
|
||||
'url' => $url,
|
||||
'selected' => $selected,
|
||||
'enabled' => $enabled,
|
||||
'popup' => $type == 'popup' ? 1 : 0,
|
||||
'type' => $type
|
||||
));
|
||||
} // show page
|
||||
} // online and in menu
|
||||
} // for each page
|
||||
|
||||
@@ -689,7 +689,7 @@ class Basic
|
||||
$fn = str_replace('##LOGID##', $rpl_string, $fn); // log id (like a log file prefix)
|
||||
|
||||
if ($this->log_per_run) {
|
||||
if ($GLOBALS['LOG_FILE_UNIQUE_ID']) {
|
||||
if (isset($GLOBALS['LOG_FILE_UNIQUE_ID'])) {
|
||||
$this->log_file_unique_id = $GLOBALS['LOG_FILE_UNIQUE_ID'];
|
||||
}
|
||||
if (!$this->log_file_unique_id) {
|
||||
|
||||
@@ -804,7 +804,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$query .= " WHERE ".$this->table_array[$element_name]['where'];
|
||||
}
|
||||
// not self where
|
||||
if (!empty($this->table_array[$element_name]['where_not_self'])) {
|
||||
if (!empty($this->table_array[$element_name]['where_not_self']) && isset($this->table_array[$this->int_pk_name]['value']) && $this->table_array[$this->int_pk_name]['value']) {
|
||||
// check if query has where already
|
||||
if (strstr($query, 'WHERE') === false) {
|
||||
$query .= " WHERE ";
|
||||
@@ -1447,14 +1447,14 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$no_write[$i] = 1;
|
||||
}
|
||||
// $this->debug('REF ELEMENT', "[$i] [".$prfx.$el_name."]: MANDATORY: ".isset($data_array['mandatory'])." SET: ".isset($_POST[$prfx.$el_name][$i]).", EMPTY: ".empty($_POST[$prfx.$el_name][$i])." | DO ACTION ".((!isset($_POST[$prfx.$el_name][$i]) || (isset($_POST[$prfx.$el_name][$i]) && empty($_POST[$prfx.$el_name][$i]))) ? 'YES' : 'NO')." => NO WRITE: ".$no_write[$i]);
|
||||
if (isset($reference_array['enable_name']) &&
|
||||
isset($reference_array['delete']) &&
|
||||
!isset($_POST[$reference_array['enable_name']][$i])
|
||||
if (!empty($reference_array['enable_name']) &&
|
||||
isset($reference_array['delete']) && $reference_array['delete'] &&
|
||||
(!isset($_POST[$reference_array['enable_name']][$i]) || empty($_POST[$reference_array['enable_name']][$i]))
|
||||
) {
|
||||
$no_write[$i] = 1;
|
||||
}
|
||||
// $this->debug('REF ELEMENT', "[$i] [".$prfx.$el_name."]: ENABLED NAME: ".isset($reference_array['enable_name']).", DELETE: ".isset($reference_array['delete']).", NOT ENABLED FOR POS: ".(isset($reference_array['enable_name']) ? isset($_POST[$reference_array['enable_name']][$i]) : '-'));
|
||||
// $this->debug('REF ELEMENT', "[$i] [".$prfx.$el_name."]: WRITE: ".$no_write[$i]);
|
||||
$this->debug('REF ELEMENT', "[$i] [".$prfx.$el_name."]: WRITE: ".$no_write[$i]);
|
||||
// flag if data is in the text field and we are in a reference data set
|
||||
if (isset($reference_array['type']) && $reference_array['type'] == 'reference_data') {
|
||||
if ($data_array['type'] == 'text' && isset($_POST[$prfx.$el_name][$i])) {
|
||||
@@ -1472,7 +1472,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$q_begin[$i] = 'UPDATE '.$table_name.' SET ';
|
||||
$q_end[$i] = ' WHERE '.$el_name.' = '.$_POST[$prfx.$el_name][$i];
|
||||
$type[$i] = 'update';
|
||||
// $this->debug('REF ELEMENT', 'SET UPDATE');
|
||||
$this->debug('REF ELEMENT', 'SET UPDATE');
|
||||
} elseif (isset($data_array['pk_id']) &&
|
||||
!empty($data_array['pk_id']) &&
|
||||
empty($_POST[$prfx.$el_name][$i])
|
||||
@@ -1481,7 +1481,7 @@ class Generate extends \CoreLibs\DB\Extended\ArrayIO
|
||||
$q_middle[$i] = ') VALUES (';
|
||||
$q_end[$i] = ')';
|
||||
$type[$i] = 'insert';
|
||||
// $this->debug('REF ELEMENT', 'SET INSERT');
|
||||
$this->debug('REF ELEMENT', 'SET INSERT');
|
||||
}
|
||||
// $this->debug('REF ELEMENT', "[$i] [".$prfx.$el_name."] PK SET: ".isset($data_array['pk_id']).'/'.empty($data_array['pk_id']).', KEY SET: '.empty($_POST[$prfx.$el_name][$i])." -> TYPE: ".(isset($type[$i]) ? $type[$i] : '-'));
|
||||
// write all data (insert/update) because I don't know until all are processed if it is insert or update
|
||||
|
||||
Reference in New Issue
Block a user