var $dblist;
function User($userId) {
$this->userId = $userId;
- $sql = sprintf("SELECT User.UserId, Username, Password, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard
+ $sql = sprintf("SELECT User.UserId, Username, Password, Name, Email, UL, bEnabled, nBytesSoft, nBytesHard, nBytes, nDatabases, nDatabasesHard, IF(nBytes>nBytesHard,1,0) AS bOverQuota
FROM User
INNER JOIN UserQuota ON User.UserId = UserQuota.UserId
INNER JOIN UserStat ON User.UserId = UserStat.UserId
function getUsername() {
return $this->exists()?$this->info['Username']:'';
}
+ function isOverQuota() {
+ return $this->exists()?($this->info['bOverQuota']>0?true:false):'';
+ }
function getBytes() {
if($this->exists()) {
$arr['nBytes'] = $this->info['nBytes'];
mysql_escape_string($this->getUserId()));
// $r = fetchRows(DBSelect($sql),'DatabaseId');
$r = fetchRows(DBSelect($sql),'Name');
+ ksort($r);
return $r;
}
}
function addDB($name) {
- if (in_array($name, $this->getDBList())) return false;
+ if (in_array($name, array_keys($this->getDBList()))) return false;
if (!addDB($name, $this->getUserId())) return false;
$this->setAccess($name);
return true;
function impersonate($userId=null) {
$wasImpersonating = isImpersonating();
if ($wasImpersonating) {
- if (is_null($userId)) {
+ if (is_null($userId) || empty($userId)) {
sess('UserId',sess('_UserId'));
+ sess('_UserId','');
} elseif ($userId>0) {
sess('UserId',$userId);
} else {
$base = (is_null($target)||substr($target,0,1)=='?')?$_SERVER['REDIRECT_URL']:(dirname($_SERVER['REDIRECT_URL']).'/');
redirectFull(is_null($target)?$base:($base.$target),$secure);
}
+function redirectStart() {
+ redirectFull(BASE_URL,null);
+}
function redirectFull($target,$secure) {
redirect2((((isSSL()&&is_null($secure))||$secure==true)?'https://':'http://').$_SERVER['SERVER_NAME'].$target);
}