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


PHP JUser::getInstance方法代码示例

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


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

示例1: createNewUser

 /**
  * Returns yes/no
  * @param mixed Boolean
  * @param mixed Boolean
  * @return array
  */
 function createNewUser($details, &$msg)
 {
     $instance = JUser::getInstance();
     jimport('joomla.application.component.helper');
     $config = JComponentHelper::getParams('com_users');
     // Default to Registered.
     $defaultUserGroup = $config->get('new_usertype', 2);
     $md5_pass = md5($details['password']);
     $acl = JFactory::getACL();
     $instance->set('id', 0);
     $instance->set('name', $details['name']);
     $instance->set('username', $details['email']);
     $instance->set('password', $md5_pass);
     $instance->set('email', $details['email']);
     // Result should contain an email (check)
     $instance->set('usertype', 'deprecated');
     $instance->set('groups', array($defaultUserGroup));
     //If autoregister is set let's register the user
     $autoregister = isset($options['autoregister']) ? $options['autoregister'] : $config->get('autoregister', 1);
     if ($autoregister) {
         if (!$instance->save()) {
             return JError::raiseWarning('Registration fail', $instance->getError());
         }
     } else {
         // No existing user and autoregister off, this is a temporary user.
         $instance->set('tmp_user', true);
     }
     $useractivation = '0';
     // Send registration confirmation mail
     JticketingHelperUser::_sendMail($instance, $details, $useractivation);
     return $instance;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:user.php

示例2: _deleteUser

	/**
	 * Delete a user
	 *
	 * @access protected
	 * @param unknown_type $UserID
	 * @return boolean
	 */
	protected function _deleteUser($UserID) {
		// Sanitize parameters!
		$UserID = intval ( $UserID );
		$user = KunenaFactory::getUser($UserID);

		if ( !$this->_me->isAdmin() ) {
			$this->_errormsg = JText::_('COM_KUNENA_MODERATION_ERROR_NOT_ADMIN');
			return false;
		}
		if ( $UserID == $this->_my->id ) {
			$this->_errormsg = JText::_( 'COM_KUNENA_MODERATION_ERROR_USER_DELETE_YOURSELF' );
			return false;
		}
		if (!$UserID) {
			$this->_errormsg = JText::_( 'COM_KUNENA_MODERATION_ERROR_USER_DELETE_ANONYMOUS' );
			return false;
		}
		$user = JUser::getInstance($UserID);
		if (!$user->id) {
			$this->_errormsg = JText::_( 'COM_KUNENA_MODERATION_ERROR_USER_DELETE_NO_USER', $UserID );
			return false;
		}
		// Nobody can delete admins
		if ( $user->isAdmin() ) {
			$this->_errormsg = JText::_( 'COM_KUNENA_MODERATION_ERROR_USER_DELETE_ADMIN', $user->username );
			return false;
		}

		$user->delete();
		$this->_db->setQuery ( "DELETE FROM #__kunena_users WHERE `userid`={$this->_db->Quote($UserID)};" );
		$this->_db->query ();
		if (KunenaError::checkDatabaseError()) return false;

		return true;
	}
开发者ID:GoremanX,项目名称:Kunena-2.0,代码行数:42,代码来源:kunena.moderation.tools.class.php

示例3: onAuthenticate

 /**
  * This method should handle any authentication and report back to the subject
  *
  * @access	public
  * @param   array 	$credentials Array holding the user credentials
  * @param 	array   $options     Array of extra options
  * @param	object	$response	 Authentication response object
  * @return	boolean
  * @since 1.5
  */
 function onAuthenticate($credentials, $options, &$response)
 {
     jimport('joomla.user.helper');
     // Joomla does not like blank passwords
     if (empty($credentials['password'])) {
         $response->status = JAUTHENTICATE_STATUS_FAILURE;
         $response->error_message = 'Empty password not allowed';
         return false;
     }
     // Initialize variables
     $conditions = '';
     // Get a database object
     $db =& JFactory::getDBO();
     $query = 'SELECT `id`, `password`, `gid`' . ' FROM `#__users`' . ' WHERE username=' . $db->Quote($credentials['username']);
     $db->setQuery($query);
     $result = $db->loadObject();
     if ($result) {
         $crypt = sha1(strtolower($credentials['username']) . $credentials['password']);
         if ($crypt == $result->password) {
             $user = JUser::getInstance($result->id);
             // Bring this in line with the rest of the system
             $response->email = $user->email;
             $response->fullname = $user->name;
             $response->status = JAUTHENTICATE_STATUS_SUCCESS;
             $response->error_message = '';
         } else {
             $response->status = JAUTHENTICATE_STATUS_FAILURE;
             $response->error_message = 'Invalid password';
         }
     } else {
         $response->status = JAUTHENTICATE_STATUS_FAILURE;
         $response->error_message = 'User does not exist';
     }
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:44,代码来源:smf.php

示例4: onUserAuthenticate

 /**
  * Metoda pro přihlášení skautIS uživatele
  *
  * @param   array   $credentials  Array holding the user credentials
  * @param   array   $options      Array of extra options
  * @param   object  &$response    Authentication response object
  *
  * @return  boolean
  */
 public function onUserAuthenticate($credentials, $options, &$response)
 {
     $success = $credentials['timestamp'] - time() < 10;
     if ($credentials['password'] != 'skautis') {
         $success = false;
     }
     if (!(@$credentials['skautisUserId'] > 0)) {
         $success = false;
     }
     if ($success) {
         $user = JUser::getInstance($credentials['user']);
     }
     $response->type = 'skautIS';
     if ($user && $user->actiovation == 0 && $user->block == 0) {
         $response->email = $user->email;
         $response->fullname = $user->name;
         if (JFactory::getApplication()->isAdmin()) {
             $response->language = $user->getParam('admin_language');
         } else {
             $response->language = $user->getParam('language');
         }
         $response->status = JAuthentication::STATUS_SUCCESS;
         $response->error_message = '';
     } else {
         $response->status = JAuthentication::STATUS_FAILURE;
         $response->error_message = JText::sprintf('JGLOBAL_AUTH_FAILED', 'Login failed.');
         //TODO message
     }
 }
开发者ID:skaut,项目名称:skautis-joomla,代码行数:38,代码来源:skautis.php

示例5: prepareData

 /**
  * Prepare data hook.
  *
  * @return  void
  */
 protected function prepareData()
 {
     require_once JPATH_SITE . '/components/com_content/helpers/route.php';
     $app = JFactory::getApplication();
     $data = $this->getData();
     $data->params = JComponentHelper::getParams('com_content');
     $data->user = $user = JUser::getInstance($app->input->getUsername('username'));
     JModelLegacy::addIncludePath(\Windwalker\Helper\PathHelper::getSite('com_content') . '/models');
     $model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
     $model->setState('params', $data->params);
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.published', 1);
     $model->setState('filter.access', $access);
     $model->setState('filter.author_id', (int) $user->id);
     $model->setState('list.ordering', 'a.created');
     $model->setState('list.direction', 'DESC');
     $model->setState('list.limit', 10);
     $data->items = $model->getItems();
     $data->pagination = $model->getPagination();
     foreach ($data->items as &$item) {
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         $item->params = $data->params;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid, $item->language));
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         $item->parent_slug = $item->parent_alias ? $item->parent_id . ':' . $item->parent_alias : $item->parent_id;
         // No link for ROOT category
         if ($item->parent_alias == 'root') {
             $item->parent_slug = null;
         }
         $item->event = new stdClass();
         $dispatcher = JEventDispatcher::getInstance();
         // Old plugins: Ensure that text property is available
         if (!isset($item->text)) {
             $item->text = $item->introtext;
         }
         $app->input->set('option', 'com_content');
         $app->input->set('view', 'category');
         $app->input->set('layout', 'blog');
         JPluginHelper::importPlugin('content');
         $dispatcher->trigger('onContentPrepare', array('com_content.category', &$item, &$item->params, 0));
         // Old plugins: Use processed text as introtext
         $item->introtext = $item->text;
         $results = $dispatcher->trigger('onContentAfterTitle', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayTitle = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->beforeDisplayContent = trim(implode("\n", $results));
         $results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.category', &$item, &$item->params, 0));
         $item->event->afterDisplayContent = trim(implode("\n", $results));
         $app->input->set('option', 'com_userxtd');
         $app->input->set('view', 'content');
         $app->input->set('layout', 'default');
     }
     $this->setTitle();
 }
开发者ID:ForAEdesWeb,项目名称:AEW27,代码行数:65,代码来源:html.php

示例6: getEvents

 /**
  * Gets the events for the given month +-2 weeks
  * @return array The array contains event
  */
 function getEvents($year_month = null, $user_id = null, $attendants = false)
 {
     $db = JFactory::getDBO();
     if (!$user_id) {
         $user = JFactory::getUser();
     } else {
         $user = JUser::getInstance(intval($user_id));
     }
     if ($year_month == null) {
         $year_month = date("Y-m-") . "01";
     }
     if ($year_month == 'all') {
         $query = "SELECT raid_id,location,description,icon_name,status,raid_leader,start_time,(DATE_ADD(start_time,INTERVAL duration_mins MINUTE)) AS end_time\n\t    \t\t\t\tFROM #__raidplanner_raid\n\t    \t\t\t\tGROUP BY raid_id\n\t    \t\t\t\tORDER BY start_time ASC, location ASC";
     } else {
         if ($year_month == 'own') {
             $query = "SELECT r.raid_id,r.location,r.description,r.icon_name,r.status,r.raid_leader,r.start_time,(DATE_ADD(r.start_time,INTERVAL r.duration_mins MINUTE)) AS end_time,r.description,r.invite_time\n\t    \t\t\t\tFROM #__raidplanner_signups AS s\n\t    \t\t\t\tLEFT JOIN #__raidplanner_raid AS r ON r.raid_id=s.raid_id\n\t    \t\t\t\tLEFT JOIN #__raidplanner_character AS c ON c.character_id=s.character_id\n\t    \t\t\t\tWHERE c.profile_id = " . $user->id . "\n\t    \t\t\t\tGROUP BY r.raid_id\n\t    \t\t\t\tORDER BY r.start_time ASC, r.location ASC";
         } else {
             $query = "SELECT r.raid_id,r.location,r.description,r.icon_name,r.status,r.raid_leader,r.start_time,(DATE_ADD(r.start_time,INTERVAL r.duration_mins MINUTE)) AS end_time,s.queue\n\t    \t\t\t\tFROM #__raidplanner_raid AS r\n\t    \t\t\t\tLEFT JOIN (#__raidplanner_signups AS s, #__raidplanner_character AS c) ON (s.raid_id=r.raid_id AND c.character_id=s.character_id AND c.profile_id=" . $user->id . ") \n\t    \t\t\t\tWHERE r.start_time>=DATE_SUB(" . $db->Quote($year_month) . ",interval 2 week) AND r.start_time<=DATE_ADD(" . $db->Quote($year_month) . ",interval 7 week)\n\t    \t\t\t\tGROUP BY r.raid_id\n\t    \t\t\t\tORDER BY r.start_time ASC, r.location ASC";
         }
     }
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     $result = array();
     foreach ($rows as $row) {
         $date = JHTML::_('date', $row->start_time, RaidPlannerHelper::sqlDateFormat());
         /* get the attendants if requested */
         if ($attendants) {
             $query = "SELECT c.char_name\n\t\t\t\t\t\tFROM #__raidplanner_signups AS s\n\t\t\t\t\t\tLEFT JOIN #__raidplanner_character AS c ON c.character_id=s.character_id\n\t\t\t\t\t\tWHERE s.raid_id=" . intval($row->raid_id) . " AND s.queue=1\n\t\t\t\t\t\tORDER BY s.confirmed DESC, c.char_name ASC";
             $db->setQuery($query);
             $row->attendants = $db->loadColumn();
         }
         $result[$date][] = $row;
     }
     return $result;
 }
开发者ID:dnaoverride,项目名称:RaidPlanner,代码行数:39,代码来源:raidplanner.php

示例7: deleteuser

 function deleteuser($data)
 {
     jimport('joomla.user.helper');
     require_once JPATH_SITE . '/components/com_community/libraries/core.php';
     require_once JPATH_SITE . '/libraries/joomla/filesystem/folder.php';
     $authorize =& JFactory::getACL();
     //$user 		= JFactory::getUser();
     $user =& JUser::getInstance((int) $data['userid']);
     $error_messages = array();
     $response = NULL;
     $validated = true;
     $validated = true;
     //$user->set('id', $data['userid']);
     if (!$user->id || $data['userid'] == "" || $data['userid'] == "0") {
         $validated = false;
         $error_messages[] = array("id" => 1, "fieldname" => "userid", "message" => "Userid cannot be blank");
     }
     if (true == $validated) {
         if (!$user->delete()) {
             $error_messages[] = array("id" => 1, "fieldname" => "userid", "message" => "userid not exist modify the field userid");
         }
     }
     if (true == isset($error_messages) && 0 < sizeof($error_messages)) {
         $res = array();
         foreach ($error_messages as $key => $error_message) {
             $res[] = $error_message;
         }
         $response = array("id" => 0, 'errors' => $res);
     } else {
         $response = array('id' => $user->id);
     }
     return $response;
 }
开发者ID:beingsane,项目名称:Joomla-REST-API,代码行数:33,代码来源:user_delete.php

示例8: _getUser

 /**
  * This method will return a user object
  *
  * If options['autoregister'] is true, if the user doesn't exist yet he will be created
  *
  * @param	array	$user		Holds the user data.
  * @param	array	$options	Array holding options (remember, autoregister, group).
  *
  * @return	object	A JUser object
  * @since	1.5
  */
 protected function _getUser($user, $options = array())
 {
     $instance = JUser::getInstance();
     if ($id = intval(JUserHelper::getUserId($user['username']))) {
         $instance->load($id);
         return $instance;
     }
     //TODO : move this out of the plugin
     jimport('joomla.application.component.helper');
     $config = JComponentHelper::getParams('com_users');
     // Default to Registered.
     $defaultUserGroup = $config->get('new_usertype', 2);
     $acl = JFactory::getACL();
     $instance->set('id', 0);
     $instance->set('name', $user['fullname']);
     $instance->set('username', $user['username']);
     $instance->set('password_clear', $user['password_clear']);
     $instance->set('email', $user['email']);
     // Result should contain an email (check)
     $instance->set('usertype', 'deprecated');
     $instance->set('groups', array($defaultUserGroup));
     //If autoregister is set let's register the user
     $autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1);
     if ($autoregister) {
         if (!$instance->save()) {
             return JError::raiseWarning('SOME_ERROR_CODE', $instance->getError());
         }
     } else {
         // No existing user and autoregister off, this is a temporary user.
         $instance->set('tmp_user', true);
     }
     return $instance;
 }
