]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_cats.php
A lot rewrites from double-quote to single-quote, some fixes for extension handling...
[mailer.git] / inc / modules / admin / what-config_cats.php
index b8ebcf8b04bb5483580e8993139443db767ad2b4..7f11a7226b88250006e5feaa4ea9b3dc77303193 100644 (file)
  * Kurzbeschreibung  : Neue Kategorien hinzufuegen und bestehende       *
  *                     editieren / loeschen                             *
  * -------------------------------------------------------------------- *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
@@ -39,10 +44,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", __FILE__);
+ADD_DESCR('admin', __FILE__);
 
 // Init variable to avoid a notice
-$CATS = "";
+$CATS = '';
 
 if (REQUEST_ISSET_POST(('add'))) {
        // Add a new category
@@ -62,10 +67,10 @@ if (REQUEST_ISSET_POST(('add'))) {
        SQL_FREERESULT($result);
 
        // Display message
-       LOAD_TEMPLATE("admin_settings_saved", false, $content);
+       LOAD_TEMPLATE('admin_settings_saved', false, $content);
 } elseif ((IS_FORM_SENT()) && (REQUEST_ISSET_POST(('id'))) && (is_array(REQUEST_POST('id')))) {
        // Change or delete categories...
-       $TEXT = "";
+       $TEXT = '';
        foreach (REQUEST_POST('id') as $id => $cat) {
                // Secure ID
                $id = bigintval($id);
@@ -101,11 +106,11 @@ if (REQUEST_ISSET_POST(('add'))) {
 
        if (isset($TEXT)) {
                // Display message
-               LOAD_TEMPLATE("admin_settings_saved", false, $TEXT);
+               LOAD_TEMPLATE('admin_settings_saved', false, $TEXT);
        }
 } elseif ((REQUEST_ISSET_POST('del')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Delete categories
-       $SW = 2; $OUT = "";
+       $OUT = ''; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value) {
                // Load data of category
                $result = SQL_QUERY_ESC("SELECT cat FROM `{!_MYSQL_PREFIX!}_cats` WHERE id=%s LIMIT 1",
@@ -130,7 +135,7 @@ if (REQUEST_ISSET_POST(('add'))) {
        LOAD_TEMPLATE("admin_del_cats");
 } elseif ((REQUEST_ISSET_POST('edit')) && (SELECTION_COUNT(REQUEST_POST('sel')) > 0)) {
        // Edit categories
-       $SW = 2; $OUT = "";
+       $OUT = ''; $SW = 2;
        foreach (REQUEST_POST('sel') as $id => $value)
        {
                // Load data from the category
@@ -156,29 +161,25 @@ if (REQUEST_ISSET_POST(('add'))) {
 
        // Load main template
        LOAD_TEMPLATE("admin_edit_cats");
-}
- else
-{
+} else {
+       // Init variable here
+       $CATS = '';
+
        // Load all categories
        $result = SQL_QUERY("SELECT id, cat, visible, sort FROM `{!_MYSQL_PREFIX!}_cats` ORDER BY `sort`", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) > 0)
-       {
+       if (SQL_NUMROWS($result) > 0) {
+               // Init variables
+               $OUT = ''; $SW = 2;
+
                // List already existing categories for editing
-               $SW = 2; $OUT = ""; $CATS = "";
-               while (list($id, $cat, $visible, $sort) = SQL_FETCHROW($result))
-               {
+               while ($content = SQL_FETCHARRAY($result)) {
                        // Prepare data for the row template
-                       $content = array(
-                               'sw'   => $SW,
-                               'id'   => $id,
-                               'cat'  => $cat,
-                               'vis'  => TRANSLATE_YESNO($visible),
-                               'sort' => $sort,
-                       );
+                       $content['sw']  = $SW;
+                       $content['vis'] = TRANSLATE_YESNO($content['visible']);
 
                        // Put cat descriptions into variable for the selection box
-                       if (strlen($cat) > 20) $cat = substr($cat, 0, 17)."...";
-                       $CATS .= "      <option value=\"".$sort."\">".$cat."</option>\n";
+                       if (strlen($content['cat']) > 20) $content['cat'] = substr($content['cat'], 0, 17)."...";
+                       $CATS .= "      <option value=\"".$content['sort']."\">".$content['cat']."</option>\n";
 
                        // Load row template and switch color
                        $OUT .= LOAD_TEMPLATE("admin_config_cats_row", true, $content);
@@ -187,12 +188,15 @@ if (REQUEST_ISSET_POST(('add'))) {
 
                // Free memory
                SQL_FREERESULT($result);
+
+               // @TODO Rewrite this constant
                define('__CAT_ROWS', $OUT);
 
                // Load main template
                LOAD_TEMPLATE("admin_config_cats");
        }
 
+       // @TODO Rewrite this constant
        define('CATS', $CATS);
 
        // Form to add a new category