// Output the raw HTML code
function OUTPUT_RAW ($HTML) {
- if ((mxchange_installed) && (basename($_SERVER['PHP_SELF']) != "install.php")) {
+ if ((isBooleanConstantAndTrue('mxchange_installed')) && (basename($_SERVER['PHP_SELF']) != "install.php")) {
// Not in install-mode so strip slashes away
echo stripslashes($HTML);
} else {
}
// Does the special template exists?
- if (!file_exists($file)) {
+ if ((!file_exists($file)) || (!is_readable($file))) {
// Reset to default template
$file = $BASE.$template.".tpl";
}
// Now does the final template exists?
- if (file_exists($file)) {
+ if ((file_exists($file)) && (is_readable($file))) {
// The local file does exists so we load it. :)
$tmpl_file = implode("", file($file));
// Add surrounding HTML comments to help finding bugs faster
$ret = "<!-- Template ".$template." - Start -->\n".$ret."<!-- Template ".$template." - End -->\n";
- } elseif ((IS_ADMIN()) || ((mxchange_installing) && (!mxchange_installed))) {
+ } elseif ((IS_ADMIN()) || ((isBooleanConstantAndTrue('mxchange_installing')) && (!isBooleanConstantAndTrue('mxchange_installed')))) {
// Only admins shall see this warning or when installation mode is active
$ret = "<br /><SPAN class=\"guest_failed\">".TEMPLATE_404."</SPAN><br />
(".basename($file).")<br />
//
function generatePassString($passHash) {
global $_CONFIG;
- $ret = "*FAILED*";
+
+ // Return vanilla password hash
+ $ret = $passHash;
// Is a secret key and master salt already initialized?
if ((!empty($_CONFIG['secret_key'])) && (!empty($_CONFIG['master_salt']))) {
$start += 4;
$newHash .= $mod;
}
+
//* DEBUG: */ die($passHash."<br>".$newHash." (".strlen($newHash).")");
$ret = generateHash($newHash, $_CONFIG['master_salt']);
}
//* DEBUG: */ echo "IGNORED:".$var."=".$value."<br />\n";
return true;
}
+// Check wether a boolean constant is set
+// Taken from user comments in PHP documentation for function constant()
+function isBooleanConstantAndTrue($constname) { // : Boolean
+ $res = false;
+ if (defined($constname)) $res = (constant($constname) === true);
+ return($res);
+}
//
//////////////////////////////////////////////