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


PHP User::data方法代码示例

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


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

示例1: getNotification

 public function getNotification($id)
 {
     //serves up the notification if the cid has permission to view it
     $user = new User();
     $pre = $this->_db->query("SELECT notifications.id AS notification_id, notifications.type, notifications.from, notifications.to_type, notifications.to, notifications.submitted, notifications.status,\n\t\t\t\t\t\t\t\t\tnotification_types.id, notification_types.group, notification_types.name AS type_name, notification_types.sort,\n\t\t\t\t\t\t\t\t\tnotification_groups.id, notification_groups.name, notification_groups.permission_required, notification_groups.sort,\n\t\t\t\t\t\t\t\t\tcontrollers.id, controllers.first_name, controllers.last_name, controllers.email\n\t\t\tFROM notifications\n\t\t\tLEFT JOIN notification_types ON notifications.type = notification_types.id\n\t\t\tLEFT JOIN notification_groups ON notifications.to = notification_groups.id\n\t\t\tLEFT JOIN controllers ON controllers.id = notifications.from\n\t\t\tWHERE notifications.id = ? OR notifications.to = ?", [[$id, $id]]);
     if (!$pre->count()) {
         throw new Exception("No record found for that ID");
     } else {
         $this->_data = $pre->first();
         if ($user->data()->id == $this->_data->from || $user->data()->id == 0 && $user->data()->id == $this->_data->to || $user->hasPermission($this->_data->permission_required)) {
             return $this->_data;
         }
         throw new Exception("Invalid permissions to view that record");
     }
 }
开发者ID:Ashilta,项目名称:VATeir,代码行数:15,代码来源:Notifications.php

示例2: get

 public function get($uid)
 {
     $pos = $this->_db->get('posts', "uid = {$uid} ORDER BY timestamp DESC");
     if ($pos->count()) {
         $posts = $pos->results();
         foreach ($posts as $post) {
             $friend = new User($post->fid);
             $friendName = $friend->data()->firstName . ' ' . $friend->data()->middleName . ' ' . $friend->data()->lastName;
             $datetime = new DateTime($post->timestamp);
             $timestamp = $datetime->format('l, F j, Y \\a\\t g:ia');
             $this->add(array('username' => $friend->data()->username, 'name' => $friendName, 'profilePicture' => $friend->data()->profilePicture, 'comment' => $post->comment, 'timestamp' => $timestamp));
         }
         return true;
     }
     return false;
 }
开发者ID:seanhho28,项目名称:social-network,代码行数:16,代码来源:Post.php

