addMenuDescription('admin', __FILE__);
// Check if the admin has entered title and what-php file name...
-if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu'))) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) {
+if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu')) || (!isPostRequestElementSet(('descr')))) && (isFormSent())) {
unsetPostRequestElement('ok');
} // END - if
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ $result = SQL_QUERY_ESC("SELECT `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Init arrays
}
}
$OUT = " <select class=\"admin_select\" name=\"sort\" size=\"1\">
- <option value=\"0\">".IS_FIRST_MENU."</option>\n";
+ <option value=\"0\">{--IS_FIRST_MENU--}</option>\n";
foreach ($below as $key => $m) {
if (is_array($m)) {
foreach ($m as $key2 => $m2) {
loadTemplate('admin_admin_add', false, $content);
} elseif (!isDemoModeActive()) {
// Insert new menu entry
- if (isPostRequestElementSet(('menu'))) {
+ if (isPostRequestElementSet('menu')) {
// Add sub menu
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admin_menu` (`action`,`what`,`title`,`descr`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
array(
addMenuDescription('admin', __FILE__);
// Check if the admin has entered title and what-php file name...
-if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet(('menu')))) && (isFormSent())) {
+if (((!isPostRequestElementSet('title')) || (!isPostRequestElementSet('menu'))) && (isFormSent())) {
// Abort adding the menu entry
unsetPostRequestElement('ok');
} // END - if
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT
+ `action`, `title`, `sort`
+FROM
+ `{?_MYSQL_PREFIX?}_guest_menu`
+WHERE
+ (`what`='' OR `what` IS NULL)
+ORDER BY
+ `sort` ASC", __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
// @TODO Cant this be rewritten?
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT what, title, sort
-FROM `{?_MYSQL_PREFIX?}_guest_menu`
-WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
- array($value_main), __FILE__, __LINE__);
+ // Query for sub menus
+ $result = SQL_QUERY_ESC("SELECT
+ `what`, `title`, `sort`
+FROM
+ `{?_MYSQL_PREFIX?}_guest_menu`
+WHERE
+ `action`='%s' AND
+ `what` != '' AND
+ `what` IS NOT NULL
+ORDER BY `sort` ASC",
+ array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Initialize arrays
$menus[$value_main] = array();
// Read menu structure
while ($content = SQL_FETCHARRAY($result)) {
// Menu actions
- $menus[$value_main][] = $content['action'];
+ $menus[$value_main][] = $content['what'];
// Menu titles
$titles[$value_main][] = $content['title'];
}
$OUT = " <select class=\"admin_select\" name=\"sort\" size=\"1\">
- <option value=\"0\">".IS_FIRST_MENU."</option>";
+ <option value=\"0\">{--IS_FIRST_MENU--}</option>";
foreach ($below as $key => $m) {
if (is_array($m)) {
foreach ($m as $key2 => $m2) {
loadTemplate('admin_guest_add', false, $content);
} elseif (!isDemoModeActive()) {
// Insert new menu entry
- if (isPostRequestElementSet(('menu'))) {
+ if (isPostRequestElementSet('menu')) {
SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')",
- array(
- postRequestElement('menu'),
- postRequestElement('name'),
- postRequestElement('title'),
- bigintval(postRequestElement('sort')),
- postRequestElement('visible'),
- postRequestElement('active'),
- ), __FILE__, __LINE__);
+ array(
+ postRequestElement('menu'),
+ postRequestElement('name'),
+ postRequestElement('title'),
+ bigintval(postRequestElement('sort')),
+ postRequestElement('visible'),
+ postRequestElement('active'),
+ ), __FILE__, __LINE__);
} else {
- SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (action, title, sort, visible, locked) VALUES ('%s','%s','%s','%s','%s')",
- array(
- postRequestElement('name'),
- postRequestElement('title'),
- bigintval(postRequestElement('sort')),
- postRequestElement('visible'),
- postRequestElement('active'),
- ), __FILE__, __LINE__);
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_guest_menu` (`action`, `title`, `sort`, `visible`, `locked`) VALUES ('%s','%s','%s','%s','%s')",
+ array(
+ postRequestElement('name'),
+ postRequestElement('title'),
+ bigintval(postRequestElement('sort')),
+ postRequestElement('visible'),
+ postRequestElement('active'),
+ ), __FILE__, __LINE__);
}
loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
} else {
loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
}
-//
+// [EOF]
?>