// Init counter
$cnt = '0';
+ // Add page header and footer
+ addPageHeaderFooter();
+
// Compile all out
while (((strpos($GLOBALS['output'], '{--') > 0) || (strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) {
// Init common variables
} // END - if
// Load user's data
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$userid},template={$template},content[]=".gettype($content).'<br />');
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):UID={$userid},template={$template},content[]=".gettype($content).'<br />');
if (($userid > 0) && (is_array($content))) {
// If nickname extension is installed, fetch nickname as well
if ((isExtensionActive('nickname')) && (isNicknameUsed($userid))) {
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):NICKNAME!<br />");
// Load by nickname
fetchUserData($userid, 'nickname');
} else {
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NO-NICK!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):NO-NICK!<br />");
/// Load by userid
fetchUserData($userid);
}
// Merge data if valid
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):content()=".count($content)." - PRE<br />");
if (isUserDataValid()) {
$content = merge_array($content, getUserDataArray());
} // END - if
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):content()=".count($content)." - AFTER<br />");
} // END - if
// Translate M to male or F to female if present
// Send mail out to an email address
function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '') {
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />");
// Compile subject line (for POINTS constant etc.)
eval("\$subject = decodeEntities(\"".compileRawCode(escapeQuotes($subject))."\");");
// Is the webmaster!
$toEmail = getConfig('WEBMASTER');
}
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):TO={$toEmail}<br />");
// Check for PHPMailer or debug-mode
if (!checkPhpMailerUsage()) {
} // END - if
// Three different ways to debug...
- //* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL));
+ /* DEBUG: */ debug_report_bug(sprintf("%s[%s:] URL=%s", __FUNCTION__, __LINE__, $URL));
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'URL=' . $URL);
//* DEBUG: */ die($URL);
// Secure the URL against bad things such als HTML insertions and so on...
$URL = secureString($URL);
+ // Set content-type here to fix a missing array element
+ setContentType('text/html');
+
// Output new location link as anchor
outputHtml('<a href="' . $URL . '"' . $rel . '>' . $URL . '</a>');
} elseif (!headers_sent()) {
$test = substr($found, 0, strlen($match));
// Does this entry exist?
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found={$found},match={$match},set={$set}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):found={$found},match={$match},set={$set}<br />");
if ($test == $match) {
// Match found!
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):fuzzyFound!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):fuzzyFound!<br />");
$fuzzyFound = true;
break;
} // END - if
// Take all string elements
if ((is_string($matches[4][$key])) && (!isset($matchesFound[$match])) && (!isset($matchesFound[$key."_" . $matches[4][$key]]))) {
// Replace it in the code
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):key={$key},match={$match}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):key={$key},match={$match}<br />");
$newMatch = str_replace('[', "['", str_replace(']', "']", $match));
$code = str_replace($match, '".' . $newMatch . '."', $code);
$matchesFound[$key . '_' . $matches[4][$key]] = 1;
$matchesFound[$match] = 1;
} elseif (!isset($matchesFound[$match])) {
// Not yet replaced!
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):match={$match}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):match={$match}<br />");
$code = str_replace($match, '".' . $match . '."', $code);
$matchesFound[$match] = 1;
}
$NAV = '';
for ($page = 1; $page <= $PAGES; $page++) {
// Is the page currently selected or shall we generate a link to it?
- if (($page == getRequestElement('page')) || ((!isGetRequestElementSet('page')) && ($page == 1))) {
+ if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
// Is currently selected, so only highlight it
$NAV .= '<strong>-';
} else {
$NAV .= '<a href="{%url=modules.php?module=admin&what=' . getWhat() . '&page=' . $page . '&offset=' . $offset;
// Add userid when we shall show all mails from a single member
- if ((isGetRequestElementSet('userid')) && (bigintval(getRequestElement('userid')) > 0)) $NAV .= '&userid=' . bigintval(getRequestElement('userid'));
+ if ((isGetRequestParameterSet('userid')) && (bigintval(getRequestParameter('userid')) > 0)) $NAV .= '&userid=' . bigintval(getRequestParameter('userid'));
// Close open anchor tag
$NAV .= '%}">';
}
$NAV .= $page;
- if (($page == getRequestElement('page')) || ((!isGetRequestElementSet('page')) && ($page == 1))) {
+ if (($page == getRequestParameter('page')) || ((!isGetRequestParameterSet('page')) && ($page == 1))) {
// Is currently selected, so only highlight it
$NAV .= '-</strong>';
} else {
// Add script data
$script .= $body;
+ // Remove trailed & to make it more conform
+ if (substr($script, -1, 1) == '&') $script = substr($script, 0, -1);
+
// Generate GET request header
$request = 'GET /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL');
$request .= 'Host: ' . $host . getConfig('HTTP_EOL');
$request .= 'Accept-Charset: UTF-8,*' . getConfig('HTTP_EOL');
$request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL');
$request .= 'Content-Type: text/plain' . getConfig('HTTP_EOL');
- $request .= 'Content-Length: '.strlen($body) . getConfig('HTTP_EOL');
- $request .= 'Connection: Close' . getConfig('HTTP_EOL') . getConfig('HTTP_EOL');
+ $request .= 'Content-Length: 0' . getConfig('HTTP_EOL');
+ $request .= 'Connection: close' . getConfig('HTTP_EOL');
+ $request .= getConfig('HTTP_EOL');
// Send the raw request
$response = sendRawRequest($host, $request);
$request .= 'User-Agent: ' . getConfig('TITLE') . '/' . getConfig('FULL_VERSION') . getConfig('HTTP_EOL');
$request .= 'Cache-Control: no-cache' . getConfig('HTTP_EOL');
$request .= 'Content-Type: application/x-www-form-urlencoded' . getConfig('HTTP_EOL');
- $request .= 'Connection: Close' . getConfig('HTTP_EOL') . getConfig('HTTP_EOL');
+ $request .= 'Connection: close' . getConfig('HTTP_EOL');
+ $request .= getConfig('HTTP_EOL');
+
+ // Add body
$request .= $body;
// Send the raw request
//* DEBUG: */ die("SCRIPT=" . $script.'<br />');
if ($useProxy === true) {
// Connect to host through proxy connection
- $fp = @fsockopen(compileRawCode(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
+ $fp = fsockopen(compileRawCode(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
} else {
// Connect to host directly
- $fp = @fsockopen($host, 80, $errno, $errdesc, 30);
+ $fp = fsockopen($host, 80, $errno, $errdesc, 30);
}
// Is there a link?
if (!is_resource($fp)) {
// Failed!
+ logDebugMessage(__FUNCTION__, __LINE__, $errdesc . ' (' . $errno . ')');
return $response;
- } // END - if
+ } elseif ((!stream_set_blocking($fp, 0)) || (!stream_set_timeout($fp, 1))) {
+ // Cannot set non-blocking mode or timeout
+ logDebugMessage(__FUNCTION__, __LINE__, socket_strerror(socket_last_error()));
+ return $response;
+ }
// Do we use proxy?
if ($useProxy === true) {
//* DEBUG: */ print('<strong>proxyTunnel=</strong><pre>' . $proxyTunnel.'</pre>');
// Write request
- fputs($fp, $proxyTunnel);
+ fwrite($fp, $proxyTunnel);
// Got response?
if (feof($fp)) {
} // END - if
// Write request
- fputs($fp, $request);
+ fwrite($fp, $request);
+
+ // Start counting
+ $start = microtime(true);
// Read response
while (!feof($fp)) {
- $response[] = trim(fgets($fp, 1024));
+ // Get info from stream
+ $info = stream_get_meta_data($fp);
+
+ // Is it timed out? 15 seconds is a really patient...
+ if (($info['timed_out'] == true) || (microtime(true) - $start) > 15) {
+ // Timeout
+ logDebugMessage(__FUNCTION__, __LINE__, 'Timed out to get data from host ' . $host);
+
+ // Abort here
+ break;
+ } // END - if
+
+ // Get line from stream
+ $line = fgets($fp, 128);
+
+ // Ignore empty lines because of non-blocking mode
+ if (empty($line)) {
+ // uslepp a little to avoid 100% CPU load
+ usleep(10);
+
+ // Skip this
+ continue;
+ } // END - if
+
+ // Add it to response
+ $response[] = trim($line);
} // END - while
// Close socket
fclose($fp);
+ // Time request if debug-mode is enabled
+ if (isDebugModeEnabled()) {
+ // Add debug message...
+ logDebugMessage(__FUNCTION__, __LINE__, 'Request took ' . (microtime(true) - $start) . ' seconds.');
+ } // END - if
+
// Skip first empty lines
$resp = $response;
foreach ($resp as $idx => $line) {
//* DEBUG: */ print('<strong>Response:</strong><pre>'.print_r($response, true).'</pre>');
- // Proxy agent found?
- if ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) {
+ // Proxy agent found or something went wrong?
+ if (!isset($response[0])) {
+ // No response, maybe timeout
+ $response = array('', '', '');
+ } elseif ((substr(strtolower($response[0]), 0, 11) == 'proxy-agent') && ($useProxy === true)) {
// Proxy header detected, so remove two lines
array_shift($response);
array_shift($response);
}
// Generate a hash for extra-security for all passwords
-function generateHash ($plainText, $salt = '') {
+function generateHash ($plainText, $salt = '', $hash = true) {
// Is the required extension 'sql_patches' there and a salt is not given?
if (((isExtensionInstalledAndOlder('sql_patches', '0.3.6')) || (!isExtensionActive('sql_patches')) || (!isExtensionInstalledAndNewer('other', '0.2.5'))) && (empty($salt))) {
// Extension sql_patches is missing/outdated so we hash the plain text with MD5
- return md5($plainText);
+ if ($hash === true) {
+ // Is plain password
+ return md5($plainText);
+ } else {
+ // Is already a hash
+ return $plainText;
+ }
} // END - if
// Do we miss an arry element here?
$ret = $passHash;
// Is a secret key and master salt already initialized?
- if ((isExtensionInstalled('sql_patches')) && (isExtensionInstalledAndNewer('other', '0.2.5')) && (isConfigEntrySet('_PRIME')) && (isConfigEntrySet('secret_key')) && (isConfigEntrySet('master_salt'))) {
+ if ((isExtensionInstalled('sql_patches')) && (isConfigEntrySet('_PRIME')) && (isConfigEntrySet('secret_key')) && (isConfigEntrySet('master_salt'))) {
// Only calculate when the secret key is generated
+ if (strlen($passHash) != getConfig('secret_key')) {
+ // Both keys must have same length so return unencrypted
+ return $ret;
+ } // END - if
+
$newHash = ''; $start = 9;
- for ($idx = '0'; $idx < 10; $idx++) {
- $part1 = hexdec(substr($passHash, $start, 4));
- $part2 = hexdec(substr(getConfig('secret_key'), $start, 4));
+ //* DEBUG: */ outputHtml('passHash=' . $passHash . '(' . strlen($passHash) . ')<br />');
+ for ($idx = 0; $idx < 20; $idx++) {
+ $part1 = hexdec(substr($passHash, ($idx * 2), 2));
+ $part2 = hexdec(substr(getConfig('secret_key'), $start, 2));
+ //* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'<br />');
$mod = dechex($idx);
if ($part1 > $part2) {
$mod = dechex(sqrt(($part1 - $part2) * getConfig('_PRIME') / pi()));
} elseif ($part2 > $part1) {
$mod = dechex(sqrt(($part2 - $part1) * getConfig('_PRIME') / pi()));
}
- $mod = substr($mod, 0, 4);
+ $mod = substr($mod, 0, 2);
//* DEBUG: */ outputHtml('part1='.$part1.'/part2='.$part2.'/mod=' . $mod . '('.strlen($mod).')<br />');
- $mod = str_repeat(0, (4 - strlen($mod))) . $mod;
- //* DEBUG: */ outputHtml('*' . $start . '=' . $mod . '*<br />');
- $start += 4;
+ $mod = str_repeat(0, (2 - strlen($mod))) . $mod;
+ //* DEBUG: */ outputHtml('mod(' . ($idx * 2) . ')=' . $mod . '*<br />');
+ $start += 2;
$newHash .= $mod;
} // END - for
- //* DEBUG: */ print($passHash.'<br />' . $newHash." (".strlen($newHash).')<br />');
+ //* DEBUG: */ print($passHash . '<br />' . $newHash . ' (' . strlen($newHash) . ')<br />');
$ret = generateHash($newHash, getConfig('master_salt'));
- //* DEBUG: */ print('ret='.$ret.'<br />');
- } else {
- // Hash it simple
- //* DEBUG: */ outputHtml("--" . $passHash."--<br />");
- $ret = md5($passHash);
- //* DEBUG: */ outputHtml("++" . $ret."++<br />");
- }
+ //* DEBUG: */ print('ret=' . $ret . '<br />');
+ } // END - if
// Return result
return $ret;
// Make sure, that the script realy realy diese here and now
$GLOBALS['app_died'] = true;
+ // Set content type if not set
+ if (!isContentTypeSet()) {
+ // text/html is the right one
+ setContentType('text/html');
+ } // END - if
+
// Load header
loadIncludeOnce('inc/header.php');
);
// Load the template
- loadTemplate('show_timings', false, $content);
+ $GLOBALS['page_footer'] .= loadTemplate('show_timings', true, $content);
}
// Check wether a boolean constant is set
// In cache?
if (isset($GLOBALS['cache_array']['const'][$constName])) {
// Use cache
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-CACHE!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ' . $constName."-CACHE!<br />");
$res = ($GLOBALS['cache_array']['const'][$constName] === true);
} else {
// Check constant
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-RESOLVE!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ' . $constName."-RESOLVE!<br />");
if (defined($constName)) {
// Found!
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-FOUND!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__ . '</font>): ' . $constName."-FOUND!<br />");
$res = (constant($constName) === true);
} // END - if
// Function to search for the last modifified file
function searchDirsRecursive ($dir, &$last_changed) {
// Get dir as array
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):dir=" . $dir.'<br />');
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):dir=" . $dir.'<br />');
// Does it match what we are looking for? (We skip a lot files already!)
// RegexPattern to exclude ., .., .revision, .svn, debug.log or .cache in the filenames
$excludePattern = '@(\.revision|debug\.log|\.cache|config\.php)$@';
$ds = getArrayFromDirectory($dir, '', true, false, array(), '.php', $excludePattern);
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds).'<br />');
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):ds[]=".count($ds).'<br />');
// Walk through all entries
foreach ($ds as $d) {
$FQFN = str_replace('//', '/', getConfig('PATH') . $dir. '/'. $d);
// Is it a file and readable?
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):FQFN={$FQFN}<br />");
if (isDirectory($FQFN)) {
// $FQFN is a directory so also crawl into this directory
$newDir = $d;
if (!empty($dir)) $newDir = $dir . '/'. $d;
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: " . $newDir.'<br />');
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):DESCENT: " . $newDir.'<br />');
searchDirsRecursive($newDir, $last_changed);
} elseif (isFileReadable($FQFN)) {
// $FQFN is a filename and no directory
$time = filemtime($FQFN);
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: " . $d." found. (".($last_changed['time'] - $time).")<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):File: " . $d." found. (".($last_changed['time'] - $time).")<br />");
if ($last_changed['time'] < $time) {
// This file is newer as the file before
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>) - NEWER!<br />");
$last_changed['path_name'] = $FQFN;
$last_changed['time'] = $time;
} // END - if
$FQFN = sprintf("%s/.revision", getConfig('CACHE_PATH'));
// Check if 'check_revision_data' is setted (switch for manually rewrite the .revision-File)
- if ((isGetRequestElementSet('check_revision_data')) && (getRequestElement('check_revision_data') == 'yes')) {
+ if ((isGetRequestParameterSet('check_revision_data')) && (getRequestParameter('check_revision_data') == 'yes')) {
// Forced rebuild of .revision file
$new = true;
} else {
} // END - foreach
// Return found value
- return trim($ins_vers[$mapper[$type]]);
+ return getActualVersion($type);
}
}
}
// The returned Array is needed twice (in getArrayFromActualVersion() and in getActualVersion() in the old .revision-fallback) so I puted it in an extra function to not polute the global namespace
function getSearchFor () {
// Add Revision, Date, Tag and Author
- $searchFor = array('Revision', 'Date', 'Tag', 'Author', 'File');
+ $searchFor = array('File', 'Revision', 'Date', 'Tag', 'Author');
// Return the created array
return $searchFor;
// Get all the keywords to search for
$searchFor = getSearchFor();
+ // Save the last-changed filename for debugging
+ $GLOBALS['cache_array']['revision']['File'] = $last_changed['path_name'];
+
// This foreach loops the $searchFor-Tags (array('Revision', 'Date', 'Tag', 'Author') --> could easaly extended in the future)
foreach ($searchFor as $search) {
// Searches for "$search-tag:VALUE$" or "$search-tag::VALUE$"(the stylish keywordversion ;-)) in the lates modified file
$res += preg_match('@\$' . $search.'(:|::) (.*) \$@U', $last_file, $t);
+
// This trimms the search-result and puts it in the $GLOBALS['cache_array']['revision']-return array
- if (isset($t[2])) $GLOBALS['cache_array']['revision'][$search] = trim($t[2]);
+ if (isset($t[2])) {
+ $GLOBALS['cache_array']['revision'][$search] = trim($t[2]);
+ } // END - if
} // END - foreach
- // Save the last-changed filename for debugging
- $GLOBALS['cache_array']['revision']['File'] = $last_changed['path_name'];
-
// at least 3 keyword-Tags are needed for propper values
if ($res && $res >= 3
&& isset($GLOBALS['cache_array']['revision']['Revision']) && $GLOBALS['cache_array']['revision']['Revision'] != ''
// No valid Data from the last modificated file so read the Revision from the Server. Fallback-solution!! Should not be removed I think.
$version = sendGetRequest('check-updates3.php');
+ // Invalid request reply?
+ if (!isset($version[11])) {
+ // Cannot continue here
+ debug_report_bug('Invalid response from check-updates3.php, count should be 10, is ' . count($version));
+ } // END - if
+
// Prepare content
// Only sets not setted or not proper values to the Online-Server-Fallback-Solution
+ if (!isset($GLOBALS['cache_array']['revision']['File']) || $GLOBALS['cache_array']['revision']['File'] == '') $GLOBALS['cache_array']['revision']['File'] = trim($version[11]);
if (!isset($GLOBALS['cache_array']['revision']['Revision']) || $GLOBALS['cache_array']['revision']['Revision'] == '') $GLOBALS['cache_array']['revision']['Revision'] = trim($version[10]);
if (!isset($GLOBALS['cache_array']['revision']['Date']) || $GLOBALS['cache_array']['revision']['Date'] == '') $GLOBALS['cache_array']['revision']['Date'] = trim($version[9]);
if (!isset($GLOBALS['cache_array']['revision']['Tag']) || $GLOBALS['cache_array']['revision']['Tag'] == '') $GLOBALS['cache_array']['revision']['Tag'] = trim($version[8]);
if (!isset($GLOBALS['cache_array']['revision']['Author']) || $GLOBALS['cache_array']['revision']['Author'] == '') $GLOBALS['cache_array']['revision']['Author'] = 'quix0r';
- if (!isset($GLOBALS['cache_array']['revision']['File']) || $GLOBALS['cache_array']['revision']['File'] == '') $GLOBALS['cache_array']['revision']['File'] = trim($version[11]);
}
// Return prepared array
case getCode('COOKIES_DISABLED') : $message = getMessage('LOGIN_COOKIES_DISABLED'); break;
case getCode('BEG_SAME_AS_OWN') : $message = getMessage('BEG_SAME_UID_AS_OWN'); break;
case getCode('LOGIN_FAILED') : $message = getMessage('LOGIN_FAILED_GENERAL'); break;
- case getCode('MODULE_MEM_ONLY') : $message = getMaskedMessage('MODULE_MEM_ONLY', getRequestElement('mod')); break;
+ case getCode('MODULE_MEM_ONLY') : $message = getMaskedMessage('MODULE_MEM_ONLY', getRequestParameter('mod')); break;
case getCode('OVERLENGTH') : $message = getMessage('MEMBER_TEXT_OVERLENGTH'); break;
case getCode('URL_FOUND') : $message = getMessage('MEMBER_TEXT_CONTAINS_URL'); break;
case getCode('SUBJ_URL') : $message = getMessage('MEMBER_SUBJ_CONTAINS_URL'); break;
- case getCode('BLIST_URL') : $message = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".generateDateTime(getRequestElement('blist'), 0); break;
+ case getCode('BLIST_URL') : $message = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".generateDateTime(getRequestParameter('blist'), 0); break;
case getCode('NO_RECS_LEFT') : $message = getMessage('MEMBER_SELECTED_MORE_RECS'); break;
case getCode('INVALID_TAGS') : $message = getMessage('MEMBER_HTML_INVALID_TAGS'); break;
case getCode('MORE_POINTS') : $message = getMessage('MEMBER_MORE_POINTS_NEEDED'); break;
break;
case getCode('EXTENSION_PROBLEM'):
- if (isGetRequestElementSet('ext')) {
- $message = generateExtensionInactiveNotInstalledMessage(getRequestElement('ext'));
+ if (isGetRequestParameterSet('ext')) {
+ $message = generateExtensionInactiveNotInstalledMessage(getRequestParameter('ext'));
} else {
$message = getMessage('EXTENSION_PROBLEM_UNSET_EXT');
}
case getCode('URL_TLOCK'):
// @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
$result = SQL_QUERY_ESC("SELECT `timestamp` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
- array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
+ array(bigintval(getRequestParameter('id'))), __FILE__, __LINE__);
// Load timestamp from last order
list($timestamp) = SQL_FETCHROW($result);
} // END - if
// Write to temp file
- fputs($fp_tmp, $line);
+ fwrite($fp_tmp, $line);
} // END - while
// Close temp file
// Ignore zero values
if (getSession('mxchange_' . $accessLevel.'_failures') > 0) {
// Non-guest has login failures found, get both data and prepare it for template
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):accessLevel={$accessLevel}<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>):accessLevel={$accessLevel}<br />");
$content = array(
'login_failures' => getSession('mxchange_' . $accessLevel.'_failures'),
'last_failure' => generateDateTime(getSession('mxchange_' . $accessLevel.'_last_fail'), 2)
// Is the include there?
if (isIncludeReadable($inc)) {
// And rebuild it from scratch
- //* DEBUG: */ outputHtml(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): inc={$inc} - LOADED!<br />");
+ //* DEBUG: */ outputHtml(__FUNCTION__ . '(<font color="#0000aa">' . __LINE__."</font>): inc={$inc} - LOADED!<br />");
loadInclude($inc);
} else {
// Include not found!
// Check if refid is set
if ((isset($GLOBALS['refid'])) && ($GLOBALS['refid'] > 0)) {
// This is fine...
- } elseif ((isGetRequestElementSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
+ } elseif ((isGetRequestParameterSet('user')) && (basename($_SERVER['PHP_SELF']) == 'click.php')) {
// The variable user comes from the click-counter script click.php and we only accept this here
- $GLOBALS['refid'] = bigintval(getRequestElement('user'));
- } elseif (isPostRequestElementSet('refid')) {
+ $GLOBALS['refid'] = bigintval(getRequestParameter('user'));
+ } elseif (isPostRequestParameterSet('refid')) {
// Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
- $GLOBALS['refid'] = secureString(postRequestElement('refid'));
- } elseif (isGetRequestElementSet('refid')) {
+ $GLOBALS['refid'] = secureString(postRequestParameter('refid'));
+ } elseif (isGetRequestParameterSet('refid')) {
// Get referal id from variable refid (so I hope this makes my script more compatible to other scripts)
- $GLOBALS['refid'] = secureString(getRequestElement('refid'));
- } elseif (isGetRequestElementSet('ref')) {
+ $GLOBALS['refid'] = secureString(getRequestParameter('refid'));
+ } elseif (isGetRequestParameterSet('ref')) {
// Set refid=ref (the referal link uses such variable)
- $GLOBALS['refid'] = secureString(getRequestElement('ref'));
+ $GLOBALS['refid'] = secureString(getRequestParameter('ref'));
} elseif ((isSessionVariableSet('refid')) && (getSession('refid') != 0)) {
// Set session refid als global
$GLOBALS['refid'] = bigintval(getSession('refid'));
// Handle message codes from URL
function handleCodeMessage () {
- if (isGetRequestElementSet('code')) {
+ if (isGetRequestParameterSet('code')) {
// Default extension is 'unknown'
$ext = 'unknown';
// Is extension given?
- if (isGetRequestElementSet('ext')) $ext = getRequestElement('ext');
+ if (isGetRequestParameterSet('ext')) $ext = getRequestParameter('ext');
// Convert the 'code' parameter from URL to a human-readable message
- $message = getMessageFromErrorCode(getRequestElement('code'));
+ $message = getMessageFromErrorCode(getRequestParameter('code'));
// Load message template
loadTemplate('message', false, $message);
$hash = generatePassString(getUserData('password'));
// Does the hash match or should we change it?
- if (($hash == getSession('u_hash')) || (postRequestElement('pass1') == postRequestElement('pass2'))) {
+ if (($hash == getSession('u_hash')) || (postRequestParameter('pass1') == postRequestParameter('pass2'))) {
// Load the data
$content = getUserDataArray();
switch ($mode) {
case 'normal': break; // Do not add any special lines
case 'email': // Email was changed!
- $content['message'] = getMessage('MEMBER_CHANGED_EMAIL').": ".postRequestElement('old_email')."\n";
+ $content['message'] = getMessage('MEMBER_CHANGED_EMAIL').": ".postRequestParameter('old_email')."\n";
break;
case 'pass': // Password was changed
if (isExtensionActive('country')) {
// Replace code with description
- $content['country'] = generateCountryInfo(postRequestElement('country_code'));
+ $content['country'] = generateCountryInfo(postRequestParameter('country_code'));
} // END - if
// Merge content with data from POST
$content = getMessage('CANNOT_SEND_ADMIN_MAILS');
} else {
// No mail to admin
- $content = "<span class=\"member_done\">{--MYDATA_MAIL_SENT--}</span>";
+ $content = '<span class="member_done">{--MYDATA_MAIL_SENT--}</span>';
}
} // END - if
return ((strpos($userAgent, 'spider') !== false) || (strpos($userAgent, 'slurp') !== false) || (strpos($userAgent, 'bot') !== false));
}
+// Prepares the header for HTML output
+function loadHtmlHeader () {
+ // Determine the page title
+ $content['header_title'] = determinePageTitle();
+
+ // Output page header code
+ $GLOBALS['page_header'] = loadTemplate('page_header', true, $content);
+
+ // Include meta data in 'guest' module
+ if (getModule() == 'index') {
+ // Load meta data template
+ $GLOBALS['page_header'] .= loadTemplate('metadata', true);
+
+ // Add meta description to header
+ if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) {
+ // Add meta description not in admin and login module and when the script is installed
+ generateMetaDescriptionCode();
+ } // END - if
+ } // END - if
+
+ // Include more header data here
+ $GLOBALS['page_header'] .= loadTemplate('header', true);
+
+ // Include stylesheet
+ loadIncludeOnce('inc/stylesheet.php');
+
+ // Closing HEAD tag
+ $GLOBALS['page_header'] .= '</head>';
+}
+
+// Adds page header and footer to output array element
+function addPageHeaderFooter () {
+ // Init output
+ $OUT = '';
+
+ // Add them all together. This is maybe to simple
+ foreach (array('page_header', 'output', 'page_footer') as $pagePart) {
+ // Add page part if set
+ if (isset($GLOBALS[$pagePart])) $OUT .= $GLOBALS[$pagePart];
+ } // END - foreach
+
+ // Transfer $OUT to 'output'
+ $GLOBALS['output'] = $OUT;
+}
+
+// Generates meta description for current module and 'what' value
+function generateMetaDescriptionCode () {
+ // Only include from guest area
+ if (getModule() == 'index') {
+ // Construct dynamic description
+ $DESCR = '{?MAIN_TITLE?} '.trim(getConfig('title_middle')) . ' ' . getTitleFromMenu('guest', getWhat());
+
+ // Output it directly
+ $GLOBALS['page_header'] .= '<meta name="description" content="' . $DESCR . '" />';
+ } // END - if
+
+ // Remove depth
+ unset($GLOBALS['ref_level']);
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////