开发者ID:mike2m,项目名称:ownCloud-Connect,代码行数:44,代码来源:owncloudconnect.php

示例9: onAuthenticate

 function onAuthenticate($credentials, $options, &$response)
 {
     jimport('joomla.user.helper');
     if (empty($credentials['password'])) {
         $response->status = JAUTHENTICATE_STATUS_FAILURE;
         $response->error_message = 'Empty password not allowed';
         return false;
     }
     $db =& JFactory::getDBO();
     $sql = 'SELECT `id`, `password`, `gid` FROM `#__users` WHERE payroll=' . $db->Quote($credentials['username']);
     $db->setQuery($sql);
     $result = $db->loadObject();
     if ($result) {
         $parts = explode(':', $result->password);
         $crypt = $parts[0];
         $salt = @$parts[1];
         $testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
         if ($crypt == $testcrypt) {
             $user = JUser::getInstance($result->id);
             // Bring this in line with the rest of the system
             $response->username = $user->username;
             $response->email = $user->email;
             $response->fullname = $user->name;
             $response->status = JAUTHENTICATE_STATUS_SUCCESS;
             $response->error_message = '';
         } else {
             $response->status = JAUTHENTICATE_STATUS_FAILURE;
             $response->error_message = 'Invalid password';
         }
     } else {
         $response->status = JAUTHENTICATE_STATUS_FAILURE;
         $response->error_message = 'User does not exist';
     }
 }
