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


PHP User::getData方法代码示例

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


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

示例1: create

 /**
  * Метод добавления нового пользователя в базу данных
  * @param User $user - пользователь
  * @return bool - добавлен/не добавлен
  */
 public function create($user)
 {
     $db = DataBase::getInstance();
     $connection = $db->connect();
     $data = $user->getData();
     $sql = "INSERT INTO " . self::TABLE_NAME . " (`name`, lastname, birthday, email, password, is_active, reg_date, last_update) VALUES (:name, :lastname, :birthday, :email, :password, :is_active, :reg_date, :last_update)";
     $stmt = $connection->prepare($sql);
     $status = $stmt->execute($data);
     $db->close();
     return $status;
 }
开发者ID:Antoshka007,项目名称:php_dz4,代码行数:16,代码来源:Users.php

示例2: _checkUser

 protected function _checkUser()
 {
     if (fnGet($this->input, 'access_token') == '') {
         $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '参数[access_token]不能为空'), 400);
     }
     // 设置当前用户和客户端
     $this->session->setUser($user = new User())->setClient($client = new Client());
     $passportConfig = $this->config->get("api.passport");
     // 尝试从缓存获取 userInfo
     if ($this->_userInfo = S($cacheKey = 'access_token_info.' . fnGet($this->input, 'access_token'))) {
         $user->find(fnGet($this->_userInfo, 'user_id'));
         $client->find(fnGet($this->_userInfo, 'client_id'));
         return;
     }
     // 向 passport 请求 userInfo
     $time = time();
     $url = str_replace('internal-resource/user-info?', '', $passportConfig->passportUrl) . 'internal-resource/user-info';
     $params = array('access_token' => fnGet($this->input, 'access_token'), 'app' => $passportConfig->passportApp, 'time' => $time);
     $sign = md5(implode('', $params) . $passportConfig->passportSecret);
     $params['sign'] = $sign;
     $http = new HttpClient();
     $response = $http->request($url, $params);
     $data = json_decode($response, true);
     if (fnGet($data, 'id')) {
         //检测用户是否已经保存
         $user->getByUsername($username = fnGet($data, 'username'));
         if (!($userId = $user->getId()) || !$user->getData('passport_id') || $user->getData('mobile') != fnGet($data, 'mobile')) {
             $user->addData(array('username' => $username, 'email' => fnGet($data, 'email'), 'mobile' => fnGet($data, 'mobile'), 'passport_id' => fnGet($data, 'passport_id'), 'avatar' => fnGet($data, 'avatar'), 'nickname' => fnGet($data, 'nickname')));
             $user->save();
             $userId = $user->getId();
         }
         //检测客户端是否已经保存
         $client->getByAppId($appId = fnGet($data, 'client_info/id'));
         if (!($clientId = $client->getId()) || $client->getScopes() != fnGet($data, 'client_info/scopes')) {
             $client->addData(array('client' => $appId, 'name' => fnGet($data, 'client_info/name'), 'app_secret' => fnGet($data, 'client_info/secret'), 'developerurl' => fnGet($data, 'client_info/endpoint'), 'scopes' => fnGet($data, 'client_info/scopes')));
             $client->save();
             $clientId = $client->getId();
         }
         $this->_userInfo = array('user_id' => $userId, 'client_id' => $clientId, 'username' => $username, 'session_data' => fnGet($data, 'session_data'));
         S($cacheKey, $this->_userInfo, 3600);
         return;
     }
     $this->_ajaxReturn(array('error_code' => '600020', 'error_msg' => '用户无效'), 400);
 }
开发者ID:xinson,项目名称:yafPlus,代码行数:44,代码来源:Base.php

示例3: formObject

 public function formObject()
 {
     $model = new User($this->data->id);
     $this->data->forUpdate = $this->data->id != '';
     $this->data->object = $model->getData();
     $this->data->object->userLevel = $model->getUserLevel();
     $this->data->title = $this->data->forUpdate ? $model->getDescription() : _M("New User");
     $this->data->userLevel = Base::userLevel();
     $this->data->save = "@fnbr20/auth/user/save/" . $model->getId() . '|formObject';
     $this->data->delete = "@fnbr20/auth/user/delete/" . $model->getId() . '|formObject';
     $this->render();
 }
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:12,代码来源:UserController.php

