// Check if the admin has entered title and what-php file name...
if ((!REQUEST_ISSET_POST(('title'))) && (IS_FORM_SENT())) {
REQUEST_UNSET_POST('ok');
-}
+} // END - if
if (!IS_FORM_SENT()) {
// Create arrays
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`",
+ __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Read menu structure
- while (list($act, $title, $sort) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Menu actions
- $menus[] = $act;
+ $menus[] = $content['action'];
// Menu titles
- $titles[] = $title;
+ $titles[] = $content['title'];
// Below this menu point should the new be added so we simply increase the sort value by 1 :-)
- $below[] = $sort + 1;
+ $below[] = $content['sort'] + 1;
}
// Free memory
SQL_FREERESULT($result);
// Remove double eintries
+ // @TODO This can be somehow rewritten to a function
$prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
foreach ($menus as $key => $value) {
if ($value == $prev) {
} else {
$prev = $value;
}
- }
+ } // END - foreach
// Prepare variables
$menus = $dmy; $titles = $dmy2; $below = $dmy3;
$below[$value_main] = array();
// Read menu structure
- while (list($act, $title, $sort) = SQL_FETCHROW($result)) {
+ while ($content = SQL_FETCHARRAY($result)) {
// Menu actions
- $menus[$value_main][] = $act;
+ $menus[$value_main][] = $content['action'];
// Menu titles
- $titles[$value_main][] = $title;
+ $titles[$value_main][] = $content['title'];
// Below this menu point should the new be added so we simply increase the sort value by 1 :-)
- $below[$value_main][] = $sort + 1;
- }
+ $below[$value_main][] = $content['sort'] + 1;
+ } // END - while
// Free memory
SQL_FREERESULT($result);
// Remove double eintries
+ // @TODO This can be somehow rewritten to a function
$prev = ""; $dmy = $menus[$value_main]; $dmy2 = $titles[$value_main]; $dmy3 = $below[$value_main];
foreach ($menus[$value_main] as $key => $value) {
if ($value == $prev) {
} else {
$prev = $value;
}
- }
- $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3;
- }
- }
- }
+ } // END - foreach
+
+ // Transfer variables into array
+ $menus[$value_main] = $dmy;
+ $titles[$value_main] = $dmy2;
+ $below[$value_main] = $dmy3;
+ } // END - if
+ } // END - foreach
+ } // END - if
$OUT = "<select class=\"admin_select\" name=\"sort\" size=\"1\">
- <option value=\"\">".IS_FIRST_MENU."</option>";
+ <option value=\"\">{--IS_FIRST_MENU--}</option>\n";
foreach ($below as $key => $m) {
if (is_array($m)) {
foreach ($m as $key2 => $m2) {
LOAD_TEMPLATE("admin_member_add");
} elseif (!IS_DEMO()) {
// Insert new menu entry
- if (REQUEST_ISSET_POST(('menu')))
- {
+ if (REQUEST_ISSET_POST(('menu'))) {
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s','%s')",
- array(
- REQUEST_POST('menu'),
- REQUEST_POST('name'),
- REQUEST_POST('title'),
- REQUEST_POST('visible'),
- REQUEST_POST('active'),
- bigintval(REQUEST_POST('sort')),
-), __FILE__, __LINE__);
+ array(
+ REQUEST_POST('menu'),
+ REQUEST_POST('name'),
+ REQUEST_POST('title'),
+ REQUEST_POST('visible'),
+ REQUEST_POST('active'),
+ bigintval(REQUEST_POST('sort')),
+ ), __FILE__, __LINE__);
} else {
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_member_menu` (`action`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
- array(
- REQUEST_POST('name'),
- REQUEST_POST('title'),
- REQUEST_POST('visible'),
- REQUEST_POST('active'),
- bigintval(REQUEST_POST('sort')),
-), __FILE__, __LINE__);
+ array(
+ REQUEST_POST('name'),
+ REQUEST_POST('title'),
+ REQUEST_POST('visible'),
+ REQUEST_POST('active'),
+ bigintval(REQUEST_POST('sort')),
+ ), __FILE__, __LINE__);
}
LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
} else {