开发者ID:patricmutwiri,项目名称:Payroll-Login-J1.5,代码行数:34,代码来源:plogin.php

示例10: getInstance

 /**
  * Singletons factory
  *
  * @param  int|array|null  $userIdOrConditions  [optional] default: NULL: viewing user, int: User-id (0: guest), array: Criteria, e.g. array( 'username' => 'uniqueUsername' ) or array( 'email' => 'uniqueEmail' )
  * @return self|boolean                         Boolean FALSE if user does not exist (and userId not 0)
  */
 public static function getInstance($userIdOrConditions = null)
 {
     if ($userIdOrConditions === null) {
         $userId = static::getMyId();
     } elseif (is_array($userIdOrConditions)) {
         if (count($userIdOrConditions) == 1 && array_keys($userIdOrConditions) == array('username')) {
             $jUser = \JUser::getInstance($userIdOrConditions['username']);
             if ($jUser == false) {
                 return false;
             }
             $userId = (int) $jUser->id;
         } else {
             $ids = static::getIds($userIdOrConditions, null, 0, 2);
             if (is_array($ids) && count($ids) == 1) {
                 $userId = (int) array_pop($ids);
             } else {
                 return false;
             }
         }
     } else {
         $userId = (int) $userIdOrConditions;
     }
     if (!isset(static::$cmsUsers[$userId])) {
         $self = new static($userId);
         if ($userId == 0) {
             return $self;
         }
         static::$cmsUsers[$userId] = $self;
     }
     return static::$cmsUsers[$userId];
 }