示例3: index

 public function index()
 {
     $flash_string = '';
     if (Session::exists('home')) {
         $flash_string = Session::flash('home');
     }
     if (Session::exists('success')) {
         $flash_string = Session::flash('success');
     }
     $user = new User();
     if ($user->isLoggedIn()) {
         $this->view('account/index', ['register' => true, 'loggedIn' => 1, 'flash' => $flash_string, 'name' => $user->data()->name, 'user_id' => $user->data()->id, 'page_name' => 'Home']);
     } else {
         $this->view('home/index', ['loggedIn' => 0, 'page_name' => 'Home', 'flash' => $flash_string]);
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:16,代码来源:home.php

示例4: search

 public function search($input = array())
 {
     $where = '';
     $x = 1;
     foreach ($input as $field => $value) {
         if (!empty($value)) {
             $fields[$field] = $value;
         }
     }
     foreach ($fields as $field => $value) {
         if (!empty($value)) {
             $where .= $field . ' = ' . '\'' . $value . '\'';
             if (count($fields) !== 1 && $x < count($fields)) {
                 $where .= ' AND ';
             }
         }
         $x++;
     }
     $search = $this->_db->get('users', $where);
     if ($search->count()) {
         $results = $search->results();
         foreach ($results as $result) {
             $friend = new User($result->id);
             $this->_results[] = $friend->data();
         }
         return true;
     }
     return false;
 }
开发者ID:seanhho28,项目名称:social-network,代码行数:29,代码来源:Search.php

示例5: addNewUser

 public function addNewUser($username, $firstname, $lastname, $password)
 {
     if (!$this->userExists($username)) {
         $newUser = new User($username, $firstname, $lastname, $password);
         $this->usersData->addNew($newUser->data(), 'username');
         return true;
     } else {
         return false;
     }
 }
开发者ID:nashvail,项目名称:100acres,代码行数:10,代码来源:UsersDatabase.php

示例6: index

 function index()
 {
     $user = new User();
     if ($user->hasPermission('admin')) {
         echo "Welcome admin!";
     } else {
         echo "Welcome " . $user->data()->name . "!";
     }
     $this->htmlResponse("index.html", ['title' => 'JN', 'error' => Session::flash('error'), 'success' => Session::flash('success')]);
 }
开发者ID:Jay-En,项目名称:BonePHP-starter,代码行数:10,代码来源:contactController.php

示例7: deleteById

 public static function deleteById($productId)
 {
     $db = self::getInstance();
     $user = new User();
     $userId = $user->data()->id;
     $sql = "DELETE FROM `Products` WHERE `Products`.`user` = ? AND `Products`.`id` = ?;";
     if (!$db->query($sql, [$userId, $productId])) {
         return false;
     }
     return true;
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:11,代码来源:product.php

示例8: login

 public static function login($userid = '', $password = '', $remember = false)
 {
     $user = new User($userid);
     if (!empty($userid) && !empty($password) && $user->exists()) {
         if (Hash::checkPassword($password, $user->data()->password)) {
             self::forceLogin($user, $remember);
             return true;
         }
     }
     return false;
 }
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:11,代码来源:Users.php

示例9: deleteUnit

 public static function deleteUnit($name)
 {
     $db = self::getInstance();
     $user = new User();
     $userId = $user->data()->id;
     $sql = "DELETE FROM `Unit` WHERE `Unit`.`Name` = ? AND `Unit`.`user` = ?;";
     if ($db->query($sql, [$name, $userId])) {
         return true;
     } else {
         return true;
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:12,代码来源:Unit.php

示例10: setData

 /**
  * Set additional data for the user account. This is used for storing additional content
  * that isn't supported by the default user table.
  */
 public function setData($name, $value)
 {
     if (self::$_user['id'] == 0) {
         // Cant set data for anonymous user
         return false;
     }
     if (User::data()->where('user_id', '=', self::$_user['id'])->andWhere('name', '=', $name)->first()) {
         User::data()->where('user_id', '=', self::$_user['id'])->andWhere('name', '=', $name)->update(array('value' => $value));
     } else {
         User::data()->insert(array('user_id' => self::$_user['id'], 'name' => $name, 'value' => $value));
     }
 }
开发者ID:simudream,项目名称:caffeine,代码行数:16,代码来源:user_current.php

示例11: getComponentsByDishId

 public static function getComponentsByDishId($dishId)
 {
     $db = self::getInstance();
     $user = new User();
     $userId = $user->data()->id;
     $sql = "SELECT `Dishes`.`id`, `Recipes`.`recipeName`, `Recipes`.`recipeCost`, `Recipes`.`yeild`, `Recipes`.`yeildUnit`, `DishRecipes`.`quantity`, `DishRecipes`.`unit`, `Unit`.`Ratio`\n\t\t\tFROM `Dishes`\n\t\t\tJOIN `DishRecipes`\n\t\t\tON `Dishes`.`id` = `DishRecipes`.`Dishes_id`\n\t\t\tAND `DishRecipes`.`Dishes_id` = ?\n\t\t\tAND `Dishes`.`user` = ?\n\t\t\tJOIN `Recipes`\n\t\t\tON `DishRecipes`.`Recipes_id` = `Recipes`.`id`\n\t\t\tJOIN `Unit`\n\t\t\tON `DishRecipes`.`unit` = `Unit`.`Name`;";
     if ($ingredient = $db->query($sql, [$dishId, $userId])->results()) {
         return $ingredient;
     } else {
         return false;
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:12,代码来源:Component.php

示例12: getIngredientsByRecipeId

 public static function getIngredientsByRecipeId($recipeId)
 {
     $db = self::getInstance();
     $user = new User();
     $userId = $user->data()->id;
     $sql = "SELECT `Products`.`productName`, `Products`.`id`, `Products`.`costPerKiloUnit`, `ProductRecipes`.`Recipes_id`, `ProductRecipes`.`quantity`, `ProductRecipes`.`unit`, `Unit`.`Ratio`, `Unit`.`UnitType`\n\t\t\tFROM `Products`\n\t\t\tJOIN `ProductRecipes`\n\t\t\tON `Products`.`id` = `ProductRecipes`.`Products_id`\n\t\t\tAND `ProductRecipes`.`Recipes_id` = ?\n\t\t\tAND `Products`.`user` = ?\n\t\t\tJOIN `Unit`\n\t\t\tON `ProductRecipes`.`unit` = `Unit`.`Name`\n\t\t\tORDER BY `ProductRecipes`.`id` ASC;";
     if ($ingredient = $db->query($sql, [$recipeId, $userId])->results()) {
         return $ingredient;
     } else {
         return false;
     }
 }
开发者ID:armourjami,项目名称:armourtake,代码行数:12,代码来源:Ingredient.php

示例13: onAuthCheckLoggedIn

 function onAuthCheckLoggedIn(Am_Event_AuthCheckLoggedIn $event)
 {
     $status = $this->getStatus();
     if ($status == self::LOGGED_AND_LINKED) {
         $event->setSuccessAndStop($this->linkedUser);
     } elseif ($status == self::LOGGED_OUT && !empty($_GET['fb_login'])) {
         $this->linkedUser->data()->set(self::FACEBOOK_LOGOUT, null)->update();
         $event->setSuccessAndStop($this->linkedUser);
     } elseif ($status == self::LOGGED_IN && $this->getDi()->request->get('fb_login')) {
         $this->linkedUser = $this->createAccount();
         $event->setSuccessAndStop($this->linkedUser);
     }
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:13,代码来源:facebook.php

示例14: form

 public function form($id = "")
 {
     if (empty($id)) {
         $head['title'] = 'Yönetici Ekle';
         $head['meta']['author'] = 'Bursa yazılım';
         $headData["kullaniciAdi"] = User::data()->username;
         $bodyVeri["data"] = ['action' => siteUrl('yonetim/ekle')];
         $bodyVeri["data"] = ['action' => siteUrl('yonetim/ekle'), 'yoneticiDetay' => ["username" => "", "pass" => "", "email" => "", "isim" => "", "soyisim" => "", "durum" => "", "ban_durum" => ""]];
     } else {
         $head['title'] = 'Yönetici Düzenle';
         $head['meta']['author'] = 'Bursa yazılım';
         $headData["kullaniciAdi"] = User::data()->username;
         $yoneticiDetay = $this->yonetici->detay($id);
         $bodyVeri["data"] = ['action' => siteUrl('yonetim/duzenle/' . $id), 'yoneticiDetay' => $yoneticiDetay];
     }
     $data['head'] = Import::view('head', $headData, true);
     $data['footer'] = Import::view('footer', '', true);
     $data['body'] = Import::view('yonetimForm', $bodyVeri, true);
     Import::masterPage($data, $head);
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:20,代码来源:yonetim.php

示例15: changePassword

 function changePassword()
 {
     $input = Input::parse();
     if (Token::check($input['token'])) {
         $validate = new Validate();
         $validate->check($input, array('password_current' => ['required' => true, 'min' => 6], 'password' => ['required' => true, 'min' => 6], 'password_repeat' => ['required' => true, 'min' => 6, 'matches' => 'password']));
         if ($validate->passed()) {
             $user = new User();
             if (Hash::make($input['password_current'], config::get('encryption/salt')) !== $user->data()->password) {
                 echo "incorrent password";
             } else {
                 $user->update(array('password' => Hash::make($input['password'], config::get('ecryption/salt'))));
                 Session::flash('success', 'Successfully changed password');
                 Redirect::to('changepassword');
             }
         } else {
             Session::flash('error', $validate->errors());
             Redirect::to('changepassword');
         }
     }
 }
开发者ID:Jay-En,项目名称:BonePHP-starter,代码行数:21,代码来源:profileController.php


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