php thebuggenie-core-entities-tables-Users类(方法)实例源码

下面列出了php thebuggenie-core-entities-tables-Users 类(方法)源码代码实例,从而了解它的用法。

作者:RTechSof    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::PROJECT_ID, Projects::getTable());
     parent::_addForeignKeyColumn(self::USER_ID, Users::getTable());
     parent::_addForeignKeyColumn(self::ROLE_ID, ListTypes::getTable());
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addBoolean(self::CONFIRMED);
     parent::_addForeignKeyColumn(self::USER_ID, Users::getTable(), Users::ID);
     parent::_addForeignKeyColumn(self::GROUP_ID, Groups::getTable(), Groups::ID);
 }

作者:pkdevbox    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addInteger(self::TARGET, 10);
     parent::_addInteger(self::VOTE, 2);
     parent::_addForeignKeyColumn(self::UID, Users::getTable(), Users::ID);
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::UID, Users::getTable(), Users::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, Issues::getTable(), Issues::ID);
     parent::_addForeignKeyColumn(self::FILE_ID, Files::getTable(), Files::ID);
     parent::_addInteger(self::ATTACHED_AT, 10);
 }

作者:RTechSof    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::UID, \thebuggenie\core\entities\tables\Users::getTable(), \thebuggenie\core\entities\tables\Users::ID);
     parent::_addForeignKeyColumn(self::ARTICLE_ID, Articles::getTable(), Articles::ID);
     parent::_addForeignKeyColumn(self::FILE_ID, \thebuggenie\core\entities\tables\Files::getTable(), \thebuggenie\core\entities\tables\Files::ID);
     parent::_addInteger(self::ATTACHED_AT, 10);
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addVarchar(self::IDENTITY, 300);
     parent::_addVarchar(self::IDENTITY_HASH, 300);
     parent::_addVarchar(self::EMAIL, 300);
     parent::_addVarchar(self::TYPE, 300);
     parent::_addForeignKeyColumn(self::UID, Users::getTable(), Users::ID);
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addVarchar(self::URL, 300);
     parent::_addInteger(self::LINK_ORDER, 3);
     parent::_addVarchar(self::TARGET_TYPE, 30);
     parent::_addInteger(self::TARGET_ID, 10);
     parent::_addVarchar(self::DESCRIPTION, 100, '');
     parent::_addForeignKeyColumn(self::UID, Users::getTable(), Users::ID);
 }

作者:shoreless-Limite    项目:thebuggeni   
protected function _parse_mention($matches)
 {
     $user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($matches[1]);
     if ($user instanceof \thebuggenie\core\entities\User) {
         $output = framework\Action::returnComponentHTML('main/userdropdown_inline', array('user' => $matches[1], 'displayname' => $matches[0]));
         $this->mentions[$user->getID()] = $user;
     } else {
         $output = $matches[0];
     }
     return $output;
 }

作者:pkdevbox    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addVarchar(self::ARTICLE_NAME, 255);
     parent::_addText(self::OLD_CONTENT, false);
     parent::_addText(self::NEW_CONTENT, false);
     parent::_addVarchar(self::REASON, 255);
     parent::_addInteger(self::DATE, 10);
     parent::_addInteger(self::REVISION, 10);
     parent::_addForeignKeyColumn(self::AUTHOR, \thebuggenie\core\entities\tables\Users::getTable(), \thebuggenie\core\entities\tables\Users::ID);
 }

作者:pkdevbox    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::ISSUE_ID, Issues::getTable(), Issues::ID);
     parent::_addForeignKeyColumn(self::EDITED_BY, Users::getTable(), Users::ID);
     parent::_addInteger(self::EDITED_AT, 10);
     parent::_addInteger(self::ESTIMATED_MONTHS, 10);
     parent::_addInteger(self::ESTIMATED_WEEKS, 10);
     parent::_addInteger(self::ESTIMATED_DAYS, 10);
     parent::_addInteger(self::ESTIMATED_HOURS, 10);
     parent::_addFloat(self::ESTIMATED_POINTS);
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addVarchar(self::PERMISSION_TYPE, 100);
     parent::_addVarchar(self::TARGET_ID, 200, 0);
     parent::_addBoolean(self::ALLOWED);
     parent::_addVarchar(self::MODULE, 50);
     parent::_addForeignKeyColumn(self::UID, Users::getTable());
     parent::_addForeignKeyColumn(self::GID, Groups::getTable());
     parent::_addForeignKeyColumn(self::TID, Teams::getTable());
     parent::_addForeignKeyColumn(self::ROLE_ID, ListTypes::getTable());
 }