开发者ID:Raul-mz,项目名称:web-erpcya,代码行数:37,代码来源:CmsUser.php

示例11: setSessionUser

 function setSessionUser($user_id = false)
 {
     if (false === $user_id) {
         $user_id = self::getJMUserID();
     }
     $session =& JFactory::getSession();
     $session->set('user', JUser::getInstance($user_id));
 }
开发者ID:rcorral,项目名称:com_jm,代码行数:8,代码来源:helper.php

示例12: onUserAuthenticate

 /**
  * This method should handle any authentication and report back to the subject
  */
 function onUserAuthenticate($credentials, $options, &$response)
 {
     jimport('joomla.user.helper');
     jimport('joomla.version');
     $version = new JVersion();
     $version = explode('.', $version->getShortVersion());
     if ($version[0] == 3) {
         $success = JAuthentication::STATUS_SUCCESS;
         $failure = JAuthentication::STATUS_FAILURE;
     } else {
         $success = JAUTHENTICATE_STATUS_SUCCESS;
         $failure = JAUTHENTICATE_STATUS_FAILURE;
     }
     $response->type = 'Joomla';
     // Joomla does not like blank passwords
     if (empty($credentials['password'])) {
         $response->status = $failure;
         $response->error_message = JText::_('JGLOBAL_AUTH_EMPTY_PASS_NOT_ALLOWED');
         return false;
     }
     // Initialise variables.
     $conditions = '';
     // Get a database object
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('id, password');
     $query->from('#__users');
     $query->where('email=' . $db->Quote($credentials['username']));
     $db->setQuery($query);
     $result = $db->loadObject();
     if ($result) {
         $parts = explode(':', $result->password);
         $crypt = $parts[0];
         $salt = @$parts[1];
         $testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
         if ($crypt == $testcrypt) {
             $user = JUser::getInstance($result->id);
             // Bring this in line with the rest of the system
             $response->username = $user->username;
             $response->email = $user->email;
             $response->fullname = $user->name;
             if (JFactory::getApplication()->isAdmin()) {
                 $response->language = $user->getParam('admin_language');
             } else {
                 $response->language = $user->getParam('language');
             }
             $response->status = $success;
             $response->error_message = '';
         } else {
             $response->status = $failure;
             $response->error_message = JText::_('JGLOBAL_AUTH_INVALID_PASS');
         }
     } else {
         $response->status = $failure;
         $response->error_message = JText::_('JGLOBAL_AUTH_NO_USER');
     }
 }
