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


PHP UserHelper类代码示例

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


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

示例1: getContent

 public function getContent()
 {
     $request =& HTTPRequest::instance();
     $group_id = $request->get('group_id');
     $pm = ProjectManager::instance();
     $project = $pm->getProject($group_id);
     $res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
     if (db_numrows($res_admin) > 0) {
         $user_helper = UserHelper::instance();
         $hp = Codendi_HTMLPurifier::instance();
         $em = EventManager::instance();
         echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
         while ($row_admin = db_fetch_array($res_admin)) {
             $display_name = '';
             $em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
             if (!$display_name) {
                 $display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
             }
             echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
         }
     }
     echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
     // count of developers on this project
     $res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
     echo db_numrows($res_count);
     echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:Widget_ProjectMembers.class.php

示例2: getTable

 function getTable($params)
 {
     $this->defaultUrl = $params['default_url'];
     $content = '';
     $content .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_title'), $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_location'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_who'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_when')));
     // Get list of all locked documents in the project.
     $dPM = Docman_PermissionsManager::instance($params['group_id']);
     $lockInfos = $dPM->getLockFactory()->getProjectLockInfos($params['group_id']);
     $uH = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     require_once dirname(__FILE__) . '/../Docman_ItemFactory.class.php';
     $dIF = new Docman_ItemFactory($params['group_id']);
     $altRowClass = 0;
     foreach ($lockInfos as $row) {
         $trclass = html_get_alt_row_color($altRowClass++);
         $item = $dIF->getItemFromDb($row['item_id']);
         $parent = $dIF->getItemFromDb($item->getParentId());
         $content .= '<tr class="' . $trclass . '">';
         $content .= '<td>' . '<a href="/plugins/docman/?group_id=' . $params['group_id'] . '&action=details&id=' . $item->getId() . '">' . $item->getTitle() . '</a></td>';
         $content .= '<td>';
         if ($dIF->isRoot($parent)) {
             $content .= '</td>';
         } else {
             $content .= '<a href="' . $this->defaultUrl . '&action=show&id=' . $parent->getId() . '">' . $parent->getTitle() . '</a></td>';
         }
         $content .= '<td>' . $hp->purify($uH->getDisplayNameFromUserId($row['user_id'])) . '</td>';
         $content .= '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['lock_date']) . '</td>';
         $content .= '</tr>';
     }
     $content .= '</table>';
     return $content;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:32,代码来源:Docman_View_Admin_LockInfos.class.php

