]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-memedit.php
Moved language strings, more EL in templates
[mailer.git] / inc / modules / admin / what-memedit.php
index 0349a74b3563586efb42342571885c8e262c75b0..658f45675cc87a83e3965e671218a315cb4d3d50 100644 (file)
@@ -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();
@@ -76,7 +76,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                                );
 
                                // 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(
@@ -95,8 +95,8 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
        $content['cnt'] = $cnt;
 
        // Load template
-       loadTemplate('admin_mmenu_edit', false, $content);
-} elseif ((isFormSent('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+       loadTemplate('admin_edit_member_menu', false, $content);
+} elseif ((isFormSent('del')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Del menu entries with or without confirmation
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
@@ -116,7 +116,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                                );
 
                                // Load template
-                               $OUT .= loadTemplate('admin_mmenu_delete_row', true, $content);
+                               $OUT .= loadTemplate('admin_del_member_menu_row', true, $content);
                        } else {
                                // Entry not found?
                                $content = array(
@@ -133,8 +133,8 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
        $content['cnt'] = $cnt;
 
        // Load template
-       loadTemplate('admin_mmenu_delete', false, $content);
-} elseif ((isPostRequestParameterSet('status')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
+       loadTemplate('admin_del_member_menu', false, $content);
+} elseif ((isPostRequestParameterSet('status')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // Change status (visible / locked)
        $content['sub'] = $SUB;
        $content['chk'] = countPostSelection();
@@ -173,7 +173,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
        $content['cnt'] = $cnt;
 
        // Load template
-       loadTemplate('admin_mmenu_status', false, $content);
+       loadTemplate('admin_member_menu_status', false, $content);
 } elseif ((isFormSent()) && (!isDemoModeActive())) {
        // An act is done...
        foreach (postRequestParameter('sel') as $sel => $menu) {
@@ -216,29 +216,29 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                // Get ids
                if (isGetRequestParameterSet('w')) {
                        // Sub menus selected
-                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
                                array(bigintval(getRequestParameter('act')), bigintval(getRequestParameter('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",
+                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`=%s LIMIT 1",
                                array(bigintval(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?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
                                array(bigintval(getRequestParameter('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",
+                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`=%s LIMIT 1",
                                array(bigintval(getRequestParameter('fid'))), __FILE__, __LINE__);
                        list($fid) = SQL_FETCHROW($result);
                }
 
                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",
+                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_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?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`=%s WHERE ".$AND." AND `id`=%s LIMIT 1",
                                array(bigintval(getRequestParameter('fid')), bigintval($tid)), __FILE__, __LINE__);
                } // END - -fi
        } // END - if
@@ -251,11 +251,8 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                $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_NUMROWS($result) > 0) {
                // Set sub value
                $content['sub'] = $SUB;
 
@@ -267,7 +264,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
-                       } elseif ($cnt == $max) {
+                       } elseif ($cnt == SQL_NUMROWS($result)) {
                                // Is lowest position
                                $data['navi'] = '<a href="{%url=modules.php?module=admin&amp;what=adminedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']-1) . '&amp;fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
                        } elseif ($data['sort'] > 0) {
@@ -294,7 +291,7 @@ if ((isFormSent('edit')) && (countPostSelection() > 0) && (!isDemoModeActive()))
                $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, '{--ADMIN_NO_MENUS_FOUND--}');