From: Roland Häder Date: Fri, 7 Nov 2008 14:38:56 +0000 (+0000) Subject: Admin user details extended, DEBUG_LOG() rewritten, random userid on refid=0 added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5f8c1a333627cd0145f778a6eebdb251f5bb40b6;p=mailer.git Admin user details extended, DEBUG_LOG() rewritten, random userid on refid=0 added --- diff --git a/click.php b/click.php index 4dd6144b67..c10ff149c3 100644 --- a/click.php +++ b/click.php @@ -54,11 +54,11 @@ if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['b } else { LOAD_URL("shop_reseller.php?reseller=".bigintval($_GET['user'])); } - } - exit(); -} else { - // Do nothing for now - die(); -} -// + } // END - if +} // END - if + +// Load index page +LOAD_URL("index.php"); + +// [EOF] ?> diff --git a/inc/databases.php b/inc/databases.php index 8ac9e4a1c6..8896da0f33 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "524"); +define('CURR_SVN_REVISION', "525"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/extensions.php b/inc/extensions.php index 8be7feba10..fee99ba7a6 100644 --- a/inc/extensions.php +++ b/inc/extensions.php @@ -367,7 +367,7 @@ function EXT_IS_ACTIVE ($ext_name) { } // Debug message - //DEBUG_LOG(__FUNCTION__.": ext_name={$ext_name},active={$active}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, " ext_name={$ext_name},active={$active}"); // Is this extension activated? (For admins we always have active extensions...) return ($active == "Y"); diff --git a/inc/extensions/ext-debug.php b/inc/extensions/ext-debug.php index 3e310c0757..642a4ff0cf 100644 --- a/inc/extensions/ext-debug.php +++ b/inc/extensions/ext-debug.php @@ -55,6 +55,8 @@ case "register": // Do stuff when installation is running (modules.php?module=ad `id` BIGINT(20) NOT NULL AUTO_INCREMENT, `sender_id` BIGINT(20) NOT NULL DEFAULT 0, `timestamp` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00', +`file` VARCHAR(255) NOT NULL DEFAULT '', +`line` MEDIUMINT NOT NOT NULL DEFAULT 0, `message` LONGTEXT, `comment` TINYTEXT, `status` ENUM('NEW','PENDING','ACCEPTED','FIXED','INVALID','DUBLICATE','SPAM') NOT NULL DEFAULT 'NEW', diff --git a/inc/extensions/ext-user.php b/inc/extensions/ext-user.php index 64a17c749f..f12042f0db 100644 --- a/inc/extensions/ext-user.php +++ b/inc/extensions/ext-user.php @@ -38,10 +38,10 @@ if (!defined('__SECURITY')) { } // Version number -$EXT_VERSION = "0.3.3"; +$EXT_VERSION = "0.3.4"; // Version history array (add more with , "0.1" and so on) -$EXT_VER_HISTORY = array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3"); +$EXT_VER_HISTORY = array("0.0", "0.1", "0.1.1", "0.1.2", "0.1.2", "0.1.3", "0.1.4", "0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.2.0", "0.2.1", "0.2.2", "0.2.3", "0.2.4", "0.2.5", "0.2.6", "0.2.7", "0.2.8", "0.2.9", "0.3.0", "0.3.1", "0.3.2", "0.3.3", "0.3.4"); switch ($EXT_LOAD_MODE) { @@ -79,7 +79,7 @@ case "update": // Update an extension break; case "0.1.1": // SQL queries for v0.1.1 - $SQLs[] = "UPDATE "._MYSQL_PREFIX."_extensions SET ext_has_css='Y' WHERE ext_name='user' AND ext_has_css='N' LIMIT 1"; + $SQLs[] = "UPDATE `"._MYSQL_PREFIX."_extensions` SET `ext_has_css`='Y' WHERE `ext_name`='user' AND `ext_has_css`='N' LIMIT 1"; // This update depends on sql_patches update! $EXT_UPDATE_DEPENDS = "sql_patches"; @@ -209,6 +209,15 @@ case "update": // Update an extension // Update notes (these will be set as task text!) $UPDATE_NOTES = "Mitglieder sind nun per Formular kontaktierbar (es wird eine EMail versendet), gesperrte und bestätigte Mitglieder-Accounts sind seperat oder gemeinsam auflistbar (seperat nur mit der Erweiterung task!)"; break; + + case "0.3.4": // SQL queries for v0.3.4 + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `select_user_zero_refid` ENUM('Y','N') NOT NULL DEFAULT 'Y'"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `user_min_confirmed` SMALLINT(5) UNSIGNED NOT NULL DEFAULT 10"; + $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_user_data` ADD `rand_confirmed` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0"; + + // Update notes (these will be set as task text!) + $UPDATE_NOTES = "Mitglieder werden per Zufall als Referal-ID ausgewählt, die eine Mindestanzahl an bestätigten Mails haben, wenn die Ref-Id 0 ist."; + break; } break; @@ -222,5 +231,5 @@ $EXT_LANG_PREFIX = "user"; // Keep this extension always active! $EXT_ALWAYS_ACTIVE = "Y"; -// +// [EOF] ?> diff --git a/inc/functions.php b/inc/functions.php index 73b15f5515..6472c60448 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -207,7 +207,7 @@ function ADD_FATAL ($message, $extra="") { } // Log fatal messages away - DEBUG_LOG(__FUNCTION__."(".__LINE__."): message={$message}"); + DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}"); } // Load a template file and return it's content (only it's name; do not use ' or ") @@ -443,7 +443,7 @@ Message : ".$MSG." \n"; // Log the mail away - if (defined('DEBUG_MAIL')) DEBUG_LOG(__FUNCTION__.":to={$TO},subject={$SUBJECT},msg={$MSG}"); + if (defined('DEBUG_MAIL')) DEBUG_LOG(__FUNCTION__, __LINE__, "to={$TO},subject={$SUBJECT},msg={$MSG}"); } elseif (($HTML == "Y") && (EXT_IS_ACTIVE("html_mail"))) { // Send mail as HTML away SEND_HTML_EMAIL($TO, $SUBJECT, $MSG, $FROM); @@ -598,7 +598,7 @@ function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) { } // END - if // Debug log - //DEBUG_LOG(__FUNCTION__.":dotted={$dotted},maxComma={$maxComma}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}"); // Translate it now switch (GET_LANGUAGE()) { @@ -1262,7 +1262,7 @@ function bigintval($num, $castValue = true) { // Has the whole value changed? if ("".$ret."" != "".$num."") { // Log the values - DEBUG_LOG(__FUNCTION__.": num={$num},ret={$ret}"); + DEBUG_LOG(__FUNCTION__, __LINE__, " num={$num},ret={$ret}"); } // END - if // Return result @@ -2362,12 +2362,12 @@ function merge_array ($array1, $array2) { die(""); } // Debug message logger -function DEBUG_LOG ($message, $force=false) { +function DEBUG_LOG ($file, $line, $message, $force=false) { // Is debug mode enabled? if ((isBooleanConstantAndTrue('DEBUG_MODE')) || ($force)) { // Log this message away $fp = fopen(PATH."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!"); - fwrite($fp, date("d.m.Y|H:i:s", time())."|".strip_tags($message)."\n"); + fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename(__FILE__)."|".__LINE__."|".strip_tags($message)."\n"); fclose($fp); } // END - if } @@ -2598,7 +2598,7 @@ function REBUILD_CACHE ($cache, $inc="") { require($fqfn); } else { // Include not found! - DEBUG_LOG(__FUNCTION__.":Include {$inc} not found. cache={$cache}"); + DEBUG_LOG(__FUNCTION__, __LINE__, "Include {$inc} not found. cache={$cache}"); } } // END - if } // END - if @@ -2613,7 +2613,7 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") { return false; } elseif (!is_object($cacheInstance)) { // No cache instance! - DEBUG_LOG(__FUNCTION__.": No cache instance found."); + DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found."); return false; } elseif ((!isset($_CONFIG['cache_admin_menu'])) || ($_CONFIG['cache_admin_menu'] == "N")) { // Caching disabled (currently experiemental!) @@ -2728,9 +2728,46 @@ function ADD_NEW_BONUS_MAIL ($data, $mode="", $output=true) { LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MORE_SELECTED); } else { // Debug log - DEBUG_LOG(__FUNCTION__."(".__LINE__."): cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!"); + DEBUG_LOG(__FUNCTION__, __LINE__, " cat={$data['cat']},receiver={$data['receiver']},data=".base64_encode(serialize($data))." More selected, than available!"); } } +// Determines referal id and sets it +function DETERMINE_REFID () { + global $_CONFIG, $CLICK, $_SERVER; + + // Check if refid is set + if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) { + // The variable user comes from the click-counter script click.php and we only accept this here + $GLOBALS['refid'] = bigintval($_GET['user']); + } elseif (!empty($_POST['refid'])) { + // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts) + $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_POST['refid'])); + } elseif (!empty($_GET['refid'])) { + // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts) + $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['refid'])); + } elseif (!empty($_GET['ref'])) { + // Set refid=ref (the referal link uses such variable) + $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['ref'])); + } elseif ((isSessionVariableSet('refid')) && (get_session('refid') != 0)) { + // Set session refid als global + $GLOBALS['refid'] = bigintval(get_session('refid')); + } elseif ((GET_EXT_VERSION("sql_patches") != "") && ($_CONFIG['def_refid'] > 0)) { + // Set default refid as refid in URL + $GLOBALS['refid'] = bigintval($_CONFIG['def_refid']); + } elseif ((GET_EXT_VERSION("user") >= "0.3.4") && ($_CONFIG['select_user_zero_refid']) == "Y") { + // Select a random user which has confirmed enougth mails + $GLOBALS['refid'] = SELECT_RANDOM_REFID(); + } else { + // No default ID when sql_patches is not installed or none set + $GLOBALS['refid'] = 0; + } + + // Set cookie when default refid > 0 + if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((get_session('refid') == "0") && (isset($_CONFIG['def_refid'])) && ($_CONFIG['def_refid'] > 0))) { + // Set cookie + set_session('refid', $GLOBALS['refid']); + } // END - if +} ////////////////////////////////////////////////// // // diff --git a/inc/language/de.php b/inc/language/de.php index cab9bc3418..1df932efdc 100644 --- a/inc/language/de.php +++ b/inc/language/de.php @@ -526,7 +526,7 @@ define('ADMIN_LAST_MODULE', "Letzte Aktion"); define('RECEIVE_MAILS', "Kann Mails empfangen"); define('REF_CLICKS', "Klicks auf Ref-Link"); define('TOTAL_LOGINS', "Logins gesamt"); -define('USED_POINTS', "Verwendete {!POINTS!}"); +define('USED_POINTS', "Ausgegebene {!POINTS!}"); define('MAILS_SENT', "Mails versendet"); define('HAS_JOINED', "Beigetreten am"); define('TOTAL_POINTS', "{!POINTS!} gesamt"); @@ -944,7 +944,7 @@ define('BONUS_EXTENSION_UPGRADE_1', "Bitte aktualisieren Sie Ihre Bonus-Erweiter define('BONUS_EXTENSION_UPGRADE_2', " oder neuer!"); define('_ON', "an"); define('CLICK_STATISTICS', "Mail-Statistik"); -define('ADMIN_SELECT_DEF_REFID', "Standart Referal-ID bei Anmeldung über keinen Ref-Link"); +define('ADMIN_SELECT_DEF_REFID', "Standart Referal-ID bei Anmeldung über keinen Ref-Link"); define('ADMIN_SELECT_REFID_TARGRT', "Ziel-Seite des Referal-Linkes"); define('ADMIN_REF_TARGET_REGISTER', "Zur Anmeldeseite"); define('ADMIN_REF_TARGET_INDEX', "Zur Eingangsseite"); @@ -1182,6 +1182,13 @@ define('MEMBER_NO_MAILS_IN_STATS', "Keine versandten Buchungen gefunden!"); define('ADMIN_RESET_PASSWORD', "Passwort vergessen?"); define('EMAIL_DETAILS', "Email-Details"); define('EMAIL_DETAILS_LINK', "Details anzeigen"); +define('ADMIN_CONFIG_REFID_TITLE', "Einstellungen zum Referal-Link"); +define('ADMIN_RANDOM_ZERO_REFID', "Soll per Zufall ein User nach folgenden Kriterien ausgewählt werden, wenn keine Standart-Refid eingestellt ist?"); +define('ADMIN_RAND_REFID_ENABLED', "Mitglieder per Zufall wählen"); +define('ADMIN_RAND_REFID_DISABLED', "Referal-Id 0 verwenden"); +define('ADMIN_RANDOM_MIN_CONFIRMED', "Wie viele bestätigte Mails muss ein Mitglied mindestens haben, um per Zufall ausgewählt zu werden?"); +define('EMAILS_RECEIVED', "Emails bereits empfangen"); +define('MAILS_CONFIRMED', "Emails bestätigt"); define('MEMBER_MAIL_BONUS_CONFIRMED_ON', "Sie haben diese Bonusmail %s bestätigt."); define('MEMBER_MAIL_NORMAL_CONFIRMED_ON', "Sie haben diese Klickmail %s bestätigt."); diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 83aa8a9e36..4f7e655790 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -123,7 +123,7 @@ function GET_REFBACK_PERCENTS ($uid, $ref) { } else { // Debug log //* DEBUG: */ print __FUNCTION__."(".__LINE__."): NO ENTRY FOUND! :-(
\n"; - DEBUG_LOG(__FUNCTION__.": uid={$uid},ref={$ref} - No entry found! :-("); + DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},ref={$ref} - No entry found! :-("); } // Free result diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 37d3c94306..9256ec8627 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -240,7 +240,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) { $performed = call_user_func_array($functionName, $urlData); } else { // Log invalid request - DEBUG_LOG(__FUNCTION__.": action={$formData['action']},id={$formData['id']},function={$functionName}"); + DEBUG_LOG(__FUNCTION__, __LINE__, " action={$formData['action']},id={$formData['id']},function={$functionName}"); } // Return status @@ -625,7 +625,7 @@ function SURFBAR_CHECK_RELOAD_FULL() { // Cache static reload lock $SURFBAR_CACHE['surf_lock'] = $_CONFIG['surfbar_static_lock']; - //DEBUG_LOG(__FUNCTION__.":Fixed surf lock is ".$_CONFIG['surfbar_static_lock'].""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".$_CONFIG['surfbar_static_lock'].""); // Do we have dynamic model? if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") { @@ -656,7 +656,7 @@ LIMIT 1", $total = SURFBAR_GET_TOTAL_URLS(); // Do we have some URLs in lock? Admins can always surf on own URLs! - //DEBUG_LOG(__FUNCTION__.":userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "userLocks=".SURFBAR_GET_DATA('user_locks').",total={$total}"); $isFull = ((SURFBAR_GET_DATA('user_locks') == $total) && ($total > 0)); // Return result @@ -764,16 +764,16 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { if (empty($salt)) { // Generate random hashed string $SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255)); - //DEBUG_LOG(__FUNCTION__.":newSalt=".SURFBAR_GET_SALT().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT().""); } else { // Use this as salt! $SURFBAR_CACHE['salt'] = $salt; - //DEBUG_LOG(__FUNCTION__.":oldSalt=".SURFBAR_GET_SALT().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "oldSalt=".SURFBAR_GET_SALT().""); } // ... and now the validation code $valCode = GEN_RANDOM_CODE($length, sha1(SURFBAR_GET_SALT().":".$urlId), $GLOBALS['userid']); - //DEBUG_LOG(__FUNCTION__.":valCode={$valCode}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}"); } // END - while // Hash it with md5() and salt it with the random string @@ -783,7 +783,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") { $valHashedCode = generatePassString($hashedCode); // Return hashed value - //DEBUG_LOG(__FUNCTION__.":finalValCode={$valHashedCode}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "finalValCode={$valHashedCode}"); return $valHashedCode; } // Check validation code @@ -797,8 +797,8 @@ function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) { $code = SURFBAR_GENERATE_VALIDATION_CODE($urlId, $salt); // Return result of checking hashes and salts - //DEBUG_LOG(__FUNCTION__.":---".$code."|".$check."---"); - //DEBUG_LOG(__FUNCTION__.":+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "---".$code."|".$check."---"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++"); return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt'))); } // Lockdown the userid/id combination (reload lock) @@ -816,13 +816,13 @@ function SURFBAR_LOCKDOWN_ID ($urlId) { // Pay points to the user and remove it from the sender function SURFBAR_PAY_POINTS ($urlId) { // Remove it from the URL owner - //DEBUG_LOG(__FUNCTION__.":uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".SURFBAR_GET_USERID().",costs=".SURFBAR_GET_COSTS().""); if (SURFBAR_GET_USERID() > 0) { SUB_POINTS(SURFBAR_GET_USERID(), SURFBAR_GET_COSTS()); } // END - if // Book it to the user - //DEBUG_LOG(__FUNCTION__.":uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".$GLOBALS['userid'].",reward=".SURFBAR_GET_REWARD().""); ADD_POINTS_REFSYSTEM($GLOBALS['userid'], SURFBAR_GET_DATA('reward')); } // Updates the statistics of current URL/userid @@ -875,7 +875,7 @@ function SURFBAR_UPDATE_SALT_STATS () { array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), $GLOBALS['userid']), __FILE__, __LINE__); // Debug message - //DEBUG_LOG(__FUNCTION__.":salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid'].""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".$GLOBALS['userid'].""); // Was that okay? if (SQL_AFFECTEDROWS() < 1) { @@ -885,14 +885,14 @@ function SURFBAR_UPDATE_SALT_STATS () { } // END - if // Debug message - //DEBUG_LOG(__FUNCTION__.":affectedRows=".SQL_AFFECTEDROWS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "affectedRows=".SQL_AFFECTEDROWS().""); // Return if the update was okay return (SQL_AFFECTEDROWS() == 1); } // Check if the reload lock is active for given id function SURFBAR_CHECK_RELOAD_LOCK ($urlId) { - //DEBUG_LOG(__FUNCTION__.":id={$urlId}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}"); // Ask the database $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt FROM "._MYSQL_PREFIX."_surfbar_locks @@ -909,7 +909,7 @@ LIMIT 1", SQL_FREERESULT($result); // Return check - //DEBUG_LOG(__FUNCTION__.":cnt={$cnt},".SURFBAR_GET_DATA('surf_lock').""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "cnt={$cnt},".SURFBAR_GET_DATA('surf_lock').""); return ($cnt == 1); } // Determine which user hash no more points left @@ -952,12 +952,12 @@ ORDER BY u.userid ASC", __FILE__, __LINE__); while (list($uid, $notified) = SQL_FETCHROW($result)) { // Get total points $points = GET_TOTAL_DATA($uid, "user_points", "points") - GET_TOTAL_DATA($uid, "user_data", "used_points"); - //DEBUG_LOG(__FUNCTION__.":uid={$uid},points={$points}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid},points={$points}"); // Shall we add this to ignore? if ($points <= $limit) { // Ignore this one! - //DEBUG_LOG(__FUNCTION__.":uid={$uid} has depleted points amount!"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$uid} has depleted points amount!"); $UIDs['uid'][$uid] = $uid; $UIDs['points'][$uid] = $points; $UIDs['notified'][$uid] = $notified; @@ -968,7 +968,7 @@ ORDER BY u.userid ASC", __FILE__, __LINE__); SQL_FREERESULT($result); // Debug message - //DEBUG_LOG(__FUNCTION__.":UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "UIDs::count=".count($UIDs)." (with own userid=".$GLOBALS['userid'].")"); // Return result return $UIDs; @@ -1154,17 +1154,17 @@ ORDER BY // Load all entries while (list($lid, $url, $last) = SQL_FETCHROW($result)) { // Debug message - //DEBUG_LOG(__FUNCTION__.":next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_DATA('surf_lock').""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$lid},url={$url},rest=".(time() - $last)."/".SURFBAR_GET_DATA('surf_lock').""); // Skip entries that are too old if (($last > (time() - SURFBAR_GET_DATA('surf_lock'))) && (!in_array($url, $ignored))) { // Debug message - //DEBUG_LOG(__FUNCTION__.":okay - lid={$lid},url={$url},last={$last}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "okay - lid={$lid},url={$url},last={$last}"); // Add only if missing or bigger if ((!isset($IDs[$url])) || ($IDs[$url] > $last)) { // Debug message - //DEBUG_LOG(__FUNCTION__.":ADD - lid={$lid},url={$url},last={$last}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "ADD - lid={$lid},url={$url},last={$last}"); // Add this ID $IDs[$url] = $last; @@ -1172,7 +1172,7 @@ ORDER BY } // END - if } else { // Debug message - //DEBUG_LOG(__FUNCTION__.":ignore - lid={$lid},url={$url},last={$last}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "ignore - lid={$lid},url={$url},last={$last}"); // Ignore these old entries! $ignored[] = $url; @@ -1201,7 +1201,7 @@ WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND (sbu.views_allowed=0 OR (s GROUP BY sbu.id", __FILE__, __LINE__); // Log last query - //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS().""); // Fetch max rand $maxRand = SQL_NUMROWS($result); @@ -1317,7 +1317,7 @@ function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) { } // END - if // And query the database - //DEBUG_LOG(__FUNCTION__.":randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock').""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock').""); $result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.views_total, sbu.views_max, sbu.views_allowed, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed FROM "._MYSQL_PREFIX."_surfbar_urls AS sbu LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs @@ -1345,12 +1345,12 @@ LIMIT 1", } // Is there an id number? - //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS().""); if (SQL_NUMROWS($result) == 1) { // Load/cache data - //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - BEFORE"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - BEFORE"); $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result)); - //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - AFTER"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - AFTER"); // Determine waiting time $SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME(); @@ -1358,28 +1358,28 @@ LIMIT 1", // Is the last salt there? if (is_null($SURFBAR_CACHE['last_salt'])) { // Then repair it wit the static! - //DEBUG_LOG(__FUNCTION__.":last_salt - FIXED!"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!"); $SURFBAR_CACHE['last_salt'] = ""; } // END - if // Fix missing last_surfed if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) { // Fix it here - //DEBUG_LOG(__FUNCTION__.":last_surfed - FIXED!"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "last_surfed - FIXED!"); $SURFBAR_CACHE['last_surfed'] = 0; } // END - if // Get base/fixed reward and costs $SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD(); $SURFBAR_CACHE['costs'] = SURFBAR_DETERMINE_COSTS(); - //DEBUG_LOG(__FUNCTION__.":BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS().""); // Only in dynamic model add the dynamic bonus! if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") { // Calculate dynamic reward/costs and add it $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); $SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD(); - //DEBUG_LOG(__FUNCTION__.":DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS().""); + //DEBUG_LOG(__FUNCTION__, __LINE__, "DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS().""); } // END - if // Now get the id @@ -1390,7 +1390,7 @@ LIMIT 1", SQL_FREERESULT($result); // Return result - //DEBUG_LOG(__FUNCTION__.":nextId={$nextId}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "nextId={$nextId}"); return $nextId; } // ----------------------------------------------------------------------------- @@ -1400,7 +1400,7 @@ LIMIT 1", // Private getter for data elements function SURFBAR_GET_DATA ($element) { global $SURFBAR_CACHE; - //DEBUG_LOG(__FUNCTION__.":element={$element}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "element={$element}"); // Default is null $data = null; @@ -1417,7 +1417,7 @@ function SURFBAR_GET_DATA ($element) { } // Return result - //DEBUG_LOG(__FUNCTION__.":element[$element]={$data}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "element[$element]={$data}"); return $data; } // Getter for reward from cache diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 115bec72f7..75cf35e997 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -37,6 +37,7 @@ if (!defined('__SECURITY')) { require($INC); } +// Add links for selecting some users function alpha($sortby, $colspan, $return=false) { global $_CONFIG; @@ -86,7 +87,8 @@ function alpha($sortby, $colspan, $return=false) OUTPUT_HTML($OUT); } } -// + +// Add links for sorting function SortLinks($letter, $sortby, $colspan, $return=false) { $OUT = ""; @@ -132,7 +134,8 @@ function SortLinks($letter, $sortby, $colspan, $return=false) OUTPUT_HTML($OUT); } } -// + +// Add page navigation function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) { if (!$show_form) @@ -197,6 +200,7 @@ function ADD_PAGENAV($PAGES, $offset, $show_form, $colspan,$return=false) OUTPUT_HTML($OUT); } } + // Create email link to user's account function USER_CREATE_EMAIL_LINK($email, $mod="admin") { @@ -221,5 +225,42 @@ WHERE email='%s'".$locked." LIMIT 1", // Return rewritten (?) email address return $email; } -// + +// Selects a random user id as the new referal id if they have at least X confirmed mails in this run +function SELECT_RANDOM_REFID () { + global $_CONFIG; + + // Default is zero refid + $refid = 0; + + // Is the extension version fine? + if (GET_EXT_VERSION("user") >= "0.3.4") { + // Get all user ids + $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true, " AND `rand_confirmed` >= ".$_CONFIG['user_min_confirmed'].""); + + // Do we have at least one? + if ($totalUsers > 0) { + // Then choose random number + $randNum = mt_rand(0, ($totalUsers - 1)); + + // Look for random user + $result = SQL_QUERY_ESC("SELECT `userid` FROM `"._MYSQL_PREFIX."_user_data` WHERE `status`='CONFIRMED' AND `rand_confirmed` >= %s ORDER BY `rand_confirmed` DESC LIMIT %s, 1", + array($_CONFIG['user_min_confirmed'], $randNum), __FILE__, __LINE__); + + // Do we have one entry there? + if (SQL_NUMROWS($result) == 1) { + // Use that userid as new referal id + list($refid) = SQL_FETCHROW($result); + } // END - if + + // Free result + SQL_FREERESULT($result); + } // END - if + } // END - if + + // Return result + return $refid; +} + +// [EOF] ?> diff --git a/inc/libs/wernis_functions.php b/inc/libs/wernis_functions.php index fed9c42c5c..011e2175bb 100644 --- a/inc/libs/wernis_functions.php +++ b/inc/libs/wernis_functions.php @@ -340,7 +340,7 @@ function WERNIS_TAKE_FEE ($points, $mode) { //* DEBUG: */ echo "mode={$mode},points={$points}
\n"; if (!in_array($mode, array('payout', 'withdraw'))) { // Log error and abort - DEBUG_LOG(__FUNCTION__.":uid={$GLOBALS['userid']},mode={$mode},points={$points}"); + DEBUG_LOG(__FUNCTION__, __LINE__, "uid={$GLOBALS['userid']},mode={$mode},points={$points}"); return false; } // END - if @@ -391,7 +391,7 @@ function WERNIS_ADD_FEES_TO_ARRAY (&$array) { // Is the array an array? ;-) if (!is_array($array)) { // Log error and return - DEBUG_LOG(__FUNCTION__.": Type ".gettype($array)." != array."); + DEBUG_LOG(__FUNCTION__, __LINE__, " Type ".gettype($array)." != array."); return; } // END - if diff --git a/inc/libs/yoomedia_functions.php b/inc/libs/yoomedia_functions.php index 10132b66d1..6cf2f20813 100644 --- a/inc/libs/yoomedia_functions.php +++ b/inc/libs/yoomedia_functions.php @@ -64,10 +64,10 @@ function YOOMEDIDA_TEST_CONFIG ($data) { // Log the response if failed if (count($response) == 0) { // Queries depleted (as we count here!) - DEBUG_LOG(__FUNCTION__."(".__LINE__."): Requested depleted. Maxmimum was: ".$_CONFIG['yoomedia_requests_total']); + DEBUG_LOG(__FUNCTION__, __LINE__, " Requested depleted. Maxmimum was: ".$_CONFIG['yoomedia_requests_total']); } elseif (count($response) <= 10) { // Log serialized raw response - DEBUG_LOG(__FUNCTION__."(".__LINE__."): Raw response=".base64_encode(serialize($response))); + DEBUG_LOG(__FUNCTION__, __LINE__, " Raw response=".base64_encode(serialize($response))); } // END - if // Do we have some data there? @@ -276,7 +276,7 @@ function YOOMEDIA_TRANSLATE_INDEX ($type, $index) { $return = $yoomediaTranslationTable[$type][$index]; } else { // Not found! - DEBUG_LOG(__FUNCTION__."(".__LINE__."): type={$type},index={$index} not found."); + DEBUG_LOG(__FUNCTION__, __LINE__, " type={$type},index={$index} not found."); } // Return value @@ -296,7 +296,7 @@ function YOOMEDIA_TRANSLATE_ERROR ($errorCode) { $return = $yoomediaTranslationTable['error_codes'][$errorCode]; } else { // Log missing entries - DEBUG_LOG(__FUNCTION__."(".__LINE__."): errorCode={$errorCode}"); + DEBUG_LOG(__FUNCTION__, __LINE__, " errorCode={$errorCode}"); } // Return value diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index 395bc3e64e..b99efa4a15 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -913,7 +913,11 @@ function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions, $content['sw'] = $SW; // Then list it - $OUT .= LOAD_TEMPLATE("admin_".$listType."_".$table."_row", true, $content); + $OUT .= LOAD_TEMPLATE(sprintf("admin_%s_%s_row", + $listType, + $table + ), true, $content + ); // Switch color $SW = 3 - $SW; @@ -924,7 +928,11 @@ function ADMIN_BUILD_LIST ($listType, $IDs, $table, $columns, $filterFunctions, } // END - foreach // Load master template - LOAD_TEMPLATE("admin_".$listType."_".$table."", false, $OUT); + LOAD_TEMPLATE(sprintf("admin_%s_%s", + $listType, + $table + ), false, $OUT + ); } // Change status of "build" list function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $statusArray) { @@ -984,7 +992,12 @@ function ADMIN_BUILD_STATUS_HANDLER ($mode, $IDs, $table, $columns, $filterFunct } // END - if // Finish SQL statement - $SQL = substr($SQL, 0, -1) . " WHERE ".$idColumn."=".bigintval($id)." AND ".$statusColumn."='".$oldStatus."' LIMIT 1"; + $SQL = substr($SQL, 0, -1) . sprintf(" WHERE %s=%s AND %s='%s' LIMIT 1", + $idColumn, + bigintval($id), + $statusColumn, + $oldStatus + ); // Run the SQL SQL_QUERY($SQL, __FILE__, __LINE__); diff --git a/inc/modules/admin/what-config_refid.php b/inc/modules/admin/what-config_refid.php index 7d88acef89..7bc5d32eb0 100644 --- a/inc/modules/admin/what-config_refid.php +++ b/inc/modules/admin/what-config_refid.php @@ -47,13 +47,38 @@ if (isset($_POST['ok'])) { // Prepare contants for the template define('__MEMBER_SELECTION', ADD_MEMBER_SELECTION_BOX($_CONFIG['def_refid'], false, true, true, "def_refid")); - switch ($_CONFIG['refid_target']) { - case "index": define('__DEF_RT_INDEX', " selected=\"selected\""); define('__DEF_RT_REGISTER', ""); break; - case "register": define('__DEF_RT_INDEX', ""); define('__DEF_RT_REGISTER', " selected=\"selected\""); break; - } + switch ($_CONFIG['refid_target']) { + case "index": + define('__DEF_RT_INDEX' , " selected=\"selected\""); + define('__DEF_RT_REGISTER', ""); + break; + + case "register": + define('__DEF_RT_INDEX' , ""); + define('__DEF_RT_REGISTER', " selected=\"selected\""); + break; + } // END - switch + + switch ($_CONFIG['select_user_zero_refid']) { + case "Y": + define('__RAND_REFID_Y', " selected=\"selected\""); + define('__RAND_REFID_N', ""); + break; + + case "N": + define('__RAND_REFID_Y', ""); + define('__RAND_REFID_N', " selected=\"selected\""); + break; + } // END - switch + + // Prepare content + $content = array( + 'user_min_confirmed' => $_CONFIG['user_min_confirmed'] + ); // Load template - LOAD_TEMPLATE("admin_config_refid"); + LOAD_TEMPLATE("admin_config_refid", false, $content); } -// + +// [EOF] ?> diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index ce84588bad..9ecd2c4ee8 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -54,9 +54,19 @@ if (!empty($_GET['mode'])) { // Remember it define('__TITLE', $listHeader); -$MORE = ", userid"; $colspan = "4"; // 27 +// Init variables +$MORE = ", userid"; $colspan = "4"; + +// Add nickname if extension is found&active if (EXT_IS_ACTIVE("nickname")) { $MORE = ", nickname"; } +// Add random confirmed if extension version matches +if (GET_EXT_VERSION("user") >= "0.3.4") { + // Add it... + $MORE .= ", rand_confirmed"; +} // END - if + +// Init unset data (bad that we change $_GET here!) if (empty($_GET['letter'])) { $_GET['letter'] = _ALL2; } if (empty($_GET['sortby'])) { $_GET['sortby'] = "userid"; } if (empty($_GET['page'])) { $_GET['page'] = "1"; } @@ -68,57 +78,80 @@ if (!empty($_GET['u_id'])) { // Secure the user ID $uid = bigintval($_GET['u_id']); - // Does the account exists? 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 - $result = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout".$MORE." + // Does the account exists? + $result_user = SQL_QUERY_ESC("SELECT gender, surname, family, street_nr, zip, city, country, email, birth_day, birth_month, birth_year, max_mails, receive_mails, refid, status, REMOTE_ADDR, last_online, last_module, ref_clicks, total_logins, used_points, emails_sent, joined, last_update, last_profile_sent, notified, ref_payout, emails_received, mails_confirmed".$MORE." FROM "._MYSQL_PREFIX."_user_data -WHERE userid=%s LIMIT 1", - array($uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { +WHERE userid=%s +LIMIT 1", + array($uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result_user) == 1) { // Account found! - $DATA = SQL_FETCHROW($result); - SQL_FREERESULT($result); + $DATA = SQL_FETCHARRAY($result_user); + // Get count/sum of refs, selected categories, unconfirmed mails $REFS = GET_TOTAL_DATA($uid, "refsystem", "counter"); $CATS = GET_TOTAL_DATA($uid, "user_cats", "id", "userid", true); $LINKS = GET_TOTAL_DATA($uid, "user_links", "id", "userid", true); + // Add links to the numbers if ($LINKS > 0) $LINKS = $BASE."&what=list_links&u_id=".$uid."\">".$LINKS."]"; - if ($DATA[13] > 0) $DATA[13] = str_replace(("u_id=".$uid), ("u_id=".$DATA[13]), $BASE."&what=list_user\">".$DATA[13]."]"); - if (empty($DATA[17])) $DATA[17] = "---"; + if ($DATA['refid'] > 0) $DATA['refid'] = $BASE."&what=list_user&u_id=".$DATA['refid']."\">".$DATA['refid']."]"; + if (empty($DATA['last_module'])) $DATA['last_module'] = "---"; if ($REFS > 0) $REFS = $BASE."&what=list_refs&u_id=".$uid."\">".$REFS."]"; if ($CATS > 0) $CATS = $BASE."&what=list_cats&u_id=".$uid."\">".$CATS."]"; // Prepare data for template - define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA[9], $DATA[8], $DATA[10]), "3")); + define('_BIRTHDAY', MAKE_DATETIME(mktime(0, 0, 0, $DATA['birth_month'], $DATA['birth_day'], $DATA['birth_year']), "3")); define('_REFS' , $REFS); define('_CATS' , $CATS); define('_LINKS', $LINKS); - define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA[14])); - $DATA[0] = TRANSLATE_GENDER($DATA[0]); - $DATA[28] = CREATE_EMAIL_LINK($DATA[7], "user_data"); - $DATA[14] = TRANSLATE_STATUS($DATA[14]); - $DATA[16] = MAKE_DATETIME($DATA[16], "0"); - $DATA[20] = TRANSLATE_COMMA($DATA[20]); - if ($DATA[21] > 0) $DATA[21] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA[21])."]"; - $DATA[22] = MAKE_DATETIME($DATA[22], "0"); - $DATA[23] = MAKE_DATETIME($DATA[23], "0"); - $DATA[24] = MAKE_DATETIME($DATA[24], "0"); - if ((empty($DATA[27])) || ($DATA[27] == $uid)) $DATA[27] = "---"; - $DATA['total'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points")); - $DATA['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points")); - + define('_ADMIN_LINKS', MEMBER_ACTION_LINKS($uid, $DATA['status'])); + $DATA['gender'] = TRANSLATE_GENDER($DATA['gender']); + $DATA['email_link'] = CREATE_EMAIL_LINK($DATA['email'], "user_data"); + $DATA['status'] = TRANSLATE_STATUS($DATA['status']); + $DATA['last_online'] = MAKE_DATETIME($DATA['last_online'], "0"); + $DATA['used_points'] = TRANSLATE_COMMA($DATA['used_points']); + if ($DATA['emails_sent'] > 0) $DATA['emails_sent'] = $BASE."&what=email_details&u_id=".$uid."\">".TRANSLATE_COMMA($DATA['emails_sent'])."]"; + $DATA['joined'] = MAKE_DATETIME($DATA['joined'], "0"); + $DATA['last_update'] = MAKE_DATETIME($DATA['last_update'], "0"); + $DATA['last_profile_sent'] = MAKE_DATETIME($DATA['last_profile_sent'], "0"); + $DATA['total'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "points")); + $DATA['locked'] = TRANSLATE_COMMA(GET_TOTAL_DATA($uid, "user_points", "locked_points")); + + // Nickname inclusion? if (EXT_IS_ACTIVE("nickname")) { - if ((empty($DATA[27])) || ($DATA[27] == $uid)) $DATA[27] = "---"; + // Nickname not set or invalid? Then + if ((empty($DATA['nickname'])) || ($DATA['nickname'] == $uid)) $DATA['nickname'] = "---"; } else { - $DATA[27] = EXT_NICKNAME_404; + // Extension not found + $DATA['nickname'] = EXT_NICKNAME_404; } - // Template laden + // Is the user extension newer? + if (GET_EXT_VERSION("user") >= "0.3.4") { + // Then "translate" the number + $DATA['rand_confirmed'] = TRANSLATE_COMMA($DATA['rand_confirmed']); + } // END - if + + // Clickrate + $DATA['click_rate'] = 0; + if ($DATA['emails_received'] > 0) { + $DATA['click_rate'] = TRANSLATE_COMMA($DATA['mails_confirmed'] / $DATA['emails_received'] * 100); + } // END - if + + // "Translate" more data + $DATA['mails_confirmed'] = TRANSLATE_COMMA($DATA['mails_confirmed']); + $DATA['emails_received'] = TRANSLATE_COMMA($DATA['emails_received']); + + // Load user-details template LOAD_TEMPLATE("admin_user_details", false, $uid); } else { - // Account does not exists! + // Account does not exist! LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_MEMBER_404_1.$uid.ADMIN_MEMBER_404_2); } + + // Free the result + SQL_FREERESULT($result_user); } else { $whereStatement = ""; if (($_GET['letter'] != _ALL2) && ($_GET['letter'] != _OTHERS) && (!empty($_GET['letter']))) { diff --git a/inc/modules/member/what-order.php b/inc/modules/member/what-order.php index a41eb096a0..1f216e16b7 100644 --- a/inc/modules/member/what-order.php +++ b/inc/modules/member/what-order.php @@ -204,14 +204,16 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1", { // Check if category and number of receivers is okay $ADD = ""; - if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) $ADD = "AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'"; + if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) { + // Choose recipients by ZIP code + $ADD = " AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'"; + } // END - if // Check for userids $result = SQL_QUERY_ESC("SELECT DISTINCT c.userid FROM "._MYSQL_PREFIX."_user_cats AS c LEFT JOIN "._MYSQL_PREFIX."_user_data AS d ON c.userid=d.userid -WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0 -".$ADD." +WHERE c.cat_id=%s AND c.userid != '%s' AND d.status='CONFIRMED' AND d.receive_mails > 0".$ADD." ORDER BY d.%s %s", array( bigintval($_POST['cat']), diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 73d3a57f36..fde8d234f2 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -57,7 +57,7 @@ if (($curr != $_CONFIG['last_month']) && ($_CONFIG['last_month'] > 0) && ($_CONF // Use last online stamp only when autopurge for inactive members is activated if (($_CONFIG['ap_inactive_since'] > 0) && ($_CONFIG['beg_active'] == "Y")) { // Okay, include last online timestamp - $whereStatement1 = sprintf("AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval($_CONFIG['ap_inactive_since']));; + $whereStatement1 = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval($_CONFIG['ap_inactive_since']));; $whereStatement2 = bigintval($_CONFIG['beg_ranks']); } // END - if } // END - if @@ -65,7 +65,7 @@ if (($curr != $_CONFIG['last_month']) && ($_CONFIG['last_month'] > 0) && ($_CONF // SQL string to check for accounts $result_main = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points AS points FROM "._MYSQL_PREFIX."_user_data -WHERE status='CONFIRMED' ".$whereStatement1." AND beg_points > 0 +WHERE status='CONFIRMED'".$whereStatement1." AND beg_points > 0 ORDER BY beg_points DESC, userid LIMIT %s", array($whereStatement2), __FILE__, __LINE__); diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 7bbaee5e1e..a700311bf3 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -67,7 +67,7 @@ function __errorHandler ($errno, $errstr, $errfile, $errline) { ); // Write debug log message - DEBUG_LOG(__FUNCTION__.":".$msg, true); + DEBUG_LOG(__FUNCTION__, __LINE__, "".$msg, true); // Output message to user and die if (EXT_IS_ACTIVE("debug")) { diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 00f7d155e3..28dd1789e0 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -335,11 +335,11 @@ function ADD_MENU($MODE, $act, $wht) { // Non-admin shall not see all menus if (!IS_ADMIN()) { - $AND = "AND visible='Y' AND locked='N'"; + $AND = " AND visible='Y' AND locked='N'"; } // Load SQL data and add the menu to the output stream... - $result_main = SQL_QUERY_ESC("SELECT title, action FROM "._MYSQL_PREFIX."_%s_menu WHERE (what='' OR what IS NULL) ".$AND." ORDER BY sort", + $result_main = SQL_QUERY_ESC("SELECT title, action FROM "._MYSQL_PREFIX."_%s_menu WHERE (what='' OR what IS NULL)".$AND." ORDER BY sort", array($MODE), __FILE__, __LINE__); //* DEBUG: */ echo __LINE__."/".$main_cnt."/".$main_action."/".$sub_what.":".$GLOBALS['what']."*
\n"; if (SQL_NUMROWS($result_main) > 0) { @@ -1076,16 +1076,16 @@ function REMOVE_RECEIVER(&$ARRAY, $key, $uid, $pool_id, $stats_id="", $bonus=fal } // Calculate sum (default) or count records of given criteria -function GET_TOTAL_DATA($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") { +function GET_TOTAL_DATA ($search, $tableName, $lookFor, $whereStatement="userid", $onlyRows=false, $add="") { $ret = 0; - if ($onlyRows) { + if (($onlyRows) || ($lookFor == "userid")) { // Count rows - $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s", - array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT COUNT(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'".$add, + array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__); } else { // Add all rows - $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'%s", - array($lookFor, $tableName, $whereStatement, $search, $add), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT SUM(`%s`) FROM `"._MYSQL_PREFIX."_%s` WHERE `%s`='%s'".$add, + array($lookFor, $tableName, $whereStatement, $search), __FILE__, __LINE__); } // Load row @@ -1866,7 +1866,7 @@ function UPDATE_CONFIG ($entries, $values, $updateMode="") { } // Run database update - //DEBUG_LOG(__FUNCTION__.":entries={$entries}"); + //DEBUG_LOG(__FUNCTION__, __LINE__, "entries={$entries}"); SQL_QUERY("UPDATE "._MYSQL_PREFIX."_config SET ".$entries." WHERE config=0 LIMIT 1", __FILE__, __LINE__); // Get affected rows @@ -2199,7 +2199,7 @@ function USER_STATS_INSERT_RECORD ($uid, $type, $data) { array(bigintval($uid), $type, $data), __FILE__, __LINE__); } elseif (is_array($data)) { // Invalid data! - DEBUG_LOG(__FUNCTION__."(".__LINE__."): uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!"); + DEBUG_LOG(__FUNCTION__, __LINE__, " uid={$uid},type={$type},data={".gettype($data).": Invalid statistics data type!"); } } diff --git a/inc/session.php b/inc/session.php index 3170dc767f..46dd7e3913 100644 --- a/inc/session.php +++ b/inc/session.php @@ -62,35 +62,8 @@ require_once(PATH."inc/language.php"); // Load extensions here require_once(PATH."inc/load_extensions.php"); -// Check if refid is set -if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) { - // The variable user comes from the click-counter script click.php and we only accept this here - $GLOBALS['refid'] = bigintval($_GET['user']); -} elseif (!empty($_POST['refid'])) { - // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts) - $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_POST['refid'])); -} elseif (!empty($_GET['refid'])) { - // Get referal id from variable refid (so I hope this makes my script more compatible to other scripts) - $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['refid'])); -} elseif (!empty($_GET['ref'])) { - // Set refid=ref (the referal link uses such variable) - $GLOBALS['refid'] = SQL_ESCAPE(strip_tags($_GET['ref'])); -} elseif (isSessionVariableSet('refid')) { - // Set session refid als global - $GLOBALS['refid'] = bigintval(get_session('refid')); -} elseif (GET_EXT_VERSION("sql_patches") != "") { - // Set default refid as refid in URL - $GLOBALS['refid'] = bigintval($_CONFIG['def_refid']); -} else { - // No default ID when sql_patches is not installed - $GLOBALS['refid'] = 0; -} - -// Set cookie when default refid > 0 -if (!isSessionVariableSet('refid') || (!empty($GLOBALS['refid'])) || ((get_session('refid') == "0") && (isset($_CONFIG['def_refid'])) && ($_CONFIG['def_refid'] > 0))) { - // Set cookie - set_session('refid', $GLOBALS['refid']); -} // END - if +// Determine and set referal id +DETERMINE_REFID(); // Transfer userid from session and validate it if (isset($_SESSION['userid'])) { diff --git a/mailid_top.php b/mailid_top.php index 33c4acad41..60ee809966 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -175,7 +175,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) switch ($ltype) { case "NORMAL": - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks+1 WHERE id=%s LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_stats SET clicks=clicks + 1 WHERE id=%s LIMIT 1", array($url_mid), __FILE__, __LINE__); // Update mediadata as well @@ -187,7 +187,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) break; case "BONUS": - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks+1 WHERE id=%s LIMIT 1", + $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_bonus SET clicks=clicks + 1 WHERE id=%s LIMIT 1", array($url_bid), __FILE__, __LINE__); // Update mediadata as well @@ -206,8 +206,15 @@ if (isBooleanConstantAndTrue('mxchange_installed')) // Only when user extension = v0.1.2: Update mails-confirmed counter if (GET_EXT_VERSION("user") >= "0.1.2") { // Update counter - $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed+1 WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); + SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + + // Update random confirmed as well? + if (GET_EXT_VERSION("user") >= "0.3.4") { + // Update second counter + SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data SET rand_confirmed=rand_confirmed + 1 WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + } // END - if } // Insert stats record diff --git a/templates/de/html/admin/admin_config_refid.tpl b/templates/de/html/admin/admin_config_refid.tpl index de8157f6db..2fbda216d4 100644 --- a/templates/de/html/admin/admin_config_refid.tpl +++ b/templates/de/html/admin/admin_config_refid.tpl @@ -1,49 +1,61 @@ -
- + +
- - - + + + - - - - - - - + - + + + - + + + + + + - - - - - + + + + + - + + + + + - - - +
 {--EDIT_REGFORM_SETTINGS--} + + {--ADMIN_CONFIG_REFID_TITLE--}  
 
 
 {--ADMIN_SELECT_DEF_REFID--}:  + {--ADMIN_SELECT_DEF_REFID--}: {!__MEMBER_SELECTION!}  
 
 {--ADMIN_SELECT_REFID_TARGRT--}: + +
 
 
 {--ADMIN_SELECT_REFID_TARGRT--}:  {--ADMIN_RANDOM_ZERO_REFID--}: + +
 
 {--ADMIN_RANDOM_MIN_CONFIRMED--}: + +
 
-
\ No newline at end of file + diff --git a/templates/de/html/admin/admin_user_details.tpl b/templates/de/html/admin/admin_user_details.tpl index f0ef072dd0..9afdf66474 100644 --- a/templates/de/html/admin/admin_user_details.tpl +++ b/templates/de/html/admin/admin_user_details.tpl @@ -7,55 +7,55 @@ {--GENDER--}:
- $DATA[0] + $DATA[gender] {--SURNAME--}:
- $DATA[1] + $DATA[surname] {--FAMILY_NAME--}:
- $DATA[2] + $DATA[family] {--STREET_NR--}:
- $DATA[3] + $DATA[street_nr] {--BIRTHDAY2--}:
{!_BIRTHDAY!} {--COUNTRY--}:
- $DATA[6] + $DATA[country] {--ZIP--}:
- $DATA[4] + $DATA[zip] {--CITY--}:
- $DATA[5] + $DATA[city] {--ADDY--}:
- $DATA[7] + $DATA[email] {--ACCOUNT_STATUS--}:
- $DATA[14] + $DATA[status] {--RECEIVE_MAILS--}:
- $DATA[12] + $DATA[receive_mails] {--MAX_PER_DAY--}:
- $DATA[11] + $DATA[max_mails] {--REF_UID--}:
- $DATA[13] + $DATA[refid] {--REF_CLICKS--}:
- $DATA[18] + $DATA[ref_clicks] {--TOTAL_LOGINS--}:
- $DATA[19] + $DATA[total_logins] {--REMOTE_IP--}:
- $DATA[15] + $DATA[REMOTE_ADDR] {--ADMIN_LAST_ONLINE--}:
- $DATA[16] + $DATA[last_online] {--ADMIN_LAST_MODULE--}:
- $DATA[17] + $DATA[last_module] {--HAS_JOINED--}:
- $DATA[22] + $DATA[joined] {--MAILS_SENT--}:
- $DATA[21] + $DATA[emails_sent] {--USED_POINTS--}:
- $DATA[20] + $DATA[used_points] {--TOTAL_POINTS--}:
$DATA[total] {--TOTAL_REFERRALS--}:
@@ -69,17 +69,29 @@ {--LOCKED_POINTS--}:
$DATA[locked] {--LAST_UPDATE--}:
- $DATA[23] + $DATA[last_update] {--LAST_PROFILE_SENT--}:
- $DATA[24] + $DATA[last_profile_sent] {--USER_REF_PAYOUT--}:
- $DATA[26] + $DATA[ref_payout] {--USER_NICKNAME--}:
- $DATA[27] + $DATA[nickname] + + + {--CLICK_RATE--}:
+ $DATA[click_rate]% + {--EMAILS_RECEIVED--}:
+ $DATA[emails_received] + {--MAILS_CONFIRMED--}:
+ $DATA[mails_confirmed] + {--RAND_CONFIRMED--}:
+ $DATA[rand_confirmed] + {--__UNUSED--}:
+ --- - {--ADMIN_MEMBER_FUNCTIONS--}:
+ {--ADMIN_MEMBER_FUNCTIONS--}:
{!_ADMIN_LINKS!} \ No newline at end of file diff --git a/view.php b/view.php index 2c45b0d4f7..8194fa6804 100644 --- a/view.php +++ b/view.php @@ -62,11 +62,10 @@ if (((!empty($_GET['user'])) || (!empty($_GET['reseller']))) && (!empty($_GET['b // Free memory SQL_FREERESULT($result); } - exit(); } else { // Do nothing for now LOAD_URL (URL."/index.php"); } -// +// // END - if ?>