X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmysql-manager.php;h=cedb715f33342b14c6ebe456728de9474d34ae98;hp=02eeb4f87c6a07152a723363ad7dd903672be6c9;hb=43f8fab36af6c030d8835e1118cab430f8585e67;hpb=d6834211baacaa54b282898fe54dc8c1511f046b diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 02eeb4f87c..cedb715f33 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -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(""); - } + + // Output it directly + OUTPUT_HTML(""); + } // 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 @@ -1874,6 +1868,9 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") { if (($values[$idx] + 0) === $values[$idx]) { // Number detected $all .= sprintf("%s=%s,", $entry, (float)$values[$idx]); + } elseif ($values[$idx] == "UNIX_TIMESTAMP()") { + // Function UNIX_TIMESTAMP() detected + $all .= sprintf("%s=%s,", $entry, $values[$idx]); } else { // String detected $all .= sprintf("%s='%s',", $entry, SQL_ESCAPE($values[$idx])); @@ -2266,8 +2263,14 @@ ORDER BY ur.refid ASC", // Get unconfirmed mails $row['unconfirmed'] = GET_TOTAL_DATA($row['refid'], "user_links", "id", "userid", true); - // Calculate clickrate - $row['clickrate'] = ($row['mails_confirmed'] / $row['emails_received'] * 100); + // Init clickrate with zero + $row['clickrate'] = 0; + + // Is at least one mail received? + if ($row['emails_received'] > 0) { + // Calculate clickrate + $row['clickrate'] = ($row['mails_confirmed'] / $row['emails_received'] * 100); + } // END - if // Activity is "active" by default because if autopurge is not installed $row['activity'] = MEMBER_ACTIVITY_ACTIVE;