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


PHP JUser::load方法代码示例

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


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

示例1: load

	public function load($id = null)
	{
		JTable::addIncludePath( JPATH_ROOT . '/libraries/joomla/database/table' );

		$result = parent::load($id);
		return $result;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:profile.php

示例2: array

 function &getUserObject($user, $options = array())
 {
     JLoader::import('joomla.user.helper');
     $instance = new JUser();
     if ($id = intval(JUserHelper::getUserId($user['username']))) {
         $instance->load($id);
         return $instance;
     }
     JLoader::import('joomla.application.component.helper');
     $config = JComponentHelper::getParams('com_users');
     $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));
     return $instance;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:22,代码来源:nofesalogin.php

示例3: activateUser

 function activateUser($user_id)
 {
     /*		global $mainframe;
     		$mainframe->logout();*/
     $new_user = new JUser();
     $new_user->load($user_id);
     $acl =& JFactory::getACL();
     $grp = $acl->getAroGroup($user_id);
     $new_user->set('guest', 0);
     $new_user->set('aid', 1);
     if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
         $new_user->set('aid', 2);
     }
     $new_user->set('usertype', $grp->name);
     $session =& JFactory::getSession();
     $session->set('user', $new_user);
     $table =& JTable::getInstance('session');
     $table->load($session->getId());
     $table->guest = $new_user->get('guest');
     $table->username = $new_user->get('username');
     $table->userid = intval($new_user->get('id'));
     $table->usertype = $new_user->get('usertype');
     $table->gid = intval($new_user->get('gid'));
     $table->update();
     $new_user->setLastVisit();
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:26,代码来源:noah.php

示例4: onUserAfterSave

 /**
  * Event onUserAfterSave
  * 
  * @access public
  * @param array $user
  * @param bool $isnew
  * @param bool $success
  * @param string $msg
  * @return bool
  */
 public function onUserAfterSave($user, $isnew, $success, $msg)
 {
     // Check if we can run this event or not
     if (MageBridgePluginHelper::allowEvent('onUserAfterSave') == false) {
         return;
     }
     // Get system variables
     $application = JFactory::getApplication();
     // Copy the username to the email address (if this is configured)
     if ($application->isSite() == true && $this->getParam('username_from_email') == 1 && $user['username'] != $user['email']) {
         MageBridgeModelDebug::getInstance()->notice("onUserAfterSave::bind on user " . $user['username']);
         // Load the right JUser object
         $data = array('username' => $user['email']);
         $object = new JUser();
         $object->load($user['id']);
         // Check whether user-syncing is allowed for this user
         if ($this->getUser()->allowSynchronization($object, 'save') == true) {
             // Change the record in the database
             $object->bind($data);
             $object->save();
             // Bind this new user-object into the session
             $session = JFactory::getSession();
             $session_user = $session->get('user');
             if ($session_user->id == $user['id']) {
                 $session_user->username = $user['email'];
             }
         }
     }
     // Synchronize this user-record with Magento
     if ($this->getParam('enable_usersync') == 1) {
         MageBridgeModelDebug::getInstance()->notice("onUserAfterSave::usersync on user " . $user['username']);
         // Sync this user-record with the bridge
         $this->getUser()->synchronize($user);
     }
     return true;
 }
开发者ID:traveladviser,项目名称:magebridge-mirror,代码行数:46,代码来源:magebridge.php

示例5: onLoginUser

 function onLoginUser($user, $options)
 {
     $app = JFactory::getApplication();
     if ($app->isAdmin()) {
         return true;
     }
     $user_id = 0;
     if (empty($user['id'])) {
         if (!empty($user['username'])) {
             jimport('joomla.user.helper');
             $instance = new JUser();
             if ($id = intval(JUserHelper::getUserId($user['username']))) {
                 $instance->load($id);
             }
             if ($instance->get('block') == 0) {
                 $user_id = $instance->id;
             }
         }
     } else {
         $user_id = $user['id'];
     }
     $this->restoreSession($user_id);
     if (empty($user_id)) {
         return true;
     }
     if (!defined('DS')) {
         define('DS', DIRECTORY_SEPARATOR);
     }
     if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) {
         return true;
     }
     $userClass = hikashop_get('class.user');
     $hika_user_id = $userClass->getID($user_id, 'cms');
     if (empty($hika_user_id)) {
         return true;
     }
     $addressClass = hikashop_get('class.address');
     $addresses = $addressClass->getByUser($hika_user_id);
     if (empty($addresses) || !count($addresses)) {
         return true;
     }
     $address = reset($addresses);
     $field = 'address_country';
     if (!empty($address->address_state)) {
         $field = 'address_state';
     }
     $app->setUserState(HIKASHOP_COMPONENT . '.shipping_address', $address->address_id);
     $app->setUserState(HIKASHOP_COMPONENT . '.billing_address', $address->address_id);
     $zoneClass = hikashop_get('class.zone');
     $zone = $zoneClass->get($address->{$field});
     if (!empty($zone)) {
         $zone_id = $zone->zone_id;
         $app->setUserState(HIKASHOP_COMPONENT . '.zone_id', $zone->zone_id);
     }
 }
