X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-mem_add.php;h=14bde5ed57ce038da88f1b96dccbd967fd1978eb;hb=4b32c7be676d4a191c869a5745f2890240852fb0;hp=da8684ad9164fc0183e74302a2313a07a665ffa5;hpb=2ec9007220186d54f84846871ed1f7638c29baf7;p=mailer.git
diff --git a/inc/modules/admin/what-mem_add.php b/inc/modules/admin/what-mem_add.php
index da8684ad91..14bde5ed57 100644
--- a/inc/modules/admin/what-mem_add.php
+++ b/inc/modules/admin/what-mem_add.php
@@ -1,7 +1,7 @@
0) {
// Read menu structure
// @TODO Cant this be rewritten?
@@ -77,7 +79,10 @@ if (!isFormSent()) {
// Remove double eintries
// @TODO This can be somehow rewritten to a function
- $prev = ''; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
+ $prev = '';
+ $dmy = $menus;
+ $dmy2 = $titles;
+ $dmy3 = $below;
foreach ($menus as $key => $value) {
if ($value == $prev) {
// Remove entries
@@ -94,7 +99,7 @@ if (!isFormSent()) {
// Load sub menus :)
foreach ($menus as $key_main => $value_main) {
- $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{!_MYSQL_PREFIX!}_member_menu` WHERE `action`='%s' AND `what` != '' ORDER BY `sort`",
+ $result = SQL_QUERY_ESC("SELECT what, title, sort FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `what` != '' ORDER BY `sort`",
array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0) {
// Initialize arrays
@@ -105,7 +110,7 @@ if (!isFormSent()) {
// 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'];
@@ -143,52 +148,53 @@ if (!isFormSent()) {
foreach ($below as $key => $m) {
if (is_array($m)) {
foreach ($m as $key2 => $m2) {
- $OUT .= " \n";
- }
+ } // END - foreach
} else {
- $OUT .= " \n";
+ $OUT .= " \n";
}
}
$OUT .= "";
- define('__BELOW_SELECTION' , $OUT);
- define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION('member', 'what', "name"));
- define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION('member', 'action', "menu"));
+ // Prepare selection boxes for template
+ $content['below_selection'] = $OUT;
+ $content['what_selection'] = adminAddMenuSelectionBox('member', 'what' , 'name');
+ $content['action_selection'] = adminAddMenuSelectionBox('member', 'action', 'menu');
// Display form
- LOAD_TEMPLATE("admin_member_add");
-} elseif (!IS_DEMO()) {
+ loadTemplate('admin_member_add', false, $content);
+} elseif (!isDemoModeActive()) {
// Insert new menu entry
- 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__);
+ if (isPostRequestParameterSet('menu')) {
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s','%s')",
+ array(
+ postRequestParameter('menu'),
+ postRequestParameter('name'),
+ postRequestParameter('title'),
+ postRequestParameter('visible'),
+ postRequestParameter('active'),
+ bigintval(postRequestParameter('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__);
+ SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_member_menu` (`action`,`title`,`visible`,`locked`,`sort`) VALUES ('%s','%s','%s','%s','%s')",
+ array(
+ postRequestParameter('name'),
+ postRequestParameter('title'),
+ postRequestParameter('visible'),
+ postRequestParameter('active'),
+ bigintval(postRequestParameter('sort')),
+ ), __FILE__, __LINE__);
}
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+ loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
} else {
// Demo mode!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
+ loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_NOT_SAVED'));
}
//