示例4: checkAuthority

function checkAuthority($level)
{
    require_once 'site.class.php';
    require_once 'user.class.php';
    $uid = Site::getSessionUid();
    if ($uid == 0) {
        return false;
    }
    $currentUser = new User();
    $currentUser->uid = $uid;
    $response = json_decode($currentUser->getData(), true);
    return $response['level'] >= $level;
}
开发者ID:CloudNumericalCalculation,项目名称:cloudcalc-web,代码行数:13,代码来源:publicFunctions.func.php

示例5: registerUser

 /**
  * Add new user and return the model
  *
  * Save new user's data to DB and load this user. If there is referral login, add loyality point to user that owns
  * this login
  *
  * @param string $email
  * @param string $login
  * @param string $name
  * @param string $userGroup
  * @param string $referralLogin
  *
  * @return User
  * @throws Exception
  */
 public static function registerUser($email, $login, $name, $userGroup = 'Default', $referralLogin = '')
 {
     if (self::userExists($email)) {
         throw new Exception('User with this email already exists');
     }
     self::saveUser(array('user_email' => $email, 'user_name' => $name, 'login' => $login, 'user_group_id' => self::getUserGroupIdFromName($userGroup), 'referral_login' => $referralLogin));
     if ($referralLogin) {
         try {
             $user = new User($referralLogin, 'login');
             $user->increaseLoyalityPoints();
             self::saveUser($user->getData());
         } catch (Exception $e) {
             // Process the error
         }
     }
     return new User('$email');
 }
开发者ID:vasylmalanka,项目名称:Recruitment-task,代码行数:32,代码来源:UserFactory.php

示例6: buy

 /**
  * Pay for subscription and save it to DB
  *
  * @param User      $user
  * @param int       $units
  * @param IPayment  $paymentService
  * @param array     $paymentDetails
  *
  * @return bool
  * @throws Exception
  */
 public static function buy(User $user, $units, IPayment $paymentService, $paymentDetails)
 {
     $userData = $user->getData();
     if ($user->getUserGroup() == User::ADMIN_USER_GROUP) {
         throw new Exception('Administrators can\'t buy subscription');
     }
     if ($user->isSubscribed()) {
         $units += ($userData['subscribed_to'] - strtotime(date('Y-m-d', time()) . ' 00:00:00')) / 86400;
     }
     //...
     if ($paymentService->processPayment($paymentData)) {
         $userData['subscribed_to'] = strtotime(date('Y-m-d', strtotime("+{$units} days")) . ' 00:00:00');
         $paymentService->savePayment();
         return true;
     }
     throw new Exception('An error occurred while processing the payment');
     //...
 }
开发者ID:vasylmalanka,项目名称:Recruitment-task,代码行数:29,代码来源:Subscription.php

示例7: updateAccount

function updateAccount($first_name, $last_name, $birthday, $sex, $email, $password, $newsletter)
{
    global $bdd;
    global $_TABLES;
    global $config;
    if (isset($_SESSION['user_id'])) {
        // Création de l'objet User
        $objUser = new User($bdd, $_TABLES);
        // Sauvegarde temporaire des anciennes données utilisateurs
        $user = $objUser->getData($_SESSION['user_id']);
        // Mise en forme des données
        $birthday_temp = explode("/", $birthday);
        $birthday = $birthday_temp[2] . '-' . $birthday_temp[1] . '-' . $birthday_temp[0];
        // Mise à jour des données du compte
        $objUser->updateAccount($_SESSION['user_id'], $email, $password, $first_name, $last_name, $birthday, $sex);
        // Ajout ou suppression de l'email de la personne dans la liste de la newsletter
        $objUserNewsletter = new UserNewsletter($bdd, $_TABLES, $config);
        if ($newsletter) {
            $objUserNewsletter->createUserNewsletter($email);
        } else {
            $email_delete = $email;
            // Verification que l'email n'a pas été modifier avant
            if ($user && !is_null($user)) {
                if ($email != $user->email) {
                    $email_delete = $user->email;
                }
            }
            $user_newsletter = $objUserNewsletter->getExist($email_delete);
            if ($user_newsletter && !is_null($user_newsletter)) {
                $objUserNewsletter->deleteUserNewsletter($user_newsletter->id, $email_delete);
            }
        }
        // Retour 0
        return 0;
    } else {
        // Session expire
        return 1;
    }
}
开发者ID:xXNoceboXx,项目名称:WUS,代码行数:39,代码来源:controller.account.php

