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


PHP UserManager::instance方法代码示例

本文整理汇总了PHP中UserManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP UserManager::instance方法的具体用法?PHP UserManager::instance怎么用?PHP UserManager::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserManager的用法示例。


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

示例1: verify_login_valid

function verify_login_valid()
{
    global $Language;
    $request =& HTTPRequest::instance();
    if (!$request->existAndNonEmpty('form_loginname')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('include_session', 'missing_pwd'));
        return 0;
    }
    // first check just confirmation hash
    $res = db_query('SELECT confirm_hash,status FROM user WHERE ' . 'user_name=\'' . db_es($request->get('form_loginname')) . '\'');
    if (db_numrows($res) < 1) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_user'));
        return 0;
    }
    $usr = db_fetch_array($res);
    //if sys_user_approval=1 then check if the admin aldready validates the account
    if ($GLOBALS['sys_user_approval'] == 0 || $usr['status'] == 'V' || $usr['status'] == 'W') {
        if (strcmp($request->get('confirm_hash'), $usr['confirm_hash'])) {
            $GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_hash'));
            return 0;
        }
    } else {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('account_verify', 'err_status'));
        return 0;
    }
    // then check valid login
    return UserManager::instance()->login($request->get('form_loginname'), $request->get('form_pw'), true);
}
开发者ID:uniteddiversity,项目名称:tuleap,代码行数:28,代码来源:verify.php

示例2: getHelp

