diff --git a/include/class.client.php b/include/class.client.php index 32e2dab21af9c14525e5dcd6bedbc19eb9b35ef7..4cb9fc1f9bf274972497322a6d750bc1ff70e81d 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -362,6 +362,11 @@ class ClientAccount extends UserAccount { function update($vars, &$errors) { global $cfg; + // FIXME: Updates by agents should go through UserAccount::update() + global $thisstaff; + if ($thisstaff) + return parent::update($vars, $errors); + $rtoken = $_SESSION['_client']['reset-token']; if ($vars['passwd1'] || $vars['passwd2'] || $vars['cpasswd'] || $rtoken) { diff --git a/include/class.page.php b/include/class.page.php index 0373780e4e697fd7c7d12c4058ed63e746b16750..fa0eb8f77c592f0d489cb1170bbd33fadcd47ec0 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -217,8 +217,6 @@ class Page extends VerySimpleModel { try { $qs = self::objects()->filter(array('name'=>$name)) ->values_flat('id'); - if ($lang) - $qs = $qs->filter(array('lang'=>$lang)); list($id) = $qs->one(); return $id; } @@ -234,10 +232,7 @@ class Page extends VerySimpleModel { static function lookupByType($type, $lang=false) { try { - $qs = self::objects()->filter(array('type'=>$type)); - if ($lang) - $qs = $qs->filter(array('lang'=>$lang)); - return $qs->one(); + return self::objects()->filter(array('type'=>$type))->one(); } catch (DoesNotExist $ex) { return null; diff --git a/include/class.user.php b/include/class.user.php index b3423a871feaa40e1e73ae57db25c07ac9bc84e8..4fcb2c3cee37b3fdf58e62f639a87f09bb540507 100644 --- a/include/class.user.php +++ b/include/class.user.php @@ -882,12 +882,14 @@ class UserAccount extends VerySimpleModel { var $_status; var $_extra; - function __onload() { - $this->_status = new UserAccountStatus($this->get('status')); + function getStatus() { + if (!isset($this->_status)) + $this->_status = new UserAccountStatus($this->get('status')); + return $this->_status; } protected function hasStatus($flag) { - return $this->_status->check($flag); + return $this->getStatus()->check($flag); } protected function clearStatus($flag) { @@ -904,7 +906,7 @@ class UserAccount extends VerySimpleModel { } function isConfirmed() { - return $this->_status->isConfirmed(); + return $this->getStatus()->isConfirmed(); } function lock() { @@ -918,7 +920,7 @@ class UserAccount extends VerySimpleModel { } function isLocked() { - return $this->_status->isLocked(); + return $this->getStatus()->isLocked(); } function forcePasswdReset() { @@ -934,10 +936,6 @@ class UserAccount extends VerySimpleModel { return !$this->hasStatus(UserAccountStatus::FORBID_PASSWD_RESET); } - function getStatus() { - return $this->_status; - } - function getInfo() { return $this->ht; }