Fixes for login bonus, some minor rewrites
[mailer.git] / inc / mysql-manager.php
index b90a230cf34bfc0082ca3f252c619de75c9f92c1..cedb715f33342b14c6ebe456728de9474d34ae98 100644 (file)
@@ -1671,28 +1671,28 @@ WHERE p.userid=%s", array(bigintval($uid)), __FILE__, __LINE__);
        $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1", array(bigintval($uid)), __FILE__, __LINE__);
 }
 //
-function META_DESCRIPTION($mod, $wht)
-{
+function META_DESCRIPTION ($mod, $wht) {
        global $_CONFIG, $DEPTH;
-       if (($mod != "admin") && ($mod != "login"))
-       {
-               // Exclude admin and member's area
+
+       // Exclude admin and member's area
+       if (($mod != "admin") && ($mod != "login")) {
+               // Construct dynamic description
                $DESCR = MAIN_TITLE." ".trim($_CONFIG['title_middle'])." ".ADD_DESCR("guest", "what-".$wht, true);
-               unset($DEPTH);
-               OUTPUT_HTML("<META name=\"description\" content=\"".$DESCR."\">");
-       }
+
+               // Output it directly
+               OUTPUT_HTML("<meta name=\"description\" content=\"".$DESCR."\" />");
+       } // END - if
+
+       // Remove depth
+       unset($DEPTH);
 }
 //
-function ADD_JACKPOT($points)
-{
+function ADD_JACKPOT($points) {
        $result = SQL_QUERY("SELECT points FROM "._MYSQL_PREFIX."_jackpot WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 0)
-       {
+       if (SQL_NUMROWS($result) == 0) {
                // Create line
                $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok','%s')", array($points), __FILE__, __LINE__);
-       }
-        else
-       {
+       } else {
                // Free memory
                SQL_FREERESULT($result);
 
@@ -1702,33 +1702,28 @@ function ADD_JACKPOT($points)
        }
 }
 //
-function SUB_JACKPOT($points)
-{
+function SUB_JACKPOT($points) {
        // First failed
        $ret = "-1";
 
        // Get current points
        $result = SQL_QUERY("SELECT points FROM "._MYSQL_PREFIX."_jackpot WHERE ok='ok' LIMIT 1", __FILE__, __LINE__);
-       if (SQL_NUMROWS($result) == 0)
-       {
+       if (SQL_NUMROWS($result) == 0) {
                // Create line
-               $result = SQL_QUERY("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok', 0.00000)", __FILE__, __LINE__);
-       }
-        else
-       {
-               // Free memory
-               SQL_FREERESULT($result);
-
+               SQL_QUERY("INSERT INTO "._MYSQL_PREFIX."_jackpot (ok, points) VALUES ('ok', 0.00000)", __FILE__, __LINE__);
+       } else {
                // Read points
                list($jackpot) = SQL_FETCHROW($result);
-               if ($jackpot >= $points)
-               {
+               if ($jackpot >= $points) {
                        // Update points when there are enougth points in jackpot
-                       $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points-%s WHERE ok='ok' LIMIT 1",
+                       SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_jackpot SET points=points-%s WHERE ok='ok' LIMIT 1",
                                array($points), __FILE__, __LINE__);
                        $ret = $jackpot - $points;
-               }
+               } // END - if
        }
+
+       // Free memory
+       SQL_FREERESULT($result);
 }
 //
 function IS_DEMO() {
@@ -1796,8 +1791,7 @@ function GET_WHAT($modCheck) {
        return $wht;
 }
 //
-function MODULE_HAS_MENU($mod, $forceDb = false)
-{
+function MODULE_HAS_MENU($mod, $forceDb = false) {
        global $cacheArray, $_CONFIG;
 
        // All is false by default