]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-memedit.php
More fixes for ext-surfbar:
[mailer.git] / inc / modules / admin / what-memedit.php
index 6e3405dc16387b85cdf88ec3adb9c609ab3b58de..d0d08009fad79f3a317511293b9ed0e724d4fc55 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -41,7 +41,7 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 // Do we edit/delete/change main menus or sub menus?
 $AND = "(`what` = '' OR `what` IS NULL)"; $subMenu = '';
@@ -56,17 +56,17 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        // Edit menu entries
        $content['sub'] = $subMenu;
        $content['chk'] = countPostSelection();
-       $cnt = '0'; $OUT = '';
+       $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'],
                                        'action' => adminAddMenuSelectionBox('member', 'action', 'sel_action[' . $sel . ']', $data['action']),
@@ -90,7 +90,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
 
        // Add row content and current counter
        $content['rows'] = $OUT;
-       $content['cnt'] = $cnt;
+       $content['cnt'] = $count;
 
        // Load template
        loadTemplate('admin_edit_member_menu', false, $content);
@@ -98,17 +98,17 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        // Del menu entries with or without confirmation
        $content['sub'] = $subMenu;
        $content['chk'] = countPostSelection();
-       $cnt = '0'; $OUT = '';
+       $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
                                );
@@ -128,7 +128,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                } // END - if
        } // END - foreach
        $content['rows'] = $OUT;
-       $content['cnt'] = $cnt;
+       $content['cnt'] = $count;
 
        // Load template
        loadTemplate('admin_delete_member_menu', false, $content);
@@ -136,17 +136,17 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        // Change status (visible / locked)
        $content['sub'] = $subMenu;
        $content['chk'] = countPostSelection();
-       $cnt = '0'; $OUT = '';
+       $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,
                                        'visible' => addSelectionBox('yn', $data['visible'], 'visible', $sel),
@@ -168,7 +168,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                } // END - if
        } // END - foreach
        $content['rows'] = $OUT;
-       $content['cnt'] = $cnt;
+       $content['cnt'] = $count;
 
        // Load template
        loadTemplate('admin_member_menu_status', false, $content);
@@ -177,7 +177,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        adminProcessMenuEditForm('member', $subMenu);
 } else {
        // Handle weightning
-       doAdminProcessMenuWeightning('guest');
+       doAdminProcessMenuWeightning('member', $AND);
 
        if (!empty($subMenu)) {
                // Edit sub menus
@@ -188,31 +188,26 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
        }
 
        // Some are there?
-       if (SQL_NUMROWS($result) > 0) {
+       if (!SQL_HASZERONUMS($result)) {
                // Set sub value
                $content['sub'] = $subMenu;
 
-               $cnt = '0'; $OUT = '';
+               $count = '0'; $OUT = '';
                while ($data = SQL_FETCHARRAY($result)) {
                        // Init navigation
                        $data['navi'] = '';
-                       $cnt++;
+                       $count++;
                        if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($subMenu)))) {
                                // 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 == SQL_NUMROWS($result)) {
+                               $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>';
+                       } elseif ($count == 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>';
+                               $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>';
                        } elseif ($data['sort'] > 0) {
                                // Anything else between highest and lowest
-                               $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>';
+                               $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>';
                        }
 
-                       // Fix empty values for Firefox
-                       if (empty($data['action'])) $data['action'] = '&nbsp;';
-                       if (empty($data['what']))   $data['what']   = '&nbsp;';
-                       if (empty($data['title']))  $data['title']  = '&nbsp;';
-
                        // Add more entries
                        $data['mode'] = 'mem';
 
@@ -230,7 +225,7 @@ if ((isFormSent('edit')) && (ifPostContainsSelections()) && (!isDemoModeActive()
                loadTemplate('admin_member_menu_overview', false, $content);
        } else {
                // Menu entries are missing... (???)
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MENUS_FOUND--}');
+               displayMessage('{--ADMIN_NO_MENUS_FOUND--}');
        }
 }