当前位置: 首页>>代码示例>>PHP>>正文


PHP entities\User类代码示例

本文整理汇总了PHP中thebuggenie\core\entities\User的典型用法代码示例。如果您正苦于以下问题:PHP User类的具体用法?PHP User怎么用?PHP User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runForgot

 /**
  * Forgotten password logic (AJAX call)
  *
  * @Route(url="/mailing/forgot")
  * @AnonymousRoute
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runForgot(framework\Request $request)
 {
     $i18n = framework\Context::getI18n();
     try {
         $username = str_replace('%2E', '.', $request['forgot_password_username']);
         if (!empty($username)) {
             if (($user = \thebuggenie\core\entities\User::getByUsername($username)) instanceof \thebuggenie\core\entities\User) {
                 if ($user->isActivated() && $user->isEnabled() && !$user->isDeleted()) {
                     if ($user->getEmail()) {
                         framework\Context::getModule('mailing')->sendForgottenPasswordEmail($user);
                         return $this->renderJSON(array('message' => $i18n->__('Please use the link in the email you received')));
                     } else {
                         throw new \Exception($i18n->__('Cannot find an email address for this user'));
                     }
                 } else {
                     throw new \Exception($i18n->__('Forbidden for this username, please contact your administrator'));
                 }
             } else {
                 throw new \Exception($i18n->__('This username does not exist'));
             }
         } else {
             throw new \Exception($i18n->__('Please enter an username'));
         }
     } catch (\Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => $e->getMessage()));
     }
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:35,代码来源:Main.php

示例2: loadUser

 /**
  * Load the user object into the user property
  *
  * @return \thebuggenie\core\entities\User
  */
 public static function loadUser($user = null)
 {
     try {
         self::$_user = $user === null ? User::loginCheck(self::getRequest(), self::getCurrentAction()) : $user;
         if (self::$_user->isAuthenticated()) {
             if (self::$_user->isOffline() || self::$_user->isAway()) {
                 self::$_user->setOnline();
             }
             if (!self::getRequest()->hasCookie('tbg3_original_username')) {
                 self::$_user->updateLastSeen();
             }
             if (!self::getScope()->isDefault() && !self::getRequest()->isAjaxCall() && !in_array(self::getRouting()->getCurrentRouteName(), array('add_scope', 'debugger', 'logout')) && !self::$_user->isGuest() && !self::$_user->isConfirmedMemberOfScope(self::getScope())) {
                 self::getResponse()->headerRedirect(self::getRouting()->generate('add_scope'));
             }
             self::$_user->save();
             if (!self::$_user->getGroup() instanceof \thebuggenie\core\entities\Group) {
                 throw new \Exception('This user account belongs to a group that does not exist anymore. <br>Please contact the system administrator.');
             }
         }
     } catch (exceptions\ElevatedLoginException $e) {
         throw $e;
     } catch (\Exception $e) {
         self::$_user = new User();
         throw $e;
     }
     return self::$_user;
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:32,代码来源:Context.php

示例3: do_execute

 public function do_execute()
 {
     $hostname = $this->getProvidedArgument('hostname');
     $this->cliEcho('Checking scope availability ...');
     if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
         $this->cliEcho("available!\n");
         $this->cliEcho("Creating scope ...");
         $scope = new entities\Scope();
         $scope->addHostname($hostname);
         $scope->setName($this->getProvidedArgument('shortname'));
         $uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
         $scope->setUploadsEnabled((bool) $uploads_enabled);
         $scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
         $scope->setMaxProjects($this->getProvidedArgument('projects', 0));
         $scope->setMaxUsers($this->getProvidedArgument('users', 0));
         $scope->setMaxTeams($this->getProvidedArgument('teams', 0));
         $scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
         $scope->setEnabled();
         $this->cliEcho(".");
         $scope->save();
         $this->cliEcho(".done!\n");
         $admin_user = $this->getProvidedArgument('scope_admin');
         if ($admin_user) {
             $user = entities\User::getByUsername($admin_user);
             if ($user instanceof entities\User) {
                 $this->cliEcho("Adding user {$admin_user} to scope\n");
                 $admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
                 tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
             } else {
                 $this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
             }
         }
         if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
             $this->cliEcho("Removing administrator user from scope\n");
             tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
         }
         foreach (framework\Context::getModules() as $module) {
             $module_name = $module->getName();
             if ($module_name == 'publish') {
                 continue;
             }
             if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
                 $this->cliEcho("Installing module {$module_name}\n");
                 entities\Module::installModule($module_name, $scope);
             }
         }
     } else {
         $this->cliEcho("not available\n", 'red');
     }
     $this->cliEcho("\n");
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:51,代码来源:CreateScope.php

