Example #1
0
 /**
  * Setup permission over user property
  */
 protected function _addPermissions()
 {
     $user = $this->user->toArray(true);
     foreach ($this->user['AclRole']['AclPermission']['AclResource'] as $resource) {
         $this->allow($this->user['AclRole']['name'], $resource['name']);
     }
     // allow default action
     $this->allow($this->user['AclRole']['name'], $this->_defaultAction);
 }
 /**
  * Adds client id and signature to the User object array
  *
  * @return array
  */
 protected function signJsConnect()
 {
     $queryArray = array_merge($this->user->toArray(), $this->properties);
     ksort($queryArray);
     $queryString = http_build_query($queryArray, null, '&');
     $signature = md5($queryString . $this->config->getSecret());
     $queryArray['client_id'] = $this->config->getClientID();
     $queryArray['signature'] = $signature;
     return $queryArray;
 }
Example #3
0
 /**
  * Setup permission over user property
  */
 protected function _addPermissions()
 {
     if ($this->isAdmin) {
         $this->allow($user['AclRole']['name']);
     } else {
         $user = $this->user->toArray(true);
         foreach ($this->user['AclRole']['AclPermission']['AclResource'] as $resource) {
             $this->allow($this->user['AclRole']['name'], $resource['name']);
         }
     }
 }
 function indexAction()
 {
     $this->form = new Am_Form_Profile();
     $this->form->addCsrf();
     $record = $this->getDi()->savedFormTable->getByType(SavedForm::T_PROFILE);
     $event = new Am_Event(Am_Event::LOAD_PROFILE_FORM, array('user' => $this->getDi()->auth->getUser()));
     $event->setReturn($record);
     $this->getDi()->hook->call($event);
     $record = $event->getReturn();
     if (!$record) {
         throw new Am_Exception_Configuration("No profile form configured");
     }
     if ($record->meta_title) {
         $this->view->meta_title = $record->meta_title;
     }
     if ($record->meta_keywords) {
         $this->view->headMeta()->setName('keywords', $record->meta_keywords);
     }
     if ($record->meta_description) {
         $this->view->headMeta()->setName('description', $record->meta_description);
     }
     $this->form->initFromSavedForm($record);
     $this->form->setUser($this->user);
     $u = $this->user->toArray();
     unset($u['pass']);
     $dataSources = array(new HTML_QuickForm2_DataSource_Array($u));
     if ($this->form->isSubmitted()) {
         array_unshift($dataSources, $this->_request);
     }
     $this->form->setDataSources($dataSources);
     if ($this->form->isSubmitted() && $this->form->validate()) {
         $oldUser = clone $this->user;
         $oldUser->toggleFrozen(true);
         $vars = $this->form->getValue();
         unset($vars['user_id']);
         if (!empty($vars['pass'])) {
             $this->user->setPass($vars['pass']);
         }
         unset($vars['pass']);
         $ve = $this->handleEmail($record, $vars) ? 1 : 0;
         $u = $this->user->setForUpdate($vars);
         $this->emailChangesToAdmin();
         $u->update();
         $this->getDi()->hook->call(Am_Event::PROFILE_USER_UPDATED, array('vars' => $vars, 'oldUser' => $oldUser, 'user' => $u, 'form' => $this->form));
         $this->getDi()->auth->setUser($u, '');
         $msg = $ve ? ___('Verification email has been sent to your address.
                 E-mail will be changed in your account after confirmation') : ___('Your profile has been updated successfully');
         return $this->redirectLocation($this->getFullUrl() . '?a=saved&_msg=' . urlencode($msg));
     }
     $this->view->form = $this->form;
     $this->view->display('member/profile.phtml');
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['LanguageObjectHistory'][serialize($this->getPrimaryKey())])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['LanguageObjectHistory'][serialize($this->getPrimaryKey())] = true;
     $keys = LanguageObjectHistoryPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getObjectId(), $keys[1] => $this->getLanguageId(), $keys[2] => $this->getData(), $keys[3] => $this->getRevision(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(), $keys[6] => $this->getCreatedBy(), $keys[7] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aContentObject) {
             $result['ContentObject'] = $this->aContentObject->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aLanguage) {
             $result['Language'] = $this->aLanguage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #6
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['DocumentData'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['DocumentData'][$this->getPrimaryKey()] = true;
     $keys = DocumentDataPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getHash(), $keys[1] => $includeLazyLoadColumns ? $this->getData() : null, $keys[2] => $this->getDataSize(), $keys[3] => $this->getCreatedAt(), $keys[4] => $this->getUpdatedAt(), $keys[5] => $this->getCreatedBy(), $keys[6] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collDocuments) {
             $result['Documents'] = $this->collDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
    public function testFromArrayRecord()
    {
        $user = new User();
        $userArray = $user->toArray();

        # add a Phonenumber
        $userArray['Phonenumber'][0]['phonenumber'] = '555 321';
        
        # add an Email address
        $userArray['Email']['address'] = '*****@*****.**';
        
        # add group
        $userArray['Group'][0]['name'] = 'New Group'; # This is a n-m relationship
        # add a group which exists
        $userArray['Group'][1]['_identifier'] = $this->previous_group; # This is a n-m relationship where the group was made in prepareData
          
        $user->fromArray($userArray);
        
        $this->assertEqual($user->Phonenumber->count(), 1);
        $this->assertEqual($user->Phonenumber[0]->phonenumber, '555 321');
        $this->assertEqual($user->Group[0]->name, 'New Group');
        $this->assertEqual($user->Group[1]->name, 'Group One');
        
        try {
          $user->save();
        } catch (Exception $e ) {
          $this->fail("Failed saving with " . $e->getMessage());
        }
    }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Subscriber'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Subscriber'][$this->getPrimaryKey()] = true;
     $keys = SubscriberPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getName(), $keys[2] => $this->getPreferredLanguageId(), $keys[3] => $this->getEmail(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(), $keys[6] => $this->getCreatedBy(), $keys[7] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collSubscriberGroupMemberships) {
             $result['SubscriberGroupMemberships'] = $this->collSubscriberGroupMemberships->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Example #9
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['PageProperty'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['PageProperty'][$this->getPrimaryKey()] = true;
     $keys = PagePropertyPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getPageId(), $keys[2] => $this->getName(), $keys[3] => $this->getValue(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(), $keys[6] => $this->getCreatedBy(), $keys[7] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aPage) {
             $result['Page'] = $this->aPage->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['JournalEntryImage'][serialize($this->getPrimaryKey())])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['JournalEntryImage'][serialize($this->getPrimaryKey())] = true;
     $keys = JournalEntryImagePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getJournalEntryId(), $keys[1] => $this->getDocumentId(), $keys[2] => $this->getSort(), $keys[3] => $this->getLegend(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(), $keys[6] => $this->getCreatedBy(), $keys[7] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aJournalEntry) {
             $result['JournalEntry'] = $this->aJournalEntry->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aDocument) {
             $result['Document'] = $this->aDocument->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #11
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['TagInstance'][serialize($this->getPrimaryKey())])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['TagInstance'][serialize($this->getPrimaryKey())] = true;
     $keys = TagInstancePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getTagId(), $keys[1] => $this->getTaggedItemId(), $keys[2] => $this->getModelName(), $keys[3] => $this->getCreatedAt(), $keys[4] => $this->getUpdatedAt(), $keys[5] => $this->getCreatedBy(), $keys[6] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aTag) {
             $result['Tag'] = $this->aTag->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #12
0
 function set(User $user, $email)
 {
     $paramsWhere = array();
     $paramsWhere['email'] = $email;
     $paramsSet = $user->toArray();
     unset($paramsSet['pass']);
     return $this->db->update($this->table, $paramsSet, $paramsWhere);
 }
 /**
  * Transform the \User entity.
  *
  * @param \User $model
  *
  * @return array
  */
 public function transformData($model)
 {
     $data = array_only($model->toArray(), User::$includable);
     if ($model->getAttribute('avatar')) {
         $data['avatar'] = $model->avatar();
     }
     return $data;
 }
 function preDispatch()
 {
     if ($this->getRequest()->getActionName() != 'confirm-email') {
         $this->getDi()->auth->requireLogin(ROOT_URL . '/profile');
         $this->user = $this->getDi()->user;
         $this->view->assign('user', $this->user->toArray());
         $this->user_id = $this->user->user_id;
     }
 }
Example #15
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. 
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
 {
     $keys = WebdavLockPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getToken(), $keys[1] => $this->getPath(), $keys[2] => $this->getOwner(), $keys[3] => $this->getIsRecursive(), $keys[4] => $this->getIsExclusive(), $keys[5] => $this->getCreatedAt(), $keys[6] => $this->getUpdatedAt(), $keys[7] => $this->getExpiresAt());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, true);
         }
     }
     return $result;
 }
