X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-guestedit.php;h=722b9eea4efef82d519769095d0fda82d0ccfaec;hp=eb779a1f35ef80e60289bd3f1cc4dd6dad98b186;hb=a4dd1eb45ae25ed017a862a4edac1e2828acbee6;hpb=cf3765c38cf0a76f396aca291f71858936e92956
diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php
index eb779a1f35..722b9eea4e 100644
--- a/inc/modules/admin/what-guestedit.php
+++ b/inc/modules/admin/what-guestedit.php
@@ -54,7 +54,7 @@ if (isGetRequestParameterSet('sub')) {
} // END - if
// List all menu points and make them editable
-if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Edit menu entries
$content['sub'] = $SUB;
$content['chk'] = countPostSelection();
@@ -79,7 +79,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
);
// Load row template
- $OUT .= loadTemplate('admin_gmenu_edit_row', true, $DATA);
+ $OUT .= loadTemplate('admin_edit_guest_menu_row', true, $DATA);
} else {
// Entry not found
$DATA = array(
@@ -97,8 +97,8 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
$content['cnt'] = $cnt;
// Load template
- loadTemplate('admin_gmenu_edit_form', false, $content);
-} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+ loadTemplate('admin_edit_guest_menu_form', false, $content);
+} elseif ((isFormSent('del')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Del menu entries with or without confirmation
$content['sub'] = $SUB;
$content['chk'] = countPostSelection();
@@ -119,7 +119,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
'menu' => $DATA['title'],
'sel' => $sel,
);
- $OUT .= loadTemplate('admin_gmenu_delete_row', true, $DATA);
+ $OUT .= loadTemplate('admin_del_guest_menu_row', true, $DATA);
} else {
// Entry not found?
$DATA = array(
@@ -134,7 +134,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
$content['cnt'] = $cnt;
// Load template
- loadTemplate('admin_gmenu_delete', false, $content);
+ loadTemplate('admin_del_guest_menu', false, $content);
} elseif ((isFormSent()) && (!isDemoModeActive())) {
// An action is done...
switch (postRequestParameter('ok')) {
@@ -176,7 +176,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_UNKNOWN_OKAY', postRequestParameter('ok')));
break;
} // END - switch
-} elseif ((isPostRequestParameterSet('status')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestParameterSet('status')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
// Change status (visible / locked)
$content['sub'] = $SUB;
$content['chk'] = countPostSelection();
@@ -216,27 +216,27 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
$content['rows'] = $OUT;
// Load template
- loadTemplate('admin_gmenu_status', false, $content);
+ loadTemplate('admin_guest_menu_status', false, $content);
} else {
if ((isGetRequestParameterSet('act')) && (isGetRequestParameterSet('tid')) && (isGetRequestParameterSet('fid'))) {
// Get ids
if (isGetRequestParameterSet('w')) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
array(getRequestParameter('act'), bigintval(getRequestParameter('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
array(getRequestParameter('act'), bigintval(getRequestParameter('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
array(bigintval(getRequestParameter('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
array(bigintval(getRequestParameter('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
@@ -244,9 +244,9 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
if ((!empty($tid)) && (!empty($fid))) {
// Sort menu
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval(getRequestParameter('tid')), bigintval($fid)), __FILE__, __LINE__);
- SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_guest_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__);
} // END - if
} // END - if
@@ -261,9 +261,8 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
array($SUB), __FILE__, __LINE__);
}
- // Get number of menu entries
- $max = SQL_NUMROWS($result);
- if ($max > 0) {
+ // Do we have entries?
+ if (SQL_NUMROWS($result) > 0) {
// Set sub value
$content['sub'] = $SUB;
@@ -277,7 +276,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
// Is highest position
$NAVI = '{--LOWER--}';
- } elseif ($cnt == $max) {
+ } elseif ($cnt == SQL_NUMROWS($result)) {
// Is lowest position
$NAVI = '{--HIGHER--}';
} elseif ($data['sort'] > 0) {
@@ -310,7 +309,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
SQL_FREERESULT($result);
// Load template
- loadTemplate('admin_gmenu_edit', false, $content);
+ loadTemplate('admin_edit_guest_menu', false, $content);
} else {
// Menu entries are missing... (???)
loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MENUS_FOUND--}');