]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-memedit.php
New functions introduced, several rewrites:
[mailer.git] / inc / modules / admin / what-memedit.php
index a959727f2b3f28cee6902200579bb7e29ba906c6..e47bea61681ba0a5efbb8c9a00b2d854777ae181 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 09/28/2003 *
- * ===============                              Last change: 05/13/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 09/28/2003 *
+ * ===================                          Last change: 05/13/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-memedit.php                                 *
@@ -52,16 +52,12 @@ if (isGetRequestElementSet('sub')) {
        $SUB = getRequestElement('sub');
 } // END - if
 
-// Get count of (maybe) selected menu points
-$chk = 0;
-if (isPostRequestElementSet('sel')) $chk = countPostSelection();
-
 // List all menu points and make them editable
-if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
+if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // Edit menu entries
        $content['sub'] = $SUB;
-       $content['chk'] = $chk;
-       $SW = 2; $cnt = 0; $OUT = '';
+       $content['chk'] = countPostSelection();
+       $SW = 2; $cnt = '0'; $OUT = '';
        foreach (postRequestElement('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -100,11 +96,11 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
 
        // Load template
        loadTemplate('admin_mmenu_edit', false, $content);
-} elseif ((isPostRequestElementSet('del')) && ($chk > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // Del menu entries with or without confirmation
        $content['sub'] = $SUB;
-       $content['chk'] = $chk;
-       $SW = 2; $cnt = 0; $OUT = '';
+       $content['chk'] = countPostSelection();
+       $SW = 2; $cnt = '0'; $OUT = '';
        foreach (postRequestElement('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -139,11 +135,11 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
 
        // Load template
        loadTemplate('admin_mmenu_delete', false, $content);
-} elseif ((isPostRequestElementSet('status')) && ($chk > 0) && (!isDemoModeActive())) {
+} elseif ((isPostRequestElementSet('status')) && (countPostSelection() > 0) && (!isDemoModeActive())) {
        // Change status (visible / locked)
        $content['sub'] = $SUB;
-       $content['chk'] = $chk;
-       $SW = 2; $cnt = 0; $OUT = '';
+       $content['chk'] = countPostSelection();
+       $SW = 2; $cnt = '0'; $OUT = '';
        foreach (postRequestElement('sel') as $sel => $confirm) {
                if ($confirm == 1) {
                        $cnt++;
@@ -237,12 +233,12 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
 
                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(getRequestElement('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(getRequestElement('fid')), bigintval($tid)), __FILE__, __LINE__);
                } // END - -fi
-       }
+       } // END - if
 
        if (!empty($SUB)) {
                // Edit sub menus
@@ -260,20 +256,20 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
                // Set sub value
                $content['sub'] = $SUB;
 
-               $SW = 2; $cnt = 0; $OUT = '';
+               $SW = 2; $cnt = '0'; $OUT = '';
                while ($data = SQL_FETCHARRAY($result)) {
                        // Init navigation
                        $data['navi'] = '';
                        $cnt++;
-                       if (($data['sort'] == 0) || (($data['sort'] == 1) && (!empty($SUB)))) {
+                       if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($SUB)))) {
                                // Is highest position
-                               $data['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=memedit&amp;sub=".$content['sub']."&amp;act=".$data['action']."&amp;w=".$data['what']."&amp;tid=".($data['sort']+1)."&amp;fid=".$data['sort']."\">{--LOWER--}</a>";
+                               $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) {
                                // Is lowest position
-                               $data['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=memedit&amp;sub=".$content['sub']."&amp;act=".$data['action']."&amp;w=".$data['what']."&amp;tid=".($data['sort']-1)."&amp;fid=".$data['sort']."\">{--HIGHER--}</a>";
+                               $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) {
                                // Anything else between highest and lowest
-                               $data['navi'] = "<a href=\"{?URL?}/modules.php?module=admin&amp;what=memedit&amp;sub=".$content['sub']."&amp;act=".$data['action']."&amp;w=".$data['what']."&amp;tid=".($data['sort']-1)."&amp;fid=".$data['sort']."\">{--HIGHER--}</a>/<a href=\"{?URL?}/modules.php?module=admin&amp;what=memedit&amp;sub=".$content['sub']."&amp;act=".$data['action']."&amp;w=".$data['what']."&amp;tid=".($data['sort']+1)."&amp;fid=".$data['sort']."\">{--LOWER--}</a>";
+                               $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>/<a href="{%url=modules.php?module=admin&amp;what=memedit&amp;sub=' . $content['sub'] . '&amp;act=' . $data['action'] . '&amp;w=' . $data['what'] . '&amp;tid=' . ($data['sort']+1) . '&amp;fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
                        }
 
                        // Fix empty values for Firefox
@@ -288,7 +284,7 @@ if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
                        // Load row template and switch color
                        $OUT .= loadTemplate('admin_menu_overview_row', true, $data);
                        $SW = 3 - $SW;
-               }
+               } // END - while
 
                // Free memory
                SQL_FREERESULT($result);