]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_cats.php
More fixes, thanks to Piter01
[mailer.git] / inc / modules / admin / what-config_cats.php
index 59b6eae39fadc27407e91ed05ae85675ecb20e37..fd795ff259337216bd159d5e487a3f98cf31aecf 100644 (file)
  ************************************************************************/
 
 // Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN())) {
+if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
 
 // Init variable to avoid a notice
 $CATS = "";
 
-OPEN_TABLE("100%", "admin_content admin_content_align", "");
 if (isset($_POST['add'])) {
        // Add a new category
        $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_cats WHERE cat='%s' LIMIT 1",
-        array(addslashes($_POST['catname'])), __FILE__, __LINE__);
+               array($_POST['catname']), __FILE__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Category does not exists, we simply add it...
-               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_cats (cat, visible, sort) VALUES ('%s', '%s', '%s')",
-                array(addslashes($_POST['catname']), $_POST['visible'], bigintval($_POST['parent'] + 1)), __FILE__, __LINE__);
+               $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_cats (cat, visible, sort) VALUES ('%s','%s','%s')",
+                       array($_POST['catname'], $_POST['visible'], bigintval($_POST['parent'] + 1)), __FILE__, __LINE__);
                $content = "<SPAN class=\"admin_done\">".CATEGORY_ADDED."</SPAN>";
        } else {
                // Category does already exists
@@ -67,7 +66,7 @@ if (isset($_POST['add'])) {
 } elseif ((isset($_POST['ok'])) && (isset($_POST['id'])) && (is_array($_POST['id']))) {
        // Change or delete categories...
        $TEXT = "";
-       foreach ($_POST['id'] as $id=>$cat) {
+       foreach ($_POST['id'] as $id => $cat) {
                // Secure ID
                $id = bigintval($id);
 
@@ -104,7 +103,7 @@ if (isset($_POST['add'])) {
 {
        // Delete categories
        $SW = 2; $OUT = "";
-       foreach ($_POST['sel'] as $id=>$value)
+       foreach ($_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 +129,7 @@ if (isset($_POST['add'])) {
 } elseif ((isset($_POST['edit'])) && ((SELECTION_COUNT($_POST['sel']) > 0) || (isset($_POST['sel'][0])))) {
        // Edit categories
        $SW = 2; $OUT = "";
-       foreach ($_POST['sel'] as $id=>$value)
+       foreach ($_POST['sel'] as $id => $value)
        {
                // Load data from the category
                $result = SQL_QUERY_ESC("SELECT cat, visible, sort FROM "._MYSQL_PREFIX."_cats WHERE id=%s LIMIT 1",
@@ -197,6 +196,6 @@ if (isset($_POST['add'])) {
        // Form to add a new category
        LOAD_TEMPLATE("admin_add_cat");
 }
-CLOSE_TABLE();
+
 //
 ?>