示例8: storeData

 public function storeData(User $user)
 {
     $this->users[$user->getUsername()] = $user->getData();
     file_put_contents($this->userFile, json_encode($this->users));
 }
开发者ID:LamaDelRay,项目名称:test_symf,代码行数:5,代码来源:Users.php

示例9: array

         $page->assign("t_Report", Reporting::success("The user \"{$username}\" was added successfully."));
     } else {
         $page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
     }
 } else {
     if ("RemoveCustomer" == $do) {
         $error = array();
         $err = @Utils::checkInput($_POST['userid'], "User ID", 0, 0, INPUT_TYPE_NUMERIC);
         if (strlen($err) != 0) {
             $error[] = $err;
         } else {
             if (!UserManager::existsById($_POST['userid'])) {
                 $error[] = "The given User ID doesn't exist.";
             } else {
                 $user = new User($_POST['userid']);
                 if ($user->getData("coins") > 0) {
                     $error[] = "The user still has coins. You cannot delete him.";
                 }
                 // TODO: Gameserver Count ask
             }
         }
         if (count($error) == 0) {
             $username = $user->getData("username");
             $name = $user->getData("prename") . " " . $user->getData("lastname");
             $page->assign("t_Report", Reporting::success("The user \"{$username}\" (\"{$name}\") has been removed successfully."));
             Database::rowDeleteByField("users", "id", $_POST['userid']);
         } else {
             $page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
         }
     }
 }
开发者ID:xerox8521,项目名称:FS-Gamepanel,代码行数:31,代码来源:customers.php

示例10: isBannedFromEvents

 public static function isBannedFromEvents(User $u)
 {
     $bannedReason = $u->getData('bannedReason');
     return !empty($bannedReason);
 }
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:5,代码来源:Events.php

示例11: escape

		            		<span class="icon-bar"></span>
		          		</button>
					</div>
					<div id="navbar" class="collapse navbar-collapse">
						<ul class="nav navbar-nav">
							<li><a href="home">Начало</a></li>
							<li class="active"><a href="teams">Отбори<span class="sr-only">(current)</span></a></li>
							<li><a href="prizes">Награди</a></li>
							<li><a href="rules">Регламент</a></li>
							<li><a href="faq">FAQ</a></li>
                            <?php 
if ($user->isLoggedIn()) {
    ?>
                                <li><a href="profile">Профил</a></li>
                                <!-- <a href="/<?php 
    echo escape($user->getData()->username);
    ?>
"> -->
                                <li><a href="logout.php">Излез</a></li>
                            <?php 
}
?>
  							
						</ul>
					</div>
				</div>
			</nav>
		</header>
		<hr />
		<div class="jumbotron">
			<table id="teams">
开发者ID:nelfurion,项目名称:HackTues-v1-web,代码行数:31,代码来源:teams.php

