From: Roland Häder Date: Sun, 26 Jul 2009 20:12:49 +0000 (+0000) Subject: if-block rewrittten, some TODOs/default added X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0fd6858b423d41e7eee9ffa3d5138d318e08cc1c;p=mailer.git if-block rewrittten, some TODOs/default added --- diff --git a/.gitattributes b/.gitattributes index 6f8ed87c6c..2f89381e9c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,5 @@ * text=auto !eol /.htaccess -text -/.svnignore -text DOCS/INSTALL.txt -text DOCS/LICENSE.txt -text DOCS/README -text diff --git a/.svnignore b/.svnignore deleted file mode 100644 index 7b9019de13..0000000000 --- a/.svnignore +++ /dev/null @@ -1 +0,0 @@ -inc/config.php diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 6bd21db085..6d62421ec2 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -1,6 +1,7 @@ ### WARNING: THIS FILE IS AUTO-GENERATED BY DOCS/todo-builder.sh (1000/quix0r) ### ### DO NOT EDIT THIS FILE. ### -./beg.php:193: // @TODO Opps, what is missing here??? +./beg.php:197: // @TODO Opps, what is missing here??? +./doubler.php:275:// @TODO Rewrite all constants ./inc/cache/config-local.php:120:// @TODO Rewrite the following three constants, somehow... ./inc/config-functions.php:182: // @TODO Make this all better... :-/ ./inc/config-functions.php:207: // @TODO Rewrite these all to config entries, if somehow possible @@ -213,8 +214,18 @@ ./inc/wrapper-functions.php:152:// @TODO Implement $compress ./inc/wrapper-functions.php:159:// @TODO Implement $decompress ./inc/wrapper-functions.php:391:// @TODO Do some more sanity check here -./mailid_top.php:208: // @TODO Rewrite these blocks to filter -./surfbar.php:65: // @TODO Display quick login form here or redirect as configured +./mailid.php:140: // @TODO Rewrite this to a filter +./mailid.php:185: // @TODO Rewrite these constants +./mailid.php:221: // @TODO Rewrite this to a filter +./mailid.php:96: // @TODO Rewrite this to a filter +./mailid_top.php:137: // @TODO Rewrite this to a filter +./mailid_top.php:184: // @TODO Rewrite this to a filter +./mailid_top.php:191: // @TODO Rewrite this to a filter +./mailid_top.php:224: // @TODO Rewrite these constants +./mailid_top.php:229: // @TODO Rewrite these blocks to filter +./mailid_top.php:90: // @TODO Rewrite this to a filter +./show_bonus.php:106: // @TODO Rewrite this constant +./surfbar.php:69: // @TODO Display quick login form here or redirect as configured ### ### DEPRECATION FOLLOWS: ### ### ./inc/functions.php:235: // @DEPRECATED Try to rewrite the if() condition ./inc/functions.php:249: // @DEPRECATED diff --git a/admin.php b/admin.php index c6a9bf529e..8de27a1209 100644 --- a/admin.php +++ b/admin.php @@ -51,22 +51,19 @@ $GLOBALS['output_mode'] = -1; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Is the admin logged-in and no sql_patches installed? - if ((IS_ADMIN()) && (!EXT_IS_ACTIVE('sql_patches'))) { - // Extension 'sql_patches' is missing! - redirectToUrl('modules.php?module=admin&sql_patches=1'); - } else { - // Default redirect - redirectToUrl('modules.php?module=admin'); - } -} else { +if (!isInstalled()) { // You have to install first! redirectToUrl('install.php'); -} +} // END - if -// Really all done here... ;-) -shutdown(); +// Is the admin logged-in and no sql_patches installed? +if ((IS_ADMIN()) && (!EXT_IS_ACTIVE('sql_patches'))) { + // Extension 'sql_patches' is missing! + redirectToUrl('modules.php?module=admin&sql_patches=1'); +} else { + // Default redirect + redirectToUrl('modules.php?module=admin'); +} -// +// [EOF] ?> diff --git a/agb.php b/agb.php index 065941cc7f..8d5e13d97c 100644 --- a/agb.php +++ b/agb.php @@ -51,16 +51,13 @@ $GLOBALS['output_mode'] = -1; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Simply redirect... :-) - redirectToUrl('modules.php?module=index&what=agb'); -} else { +if (!isInstalled()) { // You have to install first! redirectToUrl('install.php'); -} +} // END - if -// Really all done here... ;-) -shutdown(); +// Simply redirect... :-) +redirectToUrl('modules.php?module=index&what=agb'); -// +// [EOF] ?> diff --git a/beg.php b/beg.php index d69cd6b49e..3de49a3a9b 100644 --- a/beg.php +++ b/beg.php @@ -57,183 +57,183 @@ require('inc/config-global.php'); REDIRCT_ON_UNINSTALLED_EXTENSION('beg'); // Is the script installed? -if (isInstalled()) { - // Check for userid - if (REQUEST_ISSET_GET('uid')) { - // Init variables - $uid = 0; - $result = false; - $points = 0; - - // Don't pay is the default... - $pay = false; - - // Validate if it is not a number - if (''.(REQUEST_GET('uid') + 0).'' !== ''.REQUEST_GET('uid').'') { - if (EXT_IS_ACTIVE('nickname')) { - // Maybe we have found a nickname? - $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", - array(REQUEST_GET('uid')), __FILE__, __LINE__); - } else { - // Nickname entered but nickname is not active - $msg = getCode('EXTENSION_PROBLEM'); - $uid = -1; - } +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Check for userid +if (REQUEST_ISSET_GET('uid')) { + // Init variables + $uid = 0; + $result = false; + $points = 0; + + // Don't pay is the default... + $pay = false; + + // Validate if it is not a number + if (''.(REQUEST_GET('uid') + 0).'' !== ''.REQUEST_GET('uid').'') { + if (EXT_IS_ACTIVE('nickname')) { + // Maybe we have found a nickname? + $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", + array(REQUEST_GET('uid')), __FILE__, __LINE__); } else { - // Direct userid - $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + // Nickname entered but nickname is not active + $msg = getCode('EXTENSION_PROBLEM'); + $uid = -1; } + } else { + // Direct userid + $result = SQL_QUERY_ESC("SELECT userid, beg_clicks, ref_payout, status, last_online FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", + array(bigintval(REQUEST_GET('uid'))), __FILE__, __LINE__); + } - // Check if locked in so don't pay points - $status = 'failed'; - - // Check if account was found - if (SQL_NUMROWS($result) == 1) { - // Found an ID so we simply set it - list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result); - - // Account confirmed? - if ($status == 'CONFIRMED') { - // Secure userid - $uid = bigintval($uid); - - // Multiply configured values with 100000 and divide with 100000 so we can also handle small values - // If we need more number behind the decimal dot then we just need to increase all these three - // numbers matching to the numbers behind the decimal dot. Simple! ;-) - $points = mt_rand((getConfig('beg_points') * 100000), (getConfig('beg_points_max') * 100000)) / 100000; - - // Set nickname / userid for the template(s - define('__BEG_UID' , REQUEST_GET('uid')); - define('__BEG_CLICKS', ($clicks + 1)); - define('__BEG_BANNER', LOAD_TEMPLATE('beg_banner', true)); - define('__BEG_POINTS', translateComma($points)); + // Check if locked in so don't pay points + $status = 'failed'; + + // Check if account was found + if (SQL_NUMROWS($result) == 1) { + // Found an ID so we simply set it + list($uid, $clicks, $ref_payout, $status, $last) = SQL_FETCHROW($result); + + // Account confirmed? + if ($status == 'CONFIRMED') { + // Secure userid + $uid = bigintval($uid); + + // Multiply configured values with 100000 and divide with 100000 so we can also handle small values + // If we need more number behind the decimal dot then we just need to increase all these three + // numbers matching to the numbers behind the decimal dot. Simple! ;-) + $points = mt_rand((getConfig('beg_points') * 100000), (getConfig('beg_points_max') * 100000)) / 100000; + + // Set nickname / userid for the template(s + define('__BEG_UID' , REQUEST_GET('uid')); + define('__BEG_CLICKS', ($clicks + 1)); + define('__BEG_BANNER', LOAD_TEMPLATE('beg_banner', true)); + define('__BEG_POINTS', translateComma($points)); + } else { + // Other status + $uid = 0; + } + } // END - if + + // Free memory + SQL_FREERESULT($result); + + // User id valid and not webmaster's id? + if (($uid > 0) && (getConfig('beg_uid') != $uid)) { + // Update counter + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET beg_clicks=beg_clicks+1 WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", + array($uid), __FILE__, __LINE__); + + // Check for last entry for userid w/o IP number + $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND `userid`=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1", + array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); + + // Entry not found, points set and not logged in? + if (((SQL_NUMROWS($result) == 0) || (IS_ADMIN())) && ($points > 0) && (!IS_MEMBER()) && (getConfig('beg_pay_mode') == 'NONE')) { + + // Admin is testing? + if (!IS_ADMIN()) { + // Remember remote address, userid and timestamp for next click + // but only when there is no admin begging. + // Admins shall be able to test it! + SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())", + array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); + + // Was is successfull? + $pay (SQL_AFFECTEDROWS() == 1); } else { - // Other status - $uid = 0; + // Is admin! + $pay = true; } - } // END - if - - // Free memory - SQL_FREERESULT($result); - // User id valid and not webmaster's id? - if (($uid > 0) && (getConfig('beg_uid') != $uid)) { - // Update counter - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET beg_clicks=beg_clicks+1 WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", - array($uid), __FILE__, __LINE__); - - // Check for last entry for userid w/o IP number - $result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_beg_ips` WHERE (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_timeout').") OR (timeout > (UNIX_TIMESTAMP() - ".getConfig('beg_uid_timeout').") AND `userid`=%s)) AND (remote_ip='%s' OR sid='%s') LIMIT 1", - array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); - - // Entry not found, points set and not logged in? - if (((SQL_NUMROWS($result) == 0) || (IS_ADMIN())) && ($points > 0) && (!IS_MEMBER()) && (getConfig('beg_pay_mode') == 'NONE')) { - - // Admin is testing? - if (!IS_ADMIN()) { - // Remember remote address, userid and timestamp for next click - // but only when there is no admin begging. - // Admins shall be able to test it! - SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_beg_ips` (userid, remote_ip,sid, timeout) VALUES ('%s','%s','%s', UNIX_TIMESTAMP())", - array($uid, detectRemoteAddr(), session_id()), __FILE__, __LINE__); - - // Was is successfull? - $pay (SQL_AFFECTEDROWS() == 1); - } else { - // Is admin! - $pay = true; - } - - // Pay points? - if ($pay === true) { - // Add points to user or begging rallye account - if (BEG_ADD_POINTS($uid, $points)) { - // Set 'done' message - $content['msg'] = LOAD_TEMPLATE('beg_done', true); - } else { - // Error! - $content['msg'] = LOAD_TEMPLATE('beg_failed', true); - } + // Pay points? + if ($pay === true) { + // Add points to user or begging rallye account + if (BEG_ADD_POINTS($uid, $points)) { + // Set 'done' message + $content['msg'] = LOAD_TEMPLATE('beg_done', true); } else { // Error! $content['msg'] = LOAD_TEMPLATE('beg_failed', true); } - } elseif (IS_MEMBER()) { - // Logged in user found! - $content['msg'] = LOAD_TEMPLATE('beg_login', true); - } elseif (getConfig('beg_pay_mode') != 'NONE') { // Other pay-mode active! - // Prepare content for template - $content = array( - 'clicks' => constant('__BEG_CLICKS'), - 'points' => constant('__BEG_POINTS'), - 'uid' => constant('__BEG_UID') - ); - - // Load message template depending on pay-mode - $content['msg'] = LOAD_TEMPLATE('beg_pay_mode_'.strtolower(getConfig('beg_pay_mode')), true, $content); - $pay = true; } else { - // Clicked received while reload lock is active + // Error! $content['msg'] = LOAD_TEMPLATE('beg_failed', true); } + } elseif (IS_MEMBER()) { + // Logged in user found! + $content['msg'] = LOAD_TEMPLATE('beg_login', true); + } elseif (getConfig('beg_pay_mode') != 'NONE') { // Other pay-mode active! + // Prepare content for template + $content = array( + 'clicks' => constant('__BEG_CLICKS'), + 'points' => constant('__BEG_POINTS'), + 'uid' => constant('__BEG_UID') + ); + + // Load message template depending on pay-mode + $content['msg'] = LOAD_TEMPLATE('beg_pay_mode_'.strtolower(getConfig('beg_pay_mode')), true, $content); + $pay = true; + } else { + // Clicked received while reload lock is active + $content['msg'] = LOAD_TEMPLATE('beg_failed', true); + } - // Free memory - SQL_FREERESULT($result); - - // Include header - loadIncludeOnce('inc/header.php'); + // Free memory + SQL_FREERESULT($result); - // Load final template - LOAD_TEMPLATE('beg_link', false, $content); + // Include header + loadIncludeOnce('inc/header.php'); - // Tracker code enabled? (We don't track users here! - if ((getConfig('beg_pay_mode') != 'NONE') && ($pay === true)) { - // Prepare content for template - // @TODO Opps, what is missing here??? - $content = array( - ); + // Load final template + LOAD_TEMPLATE('beg_link', false, $content); - // Include config-depending template - LOAD_TEMPLATE('beg_pay_code_'.strtolower(getConfig('beg_pay_mode')), false, $content); - } elseif ((!$pay) && (!isset($content['msg']))) { - // Cannot pay! :-( - $content['msg'] = LOAD_TEMPLATE('beg_failed', true); - } + // Tracker code enabled? (We don't track users here! + if ((getConfig('beg_pay_mode') != 'NONE') && ($pay === true)) { + // Prepare content for template + // @TODO Opps, what is missing here??? + $content = array( + ); - // Include footer - loadIncludeOnce('inc/footer.php'); - } elseif (($status != 'CONFIRMED') && ($status != 'failed')) { - // Maybe locked/unconfirmed account? - $msg = generateErrorCodeFromUserStatus($status); - } elseif (($uid == '0') || ($status == 'failed')) { - // Inalid or locked account, so let's find out - $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", - array(REQUEST_GET('uid')), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - // Locked account - $msg = getCode('ACCOUNT_LOCKED'); - } else { - // Invalid nickname! (404) - $msg = getCode('USER_404'); - } + // Include config-depending template + LOAD_TEMPLATE('beg_pay_code_'.strtolower(getConfig('beg_pay_mode')), false, $content); + } elseif ((!$pay) && (!isset($content['msg']))) { + // Cannot pay! :-( + $content['msg'] = LOAD_TEMPLATE('beg_failed', true); + } - // Free memory - SQL_FREERESULT($result); - } elseif ($uid == getConfig('beg_uid')) { - // Webmaster's ID cannot beg for points! - $msg = getCode('BEG_SAME_AS_OWN'); + // Include footer + loadIncludeOnce('inc/footer.php'); + } elseif (($status != 'CONFIRMED') && ($status != 'failed')) { + // Maybe locked/unconfirmed account? + $msg = generateErrorCodeFromUserStatus($status); + } elseif (($uid == '0') || ($status == 'failed')) { + // Inalid or locked account, so let's find out + $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", + array(REQUEST_GET('uid')), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + // Locked account + $msg = getCode('ACCOUNT_LOCKED'); + } else { + // Invalid nickname! (404) + $msg = getCode('USER_404'); } - // Reload to index module - if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=beg'); - } else { - // No userid entered - redirectToUrl('modules.php?module=index'); + // Free memory + SQL_FREERESULT($result); + } elseif ($uid == getConfig('beg_uid')) { + // Webmaster's ID cannot beg for points! + $msg = getCode('BEG_SAME_AS_OWN'); } + + // Reload to index module + if ((!empty($msg)) && (!empty($msg))) redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=beg'); } else { - // You have to install first! - redirectToUrl('install.php'); + // No userid entered + redirectToUrl('modules.php?module=index'); } // Really all done here... ;-) diff --git a/birthday_confirm.php b/birthday_confirm.php index 7d4068456c..003c93fbd1 100644 --- a/birthday_confirm.php +++ b/birthday_confirm.php @@ -54,92 +54,89 @@ require('inc/config-global.php'); redirectOnUninstalledExtension('birthday'); // Is the script installed? -if (isInstalled()) { - // Script is installed so let's check for his confirmation link... - $uid = bigintval(REQUEST_GET('uid')); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Script is installed so let's check for his confirmation link... +$uid = bigintval(REQUEST_GET('uid')); - // Only allow numbers here... - $chk = bigintval(REQUEST_GET('check'), false); +// Only allow numbers here... +$chk = bigintval(REQUEST_GET('check'), false); - // Check if link is not clicked so far - $result = SQL_QUERY_ESC("SELECT b.points, d.gender, d.surname, d.family, d.status, d.ref_payout +// Check if link is not clicked so far +$result = SQL_QUERY_ESC("SELECT b.points, d.gender, d.surname, d.family, d.status, d.ref_payout FROM `{!_MYSQL_PREFIX!}_user_birthday` AS b INNER JOIN `{!_MYSQL_PREFIX!}_user_data` AS d ON b.userid=d.userid WHERE b.userid=%s AND b.chk_value='%s' LIMIT 1", - array($uid, $chk), __FILE__, __LINE__); - //* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")
\n"; - - // Prepare content - $content = array(); - - // Is an entry there? - if (SQL_NUMROWS($result) == 1) { - // Ok, congratulation again! Here's your gift from us... - $data = SQL_FETCHARRAY($result, false); - - // Is the account confirmed? - if ($data['status'] == 'CONFIRMED') { - // Set mode depending on how many mails the member has to confirm - $locked = false; - if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; - - // Add points to account - unset($GLOBALS['ref_level']); - ADD_POINTS_REFSYSTEM('birthday_confirm', $uid, $data['points'], false, '0', $locked, strtolower(getConfig('birthday_mode'))); - - // Update mediadata if version is 0.0.4 or newer - if (GET_EXT_VERSION('mediadata') >= '0.0.4') { - // Update database - MEDIA_UPDATE_ENTRY(array('total_points'), 'add', $data['points']); - } - - // Remove entry from table - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1", +array($uid, $chk), __FILE__, __LINE__); +//* DEBUG: */ echo "uid=".$uid.",chk=".$chk." (".strlen($chk).'/'.strlen(REQUEST_GET('check')).'/'.SQL_NUMROWS($result).")
\n"; + +// Prepare content +$content = array(); + +// Is an entry there? +if (SQL_NUMROWS($result) == 1) { + // Ok, congratulation again! Here's your gift from us... + $data = SQL_FETCHARRAY($result, false); + + // Is the account confirmed? + if ($data['status'] == 'CONFIRMED') { + // Set mode depending on how many mails the member has to confirm + $locked = false; + if (($data['ref_payout'] > 0) && (getConfig('allow_direct_pay') != 'Y')) $locked = true; + + // Add points to account + unset($GLOBALS['ref_level']); + ADD_POINTS_REFSYSTEM('birthday_confirm', $uid, $data['points'], false, '0', $locked, strtolower(getConfig('birthday_mode'))); + + // Update mediadata if version is 0.0.4 or newer + if (GET_EXT_VERSION('mediadata') >= '0.0.4') { + // Update database + MEDIA_UPDATE_ENTRY(array('total_points'), 'add', $data['points']); + } // END - if + + // Remove entry from table + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_birthday` WHERE userid=%s AND chk_value='%s' LIMIT 1", array($uid, $chk), __FILE__, __LINE__); - // "Translate" some data - $data['gender'] = translateGender($data['gender']); - $data['points'] = translateComma($data['points']); + // "Translate" some data + $data['gender'] = translateGender($data['gender']); + $data['points'] = translateComma($data['points']); - // Load message from template - $content['msg'] = LOAD_TEMPLATE('birthday_msg', true, $data); - } else { - // Unconfirmed / locked accounts cannot get points - $content['msg'] = sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), translateUserStatus($data['status'])); - } + // Load message from template + $content['msg'] = LOAD_TEMPLATE('birthday_msg', true, $data); } else { - // Cannot load data! - $content['msg'] = getMessage('BIRTHDAY_CANNOT_LOAD_DATA'); + // Unconfirmed / locked accounts cannot get points + $content['msg'] = sprintf(getMessage('BIRTHDAY_CANNOT_STATUS'), translateUserStatus($data['status'])); } +} else { + // Cannot load data! + $content['msg'] = getMessage('BIRTHDAY_CANNOT_LOAD_DATA'); +} - // Free memory - SQL_FREERESULT($result); - - // Set this because we have no module in URI - $GLOBALS['module'] = 'birthday_confirm'; +// Free memory +SQL_FREERESULT($result); - // Include header - loadIncludeOnce('inc/header.php'); +// Set this because we have no module in URI +$GLOBALS['module'] = 'birthday_confirm'; - // Load birthday header template (for your banners, e.g.?) - $content['header'] = LOAD_TEMPLATE('birthday_header', true); +// Include header +loadIncludeOnce('inc/header.php'); - // Load birthday footer template (for your banners, e.g.?) - $content['footer'] = LOAD_TEMPLATE('birthday_footer', true); +// Load birthday header template (for your banners, e.g.?) +$content['header'] = LOAD_TEMPLATE('birthday_header', true); - // Load final template and output it - LOAD_TEMPLATE('birthday_confirm', false, $content); +// Load birthday footer template (for your banners, e.g.?) +$content['footer'] = LOAD_TEMPLATE('birthday_footer', true); - // Include footer - loadIncludeOnce('inc/footer.php'); -} else { - // You have to install first! - redirectToUrl('install.php'); -} +// Load final template and output it +LOAD_TEMPLATE('birthday_confirm', false, $content); -// Really all done here... ;-) -shutdown(); +// Include footer +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?> diff --git a/doubler.php b/doubler.php index 783bf99288..bb9201f179 100644 --- a/doubler.php +++ b/doubler.php @@ -56,85 +56,89 @@ require('inc/config-global.php'); redirectOnUninstalledExtension('doubler'); // Is the script installed? -if (isInstalled()) { - // Probe for referal ID - if (REQUEST_ISSET_GET(('refid'))) $GLOBALS['refid'] = REQUEST_GET(('refid')); - - // Only check this if refid is provided! - if ($GLOBALS['refid'] > 0) { - // Probe for nickname extension and if a nickname was supplied by URL - $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round($GLOBALS['refid']).'') != $GLOBALS['refid'])); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Probe for referal ID +if (REQUEST_ISSET_GET(('refid'))) $GLOBALS['refid'] = REQUEST_GET(('refid')); + +// Only check this if refid is provided! +if ($GLOBALS['refid'] > 0) { + // Probe for nickname extension and if a nickname was supplied by URL + $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round($GLOBALS['refid']).'') != $GLOBALS['refid'])); + + // Do we have nickname or userid set? + if ($probe_nickname === true) { + // Nickname in URL, so load the ID + $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", + array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__); + } else { + // Direct userid entered + $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", + array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__); + } - // Do we have nickname or userid set? - if ($probe_nickname === true) { + // Load data + list($rid, $status_ref) = SQL_FETCHROW($result); + $GLOBALS['refid'] = bigintval($rid); + + // Free memory + SQL_FREERESULT($result); +} // END - if + +// Init userid +$uid = 0; + +// If no account was found set default refid and status to CONFIRMED +if (empty($GLOBALS['refid'])) { + $GLOBALS['refid'] = getConfig('def_refid'); + $status = 'CONFIRMED'; +} // END - if + +// Begin with doubler script... +if (isFormSent()) { + // Secure points (so only integer/double values are allowed + REQUEST_SET_POST('points', bigintval(REQUEST_POST('points'))); + + // Begin with doubling process + if ((REQUEST_ISSET_POST(('userid'))) && (REQUEST_ISSET_POST(('pass'))) && (REQUEST_ISSET_POST(('points')))) { + // Probe for nickname extension and if a nickname was entered + $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round(REQUEST_POST('userid')).'') != REQUEST_POST('userid'))); + if ($probe_nickname) { // Nickname in URL, so load the ID - $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", - array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", + array(REQUEST_POST('userid')), __FILE__, __LINE__); } else { // Direct userid entered - $result = SQL_QUERY_ESC("SELECT userid, status FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval($GLOBALS['refid'])), __FILE__, __LINE__); + $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", + array(bigintval(REQUEST_POST('userid'))), __FILE__, __LINE__); } // Load data - list($rid, $status_ref) = SQL_FETCHROW($result); - $GLOBALS['refid'] = bigintval($rid); + list($uid, $status, $password) = SQL_FETCHROW($result); + $uid = bigintval($uid); - // Free memory + // Free result SQL_FREERESULT($result); - } // END - if - - // Init userid - $uid = 0; - - // If no account was found set default refid and status to CONFIRMED - if (empty($GLOBALS['refid'])) { - $GLOBALS['refid'] = getConfig('def_refid'); - $status = 'CONFIRMED'; - } // END - if - - // Begin with doubler script... - if (isFormSent()) { - // Secure points (so only integer/double values are allowed - REQUEST_SET_POST('points', bigintval(REQUEST_POST('points'))); - - // Begin with doubling process - if ((REQUEST_ISSET_POST(('userid'))) && (REQUEST_ISSET_POST(('pass'))) && (REQUEST_ISSET_POST(('points')))) { - // Probe for nickname extension and if a nickname was entered - $probe_nickname = ((EXT_IS_ACTIVE('nickname')) && ((''.round(REQUEST_POST('userid')).'') != REQUEST_POST('userid'))); - if ($probe_nickname) { - // Nickname in URL, so load the ID - $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", - array(REQUEST_POST('userid')), __FILE__, __LINE__); - } else { - // Direct userid entered - $result = SQL_QUERY_ESC("SELECT userid, status, password FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array(bigintval(REQUEST_POST('userid'))), __FILE__, __LINE__); - } - - // Load data - list($uid, $status, $password) = SQL_FETCHROW($result); - $uid = bigintval($uid); - // Free result - SQL_FREERESULT($result); + // Remove any dots and unwanted chars from the points + REQUEST_SET_POST('points', bigintval(round(convertCommaToDot(REQUEST_POST('points'))))); - // Remove any dots and unwanted chars from the points - REQUEST_SET_POST('points', bigintval(round(convertCommaToDot(REQUEST_POST('points'))))); + // Probe for enough points + $probe_points = ((REQUEST_POST('points') >= getConfig('doubler_min')) && (REQUEST_POST('points') <= getConfig('doubler_max'))); - // Probe for enough points - $probe_points = ((REQUEST_POST('points') >= getConfig('doubler_min')) && (REQUEST_POST('points') <= getConfig('doubler_max'))); + // Check all together + if ((!empty($uid)) && ($password == generateHash(REQUEST_POST('pass'), substr($password, 0, -40))) && ($status == 'CONFIRMED') && ($probe_points)) { + // Nickname resolved to a unique userid or direct userid entered by the member + $GLOBALS['doubler_uid'] = $uid; - // Check all together - if ((!empty($uid)) && ($password == generateHash(REQUEST_POST('pass'), substr($password, 0, -40))) && ($status == 'CONFIRMED') && ($probe_points)) { - // Nickname resolved to a unique userid or direct userid entered by the member - $GLOBALS['doubler_uid'] = $uid; + // Calulcate points + $points = GET_TOTAL_DATA($uid, 'user_points', 'points') - GET_TOTAL_DATA($uid, 'user_data', 'used_points'); - // Calulcate points - $points = GET_TOTAL_DATA($uid, 'user_points', 'points') - GET_TOTAL_DATA($uid, 'user_data', 'used_points'); - - // So let's continue with probing his points amount - if (($points - getConfig('doubler_left') - REQUEST_POST('points') * getConfig('doubler_charge')) >= 0) + // So let's continue with probing his points amount + if (($points - getConfig('doubler_left') - REQUEST_POST('points') * getConfig('doubler_charge')) >= 0) // Enough points are left so let's continue with the doubling process // Create doubling "account" width *DOUBLED* points SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s','%s','%s','".detectRemoteAddr()."', UNIX_TIMESTAMP(), 'N','N')", @@ -153,8 +157,8 @@ if (isInstalled()) { // Okay add a refid line and apply refid percents SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_doubler` (userid, refid, points, remote_ip, timemark, completed, is_ref) VALUES ('%s',0,'%s','".detectRemoteAddr()."',UNIX_TIMESTAMP(),'N','Y')", array( - bigintval($GLOBALS['refid']), - bigintval(REQUEST_POST('points') * 2 * getConfig('doubler_ref')) + bigintval($GLOBALS['refid']), + bigintval(REQUEST_POST('points') * 2 * getConfig('doubler_ref')) ), __FILE__, __LINE__); // And that's why we don't want to you more than one referal level of doubler-points. ^^^ @@ -268,17 +272,11 @@ define('__DOUBLER_COUNTER', getConfig('doubler_counter')); define('__LEFT_VALUE', translateComma(DOUBLER_GET_TOTAL_POINTS_LEFT())); // Output neccessary form for this +// @TODO Rewrite all constants LOAD_TEMPLATE('doubler_index'); // Output footer loadIncludeOnce('inc/footer.php'); -} else { - // You have to install first! - redirectToUrl('install.php'); -} - -// Really all done here... ;-) -shutdown(); -// +// [EOF] ?> diff --git a/img.php b/img.php index db6512ae51..444b1b96f5 100644 --- a/img.php +++ b/img.php @@ -51,36 +51,33 @@ $GLOBALS['output_mode'] = -1; require('inc/config-global.php'); // Script installed? -if (isInstalled()) { - // Load header - loadIncludeOnce('inc/header.php'); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if - // Code set? - if (REQUEST_ISSET_GET(('code'))) { - // Generate image - GENERATE_IMAGE(bigintval(REQUEST_GET('code'))); - } elseif (REQUEST_ISSET_GET('tag')) { - // Tag set so create the IFN (Include-FileName) - $INC = sprintf("inc/img/tag-%s.php", - REQUEST_GET('tag') - ); +// Load header +loadIncludeOnce('inc/header.php'); - // Include is readable? - if (isIncludeReadable($INC)) { - // Include it - loadInclude($INC); - } // END - if - } +// Code set? +if (REQUEST_ISSET_GET(('code'))) { + // Generate image + GENERATE_IMAGE(bigintval(REQUEST_GET('code'))); +} elseif (REQUEST_ISSET_GET('tag')) { + // Tag set so create the IFN (Include-FileName) + $INC = sprintf("inc/img/tag-%s.php", + REQUEST_GET('tag') + ); - // Finish generation here - loadIncludeOnce('inc/footer.php'); -} else { - // You have to install first! - redirectToUrl('install.php'); + // Include is readable? + if (isIncludeReadable($INC)) { + // Include it + loadInclude($INC); + } // END - if } -// Really all done here... ;-) -shutdown(); +// Finish generation here +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?> diff --git a/index.php b/index.php index 8b38b1e2e3..4079b95efe 100644 --- a/index.php +++ b/index.php @@ -54,49 +54,46 @@ $GLOBALS['output_mode'] = '0'; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Header - loadIncludeOnce('inc/header.php'); - - // Fix missing array elements here - if (!isConfigEntrySet('index_delay')) setConfigEntry('index_delay' , 0); - if (!isConfigEntrySet('index_cookie')) setConfigEntry('index_cookie', 0); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if - // Check for cookies - if ((isSessionVariableSet('visited')) || (getConfig('index_delay') == 0) || (getConfig('index_cookie') == 0)) { - // Is the index page configured for redirect pr not? - if (getConfig('index_cookie') > 0) { - // Set cookie and remeber it for specified time - setSession('visited', 'true'); - } elseif (isSessionVariableSet('visited')) { - // Remove cookie when admin set 0 in setup - setSession('visited', ''); - } +// Header +loadIncludeOnce('inc/header.php'); - // Template laden - LOAD_TEMPLATE('index'); +// Fix missing array elements here +if (!isConfigEntrySet('index_delay')) setConfigEntry('index_delay' , 0); +if (!isConfigEntrySet('index_cookie')) setConfigEntry('index_cookie', 0); - // Shall I insert an automated forward? - if (getConfig('index_delay') > 0) { - // This will be a JavaScript-redirect! - define('__DELAY_VALUE', (getConfig('index_delay') * 1000 + 500)); - define('__MOD_VALUE' , 'index'); - LOAD_TEMPLATE('index_forward'); - } // END - if - } else { - // Redirect to main page - redirectToUrl('modules.php?module=index'); +// Check for cookies +if ((isSessionVariableSet('visited')) || (getConfig('index_delay') == 0) || (getConfig('index_cookie') == 0)) { + // Is the index page configured for redirect pr not? + if (getConfig('index_cookie') > 0) { + // Set cookie and remeber it for specified time + setSession('visited', 'true'); + } elseif (isSessionVariableSet('visited')) { + // Remove cookie when admin set 0 in setup + setSession('visited', ''); } - // Footer - loadIncludeOnce('inc/footer.php'); + // Template laden + LOAD_TEMPLATE('index'); + + // Shall I insert an automated forward? + if (getConfig('index_delay') > 0) { + // This will be a JavaScript-redirect! + define('__DELAY_VALUE', (getConfig('index_delay') * 1000 + 500)); + define('__MOD_VALUE' , 'index'); + LOAD_TEMPLATE('index_forward'); + } // END - if } else { - // You have to install first! - redirectToUrl('install.php'); + // Redirect to main page + redirectToUrl('modules.php?module=index'); } -// All done here... -shutdown(); +// Footer +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?> diff --git a/lead-confirm.php b/lead-confirm.php index d3d804eb39..38b94017ab 100644 --- a/lead-confirm.php +++ b/lead-confirm.php @@ -54,51 +54,51 @@ $GLOBALS['output_mode'] = '0'; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Header - loadIncludeOnce('inc/header.php'); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if - // Initialize the array for the template - $content = array( - 'lead_uid' => -1, - 'lead_email' => 'INVALID@EMAIL' - ); +// Is the extension active? +redirectOnUninstalledExtension('lead'); - // Is the cookie set? - if (isSessionVariableSet('lead_uid')) { - // Is the user-account unlocked and valid? - $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", - array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - // Secure the ID number - $content['lead_uid'] = bigintval(getSession('lead_uid')); +// Header +loadIncludeOnce('inc/header.php'); - // Load the email address - list($email) = SQL_FETCHROW($result); +// Initialize the array for the template +$content = array( + 'lead_uid' => -1, + 'lead_email' => 'INVALID@EMAIL' +); - // Compile email - $content['lead_email'] = COMPILE_CODE($email); - } else { - // Not found! - $content['lead_uid'] = 0; - } - } else { - // Maybe spider? - $content['lead_email'] = constant('WEBMASTER'); - } +// Is the cookie set? +if (isSessionVariableSet('lead_uid')) { + // Is the user-account unlocked and valid? + $result = SQL_QUERY_ESC("SELECT email FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1", + array(bigintval(getSession('lead_uid'))), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + // Secure the ID number + $content['lead_uid'] = bigintval(getSession('lead_uid')); - // Load the lead template - LOAD_TEMPLATE('lead_code', false, $content); + // Load the email address + list($email) = SQL_FETCHROW($result); - // Footer - loadIncludeOnce('inc/footer.php'); + // Compile email + $content['lead_email'] = COMPILE_CODE($email); + } else { + // Not found! + $content['lead_uid'] = 0; + } } else { - // You have to install first! - redirectToUrl('install.php'); + // Maybe spider? + $content['lead_email'] = constant('WEBMASTER'); } -// All done here... -shutdown(); +// Load the lead template +LOAD_TEMPLATE('lead_code', false, $content); + +// Footer +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?> diff --git a/login.php b/login.php index 9a0c074af2..9a63243365 100644 --- a/login.php +++ b/login.php @@ -53,22 +53,19 @@ $GLOBALS['output_mode'] = '0'; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Is this a member? - if (IS_MEMBER()) { - // Then redirect into login area - redirectToUrl('modules.php?module=login'); - } else { - // Guests will be redirected to login form - redirectToUrl('modules.php?module=index&what=login'); - } -} else { +if (!isInstalled()) { // You have to install first! redirectToUrl('install.php'); -} +} // END - if -// Really all done here... ;-) -shutdown(); +// Is this a member? +if (IS_MEMBER()) { + // Then redirect into login area + redirectToUrl('modules.php?module=login'); +} else { + // Guests will be redirected to login form + redirectToUrl('modules.php?module=index&what=login'); +} -// +// [EOF] ?> diff --git a/mailid.php b/mailid.php index eeea089cf8..6321d30a30 100644 --- a/mailid.php +++ b/mailid.php @@ -50,182 +50,193 @@ $GLOBALS['output_mode'] = -1; // Load the required file(s) require('inc/config-global.php'); -if (isInstalled()) { - // Is the extension active? - redirectOnUninstalledExtension('mailid'); - - // Init - $url_uid = 0; $url_bid = 0; $url_mid = 0; - - // Secure all data - if (REQUEST_ISSET_GET('uid')) $url_uid = bigintval(REQUEST_GET('uid')); - if (REQUEST_ISSET_GET('mailid')) $url_mid = bigintval(REQUEST_GET('mailid')); - if (REQUEST_ISSET_GET('bonusid')) $url_bid = bigintval(REQUEST_GET('bonusid')); - - // 01 1 12 3 32 21 1 22 10 - if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) { - // Maybe he wants to confirm an email? - if ($url_mid > 0) { - // Normal-Mails - $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1", - array($url_mid, $url_uid), __FILE__, __LINE__); - $type = 'mailid'; $urlId = $url_mid; - } elseif ($url_bid > 0) { - // Bonus-Mail - $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1", - array($url_bid, $url_uid), __FILE__, __LINE__); - $type = 'bonusid'; $urlId = $url_bid; - } else { - // Problem: No ID entered - redirectToUrl('index.php'); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Is the extension active? +redirectOnUninstalledExtension('mailid'); + +// Init +$url_uid = 0; +$url_bid = 0; +$url_mid = 0; + +// Secure all data +if (REQUEST_ISSET_GET('uid')) $url_uid = bigintval(REQUEST_GET('uid')); +if (REQUEST_ISSET_GET('mailid')) $url_mid = bigintval(REQUEST_GET('mailid')); +if (REQUEST_ISSET_GET('bonusid')) $url_bid = bigintval(REQUEST_GET('bonusid')); + +// 01 1 12 3 32 21 1 22 10 +if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) { + // Maybe he wants to confirm an email? + if ($url_mid > 0) { + // Normal-Mails + $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1", + array($url_mid, $url_uid), __FILE__, __LINE__); + $type = 'mailid'; $urlId = $url_mid; + } elseif ($url_bid > 0) { + // Bonus-Mail + $result = SQL_QUERY_ESC("SELECT link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1", + array($url_bid, $url_uid), __FILE__, __LINE__); + $type = 'bonusid'; $urlId = $url_bid; + } else { + // Problem: No ID entered + redirectToUrl('index.php'); + } + + if (SQL_NUMROWS($result) == 1) { + // Load the entry + list($ltype) = SQL_FETCHROW($result); + + // Clean result + SQL_FREERESULT($result); + + // @TODO Rewrite this to a filter + switch ($ltype) + { + case 'NORMAL': + // Is the stats ID valid? + $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1", + array($url_mid), __FILE__, __LINE__); + break; + + case 'BONUS': + // Is the bonus extension active? + redirectOnUninstalledExtension('bonus'); + + // Bonus-Mails + $result = SQL_QUERY_ESC("SELECT id, url, subject FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", + array($url_bid), __FILE__, __LINE__); + break; + + default: // Invalid mail type + debug_report_bug('Invalid mail type ' . $ltype . ' detected.'); + break; } if (SQL_NUMROWS($result) == 1) { - // Load the entry - list($ltype) = SQL_FETCHROW($result); + // Load data + list($pool, $URL, $title) = SQL_FETCHROW($result); - // Clean result + // Free result SQL_FREERESULT($result); - switch ($ltype) - { - case 'NORMAL': - // Is the stats ID valid? - $result = SQL_QUERY_ESC("SELECT pool_id, url, subject FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); - break; - - case 'BONUS': - // Is the bonus extension active? - redirectOnUninstalledExtension('bonus'); - - // Bonus-Mails - $result = SQL_QUERY_ESC("SELECT id, url, subject FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); - break; - } + // Compile extra title + $title = COMPILE_CODE($title); - if (SQL_NUMROWS($result) == 1) { - // Load data - list($pool, $URL, $title) = SQL_FETCHROW($result); + // Set it + setExtraTitle($title); - // Free result + // Is the user's ID unlocked? + $result = SQL_QUERY_ESC("SELECT status, gender, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + list($status, $gender, $sname, $fname) = SQL_FETCHROW($result); SQL_FREERESULT($result); - - // Compile extra title - $title = COMPILE_CODE($title); - - // Set it - setExtraTitle($title); - - // Is the user's ID unlocked? - $result = SQL_QUERY_ESC("SELECT status, gender, surname, family FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - list($status, $gender, $sname, $fname) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - if ($status == 'CONFIRMED') { - // User has confirmed his account so we can procede... - switch ($ltype) - { - case 'NORMAL': - $result = SQL_QUERY_ESC("SELECT payment_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1", + if ($status == 'CONFIRMED') { + // User has confirmed his account so we can procede... + // @TODO Rewrite this to a filter + switch ($ltype) + { + case 'NORMAL': + $result = SQL_QUERY_ESC("SELECT payment_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1", array(bigintval($pool)), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - list($pay) = SQL_FETCHROW($result); - $time = getPaymentPoints($pay, 'time'); - $payment = getPaymentPoints($pay, 'payment'); - $isValid = true; - } - - // Free memory - SQL_FREERESULT($result); - break; - - case 'BONUS': - $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - list($points, $time) = SQL_FETCHROW($result); - $payment = '0.00000'; - $isValid = true; - } - - // Free memory - SQL_FREERESULT($result); - break; - } + if (SQL_NUMROWS($result) == 1) { + list($pay) = SQL_FETCHROW($result); + $time = getPaymentPoints($pay, 'time'); + $payment = getPaymentPoints($pay, 'payment'); + $isValid = true; + } - // Add header - loadIncludeOnce('inc/header.php'); - - // Was that mail a valid one? - if ($isValid === true) { - // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems - if (($time == '0') && ($payment > 0)) { $URL = constant('URL'); $time = '1'; } - if (($time > 0) && (($payment > 0) || ($points > 0))) { - // He can confirm this mail! - // Export data into constants for the template - define('_UID_VALUE' , $url_uid); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_URL_VALUE' , DEREFERER($URL)); - - // Load template - LOAD_TEMPLATE('mailid_frames'); - } else { - $msg = getCode('DATA_INVALID'); + // Free memory + SQL_FREERESULT($result); + break; + + case 'BONUS': + $result = SQL_QUERY_ESC("SELECT points, time FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", + array($url_bid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + list($points, $time) = SQL_FETCHROW($result); + $payment = '0.00000'; + $isValid = true; } + + // Free memory + SQL_FREERESULT($result); + break; + + default: // Invalid mail type + debug_report_bug('Invalid mail type ' . $ltype . ' detected.'); + break; + } + + // Add header + loadIncludeOnce('inc/header.php'); + + // Was that mail a valid one? + if ($isValid === true) { + // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems + if (($time == '0') && ($payment > 0)) { $URL = constant('URL'); $time = '1'; } + if (($time > 0) && (($payment > 0) || ($points > 0))) { + // He can confirm this mail! + // Export data into constants for the template + // @TODO Rewrite these constants + define('_UID_VALUE' , $url_uid); + define('_TYPE_VALUE', $type); + define('_DATA_VALUE', $urlId); + define('_URL_VALUE' , DEREFERER($URL)); + + // Load template + LOAD_TEMPLATE('mailid_frames'); } else { - $msg = getCode('POSSIBLE_INVALID'); + $msg = getCode('DATA_INVALID'); } } else { - $msg = getCode('ACCOUNT_LOCKED'); + $msg = getCode('POSSIBLE_INVALID'); } } else { - SQL_FREERESULT($result); - $msg = getCode('USER_404'); + $msg = getCode('ACCOUNT_LOCKED'); } } else { SQL_FREERESULT($result); - $msg = getCode('STATS_404'); + $msg = getCode('USER_404'); } } else { SQL_FREERESULT($result); - $msg = getCode('ALREADY_CONFIRMED'); + $msg = getCode('STATS_404'); } } else { - // Nothing entered - $msg = getCode('ERROR_MAILID'); + SQL_FREERESULT($result); + $msg = getCode('ALREADY_CONFIRMED'); } +} else { + // Nothing entered + $msg = getCode('ERROR_MAILID'); +} - // Error code is set? - if (!empty($msg)) { - switch (getConfig('mailid_error_redirect')) { - case 'INDEX': // Redirect to index page - redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=mailid'); - break; - - case 'REJECT': // Redirect to rejection page - redirectToConfiguredUrl('reject_url'); - break; - - default: - DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s detected in mailid_error_redirect.", getConfig('mailid_error_redirect'))); - redirectToUrl('modules.php?module=index&msg=' . getCode('UNKNOWN_STATUS') . '&ext=mailid'); - break; - } - } else { - // Include footer - loadIncludeOnce('inc/footer.php'); +// Error code is set? +if (!empty($msg)) { + // @TODO Rewrite this to a filter + switch (getConfig('mailid_error_redirect')) { + case 'INDEX': // Redirect to index page + redirectToUrl('modules.php?module=index&msg='.$msg.'&ext=mailid'); + break; + + case 'REJECT': // Redirect to rejection page + redirectToConfiguredUrl('reject_url'); + break; + + default: + DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s detected in mailid_error_redirect.", getConfig('mailid_error_redirect'))); + redirectToUrl('modules.php?module=index&msg=' . getCode('UNKNOWN_STATUS') . '&ext=mailid'); + break; } } else { - // You have to install first! - redirectToUrl('install.php'); + // Include footer + loadIncludeOnce('inc/footer.php'); } -// Shutdown -shutdown(); - -// +// [EOF] ?> diff --git a/mailid_top.php b/mailid_top.php index ed811fd03e..b757543e89 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -50,317 +50,344 @@ $GLOBALS['output_mode'] = 0; // Load the required file(s) require('inc/config-global.php'); -if (isInstalled()) { - // Is the extension active - redirectOnUninstalledExtension('mailid'); - - // Secure all data - $url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = ''; - if (REQUEST_ISSET_GET('uid')) $url_uid = bigintval(REQUEST_GET('uid')); - if (REQUEST_ISSET_GET('mailid')) $url_mid = bigintval(REQUEST_GET('mailid')); - if (REQUEST_ISSET_GET('bonusid')) $url_bid = bigintval(REQUEST_GET('bonusid')); - if (REQUEST_ISSET_GET('code')) $code = bigintval(REQUEST_GET('code')); - if (REQUEST_ISSET_GET('mode')) $mode = REQUEST_GET('mode'); - - // 01 1 12 2 2 21 1 22 10 - if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) { - // No image? Then output header - if ($mode != 'img') loadIncludeOnce('inc/header.php'); - - // Maybe he wants to confirm an email? - if ($url_mid > 0) { - $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1", - array($url_mid, $url_uid), __FILE__, __LINE__); - $type = 'mailid'; $urlId = $url_mid; - } elseif ($url_bid > 0) { - $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1", - array($url_bid, $url_uid), __FILE__, __LINE__); - $type = 'bonusid'; $urlId = $url_bid; - } - - if (SQL_NUMROWS($result) == 1) { - // Is the stats ID valid? - list($lid, $ltype) = SQL_FETCHROW($result); - SQL_FREERESULT($result); - switch ($ltype) - { - case 'NORMAL': - $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1", - array($url_mid), __FILE__, __LINE__); - break; - - case 'BONUS': - $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", - array($url_bid), __FILE__, __LINE__); - break; - } - - // Entry found? - if (SQL_NUMROWS($result_mailid) == 1) { - // Load data - list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); - - // Correct notification switch in non-bonus mails - if (($notify != 'Y') && ($notify != 'N')) $notify = 'N'; +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Is the extension active +redirectOnUninstalledExtension('mailid'); + +// Secure all data +$url_uid = 0; $url_bid = 0; $url_mid = 0; $code = 0; $mode = ''; +if (REQUEST_ISSET_GET('uid')) $url_uid = bigintval(REQUEST_GET('uid')); +if (REQUEST_ISSET_GET('mailid')) $url_mid = bigintval(REQUEST_GET('mailid')); +if (REQUEST_ISSET_GET('bonusid')) $url_bid = bigintval(REQUEST_GET('bonusid')); +if (REQUEST_ISSET_GET('code')) $code = bigintval(REQUEST_GET('code')); +if (REQUEST_ISSET_GET('mode')) $mode = REQUEST_GET('mode'); + +// 01 1 12 2 2 21 1 22 10 +if (($url_uid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (getTotalFatalErrors() == 0)) { + // No image? Then output header + if ($mode != 'img') loadIncludeOnce('inc/header.php'); + + // Maybe he wants to confirm an email? + if ($url_mid > 0) { + $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE stats_id=%s AND `userid`=%s LIMIT 1", + array($url_mid, $url_uid), __FILE__, __LINE__); + $type = 'mailid'; $urlId = $url_mid; + } elseif ($url_bid > 0) { + $result = SQL_QUERY_ESC("SELECT id, link_type FROM `{!_MYSQL_PREFIX!}_user_links` WHERE bonus_id=%s AND `userid`=%s LIMIT 1", + array($url_bid, $url_uid), __FILE__, __LINE__); + $type = 'bonusid'; $urlId = $url_bid; + } - // Free some memory - SQL_FREERESULT($result_mailid); - - // Set sender to 0 when we have a bonus mail - if ($ltype == 'BONUS') $sender = 0; - - // Is the user's ID unlocked? - $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 1) { - // Load data - list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result); - - // Free some memory - SQL_FREERESULT($result); - - if ($status == 'CONFIRMED') { - // Update last activity - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_online=UNIX_TIMESTAMP(), `last_module`='mailid_top' WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); - - // User has confirmed his account so we can procede... - switch ($ltype) - { - case 'NORMAL': - $result = SQL_QUERY_ESC("SELECT payment_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - - // Entry found? - if (SQL_NUMROWS($result) == 1) { - list($pay) = SQL_FETCHROW($result); - $time = getPaymentPoints($pay, 'time'); - $payment = getPaymentPoints($pay, 'payment'); - $isValid = true; - } // END - if - - // Free memory... - SQL_FREERESULT($result); - break; - - case 'BONUS': - $result = SQL_QUERY_ESC("SELECT time, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", - array(bigintval($pool)), __FILE__, __LINE__); - - // Entry found? - if (SQL_NUMROWS($result) == 1) { - list($time, $payment) = SQL_FETCHROW($result); - $isValid = true; - } - - // Free memory... - SQL_FREERESULT($result); - break; - } + if (SQL_NUMROWS($result) == 1) { + // Is the stats ID valid? + list($lid, $ltype) = SQL_FETCHROW($result); + SQL_FREERESULT($result); + + // @TODO Rewrite this to a filter + switch ($ltype) { + case 'NORMAL': + $result_mailid = SQL_QUERY_ESC("SELECT pool_id, userid, id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `id`=%s LIMIT 1", + array($url_mid), __FILE__, __LINE__); + break; + + case 'BONUS': + $result_mailid = SQL_QUERY_ESC("SELECT id, id, is_notify FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", + array($url_bid), __FILE__, __LINE__); + break; + + default: // Unknown type + debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + break; + } - // Is this entry valid? - if ($isValid) { - if (($time == '0') && ($payment > 0)) $time = '1'; - if (($time > 0) && ($payment > 0)) { - if (!empty($code)) { - // Generate code - $img_code = generateRandomCode(getConfig('code_length'), $code, $url_uid, $urlId); - } // END - if - - switch ($mode) { - case 'add': - // Init stats data - $stats_data = 0; - - // Count clicks - switch ($ltype) - { - case 'NORMAL': - 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 - if (GET_EXT_VERSION('mediadata') >= '0.0.4') { - // Update database - MEDIA_UPDATE_ENTRY(array('total_clicks', 'normal_clicks'), 'add', 1); - } - $stats_data = $url_mid; - break; - - case 'BONUS': - 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 - if (GET_EXT_VERSION('mediadata') >= '0.0.4') { - // Update database - MEDIA_UPDATE_ENTRY(array('total_clicks', 'bonus_clicks'), 'add', 1); - } - $stats_data = $url_bid; - break; - } + // Entry found? + if (SQL_NUMROWS($result_mailid) == 1) { + // Load data + list($pool, $sender, $notify) = SQL_FETCHROW($result_mailid); - // Export data into constants for the template - define('_POINTS_VALUE' , translateComma($payment)); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + // Correct notification switch in non-bonus mails + if (($notify != 'Y') && ($notify != 'N')) $notify = 'N'; - // Only when user extension = v0.1.2: Update mails-confirmed counter - // @TODO Rewrite these blocks to filter - if (GET_EXT_VERSION('user') >= '0.1.2') { - // Update counter - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET mails_confirmed=mails_confirmed + 1 WHERE userid=%s LIMIT 1", - array($url_uid), __FILE__, __LINE__); + // Free some memory + SQL_FREERESULT($result_mailid); - // 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 - } // END - if + // Set sender to 0 when we have a bonus mail + if ($ltype == 'BONUS') $sender = 0; - // Insert stats record - insertUserStatsRecord($url_uid, $type, $stats_data); + // Is the user's ID unlocked? + $result = SQL_QUERY_ESC("SELECT status, gender, surname, family, ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + if (SQL_NUMROWS($result) == 1) { + // Load data + list($status, $gender, $sname, $fname, $ref_pay) = SQL_FETCHROW($result); - // Right code entered? - if (bigintval(REQUEST_POST('gfx_check')) == $img_code) { - // Add points over referal system is the default - $locked = false; - $template = 'mailid_points_done'; + // Free some memory + SQL_FREERESULT($result); - // Right code entered add points and remove entry - if (($ref_pay > 0) && (getConfig('allow_direct_pay') != 'Y')) { - // Don't add points over the referal system - $locked = true; - $template = 'mailid_points_locked'; - } // END - if + if ($status == 'CONFIRMED') { + // Update last activity + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET last_online=UNIX_TIMESTAMP(), `last_module`='mailid_top' WHERE userid=%s LIMIT 1", + array($url_uid), __FILE__, __LINE__); + + // User has confirmed his account so we can procede... + // @TODO Rewrite this to a filter + switch ($ltype) + { + case 'NORMAL': + $result = SQL_QUERY_ESC("SELECT payment_id FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE pool_id=%s LIMIT 1", + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { + list($pay) = SQL_FETCHROW($result); + $time = getPaymentPoints($pay, 'time'); + $payment = getPaymentPoints($pay, 'payment'); + $isValid = true; + } // END - if + + // Free memory... + SQL_FREERESULT($result); + break; + + case 'BONUS': + $result = SQL_QUERY_ESC("SELECT time, points FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1", + array(bigintval($pool)), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { + list($time, $payment) = SQL_FETCHROW($result); + $isValid = true; + } // END - if + + // Free memory... + SQL_FREERESULT($result); + break; + + default: // Unknown type + debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + break; + } - // Count down ref_payout value - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1", + // Is this entry valid? + if ($isValid) { + if (($time == '0') && ($payment > 0)) $time = '1'; + if (($time > 0) && ($payment > 0)) { + if (!empty($code)) { + // Generate code + $img_code = generateRandomCode(getConfig('code_length'), $code, $url_uid, $urlId); + } // END - if + + // @TODO Rewrite this to a filter + switch ($mode) { + case 'add': + // Init stats data + $stats_data = 0; + + // Count clicks + // @TODO Rewrite this to a filter + switch ($ltype) + { + case 'NORMAL': + 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 + if (GET_EXT_VERSION('mediadata') >= '0.0.4') { + // Update database + MEDIA_UPDATE_ENTRY(array('total_clicks', 'normal_clicks'), 'add', 1); + } + $stats_data = $url_mid; + break; + + case 'BONUS': + 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 + if (GET_EXT_VERSION('mediadata') >= '0.0.4') { + // Update database + MEDIA_UPDATE_ENTRY(array('total_clicks', 'bonus_clicks'), 'add', 1); + } + $stats_data = $url_bid; + break; + + default: // Unknown type + debug_report_bug('Unknown mail type ' . $ltype . ' detected.'); + break; + } + + // Export data into constants for the template + // @TODO Rewrite these constants + define('_POINTS_VALUE' , translateComma($payment)); + define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + + // Only when user extension = v0.1.2: Update mails-confirmed counter + // @TODO Rewrite these blocks to filter + if (GET_EXT_VERSION('user') >= '0.1.2') { + // Update counter + 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 + } // END - if + + // Insert stats record + insertUserStatsRecord($url_uid, $type, $stats_data); + + // Right code entered? + if (bigintval(REQUEST_POST('gfx_check')) == $img_code) { + // Add points over referal system is the default + $locked = false; + $template = 'mailid_points_done'; + + // Right code entered add points and remove entry + if (($ref_pay > 0) && (getConfig('allow_direct_pay') != 'Y')) { + // Don't add points over the referal system + $locked = true; + $template = 'mailid_points_locked'; + } // END - if - // Add points - unset($GLOBALS['ref_level']); - 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') { - // 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? - if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) { - // Add points and remember ranking are done in this function.... - BONUS_ADD_TURBO_POINTS($urlId, $url_uid, $type); - - // Set template to mailid_points_done2 which contains a link to the ranking list - $template = 'mailid_points_done2'; - if ($locked) $template = 'mailid_points_locked2'; - define('_UID_VALUE' , $url_uid); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', translateComma($urlId)); - } // END - if + // Count down ref_payout value + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_payout=ref_payout-1 WHERE userid=%s AND ref_payout > 0 LIMIT 1", + array($url_uid), __FILE__, __LINE__); + + // Add points + unset($GLOBALS['ref_level']); + 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') { + // 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? + if ((((getConfig('bonus_uid') == $url_uid) && (getConfig('bonus_include_own') == 'Y')) || (getConfig('bonus_uid') != $url_uid)) && (getConfig('def_refid') != $url_uid)) { + // Add points and remember ranking are done in this function.... + BONUS_ADD_TURBO_POINTS($urlId, $url_uid, $type); + + // Set template to mailid_points_done2 which contains a link to the ranking list + $template = 'mailid_points_done2'; + if ($locked) $template = 'mailid_points_locked2'; + define('_UID_VALUE' , $url_uid); + define('_TYPE_VALUE', $type); + define('_DATA_VALUE', translateComma($urlId)); } // END - if } // END - if + } // END - if - // Load total points - define('__TOTAL_POINTS', translateComma( - GET_TOTAL_DATA($url_uid, 'user_points', 'points') - - GET_TOTAL_DATA($url_uid, 'user_data', 'used_points')) - ); - - // Load template - LOAD_TEMPLATE($template); + // Load total points + define('__TOTAL_POINTS', translateComma( + GET_TOTAL_DATA($url_uid, 'user_points', 'points') - + GET_TOTAL_DATA($url_uid, 'user_data', 'used_points')) + ); + + // Load template + LOAD_TEMPLATE($template); + } else { + // Wrong image code! So add points to sender's account + unset($GLOBALS['ref_level']); + ADD_POINTS_REFSYSTEM_DIRECT('mailid_payback', $sender, $payment); + + // Load template + LOAD_TEMPLATE('mailid_points_failed'); + } + + // Remove link from table + SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `id`=%s LIMIT 1", + array(bigintval($lid)), __FILE__, __LINE__); + break; + + case 'img': + GENERATE_IMAGE($img_code); + break; + + case 'confirm': + if ($code > 0) { + // Export data into constants for the template + define('_CODE_VALUE', $code); + define('_UID_VALUE' , $url_uid ); + define('_TYPE_VALUE', $type); + define('_DATA_VALUE', $urlId); + define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + if (getConfig('code_length') > 0) { + // Generate Code + define('_IMAGE_CODE', generateCaptchaCode($code, $type, $urlId, $url_uid)); + $templ = 'mailid_enter_code'; } else { - // Wrong image code! So add points to sender's account - unset($GLOBALS['ref_level']); - ADD_POINTS_REFSYSTEM_DIRECT('mailid_payback', $sender, $payment); - - // Load template - LOAD_TEMPLATE('mailid_points_failed'); + // Disabled code + define('__GFX_CODE', $img_code); + $templ = 'mailid_confirm_buttom'; } - // Remove link from table - SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `id`=%s LIMIT 1", - array(bigintval($lid)), __FILE__, __LINE__); - break; - - case 'img': - GENERATE_IMAGE($img_code); - break; - - case 'confirm': - if ($code > 0) { - // Export data into constants for the template - define('_CODE_VALUE', $code); - define('_UID_VALUE' , $url_uid ); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); - if (getConfig('code_length') > 0) { - // Generate Code - define('_IMAGE_CODE', generateCaptchaCode($code, $type, $urlId, $url_uid)); - $templ = 'mailid_enter_code'; - } else { - // Disabled code - define('__GFX_CODE', $img_code); - $templ = 'mailid_confirm_buttom'; - } - - // Load template - LOAD_TEMPLATE($templ); - } - break; - - case '': - // Ok, all data is valid and loaded. Finally let's output the timer... :-) - // Export data into constants for the template - define('_TIME_VALUE', $time); - define('_TIM2_VALUE', strlen($time)); - define('_UID_VALUE' , $url_uid ); - define('_TYPE_VALUE', $type); - define('_DATA_VALUE', $urlId); - define('_RAND_VALUE', mt_rand(0, 99999)); - define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); - - // Load template - LOAD_TEMPLATE('mailid_timer'); - break; - } // END - switch - } else { - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (6)
"); - } + // Load template + LOAD_TEMPLATE($templ); + } + break; + + case '': + // Ok, all data is valid and loaded. Finally let's output the timer... :-) + // Export data into constants for the template + define('_TIME_VALUE', $time); + define('_TIM2_VALUE', strlen($time)); + define('_UID_VALUE' , $url_uid ); + define('_TYPE_VALUE', $type); + define('_DATA_VALUE', $urlId); + define('_RAND_VALUE', mt_rand(0, 99999)); + define('_TEMPLATE_BANNER', LOAD_TEMPLATE('mailid_banner', true)); + + // Load template + LOAD_TEMPLATE('mailid_timer'); + break; + + default: // Unknown mode + debug_report_bug('Unknown mode ' . $mode . ' detected.'); + break; + } // END - switch } else { - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (5)
"); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (6)
"); + $mode = 'failed'; } } else { - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (4)
"); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (5)
"); + $mode = 'failed'; } } else { - SQL_FREERESULT($result); - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (3)
"); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (4)
"); + $mode = 'failed'; } } else { SQL_FREERESULT($result); - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (2)
"); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (3)
"); + $mode = 'failed'; } } else { SQL_FREERESULT($result); - LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (1)
"); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (2)
"); + $mode = 'failed'; } - - // Insert footer if no image - if ($mode != 'img') { - // Write footer - loadIncludeOnce('inc/footer.php'); - } // END - if + } else { + SQL_FREERESULT($result); + LOAD_TEMPLATE('admin_settings_saved', false, "
{--MAIL_ALREADY_CONFIRMED--} (1)
"); + $mode = 'failed'; } -} elseif ($mode != 'img') { - // You have to install first! - redirectToUrl('install.php'); + + // Insert footer if no image + if ($mode != 'img') { + // Write footer + loadIncludeOnce('inc/footer.php'); + } // END - if } // Really all done here... ;-) shutdown(); -// +// [EOF] ?> diff --git a/ref.php b/ref.php index 6e639520a2..527d4e9ffc 100644 --- a/ref.php +++ b/ref.php @@ -51,71 +51,67 @@ $GLOBALS['output_mode'] = -1; require('inc/config-global.php'); // Redirect only to registration page when this script is installed -if (isInstalled()) { - // Base URL for redirection - switch (getConfig('refid_target')) - { - case 'register': - $URL = 'modules.php?module=index&what=register&refid='; - break; - - case 'index': - $URL = 'index.php?refid='; - break; - } - - // Get referal ID from ref or refid variable - if (REQUEST_ISSET_GET(('ref'))) $ref = REQUEST_GET('ref'); - elseif (REQUEST_ISSET_GET(('refid'))) $ref = REQUEST_GET('refid'); - - if (!empty($ref)) { - // Test if nickname or numeric id - if ($ref != ''.($ref + 0).'') { - if (EXT_IS_ACTIVE('nickname')) { - // Nickname in URL, so load the ID - $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", - array($ref), __FILE__, __LINE__); - - // Load userid - list($ref) = SQL_FETCHROW($result); - - // Free result - SQL_FREERESULT($result); - } else { - // Invalid request! - $ref = 0; - } - } // END - if - - // Also edit this 0 ! - if (empty($ref)) $ref = 0; - - // Update session - setSession('refid', $ref); - - // We have an refid here. So we simply add it - $URL .= bigintval($ref); - - // Is the refid valid? - if ($ref > 0) { - // Update ref counter - SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_clicks=ref_clicks+1 WHERE userid=%s LIMIT 1", - array(bigintval($ref)), __FILE__, __LINE__); - } // END - if - } else { - // No refid and we add our refid (don't forget to set $def_refid!) - $URL = 'index.php'; - } - - // Load the URL - redirectToUrl($URL); -} else { +if (!isInstalled()) { // You have to install first! redirectToUrl('install.php'); +} // END - if + +// Base URL for redirection +switch (getConfig('refid_target')) { + case 'register': + $URL = 'modules.php?module=index&what=register&refid='; + break; + + case 'index': + $URL = 'index.php?refid='; + break; +} + +// Get referal ID from ref or refid variable +if (REQUEST_ISSET_GET(('ref'))) $ref = REQUEST_GET('ref'); +elseif (REQUEST_ISSET_GET(('refid'))) $ref = REQUEST_GET('refid'); + +if (!empty($ref)) { + // Test if nickname or numeric id + if ($ref != ''.($ref + 0).'') { + if (EXT_IS_ACTIVE('nickname')) { + // Nickname in URL, so load the ID + $result = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' LIMIT 1", + array($ref), __FILE__, __LINE__); + + // Load userid + list($ref) = SQL_FETCHROW($result); + + // Free result + SQL_FREERESULT($result); + } else { + // Invalid request! + $ref = 0; + } + } // END - if + + // Also edit this 0 ! + if (empty($ref)) $ref = 0; + + // Update session + setSession('refid', $ref); + + // We have an refid here. So we simply add it + $URL .= bigintval($ref); + + // Is the refid valid? + if ($ref > 0) { + // Update ref counter + SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET ref_clicks=ref_clicks+1 WHERE userid=%s LIMIT 1", + array(bigintval($ref)), __FILE__, __LINE__); + } // END - if +} else { + // No refid and we add our refid (don't forget to set $def_refid!) + $URL = 'index.php'; } -// Really all done here... ;-) -shutdown(); +// Load the URL +redirectToUrl($URL); -// +// [EOF] ?> diff --git a/show_bonus.php b/show_bonus.php index 0b418e67b0..5daf345ce8 100644 --- a/show_bonus.php +++ b/show_bonus.php @@ -55,91 +55,89 @@ require('inc/config-global.php'); redirectOnUninstalledExtension('bonus'); // List only rankings when script is installed -if (isInstalled()) { - // Include header - loadIncludeOnce('inc/header.php'); - - if ((REQUEST_GET('uid') > 0) && (REQUEST_GET('d') > 0) && (REQUEST_ISSET_GET(('t')))) { - // Set row name - $t = ''; - switch (REQUEST_GET('t')) { - case 'bonusid': // Bonus mail - $t = 'bonus_id'; - break; - - case 'mailid': // Regular member mail - $t = 'mail_id'; - break; - - default: // Invalid type - DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", REQUEST_GET('t'))); - break; - } // END - switch - - // Valid type? - if (!empty($t)) { - // Check for data - $result = SQL_QUERY_ESC("SELECT DISTINCT d.gender, d.surname, d.family, b.level, b.points +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if + +// Include header +loadIncludeOnce('inc/header.php'); + +if ((REQUEST_GET('uid') > 0) && (REQUEST_GET('d') > 0) && (REQUEST_ISSET_GET(('t')))) { + // Set row name + $t = ''; + switch (REQUEST_GET('t')) { + case 'bonusid': // Bonus mail + $t = 'bonus_id'; + break; + + case 'mailid': // Regular member mail + $t = 'mail_id'; + break; + + default: // Invalid type + DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid type %s detected.", REQUEST_GET('t'))); + break; + } // END - switch + + // Valid type? + if (!empty($t)) { + // Check for data + $result = SQL_QUERY_ESC("SELECT DISTINCT d.gender, d.surname, d.family, b.level, b.points FROM `{!_MYSQL_PREFIX!}_user_data` AS d RIGHT JOIN `{!_MYSQL_PREFIX!}_bonus_turbo` AS b ON d.userid=b.userid WHERE d.`status`='CONFIRMED' AND d.userid=%s AND b.%s=%s LIMIT 1", - array(bigintval(REQUEST_GET('uid')), $t, bigintval(REQUEST_GET('d'))), __FILE__, __LINE__); - - // Entry found? - if (SQL_NUMROWS($result) == 1) { - // Load data - $content = SQL_FETCHARRAY($result); - - // Prepare constants for the pre-template - $content['gender'] = translateGender($content['gender']); - $content['points'] = translateComma($content['points']); - $content['mailid'] = bigintval(REQUEST_GET('d')); - $content['rows'] = BONUS_MAKE_RANK_ROWS(bigintval(REQUEST_GET('d')), $t, bigintval(REQUEST_GET('uid'))); - - // Constant created within previous function which contains informations for current user's ranking position: - // __YOUR_RANKING_LINE - - // Load pre-template - $content['msg'] = LOAD_TEMPLATE('show_bonus_msg', true, $content); - } else { - // No data found - $content['msg'] = "{--BONUS_SHOW_NO_DATA--}"; - } - - // Free memory - SQL_FREERESULT($result); + array(bigintval(REQUEST_GET('uid')), $t, bigintval(REQUEST_GET('d'))), __FILE__, __LINE__); + + // Entry found? + if (SQL_NUMROWS($result) == 1) { + // Load data + $content = SQL_FETCHARRAY($result); + + // Prepare constants for the pre-template + $content['gender'] = translateGender($content['gender']); + $content['points'] = translateComma($content['points']); + $content['mailid'] = bigintval(REQUEST_GET('d')); + $content['rows'] = BONUS_MAKE_RANK_ROWS(bigintval(REQUEST_GET('d')), $t, bigintval(REQUEST_GET('uid'))); + + // Constant created within previous function which contains informations for current user's ranking position: + // @TODO Rewrite this constant + // __YOUR_RANKING_LINE + + // Load pre-template + $content['msg'] = LOAD_TEMPLATE('show_bonus_msg', true, $content); } else { - // Wrong type entered - $content['msg'] = "{--BONUS_SHOW_WRONG_TYPE--}"; + // No data found + $content['msg'] = "{--BONUS_SHOW_NO_DATA--}"; } + + // Free memory + SQL_FREERESULT($result); } else { - // Wrong call! - $content['msg'] = "{--BONUS_SHOW_WRONG_CALL--}"; + // Wrong type entered + $content['msg'] = "{--BONUS_SHOW_WRONG_TYPE--}"; } +} else { + // Wrong call! + $content['msg'] = "{--BONUS_SHOW_WRONG_CALL--}"; +} - // Load send_bonus header template (for your banners, e.g.?) - $content['header'] = LOAD_TEMPLATE('show_bonus_header', true); - - // Load show_bonus footer template (for your banners, e.g.?) - $content['footer'] = LOAD_TEMPLATE('show_bonus_footer', true); +// Load send_bonus header template (for your banners, e.g.?) +$content['header'] = LOAD_TEMPLATE('show_bonus_header', true); - // Total ranks who can win - $content['total_ranks'] = getConfig('bonus_ranks'); +// Load show_bonus footer template (for your banners, e.g.?) +$content['footer'] = LOAD_TEMPLATE('show_bonus_footer', true); - // Load final template - LOAD_TEMPLATE('show_bonus', false, $content); +// Total ranks who can win +$content['total_ranks'] = getConfig('bonus_ranks'); - // Include footer - loadIncludeOnce('inc/footer.php'); -} else { - // You have to install first! - redirectToUrl('install.php'); -} +// Load final template +LOAD_TEMPLATE('show_bonus', false, $content); -// Really all done here... ;-) -shutdown(); +// Include footer +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?> diff --git a/sponsor_confirm.php b/sponsor_confirm.php index f05494d63e..6fc90cdcff 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -52,26 +52,23 @@ $GLOBALS['output_mode'] = '0'; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Base URL for redirection - $URL = 'modules.php?module=index&what=sponsor_login&hash='; - if (!REQUEST_ISSET_GET('hash')) { - // No refid and we add our refid (don't forget to set $def_refid!) - $URL = 'modules.php?module=index'; - } else { - // We have an refid here. So we simply add it - $URL .= REQUEST_GET('hash'); - } - - // Load the URL - redirectToUrl($URL); -} else { +if (!isInstalled()) { // You have to install first! redirectToUrl('install.php'); +} // END - if + +// Base URL for redirection +$URL = 'modules.php?module=index&what=sponsor_login&hash='; +if (!REQUEST_ISSET_GET('hash')) { + // No refid and we add our refid (don't forget to set $def_refid!) + $URL = 'modules.php?module=index'; +} else { + // We have an refid here. So we simply add it + $URL .= REQUEST_GET('hash'); } -// Really all done here... ;-) -shutdown(); +// Load the URL +redirectToUrl($URL); -// +// [EOF] ?> diff --git a/sponsor_ref.php b/sponsor_ref.php index 6550c31591..9c1920254f 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -52,32 +52,29 @@ $GLOBALS['output_mode'] = '0'; require('inc/config-global.php'); // Redirect only to registration page when this script is installed -if (isInstalled()) { - // Base URL for redirection - $URL = 'modules.php?module=index&what=sponsor_reg&refid='; +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if - // Get referal ID from ref or refid variable - $ref = 0; - if (REQUEST_ISSET_GET(('ref'))) $ref = bigintval(REQUEST_GET('ref')); - elseif (REQUEST_ISSET_GET(('refid'))) $ref = bigintval(REQUEST_GET('refid')); +// Base URL for redirection +$URL = 'modules.php?module=index&what=sponsor_reg&refid='; - if (!empty($ref)) { - // We have an refid here. So we simply add it - $URL .= $ref; - } else { - // No refid so we redirect to the index page - $URL = 'index.php'; - } +// Get referal ID from ref or refid variable +$ref = 0; +if (REQUEST_ISSET_GET(('ref'))) $ref = bigintval(REQUEST_GET('ref')); +elseif (REQUEST_ISSET_GET(('refid'))) $ref = bigintval(REQUEST_GET('refid')); - // Load the URL - redirectToUrl($URL); +if (!empty($ref)) { + // We have an refid here. So we simply add it + $URL .= $ref; } else { - // You have to install first! - redirectToUrl('install.php'); + // No refid so we redirect to the index page + $URL = 'index.php'; } -// Really all done here... ;-) -shutdown(); +// Load the URL +redirectToUrl($URL); -// +// [EOF] ?> diff --git a/surfbar.php b/surfbar.php index 8f313fd4b3..d119e1bd83 100644 --- a/surfbar.php +++ b/surfbar.php @@ -55,156 +55,153 @@ $msg = null; require('inc/config-global.php'); // Is the script installed? -if (isInstalled()) { - // Only logged in users may use this surfbar! - redirectOnUninstalledExtension('surfbar'); - - // No member? - if (!IS_MEMBER()) { - // Redirect - // @TODO Display quick login form here or redirect as configured - redirectToUrl('modules.php?module=index'); - } // END - if - - // Handle tasks on self-maintenance - SURFBAR_HANDLE_SELF_MAINTENANCE(); - - // Is there a check value? - if ((SURFBAR_CHECK_RELOAD_FULL()) || ((REQUEST_ISSET_GET('frame')) && (in_array(REQUEST_GET('frame'), array('stop', 'stop2', 'stats', 'textlinks'))))) { - // Reload-lock is full, surfbar stopped so... - // Load header - loadIncludeOnce('inc/header.php'); - - // Load template - if (((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'stop')) || (!REQUEST_ISSET_GET('frame'))) { - // Load template for "start" page - LOAD_TEMPLATE('surfbar_frame_start'); - - // Load banner - LOAD_TEMPLATE('surfbar_start_banner'); - - // This makes the footer appear again - REQUEST_UNSET_GET('frame'); - } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'stats')) { - // Get total points amount - $points = GET_TOTAL_DATA(getUserId(), 'user_points', 'points') - GET_TOTAL_DATA(getUserId(), 'user_data', 'used_points'); - - // Prepare content - $content = array( - 'points' => translateComma($points), - 'online' => SURFBAR_DETERMINE_TOTAL_ONLINE(), - 'reload' => (getConfig('surfbar_stats_reload') * 1000), - 'c_total' => translateComma(getConfig('surfbar_total_counter')), - 'c_today' => translateComma(getConfig('surfbar_daily_counter')), - 'c_yester' => translateComma(getConfig('surfbar_yester_counter')), - 'c_week' => translateComma(getConfig('surfbar_weekly_counter')), - 'c_month' => translateComma(getConfig('surfbar_monthly_counter')), - ); +if (!isInstalled()) { + // You have to install first! + redirectToUrl('install.php'); +} // END - if - // Load template for "stats" page - LOAD_TEMPLATE('surfbar_frame_stats', false, $content); - } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'textlinks')) { - // Prepare content - $content = array( - 'online' => SURFBAR_DETERMINE_TOTAL_ONLINE(), - 'reload' => (getConfig('surfbar_stats_reload') * 1000) - ); +// Only logged in users may use this surfbar! +redirectOnUninstalledExtension('surfbar'); - // Load template for "stats" page - LOAD_TEMPLATE('surfbar_frame_textlinks', false, $content); - } else { - // Prepare content - $content = array( - 'restart' => getConfig('surfbar_restart_time'), - 'start' => str_repeat('X', strlen(getConfig('surfbar_restart_time'))), - 'autostart' => (getConfig('surfbar_autostart') == 'Y') ? 'true' : 'false' - ); +// No member? +if (!IS_MEMBER()) { + // Redirect + // @TODO Display quick login form here or redirect as configured + redirectToUrl('modules.php?module=index'); +} // END - if - // Load template for stopped surfbar - LOAD_TEMPLATE('surfbar_stopped', false, $content); - } - } elseif ((REQUEST_ISSET_GET(('check'))) && (REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET(('salt')))) { - // Dummy next id get - SURFBAR_DETERMINE_NEXT_ID(REQUEST_GET('id')); - - // Check reload lock and validation code - if ((!SURFBAR_CHECK_RELOAD_LOCK(REQUEST_GET('id'))) && (SURFBAR_CHECK_VALIDATION_CODE(REQUEST_GET('id'), REQUEST_GET('check'), REQUEST_GET('salt')))) { - // Lock the URL (id) down - SURFBAR_LOCKDOWN_ID(REQUEST_GET('id')); - - // Code is valid so pay points here - SURFBAR_PAY_POINTS(); - - // Check if reload is full - if (SURFBAR_CHECK_RELOAD_FULL()) { - // Then load waiting page - SURFBAR_RELOAD_TO_STOP_PAGE(); - } // END - if - } else { - // Reload to stop frame! - SURFBAR_RELOAD_TO_STOP_PAGE(); - } +// Handle tasks on self-maintenance +SURFBAR_HANDLE_SELF_MAINTENANCE(); + +// Is there a check value? +if ((SURFBAR_CHECK_RELOAD_FULL()) || ((REQUEST_ISSET_GET('frame')) && (in_array(REQUEST_GET('frame'), array('stop', 'stop2', 'stats', 'textlinks'))))) { + // Reload-lock is full, surfbar stopped so... + // Load header + loadIncludeOnce('inc/header.php'); + + // Load template + if (((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'stop')) || (!REQUEST_ISSET_GET('frame'))) { + // Load template for "start" page + LOAD_TEMPLATE('surfbar_frame_start'); + + // Load banner + LOAD_TEMPLATE('surfbar_start_banner'); + + // This makes the footer appear again + REQUEST_UNSET_GET('frame'); + } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'stats')) { + // Get total points amount + $points = GET_TOTAL_DATA(getUserId(), 'user_points', 'points') - GET_TOTAL_DATA(getUserId(), 'user_data', 'used_points'); + + // Prepare content + $content = array( + 'points' => translateComma($points), + 'online' => SURFBAR_DETERMINE_TOTAL_ONLINE(), + 'reload' => (getConfig('surfbar_stats_reload') * 1000), + 'c_total' => translateComma(getConfig('surfbar_total_counter')), + 'c_today' => translateComma(getConfig('surfbar_daily_counter')), + 'c_yester' => translateComma(getConfig('surfbar_yester_counter')), + 'c_week' => translateComma(getConfig('surfbar_weekly_counter')), + 'c_month' => translateComma(getConfig('surfbar_monthly_counter')), + ); + + // Load template for "stats" page + LOAD_TEMPLATE('surfbar_frame_stats', false, $content); + } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'textlinks')) { + // Prepare content + $content = array( + 'online' => SURFBAR_DETERMINE_TOTAL_ONLINE(), + 'reload' => (getConfig('surfbar_stats_reload') * 1000) + ); - // All done, so fix notice for footer.php - $GLOBALS['footer_sent'] = 1; + // Load template for "stats" page + LOAD_TEMPLATE('surfbar_frame_textlinks', false, $content); } else { // Prepare content - $content = ''; - - // Determine template name - $templateName = SURFBAR_DETERMINE_TEMPLATE_NAME(); - - // Frame "top" set? - if ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'top')) { - // Determine next id - $nextId = SURFBAR_DETERMINE_NEXT_ID(); - - // Is there a valid id? - if ($nextId > 0) { - // Then prepare other content - $content = array( - 'id' => $nextId, - 'check' => SURFBAR_GENERATE_VALIDATION_CODE($nextId), - 'salt' => SURFBAR_GET_SALT(), - 'reward' => translateComma(SURFBAR_GET_REWARD($nextId)), - 'url' => SURFBAR_GET_URL($nextId), - 'curr_reload' => SURFBAR_GET_USER_LOCKS(), - 'max_urls' => SURFBAR_GET_TOTAL_URLS(), - 'reload' => SURFBAR_GET_RELOAD_TIME($nextId), - 'xxx' => str_repeat('X', strlen(SURFBAR_GET_RELOAD_TIME($nextId))) - ); - - // Update salt (double-call lock!) and statistics - SURFBAR_UPDATE_SALT_STATS(); - } else { - // Load new URL - SURFBAR_RELOAD_TO_STOP_PAGE('stop2'); - } - } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'start')) { - // Starter frame found so let the footer display - REQUEST_UNSET_GET('frame'); - } else { - // Load header in frameset mode - $isFrameset = true; - } + $content = array( + 'restart' => getConfig('surfbar_restart_time'), + 'start' => str_repeat('X', strlen(getConfig('surfbar_restart_time'))), + 'autostart' => (getConfig('surfbar_autostart') == 'Y') ? 'true' : 'false' + ); + + // Load template for stopped surfbar + LOAD_TEMPLATE('surfbar_stopped', false, $content); + } +} elseif ((REQUEST_ISSET_GET(('check'))) && (REQUEST_ISSET_GET('id')) && (REQUEST_ISSET_GET(('salt')))) { + // Dummy next id get + SURFBAR_DETERMINE_NEXT_ID(REQUEST_GET('id')); - // Load header - loadIncludeOnce('inc/header.php'); + // Check reload lock and validation code + if ((!SURFBAR_CHECK_RELOAD_LOCK(REQUEST_GET('id'))) && (SURFBAR_CHECK_VALIDATION_CODE(REQUEST_GET('id'), REQUEST_GET('check'), REQUEST_GET('salt')))) { + // Lock the URL (id) down + SURFBAR_LOCKDOWN_ID(REQUEST_GET('id')); - // Load that template - //* DEBUG: */ die("templateName={$templateName}
\ncontent=
".print_r($content, true)."
"); - LOAD_TEMPLATE($templateName, false, $content); + // Code is valid so pay points here + SURFBAR_PAY_POINTS(); + + // Check if reload is full + if (SURFBAR_CHECK_RELOAD_FULL()) { + // Then load waiting page + SURFBAR_RELOAD_TO_STOP_PAGE(); + } // END - if + } else { + // Reload to stop frame! + SURFBAR_RELOAD_TO_STOP_PAGE(); } - // Load footer - loadIncludeOnce('inc/footer.php'); + // All done, so fix notice for footer.php + $GLOBALS['footer_sent'] = 1; } else { - // You have to install first! - redirectToUrl('install.php'); + // Prepare content + $content = ''; + + // Determine template name + $templateName = SURFBAR_DETERMINE_TEMPLATE_NAME(); + + // Frame "top" set? + if ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'top')) { + // Determine next id + $nextId = SURFBAR_DETERMINE_NEXT_ID(); + + // Is there a valid id? + if ($nextId > 0) { + // Then prepare other content + $content = array( + 'id' => $nextId, + 'check' => SURFBAR_GENERATE_VALIDATION_CODE($nextId), + 'salt' => SURFBAR_GET_SALT(), + 'reward' => translateComma(SURFBAR_GET_REWARD($nextId)), + 'url' => SURFBAR_GET_URL($nextId), + 'curr_reload' => SURFBAR_GET_USER_LOCKS(), + 'max_urls' => SURFBAR_GET_TOTAL_URLS(), + 'reload' => SURFBAR_GET_RELOAD_TIME($nextId), + 'xxx' => str_repeat('X', strlen(SURFBAR_GET_RELOAD_TIME($nextId))) + ); + + // Update salt (double-call lock!) and statistics + SURFBAR_UPDATE_SALT_STATS(); + } else { + // Load new URL + SURFBAR_RELOAD_TO_STOP_PAGE('stop2'); + } + } elseif ((REQUEST_ISSET_GET('frame')) && (REQUEST_GET('frame') == 'start')) { + // Starter frame found so let the footer display + REQUEST_UNSET_GET('frame'); + } else { + // Load header in frameset mode + $isFrameset = true; + } + + // Load header + loadIncludeOnce('inc/header.php'); + + // Load that template + //* DEBUG: */ die("templateName={$templateName}
\ncontent=
".print_r($content, true)."
"); + LOAD_TEMPLATE($templateName, false, $content); } -// Really all done here... ;-) -shutdown(); +// Load footer +loadIncludeOnce('inc/footer.php'); -// +// [EOF] ?>