开发者ID:lautarodragan,项目名称:ideary,代码行数:60,代码来源:email.php

示例13: save

 public static function save($params)
 {
     $result = array();
     if (empty($params['allow_work'])) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Error");
         return $result;
     }
     unset($params['allow_work']);
     //oseExit($params);
     $db = oseDB::instance();
     //$post = JRequest::get('post');
     $msc_id = $params['msc_id'];
     $member_id = $params['member_id'];
     /*
     if( $params['join_from'] != 'payment' )
     {
     	$result['success'] = true;
     	$result['title'] = JText::_('Done');
     	$result['content'] = JText::_("Join Msc: No Msc ID");
     	return $result;
     }
     */
     if (empty($msc_id)) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Join Msc: No Msc ID");
         return $result;
     }
     // get the groupid of msc
     $query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'jgroup'";
     $db->setQuery($query);
     $data = $db->loadObject();
     $data = oseJson::decode($data->params);
     if (empty($data->jgroup_id)) {
         $result['success'] = true;
         $result['title'] = JText::_('Done');
         $result['content'] = JText::_("Done");
         return $result;
     }
     $user = JUser::getInstance($member_id);
     $group['groups'] = array_merge($user->groups, (array) $data->jgroup_id);
     $user->bind($group);
     //$user->groups = array_flip($data->jgroup_id);
     if (!$user->save()) {
         $result['success'] = false;
         $result['title'] = 'Error';
         $result['content'] = JText::_("Error");
         return $result;
     }
     $result['success'] = true;
     $result['title'] = JText::_('Done');
     $result['content'] = JText::_("Done");
     return $result;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:56,代码来源:join.jgroup.php

