From 9f6146bafa428283b33164d9630a2a394e1d1d04 Mon Sep 17 00:00:00 2001 From: quix0r Date: Sun, 8 Feb 2009 15:22:55 +0000 Subject: [PATCH] LOAD_CONFIGURED_URL() added, bug #66 resolved --- admin.php | 5 +- agb.php | 11 +- beg.php | 2 +- birthday_confirm.php | 2 +- confirm.php | 4 +- doubler.php | 2 +- img.php | 2 +- inc/autopurge/purge-general.php | 6 +- inc/databases.php | 2 +- inc/db/lib-mysql3.php | 8 +- inc/functions.php | 48 ++++++--- inc/libs/surfbar_functions.php | 2 +- inc/libs/user_functions.php | 2 +- inc/modules/admin/what-config_other.php | 36 +++---- inc/modules/admin/what-list_user.php | 10 +- inc/modules/admin/what-logs.php | 2 +- inc/modules/admin/what-overview.php | 2 +- inc/modules/guest/what-beg.php | 10 +- inc/modules/guest/what-top10.php | 125 +++++++++++++++-------- inc/modules/guest/what-wernis_portal.php | 4 +- inc/modules/member/what-beg.php | 21 ++-- inc/modules/member/what-transfer.php | 6 +- index.php | 2 +- lead-confirm.php | 2 +- login.php | 13 ++- mailid.php | 4 +- mailid_top.php | 4 +- ref.php | 2 +- show_bonus.php | 2 +- sponsor_confirm.php | 4 +- sponsor_ref.php | 4 +- surfbar.php | 2 +- 32 files changed, 185 insertions(+), 166 deletions(-) diff --git a/admin.php b/admin.php index 5a04fc8eb9..2047658661 100644 --- a/admin.php +++ b/admin.php @@ -47,10 +47,9 @@ require("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { // Simply redirect... :-) - LOAD_URL("modules.php?module=admin&action=login"); - // Redirection should be done here + LOAD_URL("modules.php?module=admin"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/agb.php b/agb.php index 7f020fcd60..be4e7dca8c 100644 --- a/agb.php +++ b/agb.php @@ -45,16 +45,13 @@ $GLOBALS['module'] = "agb"; $CSS = -1; require("inc/config.php"); // Is the script installed? -if (isBooleanConstantAndTrue('mxchange_installed')) -{ +if (isBooleanConstantAndTrue('mxchange_installed')) { // Simply redirect... :-) LOAD_URL("modules.php?module=index&what=agb"); - // Redirection should be done here -} - else -{ - // You have to configure first! +} else { + // You have to install first! LOAD_URL("install.php"); } + // Really all done here... ;-) ?> diff --git a/beg.php b/beg.php index b0ecebb6de..f76da26f19 100644 --- a/beg.php +++ b/beg.php @@ -235,7 +235,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { LOAD_URL("modules.php?module=index"); } } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/birthday_confirm.php b/birthday_confirm.php index 1c71ee60db..6ec8545718 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -130,7 +130,7 @@ WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", // Include footer include(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } // Really all done here... ;-) diff --git a/confirm.php b/confirm.php index 49197dcc2b..612d3480fd 100644 --- a/confirm.php +++ b/confirm.php @@ -58,10 +58,8 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install // Load the URL LOAD_URL($URL); - - // Redirection should be done here } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/doubler.php b/doubler.php index 09d00fba02..f328e4235a 100644 --- a/doubler.php +++ b/doubler.php @@ -274,7 +274,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Output footer include(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/img.php b/img.php index 09cafe5146..15fb090ac9 100644 --- a/img.php +++ b/img.php @@ -70,7 +70,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Finish generation here require_once(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/inc/autopurge/purge-general.php b/inc/autopurge/purge-general.php index a24b4c7cdc..d133ca7a7c 100644 --- a/inc/autopurge/purge-general.php +++ b/inc/autopurge/purge-general.php @@ -46,11 +46,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') == "N")) { if ((getConfig('auto_purge_active') == "Y") && (getConfig('auto_purge') > 0)) { // First calculate the timestamp - if (function_exists('CREATE_TIME_SELECTIONS')) { - $PURGE = getConfig('auto_purge'); - } else { - $PURGE = getConfig('auto_purge') * getConfig('one_day'); - } + $PURGE = getConfig('auto_purge'); // Init variables $admin_points = 0; diff --git a/inc/databases.php b/inc/databases.php index ae2d16ee63..5001bc3f0d 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -97,7 +97,7 @@ define('START_TDAY', MAKE_TIME(0, 0, 0, time())); define('SERVER_URL', "http://www.mxchange.org"); // Current SVN revision -define('CURR_SVN_REVISION', "717"); +define('CURR_SVN_REVISION', "718"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index e889278f6b..f41591f0ee 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -226,13 +226,15 @@ function SQL_FREERESULT($result) { function SQL_QUERY_ESC($qstring, $data, $file, $line, $run=true, $strip=true) { global $link; + // Init variable + $query = "failed"; + if ($strip) { $strip = "true"; } else { $strip = "false"; } - $query = ""; $eval = "\$query = sprintf(\"".$qstring."\""; foreach ($data as $var) { if ((!empty($var)) || ($var === 0)) { @@ -250,10 +252,10 @@ function SQL_QUERY_ESC($qstring, $data, $file, $line, $run=true, $strip=true) { //* DEBUG: */ fclose($fp); // Run the code - @eval($eval); + eval($eval); // Was the eval() command fine? - if (empty($query)) { + if ($query == "failed") { // Something went wrong? print "eval=".htmlentities($eval)."
";
 		debug_print_backtrace();