示例12: triggerNotificationCenter

 /**
  * Send a notification when address has been changed
  *
  * @param Address $objAddress
  * @param array   $arrOldAddress
  * @param \User   $objMember
  * @param Config  $objConfig
  */
 protected function triggerNotificationCenter(Address $objAddress, array $arrOldAddress, \User $objMember, Config $objConfig)
 {
     if (!$this->nc_notification) {
         return;
     }
     /** @type Notification $objNotification */
     $objNotification = Notification::findByPk($this->nc_notification);
     if (null === $objNotification) {
         return;
     }
     $arrTokens = array();
     $arrTokens['admin_email'] = $GLOBALS['TL_ADMIN_EMAIL'];
     $arrTokens['domain'] = \Environment::get('host');
     $arrTokens['link'] = \Environment::get('base') . \Environment::get('request');
     foreach ($objAddress->row() as $k => $v) {
         $arrTokens['address_' . $k] = $v;
     }
     foreach ($arrOldAddress as $k => $v) {
         $arrTokens['address_old_' . $k] = $v;
     }
     foreach ($objMember->getData() as $k => $v) {
         $arrTokens['member_' . $k] = $v;
     }
     foreach ($objConfig->row() as $k => $v) {
         $arrTokens['config_' . $k] = $v;
     }
     $objNotification->send($arrTokens);
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:36,代码来源:AddressBook.php

示例13: chgpasswdsave

 function chgpasswdsave($vars)
 {
     //print_r($vars);return;
     $a = new User($this->db_conns);
     $a->getData($vars['id']);
     if ($vars['init_passwd'] != $a->user_password) {
         $this->gotoURL("user.php?action=chgpasswd&id=" . $a->id . "&error=1");
     } else {
         if ($vars['password'] != $vars['password2']) {
             $this->gotoURL("user.php?action=chgpasswd&id=" . $a->id . "&error=2");
         } else {
             $a->user_password = $vars['password'];
             $a->chgpassword();
             $this->gotoURL("user.php?action=list");
         }
     }
 }
开发者ID:jcandrew1966,项目名称:as_woodhouse,代码行数:17,代码来源:UserController.php

示例14: max

        $level = max(0, min(9, (int) getRequest('level')));
        if (($sqlUser = @mysql_query('UPDATE `user`
			SET `level` = "' . $level . '"
			WHERE `uid` = "' . $uid . '";')) === false) {
            handle(ERROR_SYSTEM . '01');
        }
        handle('0000');
        break;
    case 'resetPassword':
        if (!checkAuthority(9)) {
            handle(ERROR_PERMISSION . '01');
        }
        $_p = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        $currentUser = new User();
        $currentUser->uid = $uid = getRequest('uid');
        $username = json_decode($currentUser->getData(), true)['username'];
        $pwd = '';
        for ($_i = 0; $_i < 10; $_i++) {
            $pwd .= $_p[mt_rand(0, strlen($_p) - 1)];
        }
        $password = password_hash(md5($username . md5($pwd) . '.cc'), PASSWORD_BCRYPT);
        if (($sqlUser = @mysql_query('UPDATE `user`
			SET `password` = "' . $password . '"
			WHERE `uid` = "' . $uid . '";')) === false) {
            handle(ERROR_SYSTEM . '01');
        }
        handle('0000{"password":"' . $pwd . '"}');
        break;
    default:
        ERROR(ERROR_INPUT . '02', 'Request Error.');
        break;
开发者ID:CloudNumericalCalculation,项目名称:cloudcalc-web,代码行数:31,代码来源:user.request.php

示例15: unset

<!doctype html>

<html>
    <head>
    
    </head>
    
    <body>
        <?php 
if (isset($_SESSION['alert'])) {
    echo $_SESSION['alert'];
    unset($_SESSION['alert']);
}
include_once 'includes/menu.inc.php';
$User = new User();
$data = $User->getData();
echo '<input type="text" name="username" value="' . $data[0]['username'] . '" disabled>Usernames cannot be changed.<br><br>';
if (isset($data[1]['first']) && isset($data[1]['middle']) && isset($data[1]['last'])) {
    echo $data[1]['first'] . ' ' . $data[1]['middle'] . ' ' . $data[1]['last'];
    ?>
        
        <form action="" method="post">
            <input type="text" name="first" placeholder="First Name">
            <input type="text" name="middle" placeholder="Middle Name / MI">
            <input type="text" name="last" placeholder="Last Name">
            <input type="hidden" name="token" value="<?php 
    echo $token;
    ?>
">
            <input type="submit" name="updateName" value="Update">
        </form>
开发者ID:jryantz,项目名称:awc-framework,代码行数:31,代码来源:profile.php


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