outputRawCode($HTML);
// That's why you don't need any \n at the end of your HTML code... :-)
- if ($newLine) echo "\n";
+ if ($newLine) print("\n");
} else {
// Render mode for old or lame servers...
$OUTPUT .= $HTML;
// The same as above... ^
outputRawCode($HTML);
- if ($newLine) echo "\n";
+ if ($newLine) print("\n");
break;
default:
// Output the raw HTML code
function outputRawCode ($HTML) {
// Output stripped HTML code to avoid broken JavaScript code, etc.
- echo stripslashes(stripslashes($HTML));
+ print(stripslashes(stripslashes($HTML)));
// Flush the output if only constant('_OB_CACHING') is not 'on'
if (constant('_OB_CACHING') != 'on') {
// Send mail out to an email address
function sendEmail ($toEmail, $subject, $message, $HTML = 'N', $mailHeader = '') {
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail},SUBJECT={$subject}<br />");
// Compile subject line (for POINTS constant etc.)
$eval = "\$subject = decodeEntities(\"".COMPILE_CODE(smartAddSlashes($subject))."\");";
// Load email address
$result_email = SQL_QUERY_ESC("SELECT `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(bigintval($toEmail)), __FUNCTION__, __LINE__);
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result_email)."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):numRows=".SQL_NUMROWS($result_email)."<br />");
// Does the user exist?
if (SQL_NUMROWS($result_email)) {
// Is the webmaster!
$toEmail = constant('WEBMASTER');
}
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):TO={$toEmail}<br />");
// Check for PHPMailer or debug-mode
if (!checkPhpMailerUsage()) {
} // END - if
// Load user's data
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template},content[]=".gettype($content)."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):UID={$UID},template={$template},content[]=".gettype($content)."<br />");
if (($UID > 0) && (is_array($content))) {
// If nickname extension is installed, fetch nickname as well
if (EXT_IS_ACTIVE('nickname')) {
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NICKNAME!<br />");
// Load nickname
$result = SQL_QUERY_ESC("SELECT `surname`, `family`, `gender`, `email`, `nickname` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(bigintval($UID)), __FUNCTION__, __LINE__);
} else {
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NO-NICK!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):NO-NICK!<br />");
/// Load normal data
$result = SQL_QUERY_ESC("SELECT `surname`, `family`, `gender`, `email` FROM `{!_MYSQL_PREFIX!}_user_data` WHERE `userid`=%s LIMIT 1",
array(bigintval($UID)), __FUNCTION__, __LINE__);
}
// Fetch and merge data
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - PRE<br />");
$content = merge_array($content, SQL_FETCHARRAY($result));
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):content()=".count($content)." - AFTER<br />");
// Free result
SQL_FREERESULT($result);
$test = substr($found, 0, strlen($match));
// Does this entry exist?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found={$found},match={$match},set={$set}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):found={$found},match={$match},set={$set}<br />");
if ($test == $match) {
// Match found!
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):fuzzyFound!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):key={$key},match={$match}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):key={$key},match={$match}<br />");
$newMatch = str_replace("[" . $matches[4][$key]."]", "['" . $matches[4][$key]."']", $match);
$code = str_replace($match, "\"." . $newMatch.".\"", $code);
$matchesFound[$key."_" . $matches[4][$key]] = 1;
$matchesFound[$match] = 1;
} elseif (!isset($matchesFound[$match])) {
// Not yet replaced!
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):match={$match}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):match={$match}<br />");
$code = str_replace($match, "\"." . $match.".\"", $code);
$matchesFound[$match] = 1;
}
// First of all years...
$Y = abs(floor($timestamp / (31536000 + $SWITCH)));
- //* DEBUG: */ print("Y={$Y}<br />\n");
+ //* DEBUG: */ print("Y={$Y}<br />");
// Next months...
$M = abs(floor($timestamp / 2628000 - $Y * 12));
- //* DEBUG: */ print("M={$M}<br />\n");
+ //* DEBUG: */ print("M={$M}<br />");
// Next weeks
$W = abs(floor($timestamp / 604800 - $Y * ((365 + $SWITCH / getConfig('one_day')) / 7) - ($M / 12 * (365 + $SWITCH / getConfig('one_day')) / 7)));
- //* DEBUG: */ print("W={$W}<br />\n");
+ //* DEBUG: */ print("W={$W}<br />");
// Next days...
$D = abs(floor($timestamp / 86400 - $Y * (365 + $SWITCH / getConfig('one_day')) - ($M / 12 * (365 + $SWITCH / getConfig('one_day'))) - $W * 7));
- //* DEBUG: */ print("D={$D}<br />\n");
+ //* DEBUG: */ print("D={$D}<br />");
// Next hours...
$h = abs(floor($timestamp / 3600 - $Y * (365 + $SWITCH / getConfig('one_day')) * 24 - ($M / 12 * (365 + $SWITCH / getConfig('one_day')) * 24) - $W * 7 * 24 - $D * 24));
- //* DEBUG: */ print("h={$h}<br />\n");
+ //* DEBUG: */ print("h={$h}<br />");
// Next minutes..
$m = abs(floor($timestamp / 60 - $Y * (365 + $SWITCH / getConfig('one_day')) * 24 * 60 - ($M / 12 * (365 + $SWITCH / getConfig('one_day')) * 24 * 60) - $W * 7 * 24 * 60 - $D * 24 * 60 - $h * 60));
- //* DEBUG: */ print("m={$m}<br />\n");
+ //* DEBUG: */ print("m={$m}<br />");
// And at last seconds...
$s = abs(floor($timestamp - $Y * (365 + $SWITCH / getConfig('one_day')) * 24 * 3600 - ($M / 12 * (365 + $SWITCH / getConfig('one_day')) * 24 * 3600) - $W * 7 * 24 * 3600 - $D * 24 * 3600 - $h * 3600 - $m * 60));
- //* DEBUG: */ print("s={$s}<br />\n");
+ //* DEBUG: */ print("s={$s}<br />");
// Is seconds zero and time is < 60 seconds?
if (($s == 0) && ($timestamp < 60)) {
if (ereg('/', $host)) $host = substr($host, 0, strpos($host, '/'));
// Generate relative URL
- //* DEBUG: */ print("SCRIPT=" . $script."<br />\n");
+ //* DEBUG: */ print("SCRIPT=" . $script."<br />");
if (substr(strtolower($script), 0, 7) == 'http://') {
// But only if http:// is in front!
$script = substr($script, (strlen($url) + 7));
$script = substr($script, (strlen($url) + 8));
}
- //* DEBUG: */ print("SCRIPT=" . $script."<br />\n");
+ //* DEBUG: */ print("SCRIPT=" . $script."<br />");
if (substr($script, 0, 1) == '/') $script = substr($script, 1);
// Return host name
} // END - if
// Open connection
- //* DEBUG: */ die("SCRIPT=" . $script."<br />\n");
+ //* DEBUG: */ die("SCRIPT=" . $script."<br />");
if ($useProxy === true) {
// Connect to host through proxy connection
$fp = @fsockopen(COMPILE_CODE(getConfig('proxy_host')), bigintval(getConfig('proxy_port')), $errno, $errdesc, 30);
function isUrlValid ($URL, $compile=true) {
// Trim URL a little
$URL = trim(urldecode($URL));
- //* DEBUG: */ echo $URL."<br />";
+ //* DEBUG: */ OUTPUT_HTML($URL."<br />");
// Compile some chars out...
if ($compile === true) $URL = compileUriCode($URL, false, false, false);
- //* DEBUG: */ echo $URL."<br />";
+ //* DEBUG: */ OUTPUT_HTML($URL."<br />");
// Check for the extension filter
if (EXT_IS_ACTIVE('filter')) {
foreach ($TARGETS as $tar) {
$eval .= "<span class=\\\"admin_user_link\\\"><a href=\\\"{!URL!}/modules.php?module=admin&what=" . $tar."&uid=" . $uid."\\\" title=\\\"{--ADMIN_LINK_";
- //* DEBUG: */ echo "*" . $tar.'/' . $status."*<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("*" . $tar.'/' . $status."*<br />");
if (($tar == "lock_user") && ($status == 'LOCKED')) {
// Locked accounts shall be unlocked
$eval .= "UNLOCK_USER";
// Generate SHA1 sum from modula of number and the prime number
$sha1 = sha1(($a % getConfig('_PRIME')) . $server.getConfig('ENCRYPT_SEPERATOR') . $keys.getConfig('ENCRYPT_SEPERATOR') . $data.getConfig('ENCRYPT_SEPERATOR').getConfig('DATE_KEY').getConfig('ENCRYPT_SEPERATOR') . $a);
- //* DEBUG: */ echo "SHA1=" . $sha1." (".strlen($sha1).")<br />";
+ //* DEBUG: */ OUTPUT_HTML("SHA1=" . $sha1." (".strlen($sha1).")<br />");
$sha1 = scrambleString($sha1);
- //* DEBUG: */ echo "Scrambled=" . $sha1." (".strlen($sha1).")<br />";
+ //* DEBUG: */ OUTPUT_HTML("Scrambled=" . $sha1." (".strlen($sha1).")<br />");
//* DEBUG: */ $sha1b = descrambleString($sha1);
- //* DEBUG: */ echo "Descrambled=" . $sha1b." (".strlen($sha1b).")<br />";
+ //* DEBUG: */ OUTPUT_HTML("Descrambled=" . $sha1b." (".strlen($sha1b).")<br />");
// Generate the password salt string
$salt = substr($sha1, 0, getConfig('salt_length'));
- //* DEBUG: */ echo $salt." (".strlen($salt).")<br />";
+ //* DEBUG: */ OUTPUT_HTML($salt." (".strlen($salt).")<br />");
} else {
// Use given salt
$salt = substr($salt, 0, getConfig('salt_length'));
- //* DEBUG: */ echo "GIVEN={$salt}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("GIVEN={$salt}<br />");
}
// Return hash
}
// Scramble string here
- //* DEBUG: */ echo "***Original=" . $str."***<br />";
+ //* DEBUG: */ OUTPUT_HTML("***Original=" . $str."***<br />");
for ($idx = 0; $idx < strlen($str); $idx++) {
// Get char on scrambled position
$char = substr($str, $scrambleNums[$idx], 1);
} // END - for
// Return scrambled string
- //* DEBUG: */ echo "***Scrambled=" . $scrambled."***<br />";
+ //* DEBUG: */ OUTPUT_HTML("***Scrambled=" . $scrambled."***<br />");
return $scrambled;
}
if (count($scrambleNums) != 40) return $str;
// Begin descrambling
- $orig = str_repeat(" ", 40);
- //* DEBUG: */ echo "+++Scrambled=" . $str."+++<br />";
+ $orig = str_repeat(' ', 40);
+ //* DEBUG: */ OUTPUT_HTML("+++Scrambled=" . $str."+++<br />");
for ($idx = 0; $idx < 40; $idx++) {
$char = substr($str, $idx, 1);
$orig = substr_replace($orig, $char, $scrambleNums[$idx], 1);
} // END - for
// Return scrambled string
- //* DEBUG: */ echo "+++Original=" . $orig."+++<br />";
+ //* DEBUG: */ OUTPUT_HTML("+++Original=" . $orig."+++<br />");
return $orig;
}
}
$mod = substr(round($mod), 0, 4);
$mod = str_repeat('0', 4-strlen($mod)) . $mod;
- //* DEBUG: */ echo "*" . $start.'=' . $mod."*<br />";
+ //* DEBUG: */ OUTPUT_HTML("*" . $start.'=' . $mod."*<br />");
$start += 4;
$newHash .= $mod;
} // END - for
//* DEBUG: */ print($passHash."<br />" . $newHash." (".strlen($newHash).')');
$ret = generateHash($newHash, getConfig('master_salt'));
- //* DEBUG: */ print($ret."<br />\n");
+ //* DEBUG: */ print($ret."<br />");
} else {
// Hash it simple
- //* DEBUG: */ echo "--" . $passHash."--<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("--" . $passHash."--<br />");
$ret = md5($passHash);
- //* DEBUG: */ echo "++" . $ret."++<br />\n";
+ //* DEBUG: */ OUTPUT_HTML("++" . $ret."++<br />");
}
// Return result
// In cache?
if (isset($GLOBALS['cache_array']['const'][$constName])) {
// Use cache
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-CACHE!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-CACHE!<br />");
$res = ($GLOBALS['cache_array']['const'][$constName] === true);
} else {
// Check constant
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-RESOLVE!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-RESOLVE!<br />");
if (defined($constName)) {
// Found!
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): " . $constName."-FOUND!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):dir=" . $dir."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):ds[]=".count($ds)."<br />");
// Walk through all entries
foreach ($ds as $d) {
$FQFN = str_replace('//', '/', constant('PATH') . $dir. '/'. $d);
// Is it a file and readable?
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):FQFN={$FQFN}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):DESCENT: " . $newDir."<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):File: " . $d." found. (".($last_changed['time'] - $time).")<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>) - NEWER!<br />");
$last_changed['path_name'] = $FQFN;
$last_changed['time'] = $time;
} // END - if
if (!empty($message)) {
// Use and log it
$debug = sprintf("Note: %s<br />\n",
- $message
+ $message
);
// @TODO Add a little more infos here
// @TODO Are these convertions still required?
$pat = str_replace('.', "\.", $pat);
$pat = str_replace('@', "\@", $pat);
- echo $key."= " . $pat . "<br />";
+ //* DEBUG: */ OUTPUT_HTML($key."= " . $pat . "<br />");
} // END - if
// Check if expression matches
// Ignore zero values
if (getSession('mxchange_' . $accessLevel.'_failures') > 0) {
// Non-guest has login failures found, get both data and prepare it for template
- //* DEBUG: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):accessLevel={$accessLevel}<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__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: */ print __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): inc={$inc} - LOADED!<br />\n";
+ //* DEBUG: */ OUTPUT_HTML(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): inc={$inc} - LOADED!<br />");
loadInclude($INC);
} else {
// Include not found!
// Exclude '.', '..' and entries in $excludeArray automatically
if (in_array($baseFile, $excludeArray, true)) {
// Exclude them
- //* DEBUG: */ print 'excluded=' . $baseFile . '<br />';
+ //* DEBUG: */ OUTPUT_HTML('excluded=' . $baseFile . "<br />");
continue;
} // END - if
// Check if the base filename matches an exclusion pattern and if the pattern is not empty
if ((!empty($excludePattern)) && (preg_match($excludePattern, $baseFile, $match))) {
// These Lines are only for debugging!!
- //* DEBUG: */ print 'baseDir:' . $baseDir . '<br />';
- //* DEBUG: */ print 'baseFile:' . $baseFile . '<br />';
- //* DEBUG: */ print 'FQFN:' . $FQFN . '<br />';
+ //* DEBUG: */ OUTPUT_HTML('baseDir:' . $baseDir . "<br />");
+ //* DEBUG: */ OUTPUT_HTML('baseFile:' . $baseFile . "<br />");
+ //* DEBUG: */ OUTPUT_HTML('FQFN:' . $FQFN . "<br />");
// Exclude this one
continue;