public function getAuthor()
 {
     if (!isset($this->_author)) {
         $this->_author = Zwe_Model_User::getUserById($this->IDUser);
     }
     return $this->_author;
 }
 public static function getNewsByID($IDNews)
 {
     $News = new self();
     $News->fetchRowAndSet("IDNews = '{$IDNews}'");
     $News->Author = Zwe_Model_User::getUserById($News->IDAuthor);
     return $News;
 }
 public static function searchUser($Search)
 {
     $Users = parent::searchUser($Search);
     $Ret = array();
     foreach ($Users as $User) {
         $TheUser = new self();
         $Ret[] = $TheUser->copy($User);
     }
     return $Ret;
 }
 public function confirmAction()
 {
     $User = $this->_getParam('user');
     $Salt = $this->_getParam('salt');
     if (Zwe_Model_User::confirmUser($User, $Salt)) {
         $this->view->ok = true;
     } else {
         $this->view->ok = false;
     }
 }
 /**
  * Ritorna se l'email e la password passate corrispondono a un utente valido.
  *
  * @static
  * @param string $Email L'email dell'utente che si vuole loggare
  * @param string $Password La password dell'utente che si vuole loggare
  * @return bool Se lo login è andata a buon fine o meno
  */
 public static function isValidLogin($Email, $Password)
 {
     $Auth = Zend_Auth::getInstance();
     $Adapter = self::getAuthAdapter();
     $Adapter->setIdentity($Email);
     $Adapter->setCredential($Password);
     self::$AuthResult = $Auth->authenticate($Adapter);
     if (self::$AuthResult->isValid()) {
         $Auth->getStorage()->write(self::getUserById($Adapter->getResultRowObject()->IDUser));
         return true;
     } else {
         return false;
     }
 }
 public function getReceiver()
 {
     if (!isset($this->_receiver)) {
         $Receivers = Zwe_Model_MessageReceiver::getReceiversFromIDMessage($this->IDParent);
         $this->_receiver = array();
         foreach ($Receivers as $Receiver) {
             $this->_receiver[] = Zwe_Model_User::getUserById($Receiver->IDUser);
         }
     }
     return $this->_receiver;
 }
 public function __toString()
 {
     $date = new Zend_Date($this->Date);
     $author = Zwe_Model_User::getUserById($this->IDUser);
     return str_replace(array('%date%', '%author%', '%text%'), array($date, $author, $this->Text), $this->_template);
 }
 /**
  * L'action per confermare una nuova iscrizione.
  */
 public function confirmAction()
 {
     $User = $this->_getParam('user');
     $Salt = $this->_getParam('salt');
     Zwe_Model_User::confirmUser($User, $Salt);
     $this->_helper->_redirector('index');
 }