X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=0.2.1%2Finc%2Fmodules%2Fadmin%2Fwhat-admin_add.php;fp=0.2.1%2Finc%2Fmodules%2Fadmin%2Fwhat-admin_add.php;h=88aaa205ec52f172848573501008e096afd89f1e;hp=71bebceac5f436f237fe6250b4784ff654635cf8;hb=7bc25dd08431c94ce9edca131d56c1a36b13c28a;hpb=157ee010917df5ca07e6d31b42f67417b2516d74 diff --git a/0.2.1/inc/modules/admin/what-admin_add.php b/0.2.1/inc/modules/admin/what-admin_add.php index 71bebceac5..88aaa205ec 100644 --- a/0.2.1/inc/modules/admin/what-admin_add.php +++ b/0.2.1/inc/modules/admin/what-admin_add.php @@ -1,208 +1,208 @@ - 0) - { - // Read menu structure - while (list($act, $title, $sort) = SQL_FETCHROW($result)) - { - // Menu actions - $menus[] = $act; - - // Menu titles - $titles[] = $title; - - // Below this menu point should the new be added so we simply increase the sort value by 1 :-) - $below[] = $sort + 1; - } - - // Free memory - SQL_FREERESULT($result); - - // Remove double eintries - $prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below; - foreach ($menus as $key=>$value) - { - if ($value == $prev) - { - unset($dmy[$key]); - unset($dmy2[$key]); - unset($dmy3[$key]); - } - else - { - $prev = $value; - } - } - $menus = $dmy; $titles = $dmy2; $below = $dmy3; - // Load sub menus :) - foreach ($menus as $key_main=>$value_main) - { - $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort", - array($value_main), __FILE__, __LINE__); - if (SQL_NUMROWS($result) > 0) - { - $menus[$value_main] = array(); - $titles[$value_main] = array(); - $below[$value_main] = array(); - // Read menu structure - while (list($act, $title, $sort) = SQL_FETCHROW($result)) - { - // Menu actions - $menus[$value_main][] = $act; - - // Menu titles - $titles[$value_main][] = $title; - - // Below this menu point should the new be added so we simply increase the sort value by 1 :-) - $below[$value_main][] = $sort + 1; - } - - // Free memory - SQL_FREERESULT($result); - - // Remove double eintries - $prev = ""; $dmy = $menus[$value_main]; $dmy2 = $titles[$value_main]; $dmy3 = $below[$value_main]; - foreach ($menus[$value_main] as $key=>$value) - { - if ($value == $prev) - { - unset($dmy[$key]); - unset($dmy2[$key]); - unset($dmy3[$key]); - } - else - { - $prev = $value; - } - } - $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3; - } - } - } - $OUT = " "; - - define('__BELOW_SELECTION' , $OUT); - define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION("admin", "what", "name")); - define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION("admin", "action", "menu")); - - // Display form - LOAD_TEMPLATE("admin_admin_add"); -} - elseif (!IS_DEMO()) -{ - // Insert new menu entry - if (!empty($_POST['menu'])) - { - // Add sub menu - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) -VALUES('%s', '%s', '%s', '%s', '%s')", - array( - $_POST['menu'], - $_POST['name'], - $_POST['title'], - addslashes($_POST['descr']), - bigintval($_POST['sort']), -), __FILE__, __LINE__); - } - else - { - // Add main menu - $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, title, descr, sort) -VALUES('%s', '%s', '%s', '%s')", - array( - $_POST['name'], - $_POST['title'], - addslashes($_POST['descr']), - bigintval($_POST['sort']), -), __FILE__, __LINE__); - } - LOAD_TEMPLATE("admin_settings_saved", false, SAVING_DONE); -} - else -{ - // Is demo login! - LOAD_TEMPLATE("admin_settings_saved", false, SETTINGS_NOT_SAVED); -} -CLOSE_TABLE(); - -// -?> + 0) + { + // Read menu structure + while (list($act, $title, $sort) = SQL_FETCHROW($result)) + { + // Menu actions + $menus[] = $act; + + // Menu titles + $titles[] = $title; + + // Below this menu point should the new be added so we simply increase the sort value by 1 :-) + $below[] = $sort + 1; + } + + // Free memory + SQL_FREERESULT($result); + + // Remove double eintries + $prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below; + foreach ($menus as $key=>$value) + { + if ($value == $prev) + { + unset($dmy[$key]); + unset($dmy2[$key]); + unset($dmy3[$key]); + } + else + { + $prev = $value; + } + } + $menus = $dmy; $titles = $dmy2; $below = $dmy3; + // Load sub menus :) + foreach ($menus as $key_main=>$value_main) + { + $result = SQL_QUERY_ESC("SELECT what, title, sort FROM "._MYSQL_PREFIX."_admin_menu WHERE action='%s' AND what != '' ORDER BY sort", + array($value_main), __FILE__, __LINE__); + if (SQL_NUMROWS($result) > 0) + { + $menus[$value_main] = array(); + $titles[$value_main] = array(); + $below[$value_main] = array(); + // Read menu structure + while (list($act, $title, $sort) = SQL_FETCHROW($result)) + { + // Menu actions + $menus[$value_main][] = $act; + + // Menu titles + $titles[$value_main][] = $title; + + // Below this menu point should the new be added so we simply increase the sort value by 1 :-) + $below[$value_main][] = $sort + 1; + } + + // Free memory + SQL_FREERESULT($result); + + // Remove double eintries + $prev = ""; $dmy = $menus[$value_main]; $dmy2 = $titles[$value_main]; $dmy3 = $below[$value_main]; + foreach ($menus[$value_main] as $key=>$value) + { + if ($value == $prev) + { + unset($dmy[$key]); + unset($dmy2[$key]); + unset($dmy3[$key]); + } + else + { + $prev = $value; + } + } + $menus[$value_main] = $dmy; $titles[$value_main] = $dmy2; $below[$value_main] = $dmy3; + } + } + } + $OUT = " "; + + define('__BELOW_SELECTION' , $OUT); + define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION("admin", "what", "name")); + define('__ACTION_SELECTION', ADMIN_MAKE_MENU_SELECTION("admin", "action", "menu")); + + // Display form + LOAD_TEMPLATE("admin_admin_add"); +} + elseif (!IS_DEMO()) +{ + // Insert new menu entry + if (!empty($_POST['menu'])) + { + // Add sub menu + $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, what, title, descr, sort) +VALUES('%s', '%s', '%s', '%s', '%s')", + array( + $_POST['menu'], + $_POST['name'], + $_POST['title'], + addslashes($_POST['descr']), + bigintval($_POST['sort']), +), __FILE__, __LINE__); + } + else + { + // Add main menu + $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_admin_menu (action, title, descr, sort) +VALUES('%s', '%s', '%s', '%s')", + array( + $_POST['name'], + $_POST['title'], + addslashes($_POST['descr']), + bigintval($_POST['sort']), +), __FILE__, __LINE__); + } + LOAD_TEMPLATE("admin_settings_saved", false, SAVING_DONE); +} + else +{ + // Is demo login! + LOAD_TEMPLATE("admin_settings_saved", false, SETTINGS_NOT_SAVED); +} +CLOSE_TABLE(); + +// +?>