function getHelp($section = '')
{
    if (trim($section) !== '' && $section[0] !== '#') {
        $section = '#' . $section;
    }
    return '<a href="javascript:help_window(\'' . get_server_url() . '/plugins/pluginsadministration/documentation/' . UserManager::instance()->getCurrentUser()->getLocale() . '/' . $section . '\');">[?]</a>';
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:common.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param Integer $groupId     Project Id
  * @param Integer $weeksNumber Statistics duration in weeks
  *
  * @return Void
  */
 public function __construct($groupId, $weeksNumber)
 {
     $dao = new GitDao();
     // TODO: Optionally include presonal forks in repo list
     $allRepositories = $dao->getProjectRepositoryList($groupId);
     $um = UserManager::instance();
     $user = $um->getCurrentUser();
     $repoFactory = new GitRepositoryFactory($dao, ProjectManager::instance());
     foreach ($allRepositories as $repo) {
         $repository = $repoFactory->getRepositoryById($repo['repository_id']);
         if ($repository->userCanRead($user)) {
             $this->repoList[] = $repository;
         }
     }
     $this->displayChart = false;
     $this->weeksNumber = min($weeksNumber, self::MAX_WEEKSNUMBER);
     // Init some class properties according to 'weeks number' parameter
     $today = $_SERVER['REQUEST_TIME'];
     $startPeriod = strtotime("-{$this->weeksNumber} weeks");
     $weekInSeconds = self::WEEKS_IN_SECONDS;
     for ($i = $startPeriod + $weekInSeconds; $i < $today + $weekInSeconds; $i += $weekInSeconds) {
         $this->dates[] = date('M d', $i);
         $this->weekNum[] = intval(date('W', $i));
         $this->year[] = intval(date('Y', $i));
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:34,代码来源:Git_LastPushesGraph.class.php

示例4: process

 public function process()
 {
     global $sys_allow_restricted_users;
     $parameters = $this->getParametersAsArray();
     $project = null;
     if (!empty($parameters[0])) {
         $project = $this->getProject($parameters[0]);
     } else {
         $this->error('Missing argument project id');
         return false;
     }
     $repositoryName = '';
     if (!empty($parameters[1])) {
         $repositoryName = $parameters[1];
     } else {
         $this->error('Missing argument repository name');
         return false;
     }
     $userId = 0;
     if (!empty($parameters[2])) {
         $userId = $parameters[2];
     } else {
         $this->error('Missing argument user id');
         return false;
     }
     try {
         $repository = new GitRepository();
         $repository->setBackend(Backend::instance('Git', 'GitBackend'));
         $repository->setDescription('-- Default description --');
         //default access is private when restricted users are allowed
         if ($sys_allow_restricted_users == 1) {
             $repository->setAccess(GitRepository::PRIVATE_ACCESS);
         } else {
             $repository->setAccess(GitRepository::PUBLIC_ACCESS);
         }
         $user = null;
         if (!empty($userId)) {
             $user = UserManager::instance()->getUserById($userId);
         }
         if (!empty($user)) {
             $repository->setCreator($user);
         }
         $repository->setProject($project);
         $repository->setName($repositoryName);
         $repository->create();
         $this->done();
     } catch (GitDaoException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitDriverException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (GitBackendException $e) {
         $this->error($e->getMessage());
         return false;
     } catch (Exception $e) {
         $this->error($e->getMessage());
         return false;
     }
 }
开发者ID:nterray,项目名称:tuleap,代码行数:60,代码来源:SystemEvent_GIT_REPO_CREATE.class.php

示例5: importTemplateInProject

 public function importTemplateInProject(Project $project, PFUser $user, $template_path)
 {
     \UserManager::instance()->forceLogin($user->getUserName());
     var_dump('Import Template');
     $this->xml_importer->import($project->getID(), $template_path);
     var_dump('Template imported');
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:ProjectHelper.php

示例6: register_valid

function register_valid(Codendi_Request $request)
{
    global $Language;
    if (!$request->existAndNonEmpty('Update')) {
        return false;
    }
    if (!$request->existAndNonEmpty('user_id')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_userid'));
        return false;
    }
    if (!$request->existAndNonEmpty('form_pw')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_nopasswd'));
        return false;
    }
    if ($request->get('form_pw') != $request->get('form_pw2')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_passwd'));
        return false;
    }
    $errors = array();
    if (!account_pwvalid($request->get('form_pw'), $errors)) {
        foreach ($errors as $e) {
            $GLOBALS['Response']->addFeedback('error', $e);
        }
        return false;
    }
    // if we got this far, it must be good
    $user_manager = UserManager::instance();
    $user = $user_manager->getUserById($request->get('user_id'));
    $user->setPassword($request->get('form_pw'));
    if (!$user_manager->updateDb($user)) {
        $GLOBALS['Response']->addFeedback(Feedback::ERROR, $Language->getText('admin_user_changepw', 'error_update'));
        return false;
    }
    return true;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:35,代码来源:user_changepw.php

示例7: buildSearchAdminClient

 /**
  * Build instance of SearchAdminClientFacade
  *
  * @return ElasticSearch_ClientFacade
  */
 public function buildSearchAdminClient()
 {
     $index = fulltextsearchPlugin::SEARCH_DEFAULT;
     $type = '';
     $client = $this->getClient($index, $type);
     return new ElasticSearch_SearchAdminClientFacade($client, $index, $this->project_manager, UserManager::instance(), new ElasticSearch_1_2_ResultFactory($this->project_manager, new URLVerification(), UserManager::instance()));
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:12,代码来源:ClientFactory.class.php

示例8: displayNotificationEmail

 function displayNotificationEmail()
 {
     $html = '';
     $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_title') . '</h3>';
     $atsm = new Docman_ApprovalTableNotificationCycle();
     $atsm->setItem($this->item);
     $atf =& Docman_ApprovalTableFactoriesFactory::getFromItem($this->item);
     $table = $atf->getTable(false);
     $atsm->setTable($table);
     $um =& UserManager::instance();
     $owner =& $um->getUserById($table->getOwner());
     $atsm->setOwner($owner);
     $atsm->sendNotifReviewer($owner);
     $html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_subject') . ' ' . $atsm->getNotificationSubject() . "\n";
     $html .= '<p class="docman_approval_email">';
     if (ProjectManager::instance()->getProject($this->item->getGroupId())->getTruncatedEmailsUsage()) {
         $html .= $GLOBALS['Language']->getText('plugin_docman', 'truncated_email');
     } else {
         $html .= htmlentities(quoted_printable_decode($atsm->getNotificationBodyText()), ENT_COMPAT, 'UTF-8');
     }
     $html .= '</p>';
     $backurl = $this->url . '&action=approval_create&id=' . $this->item->getId();
     $html .= '<a href="' . $backurl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_back') . '</a>';
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:25,代码来源:Docman_View_ItemDetailsSectionApprovalCreate.class.php

示例9: generate

 function generate()
 {
     global $Language;
     $request =& HTTPRequest::instance();
     if ($data = $request->get('data')) {
         if (isset($data['users']['generate']) && $data['users']['generate']) {
             $um = UserManager::instance();
             $nb_wanted = isset($data['users']['nb']) ? (int) $data['users']['nb'] : 1;
             $users = $this->_getUsersData();
             reset($users);
             $nb_done = 0;
             while ((list(, $user) = each($users)) && $nb_wanted > $nb_done) {
                 if (!$um->getUserByUserName($user['name'])) {
                     require_once 'account.php';
                     account_create($user['name'], 'codendi', '', $user['realname'], '', '379fbec92fb84a72d6026a422@mailinator.com', 'A', '', 0, 0, 'Europe/Paris', 'en_US', 'A');
                     $nb_done++;
                 }
             }
         }
         if (isset($data['projects']['generate']) && $data['projects']['generate']) {
             $nb_wanted = isset($data['projects']['nb']) ? (int) $data['projects']['nb'] : 1;
             $projects = $this->_getProjectsData();
             reset($projects);
             $nb_done = 0;
             while ((list(, $project) = each($projects)) && $nb_wanted > $nb_done) {
                 if (!group_get_object_by_name($project['name'])) {
                     $projectCreator = new ProjectCreator(ProjectManager::instance(), ReferenceManager::instance());
                     $projectCreator->create(array('project' => array('form_unix_name' => $project['name'], 'form_full_name' => $project['name'], 'form_short_description' => $project['description'], 'form_purpose' => $project['description'], 'form_required_sw' => '', 'form_patents' => '', 'form_comments' => '', 'built_from_template' => 100, 'is_test' => false, 'is_public' => true, 'trove' => array())));
                     $nb_done++;
                 }
             }
         }
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:34,代码来源:DataGeneratorActions.class.php

示例10: getInstance

 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance($config, $args)
 {
     if (self::$instance == null) {
         self::$instance = new UserManager($config, $args);
     }
     return self::$instance;
 }
开发者ID:pars5555,项目名称:pcstore,代码行数:14,代码来源:UserManager.class.php

示例11: __construct

 public function __construct(EventManager $event_manager)
 {
     $this->event_manager = $event_manager;
     $this->renderer = TemplateRendererFactory::build()->getRenderer(array(ForgeConfig::get('codendi_dir') . '/src/templates/search'));
     $this->search_types = array(Search_SearchTrackerV3::NAME => new Search_SearchTrackerV3(new ArtifactDao()), Search_SearchProject::NAME => new Search_SearchProject(new ProjectDao()), Search_SearchPeople::NAME => new Search_SearchPeople(UserManager::instance()), Search_SearchForum::NAME => new Search_SearchForum(new ForumDao()), Search_SearchSnippet::NAME => new Search_SearchSnippet(new SnippetDao()), Search_SearchWiki::NAME => new Search_SearchWiki(new WikiDao()));
     $this->plugin_manager = PluginManager::instance();
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:SearchController.class.php

示例12: confirmHash

 public function confirmHash()
 {
     $user_manager = UserManager::instance();
     $confirm_hash = $this->request->get('confirm_hash');
     $success = $user_manager->getUserByConfirmHash($confirm_hash) !== null;
     if ($success) {
         // Get user status: if already set to 'R' (restricted) don't change it!
         $user = $user_manager->getUserByConfirmHash($confirm_hash);
         if ($user->getStatus() == PFUser::STATUS_RESTRICTED || $user->getStatus() == PFUser::STATUS_VALIDATED_RESTRICTED) {
             $user->setStatus(PFUser::STATUS_RESTRICTED);
         } else {
             $user->setStatus(PFUser::STATUS_ACTIVE);
         }
         if ($user->getUnixUid() == 0) {
             $user_manager->assignNextUnixUid($user);
             if ($user->getStatus() == PFUser::STATUS_RESTRICTED) {
                 // Set restricted shell for restricted users.
                 $user->setShell($GLOBALS['codendi_bin_prefix'] . '/cvssh-restricted');
             }
         }
         $user->setUnixStatus(PFUser::STATUS_ACTIVE);
         $user_manager->updateDb($user);
         $user_manager->removeConfirmHash($confirm_hash);
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('account_verify', 'account_confirm'));
     } else {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('account_verify', 'err_hash'));
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:28,代码来源:LoginController.class.php

示例13: __construct

 /**
  * Constructor
  *
  * @param Tracker_FormElement_Field_ArtifactLink $field        The field of the value
  * @param boolean                                $has_changed  If the changeset value has chnged from the previous one
  * @param array                                  $artifact_links array of artifact_id => Tracker_ArtifactLinkInfo
  * @param array                                  $reverse_artifact_links array of artifact_id => Tracker_ArtifactLinkInfo
  */
 public function __construct($id, $field, $has_changed, $artifact_links, $reverse_artifact_links)
 {
     parent::__construct($id, $field, $has_changed);
     $this->artifact_links = $artifact_links;
     $this->reverse_artifact_links = $reverse_artifact_links;
     $this->user_manager = UserManager::instance();
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:15,代码来源:Tracker_Artifact_ChangesetValue_ArtifactLink.class.php

示例14:

 function &getUser()
 {
     if ($this->user === null) {
         $um = UserManager::instance();
         $this->user = $um->getCurrentUser();
     }
     return $this->user;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:DocmanWatermark_Controller.class.php

示例15: delete

 /**
  * Delete entry that match $package_id and $user_id (current user) in filemodule_monitor
  *
  * @param $package_id int
  * @return true if there is no error
  */
 function delete($filemodule_id)
 {
     $um =& UserManager::instance();
     $user =& $um->getCurrentUser();
     $sql = sprintf("DELETE FROM filemodule_monitor WHERE filemodule_id=%d AND user_id=%d", $this->da->escapeInt($filemodule_id), $this->da->escapeInt($user->getID()));
     $deleted = $this->update($sql);
     return $deleted;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:14,代码来源:FileModuleMonitorDao.class.php


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