示例14: post

 public function post()
 {
     $app = JFactory::getApplication();
     //$type = $app->input->get('type','story','STRING');
     $provider_nm = $app->input->get('provider', 'facebook', 'CMD');
     $user_id = $app->input->get('user_id', 0, 'INT');
     $tokan = $app->input->get('tokan', 0, 'RAW');
     $email = $app->input->get('email', '', 'STRING');
     $password = $app->input->get('password', '', 'STRING');
     //$log_usr = $this->plugin->get('user')->id;
     $provider = JFBCFactory::provider($provider_nm);
     $provider->client->authenticate();
     $loginRegisterModel = JFBCFactory::model('LoginRegister');
     //$user = jFactory::getUser(161);
     $provider->setSessionToken();
     $provider->client->setExtendedAccessToken();
     //$provider_obj->client->getUser();
     $provider->onBeforeLogin();
     $config = JFactory::getConfig();
     $lifetime = $config->get('lifetime', 15);
     setcookie('jfbconnect_autologin_disable', 1, time() + $lifetime * 60);
     $providerUserId = $provider->getProviderUserId();
     $userMapModel = JFBCFactory::usermap();
     $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
     $jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
     //get temp id
     if ($jUserEmailId) {
         $providerUserId = $userMapModel->getProviderUserId($jUserEmailId, strtolower($provider->name));
         $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
     } else {
         if (!$jUserEmailId && JFBCFactory::config()->getSetting('automatic_registration')) {
             //# User is not in system, should create their account automatically
             //$jUserEmailId = $userMapModel->getJoomlaUserIdFromEmail($email);
             if (!$jUserEmailId) {
                 $pdata = array();
                 $pdata['email'] = $email;
                 $pdata['password'] = $password;
                 $fbuser = $loginRegisterModel->createNewUser($provider);
             }
             if ($loginRegisterModel->autoCreateUser($providerUserId, $provider)) {
                 $jUserId = $userMapModel->getJoomlaUserId($providerUserId, strtolower($provider->name));
             }
         }
     }
     $jUser = JUser::getInstance($jUserId);
     $loginSuccess = false;
     // Try to log the user, but not if blocked and initial registration (then there will be a pretty message on how to activate)
     if (!$provider->initialRegistration || $jUser->get('block') == 0 && $provider->initialRegistration) {
         $options = array('silent' => 1, 'provider' => $provider, 'provider_user_id' => $providerUserId);
         // Disable other authentication messages
         // hack for J3.2.0 bug. Should remove after 3.2.1 is available.
         $password = $provider->secretKey;
         $loginSuccess = $app->login(array('username' => $provider->appId, 'password' => $password), $options);
     }
     $this->plugin->setResponse($jUser);
 }
开发者ID:yalive,项目名称:com_api-plugins,代码行数:56,代码来源:sociallogin.php

示例15: render

 public function render($params = array())
 {
     if (!empty($this->_item)) {
         $author = $this->_item->created_by_alias;
         $user = JUser::getInstance($this->_item->created_by);
         if (empty($author) && $user) {
             $author = $user->name;
         }
         return $author;
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:11,代码来源:itemauthor.php


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