// Register an administrator account
function REGISTER_ADMIN ($user, $md5, $email) {
// Login does already exist
- $ret = "already";
+ $ret = 'already';
// Lookup the admin
$result = SQL_QUERY_ESC("SELECT `id` FROM `{!_MYSQL_PREFIX!}_admins` WHERE login='%s' LIMIT 1",
- array($user), __FUNCTION__, __LINE__);
+ array($user), __FUNCTION__, __LINE__);
// Is the entry there?
if (SQL_NUMROWS($result) == 0) {
$add = runFilterChain('sql_admin_extra_data');
// Get password from DB
- $result = SQL_QUERY_ESC("SELECT password".$add." FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
- array($aid), __FUNCTION__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `password`" . $add . " FROM `{!_MYSQL_PREFIX!}_admins` WHERE `id`=%s LIMIT 1",
+ array($aid), __FUNCTION__, __LINE__);
// Entry found?
if (SQL_NUMROWS($result) == 1) {
if ((GET_EXT_VERSION('admins') >= '0.7.0') && ((EXT_VERSION_IS_OLDER('sql_patches', '0.3.6')) || (GET_EXT_VERSION('sql_patches') == ''))) {
// Reset counter on out-dated sql_patches version
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_admins` SET login_failures=0,last_failure='0000-00-00 00:00:00' WHERE login='%s' LIMIT 1",
- array($adminLogin), __FUNCTION__, __LINE__);
+ array($adminLogin), __FUNCTION__, __LINE__);
// Rebuild cache
rebuildCacheFiles('admins', 'admin');
} // END - if
// Now set all session variables and return the result
- return (
- (
- setSession('admin_md5', generatePassString($passHash))
+ return ((
+ setSession('admin_md5', generatePassString($passHash))
) && (
- setSession('admin_login', $adminLogin)
+ setSession('admin_login', $adminLogin)
) && (
- setSession('admin_last', time())
+ setSession('admin_last', time())
) && (
- setSession('admin_to', bigintval(REQUEST_POST('timeout')))
- )
- );
+ setSession('admin_to', bigintval(REQUEST_POST('timeout')))
+ ));
}
// Only be executed on cookie checking
function CHECK_ADMIN_COOKIES ($admin_login, $password) {
// By default no admin cookies are found
- $ret = '404'; $pass = '';
+ $ret = '404';
+ $pass = '';
// Get hash
$pass = GET_ADMIN_HASH(GET_ADMIN_ID($admin_login));
if (($ret == 'pass') && ((generatePassString($pass) == $password) || ($pass == $password) || ((strlen($pass) == 32) && (md5($password) == $pass)))) {
// Passwords matches!
$ret = 'done';
- }
+ } // END - if
// Return result
return $ret;
$GLOBALS['menu']['description'][$menu] = $descr;
}
$OUT .= "<li class=\"admin_menu\">
- <div class=\"nobr\"><strong>·</strong> ";
+<div class=\"nobr\"><strong>·</strong> ";
if (($menu == $act) && (empty($wht))) {
$OUT .= "<strong>";
// "Walk" through all entries
foreach ($IDs as $id => $sel) {
// Construct SQL query
- $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET",
- SQL_ESCAPE($table)
- );
+ $sql = sprintf("UPDATE `{!_MYSQL_PREFIX!}_%s` SET", SQL_ESCAPE($table));
// Load data of entry
$result = SQL_QUERY_ESC("SELECT * FROM `{!_MYSQL_PREFIX!}_%s` WHERE %s=%s LIMIT 1",
- array($table, $idColumn, $id), __FUNCTION__, __LINE__);
+ array($table, $idColumn, $id), __FUNCTION__, __LINE__);
// Fetch the data
$content = SQL_FETCHARRAY($result);
SQL_FREERESULT($result);
// Add all status entries (e.g. status column last_updated or so)
- $newStatus = "UNKNOWN";
- $oldStatus = "UNKNOWN";
- $statusColumn = "unknown";
+ $newStatus = 'UNKNOWN';
+ $oldStatus = 'UNKNOWN';
+ $statusColumn = 'unknown';
foreach ($statusArray as $column => $statusInfo) {
// Does the entry exist?
if ((isset($content[$column])) && (isset($statusInfo[$content[$column]]))) {
$sql .= sprintf(" %s='%s',", SQL_ESCAPE($column), SQL_ESCAPE($statusInfo[$content[$column]]));
// Remember status
- if ($statusColumn == "unknown") {
+ if ($statusColumn == 'unknown') {
// Always (!!!) change status column first!
$oldStatus = $content[$column];
$newStatus = $statusInfo[$oldStatus];