From f7d1229840cdae4ba22fdf375265bca4fb4a2d32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 28 Jun 2011 20:39:41 +0000 Subject: [PATCH] Renamed some all-capitalized variables small --- confirm.php | 6 ++--- inc/config-global.php | 18 +++++++++------ inc/functions.php | 48 +++++++++++++++++++++------------------ inc/wrapper-functions.php | 6 ++--- mailid.php | 6 ++--- modules.php | 1 - ref.php | 8 +++---- sponsor_confirm.php | 6 ++--- sponsor_ref.php | 11 ++++----- surfbar.php | 4 ++-- 10 files changed, 59 insertions(+), 55 deletions(-) diff --git a/confirm.php b/confirm.php index 6c283d3fee..b17229394b 100644 --- a/confirm.php +++ b/confirm.php @@ -49,16 +49,16 @@ require('inc/config-global.php'); setContentType('text/html'); // No hash provided then we redirect to the right page -$URL = 'modules.php?module=index&what=confirm'; +$url = 'modules.php?module=index&what=confirm'; // Is the hash there? if (isGetRequestParameterSet('hash')) { // We have a hash here. So we simply add it - $URL .= '&hash=' . getRequestParameter('hash'); + $url .= '&hash=' . getRequestParameter('hash'); } // END - if // Load the URL -redirectToUrl($URL); +redirectToUrl($url); // [EOF] ?> diff --git a/inc/config-global.php b/inc/config-global.php index e4ad948336..425f89082e 100644 --- a/inc/config-global.php +++ b/inc/config-global.php @@ -56,16 +56,16 @@ error_reporting(E_ALL | E_STRICT); // CFG: REGISTER-GLOBALS @import_request_variables(''); -// Detect path -$PATH = str_replace("\\", '/', substr(dirname(__FILE__), 0, -3)); +// Detect path and fix windozer paths +$path = str_replace("\\", '/', substr(dirname(__FILE__), 0, -3)); // Some very important function includes -foreach (array('config','wrapper','template','module','inc','stats','http') as $inc) { - include($PATH . 'inc/' . $inc . '-functions.php'); +foreach (array('config', 'wrapper', 'template', 'module', 'inc', 'stats', 'http') as $inc) { + include($path . 'inc/' . $inc . '-functions.php'); } // END - foreach -// Own functions -include($PATH . 'inc/functions.php'); +// General functions +include($path . 'inc/functions.php'); // Auto-detection... (patched by "Stelzi" aka. profi-concept, thanks again!) $URL = 'http://' . detectServerName() . str_replace("\\", '/', dirname($_SERVER['PHP_SELF'])); @@ -81,7 +81,7 @@ setConfigEntry('URL', $URL); setConfigEntry('DOMAIN', detectDomainName()); // CFG: SERVER-PATH -setConfigEntry('PATH', $PATH); +setConfigEntry('PATH', $path); // CFG: VERSION setConfigEntry('VERSION', 'v0.2.1'); @@ -110,6 +110,10 @@ setConfigEntry('salt_length', 10); // CFG: MINIMUM-ADMIN-PASS-LENGTH setConfigEntry('minium_admin_pass_length', 4); +// Remove maybe conflicting variables +unset($url); +unset($path); + // Connect to the database... loadIncludeOnce('inc/mysql-connect.php'); diff --git a/inc/functions.php b/inc/functions.php index dbb38836ce..6f570cdd1f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -478,22 +478,22 @@ function translateMenuVisibleLocked ($content, $prefix = '') { } // Generates an URL for the dereferer -function generateDerefererUrl ($URL) { +function generateDerefererUrl ($url) { // Don't de-refer our own links! - if (substr($URL, 0, strlen(getUrl())) != getUrl()) { + if (substr($url, 0, strlen(getUrl())) != getUrl()) { // De-refer this link - $URL = '{%url=modules.php?module=loader&url=' . encodeString(compileUriCode($URL)) . '%}'; + $url = '{%url=modules.php?module=loader&url=' . encodeString(compileUriCode($url)) . '%}'; } // END - if // Return link - return $URL; + return $url; } // Generates an URL for the frametester -function generateFrametesterUrl ($URL) { +function generateFrametesterUrl ($url) { // Prepare frametester URL $frametesterUrl = sprintf("{%%url=modules.php?module=frametester&url=%s%%}", - encodeString(compileUriCode($URL)) + encodeString(compileUriCode($url)) ); // Return the new URL @@ -540,26 +540,28 @@ function makeTime ($hours, $minutes, $seconds, $stamp) { } // Redirects to an URL and if neccessarry extends it with own base URL -function redirectToUrl ($URL, $allowSpider = true) { +function redirectToUrl ($url, $allowSpider = true) { // Remove {%url= - if (substr($URL, 0, 6) == '{%url=') $URL = substr($URL, 6, -2); + if (substr($url, 0, 6) == '{%url=') { + $url = substr($url, 6, -2); + } // END - if // Compile out codes - eval('$URL = "' . compileRawCode(encodeUrl($URL)) . '";'); + eval('$url = "' . compileRawCode(encodeUrl($url)) . '";'); // Default 'rel' value is external, nofollow is evil from Google and hurts the Internet $rel = ' rel="external"'; // Do we have internal or external URL? - if (substr($URL, 0, strlen(getUrl())) == getUrl()) { + if (substr($url, 0, strlen(getUrl())) == getUrl()) { // Own (=internal) URL $rel = ''; } // END - if // Three different ways to debug... - //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'URL=' . $URL); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $URL); - //* DEBUG: */ die($URL); + //* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, 'URL=' . $url); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $url); + //* DEBUG: */ die($url); // We should not sent a redirect if headers are already sent if (!headers_sent()) { @@ -570,11 +572,11 @@ function redirectToUrl ($URL, $allowSpider = true) { $GLOBALS['output'] = ''; // Load URL when headers are not sent - sendRawRedirect(doFinalCompilation(str_replace('&', '&', $URL), false)); + sendRawRedirect(doFinalCompilation(str_replace('&', '&', $url), false)); } else { // Output error message loadInclude('inc/header.php'); - loadTemplate('redirect_url', false, str_replace('&', '&', $URL)); + loadTemplate('redirect_url', false, str_replace('&', '&', $url)); loadInclude('inc/footer.php'); } @@ -844,24 +846,26 @@ function isEmailValid ($email) { } // Function taken from user comments on www.php.net / function isInStringIgnoreCase() -function isUrlValid ($URL, $compile=true) { +function isUrlValid ($url, $compile=true) { // Trim URL a little - $URL = trim(urldecode($URL)); - //* DEBUG: */ debugOutput($URL); + $url = trim(urldecode($url)); + //* DEBUG: */ debugOutput($url); // Compile some chars out... - if ($compile === true) $URL = compileUriCode($URL, false, false, false); - //* DEBUG: */ debugOutput($URL); + if ($compile === true) { + $url = compileUriCode($url, false, false, false); + } // END - if + //* DEBUG: */ debugOutput($url); // Check for the extension filter if (isExtensionActive('filter')) { // Use the extension's filter set - return FILTER_VALIDATE_URL($URL, false); + return FILTER_VALIDATE_URL($url, false); } // END - if // If not installed, perform a simple test. Just make it sure there is always a http:// or // https:// in front of the URLs - return isUrlValidSimple($URL); + return isUrlValidSimple($url); } // Generate a hash for extra-security for all passwords diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 0c2c4425ef..eeed642ae7 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -752,7 +752,7 @@ function redirectToConfiguredUrl ($configEntry) { // Wrapper function to redirect from member-only modules to index function redirectToIndexMemberOnlyModule () { // Do the redirect here - redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule()); + redirectToUrl('modules.php?module=index&code=' . getCode('MODULE_MEMBER_ONLY') . '&mod=' . getModule()); } // Wrapper function to redirect to current URL @@ -761,9 +761,9 @@ function redirectToRequestUri () { } // Wrapper function to redirect to de-refered URL -function redirectToDereferedUrl ($URL) { +function redirectToDereferedUrl ($url) { // Redirect to to - redirectToUrl(generateDerefererUrl($URL)); + redirectToUrl(generateDerefererUrl($url)); } // Wrapper function for checking if extension is installed and newer or same version diff --git a/mailid.php b/mailid.php index 3ae1fa55b8..7f1746bdfb 100644 --- a/mailid.php +++ b/mailid.php @@ -117,7 +117,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr if (SQL_NUMROWS($result) == 1) { // Load data - list($pool, $URL, $title) = SQL_FETCHROW($result); + list($pool, $url, $title) = SQL_FETCHROW($result); // Free result SQL_FREERESULT($result); @@ -177,7 +177,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr 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 = getUrl(); + $url = getUrl(); $time = 1; } // END - if @@ -190,7 +190,7 @@ if ((isValidUserId($userId)) && (($mailId > 0) || ($bonusId > 0)) && (!ifFatalEr 'userid' => $userId, 'type' => $type, 'data' => $urlId, - 'url' => $URL + 'url' => $url ); // Load template diff --git a/modules.php b/modules.php index 2b1b2acf75..247d98cd48 100644 --- a/modules.php +++ b/modules.php @@ -59,7 +59,6 @@ loadIncludeOnce('inc/header.php'); // Modules are by default not valid! $isModuleValid = false; -$URL = ''; // Init module state as 'failed' (always failed first) $moduleState = 'failed'; diff --git a/ref.php b/ref.php index f6e5f1913b..4eb1fe139f 100644 --- a/ref.php +++ b/ref.php @@ -49,7 +49,7 @@ require('inc/config-global.php'); setContentType('text/html'); // No refid by default -$URL = 'modules.php?module=index'; +$url = 'modules.php?module=index'; if (isValidUserId(determineReferalId())) { // Test if nickname or numeric id @@ -85,18 +85,18 @@ if (isValidUserId(determineReferalId())) { // Base URL for redirection switch (getConfig('refid_target')) { case 'register': - $URL = 'modules.php?module=index&what=register'; + $url = 'modules.php?module=index&what=register'; break; case 'index': - $URL = 'modules.php?module=index'; + $url = 'modules.php?module=index'; break; } // END - switch } // END - if } // END - if // Load the URL -redirectToUrl($URL); +redirectToUrl($url); // [EOF] ?> diff --git a/sponsor_confirm.php b/sponsor_confirm.php index ea061a4d64..efa72fcc5f 100644 --- a/sponsor_confirm.php +++ b/sponsor_confirm.php @@ -50,16 +50,16 @@ require('inc/config-global.php'); setContentType('text/html'); // No hash provided by default -$URL = 'modules.php?module=index'; +$url = 'modules.php?module=index'; // Is there a hash? if (isGetRequestParameterSet('hash')) { // We have an refid here. So we simply add it - $URL = 'modules.php?module=index&what=sponsor_login&hash=' . getRequestParameter('hash'); + $url = 'modules.php?module=index&what=sponsor_login&hash=' . getRequestParameter('hash'); } // END - if // Load the URL -redirectToUrl($URL); +redirectToUrl($url); // [EOF] ?> diff --git a/sponsor_ref.php b/sponsor_ref.php index 2656eb9c89..d6cbd1f0de 100644 --- a/sponsor_ref.php +++ b/sponsor_ref.php @@ -50,19 +50,16 @@ require('inc/config-global.php'); setContentType('text/html'); // Base URL for redirection -$URL = 'modules.php?module=index&what=sponsor_reg&refid='; +$url = 'modules.php?module=index'; // Do we have a referal id? if (isValidUserId($GLOBALS['refid'])) { // We have an refid here. So we simply add it - $URL .= $GLOBALS['refid']; -} else { - // No refid so we redirect to the index page - $URL = 'modules.php?module=index'; -} + $url .= '&what=sponsor_reg&refid=' . $GLOBALS['refid']; +} // END - if // Load the URL -redirectToUrl($URL); +redirectToUrl($url); // [EOF] ?> diff --git a/surfbar.php b/surfbar.php index eb9ab63004..cb718f47b8 100644 --- a/surfbar.php +++ b/surfbar.php @@ -68,10 +68,10 @@ if (!isMember()) { // Is the form sent? if ((isFormSent()) && (isPostRequestParameterSet('id')) && (isPostRequestParameterSet('password'))) { // Do the login procedure - $URL = doUserLogin(postRequestParameter('id'), postRequestParameter('password'), basename(__FILE__), basename(__FILE__) . '?code='); + $url = doUserLogin(postRequestParameter('id'), postRequestParameter('password'), basename(__FILE__), basename(__FILE__) . '?code='); // And redirect to the URL - redirectToUrl($URL); + redirectToUrl($url); } else { // Load header loadIncludeOnce('inc/header.php'); -- 2.39.2