示例3: __construct

 public function __construct($default = array())
 {
     parent::__construct($default);
     // init vars
     $this->joomla = JFactory::getApplication();
     $this->user = JFactory::getUser();
     $this->session = JFactory::getSession();
     $this->document = JFactory::getDocument();
     $this->dispatcher = JDispatcher::getInstance();
     $this->option = YRequest::getCmd('option');
     $this->link_base = 'index.php?option=' . $this->option;
     $this->controller = $this->getName();
     // add super administrator var to user
     $this->user->superadmin = UserHelper::isJoomlaSuperAdmin($this->user);
     // init additional admin vars
     if ($this->joomla->isAdmin()) {
         $this->baseurl = 'index.php?option=' . $this->option . '&controller=' . $this->getName();
     }
     // init additional site vars
     if ($this->joomla->isSite()) {
         $this->itemid = (int) $GLOBALS['Itemid'];
         $this->params = $this->joomla->getParams();
         $this->pathway = $this->joomla->getPathway();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:25,代码来源:controller.php

示例4: getContent

 function getContent()
 {
     $html = '';
     $i = 1;
     $UH = UserHelper::instance();
     $hp = Codendi_HTMLPurifier::instance();
     while ($data = db_fetch_array($this->getLatestRevisions())) {
         $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
         $html .= '<div style="font-size:0.98em;">';
         $html .= '<a href="' . $this->_getLinkToCommit($data) . '">#' . $data['revision'] . '</a>';
         $html .= ' by ';
         if (isset($data['whoid'])) {
             $name = $UH->getDisplayNameFromUserId($data['whoid']);
         } else {
             $name = $UH->getDisplayNameFromUserName($data['who']);
         }
         $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . ' on ';
         //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
         $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
         $html .= '</div>';
         $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
         $html .= util_make_links(substr($data['description'], 0, 255), $this->group_id);
         if (strlen($data['description']) > 255) {
             $html .= '&nbsp;[...]';
         }
         $html .= '</div>';
         $html .= '</div>';
     }
     $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
     $html .= '<a href="' . $this->_getLinkToMore() . '">[ More ]</a>';
     $html .= '</div>';
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:33,代码来源:Widget_ProjectLatestCommits.class.php

示例5: show

 public function show()
 {
     $this->editable = UserHelper::isEditor();
     $cons = array();
     $field = trim(fRequest::get('field'));
     $start_year = trim(fRequest::get('start_year'));
     $major = trim(fRequest::get('major'));
     $location = trim(fRequest::get('location'));
     $words = trim(fRequest::get('words'));
     $cons['login_name|display_name~'] = $words;
     if (!empty($field)) {
         $cons['field='] = $field;
     }
     if (!empty($start_year)) {
         $cons['start_year='] = $start_year;
     }
     if (!empty($major)) {
         $cons['major='] = $major;
     }
     if (!empty($location)) {
         $cons['location~'] = $location;
     }
     $this->users = fRecordSet::build('Profile', $cons, array('id' => 'asc'));
     $this->field = $field;
     $this->start_year = $start_year;
     $this->major = $major;
     $this->location = $location;
     $this->words = $words;
     $this->render('search/index');
 }
开发者ID:daerduoCarey,项目名称:xiaoyou,代码行数:30,代码来源:SearchController.php

示例6: __construct

 /**
  * Before we do anything, check to see if the user is an admin. If it's
  *  an un-auth'd call, log the user info (if they are logged in as a non-admin),
  *  and the IP address
  */
 public function __construct()
 {
     parent::__construct();
     if (!UserHelper::isAdmin()) {
         log_message('error', "Attempted unauthorized access to admin section: " . UserHelper::getEmail() . '-' . UserHelper::getId() . '-' . $this->input->ip_address());
         show_error("You do not have permission to access this resource. This has been logged.");
     }
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:13,代码来源:home.php

示例7: instance

 /**
  * 
  * @return UserHelper
  */
 public static function instance()
 {
     if (!isset(self::$_instance)) {
         $c = __CLASS__;
         self::$_instance = new $c();
     }
     return self::$_instance;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:12,代码来源:UserHelper.class.php

示例8: get_profile_box

 /**
  * An ajax call to get the current logged-in-user's profile page when logged in.
  * Loaded via ajax so the front page can be cached easily
  * Loads a login box if the user is not logged in, and a profile
  *  box if they are
  */
 public function get_profile_box()
 {
     if (UserHelper::isLoggedIn()) {
         $this->load->view('global/_profile_box');
     } else {
         $this->load->view('global/_login_form');
     }
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:14,代码来源:contributors.php

示例9: process

 public function process()
 {
     $this->validate();
     if (!$this->hasErrors()) {
         if (($model = Yii::app()->getUser()->getModel()) !== null) {
             return $model->saveAttributes(array('password' => UserHelper::encryptPassword($this->newPassword)));
         }
     }
     return false;
 }
开发者ID:jayrulez,项目名称:kcconline,代码行数:10,代码来源:ChangePasswordForm.php

示例10: check

 function check()
 {
     if (config_item('is_maintanence')) {
         $CI =& get_instance();
         $is_admin = in_array(UserHelper::getUsername(), config_item('admin_users'));
         if (!$is_admin && !($CI->uri->segment(1) == 'login')) {
             die('Hang on a bit while we upgrade the site :)');
         }
     }
 }
开发者ID:souparno,项目名称:getsparks.org,代码行数:10,代码来源:Maintenance.php

示例11: actionSocial

 /**
  * Performs social login.
  * 
  * @param string $provider The name of the social network.
  */
 public function actionSocial($provider)
 {
     if (Yii::app()->hasModule('social') && Yii::app()->hasModule('registration')) {
         /* social and registration modules are loaded */
         Yii::import('application.modules.social.models.*');
         Yii::import('application.modules.social.components.*');
         try {
             $provider_params = array('redirect_uri' => 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->request->requestUri);
             $p = ProviderManager::getInstance($provider, $provider_params);
             if (isset($p)) {
                 $result = $p->isAuthorized();
                 $user = null;
                 if ($result['success']) {
                     // app authorized
                     if (!isset(Yii::app()->session['registration_user_id'])) {
                         if ($result['registration_required']) {
                             $user = UserHelper::createAccount($result['user_data']['social_email'], null, null, true, false, false);
                             $p->setSession($result['user_data']);
                             $p->storeOauthData($user->id, $result['user_data']);
                         } else {
                             $user = User::model()->findByPk($result['user_id']);
                             $identity = new SocialUserIdentity($result['user_id'], $result['user_data']);
                             $identity->authenticate();
                             $p->storeOauthData($result['user_id'], $result['user_data']);
                         }
                     } else {
                         $user = User::model()->findByPk(Yii::app()->session['registration_user_id']);
                         if (isset($user)) {
                             $p->setSession($result['user_data']);
                             $p->storeOauthData($user->id, $result['user_data']);
                         }
                     }
                     $p->pullData($result['user_data']['social_oauth_id'], $result['user_data']['social_oauth_token'], $user);
                     if (isset(Yii::app()->session['registration_user_id'])) {
                         $this->redirect(Yii::app()->createUrl('registration'));
                     } else {
                         if ($result['registration_required']) {
                             $this->redirect(Yii::app()->createUrl('registration'));
                         } else {
                             $this->redirect(Yii::app()->baseUrl);
                         }
                     }
                 } else {
                     // app not authorized
                     $this->redirect($result['url']);
                 }
             }
         } catch (Exception $ex) {
             $this->redirect(Yii::app()->createUrl('users'));
         }
     } else {
         /* modules are not loaded */
         $this->redirect(Yii::app()->createUrl('users'));
     }
 }
开发者ID:bafio89,项目名称:qea-u,代码行数:60,代码来源:AuthController.php

示例12: getContent

 public function getContent()
 {
     $html = '';
     $uh = UserHelper::instance();
     $request = HTTPRequest::instance();
     $hp = Codendi_HTMLPurifier::instance();
     $user = UserManager::instance()->getCurrentUser();
     $pm = ProjectManager::instance();
     $project_ids = $user->getProjects();
     foreach ($project_ids as $project_id) {
         $project = $pm->getProject($project_id);
         if ($project->usesSVN()) {
             list($hide_now, $count_diff, $hide_url) = my_hide_url('my_svn_group', $project_id, $request->get('hide_item_id'), count($project_ids), $request->get('hide_my_svn_group'));
             $html .= $hide_url;
             $html .= '<strong>' . $project->getPublicName() . '</strong>';
             if (!$hide_now) {
                 list($latest_revisions, $nb_revisions) = svn_get_revisions($project, 0, $this->_nb_svn_commits, '', $user->getUserName(), '', '', 0, false);
                 if (db_numrows($latest_revisions) > 0) {
                     $i = 0;
                     while ($data = db_fetch_array($latest_revisions)) {
                         $html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
                         $html .= '<div style="font-size:0.98em;">';
                         $html .= '<a href="' . $this->_getLinkToCommit($project->getGroupId(), $data['revision']) . '">rev #' . $data['revision'] . '</a>';
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_on') . ' ';
                         //In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
                         $html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
                         $html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_by') . ' ';
                         if (isset($data['whoid'])) {
                             $name = $uh->getDisplayNameFromUserId($data['whoid']);
                         } else {
                             $name = $uh->getDisplayNameFromUserName($data['who']);
                         }
                         $html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML);
                         $html .= '</div>';
                         $html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
                         $html .= util_make_links(substr($data['description'], 0, 255), $project->getGroupId());
                         if (strlen($data['description']) > 255) {
                             $html .= '&nbsp;[...]';
                         }
                         $html .= '</div>';
                         $html .= '</div>';
                     }
                     $html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
                     $html .= '<a href="' . $this->_getLinkToMore($project->getGroupId(), $user->getUserName()) . '">[ More ]</a>';
                     $html .= '</div>';
                 } else {
                     $html .= '<div></div>';
                 }
             } else {
                 $html .= '<div></div>';
             }
         }
     }
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:55,代码来源:Widget_MyLatestSvnCommits.class.php

示例13: getContent

 function getContent()
 {
     $content = '';
     $uh = UserHelper::instance();
     if (is_a($this->item, 'Docman_File')) {
         $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>';
         $version_factory =& new Docman_VersionFactory();
         $approvalFactory =& Docman_ApprovalTableFactory::getFromItem($this->item);
         if ($versions = $version_factory->getAllVersionForItem($this->item)) {
             if (count($versions)) {
                 $titles = array();
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_version');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_date');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_author');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_label');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_changelog');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval');
                 $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_delete_version');
                 $content .= html_build_list_table_top($titles, false, false, false);
                 $odd_even = array('boxitem', 'boxitemalt');
                 $i = 0;
                 foreach ($versions as $key => $nop) {
                     $download = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $versions[$key]->getNumber()));
                     $delete = Docman_View_View::buildUrl($this->url, array('action' => 'confirmDelete', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber()));
                     $user = $versions[$key]->getAuthorId() ? $uh->getDisplayNameFromUserId($versions[$key]->getAuthorId()) : $GLOBALS['Language']->getText('plugin_docman', 'details_history_anonymous');
                     $content .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">';
                     $content .= '<td align="center"><a href="' . $download . '">' . $versions[$key]->getNumber() . '</a></td>';
                     $content .= '<td>' . html_time_ago($versions[$key]->getDate()) . '</td>';
                     $content .= '<td>' . $this->hp->purify($user) . '</td>';
                     $content .= '<td>' . $this->hp->purify($versions[$key]->getLabel()) . '</td>';
                     $content .= '<td>' . $this->hp->purify($versions[$key]->getChangelog(), CODENDI_PURIFIER_LIGHT) . '</td>';
                     $table = $approvalFactory->getTableFromVersion($versions[$key]);
                     if ($table != null) {
                         $appTable = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber()));
                         $content .= '<td align="center"><a href="' . $appTable . '">' . ($titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval_show') . '</a></td>');
                     } else {
                         $content .= '<td></td>';
                     }
                     $content .= '<td align="center"><a href="' . $delete . '"><img src="' . util_get_image_theme("ic/trash.png") . '" height="16" width="16" border="0"></a></td>';
                     $content .= '</tr>';
                 }
                 $content .= '</table>';
             } else {
                 $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_no') . '</div>';
             }
         } else {
             $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_error') . '</div>';
         }
     }
     if ($this->logger) {
         $content .= $this->logger->fetchLogsForItem($this->item->getId(), $this->display_access_logs);
     }
     return $content;
 }
