|
|
|
@ -85,50 +85,6 @@ class admin_auth { |
|
|
|
|
return array(1,"OK"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function validateAccount($id) { |
|
|
|
|
/* can only do this after upgrade, which means |
|
|
|
|
* that the first login will always fail |
|
|
|
|
$query |
|
|
|
|
= ' select id, disabled,password,privileges' |
|
|
|
|
. ' from %s' |
|
|
|
|
. ' where id = ?'; |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
$query |
|
|
|
|
= ' select id, disabled,password' |
|
|
|
|
. ' from %s' |
|
|
|
|
. ' where id = ?'; |
|
|
|
|
|
|
|
|
|
$query = sprintf($query, $GLOBALS['tables']['admin']); |
|
|
|
|
$req = Sql_Query_Params($query, array($id)); |
|
|
|
|
$data = Sql_Fetch_Row($req); |
|
|
|
|
if (!$data[0]) { |
|
|
|
|
return array(0,s("No such account")); |
|
|
|
|
} elseif ($data[1]) { |
|
|
|
|
return array(0,s("your account has been disabled")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## do this seperately from above, to avoid lock out when the DB hasn't been upgraded. |
|
|
|
|
## so, ignore the error |
|
|
|
|
$query |
|
|
|
|
= ' select privileges' |
|
|
|
|
. ' from %s' |
|
|
|
|
. ' where id = ?'; |
|
|
|
|
|
|
|
|
|
$query = sprintf($query, $GLOBALS['tables']['admin']); |
|
|
|
|
$req = Sql_Query_Params($query, array($id),1); |
|
|
|
|
if ($req) { |
|
|
|
|
$data = Sql_Fetch_Row($req); |
|
|
|
|
} else { |
|
|
|
|
$data = array(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($data[0])) { |
|
|
|
|
$_SESSION['privileges'] = unserialize($data[0]); |
|
|
|
|
} |
|
|
|
|
return array(1,"OK"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function adminName($id) { |
|
|
|
|
$req = Sql_Fetch_Row_Query(sprintf('select loginname from %s where id = %d',$GLOBALS["tables"]["admin"],$id)); |
|
|
|
|
return $req[0] ? $req[0] : s("Nobody"); |
|
|
|
|