return $OUT;
}
//
-function BONUS_POINTS_HANDLER($MODE)
-{
+function BONUS_POINTS_HANDLER($MODE) {
global $_CONFIG;
// Shall we add bonus points?
if ($_CONFIG['bonus_active'] == "N") return;
// Switch to jackpot-mode when no UID is supplied but userid-mode is selected
- if (($_CONFIG['bonus_mode'] == "UID") && ($_CONFIG['bonus_uid'] == "0")) $_CONFIG['bonus_mode'] = "JACKPOT";
+ if (($_CONFIG['bonus_mode'] == "UID") && ($_CONFIG['bonus_uid'] == "0")) {
+ // Update database
+ UPDATE_CONFIG(array('bonus_mode'), array("JACKPOT"));
- if ($MODE == "login_bonus")
- {
+ // Update configuration
+ $_CONFIG['bonus_mode'] = "JACKPOT";
+ } // END - if
+
+ if ($MODE == "login_bonus") {
// Login bonus detected
$points = $_CONFIG['login_bonus'];
- }
- else
- {
+ } else {
// Direct points supplied
$points = $MODE;
}
// Probe for last online timemark
$probe = time() - $online;
if (!empty($login)) $probe = time() - $login;
- if ((GET_EXT_VERSION("bonus") >= "0.2.2") && ($probe >= $_CONFIG['login_timeout'])) {
+ //if ((GET_EXT_VERSION("bonus") >= "0.2.2") && ($probe >= $_CONFIG['login_timeout'])) {
+ if (true) {
// Add login bonus to user's account
$ADD = sprintf(", login_bonus=login_bonus+%s",
(float)$_CONFIG['login_bonus']
// Cookies not setable!
$URL = URL."/modules.php?module=index&what=login&login=".CODE_NO_COOKIES;
}
- } else {
+ } elseif (GET_EXT_VERSION("sql_patches") >= "0.4.7") {
// Update failture counter
SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET login_failtures=login_failtures+1,last_failture=NOW() WHERE userid=%s LIMIT 1",
array($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);
}
}
//
-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() {
return $wht;
}
//
-function MODULE_HAS_MENU($mod, $forceDb = false)
-{
+function MODULE_HAS_MENU($mod, $forceDb = false) {
global $cacheArray, $_CONFIG;
// All is false by default