inc/gen_refback.php -text
inc/gen_sql_patches.php -text
inc/header.php -text
+inc/img/.htaccess -text
inc/install-inc.php -text
inc/js/.htaccess -text
inc/language.php -text
install/menu-de.sql -text
install/menu-en.sql -text
install/tables.sql -text
+/js.php -text
/lead-confirm.php -text
/login.php -text
/mailid.php -text
<?php
/************************************************************************
- * MXChange v0.2.1 Start: 10/12/2003 *
- * =============== Last change: 10/12/2004 *
+ * MXChange v0.2.1 Start: 10/16/2008 *
+ * =============== Last change: 10/16/2008 *
* *
* -------------------------------------------------------------------- *
* File : img.php *
// Load the required file(s)
require ("inc/config.php");
-if (isBooleanConstantAndTrue('mxchange_installed'))
-{
- if (!empty($_GET['code']))
- {
+// Script installed?
+if (isBooleanConstantAndTrue('mxchange_installed')) {
+ // Code set?
+ if (!empty($_GET['code'])) {
// Generate image
GENERATE_IMAGE(bigintval($_GET['code']));
+ } elseif (!empty($_GET['tag'])) {
+ // Tag set so create FQFN
+ $fqfn = sprintf("%sinc/img/tag-%s.php",
+ PATH,
+ SQL_ESCAPE($_GET['tag'])
+ );
+
+ // Include is readable?
+ if (FILE_READABLE($fqfn)) {
+ // Include it
+ require($fqfn);
+ } // END - if
}
-}
- else
-{
+} else {
// You have to configure first!
LOAD_URL("install.php");
}
define('SERVER_URL', "http://www.mxchange.org");
// This current patch level
-define('CURR_SVN_REVISION', "515");
+define('CURR_SVN_REVISION', "516");
// Take a prime number which is long (if you know a longer one please try it out!)
define('_PRIME', 591623);
ORDER BY d.timemark
LIMIT %d", array($DOUBLER_POINTS, $min, $_CONFIG['doubler_max_sent']), __FILE__, __LINE__);
-if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) || ((SQL_NUMROWS($result_main) == $_CONFIG['doubler_group_sent']) && ($_CONFIG['doubler_sent_all'] == "N")))
-{
+if (((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) || ((SQL_NUMROWS($result_main) == $_CONFIG['doubler_group_sent']) && ($_CONFIG['doubler_sent_all'] == "N"))) {
// Switch to matching SQL resource
$result_load = $result_main;
if ((SQL_NUMROWS($result_total) > 0) && ($_CONFIG['doubler_sent_all'] == "Y")) $result_load = $result_total;
// At least one account was found
- while(list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load))
- {
+ while(list($id, $uid, $points, $ip, $time) = SQL_FETCHROW($result_load)) {
// Only double when points are enougth!
- if ($DOUBLER_POINTS >= $points)
- {
+ if ($DOUBLER_POINTS >= $points) {
// Check for his ref points
- $result_ref = SQL_QUERY_ESC("SELECT SUM(points) FROM "._MYSQL_PREFIX."_doubler WHERE refid=%s AND completed='N' AND is_ref='Y'",
- array(bigintval($uid)), __FILE__, __LINE__);
- list($ref) = SQL_FETCHROW($result_ref);
-
- // Free memory
- SQL_FREERESULT($result_ref);
+ $ref = GET_TOTAL_DATA($uid, "doubler", "points", "refid", false, " AND completed='N' AND is_ref='Y'");
// Zero refid when empty (might be helpful!)
if (empty($ref)) $ref = 0;
- if (($ref > 0) && ($DOUBLER_UID == $uid) && (!empty($ref)))
- {
+ if (($ref > 0) && ($DOUBLER_UID == $uid) && (!empty($ref))) {
// Referal points found so add them and set line(s) to completed='Y'
$points += $ref;
$result_ref = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_doubler SET completed='Y' WHERE refid=%s AND completed='N' AND is_ref='Y'",
array(bigintval($uid)), __FILE__, __LINE__);
- }
- else
- {
+ } else {
// No referal points found
$ref = 0;
}
$OK = false;
// Check for jackpot inclusion in doubling process
- if (($jackpot > 0) && ($jackpot >= $points) && ($_CONFIG['doubler_jackpot'] == "Y"))
- {
+ if (($jackpot > 0) && ($jackpot >= $points) && ($_CONFIG['doubler_jackpot'] == "Y")) {
// Subtract points from jackpot
SUB_JACKPOT($points);
$jackpot -= $points;
// Okay, done!
$OK = true;
- }
+ } // END - if
// Exclude also webmaster's ID in taking points from webmaster's account
- if (($user > 0) && ($user >= $points) && (!$OK) && ($_CONFIG['doubler_uid'] > 0) && ($uid != $_CONFIG['doubler_uid']))
- {
+ if (($user > 0) && ($user >= $points) && (!$OK) && ($_CONFIG['doubler_uid'] > 0) && ($uid != $_CONFIG['doubler_uid'])) {
// Add points to used points
SUB_POINTS($_CONFIG['doubler_uid'], $points);
// Okay, done!
$OK = true;
- }
+ } // END - if
// Update doubler's account only when others are not updated
if (!$OK) {
--- /dev/null
+Deny from all
\ No newline at end of file
define('ADMIN_BEG_PAY_MODE_BOTH', "Durch beides obriges absichern");
define('ADMIN_BEG_PAY_MODE_NONE', "Keine Absicherung (unsicher)");
+// More strings for beg link
+define('BEG_LINK_PAY_BOTH_1', "Das Mitglied <strong>");
+define('BEG_LINK_PAY_BOTH_2', "</strong> hat bei Ihnen gerade <strong>");
+define('BEG_LINK_PAY_BOTH_3', " {!POINTS!}</strong> erbettelt. Dies war der <strong>");
+define('BEG_LINK_PAY_BOTH_4', ".</strong> Klick auf seinen Bettellink. Vielen Dank für Ihre Spende!");
+
// Begging rallye
define('BEG_RANK', "Bettel-Rank");
define('BEG_TOTAL', "Gesamt erbettelt");
$msg_user = LOAD_EMAIL_TEMPLATE("order-deleted", array(), $sender);
SEND_EMAIL($sender, MEMBER_ORDER_DELETED, $msg_user);
- // Delete mail from queue
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1",
- array(bigintval($_GET['mid'])), __FILE__, __LINE__);
-
// Fetch right stats_id from pool
- $result = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s
+ $result_pool = SQL_QUERY_ESC("SELECT s.id FROM "._MYSQL_PREFIX."_user_stats AS s
LEFT JOIN "._MYSQL_PREFIX."_pool AS p
ON s.pool_id=p.id
WHERE s.pool_id=%s LIMIT 1",
array(bigintval($_GET['mid'])), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1) {
+ if (SQL_NUMROWS($result_pool) == 1) {
// Fetch stats id
- list($stats_id) = SQL_FETCHROW($result);
-
- // Free the result
- SQL_FREERESULT($result);
+ list($stats_id) = SQL_FETCHROW($result_pool);
// Get all user links
- $result = SQL_QUERY_ESC("SELECT COUNT(id) AS 'cnt' FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
- array(bigintval($stats_id)), __FILE__, __LINE__);
-
- // Get unconfirmed links for calculation of total points
- list($links) = SQL_FETCHROW($result);
+ $links = GET_TOTAL_DATA($stats_id, "user_links", "userid", "stats_id", true);
- // Free result
- SQL_FREERESULT($result);
+ // Reset sent mails for recipient(s)
+ REDUCT_RECIPIENT_RECEIVED_MAILS("stats_id", $_GET['mid'], $links);
// Calc total points and pay them back
$totalPoints = $links * $price;
if ($_CONFIG['repay_deleted_mails'] == "JACKPOT") {
// Set jackpot
$sender = 0;
- }
+ } // END - if
// Pay back points
//* DEBUG: */ echo "PAYBACK:".$sender."<br />\n";
if ($_CONFIG['repay_deleted_mails'] == 'REPAY') {
// Repayed
LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_REPAYED,
- number_format($totalPoints, 0, ",", ".")
+ TRANSLATE_COMMA($totalPoints)
));
} else {
// To jackpot
LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_TO_JACKPOT,
- number_format($totalPoints, 0, ",", ".")
+ TRANSLATE_COMMA($totalPoints)
));
}
} else {
LOAD_TEMPLATE("admin_settings_saved", false, sprintf(ADMIN_POINTS_SHREDDED, $totalPoints));
}
+ // Delete mail from queue
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_pool WHERE id=%s LIMIT 1",
+ array(bigintval($_GET['mid'])), __FILE__, __LINE__);
+
// Remove links from DB
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
- array(bigintval($stats_id)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE stats_id=%s",
+ array(bigintval($stats_id)), __FILE__, __LINE__);
// Output link for manually removing stats entry
LOAD_TEMPLATE("admin_settings_saved", false, "<A href=\"".URL."/modules.php?module=admin&what=del_email&pid=".bigintval($_GET['mid'])."\">".ADMIN_REMOVE_STATS_ENTRY."</A>");
}
+
+ // Free the result
+ SQL_FREERESULT($result_pool);
} else {
// Mail already deleted!
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NORMAL_MAIL_ALREADY_DELETED);
} elseif (!empty($_GET['pid'])) {
// Remove stats entries
$result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_stats WHERE pool_id=%s LIMIT 1",
- array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+ array(bigintval($_GET['pid'])), __FILE__, __LINE__);
+
+ // Output message
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_USER_STATS_REMOVED);
} elseif ((!empty($_GET['bid'])) && (EXT_IS_ACTIVE("bonus"))) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp, mails_sent FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
+ array(bigintval($_GET['bid'])), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
// Load data
- list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
+ list ($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
+
+ // Reset sent mails for recipient(s)
+ REDUCT_RECIPIENT_RECEIVED_MAILS ("bonus_id", $_GET['bid'], $sent);
// Delete bonus mail entirely from database
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s",
- array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_bonus WHERE id=%s LIMIT 1",
+ array(bigintval($_GET['bid'])), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_user_links WHERE bonus_id=%s",
+ array(bigintval($_GET['bid'])), __FILE__, __LINE__);
// Prepare data for the template
define('__ID' , $id);
// Mail already deleted!
LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_BONUS_MAIL_ALREADY_DELETED);
}
+
+ // Free result
+ SQL_FREERESULT($result);
} elseif ((!empty($_GET['nid'])) && (GET_EXT_VERSION("bonus") >= "0.8.7")) {
// Load data from bonus mail
$result = SQL_QUERY_ESC("SELECT id, subject, url, timestamp FROM "._MYSQL_PREFIX."_bonus WHERE id=%s",
define('user_max_rec', $dummy);
// Max mails per day
-$result_max = SQL_QUERY("SELECT SUM(max_mails) FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND max_mails > 0", __FILE__, __LINE__);
-list($dmy) = SQL_FETCHROW($result_max);
-SQL_FREERESULT($result_max);
-define('max', $dmy);
+define('max', GET_TOTAL_DATA("CONFIRMED", "user_data", "max_mails", "status", false, " AND `max_mails` > 0"));
// Max mails for this day
-$result_rec = SQL_QUERY("SELECT SUM(receive_mails) FROM "._MYSQL_PREFIX."_user_data WHERE status='CONFIRMED' AND receive_mails > 0", __FILE__, __LINE__);
-list($dummy) = SQL_FETCHROW($result_rec);
-define('rec', $dummy);
-SQL_FREERESULT($result_rec);
+define('rec', GET_TOTAL_DATA("CONFIRMED", "user_data", "receive_mails", "status", false, " AND `receive_mails` > 0"));
// Initial lots of variables
$bmails = 0; $sent = 0; $max = 0; $rec = 0; $clicks = 0;
if (empty($dmy)) $dmy = 0;
if (empty($dmy2)) $dmy2 = 0;
$sent += $dmy2; $clicks += $dmy;
-}
+} // END - if
define('user_stats', ($nmails + $bmails));
define('sent' , $sent);
define('RAND_NUMBER', mt_rand(1000000, 9999999));
}
} else {
+ // Add language system
+ include (PATH."inc/language.php");
+
// Wrong database?
ADD_FATAL(WRONG_DB_SELECTED);
}
} else {
+ // Add language system
+ include (PATH."inc/language.php");
+
// No link to database!
ADD_FATAL(NO_DB_LINK);
$db = false;
}
} else {
+ // Add language system
+ include (PATH."inc/language.php");
+
// Maybe you forgot to enter your MySQL data?
ADD_FATAL(MYSQL_DATA_MISSING);
}
// Return status for sending routine
return $ret;
}
-//
+
+// Calculate sum (default) or count records of given criteria
function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") {
$ret = 0;
if ($onlyRows) {
// Count rows
- $result = SQL_QUERY_ESC("SELECT COUNT(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+ $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
} else {
// Add all rows
- $result = SQL_QUERY_ESC("SELECT SUM(%s) FROM "._MYSQL_PREFIX."_%s WHERE %s='%s'%s",
+ $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s",
array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__);
}
} elseif (!EXT_IS_ACTIVE("cache")) {
// Load from database
$result_aid = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
- array(bigintval($ret)), __FILE__, __LINE__);
+ array(bigintval($aid)), __FILE__, __LINE__);
if (SQL_NUMROWS($result_aid) == 1) {
// Fetch data
list($ret) = SQL_FETCHROW($result_aid);
return $refs;
}
-//
+// Recuced the amount of received emails for the receipients for given email
+function REDUCT_RECIPIENT_RECEIVED_MAILS ($column, $id, $count) {
+ // Search for mail in database
+ $result = SQL_QUERY_ESC("SELECT `userid` FROM `"._MYSQL_PREFIX."_user_links` WHERE `%s`=%s ORDER BY `userid` ASC LIMIT %s",
+ array($column, bigintval($id), $count), __FILE__, __LINE__);
+
+ // Are there entries?
+ if (SQL_NUMROWS($result) > 0) {
+ // Now load all userids for one big query!
+ $UIDs = array();
+ while (list($uid) = SQL_FETCHROW($result)) {
+ $UIDs[$uid] = $uid;
+ } // END - while
+
+ // 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)), __FILE__, __LINE__);
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+}
+
+// [EOF]
?>
--- /dev/null
+<?php
+/************************************************************************
+ * MXChange v0.2.1 Start: 10/15/2008 *
+ * =============== Last change: 10/15/2008 *
+ * *
+ * -------------------------------------------------------------------- *
+ * File : js.php *
+ * -------------------------------------------------------------------- *
+ * Short description : Image code for multi-purposes *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung : Code-Bild fuer verschiedene Zwecke *
+ * -------------------------------------------------------------------- *
+ * *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * For more information visit: http://www.mxchange.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ************************************************************************/
+
+// Deactivate caching system in fake-CSS mode
+define('_OB_CACHING', "old");
+
+// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
+require_once("inc/libs/security_functions.php");
+
+// Init "action" and "what"
+global $what, $action;
+$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+
+// This is a fake-CSS file loader, more a JavaScript loader...
+// This is in one way good and in one not. The whole reset part will be
+// by-passed even in this "faked" CSS mode. The bad news is that this makes all
+// JS calls on this script to CSS calls. So no real "request" like in MVC
+// pattern is given...
+//
+// But mxchange 0.3.0 will show that in better way! :D :D :D
+$CSS = "1"; $GLOBALS['module'] = "js";
+
+// Load the required file(s)
+require ("inc/config.php");
+
+// Is this script installed and a JavaScript tag is provied?
+if ((isBooleanConstantAndTrue('mxchange_installed')) && (isset($_GET['tag']))) {
+ // Set header
+ @header("Content-type: text/javascript");
+
+ // Load header
+ require_once(PATH."inc/header.php");
+
+ // Prepare include file for looking
+ $fqfn = sprintf("%sinc/js/tag-%s.php",
+ PATH,
+ SQL_ESCAPE($_GET['tag'])
+ );
+
+ // Is that file readable?
+ if (FILE_READABLE($fqfn)) {
+ // Include it
+ require_once($fqfn);
+ } // END - if
+
+ // Load footer
+ require_once(PATH."inc/footer.php");
+} // END - if
+
+//
+?>