示例4: addIdentity

 public function addIdentity($identity, $user_id)
 {
     $user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($user_id);
     $crit = $this->getCriteria();
     $crit->addInsert(self::IDENTITY, $identity);
     $crit->addInsert(self::IDENTITY_HASH, User::hashPassword($identity, $user->getSalt()));
     $crit->addInsert(self::UID, $user_id);
     $type = 'openid';
     foreach (self::getProviders() as $provider => $string) {
         if (stripos($identity, $string) !== false) {
             $type = $provider;
             break;
         }
     }
     $crit->addInsert(self::TYPE, $type);
     $this->doInsert($crit);
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:17,代码来源:OpenIdAccounts.php

示例5: runAuthenticate

 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'));
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:21,代码来源:Main.php

示例6: findInConfig

 public function findInConfig($details, $limit = 50, $allow_keywords = true)
 {
     $crit = $this->getCriteria();
     switch ($details) {
         case 'unactivated':
             if ($allow_keywords) {
                 $crit->addWhere(self::ACTIVATED, false);
                 $limit = 500;
                 break;
             }
         case 'newusers':
             if ($allow_keywords) {
                 $crit->addWhere(self::JOINED, NOW - 1814400, Criteria::DB_GREATER_THAN_EQUAL);
                 $limit = 500;
                 break;
             }
         case '0-9':
             if ($allow_keywords) {
                 $ctn = $crit->returnCriterion(self::UNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
                 $ctn->addOr(self::BUDDYNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
                 $ctn->addOr(self::REALNAME, array('0%', '1%', '2%', '3%', '4%', '5%', '6%', '7%', '8%', '9%'), Criteria::DB_IN);
                 $crit->addWhere($ctn);
                 $limit = 500;
                 break;
             }
         case 'all':
             if ($allow_keywords) {
                 $limit = 500;
                 break;
             }
         default:
             if (mb_strlen($details) == 1) {
                 $limit = 500;
             }
             $details = mb_strlen($details) == 1 ? mb_strtolower("{$details}%") : mb_strtolower("%{$details}%");
             $ctn = $crit->returnCriterion(self::UNAME, $details, Criteria::DB_LIKE);
             $ctn->addOr(self::BUDDYNAME, $details, Criteria::DB_LIKE);
             $ctn->addOr(self::REALNAME, $details, Criteria::DB_LIKE);
             $ctn->addOr(self::EMAIL, $details, Criteria::DB_LIKE);
             $crit->addWhere($ctn);
             break;
     }
     $crit->addJoin(UserScopes::getTable(), UserScopes::USER_ID, self::ID, array(), Criteria::DB_INNER_JOIN);
     $crit->addWhere(UserScopes::SCOPE, framework\Context::getScope()->getID());
     $crit->addWhere(self::DELETED, false);
     $users = array();
     $res = null;
     if ($details != '' && ($res = $this->doSelect($crit))) {
         while (($row = $res->getNextRow()) && count($users) < $limit) {
             $user_id = (int) $row->get(self::ID);
             $details = UserScopes::getTable()->getUserDetailsByScope($user_id, framework\Context::getScope()->getID());
             if (!$details) {
                 continue;
             }
             $users[$user_id] = \thebuggenie\core\entities\User::getB2DBTable()->selectById($user_id);
             $users[$user_id]->setScopeConfirmed($details['confirmed']);
         }
     }
     return $users;
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:60,代码来源:Users.php

示例7: runToggleFavouriteArticle

 /**
  * Toggle favourite article (starring)
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runToggleFavouriteArticle(framework\Request $request)
 {
     if ($article_id = $request['article_id']) {
         try {
             $article = Articles::getTable()->selectById($article_id);
             $user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($request['user_id']);
         } catch (\Exception $e) {
             return $this->renderText('fail');
         }
     } else {
         return $this->renderText('no article');
     }
     if ($user->isArticleStarred($article_id)) {
         $retval = !$user->removeStarredArticle($article_id);
     } else {
         $retval = $user->addStarredArticle($article_id);
         if ($user->getID() != $this->getUser()->getID()) {
             framework\Event::createNew('core', 'article_subscribe_user', $article, compact('user'))->trigger();
         }
     }
     return $this->renderText(json_encode(array('starred' => $retval, 'subscriber' => $this->getComponentHTML('publish/articlesubscriber', array('user' => $user, 'article' => $article)))));
 }
开发者ID:shoreless-Limited,项目名称:thebuggenie,代码行数:27,代码来源:Actions.php

示例8: User__populateStarredArticles

 /**
  * Populate the array of starred articles
  */
 protected function User__populateStarredArticles(User $user)
 {
     if ($user->_isset('publish', 'starredarticles') === null) {
         $articles = UserArticles::getTable()->getUserStarredArticles($user->getID());
         $user->_store('publish', 'starredarticles', $articles);
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:10,代码来源:Publish.php

示例9: link_tag

         <?php 
 if (!isset($include_issue_title) || $include_issue_title) {
     ?>
             <?php 
     echo link_tag(make_url('viewissue', array('project_key' => $issue->getProject()->getKey(), 'issue_no' => $issue->getFormattedIssueNo())), $issue_title, array('class' => $log_action['change_type'] == \thebuggenie\core\entities\tables\Log::LOG_ISSUE_CLOSE ? 'issue_closed' : 'issue_open', 'style' => 'margin-top: 7px;'));
     ?>
         <?php 
 }
 ?>
         <?php 
 if ((!isset($include_issue_title) || $include_issue_title) && (isset($include_user) && $include_user == true)) {
     ?>
             <br>
             <span class="user">
                 <?php 
     if (($user = \thebuggenie\core\entities\User::getB2DBTable()->selectById($log_action['user_id'])) instanceof \thebuggenie\core\entities\User) {
         ?>
                     <?php 
         if ($log_action['change_type'] != \thebuggenie\core\entities\tables\Log::LOG_COMMENT) {
             ?>
                         <?php 
             echo $user->getNameWithUsername() . ':';
             ?>
                     <?php 
         } else {
             ?>
                         <?php 
             echo __('%user said', array('%user' => $user->getNameWithUsername())) . ':';
             ?>
                     <?php 
         }
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:_logitem.inc.php

示例10: getDefaultUser

 /**
  * Return the default user
  *
  * @return \thebuggenie\core\entities\User
  */
 public static function getDefaultUser()
 {
     try {
         return \thebuggenie\core\entities\User::getB2DBTable()->selectByID((int) self::get(self::SETTING_DEFAULT_USER_ID));
     } catch (\Exception $e) {
         return null;
     }
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:13,代码来源:Settings.php

示例11: getOrCreateUserFromEmailString

 public function getOrCreateUserFromEmailString($email_string)
 {
     $email = $this->getEmailAdressFromSenderString($email_string);
     if (!($user = User::findUser($email))) {
         $name = $email;
         if (($q_pos = strpos($email_string, "<")) !== false) {
             $name = trim(substr($email_string, 0, $q_pos - 1));
         }
         $user = new User();
         try {
             $user->setBuddyname($name);
             $user->setEmail($email);
             $user->setUsername($email);
             $user->setValidated();
             $user->setActivated();
             $user->setEnabled();
             $user->save();
         } catch (\Exception $e) {
             return null;
         }
     }
     return $user;
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:23,代码来源:Mailing.php

示例12: __

                 <?php 
     echo __('Set resolution to %resolution', array('%resolution' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Resolution::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Resolution provided by user')) . '</span>'));
     ?>
             <?php 
 } elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_SET_REPRODUCABILITY) {
     ?>
                 <?php 
     echo __('Set reproducability to %reproducability', array('%reproducability' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ? \thebuggenie\core\entities\Reproducability::getB2DBTable()->selectById((int) $action->getTargetValue())->getName() : __('Reproducability provided by user')) . '</span>'));
     ?>
             <?php 
 } elseif ($action->getActionType() == \thebuggenie\core\entities\WorkflowTransitionAction::ACTION_ASSIGN_ISSUE) {
     ?>
                 <?php 
     if ($action->hasTargetValue()) {
         $target_details = explode('_', $action->getTargetValue());
         echo __('Assign issue to %assignee', array('%assignee' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($target_details[0] == 'user' ? \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1])->getNameWithUsername() : \thebuggenie\core\entities\Team::getB2DBTable()->selectById((int) $target_details[1])->getName()) . '</span>'));
     } else {
         echo __('Assign issue to %assignee', array('%assignee' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . __('User or team specified during transition') . '</span>'));
     }
     ?>
             <?php 
 } elseif ($action->isCustomSetAction()) {
     ?>
                 <?php 
     $tbg_response->addJavascript('calendarview.js');
     switch (\thebuggenie\core\entities\CustomDatatype::getByKey($action->getCustomActionType())->getType()) {
         case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXTAREA_MAIN:
         case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXTAREA_SMALL:
         case \thebuggenie\core\entities\CustomDatatype::INPUT_TEXT:
         case \thebuggenie\core\entities\CustomDatatype::CALCULATED_FIELD:
             echo __('Set issue field %key to %value', array('%key' => $action->getCustomActionType(), '%value' => '<span id="workflowtransitionaction_' . $action->getID() . '_value" style="font-weight: bold;">' . ($action->getTargetValue() ?: __('Value provided by user')) . '</span>'));
开发者ID:founderio,项目名称:thebuggenie,代码行数:31,代码来源:_workflowtransitionaction.inc.php

示例13: isFriend

 /**
  * Check if the given user is a friend of this user
  *
  * @param \thebuggenie\core\entities\User $user The user to check
  *
  * @return boolean
  */
 public function isFriend($user)
 {
     $this->_setupFriends();
     if (empty($this->_friends)) {
         return false;
     }
     return array_key_exists($user->getID(), $this->_friends);
 }
开发者ID:underblaze,项目名称:thebuggenie-4.1.0,代码行数:15,代码来源:User.php

示例14: tbg_get_userstate_image

function tbg_get_userstate_image(\thebuggenie\core\entities\User $user)
{
    switch (true) {
        case $user->getState()->isInMeeting():
            return fa_image_tag('circle', array('class' => 'userstate in-meeting', 'title' => __($user->getState()->getName())));
            break;
        case $user->getState()->isBusy():
            return fa_image_tag('minus-circle', array('class' => 'userstate busy', 'title' => __($user->getState()->getName())));
            break;
        case $user->isOffline():
            return fa_image_tag('times-circle', array('class' => 'userstate offline', 'title' => __($user->getState()->getName())));
            break;
        case $user->getState()->isAbsent():
            return fa_image_tag('circle', array('class' => 'userstate absent', 'title' => __($user->getState()->getName())));
            break;
        case $user->getState()->isUnavailable():
            return fa_image_tag('circle-thin', array('class' => 'userstate unavailable', 'title' => __($user->getState()->getName())));
            break;
        default:
            return fa_image_tag('check-circle', array('class' => 'userstate online', 'title' => __($user->getState()->getName())));
            break;
    }
}
开发者ID:founderio,项目名称:thebuggenie,代码行数:23,代码来源:common.inc.php

示例15: removeMember

 public function removeMember(\thebuggenie\core\entities\User $user)
 {
     if ($this->_members !== null) {
         unset($this->_members[$user->getID()]);
     }
     if ($this->_num_members !== null) {
         $this->_num_members--;
     }
     tables\TeamMembers::getTable()->removeUserFromTeam($user->getID(), $this->getID());
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:10,代码来源:Team.php


注:本文中的thebuggenie\core\entities\User类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。