// Is the required extension "sql_patches" there?
if ((GET_EXT_VERSION("sql_patches") < "0.3.6") || (GET_EXT_VERSION("sql_patches") == "")) {
- // Extension sql_patches is missing/outdated so we return the plain text
- return $plainText;
+ // Extension sql_patches is missing/outdated so we return only the regular SHA1 hash
+ return sha1($plainText);
}
// When the salt is empty build a new one, else use the first x configured characters as the salt
// Unset/set session variables
function set_session ($var, $value) {
global $CSS;
+
// Abort in CSS mode here
if ($CSS == 1) return true;
// Taken from user comments in PHP documentation for function constant()
function isBooleanConstantAndTrue($constname) { // : Boolean
$res = false;
- if (defined($constname)) $res = (constant($constname) === true);
+ if (defined($constname)) {
+ $res = (constant($constname) === true);
+ }
return($res);
}
switch ($ret)
{
case "done":
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
+ admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define ('admin_registered', ", ");", "true", 0);
if (!_FATAL) {
// Registering is done
LOAD_URL(URL."/modules.php?module=admin&action=login®ister=done");
}
if (!isBooleanConstantAndTrue('admin_registered')) {
// Write to config that registration is done
- admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define('admin_registered', ", ");", "true", 0);
+ admin_WriteData(PATH."inc/config.php", "ADMIN-SETUP", "define ('admin_registered', ", ");", "true", 0);
// Load URL for login
$URL = URL."/modules.php?module=admin&action=login";
// Try to register the session variables
if ((set_session("admin_md5", generatePassString(generateHash($_POST['pass'], __SALT)))) && (set_session("admin_login", $_POST['login'])) && (set_session("admin_last", time())) && (set_session("admin_to", $_POST['timeout']))) {
// Construct URL and redirect
+ die("OK");
$URL = URL."/modules.php?module=admin&";
// Rewrite overview module
}
} else {
// Maybe an Admin want's to login?
- $ret = CHECK_ADMIN_COOKIES(SQL_ESCAPE(get_session('admin_login')), SQL_ESCAPE(get_session('admin_md5')));
+ $ret = CHECK_ADMIN_COOKIES('admin_login', 'admin_md5');
switch ($ret) {
case "done":
// Cookie-Data accepted
// Only be executed on cookie checking
function CHECK_ADMIN_COOKIES ($admin_login, $password) {
global $cacheArray, $_CONFIG;
+
+ // Get login and password hash
+ $admin_login = SQL_ESCAPE(get_session($admin_login));
+ $password = SQL_ESCAPE(get_session($password));
+
$ret = "404"; $pass = "";
if (!empty($cacheArray['admins']['aid'][$admin_login])) {
// Get password from cache
// Copy back tmp file and delete tmp :-)
@copy($tmp, $file);
@unlink($tmp);
- define('_FATAL', false);
+ define ('_FATAL', false);
}
elseif (!$found)
{
OUTPUT_HTML("<STRONG>CHANGE:</STRONG> 404!");
- define('_FATAL', true);
+ define ('_FATAL', true);
}
else
{
OUTPUT_HTML("<STRONG>TMP:</STRONG> UNDONE!");
- define('_FATAL', true);
+ define ('_FATAL', true);
}
}
}