config.php partly solved, see #117
[mailer.git] / inc / mysql-manager.php
index be375eea693240de433a91fd2ff6667ca89417d4..a8532d69974104018b6e6dc2a1f02ed7d169f53e 100644 (file)
@@ -92,7 +92,7 @@ function getModuleDescription ($mode, $wht, $column = 'what') {
        } // END - if
 
        // Default is not found
-       $ret = "??? (".$wht.")";
+       $ret = "??? (".$wht.')';
 
        // Look for title
        $result = SQL_QUERY_ESC("SELECT title FROM `{!_MYSQL_PREFIX!}_%s_menu` WHERE %s='%s' LIMIT 1",
@@ -237,7 +237,7 @@ function checkModulePermissions ($mod) {
                        $ret = checkModulePermissions($mod_chk);
                } else {
                        // Module not found we don't add it to the database
-                       $ret = "404";
+                       $ret = '404';
                }
        } elseif (!$found) {
                // Problem with module detected
@@ -328,7 +328,7 @@ function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
        $prefix .= " -> ";
 
        // We need to remove .php and the end
-       if (substr($search, -4, 4) == ".php") {
+       if (substr($search, -4, 4) == '.php') {
                // Remove the .php
                $search = substr($search, 0, -4);
        } // END - i
@@ -441,7 +441,7 @@ function ADD_MENU ($mode, $act, $wht) {
                                                }
 
                                                // Navigation link
-                                               $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&amp;what=".$content['sub_what'].addUrlData("")."\" target=\"_self\">";
+                                               $OUT .= "<a name=\"menu\" class=\"menu_blur\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module']."&amp;what=".$content['sub_what']."\" target=\"_self\">";
                                        } else {
                                                $OUT .= "<em>";
                                        }
@@ -664,7 +664,7 @@ function addMaxReceiveList ($mode, $default = '', $return = false) {
                        $OUT .= "      <option value=\"".$content['value']."\"";
                        if (REQUEST_POST('max_mails') == $content['value']) $OUT .= ' selected="selected"';
                        $OUT .= ">".$content['value']." {--PER_DAY--}";
-                       if (!empty($content['comment'])) $OUT .= " (".$content['comment'].")";
+                       if (!empty($content['comment'])) $OUT .= " (".$content['comment'].')';
                        $OUT .= "</option>\n";
                }
                define('__MAX_RECEIVE_OPTIONS', $OUT);
@@ -1606,7 +1606,6 @@ WHERE p.userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 1) {
                // Save his points to add them to the jackpot
                list($points) = SQL_FETCHROW($result);
-               SQL_FREERESULT($result);
 
                // Delete points entries as well
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_points` WHERE userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
@@ -1619,7 +1618,10 @@ WHERE p.userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
 
                // Now, when we have all his points adds them do the jackpot!
                ADD_JACKPOT($points);
-       }
+       } // END - if
+
+       // Free the result
+       SQL_FREERESULT($result);
 
        // Delete category selections as well...
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE userid=%s",
@@ -1629,10 +1631,10 @@ WHERE p.userid=%s", array(bigintval($uid)), __FUNCTION__, __LINE__);
        if (EXT_IS_ACTIVE('rallye')) {
                SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_rallye_users` WHERE userid=%s",
                        array(bigintval($uid)), __FUNCTION__, __LINE__);
-       }
+       } // END - if
 
        // Now a mail to the user and that's all...
-       $msg = LOAD_EMAIL_TEMPLATE("del-user", array('text' => $reason), $uid);
+       $msg = LOAD_EMAIL_TEMPLATE('del-user', array('text' => $reason), $uid);
        sendEmail($uid, getMessage('ADMIN_DEL_ACCOUNT'), $msg);
 
        // Ok, delete the account!
@@ -1644,7 +1646,7 @@ function generateMetaDescriptionCode ($mod, $wht) {
        // Exclude admin and member's area
        if (($mod != 'admin') && ($mod != 'login')) {
                // Construct dynamic description
-               $DESCR = '{!MAIN_TITLE!} '.trim(getConfig('title_middle')).' '.ADD_DESCR('guest', 'what-'.$wht, true);
+               $DESCR = '{!MAIN_TITLE!} '.trim(getConfig('title_middle')) . ' ' . ADD_DESCR('guest', 'what-'.$wht, true);
 
                // Output it directly
                OUTPUT_HTML('<meta name="description" content="' . $DESCR . '" />');
@@ -1655,7 +1657,7 @@ function generateMetaDescriptionCode ($mod, $wht) {
 }
 
 // Adds points to the jackpot
-function ADD_JACKPOT($points) {
+function ADD_JACKPOT ($points) {
        $result = SQL_QUERY("SELECT points FROM `{!_MYSQL_PREFIX!}_jackpot` WHERE ok='ok' LIMIT 1", __FUNCTION__, __LINE__);
        if (SQL_NUMROWS($result) == 0) {
                // Create line
@@ -1671,7 +1673,7 @@ function ADD_JACKPOT($points) {
 }
 
 // Subtracts points from the jackpot
-function SUB_JACKPOT($points) {
+function SUB_JACKPOT ($points) {
        // First failed
        $ret = '-1';
 
@@ -2176,7 +2178,7 @@ function reduceRecipientReceivedMails ($column, $id, $count) {
 
                // Now update all user accounts
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET `emails_received`=`emails_received`-1 WHERE `userid` IN (%s) LIMIT %s",
-                       array(implode(",", $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
+                       array(implode(',', $UIDs), count($UIDs)), __FUNCTION__, __LINE__);
        } // END - if
 
        // Free result
@@ -2219,6 +2221,11 @@ function SET_SQL_KEY ($key, $value) {
        $GLOBALS['sqls'][$key] = (string) $value;
 }
 
+// Merge SQLs together
+function MERGE_SQLS ($SQLs) {
+       SET_SQLS(merge_array(GET_SQLS(), $SQLs));
+}
+
 // Counter for SQLs array
 function COUNT_SQLS () {
        // Default is false