// Deprecated : $length
// Optional : $DATA
//
-function generateRandomCodde ($length, $code, $uid, $DATA = '') {
+function generateRandomCode ($length, $code, $uid, $DATA = '') {
// Fix missing _MAX constant
// @TODO Rewrite this unnice code
if (!defined('_MAX')) define('_MAX', 15235);
$url = constant('SERVER_URL');
// Is this URL valid?
- if (substr($script, 0, 7) == "http://") {
+ if (substr($script, 0, 7) == 'http://') {
// Use the hostname from script URL as new hostname
$url = substr($script, 7);
$extract = explode('/', $url);
} // END - if
// Extract host name
- $host = str_replace("http://", '', $url);
+ $host = str_replace('http://', '', $url);
if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
// Generate relative URL
//* DEBUG: */ print("SCRIPT=".$script."<br />\n");
- if (substr(strtolower($script), 0, 7) == "http://") {
+ if (substr(strtolower($script), 0, 7) == 'http://') {
// But only if http:// is in front!
$script = substr($script, (strlen($url) + 7));
} elseif (substr(strtolower($script), 0, 8) == "https://") {
// Open connection
//* DEBUG: */ die("SCRIPT=".$script."<br />\n");
- if ($useProxy) {
- $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), getConfig('proxy_port'), $errno, $errdesc, 30);
+ if ($useProxy === true) {
+ // Connect to host through proxy connection
+ $fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
} else {
+ // Connect to host directly
$fp = @fsockopen($host, 80, $errno, $errdesc, 30);
}
} // END - if
// Do we use proxy?
- if ($useProxy) {
+ if ($useProxy === true) {
// Generate CONNECT request header
$proxyTunnel = "CONNECT " . $host . ":80 HTTP/1.1" . getConfig('HTTP_EOL');
$proxyTunnel .= "Host: " . $host . getConfig('HTTP_EOL');
// Use login data to proxy? (username at least!)
if (getConfig('proxy_username') != '') {
// Add it as well
- $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')).getConfig('ENCRYPT_SEPERATOR').COMPILE_CODE(getConfig('proxy_password')));
+ $encodedAuth = base64_encode(COMPILE_CODE(getConfig('proxy_username')) . getConfig('ENCRYPT_SEPERATOR') . COMPILE_CODE(getConfig('proxy_password')));
$proxyTunnel .= "Proxy-Authorization: Basic " . $encodedAuth . getConfig('HTTP_EOL');
} // END - if
//* DEBUG: */ print("<strong>Response:</strong><pre>".print_r($response, true)."</pre>");
// Proxy agent found?
- if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy)) {
+ if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) {
// Proxy header detected, so remove two lines
array_shift($response);
array_shift($response);
case getCode('EXTENSION_PROBLEM'):
if (REQUEST_ISSET_GET('ext')) {
- $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), REQUEST_GET('ext'));
+ $msg = generateExtensionInactiveMessage(REQUEST_GET('ext'));
} else {
$msg = getMessage('EXTENSION_PROBLEM_UNSET_EXT');
}
return ((isset($GLOBALS['extra_title'])) && (!empty($GLOBALS['extra_title'])));
}
+// Generates a 'extension foo inactive' message
+function generateExtensionInactiveMessage ($ext) {
+ // Is the extension empty?
+ if (empty($ext)) {
+ // This should not happen
+ trigger_error(__FUNCTION__ . ': Parameter ext is empty. This should not happen.');
+ } // END - if
+
+ // Default message
+ $msg = sprintf(getMessage('EXTENSION_PROBLEM_EXT_INACTIVE'), $ext);
+
+ // Is an admin logged in?
+ if (IS_ADMIN()) {
+ // Then output admin message
+ $msg = sprintf(getMessage('ADMIN_EXTENSION_PROBLEM_EXT_INACTIVE'), $ext);
+ } // END - if
+
+ // Return prepared message
+ return $msg;
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////