Example #16
0
 /**
  * Transform the \User entity.
  *
  * @param \User $model
  *
  * @return array
  */
 public function transformData($model)
 {
     $user = array_only($model->toArray(), User::$includable);
     if ($model->getAttribute('avatar')) {
         $user['avatar'] = $model->avatar();
     }
     if ($model->getAttribute('links')) {
         $user['links'] = ['replies_web_view' => route('users.replies.web_view', $model->id)];
     }
     return $user;
 }
Example #17
0
 /**
  * Transform the \User entity.
  *
  * @param \User $model
  *
  * @return array
  */
 public function transformData($model)
 {
     $user = array_only($model->toArray(), User::$includable);
     if ($model->getAttribute('avatar')) {
         $user['avatar'] = starts_with($model->avatar, 'http') ? $model->avatar : cdn('uploads/avatars/' . $model->avatar);
     }
     if ($model->getAttribute('links')) {
         $user['links'] = ['replies_web_view' => route('users.replies.web_view', $model->id)];
     }
     return $user;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. 
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $includeForeignObjects = false)
 {
     $keys = DirectoryPermissionPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getFilename(), $keys[2] => $this->getGroupId(), $keys[3] => $this->getCreatedBy(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt());
     if ($includeForeignObjects) {
         if (null !== $this->aGroup) {
             $result['Group'] = $this->aGroup->toArray($keyType, $includeLazyLoadColumns, true);
         }
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, true);
         }
     }
     return $result;
 }
