X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-memedit.php;h=d0d08009fad79f3a317511293b9ed0e724d4fc55;hb=101e5f161c0c367c022c9288398226a57f3919d7;hp=72ae2f4ddb34f516818b207b66f7537117165672;hpb=74ebef603ce49e3e311a29527572a24670131889;p=mailer.git
diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php
index 72ae2f4ddb..d0d08009fa 100644
--- a/inc/modules/admin/what-memedit.php
+++ b/inc/modules/admin/what-memedit.php
@@ -1,7 +1,7 @@
0) && (!isDemoModeActive())) {
+if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Edit menu entries
- $content['sub'] = $SUB;
+ $content['sub'] = $subMenu;
$content['chk'] = countPostSelection();
- $SW = 2; $cnt = '0'; $OUT = '';
- foreach (postRequestElement('sel') as $sel => $confirm) {
+ $count = '0'; $OUT = '';
+ foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title`, `action`, `what` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
$data = SQL_FETCHARRAY($result);
$data = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'sel' => $sel,
'menu' => $data['title'],
- 'sw' => $SW,
- 'act' => adminAddMenuSelectionBox('member', 'act' , 'sel_act[' . $sel . ']', $data['action']),
- 'what' => adminAddMenuSelectionBox('member', 'what', 'sel_what[' . $sel . ']', $data['what']),
+ 'action' => adminAddMenuSelectionBox('member', 'action', 'sel_action[' . $sel . ']', $data['action']),
+ 'what' => adminAddMenuSelectionBox('member', 'what' , 'sel_what[' . $sel . ']', $data['what']),
);
// Load template
- $OUT .= loadTemplate('admin_mmenu_edit_row', true, $data);
+ $OUT .= loadTemplate('admin_edit_member_menu_row', true, $data);
} else {
// Entry not found?
$data = array(
- 'sw' => $SW,
'sel' => $sel
);
@@ -88,39 +85,39 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
$OUT .= loadTemplate('admin_menu_404_row', true, $data);
}
SQL_FREERESULT($result);
- $SW = 3 - $SW;
- }
- }
+ } // END - if
+ } // END - foreach
+
+ // Add row content and current counter
$content['rows'] = $OUT;
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
// Load template
- loadTemplate('admin_mmenu_edit', false, $content);
-} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+ loadTemplate('admin_edit_member_menu', false, $content);
+} elseif ((isFormSent('delete')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Del menu entries with or without confirmation
- $content['sub'] = $SUB;
+ $content['sub'] = $subMenu;
$content['chk'] = countPostSelection();
- $SW = 2; $cnt = '0'; $OUT = '';
- foreach (postRequestElement('sel') as $sel => $confirm) {
+ $count = '0'; $OUT = '';
+ foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
list($title) = SQL_FETCHROW($result);
$content = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'sel' => $sel,
'title' => $title
);
// Load template
- $OUT .= loadTemplate('admin_mmenu_delete_row', true, $content);
+ $OUT .= loadTemplate('admin_delete_member_menu_row', true, $content);
} else {
// Entry not found?
$content = array(
- 'sw' => $SW,
'sel' => $sel
);
@@ -131,28 +128,27 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
} // END - if
} // END - foreach
$content['rows'] = $OUT;
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
// Load template
- loadTemplate('admin_mmenu_delete', false, $content);
-} elseif ((isPostRequestElementSet('status')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+ loadTemplate('admin_delete_member_menu', false, $content);
+} elseif ((isPostRequestParameterSet('status')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Change status (visible / locked)
- $content['sub'] = $SUB;
+ $content['sub'] = $subMenu;
$content['chk'] = countPostSelection();
- $SW = 2; $cnt = '0'; $OUT = '';
- foreach (postRequestElement('sel') as $sel => $confirm) {
+ $count = '0'; $OUT = '';
+ foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
$data = SQL_FETCHARRAY($result);
$data = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'menu' => $data['title'],
'sel' => $sel,
- 'sw' => $SW,
'visible' => addSelectionBox('yn', $data['visible'], 'visible', $sel),
'locked' => addSelectionBox('yn', $data['locked'] , 'locked' , $sel),
);
@@ -162,7 +158,6 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
} else {
// Entry not found?
$data = array(
- 'sw' => $SW,
'sel' => $sel
);
@@ -170,77 +165,21 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
$OUT .= loadTemplate('admin_menu_404_row', true, $data);
}
SQL_FREERESULT($result);
- $SW = 3 - $SW;
} // END - if
} // END - foreach
$content['rows'] = $OUT;
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
// Load template
- loadTemplate('admin_mmenu_status', false, $content);
+ loadTemplate('admin_member_menu_status', false, $content);
} elseif ((isFormSent()) && (!isDemoModeActive())) {
- // An act is done...
- foreach (postRequestElement('sel') as $sel => $menu) {
- $AND = "(`what` = '' OR `what` IS NULL)";
- $sel = bigintval($sel);
- if (!empty($SUB)) $AND = "`action`='".$SUB."'";
- switch (postRequestElement('ok')) {
- case 'edit': // Edit menu
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
- array($menu, postRequestElement('sel_act', $sel), postRequestElement('sel_what', $sel), $sel), __FILE__, __LINE__);
- break;
-
- case 'del': // Delete menu
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
- array($sel), __FILE__, __LINE__);
- break;
-
- case 'status': // Change status of menus
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
- array(postRequestElement('visible', $sel), postRequestElement('locked', $sel), $sel), __FILE__, __LINE__);
- break;
- } // END - switch
- break;
- } // END - foreach
-
- // Load template
- loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+ // Process menu editing form
+ adminProcessMenuEditForm('member', $subMenu);
} else {
- if ((isGetRequestElementSet('act')) && (isGetRequestElementSet('tid')) && (isGetRequestElementSet('fid'))) {
- // Init
- $tid = ''; $fid = '';
-
- // Get ids
- if (isGetRequestElementSet('w')) {
- // Sub menus selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('act')), bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
- list($tid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('act')), bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
- list($fid) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- } else {
- // Main menu selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
- list($tid) = SQL_FETCHROW($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
- array(bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
- list($fid) = SQL_FETCHROW($result);
- }
+ // Handle weightning
+ doAdminProcessMenuWeightning('member', $AND);
- if ((!empty($tid)) && (!empty($fid))) {
- // Sort menu
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
- array(bigintval(getRequestElement('tid')), bigintval($fid)), __FILE__, __LINE__);
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
- array(bigintval(getRequestElement('fid')), bigintval($tid)), __FILE__, __LINE__);
- } // END - -fi
- }
-
- if (!empty($SUB)) {
+ if (!empty($subMenu)) {
// Edit sub menus
$result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", __FILE__, __LINE__);
} else {
@@ -248,43 +187,33 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
$result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
}
- // Get total menu entries
- $max = SQL_NUMROWS($result);
-
// Some are there?
- if ($max > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Set sub value
- $content['sub'] = $SUB;
+ $content['sub'] = $subMenu;
- $SW = 2; $cnt = '0'; $OUT = '';
+ $count = '0'; $OUT = '';
while ($data = SQL_FETCHARRAY($result)) {
// Init navigation
$data['navi'] = '';
- $cnt++;
- if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
+ $count++;
+ if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($subMenu)))) {
// Is highest position
- $data['navi'] = "{--LOWER--}";
- } elseif ($cnt == $max) {
+ $data['navi'] = '{--LOWER--}';
+ } elseif ($count == SQL_NUMROWS($result)) {
// Is lowest position
- $data['navi'] = "{--HIGHER--}";
+ $data['navi'] = '{--HIGHER--}';
} elseif ($data['sort'] > 0) {
// Anything else between highest and lowest
- $data['navi'] = "{--HIGHER--}/{--LOWER--}";
+ $data['navi'] = '{--HIGHER--}|{--LOWER--}';
}
- // Fix empty values for Firefox
- if (empty($data['action'])) $data['action'] = ' ';
- if (empty($data['what'])) $data['what'] = ' ';
- if (empty($data['title'])) $data['title'] = ' ';
-
// Add more entries
- $data['sw'] = $SW;
$data['mode'] = 'mem';
// Load row template and switch color
$OUT .= loadTemplate('admin_menu_overview_row', true, $data);
- $SW = 3 - $SW;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
@@ -293,10 +222,10 @@ if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoM
$content['rows'] = $OUT;
// Load main template
- loadTemplate('admin_mmenu_overview', false, $content);
+ loadTemplate('admin_member_menu_overview', false, $content);
} else {
// Menu entries are missing... (???)
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
+ displayMessage('{--ADMIN_NO_MENUS_FOUND--}');
}
}