diff --git a/inc/functions.php b/inc/functions.php
index e25fce1111..de39d07278 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -144,18 +144,15 @@ function OUTPUT_HTML ($HTML, $NEW_LINE = true) {
 			// Log this error
 			DEBUG_LOG(__FUNCTION__, __LINE__, "Headers already sent! We need debug backtrace here.");
 
-			// Output debug trace
-			print("Headers are already sent!
\n"); - print("Please report this error at bugs.mxchange.org:
");
-			debug_print_backtrace();
-			die("
Thank you for your help finding bugs."); + // Trigger an user error + trigger_error("Headers are already sent!"); } // END - if // Output cached HTML code $OUTPUT = ob_get_contents(); // Clear output buffer for later output - ob_end_clean(); + clearOutputBuffer(); // Send HTTP header header("HTTP/1.1 200"); @@ -171,7 +168,7 @@ function OUTPUT_HTML ($HTML, $NEW_LINE = true) { header("Connection: Close"); // Extension "rewrite" installed? - if ((EXT_IS_ACTIVE("rewrite")) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) { + if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) { $OUTPUT = REWRITE_LINKS($OUTPUT); } // END - if @@ -194,7 +191,7 @@ function OUTPUT_HTML ($HTML, $NEW_LINE = true) { OUTPUT_RAW($OUTPUT); } elseif ((OUTPUT_MODE == "render") && (!empty($OUTPUT))) { // Rewrite links when rewrite extension is active - if ((EXT_IS_ACTIVE("rewrite")) && (function_exists('REWRITE_LINKS')) && ($CSS != "1") && ($CSS != "-1")) { + if ((EXT_IS_ACTIVE("rewrite")) && ($CSS != "1") && ($CSS != "-1")) { $OUTPUT = REWRITE_LINKS($OUTPUT); } // END - if @@ -817,12 +814,9 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { if (getConfig('auto_purge') == 0) { // Will never expire! $EXPIRATION = MAIL_WILL_NEVER_EXPIRE; - } elseif (function_exists('CREATE_FANCY_TIME')) { + } else { // Create nice date string $EXPIRATION = CREATE_FANCY_TIME(getConfig('auto_purge')); - } else { - // Display days only - $EXPIRATION = round(getConfig('auto_purge')/60/60/24)." "._DAYS; } // Is content an array? @@ -926,6 +920,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") { if (empty($newContent)) { // Compiling failed $newContent = "Compiler error for template {$template}!\nUncompiled content:\n".$tmpl_file; + // Add last error if the required function exists if (function_exists('error_get_last')) $newContent .= "\n--------------------------------------\nDebug:\n".print_r(error_get_last(), true)."--------------------------------------\nPlease don't alter these informations!\nThanx."; } // END - if @@ -969,7 +964,7 @@ function LOAD_URL($URL, $addUrlData=true) { // Clear it only if there is content if (!empty($OUTPUT)) { - ob_end_clean(); + clearOutputBuffer(); } // END - if // Add some data to URL if cookies are not accepted @@ -989,7 +984,7 @@ function LOAD_URL($URL, $addUrlData=true) { debug_print_backtrace(); die("
URL={$URL}"); */ - @header ("Location: ".str_replace("&", "&", $URL)); + header ("Location: ".str_replace("&", "&", $URL)); } else { // Output error message include(PATH."inc/header.php"); @@ -998,6 +993,22 @@ function LOAD_URL($URL, $addUrlData=true) { } exit(); } + +// Wrapper for LOAD_URL but URL comes from a configuration entry +function LOAD_CONFIGURED_URL ($configEntry) { + // Get the URL + $URL = getConfig($configEntry); + + // Is this URL set? + if (is_null($URL)) { + // Then abort here + trigger_error(sprintf("Configuration entry %s is not set!", $configEntry); + } // END - if + + // Load the URL + LOAD_URL($URL); +} + // function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) { global $SEC_CHARS, $URL_CHARS; @@ -3059,6 +3070,15 @@ function GEN_ERROR_CODE_FROM_ACCOUNT_STATUS ($status) { return $ERROR; } +// Clears the output buffer. This function does *NOT* backup sent content. +function clearOutputBuffer () { + // Trigger an error on failure + if (!ob_end_clean()) { + // Failed! + trigger_error(__FUNCTION__.": Failed to clean output buffer."); + } // END - if +} + ////////////////////////////////////////////////// // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS // ////////////////////////////////////////////////// diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 31cd556dad..cdb46c8e77 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -1481,7 +1481,7 @@ function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") { LOAD_URL("surfbar.php?frame=".$page); } else { // Reload to external page - LOAD_URL(getConfig('surfbar_pause_url')); + LOAD_CONFIGURED_URL('surfbar_pause_url'); } } diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index fd534b8128..38b9cc52c3 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -38,7 +38,7 @@ if (!defined('__SECURITY')) { } // Add links for selecting some users -function alpha($sortby, $colspan, $return=false) { +function alpha ($sortby, $colspan, $return=false) { global $_CONFIG; if (empty($_GET['offset'])) $_GET['offset'] = 0; $ADD = "&page=".SQL_ESCAPE($_GET['page'])."&offset=".SQL_ESCAPE($_GET['offset']); diff --git a/inc/modules/admin/what-config_other.php b/inc/modules/admin/what-config_other.php index 5d3b3b19a4..58fe215f3a 100644 --- a/inc/modules/admin/what-config_other.php +++ b/inc/modules/admin/what-config_other.php @@ -46,14 +46,12 @@ ADD_DESCR("admin", __FILE__); // Stop saving data if one input field is !isset if (isset($_POST['ok'])) { - if (function_exists('CREATE_TIME_SELECTIONS')) { - // Calculate stamps and set calculated stamps - $_POST['online_timeout'] = CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout" , $_POST); - $_POST['url_tlock'] = CREATE_TIMESTAMP_FROM_SELECTIONS("url_tlock" , $_POST); - $_POST['profile_lock'] = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_lock" , $_POST); - $_POST['profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_update" , $_POST); - $_POST['resend_profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("resend_profile_update", $_POST); - } + // Calculate stamps and set calculated stamps + $_POST['online_timeout'] = CREATE_TIMESTAMP_FROM_SELECTIONS("ip_timeout" , $_POST); + $_POST['url_tlock'] = CREATE_TIMESTAMP_FROM_SELECTIONS("url_tlock" , $_POST); + $_POST['profile_lock'] = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_lock" , $_POST); + $_POST['profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("profile_update" , $_POST); + $_POST['resend_profile_update'] = CREATE_TIMESTAMP_FROM_SELECTIONS("resend_profile_update", $_POST); // Online-Timeout shall be > 0 or your database will crow and crow and crow... if (!isset($_POST['online_timeout'])) { unset($_POST['ok']); } @@ -81,22 +79,12 @@ if (isset($_POST['ok'])) { define('_CFG_REJECT_URL' , getConfig('reject_url')); define('_CFG_MIN_AGE' , getConfig('min_age')); - // Is there the pro-version function avaiable to create selection boxes instead of input boxes? - if (function_exists('CREATE_TIME_SELECTIONS')) { - // Only pro versions: time selection boxes - define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('online_timeout'), "ip_timeout" , "ms")); - define('_CFG_URL_TLOCK' , CREATE_TIME_SELECTIONS(getConfig('url_tlock') , "url_tlock" , "WDh")); - define('_CFG_PROFILE_LOCK' , CREATE_TIME_SELECTIONS(getConfig('profile_lock') , "profile_lock" , "WDh")); - define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), "profile_update" , "YM")); - define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , "resend_profile_update", "MWD")); - } else { - // Normal input boxes - define('_CFG_ONLINE_TIMEOUT', "
("._SECONDS.")
"); - define('_CFG_URL_TLOCK' , "
("._SECONDS.")
"); - define('_CFG_PROFILE_LOCK' , "
("._SECONDS.")
"); - define('_CFG_PROFILE_UPDATE', "
("._SECONDS.")
"); - define('_CFG_PROF_REUPDATE' , "
("._SECONDS.")
"); - } + // Time selection boxes + define('_CFG_ONLINE_TIMEOUT', CREATE_TIME_SELECTIONS(getConfig('online_timeout'), "ip_timeout" , "ms")); + define('_CFG_URL_TLOCK' , CREATE_TIME_SELECTIONS(getConfig('url_tlock') , "url_tlock" , "WDh")); + define('_CFG_PROFILE_LOCK' , CREATE_TIME_SELECTIONS(getConfig('profile_lock') , "profile_lock" , "WDh")); + define('_CFG_PROFILE_UPDATE', CREATE_TIME_SELECTIONS(getConfig('profile_update'), "profile_update" , "YM")); + define('_CFG_PROF_REUPDATE' , CREATE_TIME_SELECTIONS(getConfig('resend_profile_update') , "resend_profile_update", "MWD")); if (getConfig('order_multi_page') == "N") { define('_CFG_ORDER_MULTI_N', " checked=\"checked\""); diff --git a/inc/modules/admin/what-list_user.php b/inc/modules/admin/what-list_user.php index ddec04ffa8..8021593694 100644 --- a/inc/modules/admin/what-list_user.php +++ b/inc/modules/admin/what-list_user.php @@ -264,13 +264,9 @@ LIMIT 1", define('__COLSPAN2' , ($colspan + 2)); define('__USER_CNT' , $user_count); - if ((function_exists('alpha')) && (function_exists('SortLinks'))) { - define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true)); - define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true)); - } else { - define('__ALPHA_SORT', ""); - define('__SORT_LINKS', ""); - } + // Sorting links + define('__ALPHA_SORT', alpha($_GET['sortby'], $colspan, true)); + define('__SORT_LINKS', SortLinks($_GET['letter'], $_GET['sortby'], $colspan, true)); if ($PAGES > 1) { define('__PAGE_NAV', ADD_PAGENAV($PAGES, getConfig('user_limit'), true, $colspan, true)); diff --git a/inc/modules/admin/what-logs.php b/inc/modules/admin/what-logs.php index a5ce46945d..b8d50bfbc7 100644 --- a/inc/modules/admin/what-logs.php +++ b/inc/modules/admin/what-logs.php @@ -54,7 +54,7 @@ if (!empty($_GET['access'])) { $OUTPUT = ob_get_contents(); // Clean content - ob_end_clean(); + clearOutputBuffer(); // Set header if (substr($access, -3, 3) == "log") { diff --git a/inc/modules/admin/what-overview.php b/inc/modules/admin/what-overview.php index 83e1660d25..208c3773da 100644 --- a/inc/modules/admin/what-overview.php +++ b/inc/modules/admin/what-overview.php @@ -48,7 +48,7 @@ $taskExt = false; // Default is that "task" is not installed // When the admin is logging in check several things first (new jobs to complete and so on) if ($GLOBALS['action'] == "login") { - if ((EXT_IS_ACTIVE("task")) && (function_exists('OUTPUT_ADVANCED_OVERVIEW'))) { + if (EXT_IS_ACTIVE("task")) { // When task extension is registered output advanced overview page $JOBS_DONE = OUTPUT_ADVANCED_OVERVIEW($result_tasks); // This function is provided by the extension 'task' $taskExt = true; diff --git a/inc/modules/guest/what-beg.php b/inc/modules/guest/what-beg.php index d61d0d0671..71ab1bd55a 100644 --- a/inc/modules/guest/what-beg.php +++ b/inc/modules/guest/what-beg.php @@ -54,13 +54,9 @@ if ($GLOBALS['refid'] > 0) { define('__BEG_UID' , getConfig('def_refid')); } -if (function_exists('CREATE_FANCY_TIME')) { - define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout'))); - define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout'))); -} else { - define('__BEG_TIMEOUT ' , round(getConfig('beg_timeout') / 60)." ".MINUTES); - define('__BEG_UID_TIMEOUT', round(getConfig('beg_uid_timeout') / 60)." ".MINUTES); -} +// Selection boxes are now the default +define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout'))); +define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout'))); // Load final template LOAD_TEMPLATE("guest_".substr(basename(__FILE__), 5, -4)); diff --git a/inc/modules/guest/what-top10.php b/inc/modules/guest/what-top10.php index 56c36548f7..fe843213db 100644 --- a/inc/modules/guest/what-top10.php +++ b/inc/modules/guest/what-top10.php @@ -44,18 +44,25 @@ if (!defined('__SECURITY')) { ADD_DESCR("guest", __FILE__); //// TOP logins -$ADD = "userid"; -if (EXT_IS_ACTIVE("nickname")) $ADD = "nickname"; -$result = SQL_QUERY_ESC("SELECT userid, ".$ADD.", total_logins, last_online -FROM "._MYSQL_PREFIX."_user_data -WHERE total_logins>0 AND status='CONFIRMED' ORDER BY total_logins DESC LIMIT %s", - array(getConfig('top10_max')), __FILE__, __LINE__); +$result = SQL_QUERY_ESC(" +SELECT + userid, total_logins, last_online +FROM + "._MYSQL_PREFIX."_user_data +WHERE + total_logins > 0 AND + status='CONFIRMED' +ORDER BY + total_logins DESC +LIMIT %s", + array(getConfig('top10_max')), __FILE__, __LINE__); $OUT = ""; $SW = 2; $cnt = 1; -while(list($uid, $nick, $logins, $last) = SQL_FETCHROW($result)) -{ +while (list($uid, $logins, $last) = SQL_FETCHROW($result)) { $nick2 = "---"; - if (($nick != $uid) && (!empty($nick))) $nick2 = $nick; + + // Get nickname + if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid); // Prepare data for template $content = array( @@ -74,11 +81,10 @@ while(list($uid, $nick, $logins, $last) = SQL_FETCHROW($result)) // Switch colors and count one up $SW = 3 - $SW; $cnt++; } -if ($cnt < getConfig('top10_max')) -{ + +if ($cnt < getConfig('top10_max')) { // Add more "blank" rows - for ($i = $cnt; $i <= getConfig('top10_max'); $i++) - { + for ($i = $cnt; $i <= getConfig('top10_max'); $i++) { // Prepare data for template $content = array( 'sw' => $SW, @@ -92,22 +98,38 @@ if ($cnt < getConfig('top10_max')) } define('__TOP_LOGINS_ROWS', $OUT); +// Free result +SQL_FREERESULT($result); + //// TOP earners -$result = SQL_QUERY_ESC("SELECT DISTINCT p.userid, d.".$ADD.", (SUM(p.points) - d.used_points) AS tpoints, d.last_online -FROM "._MYSQL_PREFIX."_user_points AS p -LEFT JOIN `"._MYSQL_PREFIX."_user_data` AS d -ON p.userid=d.userid -WHERE p.points > 0 AND d.status='CONFIRMED' -GROUP BY p.userid -ORDER BY tpoints DESC, d.last_online DESC +$result = SQL_QUERY_ESC(" +SELECT DISTINCT + d.userid, + (SUM(p.points) - d.used_points) AS tpoints, + d.last_online +FROM + `"._MYSQL_PREFIX."_user_data` AS d +LEFT JOIN + "._MYSQL_PREFIX."_user_points AS p +ON + p.userid=d.userid +WHERE + p.points > 0 AND + d.status='CONFIRMED' +GROUP BY + p.userid +ORDER BY + tpoints DESC, + d.last_online DESC LIMIT %s", - array(getConfig('top10_max')), __FILE__, __LINE__); + array(getConfig('top10_max')), __FILE__, __LINE__); $OUT = ""; $SW = 2; $cnt = 1; -while(list($uid, $nick, $points, $last) = SQL_FETCHROW($result)) -{ +while (list($uid, $points, $last) = SQL_FETCHROW($result)) { $nick2 = "---"; - if (($nick != $uid) && (!empty($nick))) $nick2 = $nick; + + // Get nickname + if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid); // Prepare data for template $content = array( @@ -125,11 +147,10 @@ while(list($uid, $nick, $points, $last) = SQL_FETCHROW($result)) // Switch colors and count one up $SW = 3 - $SW; $cnt++; } -if ($cnt < getConfig('top10_max')) -{ + +if ($cnt < getConfig('top10_max')) { // Add more "blank" rows - for ($i = $cnt; $i <= getConfig('top10_max'); $i++) - { + for ($i = $cnt; $i <= getConfig('top10_max'); $i++) { // Prepare data for template $content = array( 'sw' => $SW, @@ -143,22 +164,38 @@ if ($cnt < getConfig('top10_max')) } define('__TOP_POINTS_ROWS', $OUT); +// Free result +SQL_FREERESULT($result); + //// TOP referal "hunter" -$result = SQL_QUERY_ESC("SELECT DISTINCT r.userid, d.".$ADD.", SUM(r.counter) AS refs, d.last_online -FROM "._MYSQL_PREFIX."_refsystem AS r -LEFT JOIN `"._MYSQL_PREFIX."_user_data` AS d -ON r.userid=d.userid -WHERE r.counter > 0 AND d.status='CONFIRMED' -GROUP BY r.userid -ORDER BY refs DESC, d.last_online DESC +$result = SQL_QUERY_ESC(" +SELECT DISTINCT + d.userid, + SUM(r.counter) AS refs, + d.last_online +FROM + `"._MYSQL_PREFIX."_user_data` AS d +LEFT JOIN + "._MYSQL_PREFIX."_refsystem AS r +ON + r.userid=d.userid +WHERE + r.counter > 0 AND + d.status='CONFIRMED' +GROUP BY + r.userid +ORDER BY + refs DESC, + d.last_online DESC LIMIT %s", - array(getConfig('top10_max')), __FILE__, __LINE__); + array(getConfig('top10_max')), __FILE__, __LINE__); $OUT = ""; $SW = 2; $cnt = 1; -while(list($uid, $nick, $refs, $last) = SQL_FETCHROW($result)) -{ +while (list($uid, $refs, $last) = SQL_FETCHROW($result)) { $nick2 = "---"; - if (($nick != $uid) && (!empty($nick))) $nick2 = $nick; + + // Get nickname + if (EXT_IS_ACTIVE("nickname")) $nick2 = NICKNAME_GET_NICK($uid); // Prepare data for template $content = array( @@ -177,11 +214,10 @@ while(list($uid, $nick, $refs, $last) = SQL_FETCHROW($result)) // Switch colors and count one up $SW = 3 - $SW; $cnt++; } -if ($cnt < getConfig('top10_max')) -{ + +if ($cnt < getConfig('top10_max')) { // Add more "blank" rows - for ($i = $cnt; $i <= getConfig('top10_max'); $i++) - { + for ($i = $cnt; $i <= getConfig('top10_max'); $i++) { // Prepare data for template $content = array( 'sw' => $SW, @@ -195,6 +231,9 @@ if ($cnt < getConfig('top10_max')) } define('__TOP_REFERRAL_ROWS', $OUT); +// Free result +SQL_FREERESULT($result); + // Remember other values in constants define('__TOP10_MAX', getConfig('top10_max')); diff --git a/inc/modules/guest/what-wernis_portal.php b/inc/modules/guest/what-wernis_portal.php index f97690f2f7..51a2efa606 100644 --- a/inc/modules/guest/what-wernis_portal.php +++ b/inc/modules/guest/what-wernis_portal.php @@ -47,10 +47,10 @@ require_once(PATH."inc/rdf.class.php"); ADD_DESCR("guest", __FILE__); OUTPUT_HTML("
"); -$rdf = new fase4_rdf; +$rdf = new fase4_rdf(); $rdf->use_dynamic_display(false); $rdf->set_CacheDir(PATH."inc/cache/"); -$rdf->set_salt(SITE_KEY); +$rdf->set_salt(md5(SITE_KEY)); $rdf->set_max_item(10); $rdf->set_Options( array( diff --git a/inc/modules/member/what-beg.php b/inc/modules/member/what-beg.php index e9a2d6404b..bf048dcac0 100644 --- a/inc/modules/member/what-beg.php +++ b/inc/modules/member/what-beg.php @@ -70,21 +70,12 @@ $nickname = true; if (empty($uid)) { $uid = $GLOBALS['userid']; $nickname = false; } // Prepare constants -define('__BEG_UID' , $uid); -define('__BEG_CLICKS' , $clicks); -define('__BEG_POINTS' , TRANSLATE_COMMA(getConfig('beg_points'))); -define('__BEG_POINTS_MAX', TRANSLATE_COMMA(getConfig('beg_points_max'))); - -if (function_exists('CREATE_FANCY_TIME')) -{ - define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout'))); - define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout'))); -} - else -{ - define('__BEG_TIMEOUT ' , round(getConfig('beg_timeout') / 60)." ".MINUTES); - define('__BEG_UID_TIMEOUT', round(getConfig('beg_uid_timeout') / 60)." ".MINUTES); -} +define('__BEG_UID' , $uid); +define('__BEG_CLICKS' , $clicks); +define('__BEG_POINTS' , TRANSLATE_COMMA(getConfig('beg_points'))); +define('__BEG_POINTS_MAX' , TRANSLATE_COMMA(getConfig('beg_points_max'))); +define('__BEG_TIMEOUT' , CREATE_FANCY_TIME(getConfig('beg_timeout'))); +define('__BEG_UID_TIMEOUT', CREATE_FANCY_TIME(getConfig('beg_uid_timeout'))); // Load template LOAD_TEMPLATE("member_".substr(basename(__FILE__), 5, -4)); diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index e1516ea152..a615d259e7 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -162,11 +162,7 @@ case "new": // Start new transfer // Remember transfer reason and fancy date/time in constants define('__TRANSFER_REASON', $_POST['reason']); - if (function_exists('CREATE_FANCY_TIME')) { - define('__TRANSFER_EXPIRES', CREATE_FANCY_TIME(getConfig('transfer_age'))); - } else { - define('__TRANSFER_EXPIRES', round(getConfig('transfer_age')/60/60/24)." ".DAYS); - } + define('__TRANSFER_EXPIRES', CREATE_FANCY_TIME(getConfig('transfer_age'))); // Generate tranafer id define('__TRANS_ID', bigintval(GEN_RANDOM_CODE("10", mt_rand(0, 99999), $GLOBALS['userid'], $_POST['reason']))); diff --git a/index.php b/index.php index 312719aa93..d5ee879dcd 100644 --- a/index.php +++ b/index.php @@ -83,7 +83,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Footer require(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/lead-confirm.php b/lead-confirm.php index c5cab5847b..7bcd9100eb 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -85,7 +85,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Footer require(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/login.php b/login.php index 575533ed92..27537535c7 100644 --- a/login.php +++ b/login.php @@ -46,11 +46,16 @@ require("inc/config.php"); // Is the script installed? if (isBooleanConstantAndTrue('mxchange_installed')) { - // Simply redirect... :-) - LOAD_URL("modules.php?module=index&what=login"); - // Redirection should be done here + // Is this a member? + if (IS_MEMBER()) { + // Then redirect into login area + LOAD_URL("modules.php?module=login"); + } else { + // Guests will be redirected to login form + LOAD_URL("modules.php?module=index&what=login"); + } } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/mailid.php b/mailid.php index 5bca0bab23..3fb1eaafab 100644 --- a/mailid.php +++ b/mailid.php @@ -206,7 +206,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { break; case "REJECT": // Redirect to rejection page - LOAD_URL(getConfig('reject_url')); + LOAD_CONFIGURED_URL('reject_url'); break; default: @@ -219,7 +219,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { require_once(PATH."inc/footer.php"); } } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/mailid_top.php b/mailid_top.php index 4246555689..2136361822 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -240,7 +240,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { ADD_POINTS_REFSYSTEM("mailid_okay", $url_uid, $payment, false, "0", $locked); // Shall I add bonus points for "turbo clickers" ? - if ((GET_EXT_VERSION("bonus") >= "0.2.2") && (function_exists('BONUS_ADD_TURBO_POINTS'))) { + if (GET_EXT_VERSION("bonus") >= "0.2.2") { // Is an active-rallye running and this is not a notification mail? if ((getConfig('bonus_active') == "Y") && ($notify == "N")) { // Shall I exclude the webmaster's own userid from the active-rallye? @@ -352,7 +352,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { } // END - if } } elseif ($mode != "img") { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/ref.php b/ref.php index 7f92027256..7adf9ae91a 100644 --- a/ref.php +++ b/ref.php @@ -104,7 +104,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Load the URL LOAD_URL($URL); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/show_bonus.php b/show_bonus.php index 61e8ce264a..7ef2fa027e 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -135,7 +135,7 @@ LIMIT 1", // Include footer include(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/sponsor_confirm.php b/sponsor_confirm.php index c3aadaa205..5b601d88ca 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -50,10 +50,8 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Load the URL LOAD_URL($URL); - - // Redirection should be done here } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/sponsor_ref.php b/sponsor_ref.php index bbcb00a7f2..065aef6868 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -56,10 +56,8 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue(mxchange_installe // Load the URL LOAD_URL($URL); - - // Redirection should be done here } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } diff --git a/surfbar.php b/surfbar.php index dfc8d87175..02d12ccf14 100644 --- a/surfbar.php +++ b/surfbar.php @@ -194,7 +194,7 @@ if (isBooleanConstantAndTrue('mxchange_installed')) { // Load footer require_once(PATH."inc/footer.php"); } else { - // You have to configure first! + // You have to install first! LOAD_URL("install.php"); } -- 2.39.5