Example #19
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['SystemLog'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['SystemLog'][$this->getPrimaryKey()] = true;
     $keys = SystemLogPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getIndex(), $keys[3] => $this->getEntity(), $keys[4] => $this->getService(), $keys[5] => $this->getCode(), $keys[6] => $this->getMessage(), $keys[7] => $this->getData());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #20
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Action'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Action'][$this->getPrimaryKey()] = true;
     $keys = ActionPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getActionTime(), $keys[3] => $this->getKey(), $keys[4] => $this->getDetails());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #21
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return    array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Job'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Job'][$this->getPrimaryKey()] = true;
     $keys = JobPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getChartId(), $keys[3] => $this->getStatus(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getDoneAt(), $keys[6] => $this->getType(), $keys[7] => $this->getParameter(), $keys[8] => $this->getFailReason());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aChart) {
             $result['Chart'] = $this->aChart->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #22
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['UserProduct'][serialize($this->getPrimaryKey())])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['UserProduct'][serialize($this->getPrimaryKey())] = true;
     $keys = UserProductPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getUserId(), $keys[1] => $this->getProductId(), $keys[2] => $this->getExpires());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aProduct) {
             $result['Product'] = $this->aProduct->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #23
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Session'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Session'][$this->getPrimaryKey()] = true;
     $keys = SessionPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getSessionKey(), $keys[2] => $this->getData(), $keys[3] => $this->getClientIpAddress(), $keys[4] => $this->getSessionType(), $keys[5] => $this->getTime(), $keys[6] => $this->getUserId());
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collSingleSignOnKeys) {
             $result['SingleSignOnKeys'] = $this->collSingleSignOnKeys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['SingleSignOnKey'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['SingleSignOnKey'][$this->getPrimaryKey()] = true;
     $keys = SingleSignOnKeyPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getSecret(), $keys[2] => $this->getUsed(), $keys[3] => $this->getSessionId(), $keys[4] => $this->getUserId(), $keys[5] => $this->getValidForMinutes(), $keys[6] => $this->getCreatedAt(), $keys[7] => $this->getUpdatedAt());
     if ($includeForeignObjects) {
         if (null !== $this->aSession) {
             $result['Session'] = $this->aSession->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #25
0
 public function save(array &$properties)
 {
     if (empty($properties) || !is_array($properties)) {
         throw new InvalidArgumentException('You must provide the values to update.', 400);
     }
     if (!empty($properties['SetPassword']) && $properties['SetPassword'] === 'yes') {
         $errorCode = 400;
         $errorMessage = '';
         if ($properties['Password'] !== $properties['ConfirmPassword']) {
             $errorMessage = 'Confirm Password must match Password.';
         } else {
             if (strlen($properties['Password']) < 10) {
                 $errorMessage = 'Password cannot be less than 10 characters long.';
             } else {
                 if (strlen($properties['Password']) > 100) {
                     $errorMessage = 'Password cannot be more than 100 characters long.';
                 } else {
                     // Create a User object just to generate the password hash. -- cwells
                     $user = new User($properties);
                     if (!$user->setPassword($properties['Password'])) {
                         $errorCode = 500;
                         $errorMessage = 'Failed to set the password. Please try again.';
                     }
                     $properties = $user->toArray();
                 }
             }
         }
         if (!empty($errorMessage)) {
             if (empty($properties[User::getPrimaryKeyName()])) {
                 $this->add($properties);
             } else {
                 $this->edit($properties);
             }
             $this->view->setStatus($errorMessage, $errorCode);
             return;
         }
     }
     // These are not actual properties on the User object. -- cwells
     unset($properties['SetPassword']);
     unset($properties['Password']);
     unset($properties['ConfirmPassword']);
     parent::save($properties);
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['memberProfile'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['memberProfile'][$this->getPrimaryKey()] = true;
     $keys = memberProfilePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getVisible(), $keys[2] => $this->getBio());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
Example #27
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['Language'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['Language'][$this->getPrimaryKey()] = true;
     $keys = LanguagePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getPathPrefix(), $keys[2] => $this->getIsActive(), $keys[3] => $this->getSort(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt(), $keys[6] => $this->getCreatedBy(), $keys[7] => $this->getUpdatedBy());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUserRelatedByCreatedBy) {
             $result['UserRelatedByCreatedBy'] = $this->aUserRelatedByCreatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUserRelatedByUpdatedBy) {
             $result['UserRelatedByUpdatedBy'] = $this->aUserRelatedByUpdatedBy->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collPageStrings) {
             $result['PageStrings'] = $this->collPageStrings->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLanguageObjects) {
             $result['LanguageObjects'] = $this->collLanguageObjects->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLanguageObjectHistorys) {
             $result['LanguageObjectHistorys'] = $this->collLanguageObjectHistorys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collTranslations) {
             $result['Translations'] = $this->collTranslations->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collUsersRelatedByLanguageId) {
             $result['UsersRelatedByLanguageId'] = $this->collUsersRelatedByLanguageId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collDocuments) {
             $result['Documents'] = $this->collDocuments->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
         if (null !== $this->collLinks) {
             $result['Links'] = $this->collLinks->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to TRUE.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['SystemEventInstance'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['SystemEventInstance'][$this->getPrimaryKey()] = true;
     $keys = SystemEventInstancePeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getSystemEventId(), $keys[2] => $this->getUserId(), $keys[3] => $this->getMessage(), $keys[4] => $this->getCreatedAt(), $keys[5] => $this->getUpdatedAt());
     if ($includeForeignObjects) {
         if (null !== $this->aSystemEvent) {
             $result['SystemEvent'] = $this->aSystemEvent->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->collSystemEventInstanceMessages) {
             $result['SystemEventInstanceMessages'] = $this->collSystemEventInstanceMessages->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
         }
     }
     return $result;
 }
Example #29
0
 /**
  * Exports the object as an array.
  *
  * You can specify the key type of the array by passing one of the class
  * type constants.
  *
  * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                    Defaults to BasePeer::TYPE_PHPNAME.
  * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
  * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
  * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
  *
  * @return array an associative array containing the field names (as keys) and field values
  */
 public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
 {
     if (isset($alreadyDumpedObjects['signIn'][$this->getPrimaryKey()])) {
         return '*RECURSION*';
     }
     $alreadyDumpedObjects['signIn'][$this->getPrimaryKey()] = true;
     $keys = signInPeer::getFieldNames($keyType);
     $result = array($keys[0] => $this->getId(), $keys[1] => $this->getUserId(), $keys[2] => $this->getReasonId(), $keys[3] => $this->getCreatedAt(), $keys[4] => $this->getUpdatedAt());
     $virtualColumns = $this->virtualColumns;
     foreach ($virtualColumns as $key => $virtualColumn) {
         $result[$key] = $virtualColumn;
     }
     if ($includeForeignObjects) {
         if (null !== $this->aUser) {
             $result['User'] = $this->aUser->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
         if (null !== $this->asignInReason) {
             $result['signInReason'] = $this->asignInReason->toArray($keyType, $includeLazyLoadColumns, $alreadyDumpedObjects, true);
         }
     }
     return $result;
 }
 public function login(array $params = null)
 {
     if ($this->app->getCurrentUser()->isLoggedIn()) {
         $this->app->redirectToHome();
     }
     $this->loadView('login');
     if (!empty($params)) {
         // Data was received, so this is a login attempt. -- cwells
         if (empty($params['Nickname']) || empty($params['Password'])) {
             $this->view->setStatus('You must provide a username and a password.', 400);
         } else {
             $db = $this->app->getDatabase();
             $user = $db->select('User', $params['Nickname']);
             if (is_null($user)) {
                 // Perform the password verification even when the user is not found in order to make timing attacks more difficult. -- cwells
                 $user = new User();
                 $user->verifyPassword($params['Password']);
                 $this->view->setStatus('Login failure. Please try again.', 401);
                 $this->logger->warn('Failed to retrieve User with primary key = ' . $params['Nickname'] . '.');
             } else {
                 if ($user->verifyPassword($params['Password']) === false) {
                     $this->view->setStatus('Login failure. Please try again.', 401);
                     $this->logger->warn('Invalid password provided for account: ' . $params['Nickname']);
                 } else {
                     $user->LastLogin = date(\CWA\DB\DATETIME_PHP_TO_DB);
                     $userProperties = $user->toArray();
                     $db->update('User', $userProperties);
                     $this->app->setCurrentUser($user);
                     if (!empty($_GET['returnURL']) && strncmp('/', $_GET['returnURL'], 1) === 0) {
                         $this->app->redirect($_GET['returnURL']);
                     } else {
                         $this->app->redirectToHome();
                     }
                 }
             }
         }
     }
 }