作者:founderi    项目:thebuggeni   
public function componentUserdropdown()
 {
     framework\Logging::log('user dropdown component');
     $this->rnd_no = rand();
     try {
         if (!$this->user instanceof entities\User) {
             framework\Logging::log('loading user object in dropdown');
             if (is_numeric($this->user)) {
                 $this->user = tables\Users::getTable()->getByUserId($this->user);
             } else {
                 $this->user = tables\Users::getTable()->getByUsername($this->user);
             }
             framework\Logging::log('done (loading user object in dropdown)');
         }
     } catch (\Exception $e) {
     }
     $this->show_avatar = isset($this->show_avatar) ? $this->show_avatar : true;
     framework\Logging::log('done (user dropdown component)');
 }

作者:pkdevbox    项目:thebuggeni   
public function runAuthenticate(framework\Request $request)
 {
     $username = trim($request['username']);
     $password = trim($request['password']);
     if ($username) {
         $user = tables\Users::getTable()->getByUsername($username);
         if ($password && $user instanceof entities\User) {
             foreach ($user->getApplicationPasswords() as $app_password) {
                 if (!$app_password->isUsed()) {
                     if ($app_password->getHashPassword() == entities\User::hashPassword($password, $user->getSalt())) {
                         $app_password->useOnce();
                         $app_password->save();
                         return $this->renderJSON(array('token' => $app_password->getHashPassword()));
                     }
                 }
             }
         }
     }
     $this->getResponse()->setHttpStatus(400);
     return $this->renderJSON(array('error' => 'Incorrect username or application password'));
 }

作者:founderi    项目:thebuggeni   
protected function _initialize()
 {
     parent::_setup(self::B2DBNAME, self::ID);
     parent::_addForeignKeyColumn(self::UID, Users::getTable());
     parent::_addForeignKeyColumn(self::TID, Teams::getTable());
 }

作者:RTechSof    项目:thebuggeni   
public function runFilterFindUsers(framework\Request $request)
 {
     $filter = $request['filter'];
     $filterkey = $request['filterkey'];
     $existing_users = $request['existing_id'];
     if (strlen($filter) < 3) {
         return $this->renderJSON(array('results' => '<li>' . $this->getI18n()->__('Please enter 3 characters or more') . '</li>'));
     }
     $users = tables\Users::getTable()->getByDetails($filter, 10);
     foreach ($existing_users as $id) {
         if (isset($users[$id])) {
             unset($users[$id]);
         }
     }
     return $this->renderJSON(array('results' => $this->getComponentHTML('search/filterfindusers', compact('users', 'filterkey'))));
 }

作者:founderi    项目:thebuggeni   
protected function _getAvailableUserChoices()
 {
     $me = framework\Context::getUser();
     $filters = array($me->getID() => $me);
     foreach ($me->getFriends() as $user) {
         $filters[$user->getID()] = $user;
     }
     if (count($this->getValues())) {
         $users = tables\Users::getTable()->getByUserIDs($this->getValues());
         foreach ($users as $user) {
             $filters[$user->getID()] = $user;
         }
     }
     return $filters;
 }

作者:rianori    项目:thebuggeni   
protected function _addUpdateNotifications($updated_by)
 {
     $uids = tables\UserIssues::getTable()->getUserIDsByIssueID($this->getID());
     $users = tables\Users::getTable()->getByUserIDs($uids);
     foreach ($users as $user) {
         if ($user->getNotificationSetting(framework\Settings::SETTINGS_USER_NOTIFY_SUBSCRIBED_ISSUES, false)->isOn() && $this->isSubscriber($user)) {
             $subscribed_category_id = $user->getNotificationSetting(\thebuggenie\core\framework\Settings::SETTINGS_USER_SUBSCRIBE_NEW_ISSUES_MY_PROJECTS_CATEGORY, null)->getValue();
             if ($subscribed_category_id === null || $subscribed_category_id == 0 || $this->getCategory() instanceof Category && $this->getCategory()->getID() == $subscribed_category_id) {
                 $this->_addNotificationIfNotNotified(Notification::TYPE_ISSUE_UPDATED, $user, $updated_by);
             }
         }
     }
 }

作者:JonathanR    项目:thebuggeni   
/**
  * Find users and show selection box
  *
  * @param framework\Request $request The request object
  */
 public function runFindAssignee(framework\Request $request)
 {
     $this->forward403unless($request->isPost());
     $this->message = false;
     if ($request['find_by']) {
         $this->selected_project = entities\Project::getB2DBTable()->selectById($request['project_id']);
         $this->users = tables\Users::getTable()->getByDetails($request['find_by'], 10);
         $this->teams = tables\Teams::getTable()->quickfind($request['find_by']);
         $this->global_roles = entities\Role::getAll();
         $this->project_roles = entities\Role::getByProjectID($this->selected_project->getID());
     } else {
         $this->message = true;
     }
 }

