RALLYE_DELETE_EXPIRED_RALLYES();
}
-if (EXT_IS_ACTIVE("bonus")) {
- // Check for expired turbo bonus lines
- require_once(PATH."inc/libs/bonus_functions.php");
- BONUS_PURGE_EXPIRED_TURBO_BONUS();
-}
-
//
?>
define('SERVER_URL', "http://www.mxchange.org");
// Current SVN revision
-define('CURR_SVN_REVISION', "596");
+define('CURR_SVN_REVISION', "597");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='Y', locked='Y' WHERE what='beg' LIMIT 1";
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='Y', locked='Y' WHERE what='beg' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_guest_menu` SET visible='N', locked='Y' WHERE what='beg' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what IN('beg','beg2') LIMIT 2";
$SQLs[] = "UPDATE `"._MYSQL_PREFIX."_mod_reg` SET locked='Y' WHERE module='beg' LIMIT 1";
break;
{
case "register": // Do stuff when installation is running (modules.php?module=admin&action=login is called)
// SQL commands to run
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu VALUES (NULL,'email','send_bonus','Bonusmail senden',5,'Versenden Sie hier Bonus-Mails an alle Mitglieder oder nur an alle aus einer Kategorie. Es spielt keine Rolle, wie viele Mails bereits versendet worden, Sie können hier immer senden.')";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu VALUES (NULL,'main','bonus','Bonuspunkte',7,'Y','Y','', 0)";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`sort`,`descr`) VALUES ('email','send_bonus','Bonusmail senden',5,'Versenden Sie hier Bonus-Mails an alle Mitglieder oder nur an alle aus einer Kategorie. Es spielt keine Rolle, wie viele Mails bereits versendet worden, Sie können hier immer senden.')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`, `what`, `title`, `sort`, `visible`, `locked`, `counter`) VALUES ('main','bonus','Bonuspunkte',7,'Y','Y', 0)";
$SQLs[] = "DROP TABLE IF EXISTS "._MYSQL_PREFIX."_bonus";
$SQLs[] = "CREATE TABLE "._MYSQL_PREFIX."_bonus (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='bonus' LIMIT 1";
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE action='bonus' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='bonus' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE action='bonus' LIMIT 1";
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='show_bonus' LIMIT 1";
break;
case "0.2.1": // SQL queries for v0.2.1
$SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_admin_menu WHERE what='config_bonus' LIMIT 1";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu VALUES (NULL,'setup','config_bonus','Bonus-{!POINTS!}',8,'Richten Sie Bonus-{!POINTS!} ein, die beim x'ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zusätzlich bekommen, als der 10. Klick.')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu (`action`,`what`,`title`,`sort`,`descr`) VALUES VALUES ('setup','config_bonus','Bonus-{!POINTS!}',8,'Richten Sie Bonus-{!POINTS!} ein, die beim x'ten Klick auf die Mail verbucht werden sollen. Beispiele: Der 1. Klick sollte mehr {!POINTS!} zusätzlich bekommen, als der 10. Klick.')";
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD login_bonus FLOAT(20,3) NOT NULL DEFAULT 10.000";
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD turbo_bonus FLOAT(20,3) NOT NULL DEFAULT 100.000";
$SQLs[] = "ALTER TABLE "._MYSQL_PREFIX."_config ADD login_timeout BIGINT(20) UNSIGNED NOT NULL DEFAULT ".$_CONFIG['one_day']."";
case "0.2.3": // SQL queries for v0.2.3
$SQLs[] = "DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE what='bonus' LIMIT 1";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu VALUES (NULL,'main','bonus','Aktiv-Rallye',7,'Y','Y','', 0)";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_member_menu (`action`, `what`, `title`, `sort`, `visible`, `locked`, `counter`) VALUES ('main','bonus','Aktiv-Rallye',7,'Y','Y', 0)";
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Aktiv-Rallye mit Klick-Vergütung hinzugefügt.";
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET locked='Y' WHERE what='booking' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='booking' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='doubler' LIMIT 1";
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='doubler' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='doubler' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='doubler' LIMIT 1";
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='doubler' LIMIT 1";
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='holiday' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='holiday' LIMIT 1";
break;
case "update": // Update an extension
break;
case "0.1.8": // SQL queries for v0.1.8
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'list_holiday')";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'del_holiday')";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', NULL, 'config_holiday')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_holiday')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_holiday')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_holiday')";
// Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
$EXT_UPDATE_DEPENDS = "sql_patches";
}
// Version number
-$EXT_VERSION = "0.1.5";
+$EXT_VERSION = "0.1.6";
// Auto-set extension version
if (empty($EXT_VER)) $EXT_VER = $EXT_VERSION;
// Version history array (add more with , "0.1" and so on)
-$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.51", "0.0.52", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5");
+$EXT_VER_HISTORY = array("0.0", "0.0.1", "0.0.2", "0.0.3", "0.0.4", "0.0.5", "0.0.51", "0.0.52", "0.0.6", "0.0.7", "0.0.8", "0.0.9", "0.1.0", "0.1.1", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6");
switch ($EXT_LOAD_MODE)
{
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='html_mail' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='html_mail' LIMIT 1";
break;
case "update": // Update an extension
// Update notes (these will be set as task text!)
$UPDATE_NOTES = "Fehlerhinweis bei deaktivierter Erweiterung verbessert.";
break;
+
+ case "0.1.6":
+ // Dependency is needed for ext-registration!! (want to alter a non existent Table)
+ $EXT_UPDATE_DEPENDS = "bonus";
+ $UPDATE_NOTES = "Abhänigkeit von der Erweiterung <strong>bonus</strong> hinzugefügt.";
+ break;
}
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='nickname' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='nickname' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE action='online' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE action='online' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='order' LIMIT 1";
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET locked='Y' WHERE module='order' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_mod_reg SET visible='N', locked='Y' WHERE module='order' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='payout' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='payout' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='primera' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='primera' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='rallyes' LIMIT 1";
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='rallyes' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='rallyes' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='rallyes' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET locked='Y' WHERE what='refback' LIMIT 1";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', locked='Y' WHERE what='refback' LIMIT 1";
break;
case "update": // Update an extension
`fixed_reload` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
UNIQUE KEY `userid_url` (`userid`,`url`),
-INDEX `status_userid` (`status`,`userid`),
+INDEX `status_userid` (`status`,`userid`)
) TYPE=MyISAM COMMENT='Surfbar URLs'";
// Reload locks
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5";
+ $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_member_menu` SET visible='N', `locked`='Y' WHERE `action` = 'surfbar' LIMIT 5";
$SQLs[] = "UPDATE `"._MYSQL_PREFIX."_mod_reg` SET locked='Y' WHERE module='surfbar' LIMIT 1";
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='Y' WHERE what='top10' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='top10' LIMIT 1";
break;
case "update": // Update an extension
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='transfer' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='transfer' LIMIT 1";
break;
case "update": // Update an extension
break;
case "0.2.3": // SQL queries for v0.2.3
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'list_transfer')";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', NULL, 'del_transfer')";
- $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', NULL, 'config_transfer')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'list_transfer')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('member', '', 'del_transfer')";
+ $SQLs[] = "INSERT INTO "._MYSQL_PREFIX."_admin_menu_las (la_id, la_action, la_what) VALUES ('config', '', 'config_transfer')";
// Depends on sql_patches (or you have to execute these both SQL statements by phpMyAdmin
$EXT_UPDATE_DEPENDS = "sql_patches";
case "activate": // Do stuff when admin activates this extension
// SQL commands to run
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1";
$SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='N' WHERE what='wernis' LIMIT 1";
break;
case "deactivate": // Do stuff when admin deactivates this extension
// SQL commands to run
- $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='Y', locked='Y' WHERE what='wernis' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_guest_menu SET visible='N', locked='Y' WHERE what='wernis' LIMIT 1";
+ $SQLs[] = "UPDATE "._MYSQL_PREFIX."_member_menu SET visible='N', locked='Y' WHERE what='wernis' LIMIT 1";
break;
case "update": // Update an extension
require($INC);
}
+// Init variables
+$bsent = 0; $bclicks = 0; $bcount = 0;
+
// Check for normal mails
$result_media = SQL_QUERY("SELECT SUM(max_rec) AS max_rec, SUM(clicks) AS clicks
FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);
$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_user_stats", __FILE__, __LINE__);
list($ncount) = SQL_FETCHROW($result_media);
SQL_FREERESULT($result_media);
-$result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);
-list($bcount) = SQL_FETCHROW($result_media);
-SQL_FREERESULT($result_media);
// Check for bonus extension
-if (EXT_IS_ACTIVE("bonus"))
-{
+if (EXT_IS_ACTIVE("bonus")) {
+ // Count bonus mails
+ $result_media = SQL_QUERY("SELECT COUNT(id) FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);
+ list($bcount) = SQL_FETCHROW($result_media);
+ SQL_FREERESULT($result_media);
+
// Check for bonus mails
$result_media = SQL_QUERY("SELECT SUM(mails_sent) AS bonus_sent, SUM(clicks) AS bonus_clicks
FROM "._MYSQL_PREFIX."_bonus", __FILE__, __LINE__);
list($bsent, $bclicks) = SQL_FETCHROW($result_media);
if (empty($bsent)) $bsent = 0;
if (empty($bclicks)) $bclicks = 0;
-}
- else
-{
- // Not found!
- $bsent = 0; $bclicks = 0;
-}
+} // END - if
// Load (maybe) missing file
require_once(PATH."inc/libs/mediadata_functions.php");
} else {
$next++;
}
- }
+ } // END - if
//* DEBUG: */ echo "WRITE: <font color=\"green\">".htmlentities($line)."</font><br />\n";
fputs($fp_tmp, $line);
- }
+ } // END - while
fclose($fp_tmp);
// Finished writing tmp file
$done = true;
- }
+ } // END - if
// Close source directory
fclose($fp);
} else {
OUTPUT_HTML("<STRONG>TMP:</STRONG> UNDONE!");
}
- }
+ } // END - if
} else {
OUTPUT_HTML("<STRONG>404:</STRONG> ".$file."<br />");
}
// Hostname not set
OUTPUT_HTML(INSTALL_SMTP_HOSTNAME_EMPTY."<br />");
$_GET['page'] = 3;
- }
+ } // END - if
if ((empty($_POST['smtp_pass1'])) && (!empty($_POST['smtp_pass2']))) {
// Password is empty
OUTPUT_HTML(INSTALL_SMTP_PASS1_EMPTY."<br />");
$_GET['page'] = 3;
- }
+ } // END - if
if ((!empty($_POST['smtp_pass1'])) && (empty($_POST['smtp_pass2']))) {
// Password repeat is empty
OUTPUT_HTML(INSTALL_SMTP_PASS2_EMPTY."<br />");
$_GET['page'] = 3;
- }
+ } // END - if
if ($_POST['smtp_pass1'] != $_POST['smtp_pass1']) {
// Passwords are not matching
OUTPUT_HTML(INSTALL_SMTP_PASS_MISMATCH."<br />");
$_GET['page'] = 3;
- }
-}
+ } // END - if
+} // END - if
// Is MXChange installed or no admin registered so far?
if ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered')))
// And split it up against ;\n ...
$SQLs = array_merge($SQLs, explode(";\n", $sql));
- }
- }
+ } // END - if
+ } // END - foreach
// Are some SQLs found?
if (count($SQLs) == 0) {
// Abort here
ADD_FATAL(INSTALL_SQL_IMPORT_FAILED);
return;
- }
+ } // END - if
// Now run all queries through and try to keep out empty or comment queries
foreach ($SQLs as $sql) {
if ((!empty($sql)) && (substr($sql, 0, 2) != "--") && (substr($sql, 0, 1) != "#")) {
// Then run it!
SQL_QUERY($sql, __FILE__, __LINE__);
- }
- }
+ } // END - if
+ } // END - foreach
// Ok, all done. So we can write the config data to the php files
if ($_POST['spath'] != PATH) install_WriteData($_POST['spath']."inc/config.php", "SERVER-PATH", "define('PATH', \"", "\");", $_POST['spath'], 0);
// Close the link
SQL_CLOSE($link, __FILE__, __LINE__);
- }
- else
- {
+ } else {
// Installation area not found!
ADD_FATAL(INSTALL_MISSING_DUMPS);
}
- }
- }
- if ((sizeof($FATAL) > 0) || ((isset($FATAL[0])) && ($FATAL[0] != '')))
- {
+ } // END - if
+ } // END - if
+
+ if ((sizeof($FATAL) > 0) || ((isset($FATAL[0])) && ($FATAL[0] != ''))) {
$OUT = "";
- foreach ($FATAL as $value)
- {
+ foreach ($FATAL as $value) {
$OUT .= " <LI>".$value."</LI>\n";
- }
+ } // END foreach
define('__FATAL_ERROR_LI', $OUT);
$OUT = "";
- foreach ($mysql as $key => $value)
- {
+ foreach ($mysql as $key => $value) {
$OUT .= " <INPUT type=\"hidden\" name=\"mysql[".$key."]\" value=\"".$value."\">\n";
- }
+ } // END foreach
define('__MYSQL_DATA' , $OUT);
define('__SPATH_VALUE' , $_POST['spath']);
define('__BURL_VALUE' , $_POST['burl']);
</TR>
</TABLE>
</FORM>");
- }
- else
- {
+ } else {
// Installation is done!
- $URL = $burl."/install.php?page=finalize";
- LOAD_URL($URL);
+ LOAD_URL($burl."/install.php?page=finalize");
}
- }
- elseif (isBooleanConstantAndTrue('mxchange_installed'))
- {
+ } elseif (isBooleanConstantAndTrue('mxchange_installed')) {
// Redirection after writing data... :-)
LOAD_TEMPLATE("install_finished");
- }
- else
- {
+ } else {
// Something goes wrong during installation! :-(
ADD_FATAL(INSTALL_FINALIZER_FAILED);
include ("inc/fatal_errors.php");
OUTPUT_HTML(" <STRONG class=\"install_error\">".WRONG_PAGE."</STRONG>");
break;
}
-}
- else
-{
+} else {
ADD_FATAL(ALREADY_INSTALLED);
}
//
}
// This function must be run *BEFORE* a link is removed from table 'mxchange_user_links' !
-function BONUS_ADD_TURBO_POINTS($mid, $uid, $type)
-{
+function BONUS_ADD_TURBO_POINTS($mid, $uid, $type) {
global $_CONFIG;
// Shall we add bonus points?
- if ($_CONFIG['bonus_active'] == "N") return;
+ if ($_CONFIG['bonus_active'] == "N") return false;
+
+ // Init variables
+ $SQL = ""; $bonys = 0; $mail = 0; $column = "";
// Select SQL command
- $SQL = "";
switch ($type)
{
case "bonusid":
- $result = SQL_QUERY_ESC("SELECT clicks FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
- array($mid), __FILE__, __LINE__);
- $bonus = $mid; $mail = 0;
+ $column = "bonus_id";
+ $bonus = $mid;
break;
case "mailid" :
- $result = SQL_QUERY_ESC("SELECT clicks FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1",
- array($mid), __FILE__, __LINE__);
- $bonus = 0; $mail = $mid;
+ $column = "mail_id";
+ $mail = $mid;
+ break;
+
+ default:
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid type %s detected.", $type));
break;
}
+ // Is a column name set?
+ if (empty($column)) {
+ // No, then abort here
+ return false;
+ } // END - if
+
+ // Check for entry
+ $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_bonus_turbo WHERE userid=%s AND %s=%s LIMIT 1",
+ array($uid, $column, $mid), __FILE__, __LINE__);
+
// Load clicks from table as current rank
list($rank) = SQL_FETCHROW($result);
- if ($rank == 1)
- {
+ // Add one line
+ $rank++;
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Which rank?
+ if ($rank == 1) {
// First rank!
- $rank = 1;
$points = $_CONFIG['turbo_bonus'];
- }
- else
- {
+ } else {
// Anything else so let's explode all entered rank points
$test = explode(";", $_CONFIG['turbo_rates']);
- if (!empty($test[$rank - 2]))
- {
+ if (!empty($test[$rank - 2])) {
// Level found
$points = $test[$rank - 2];
- }
- else
- {
+ } else {
// Level not found!
$points = "0.00000";
}
// Add points to his account directly
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET turbo_bonus=turbo_bonus+".$points." WHERE userid=%s LIMIT 1",
- array(bigintval($uid)), __FILE__, __LINE__);
+ array(bigintval($uid)), __FILE__, __LINE__);
// Rember this whole data for displaying ranking list
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus_turbo (userid, mail_id, bonus_id, level, points, timemark) VALUES ('%s', '%s', '%s', '".$rank."', '".$points."', UNIX_TIMESTAMP())",
- array(bigintval($uid), bigintval($mail), bigintval($bonus)), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_bonus_turbo (userid, mail_id, bonus_id, level, points, timemark) VALUES ('%s', '%s', '%s', '%s', '%s', UNIX_TIMESTAMP())",
+ array(bigintval($uid), bigintval($mail), bigintval($bonus), $rank, $points), __FILE__, __LINE__);
if ((GET_EXT_VERSION("bonus") >= "0.3.5") && ($_CONFIG['bonus_mode'] != "ADD") && ($points > 0)) BONUS_POINTS_HANDLER($points);
}
//
-function BONUS_MAKE_RANK_ROWS($data, $type, $uid)
-{
+function BONUS_MAKE_RANK_ROWS ($data, $type, $uid) {
global $_CONFIG;
$self = false; $OUT = "";
// Load current user's data
$result = SQL_QUERY_ESC("SELECT level, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND userid=%s LIMIT 1",
- array($type, $data, $uid), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array($type, $data, $uid), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Load data
list($rank, $points, $mark) = SQL_FETCHROW($result);
// Load template
define('__YOUR_RANKING_LINE', LOAD_TEMPLATE("show_bonus_yr", true));
- }
+ } // END - if
// Load rankings
$result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s ORDER BY level LIMIT %s",
- array($type, $data, $_CONFIG['bonus_lines']), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0)
- {
+ array($type, $data, $_CONFIG['bonus_lines']), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) > 0) {
// Start generating the ranking list
$max = SQL_NUMROWS($result);
$SW = 2;
- for ($rank = 1; $rank <= $max; $rank++)
- {
+ for ($rank = 1; $rank <= $max; $rank++) {
// Load data
- $result_users = SQL_QUERY_ESC("SELECT userid, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND level='%s' LIMIT 1",
- array($type, $data, $rank), __FILE__, __LINE__);
- list($userid, $points, $mark) = SQL_FETCHROW($result_users);
+ $result_users = SQL_QUERY_ESC("SELECT userid, points, timemark FROM "._MYSQL_PREFIX."_bonus_turbo WHERE %s=%s AND level=%s LIMIT 1",
+ array($type, $data, $rank), __FILE__, __LINE__);
+
+ // Nothing found by default
+ $userid = "---"; $points = "---";
// Are you one of them?
- if (empty($userid))
- {
- // Nothing found
- $userid = "---"; $points = "---";
- }
- else
- {
+ if (SQL_NUMROWS($result_users) == 1) {
+ // Load data
+ list($userid, $points, $mark) = SQL_FETCHROW($result_users);
+
// Translate comma
$points = TRANSLATE_COMMA($points);
- }
+ } // END - if
// Output row
$OUT .= "<TR>
<TD class=\"bonus_rank_".$rank." bottom2 switch_sw".$SW."\" align=\"center\">".$points."</TD>
</TR>\n";
$SW = 3 - $SW;
- }
- if (!$self)
- {
+ } // END - for
+
+ if (!$self) {
// If current user was not found set constant
define('__YOUR_RANKING_LINE', BONUS_RANK_YOU_ARE_NOT_FOUND);
- }
- }
- else
- {
+ } // END - if
+ } else {
// No entries found!
$OUT = "<TR>
<TD colspan=\"3\" align=\"center\" height=\"30\" class=\"bottom2\">
list($refid) = SQL_FETCHROW($result);
// Reset this user's counter
- SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_iser_data` SET `rand_confirmed`=0 WHERE userid=%s LIMIT 1",
+ SQL_QUERY_ESC("UPDATE `"._MYSQL_PREFIX."_user_data` SET `rand_confirmed`=0 WHERE userid=%s LIMIT 1",
array($refid), __FILE__, __LINE__);
} // END - if
if (($CSS == 1) || (!defined('__DAILY_RESET'))) return;
//* DEBUG: */ echo basename(__FILE__)."<br />\n";
+// Purge expired entries in _bonus_turbo
+BONUS_PURGE_EXPIRED_TURBO_BONUS();
+
// Reset accounts
$result = SQL_QUERY("UPDATE "._MYSQL_PREFIX."_user_data SET turbo_bonus=0, login_bonus=0, bonus_order=0, bonus_stats=0, bonus_ref=0",
__FILE__, __LINE__);
// Load the required file(s)
require("inc/config.php");
-if (isBooleanConstantAndTrue('mxchange_installed'))
-{
+if (isBooleanConstantAndTrue('mxchange_installed')) {
// Is the extension active
if (!EXT_IS_ACTIVE("mailid", true)) {
// Is not activated/installed yet!
- ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "register"));
- }
+ ADD_FATAL(sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid"));
+ } // END - if
// Secure all data
$url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = "";
if (!empty($_GET['mode'])) $mode = $_GET['mode'];
// 01 1 12 2 2 21 1 2 2 10
- if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0))
- {
+ if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (count($FATAL) == 0)) {
+ // No image? Then output header
if ($mode != "img") require_once(PATH."inc/header.php");
// Maybe he wants to confirm an email?
- if ($url_mid > 0)
- {
+ if ($url_mid > 0) {
$result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s AND userid=%s LIMIT 1",
array($url_mid, $url_uid), __FILE__, __LINE__);
$type = "mailid"; $DATA = $url_mid;
- }
- elseif ($url_bid > 0)
- {
+ } elseif ($url_bid > 0) {
$result = SQL_QUERY_ESC("SELECT id, link_type FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s AND userid=%s LIMIT 1",
array($url_bid, $url_uid), __FILE__, __LINE__);
$type = "bonusid"; $DATA = $url_bid;
}
- if (SQL_NUMROWS($result) == 1)
- {
+
+ if (SQL_NUMROWS($result) == 1) {
// Is the stats ID valid?
list($lid, $ltype) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
{
case "NORMAL":
$result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM "._MYSQL_PREFIX."_user_stats WHERE id=%s LIMIT 1",
- array($url_mid), __FILE__, __LINE__);
+ array($url_mid), __FILE__, __LINE__);
break;
case "BONUS":
$result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
- array($url_bid), __FILE__, __LINE__);
+ array($url_bid), __FILE__, __LINE__);
break;
}
- if (SQL_NUMROWS($result_mailid) == 1)
- {
+
+ // Entry found?
+ if (SQL_NUMROWS($result_mailid) == 1) {
+ // Load data
list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid);
// Correct notification switch in non-bonus mails
// Is the user's ID unlocked?
$result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array($url_uid), __FILE__, __LINE__);
+ if (SQL_NUMROWS($result) == 1) {
// Load data
list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result);
+
+ // Free some memory
SQL_FREERESULT($result);
- if ($status == "CONFIRMED")
- {
+ if ($status == "CONFIRMED") {
// Update last activity
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET last_online=UNIX_TIMESTAMP(), last_module='mailid_top' WHERE userid=%s LIMIT 1",
- array($url_uid), __FILE__, __LINE__);
+ array($url_uid), __FILE__, __LINE__);
// User has confirmed his account so we can procede...
switch ($ltype)
{
case "NORMAL":
$result = SQL_QUERY_ESC("SELECT payment_id FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1",
- array(bigintval($pool)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array(bigintval($pool)), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
list($pay) = SQL_FETCHROW($result);
$time = GET_PAY_POINTS($pay, "time");
$payment = GET_PAY_POINTS($pay, "payment");
$VALID = true;
- }
+ } // END - if
// Free memory...
SQL_FREERESULT($result);
case "BONUS":
$result = SQL_QUERY_ESC("SELECT time, points FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
- array(bigintval($pool)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ array(bigintval($pool)), __FILE__, __LINE__);
+
+ // Entry found?
+ if (SQL_NUMROWS($result) == 1) {
list($time, $payment) = SQL_FETCHROW($result);
$VALID = true;
}
SQL_FREERESULT($result);
break;
}
- if ($VALID)
- {
+
+ // Is this entry valid?
+ if ($VALID) {
if (($time == "0") && ($payment > 0)) $time = "1";
- if (($time > 0) && ($payment > 0))
- {
- if (!empty($code))
- {
+ if (($time > 0) && ($payment > 0)) {
+ if (!empty($code)) {
// Generate code
$img_code = GEN_RANDOM_CODE($_CONFIG['code_length'], $code, $url_uid, $DATA);
- }
+ } // END - if
- switch ($mode)
- {
+ switch ($mode) {
case "add":
// Init stats data
$stats_data = 0;
{
case "NORMAL":
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
- array($url_mid), __FILE__, __LINE__);
+ array($url_mid), __FILE__, __LINE__);
// Update mediadata as well
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
case "BONUS":
$result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1",
- array($url_bid), __FILE__, __LINE__);
+ array($url_bid), __FILE__, __LINE__);
// Update mediadata as well
if (GET_EXT_VERSION("mediadata") >= "0.0.4") {
else OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (5)</STRONG>");
}
else OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (4)</STRONG>");
- }
- else
- {
+ } else {
SQL_FREERESULT($result);
OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (3)</STRONG>");
}
- }
- else
- {
+ } else {
SQL_FREERESULT($result);
OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (2)</STRONG>");
}
- }
- else
- {
+ } else {
SQL_FREERESULT($result);
OUTPUT_HTML("<STRONG class=\"member_failed\">".MAIL_ALREADY_CONFIRMED." (1)</STRONG>");
}
- if ($mode != "img")
- {
+
+ // Insert footer if no image
+ if ($mode != "img") {
// Write footer
require_once(PATH."inc/footer.php");
- }
+ } // END - if
}
-}
- elseif ($mode != "img")
-{
+} elseif ($mode != "img") {
// You have to configure first!
LOAD_URL("install.php");
}
// Init "action" and "what"
global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set this because we have no module in URI
$GLOBALS['module'] = "show_bonus"; $CSS = 0;
if (($_GET['uid'] > 0) && ($_GET['d'] > 0) && (!empty($_GET['t']))) {
// Set row name
$t = "";
- switch ($_GET['t'])
- {
- case "bonusid":
- $t = "bonus_id";
- break;
-
- case "mailid":
- $t = "mail_id";
- break;
- }
+ switch ($_GET['t']) {
+ case "bonusid": // Bonus mail
+ $t = "bonus_id";
+ break;
+
+ case "mailid": // Regular member mail
+ $t = "mail_id";
+ break;
+
+ default: // Invalid type
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", $_GET['t']));
+ break;
+ } // END - switch
// Valid type?
if (!empty($t)) {
FROM "._MYSQL_PREFIX."_user_data AS d
RIGHT JOIN "._MYSQL_PREFIX."_bonus_turbo AS b
ON d.userid=b.userid
-WHERE d.status='CONFIRMED' AND d.userid=%s AND b.".$t."='%s' LIMIT 1",
- array(bigintval($_GET['uid']), bigintval($_GET['d'])), __FILE__, __LINE__);
+WHERE d.status='CONFIRMED' AND d.userid=%s AND b.%s=%s
+LIMIT 1",
+ array(bigintval($_GET['uid']), $t, bigintval($_GET['d'])), __FILE__, __LINE__);
+
+ // Entry found?
if (SQL_NUMROWS($result) == 1) {
// Load data
- list($gender, $sname, $fname, $level, $points) = SQL_FETCHROW($result);
+ $content = SQL_FETCHARRAY($result);
// Prepare constants for the pre-template
- define('__GENDER' , TRANSLATE_GENDER($gender));
- define('__SNAME' , $sname);
- define('__FNAME' , $fname);
- define('__RANK' , $level);
- define('__POINTS' , $points);
- define('__MAILID' , $_GET['d']);
+ define('__GENDER' , TRANSLATE_GENDER($content['gender']));
+ define('__SNAME' , $content['surname']);
+ define('__FNAME' , $content['family']);
+ define('__RANK' , BIGINTVAL($content['level']));
+ define('__POINTS' , TRANSLATE_COMMA($content['points']));
+ define('__MAILID' , bigintval($_GET['d']));
define('__RANK_ROWS', BONUS_MAKE_RANK_ROWS(bigintval($_GET['d']), $t, bigintval($_GET['uid'])));
// Constant created within previous function which contains informations for current user's ranking position:
define('__BONUS_MSG', LOAD_TEMPLATE("show_bonus_msg", true));
} else {
// No data found
- define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</FONT>");
+ define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_NO_DATA."</span>");
}
// Free memory
SQL_FREERESULT($result);
} else {
// Wrong type entered
- define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</FONT>");
+ define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_TYPE."</span>");
}
} else {
// Wrong call!
- define('__BONUS_MSG', "<FONT class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</FONT>");
+ define('__BONUS_MSG', "<span class=\"guest_failed\">".BONUS_SHOW_WRONG_CALL."</span>");
}
// Load send_bonus header template (for your banners, e.g.?)