X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fmodules%2Fadmin%2Fwhat-guest_add.php;h=3bd9a5c284d4375446d907944b84a3908cc63ecb;hb=4e828541f3977c085ef54d3490b3e0069eb09a06;hp=de1be885ddf4a9b27c3bd35a42214a79a99886e9;hpb=b7c28074ad5f8674f59f454f80703b97600897cb;p=mailer.git
diff --git a/inc/modules/admin/what-guest_add.php b/inc/modules/admin/what-guest_add.php
index de1be885dd..3bd9a5c284 100644
--- a/inc/modules/admin/what-guest_add.php
+++ b/inc/modules/admin/what-guest_add.php
@@ -32,35 +32,29 @@
************************************************************************/
// 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__));
-OUTPUT_HTML("
");
-OPEN_TABLE("100%", "admin_content admin_content_align", "");
+// Add description as navigation point
+ADD_DESCR("admin", __FILE__);
// Check if the admin has entered title and what-php file name...
-if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok'])))
-{
+if (((empty($_POST['title'])) || (empty($_POST['menu']))) && (isset($_POST['ok']))) {
+ // Abort adding the menu entry
unset($_POST['ok']);
}
-if (!isset($_POST['ok']))
-{
+if (!isset($_POST['ok'])) {
// Create arrays
$menus = array(); $titles = array(); $below = array();
// Get all available main menus
- $result = SQL_QUERY("SELECT action, title, sort FROM "._MYSQL_PREFIX."_guest_menu WHERE (what='' OR what IS NULL) ORDER BY sort", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ $result = SQL_QUERY("SELECT action, title, sort FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) ORDER BY `sort`", __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0) {
// Read menu structure
- while (list($act, $title, $sort) = SQL_FETCHROW($result))
- {
+ while (list($act, $title, $sort) = SQL_FETCHROW($result)) {
// Menu actions
$menus[] = $act;
@@ -76,27 +70,27 @@ if (!isset($_POST['ok']))
// Remove double eintries
$prev = ""; $dmy = $menus; $dmy2 = $titles; $dmy3 = $below;
- foreach ($menus as $key=>$value)
- {
- if ($value == $prev)
- {
+ foreach ($menus as $key => $value) {
+ if ($value == $prev) {
unset($dmy[$key]);
unset($dmy2[$key]);
unset($dmy3[$key]);
- }
- else
- {
+ } else {
$prev = $value;
}
}
- $menus = $dmy; $titles = $dmy2; $below = $dmy3;
+
+ // Init variables
+ $menus = $dmy;
+ $titles = $dmy2;
+ $below = $dmy3;
+
// Load sub menus :)
- foreach ($menus as $key_main=>$value_main)
- {
+ foreach ($menus as $key_main => $value_main) {
$result = SQL_QUERY_ESC("SELECT what, title, sort
-FROM "._MYSQL_PREFIX."_guest_menu
-WHERE action='%s' AND what != '' ORDER BY sort",
- array(bigintval($value_main)), __FILE__, __LINE__);
+FROM `{!_MYSQL_PREFIX!}_guest_menu`
+WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort`",
+ array($value_main), __FILE__, __LINE__);
if (SQL_NUMROWS($result) > 0)
{
// Initialize arrays
@@ -122,7 +116,7 @@ WHERE action='%s' AND what != '' ORDER BY sort",
// Remove double eintries
$prev = ""; $dmy = $menus[$value_main]; $dmy2 = $titles[$value_main]; $dmy3 = $below[$value_main];
- foreach ($menus[$value_main] as $key=>$value)
+ foreach ($menus[$value_main] as $key => $value)
{
if ($value == $prev)
{
@@ -140,31 +134,31 @@ WHERE action='%s' AND what != '' ORDER BY sort",
}
}
- $OUT = " ";
define('__BELOW_SELECTION' , $OUT);
define('__WHAT_SELECTION' , ADMIN_MAKE_MENU_SELECTION("guest", "what", "name"));
@@ -178,9 +172,7 @@ WHERE action='%s' AND what != '' ORDER BY sort",
// Insert new menu entry
if (!empty($_POST['menu']))
{
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_guest_menu
-(action, what, title, sort, visible, locked)
-VALUES('%s', '%s', '%s', '%s', '%s', '%s')",
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (`action`,`what`,`title`,`sort`,`visible`,`locked`) VALUES ('%s','%s','%s','%s','%s','%s')",
array(
$_POST['menu'],
$_POST['name'],
@@ -192,9 +184,7 @@ VALUES('%s', '%s', '%s', '%s', '%s', '%s')",
}
else
{
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_guest_menu
-(action, title, sort, visible, locked)
-VALUES('%s', '%s', '%s', '%s', '%s')",
+ SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_guest_menu` (action, title, sort, visible, locked) VALUES ('%s','%s','%s','%s','%s')",
array(
$_POST['name'],
$_POST['title'],
@@ -203,14 +193,13 @@ VALUES('%s', '%s', '%s', '%s', '%s')",
$_POST['active'],
), __FILE__, __LINE__);
}
- LOAD_TEMPLATE("admin_settings_saved", false, SAVING_DONE);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
}
else
{
// Demo mode!
- LOAD_TEMPLATE("admin_settings_saved", false, SETTINGS_NOT_SAVED);
+ LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_NOT_SAVED'));
}
-CLOSE_TABLE();
//
?>