开发者ID:rodhoff,项目名称:MNW,代码行数:55,代码来源:hikashopuser.php

示例6: save

 /**
  * Method to save the form data.
  *
  * @param   array  The form data.
  * @return  mixed  	The user id on success, false on failure.
  * @since   1.6
  */
 public function save($data)
 {
     $userId = !empty($data['id']) ? $data['id'] : (int) $this->getState('user.id');
     $user = new JUser($userId);
     // Prepare the data for the user object.
     $data['email'] = JStringPunycode::emailToPunycode($data['email1']);
     $data['password'] = $data['password1'];
     // Unset the username if it should not be overwritten
     $username = $data['username'];
     $isUsernameCompliant = $this->getState('user.username.compliant');
     if (!JComponentHelper::getParams('com_users')->get('change_login_name') && $isUsernameCompliant) {
         unset($data['username']);
     }
     // Unset the block so it does not get overwritten
     unset($data['block']);
     // Unset the sendEmail so it does not get overwritten
     unset($data['sendEmail']);
     // handle the two factor authentication setup
     if (array_key_exists('twofactor', $data)) {
         $model = new UsersModelUser();
         $twoFactorMethod = $data['twofactor']['method'];
         // Get the current One Time Password (two factor auth) configuration
         $otpConfig = $model->getOtpConfig($userId);
         if ($twoFactorMethod != 'none') {
             // Run the plugins
             FOFPlatform::getInstance()->importPlugin('twofactorauth');
             $otpConfigReplies = FOFPlatform::getInstance()->runPlugins('onUserTwofactorApplyConfiguration', array($twoFactorMethod));
             // Look for a valid reply
             foreach ($otpConfigReplies as $reply) {
                 if (!is_object($reply) || empty($reply->method) || $reply->method != $twoFactorMethod) {
                     continue;
                 }
                 $otpConfig->method = $reply->method;
                 $otpConfig->config = $reply->config;
                 break;
             }
             // Save OTP configuration.
             $model->setOtpConfig($userId, $otpConfig);
             // Generate one time emergency passwords if required (depleted or not set)
             if (empty($otpConfig->otep)) {
                 $oteps = $model->generateOteps($userId);
             }
         } else {
             $otpConfig->method = 'none';
             $otpConfig->config = array();
             $model->setOtpConfig($userId, $otpConfig);
         }
         // Unset the raw data
         unset($data['twofactor']);
         // Reload the user record with the updated OTP configuration
         $user->load($userId);
     }
     // Bind the data.
     if (!$user->bind($data)) {
         $this->setError(JText::sprintf('COM_USERS_PROFILE_BIND_FAILED', $user->getError()));
         return false;
     }
     // Load the users plugin group.
     JPluginHelper::importPlugin('user');
     // Null the user groups so they don't get overwritten
     $user->groups = null;
     // Store the data.
     if (!$user->save()) {
         $this->setError($user->getError());
         return false;
     }
     $user->tags = new JHelperTags();
     $user->tags->getTagIds($user->id, 'com_users.user');
     return $user->id;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:77,代码来源:profile.php

示例7: intval

<?php

/*
 * Copyright (c) 2006/2007 Flipperwing Ltd. (http://www.flipperwing.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
/**
 * @author andy.scholz@gmail.com
 * @copyright (c)2006-2007 Flipperwing Ltd.
 */
// Set flag that this is a parent file
define('_VALID_MOS', 1);
require_once "../../init.php";
require_once $csModelsDir . "/JUser.php";
$id = intval($_REQUEST['id']);
$obj = new JUser(&$database);
if (!$obj->load($id)) {
    returnError("Could not find user with id#{$id}");
}
returnData($obj);
开发者ID:bthamrin,项目名称:gwtwindowmanager,代码行数:31,代码来源:get.php

示例8: onAuthenticate

 function onAuthenticate($credentials, $options, &$response)
 {
     if (!$this->_init_ok) {
         return;
     }
     $login = $credentials['username'];
     $pass = $credentials['password'];
     $this->db->setQuery("SELECT id FROM #__user WHERE name = " . $this->db->Quote($login) . " AND password = " . $this->db->Quote($this->getPassword($pass)));
     $id = $this->db->loadResult();
     if (!$id) {
         $response->status = JAUTHENTICATE_STATUS_FAILURE;
         $response->error_message = 'Could not authenticate';
         return;
     }
     $response->status = JAUTHENTICATE_STATUS_SUCCESS;
     jimport('joomla.user.helper');
     $j_id = JUserHelper::getUserId($login);
     if (!$j_id) {
         $j_id = $this->createUser($login);
     }
     $j_user = new JUser();
     $j_user->load($j_id);
     $j_user->set('password_clear', $pass);
     $j_user->save();
     return true;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:26,代码来源:noah.php

示例9: load

 /**
  * Method to load a ResUser object by user id number
  *
  * @access 	public
  * @param 	mixed 	$identifier The user id of the user to load
  * @param 	string 	$path 		Path to a parameters xml file
  * @return 	boolean 			True on success
  * @since 1.5
  */
 function load($id)
 {
     if (!parent::load($id)) {
         return false;
     }
     //initializing variables
     $array = array(31 => 'NonProfit', 32 => 'Verified', 33 => 'Individual Donor', 34 => 'Business Donor');
     if (!$this->usertype) {
         $this->usertype = $array[$this->gid];
     }
     return true;
 }
开发者ID:Jonathonbyrd,项目名称:Joomla-Listings,代码行数:21,代码来源:user.php

示例10: getUser

 /**
  * Gets a user object if the user filter is set.
  *
  * @return  JUser  The JUser object
  *
  * @since   2.5
  */
 public function getUser()
 {
     $user = new JUser();
     // Filter by search in title
     $search = (int) $this->getState('filter.user_id');
     if ($search != 0) {
         $user->load((int) $search);
     }
     return $user;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:17,代码来源:notes.php

示例11: UnexpectedValueException

 /**
  * Gets the CMS User object
  *
  * @param  int    $cmsUserId
  * @return JUser
  * @throws UnexpectedValueException
  */
 function &_getCmsUserObject($cmsUserId = null)
 {
     /** @var \JUser $obj */
     $obj = new \JUser();
     if ($cmsUserId) {
         if (!$obj->load((int) $cmsUserId)) {
             throw new UnexpectedValueException(CBTxt::T('UNABLE_TO_LOAD_USER_ID', 'User id failed to load: [user_id]', array('[user_id]' => (int) $cmsUserId)));
         }
     }
     return $obj;
 }
开发者ID:bobozhangshao,项目名称:HeartCare,代码行数:18,代码来源:CBframework.php

示例12: editForm

 function editForm($tpl = null)
 {
     $helper = new adagencyAdminHelper();
     $my = JFactory::getUser();
     //echo "<pre>";var_dump($my);die();
     require_once JPATH_SITE . DS . 'components' . DS . 'com_adagency' . DS . 'helpers' . DS . 'sajax.php';
     $db = JFactory::getDBO();
     $advertiser = $this->get('Advertiser');
     //echo "<pre>";var_dump($advertiser);die();
     $isNew = $advertiser->aid < 1;
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     //BUG registered users
     jimport("joomla.database.table.user");
     $user = new JUser();
     if (!$isNew) {
         $user->load($advertiser->user_id);
     }
     $itemid = $this->getModel("adagencyConfig")->getItemid('adagencyadvertisers');
     $itemid_cpn = $this->getModel("adagencyConfig")->getItemid('adagencycpanel');
     $this->assign("itemid_cpn", $itemid_cpn);
     $configs = $this->get('Conf');
     if (isset($configs->show)) {
         $show = explode(";", $configs->show);
     } else {
         $show = NULL;
     }
     if (isset($configs->mandatory)) {
         $mandatory = explode(";", $configs->mandatory);
     } else {
         $mandatory = NULL;
     }
     if (count($show) >= 2) {
         unset($show[count($show) - 1]);
     }
     if (count($mandatory) >= 2) {
         unset($mandatory[count($mandatory) - 1]);
     }
     $configs->show = $show;
     $configs->mandatory = $mandatory;
     $this->assign("conf", $configs);
     $this->assign("user", $user);
     $this->assign("advertiser", $advertiser);
     if (isset($_SESSION['ad_country'])) {
         $advertiser->country = $_SESSION['ad_country'];
     }
     $configs = $this->_models['adagencyconfig']->getConfigs();
     $country_option = $helper->get_country_options($advertiser, false, $configs);
     //echo "<pre>";var_dump($country_option);die();
     $lists['country_option'] = $country_option;
     $query = "SELECT country FROM #__ad_agency_states GROUP BY country ORDER BY country ASC";
     $db->setQuery($query);
     $countries = $db->loadObjectList();
     //echo "<pre>";var_dump($countries);die();
     $profile = new StdClass();
     $profile->country = $advertiser->country;
     $profile->state = $advertiser->state;
     if (isset($_SESSION['ad_state']) && $_SESSION['ad_state'] != '') {
         $advertiser->state = $_SESSION['ad_state'];
     }
     $shipcountry_option = $helper->get_country_options($advertiser, true, $configs);
     $lists['shipcountry_options'] = $shipcountry_option;
     $lists['customerlocation'] = $helper->get_store_province($advertiser);
     $profile = new StdClass();
     $profile->country = $advertiser->shipcountry;
     $profile->state = $advertiser->state;
     $lists['customershippinglocation'] = $helper->get_store_province($profile, true, $configs);
     $content = $this->_models['adagencyplugin']->getPluginOptions($advertiser->paywith);
     $lists['paywith'] = $content;
     $captch = $configs->captcha;
     $this->assign("is_captcha", $captch);
     $this->assign("lists", $lists);
     $this->assign("itemid", $itemid);
     parent::display($tpl);
 }
开发者ID:politik86,项目名称:test2,代码行数:74,代码来源:view.html.php

示例13: doUserLogIn

function doUserLogIn($username)
{
    $my = new JUser();
    jimport('joomla.user.helper');
    if ($id = intval(JUserHelper::getUserId($username))) {
        $my->load($id);
    } else {
        return JError::raiseWarning('SOME_ERROR_CODE', 'MigrationAssistant (doUserLogIn): Failed to load user');
    }
    // If the user is blocked, redirect with an error
    if ($my->get('block') == 1) {
        return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_NOLOGIN_BLOCKED'));
    }
    //Mark the user as logged in
    $my->set('guest', 0);
    // Discover the access group identifier
    // NOTE : this is a very basic for of permission handling, will be replaced by a full ACL in 1.6
    jimport('joomla.factory');
    $acl =& JFactory::getACL();
    $grp = $acl->getAroGroup($my->get('id'));
    $my->set('aid', 1);
    if ($acl->is_group_child_of($grp->name, 'Registered', 'ARO') || $acl->is_group_child_of($grp->name, 'Public Backend', 'ARO')) {
        // fudge Authors, Editors, Publishers and Super Administrators into the special access group
        $my->set('aid', 2);
    }
    //Set the usertype based on the ACL group name
    $my->set('usertype', $grp->name);
    // Register the needed session variables
    $session =& JFactory::getSession();
    $session->set('user', $my);
    // Get the session object
    $table =& JTable::getInstance('session');
    $table->load($session->getId());
    $table->guest = $my->get('guest');
    $table->username = $my->get('username');
    $table->userid = intval($my->get('id'));
    $table->usertype = $my->get('usertype');
    $table->gid = intval($my->get('gid'));
    $table->update();
    // Hit the user last visit field
    $my->setLastVisit();
    // Set remember me option
    $lifetime = time() + 365 * 24 * 60 * 60;
    setcookie('usercookie[username]', $my->get('username'), $lifetime, '/');
    setcookie('usercookie[password]', $my->get('password'), $lifetime, '/');
}
开发者ID:planetangel,项目名称:Planet-Angel-Website,代码行数:46,代码来源:tasks.php

示例14: getUser

 function getUser($user)
 {
     $instance = new JUser();
     if ($id = intval(JUserHelper::getUserId($user['username'])))
     {
         $instance->load($id);
         return $instance;
     }
     else
     {
     	return false;
     }
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:13,代码来源:oseuser.php

示例15: onUserLogin

 public function onUserLogin($user, $options = array())
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     jimport('joomla.user.helper');
     $instance = new JUser();
     if ($id = intval(JUserHelper::getUserId($user['username']))) {
         $instance->load($id);
     }
     if ($instance->get('block') == 0) {
         require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
         // start the user session for AlphaUserpoints
         AlphaUserPointsHelper::getReferreid(intval($instance->get('id')));
         if ($app->isSite()) {
             // load language component
             $lang = JFactory::getLanguage();
             $lang->load('com_alphauserpoints', JPATH_SITE);
             // check raffle subscription to showing a reminder message
             // check first if rule for raffle is enabled
             $result = AlphaUserPointsHelper::checkRuleEnabled('sysplgaup_raffle', 1);
             if ($result) {
                 $resultCurrentRaffle = $this->checkIfCurrentRaffleSubscription(intval($instance->get('id')));
                 if ($resultCurrentRaffle == 'stillRegistered') {
                     $messageAvailable = JText::_('AUP_YOU_ARE_STILL_NOT_REGISTERED_FOR_RAFFLE');
                     if ($messageAvailable != '') {
                         $messageRaffle = sprintf(JText::_('AUP_YOU_ARE_STILL_NOT_REGISTERED_FOR_RAFFLE'), $user['username']);
                         $app->enqueueMessage($messageRaffle);
                     }
                 }
             }
         }
         //return true;
     }
 }
开发者ID:q0821,项目名称:esportshop,代码行数:34,代码来源:sysplgaup_newregistered.php


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