开发者ID:nterray,项目名称:tuleap,代码行数:54,代码来源:Docman_View_ItemDetailsSectionHistory.class.php

示例14: getNick

 private function getNick()
 {
     $pUin = Utils::GetCookie('p_uin');
     $pUin = intval($pUin);
     $ret = UserHelper::getUserInfo($pUin);
     if (!empty($ret)) {
         return $ret[$pUin]["nick_name"];
     } else {
         return "腾讯网友";
     }
 }
开发者ID:Resolut1on,项目名称:My-Project,代码行数:11,代码来源:mt-action.php

示例15: getCryptedPassword

 /**
  * Formats a password using the current encryption.
  *
  * @param   string   $plaintext     The plaintext password to encrypt.
  * @param   string   $salt          The salt to use to encrypt the password. []
  *                                  If not present, a new salt will be
  *                                  generated.
  * @param   string   $encryption    The kind of password encryption to use.
  *                                  Defaults to md5-hex.
  * @param   boolean  $show_encrypt  Some password systems prepend the kind of
  *                                  encryption to the crypted password ({SHA},
  *                                  etc). Defaults to false.
  *
  * @return  string  The encrypted password.
  *
  * @since   11.1
  */
 public static function getCryptedPassword($plaintext, $salt = '', $encryption = 'md5-hex', $show_encrypt = false)
 {
     // Get the salt to use.
     $salt = UserHelper::getSalt($encryption, $salt, $plaintext);
     // Encrypt the password.
     switch ($encryption) {
         case 'md5-hex':
         default:
             $encrypted = $salt ? md5($plaintext . $salt) : md5($plaintext);
             return $show_encrypt ? '{MD5}' . $encrypted : $encrypted;
     }
 }
开发者ID:ErickLopez76,项目名称:offiria,代码行数:29,代码来源:user.php


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