作者:RTechSof    项目:thebuggeni   
//.........这里部分代码省略.........
             }
             if ($allowed == false) {
                 throw new \Exception(framework\Context::getI18n()->__('You are not a member of a group allowed to log in'));
             }
         }
         /*
          * Set user's properties.
          * Realname is obtained from directory, if not found we set it to the username
          * Email is obtained from directory, if not found we set it to blank
          */
         if (!array_key_exists(strtolower($fullname_attr), $data[0])) {
             $realname = $username;
         } else {
             $realname = $data[0][strtolower($fullname_attr)][0];
         }
         if (!array_key_exists(strtolower($buddyname_attr), $data[0])) {
             $buddyname = $username;
         } else {
             $buddyname = $data[0][strtolower($buddyname_attr)][0];
         }
         if (!array_key_exists(strtolower($email_attr), $data[0])) {
             $email = '';
         } else {
             $email = $data[0][strtolower($email_attr)][0];
         }
         /*
          * If we are performing a non integrated authentication login,
          * now bind to the user and see if the credentials
          * are valid. We bind using the full DN of the user, so no need for DOMAIN\ stuff
          * on Windows, and more importantly it fixes other servers.
          *
          * If the bind fails (exception), we throw a nicer exception and don't continue.
          */
         if ($mode == 1 && !$integrated_auth) {
             try {
                 if (!is_array($data[0][strtolower($dn_attr)])) {
                     $dn = $data[0][strtolower($dn_attr)];
                 } else {
                     $dn = $data[0][strtolower($dn_attr)][0];
                 }
                 $bind = $this->bind($connection, $this->escape($dn), $password);
             } catch (\Exception $e) {
                 throw new \Exception(framework\Context::geti18n()->__('Your password was not accepted by the server'));
             }
         } elseif ($mode == 1) {
             if (!isset($_SERVER[$this->getSetting('integrated_auth_header')]) || $_SERVER[$this->getSetting('integrated_auth_header')] != $username) {
                 throw new \Exception(framework\Context::geti18n()->__('HTTP authentication internal error.'));
             }
         }
     } catch (\Exception $e) {
         ldap_unbind($connection);
         throw $e;
     }
     try {
         /*
          * Get the user object. If the user exists, update the user's
          * data from the directory.
          */
         $user = \thebuggenie\core\entities\User::getByUsername($username);
         if ($user instanceof \thebuggenie\core\entities\User) {
             $user->setBuddyname($buddyname);
             $user->setRealname($realname);
             $user->setPassword($user->getJoinedDate() . $username);
             // update password
             $user->setEmail($email);
             // update email address
             $user->save();
         } else {
             /*
              * If not, and we are performing an initial login, create the user object
              * if we are validating a log in, kick the user out as the session is invalid.
              */
             if ($mode == 1) {
                 // create user
                 $user = new \thebuggenie\core\entities\User();
                 $user->setUsername($username);
                 $user->setRealname('temporary');
                 $user->setBuddyname($username);
                 $user->setEmail('temporary');
                 $user->setEnabled();
                 $user->setActivated();
                 $user->setJoined();
                 $user->setPassword($user->getJoinedDate() . $username);
                 $user->save();
             } else {
                 throw new \Exception('User does not exist in TBG');
             }
         }
     } catch (\Exception $e) {
         ldap_unbind($connection);
         throw $e;
     }
     ldap_unbind($connection);
     /*
      * Set cookies and return user row for general operations.
      */
     framework\Context::getResponse()->setCookie('tbg3_username', $username);
     framework\Context::getResponse()->setCookie('tbg3_password', \thebuggenie\core\entities\User::hashPassword($user->getJoinedDate() . $username, $user->getSalt()));
     return \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($username);
 }

作者:AzerothShar    项目:thebuggeni   
protected function _addUpdateNotifications($updated_by)
 {
     $uids = tables\UserIssues::getTable()->getUserIDsByIssueID($this->getID());
     $users = tables\Users::getTable()->getByUserIDs($uids);
     foreach ($users as $user) {
         $this->_addNotification(Notification::TYPE_ISSUE_UPDATED, $user, $updated_by);
     }
 }


问题


面经


文章

微信
公众号

扫码关注公众号