* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
// Is the entry there?
if (SQL_HASZERONUMS($result)) {
// Ok, let's create the admin login
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`, `password`, `email`) VALUES ('%s', '%s', '%s')",
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins` (`login`,`password`,`email`) VALUES ('%s', '%s', '%s')",
array(
$adminLogin,
$passHash,
function ifAdminLoginDataIsValid ($adminLogin, $adminPassword) {
// First of all, no admin login is found, so the admin hash is null
$ret = '404';
- $adminHash = null;
+ $adminHash = NULL;
// Get admin id from login
$adminId = getAdminId($adminLogin);
// Checks wether current admin is allowed to access given action/what combination
// (only one is allowed to be null!)
-function isAdminAllowedAccessMenu ($action, $what = null) {
+function isAdminAllowedAccessMenu ($action, $what = NULL) {
// Do we have cache?
if (!isset($GLOBALS[__FUNCTION__][$action][$what])) {
// ACL is always 'allow' when no ext-admins is installed
// Build main menu
$result_main = SQL_QUERY("SELECT
- `action`, `title`, `descr`
+ `action`,`title`,`descr`
FROM
`{?_MYSQL_PREFIX?}_admin_menu`
WHERE
// Check for menu entries
$result_what = SQL_QUERY_ESC("SELECT
- `what`, `title`, `descr`
+ `what`,`title`,`descr`
FROM
`{?_MYSQL_PREFIX?}_admin_menu`
WHERE
// Free memory
SQL_FREERESULT($result_main);
$OUT .= '</ul>';
- }
+ } // END - if
// Is there a cache instance again?
// Return or output content?
}
}
-// Create member selection box
-function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $none = false, $field = 'userid') {
+// Create an admin selection box form
+function addAdminSelectionBox ($adminId = NULL, $special = '') {
+ // Default is email as "special column"
+ $ADD = ',`email` AS `special`';
+
+ // Is a special column given?
+ if (!empty($special)) {
+ // Additional column for SQL query
+ $ADD = ',`' . $special . '` AS `special`';
+ } // END - if
+
+ // Query all entries
+ $result = SQL_QUERY('SELECT
+ `id`,`login`' . $ADD . '
+FROM
+ `{?_MYSQL_PREFIX?}_admins`
+ORDER BY
+ `login` ASC', __FUNCTION__, __LINE__);
+
+ // Init output
+ $OUT = '';
+
+ // Load all entries
+ while ($content = SQL_FETCHARRAY($result)) {
+ // Add the entry
+ $OUT .= loadTemplate('select_admins_option', true, $content);
+ } // END - if
+
+ // Free memory
+ SQL_FREERESULT($result);
+
+ // Add form to content
+ $content['form_selection'] = $OUT;
+
+ // Output form
+ loadTemplate('select_admins_box', false, $content);
+}
+
+// Create a member selection box
+function addMemberSelectionBox ($userid = NULL, $add_all = false, $return = false, $none = false, $field = 'userid') {
// Output selection form with all confirmed user accounts listed
- $result = SQL_QUERY("SELECT `userid`, `surname`, `family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
+ $result = SQL_QUERY('SELECT
+ `userid`,`surname`,`family`
+FROM
+ `{?_MYSQL_PREFIX?}_user_data`
+ORDER BY
+ `userid` ASC', __FUNCTION__, __LINE__);
// Default output
$OUT = '';
// USe this only for adding points (e.g. adding refs really makes no sence ;-) )
- if ($add_all === true) $OUT = ' <option value="all">{--ALL_MEMBERS--}</option>';
- elseif ($none === true) $OUT = ' <option value="0">{--SELECT_NONE--}</option>';
+ if ($add_all === true) {
+ $OUT = ' <option value="all">{--ALL_MEMBERS--}</option>';
+ } elseif ($none === true) {
+ $OUT = ' <option value="0">{--SELECT_NONE--}</option>';
+ }
+ // Load all entries
while ($content = SQL_FETCHARRAY($result)) {
$OUT .= '<option value="' . bigintval($content['userid']) . '"';
- if ($def == $content['userid']) $OUT .= ' selected="selected"';
+ if ($userid == $content['userid']) $OUT .= ' selected="selected"';
$OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
} // END - while
if ($return === false) {
// Remeber options in constant
$content['form_selection'] = $OUT;
- $content['what'] = getWhat();
+ $content['what'] = '{%pipe,getWhat%}';
// Load template
loadTemplate('admin_form_selection_box', false, $content);
$what = "`what` != '' AND `what` IS NOT NULL";
if ($mode == 'action') $what = "(`what`='' OR `what` IS NULL) AND `action` != 'login'";
- $result = SQL_QUERY_ESC("SELECT `%s` AS `menu`, `title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC",
+ $result = SQL_QUERY_ESC("SELECT `%s` AS `menu`,`title` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE ".$what." ORDER BY `sort` ASC",
array($mode), __FUNCTION__, __LINE__);
if (!SQL_HASZERONUMS($result)) {
// Load menu as selection
} // END - foreach
// Add both in one line
- $keys = implode('`, `', $keys);
+ $keys = implode('`,`', $keys);
$values = implode(', ', $values);
// Generate SQL string
// Walk through all files
foreach ($menuArray as $file) {
// Is this a PHP script?
- if ((!isDirectory($file)) && (strpos($file, '' . $type . '-') > -1) && (strpos($file, '.php') > 0)) {
+ if ((!isDirectory($file)) && (isInString('' . $type . '-', $file)) && (isInString('.php', $file))) {
// Then test if the file is readable
$test = sprintf("inc/modules/%s/%s", $menu, $file);
}
// Send mails for del/edit/lock build modes
-function sendAdminBuildMails ($mode, $table, $content, $id, $subjectPart = '', $userIdColumn = 'userid') {
+function sendAdminBuildMails ($mode, $tableName, $content, $id, $subjectPart = '', $userIdColumn = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // $tableName is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName[]=' . gettype($tableName) . '!=array');
+ } elseif ((!is_array($userIdColumn)) || (count($userIdColumn) != 1)) {
+ // $tableName is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array');
+ } // END - if
+
// Default subject is the subject part
$subject = $subjectPart;
} // END - if
// Is the raw userid set?
- if (postRequestParameter($userIdColumn, $id) > 0) {
+ if (postRequestElement($userIdColumn[0], $id) > 0) {
// Load email template
if (!empty($subjectPart)) {
- $mail = loadEmailTemplate('member_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content);
+ $mail = loadEmailTemplate('member_' . $mode . '_' . strtolower($subjectPart) . '_' . $tableName[0], $content);
} else {
- $mail = loadEmailTemplate('member_' . $mode . '_' . $table, $content);
+ $mail = loadEmailTemplate('member_' . $mode . '_' . $tableName[0], $content);
}
// Send email out
- sendEmail(postRequestParameter($userIdColumn, $id), strtoupper('{--MEMBER_' . $subject . '_' . $table . '_SUBJECT--}'), $mail);
+ sendEmail(postRequestElement($userIdColumn[0], $id), strtoupper('{--MEMBER_' . $subject . '_' . $tableName[0] . '_SUBJECT--}'), $mail);
} // END - if
// Generate subject
- $subject = strtoupper('{--ADMIN_' . $subject . '_' . $table . '_SUBJECT--}');
+ $subject = strtoupper('{--ADMIN_' . $subject . '_' . $tableName[0] . '_SUBJECT--}');
// Send admin notification out
if (!empty($subjectPart)) {
- sendAdminNotification($subject, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userIdColumn, $id));
+ sendAdminNotification($subject, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $tableName[0], $content, postRequestElement($userIdColumn[0], $id));
} else {
- sendAdminNotification($subject, 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userIdColumn, $id));
+ sendAdminNotification($subject, 'admin_' . $mode . '_' . $tableName[0], $content, postRequestElement($userIdColumn[0], $id));
}
}
// Build a special template list
-function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $userid = 'userid') {
- // $table and $idColumn must bove be arrays!
- if (!is_array($table)) {
- // $table is no array
- debug_report_bug(__FUNCTION__, __LINE__, 'table[]=' . gettype($table) . '!=array');
+function adminListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid')) {
+ // $tableName and $idColumn must bove be arrays!
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // $tableName is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName[]=' . gettype($tableName) . '!=array');
} elseif (!is_array($idColumn)) {
// $idColumn is no array
debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif ((!is_array($userIdColumn)) || (count($userIdColumn) != 1)) {
+ // $tableName is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array');
}
+ // Init row output
$OUT = '';
// "Walk" through all entries
- foreach ($IDs as $id => $selected) {
+ //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'listType=<pre>'.print_r($listType,true).'</pre>,tableName<pre>'.print_r($tableName,true).'</pre>,columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,idColumn=<pre>'.print_r($idColumn,true).'</pre>,userIdColumn=<pre>'.print_r($userIdColumn,true).'</pre>,rawUserId=<pre>'.print_r($rawUserId,true).'</pre>');
+ foreach (postRequestElement($idColumn[0]) as $id => $selected) {
// Secure id number
$id = bigintval($id);
// Get result from a given column array and table name
- $result = SQL_RESULT_FROM_ARRAY($table[0], $columns, $idColumn[0], $id, __FUNCTION__, __LINE__);
+ $result = SQL_RESULT_FROM_ARRAY($tableName[0], $columns, $idColumn[0], $id, __FUNCTION__, __LINE__);
// Is there one entry?
if (SQL_NUMROWS($result) == 1) {
// Filter all data
foreach ($content as $key => $value) {
// Search index
- $idx = array_search($key, $columns, true);
+ $idx = searchXmlArray($key, $columns, 'column');
+
+ // Skip any missing entries
+ if ($idx === false) {
+ // Skip this one
+ //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'key=' . $key . ' - SKIPPED!');
+ continue;
+ } // END - if
// Do we have a userid?
- if ($key == $userIdColumn) {
+ //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
+ if ($key == $userIdColumn[0]) {
// Add it again as raw id
- $content[$userIdColumn] = bigintval($value);
- $content[$userIdColumn . '_raw'] = $content[$userIdColumn];
+ //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'key=' . $key . ',userIdColumn=' . $userIdColumn[0]);
+ $content[$userIdColumn[0]] = makeZeroToNull($value);
+ $content[$userIdColumn[0] . '_raw'] = $content[$userIdColumn[0]];
} // END - if
// If the key matches the idColumn variable, we need to temporary remember it
- //* DEBUG: */ debugOutput('key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value);
- if ($key == $idColumn) {
+ //* DEBUG: */ debugOutput('key=' . $key . ',idColumn=' . $idColumn[0] . ',value=' . $value);
+ if ($key == $idColumn[0]) {
// Found, so remember it
$GLOBALS['admin_list_builder_id_value'] = $value;
} // END - if
- // Handle the call in external function
- //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value);
- $content[$key] = handleExtraValues(
- $filterFunctions[$idx],
- $value,
- $extraValues[$idx]
- );
+ // Do we have a call-back function and extra-value pair?
+ if ((isset($filterFunctions[$idx])) && (isset($extraValues[$idx]))) {
+ // Handle the call in external function
+ //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value);
+ $content[$key] = handleExtraValues(
+ $filterFunctions[$idx],
+ $value,
+ $extraValues[$idx]
+ );
+ } elseif ((isset($columns[$idx]['name'])) && (isset($filterFunctions[$columns[$idx]['name']])) && (isset($extraValues[$columns[$idx]['name']]))) {
+ // Handle the call in external function
+ //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$columns[$idx]['name']] . ',value=' . $value);
+ $content[$key] = handleExtraValues(
+ $filterFunctions[$columns[$idx]['name']],
+ $value,
+ $extraValues[$columns[$idx]['name']]
+ );
+ }
} // END - foreach
// Then list it
$OUT .= loadTemplate(sprintf("admin_%s_%s_row",
$listType,
- $table[0]
+ $tableName[0]
), true, $content
);
} // END - if
// Load master template
loadTemplate(sprintf("admin_%s_%s",
$listType,
- $table[0]
+ $tableName[0]
), false, $OUT
);
}
// Change status of "build" list
-function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray, $userid = 'userid') {
+function adminBuilderStatusHandler ($mode, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray, $rawUserId = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif ((!is_array($userIdColumn)) || (count($userIdColumn) != 1)) {
+ // $tableName is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array');
+ } // END - if
+
// All valid entries? (We hope so here!)
- if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (count($statusArray) > 0)) {
+ if ((count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (count($statusArray) > 0)) {
// "Walk" through all entries
- foreach ($IDs as $id => $sel) {
+ foreach (postRequestElement($idColumn[0]) as $id => $sel) {
// Construct SQL query
- $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET", SQL_ESCAPE($table));
+ $sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET", SQL_ESCAPE($tableName[0]));
// Load data of entry
$result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1",
- array($table, $idColumn, $id), __FUNCTION__, __LINE__);
+ array(
+ $tableName[0],
+ $idColumn[0],
+ $id
+ ), __FUNCTION__, __LINE__);
// Fetch the data
$content = SQL_FETCHARRAY($result);
logDebugMessage(__FUNCTION__, __LINE__, 'Found entry: ' . $key);
// Skip id, raw userid and 'do_$mode'
- if (!in_array($key, array($idColumn, $userid, ('do_' . $mode)))) {
+ if (!in_array($key, array($idColumn[0], $rawUserId[0], ('do_' . $mode)))) {
// Are there brackets () at the end?
if (substr($entries[$id], -2, 2) == '()') {
// Direct SQL command found
// Finish SQL statement
$sql = substr($sql, 0, -1) . sprintf(" WHERE `%s`=%s AND `%s`='%s' LIMIT 1",
- $idColumn,
+ $idColumn[0],
bigintval($id),
$statusColumn,
$oldStatus
} // END - if
// Send "build mails" out
- sendAdminBuildMails($mode, $table, $content, $id, $statusInfo[$content[$column]], $userIdColumn);
+ sendAdminBuildMails($mode, $tableName, $content, $id, $statusInfo[$content[$column]], $userIdColumn);
} // END - foreach
} // END - if
}
// Delete rows by given id numbers
-function adminDeleteEntriesConfirm ($IDs, $table, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = false, $idColumn = 'id', $userIdColumn = 'userid', $userid = 'userid') {
+function adminDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = array(false), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif (!is_array($userIdColumn)) {
+ // $userIdColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array');
+ } elseif (!is_array($deleteNow)) {
+ // $deleteNow is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'deleteNow[]=' . gettype($deleteNow) . '!=array');
+ } // END - if
+
// All valid entries? (We hope so here!)
- if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) {
+ if ((count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) {
// Shall we delete here or list for deletion?
- if ($deleteNow === true) {
+ if ($deleteNow[0] === true) {
// The base SQL command:
$sql = "DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s` IN (%s)";
// Delete them all
$idList = '';
- foreach ($IDs as $id => $sel) {
+ foreach (postRequestElement($idColumn[0]) as $id => $sel) {
// Is there a userid?
- if (isPostRequestParameterSet($userid, $id)) {
+ if (isPostRequestElementSet($rawUserId[0], $id)) {
// Load all data from that id
$result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1",
array(
- $table,
- $idColumn,
+ $tableName[0],
+ $idColumn[0],
$id
), __FUNCTION__, __LINE__);
SQL_FREERESULT($result);
// Send "build mails" out
- sendAdminBuildMails('delete', $table, $content, $id, '', $userIdColumn);
+ sendAdminBuildMails('delete', $tableName, $content, $id, '', $userIdColumn);
} // END - if
// Add id number
} // END - foreach
// Run the query
- SQL_QUERY_ESC($sql, array($table, $idColumn, substr($idList, 0, -1)), __FUNCTION__, __LINE__);
+ SQL_QUERY_ESC($sql, array($tableName[0], $idColumn[0], substr($idList, 0, -1)), __FUNCTION__, __LINE__);
// Was this fine?
- if (SQL_AFFECTEDROWS() == count($IDs)) {
+ if (SQL_AFFECTEDROWS() == count(postRequestElement($idColumn[0]))) {
// All deleted
displayMessage('{--ADMIN_ALL_ENTRIES_REMOVED--}');
} else {
// Some are still there :(
- displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs)));
+ displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count(postRequestElement($idColumn[0]))));
}
} else {
// List for deletion confirmation
- adminListBuilder('delete', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ adminListBuilder('delete', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} // END - if
}
// Edit rows by given id numbers
-function adminEditEntriesConfirm ($IDs, $table, $columns = array(), $filterFunctions = array(), $extraValues = array(), $editNow = false, $idColumn = 'id', $userIdColumn = 'userid', $userid = 'userid') {
+function adminEditEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $editNow = array(false), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif (!is_array($userIdColumn)) {
+ // $userIdColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'userIdColumn[]=' . gettype($userIdColumn) . '!=array');
+ } elseif (!is_array($editNow)) {
+ // $editNow is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'editNow[]=' . gettype($editNow) . '!=array');
+ } // END - if
+
// All valid entries? (We hope so here!)
- if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) {
+ //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn=<pre>'.print_r($idColumn,true).'</pre>,tableName<pre>'.print_r($tableName,true).'</pre>,columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,editNow=<pre>'.print_r($editNow,true).'</pre>,userIdColumn=<pre>'.print_r($userIdColumn,true).'</pre>,rawUserId=<pre>'.print_r($rawUserId,true).'</pre>');
+ //if ((count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues))) {
+ if (true) {
// Shall we change here or list for editing?
- if ($editNow === true) {
+ if ($editNow[0] === true) {
// Change them all
$affected = '0';
- foreach ($IDs as $id => $sel) {
+ foreach (postRequestElement($idColumn[0]) as $id => $sel) {
// Prepare content array (new values)
$content = array();
// Prepare SQL for this row
$sql = sprintf("UPDATE `{?_MYSQL_PREFIX?}_%s` SET",
- SQL_ESCAPE($table)
+ SQL_ESCAPE($tableName[0])
);
foreach (postRequestArray() as $key => $entries) {
// Skip raw userid which is always invalid
- if ($key == $userid) {
+ if ($key == $rawUserId[0]) {
// Continue with next field
continue;
} // END - if
// Is entries an array?
- if (($key != $idColumn) && (is_array($entries)) && (isset($entries[$id]))) {
+ if (($key != $idColumn[0]) && (is_array($entries)) && (isset($entries[$id]))) {
// Add this entry to content
$content[$key] = $entries[$id];
SQL_ESCAPE($key),
SQL_ESCAPE($entries[$id])
);
- } elseif (($key != $idColumn) && (!is_array($entries))) {
+ } elseif (($key != $idColumn[0]) && (!is_array($entries))) {
// Add normal entries as well!
$content[$key] = $entries;
}
} // END - foreach
// Finish SQL command
- $sql = substr($sql, 0, -1) . " WHERE `" . $idColumn . "`=" . bigintval($id) . " LIMIT 1";
+ $sql = substr($sql, 0, -1) . " WHERE `" . $idColumn[0] . "`=" . bigintval($id) . " LIMIT 1";
// Run this query
SQL_QUERY($sql, __FUNCTION__, __LINE__);
// Load all data from that id
$result = SQL_QUERY_ESC("SELECT * FROM `{?_MYSQL_PREFIX?}_%s` WHERE `%s`=%s LIMIT 1",
- array($table, $idColumn, $id), __FUNCTION__, __LINE__);
+ array(
+ $tableName[0],
+ $idColumn[0],
+ $id
+ ), __FUNCTION__, __LINE__);
// Fetch the data and merge it into $content
$content = merge_array($content, SQL_FETCHARRAY($result));
SQL_FREERESULT($result);
// Send "build mails" out
- sendAdminBuildMails('edit', $table, $content, $id, '', $userIdColumn);
+ sendAdminBuildMails('edit', $tableName, $content, $id, '', $userIdColumn);
} // END - foreach
// Was this fine?
- if ($affected == count($IDs)) {
+ if ($affected == count(postRequestElement($idColumn[0]))) {
// All deleted
displayMessage('{--ADMIN_ALL_ENTRIES_EDITED--}');
} else {
// Some are still there :(
- displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs)));
+ displayMessage(sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count(postRequestElement($idColumn[0]))));
}
} else {
// List for editing
- adminListBuilder('edit', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ adminListBuilder('edit', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} else {
// Maybe some invalid parameters
- debug_report_bug(__FUNCTION__, __LINE__, 'IDs[]=' . gettype($IDs) . ',table=' . $table . ',columns[]=' . gettype($columns) . ',filterFunctions[]=' . gettype($filterFunctions) . ',extraValues[]=' . gettype($extraValues) . ',idColumn=' . $idColumn . ',userIdColumn=' . $userIdColumn . ' - INVALID!');
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName=' . $tableName[0] . ',columns[]=' . gettype($columns) . ',filterFunctions[]=' . gettype($filterFunctions) . ',extraValues[]=' . gettype($extraValues) . ',idColumn=' . $idColumn[0] . ',userIdColumn=' . $userIdColumn[0] . ' - INVALID!');
}
}
// Un-/lock rows by given id numbers
-function adminLockEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctions=array(), $extraValues=array(), $statusArray=array(), $lockNow=false, $idColumn='id', $userIdColumn='userid') {
+function adminLockEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $statusArray = array(), $lockNow = array(false), $idColumn = array('id'), $userIdColumn = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif (!is_array($lockNow)) {
+ // $lockNow is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'lockNow[]=' . gettype($lockNow) . '!=array');
+ } // END - if
+
// All valid entries? (We hope so here!)
- if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (($lockNow === false) || (count($statusArray) == 1))) {
+ if ((count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (($lockNow[0] === false) || (count($statusArray) == 1))) {
// Shall we un-/lock here or list for locking?
- if ($lockNow === true) {
+ if ($lockNow[0] === true) {
// Un-/lock entries
- adminBuilderStatusHandler('lock', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray);
+ adminBuilderStatusHandler('lock', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray);
} else {
// List for editing
- adminListBuilder('lock', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ adminListBuilder('lock', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} // END - if
}
// Undelete rows by given id numbers
-function adminUndeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFunctions=array(), $extraValues=array(), $statusArray=array(), $undeleteNow=false, $idColumn='id', $userIdColumn='userid') {
+function adminUndeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $statusArray = array(), $undeleteNow = array(false), $idColumn = array('id'), $userIdColumn = array('userid')) {
+ // $tableName must be an array
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (!is_array($idColumn)) {
+ // $idColumn is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'idColumn[]=' . gettype($idColumn) . '!=array');
+ } elseif (!is_array($undeleteNow)) {
+ // $undeleteNow is no array
+ debug_report_bug(__FUNCTION__, __LINE__, 'undeleteNow[]=' . gettype($undeleteNow) . '!=array');
+ } // END - if
+
// All valid entries? (We hope so here!)
- if ((is_array($IDs)) && (count($IDs) > 0) && (count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (($undeleteNow === false) || (count($statusArray) == 1))) {
+ if ((count($columns) == count($filterFunctions)) && (count($columns) == count($extraValues)) && (($undeleteNow[0] === false) || (count($statusArray) == 1))) {
// Shall we un-/lock here or list for locking?
- if ($undeleteNow === true) {
+ if ($undeleteNow[0] === true) {
// Undelete entries
- adminBuilderStatusHandler('undelete', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray);
+ adminBuilderStatusHandler('undelete', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray);
} else {
// List for editing
- adminListBuilder('undelete', $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+ adminListBuilder('undelete', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
}
} // END - if
}
+// Adds a given entry to the database
+function adminAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array()) {
+ //* DEBUG: */ die('columns=<pre>'.print_r($columns,true).'</pre>,filterFunctions=<pre>'.print_r($filterFunctions,true).'</pre>,extraValues=<pre>'.print_r($extraValues,true).'</pre>,POST=<pre>'.print_r($_POST,true).'</pre>');
+ // Verify that tableName and columns are not empty
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
+ // No tableName specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array');
+ } elseif (count($columns) == 0) {
+ // No columns specified
+ debug_report_bug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML.');
+ }
+
+ // Init columns and value elements
+ $sqlColumns = array();
+ $sqlValues = array();
+
+ // Add columns and values
+ foreach ($columns as $key=>$columnName) {
+ // Copy entry to final arrays
+ $sqlColumns[$key] = $columnName;
+ $sqlValues[$key] = postRequestElement($columnName);
+ //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'key='.$key.',columnName='.$columnName.',filterFunctions='.$filterFunctions[$key].',extraValues='.intval(isset($extraValues[$key])).',extraValuesName='.intval(isset($extraValues[$columnName . '_list'])).'<br />');
+
+ // Send data through the filter function if found
+ if ((isset($filterFunctions[$key])) && (isset($extraValues[$key . '_list']))) {
+ // Filter function set!
+ $sqlValues[$key] = call_user_func_array($filterFunctions[$key], merge_array(array($columnName), $extraValues[$key . '_list']));
+ } // END - if
+ } // END - foreach
+
+ // Build the SQL query
+ $SQL = 'INSERT INTO `{?_MYSQL_PREFIX?}_' . $tableName[0] . '` (`' . implode('`, `', $sqlColumns) . "`) VALUES ('" . implode("','", $sqlValues) . "')";
+
+ // Run the SQL query
+ SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+
+ // Entry has been added?
+ if (!SQL_HASZEROAFFECTED()) {
+ // Display success message
+ displayMessage('{--ADMIN_ENTRY_ADDED--}');
+ } else {
+ // Display failed message
+ displayMessage('{--ADMIN_ENTRY_NOT_ADDED--}');
+ }
+}
+
// List all given rows (callback function from XML)
function adminListEntries ($tableTemplate, $rowTemplate, $noEntryMessageId, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters = array()) {
// Verify that tableName and columns are not empty
- if (count($tableName) != 1) {
+ if ((!is_array($tableName)) || (count($tableName) != 1)) {
// No tableName specified
- debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML. tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate);
+ debug_report_bug(__FUNCTION__, __LINE__, 'tableName is not given. Please fix your XML,tableName[]=' . gettype($tableName) . '!=array,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate);
} elseif (count($columns) == 0) {
// No columns specified
- debug_report_bug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML. tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]);
+ debug_report_bug(__FUNCTION__, __LINE__, 'columns is not given. Please fix your XML,tableTemplate=' . $tableTemplate . ',rowTemplate=' . $rowTemplate . ',tableName[0]=' . $tableName[0]);
}
// This is the minimum query, so at least columns and tableName must have entries
$SQL = 'SELECT ';
- foreach ($columns as $columnArray) {
- // Init SQL part
- $sqlPart = '';
- // Do we have a table/alias
- if (!empty($columnArray['table'])) {
- // Pre-add it
- $sqlPart .= $columnArray['table'] . '.';
- } // END - if
-
- // Add column
- $sqlPart .= '`' . $columnArray['column'] . '`';
- // Is a function and alias set?
- if ((!empty($columnArray['function'])) && (!empty($columnArray['alias']))) {
- // Add both
- $sqlPart = $columnArray['function'] . '(' . $sqlPart . ') AS `' . $columnArray['alias'] . '`';
- } // END - if
-
- // Add finished SQL part to the query
- $SQL .= $sqlPart . ',';
- } // END - foreach
+ // Get the sql part back from given array
+ $SQL .= getSqlPartFromXmlArray($columns);
// Remove last commata and add FROM statement
- $SQL = substr($SQL, 0, -1) . ' FROM `{?_MYSQL_PREFIX?}_' . $tableName[0] . '`';
+ $SQL .= ' FROM `{?_MYSQL_PREFIX?}_' . $tableName[0] . '`';
// Do we have entries from whereColumns to add?
if (count($whereColumns) > 0) {
} // END - if
// Now handle all over to the inner function which will execute the listing
- doAdminListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters = array());
+ doAdminListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters);
}
// Do the listing of entries
$OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
// "Translate" content
- foreach ($callbackColumns as $column=>$callbackFunction) {
+ foreach ($callbackColumns as $columnName=>$callbackFunction) {
// Fill the callback arguments
- $args = array($content[$column]);
+ $args = array($content[$columnName]);
// Do we have more to add?
- if (isset($extraParameters[$column])) {
+ if (isset($extraParameters[$columnName])) {
// Add them as well
- merge_array($args, $extraParameters[$column]);
+ $args = merge_array($args, $extraParameters[$columnName]);
} // END - if
// Call the callback-function
//* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'callbackFunction=' . $callbackFunction . ',args=<pre>'.print_r($args, true).'</pre>');
// @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
- $content[$column] = call_user_func_array($callbackFunction, $args);
+ $content[$columnName] = call_user_func_array($callbackFunction, $args);
} // END - foreach
// Load row template
loadTemplate(trim($tableTemplate[0]), false, $OUT);
} else {
// No URLs in surfbar
- displayMessage('{--' .$noEntryMessageId . '--}');
+ displayMessage('{--' .$noEntryMessageId[0] . '--}');
}
// Free result
SQL_FREERESULT($result);
}
-// Checks proxy settins by fetching check-updates3.php from www.mxchange.org
+// Checks proxy settins by fetching check-updates3.php from mxchange.org
function adminTestProxySettings ($settingsArray) {
// Set temporary the new settings
mergeConfig($settingsArray);
$content = sendGetRequest('check-updates3.php');
// Is the first line with "200 OK"?
- $valid = (strpos($content[0], '200 OK') !== false);
+ $valid = isInString('200 OK', $content[0]);
// Return result
return $valid;
$OUT = '';
// Look up administator login
- $result = SQL_QUERY_ESC("SELECT `id`, `login`, `password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `email`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id`,`login`,`password` FROM `{?_MYSQL_PREFIX?}_admins` WHERE '%s' REGEXP `email` LIMIT 1",
array($email), __FUNCTION__, __LINE__);
// Is there an account?
$valid = false;
// Then try to find that user
- $result = SQL_QUERY_ESC("SELECT `id`, `password`, `email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id`,`password`,`email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `login`='%s' LIMIT 1",
array($login), __FUNCTION__, __LINE__);
// Is an account here?
// Function to update task data
function adminUpdateTaskData ($id, $row, $data) {
- // Should be admin!
+ // Should be admin and valid id
if (!isAdmin()) {
// Not an admin so redirect better
- redirectToUrl('modules.php?module=index');
- } // END - if
-
- // Is the id not set, then we need a backtrace here... :(
- if ($id <= 0) {
+ debug_report_bug(__FUNCTION__, __LINE__, 'id=' . $id . ',row=' . $row . ',data=' . $data . ' - isAdmin()=false');
+ } elseif ($id <= 0) {
// Initiate backtrace
debug_report_bug(__FUNCTION__, __LINE__, sprintf("id is invalid: %s. row=%s, data=%s",
$id,
// Ask for them
if (isFormSent()) {
// Is the element set, then we need to change the admin
- if (isPostRequestParameterSet('expert_settings')) {
+ if (isPostRequestElementSet('expert_settings')) {
// Get it and prepare final post data array
$postData['login'][getCurrentAdminId()] = getCurrentAdminLogin();
$postData['expert_warning'][getCurrentAdminId()] = 'N';
adminsChangeAdminAccount($postData, 'expert_warning');
// Clear form
- unsetPostRequestParameter('ok');
+ unsetPostRequestElement('ok');
} // END - if
// All fine!
$NAV = '';
for ($page = 1; $page <= $numPages; $page++) {
// Is the page currently selected or shall we generate a link to it?
- if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
+ if (($page == getRequestElement('page')) || ((!isGetRequestElementSet('page')) && ($page == 1))) {
// Is currently selected, so only highlight it
$NAV .= '<strong>-';
} else {
$NAV .= '<a href="{%url=modules.php?module=admin&what=' . getWhat() . '&page=' . $page . '&offset=' . $offset;
// Add userid when we shall show all mails from a single member
- if ((isGetRequestParameterSet('userid')) && (isValidUserId(getRequestParameter('userid')))) $NAV .= '&userid=' . bigintval(getRequestParameter('userid'));
+ if ((isGetRequestElementSet('userid')) && (isValidUserId(getRequestElement('userid')))) $NAV .= '&userid=' . bigintval(getRequestElement('userid'));
// Close open anchor tag
$NAV .= '%}">';
}
$NAV .= $page;
- if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
+ if (($page == getRequestElement('page')) || ((!isGetRequestElementSet('page')) && ($page == 1))) {
// Is currently selected, so only highlight it
$NAV .= '-</strong>';
} else {
// Process menu editing form
function adminProcessMenuEditForm ($type, $subMenu) {
// An action is done...
- foreach (postRequestParameter('sel') as $sel => $menu) {
+ foreach (postRequestElement('sel') as $sel => $menu) {
$AND = "(`what` = '' OR `what` IS NULL)";
$sel = bigintval($sel);
$AND = "`action`='" . $subMenu . "'";
} // END - if
- switch (postRequestParameter('ok')) {
+ switch (postRequestElement('ok')) {
case 'edit': // Edit menu
- if (postRequestParameter('sel_what', $sel) == '') {
+ if (postRequestElement('sel_what', $sel) == '') {
// Update with 'what'=null
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `title`='%s', `action`='%s', `what`=NULL WHERE ".$AND." AND `id`=%s LIMIT 1",
array(
$type,
$menu,
- postRequestParameter('sel_action', $sel),
+ postRequestElement('sel_action', $sel),
$sel
), __FILE__, __LINE__);
} else {
array(
$type,
$menu,
- postRequestParameter('sel_action', $sel),
- postRequestParameter('sel_what', $sel),
+ postRequestElement('sel_action', $sel),
+ postRequestElement('sel_what', $sel),
$sel
), __FILE__, __LINE__);
}
case 'status': // Change status of menus
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
- array($type, postRequestParameter('visible', $sel), postRequestParameter('locked', $sel), $sel), __FILE__, __LINE__);
+ array($type, postRequestElement('visible', $sel), postRequestElement('locked', $sel), $sel), __FILE__, __LINE__);
break;
default: // Unexpected action
- logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestParameter('ok')));
- displayMessage('{%message,ADMIN_UNKNOWN_OKAY=' . postRequestParameter('ok') . '%}');
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unsupported action %s detected.", postRequestElement('ok')));
+ displayMessage('{%message,ADMIN_UNKNOWN_OKAY=' . postRequestElement('ok') . '%}');
break;
} // END - switch
} // END - foreach
// Handle weightning
function doAdminProcessMenuWeightning ($type, $AND) {
// Are there all required (generalized) GET parameter?
- if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) {
+ if ((isGetRequestElementSet('act')) && (isGetRequestElementSet('tid')) && (isGetRequestElementSet('fid'))) {
// Init variables
$tid = ''; $fid = '';
// Get ids
- if (isGetRequestParameterSet('w')) {
+ if (isGetRequestElementSet('w')) {
// Sub menus selected
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
array(
$type,
- getRequestParameter('act'),
- bigintval(getRequestParameter('tid'))
+ getRequestElement('act'),
+ bigintval(getRequestElement('tid'))
), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
array(
$type,
- getRequestParameter('act'),
- bigintval(getRequestParameter('fid'))
+ getRequestElement('act'),
+ bigintval(getRequestElement('fid'))
), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
array(
$type,
- bigintval(getRequestParameter('tid'))
+ bigintval(getRequestElement('tid'))
), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
$result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_%s_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
array(
$type,
- bigintval(getRequestParameter('fid'))
+ bigintval(getRequestElement('fid'))
), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
array(
$type,
- bigintval(getRequestParameter('tid')),
+ bigintval(getRequestElement('tid')),
bigintval($fid)
), __FILE__, __LINE__);
SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_%s_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
array(
$type,
- bigintval(getRequestParameter('fid')),
+ bigintval(getRequestElement('fid')),
bigintval($tid)
), __FILE__, __LINE__);
} // END - if