Some fixes, surfbar fixed reload is now in select boxes
authorRoland Häder <roland@mxchange.org>
Tue, 2 Dec 2008 19:15:17 +0000 (19:15 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 2 Dec 2008 19:15:17 +0000 (19:15 +0000)
inc/databases.php
inc/functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-add_surfbar_url.php
inc/modules/admin/what-config_newsletter.php
inc/modules/admin/what-config_user.php
templates/de/html/admin/admin_add_surfbar_url.tpl

index 25f1607c87eba20d6ec9b58cb8ac7bb0a5bf85ad..b8c28bd10e825b6673c7459b3e72ed0756c36ebf 100644 (file)
@@ -113,8 +113,8 @@ define('USAGE_BASE', "usage");
 // Server-URL (DO NOT CHANGE THIS OR YOU CANNOT CHECK FOR UPDATES/EXTENSIONS!)
 define('SERVER_URL', "http://www.mxchange.org");
 
-// This current patch level
-define('CURR_SVN_REVISION', "583");
+// Current SVN revision
+define('CURR_SVN_REVISION', "584");
 
 // Take a prime number which is long (if you know a longer one please try it out!)
 define('_PRIME', 591623);
index 5a8a571579e5ef02b22f28984299b914590ac1cb..1a863f6df84c45ade91a2d65f417dd434b6d1749 100644 (file)
@@ -2522,31 +2522,31 @@ function FILE_READABLE($fqfn) {
 // Converts timestamp selections into a timestamp
 function CONVERT_SELECTIONS_TO_TIMESTAMP(&$POST, &$DATA, &$id, &$skip) {
        // Init test variable
-       $TEST2 = "";
+       $test2 = "";
 
        // Get last three chars
-       $TEST = substr($id, -3);
+       $test = substr($id, -3);
 
        // Improved way of checking! :-)
-       if (in_array($TEST, array("_ye", "_mo", "_we", "_da", "_ho", "_mi", "_se"))) {
+       if (in_array($test, array("_ye", "_mo", "_we", "_da", "_ho", "_mi", "_se"))) {
                // Found a multi-selection for timings?
-               $TEST = substr($id, 0, -3);
-               if ((isset($POST[$TEST."_ye"])) && (isset($POST[$TEST."_mo"])) && (isset($POST[$TEST."_we"])) && (isset($POST[$TEST."_da"])) && (isset($POST[$TEST."_ho"])) && (isset($POST[$TEST."_mi"])) && (isset($POST[$TEST."_se"])) && ($TEST != $TEST2)) {
+               $test = substr($id, 0, -3);
+               if ((isset($POST[$test."_ye"])) && (isset($POST[$test."_mo"])) && (isset($POST[$test."_we"])) && (isset($POST[$test."_da"])) && (isset($POST[$test."_ho"])) && (isset($POST[$test."_mi"])) && (isset($POST[$test."_se"])) && ($test != $test2)) {
                        // Generate timestamp
-                       $POST[$TEST] = CREATE_TIMESTAMP_FROM_SELECTIONS($TEST, $POST);
-                       $DATA[] = "$TEST='".$POST[$TEST]."'";
+                       $POST[$test] = CREATE_TIMESTAMP_FROM_SELECTIONS($test, $POST);
+                       $DATA[] = sprintf("%s='%s'", $test, $POST[$test]);
 
                        // Remove data from array
                        foreach (array("ye", "mo", "we", "da", "ho", "mi", "se") as $rem) {
-                               unset($POST[$TEST."_".$rem]);
+                               unset($POST[$test."_".$rem]);
                        } // END - foreach
 
                        // Skip adding
-                       unset($id); $skip = true; $TEST2 = $TEST;
+                       unset($id); $skip = true; $test2 = $test;
                } // END - if
        } else {
                // Process this entry
-               $skip = false; $TEST2 = "";
+               $skip = false; $test2 = "";
        }
 }
 // Reverts the german decimal comma into Computer decimal dot
index ea7df656eade12a540ad1832e9b528b8ed1ad0b0..d6b6c0b65e459e6ebcd88095304250e1d8cadc58 100644 (file)
@@ -656,10 +656,10 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con
                                $test = (float)$val;
                                if ("".$val."" == "".$test."") {
                                        // Add numbers
-                                       $DATA[] = $id."=".$val."";
+                                       $DATA[] = sprintf("`%s`=%s%s", $id, $test);
                                } else {
                                        // Add strings
-                                       $DATA[] = $id."='".trim($val)."'";
+                                       $DATA[] = sprintf("`%s`='%s'", $id, trim($val));
                                }
 
                                // Update current configuration
@@ -672,9 +672,9 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con
        $result = false;
        if (!$alwaysAdd) {
                if (!empty($whereStatement)) {
-                       $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX.$tableName." WHERE ".$whereStatement." LIMIT 1", __FILE__, __LINE__);
+                       $result = SQL_QUERY("SELECT * FROM `"._MYSQL_PREFIX.$tableName."` WHERE ".$whereStatement." LIMIT 1", __FILE__, __LINE__);
                } else {
-                       $result = SQL_QUERY("SELECT * FROM "._MYSQL_PREFIX.$tableName." LIMIT 1", __FILE__, __LINE__);
+                       $result = SQL_QUERY("SELECT * FROM `"._MYSQL_PREFIX.$tableName."` LIMIT 1", __FILE__, __LINE__);
                }
        } // END - if
 
@@ -683,7 +683,11 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con
                $DATA_UPDATE = implode(", ", $DATA);
 
                // Generate SQL string
-               $SQL = "UPDATE "._MYSQL_PREFIX.$tableName." SET ".$DATA_UPDATE." WHERE ".$whereStatement." LIMIT 1";
+               $SQL = sprintf("UPDATE `"._MYSQL_PREFIX."%s` SET %s WHERE %s LIMIT 1",
+                       $tableName,
+                       $DATA_UPDATE,
+                       $whereStatement
+               );
        } else {
                // Add Line (does only work with auto_increment!
                $KEYs = array(); $VALUEs = array();
@@ -698,7 +702,11 @@ function ADMIN_SAVE_SETTINGS (&$POST, $tableName="_config", $whereStatement="con
                $VALUEs = implode(", ", $VALUEs);
 
                // Generate SQL string
-               $SQL = "INSERT INTO "._MYSQL_PREFIX.$tableName." (".$KEYs.") VALUES (".$VALUEs.")";
+               $SQL = sprintf("INSERT INTO "._MYSQL_PREFIX."%s (%s) VALUES (%s)",
+                       $tableName,
+                       $KEYs,
+                       $VALUEs
+               );
        }
 
        // Free memory
index bfe1425c555c0d6f0691dbf051737f6994fb4714..d60a9d8602b34ca6055788a7c0857be7f0d87cd2 100644 (file)
@@ -41,7 +41,13 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 ADD_DESCR("admin", __FILE__);
 
 // Was an URL added?
-if ((isset($_POST['add'])) && (!empty($_POST['url'])) && (!empty($_POST['limit']))) {
+if ((isset($_POST['add'])) && (!empty($_POST['url']))) {
+       // Dummy variables
+       $DATA = array(); $id = "reload_ye"; $skip = false;
+
+       // Convert the "reload selections"
+       CONVERT_SELECTIONS_TO_TIMESTAMP($_POST, $DATA, $id, $skip);
+
        // Then add this URL
        if (SURFBAR_ADMIN_ADD_URL($_POST['url'], $_POST['limit'], $_POST['reload'])) {
                // URL was added
@@ -52,8 +58,13 @@ if ((isset($_POST['add'])) && (!empty($_POST['url'])) && (!empty($_POST['limit']
        }
 } // END - if
 
+// Prepare content for template
+$content = array(
+       'reload' => CREATE_TIME_SELECTIONS(0, "reload", "WDhms")
+);
+
 // Load template
-LOAD_TEMPLATE("admin_add_surfbar_url");
+LOAD_TEMPLATE("admin_add_surfbar_url", false, $content);
 
 //
 ?>
index d5f22e249ed5fef765403dfa23f1249eea68e8b2..d8564cec27bd2086de05267ef955ee75f838a42f 100644 (file)
@@ -40,20 +40,18 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (isset($_POST['ok']))
-{
+if (isset($_POST['ok'])) {
        // Save data
        $_POST['nl_charge'] = REVERT_COMMA($_POST['nl_charge']);
 
        ADMIN_SAVE_SETTINGS($_POST);
-}
- else
-{
+} else {
        // Prepare contants for the template
        define('__CHARGE_VALUE'  , TRANSLATE_COMMA($_CONFIG['nl_charge'], false));
 
        // Prepare constants and load template
        LOAD_TEMPLATE("admin_config_newsletter", false);
 }
+
 //
 ?>
index c097c77ddaa388c0b3684475c9d0ec85556254ba..f2fcbbcbc2cae7a6c4905fe23e4d7c629331c2b9 100644 (file)
@@ -39,13 +39,10 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 // Add description as navigation point
 ADD_DESCR("admin", __FILE__);
 
-if (isset($_POST['ok']))
-{
+if (isset($_POST['ok'])) {
        // Save settings
        ADMIN_SAVE_SETTINGS($_POST);
-}
- else
-{
+} else {
        // Prepare constants for the template
        define('__LIMIT_VALUE', $_CONFIG['user_limit']);
        define('__ALPHA_VALUE', $_CONFIG['user_alpha']);
index c45e3fa62dc80f04241688acab8e8602c3e0d82e..b9d766352e6243e4a0a1216b20699b1db282c533 100644 (file)
@@ -14,7 +14,7 @@
        </div>
 
        <div class="admin_input" style="padding-top:5px;padding-bottom:5px" align="center">
-               Reloadsperre: <input type="text" name="reload" size="5" maxlength="20" value="0" /> {--_SECONDS--}<br />
+               Reloadsperre: $content[reload]
                <span class="admin_note">(0 = Standarteinstellungen)</span>
        </div>