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


PHP Auth::get_user_id方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     // -- Set the UserID
     // -----------------
     list($driver, $user_id) = \Auth::get_user_id();
     $this->_userID = (int) $user_id;
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:7,代码来源:access_log_class.php

示例2: _event_before_insert

 /**
  * before_insert observer event method
  */
 public function _event_before_insert()
 {
     // assign the user id that lasted updated this record
     if (!$this->user_id) {
         $this->user_id = ($this->user_id = \Auth::get_user_id()) ? $this->user_id[1] : 0;
     }
 }
开发者ID:wxl2012,项目名称:wx,代码行数:10,代码来源:order.php

示例3: article_edit

 /**
  * 記事編集フィールドセット
  * 
  * @access  public
  * @return  Fieldsetオブジェクト
  */
 public static function article_edit($id)
 {
     $article = \DB::select('*')->from('topics')->where('topic_id', $id)->and_where('type_id', 1)->and_where('id', \Auth::get_user_id()[1])->execute()->as_array();
     $image = \DB::select('*')->from('topics_pictures')->where('topic_id', $id)->and_where('response_id', null)->execute()->count();
     $form = \Fieldset::forge('article_regist_form');
     $form->form()->set_attribute('class', 'form form-horizontal');
     $form->add('id', '', array('type' => 'hidden', 'value' => $id))->add_rule('required')->add_rule('valid_string', array('numeric'));
     $form->add('title', 'タイトル', array('class' => 'form-control', 'required', 'value' => $article[0]['title']))->add_rule('required')->add_rule('min_length', 1)->add_rule('max_length', 100);
     $form->add('body', '内容', array('type' => 'textarea', 'rows' => 20, 'class' => 'form-control', 'required', 'value' => $article[0]['topic_body']))->add_rule('required')->add_rule('min_length', 2)->add_rule('max_length', 5000);
     $form->add('image', '画像ファイル', array('type' => 'file'));
     if ($image > 0) {
         $form->add('change_image', '', array('type' => 'checkbox', 'value' => 'true', 'options' => array(0 => '保存済みの画像を使用する')))->set_template("<div class=\"form-group\">\n\n\t\t\t\t\t\t\t\t\t\t<div class=\"col-sm-2 control-label\">\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t<div class=\"col-sm-10 checkbox {error_class}\">\n\t\t\t\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t\t\t\t{fields}\n\n\t\t\t\t\t\t\t\t\t\t\t\t{field}\n\n\t\t\t\t\t\t\t\t\t\t\t\t{fields}\n\t\t\t\t\t\t\t\t\t\t\t\t保存済みの画像を使用する\n\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t<span>{description}</span>{error_msg}\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t</div>\n");
     }
     $result = \DB::select('category_id', 'category')->from('categories')->execute()->as_array();
     foreach ($result as $item) {
         $options[$item['category_id']] = $item['category'];
     }
     $form->add('category', 'カテゴリー', array('type' => 'select', 'options' => $options, 'class' => 'form-control', 'required', 'value' => $article[0]['category_id']))->add_rule('required');
     //		$form->add('tag','タグ',array('class'=>'form-control','list'=>'tag-auto','placeholder'=>'例)中華,ランチ'))
     //			->add_rule('min_length',1)
     //			->add_rule('max_length',100);
     $form->add('readonly', '', array('type' => 'checkbox', 'value' => !$article[0]['readonly'], 'options' => array(0 => '')))->set_template("<div class=\"form-group\">\n\n\t\t\t\t\t\t\t<div class=\"col-sm-2 control-label\">\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\tコメントの可否\n\t\t\t\t\t\t\t\t\t<span class=\"require\">*</span>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"col-sm-10 checkbox {error_class}\">\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t{fields}\n\n\t\t\t\t\t\t\t\t\t{field}\n\n\t\t\t\t\t\t\t\t\t{fields}\n\t\t\t\t\t\t\t\t\t※記事へのコメントを許可しない場合をチェックを外して下さい。\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t<span>{description}</span>{error_msg}\n\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t</div>\n");
     $form->form()->add_csrf();
     $form->add('submit', '', array('type' => 'submit', 'value' => '投稿', 'class' => 'btn btn-primary'));
     return $form;
 }
开发者ID:takawasitobi,项目名称:pembit,代码行数:32,代码来源:formparts.php

示例4: __construct

 public function __construct($referralID = 0)
 {
     if ((int) $referralID <= 0) {
         return;
     }
     // -- Set the Referral ID
     // ----------------------
     $this->_referralID = $referralID;
     //-- Set the database model
     // ------------------------
     Referrals_model::forge($this->_referralID);
     list($driver, $user_id) = \Auth::get_user_id();
     $this->_user_id = $user_id;
     // -- Load the referral up
     // -----------------------
     $loadResult = $this->load();
     // -- Set the Email template location
     // ----------------------------------
     $this->_emailTemplateDir = PKGPATH . 'crm/subpackage/referrals/view/email/';
     if (is_null($loadResult)) {
         return null;
     } else {
         return $this;
     }
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:25,代码来源:referrals_class.php

示例5: getTypeaheadList

 public static function getTypeaheadList($col)
 {
     if (Auth::check() === false) {
         return json_encode(array());
     }
     $user_id = Auth::get_user_id();
     $res = DB::select($col)->from('posts')->where('user_id', '=', $user_id[1])->group_by($col)->execute()->as_array();
     return json_encode(\Arr::pluck($res, $col));
 }
开发者ID:nobuhiko,项目名称:mylogbook,代码行数:9,代码来源:post.php

示例6: log

 static function log($category, $message)
 {
     require_once THRIFT_ROOT . '/Thrift.php';
     require_once THRIFT_ROOT . '/protocol/TBinaryProtocol.php';
     require_once THRIFT_ROOT . '/transport/TSocket.php';
     require_once THRIFT_ROOT . '/transport/TFramedTransport.php';
     require_once THRIFT_ROOT . '/packages/scribe/scribe.php';
     switch ($category) {
         case 'general':
         case 'accounts':
         case 'actions':
         case 'status':
         case 'security':
         case 'debug':
         case 'history':
         case 'regulation':
         case 'specials':
             break;
         default:
             fatal();
     }
     if (!is_string($message)) {
         if (is_array($message)) {
             if (!isset($message['ts'])) {
                 $message['ts'] = time();
             }
             if (!isset($message['client_ip'])) {
                 $message['client_ip'] = Utils::get_client_ip();
             }
             if (!isset($message['user_id']) && Auth::is_logged()) {
                 $message['user_id'] = Auth::get_user_id();
             }
             if (!isset($message['user_name']) && Auth::is_logged()) {
                 $message['user_name'] = Auth::get_user_name();
             }
             $oauth_client_id = Auth::get_oauth_client_id();
             if (!isset($message['oauth_client_id']) && !empty($oauth_client_id)) {
                 $message['oauth_client_id'] = $oauth_client_id;
             }
         }
         $message = json_encode($message);
     }
     try {
         $log_entry = new \LogEntry(array('category' => $category, 'message' => $message));
         $messages = array($log_entry);
         $socket = new \TSocket(SCRIBE_HOST, SCRIBE_PORT, FALSE);
         $transport = new \TFramedTransport($socket);
         $protocol = new \TBinaryProtocolAccelerated($transport, FALSE, FALSE);
         $client = new \scribeClient($protocol, $protocol);
         $transport->open();
         $client->send_log($messages);
         $transport->close();
     } catch (\TException $e) {
         return FALSE;
     }
     return TRUE;
 }
开发者ID:jedisct1,项目名称:PHP-OAuth2-Provider,代码行数:57,代码来源:class.scribe.inc.php

示例7: before

 public function before()
 {
     parent::before();
     // Without this line, templating won't work!
     if (\Auth::check()) {
         # Set user info
         list(, $userid) = \Auth::get_user_id();
         $this->template->set_global('auth', ['user' => ['screen_name' => \Auth::get_screen_name(), 'group' => \Auth::group()->get_name()]], false);
     }
 }
开发者ID:vano00,项目名称:jobs,代码行数:10,代码来源:base.php

示例8: before

 public function before()
 {
     parent::before();
     if (Auth::check()) {
         $user_id = Auth::get_user_id()[1];
         $this->user = Model_User::find($user_id);
         if ($this->user->group_id == 100) {
             $this->auth_status = true;
         }
     }
 }
开发者ID:Trd-vandolph,项目名称:game-bootcamp,代码行数:11,代码来源:api.php

示例9: before_insert

 /**
  * Sets the CreatedBy property to the current user id
  *
  * @param Model Model object subject of this observer method
  */
 public function before_insert(Orm\Model $obj)
 {
     if ($obj instanceof Orm\Model_Temporal) {
         if ($obj->{$obj->temporal_property('end_column')} !== $obj->temporal_property('max_timestamp')) {
             return false;
         }
     }
     if ($user_id = \Auth::get_user_id()) {
         $obj->{$this->_property} = $user_id[1];
     }
 }
开发者ID:indigophp,项目名称:fuel-core,代码行数:16,代码来源:CreatedBy.php

示例10: before

 public function before()
 {
     parent::before();
     $this->viewer_info = array();
     if (!Auth::check()) {
         Response::redirect('members');
         // login画面に戻る。
     } else {
         $this->viewer_info['name'] = Auth::get_screen_name();
         $this->viewer_info['uid'] = Auth::get_user_id();
     }
 }
开发者ID:akmnhm,项目名称:tabi_log,代码行数:12,代码来源:top.php

示例11: before

 public function before()
 {
     // Lets render the template
     parent::before();
     // Check to see if the config exsists
     if (file_exists(APPPATH . 'config/production/db.php') === false) {
         Response::Redirect('install');
     }
     if (DBUtil::field_exists('urls', array('cached_preview')) === false && file_exists(APPPATH . 'classes/controller/upgrade.php')) {
         Response::Redirect(Uri::Create('upgrade'));
     }
     $real_base_url = Config::get('base_url');
     Config::set('base_url', str_replace('public/', '', $real_base_url));
     $base_url = Settings::get('different_short_url');
     if (empty($base_url) === false) {
         View::set_global(array('base_url' => $base_url), false, false);
     }
     if (trim(Uri::Base(), '/') == Settings::get('different_short_url')) {
         if (count(Uri::Segments()) == 2) {
             $route = Uri::to_assoc();
             if (isset($route) === true && $route['core'] == '404') {
                 // We are good!
             } else {
                 Response::Redirect(Settings::Get('base_url'));
             }
         } else {
             Response::Redirect(Settings::Get('base_url'));
         }
     }
     $data = null;
     if (Auth::Check()) {
         $user_id = Auth::get_user_id();
         static::$user_id = $user_id[1];
         $data['api_key'] = Auth::get('api_key');
         if (empty($data['api_key']) === true) {
             if (empty($data['api_key']) === true) {
                 $data['api_key'] = preg_replace('/\\+|\\/|\\=|\\?/', '', \Auth::instance()->hash_password(\Str::random()) . static::$user_id);
                 // invalidate the hash
                 \Auth::update_user(array('api_key' => $data['api_key']), Auth::get('username'));
             }
         }
     }
     // Lets set the default title , you can change it when calling the view
     $this->template->title = ucwords(str_replace('controller_', '', strtolower($this->request->route->controller)));
     try {
         Module::load('image');
         $this->template->image_js = true;
     } catch (Exception $e) {
     }
     // Lets get the header and footer and set a variable to use within the template
     $this->template->footer = View::forge('core/footer', $data);
     $this->template->header = View::forge('core/header');
 }
开发者ID:aircross,项目名称:MeeLa-Premium-URL-Shortener,代码行数:53,代码来源:template.php

示例12: before

 public function before()
 {
     parent::before();
     if (!Auth::check()) {
         return $this->responseJson('nologin', true);
     }
     $this->fleamarket = Model_Fleamarket::find(Input::param('fleamarket_id'));
     if (!$this->fleamarket) {
         return $this->responseJson('nodata', true);
     }
     $this->input = array('user_id' => Auth::get_user_id(), 'fleamarket_id' => Input::param('fleamarket_id'));
     $this->favorite = Model_Favorite::query()->where($this->input)->get_one();
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:13,代码来源:favorite.php

示例13: saveCorrespondence

 public static function saveCorrespondence($ppiClientID = 0, $claimID = 0, $stageID = 0, $statusID = 0, $dispositionID, $notes = null)
 {
     // -- Save a new correspondance
     // ----------------------------
     $result = 0;
     list($driver, $user_id) = \Auth::get_user_id();
     $result = \DB::query("INSERT INTO\n                            " . static::$crmPpiCorrespondence . "\n                          (\n                             id\n                            ,ppi_client_id\n                            ,claim_id\n                            ,stage_id\n                            ,status_id\n                            ,user_id\n                            ,disposition_id\n                            ,date\n                            ,notes\n                          )\n                            VALUES\n                          (\n                             NULL\n                            ," . (int) $ppiClientID . " \n                            ," . (int) $claimID . "\n                            ," . (int) $stageID . "\n                            ," . (int) $statusID . "\n                            ," . $user_id . "\n                            ," . (int) $dispositionID . "\n                            ,NOW()\n                            ," . (isset($notes) ? \DB::quote($notes) : "''") . "\n                          )\n                         ", \DB::insert())->execute();
     if ($result > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:13,代码来源:ppi_correspondence_model.php

示例14: action_view

 public function action_view($id = null)
 {
     is_null($id) and Response::redirect('job');
     $data['job'] = \Model\Job::find($id);
     $data['actions'] = ['back' => ['label' => 'Back', 'url' => '/']];
     if (\Auth::check()) {
         list(, $userid) = \Auth::get_user_id();
         // check if the job has been saved by the current user
         $data['favorite'] = \Model\Favorite::find('all', array('where' => array(array('user_id', $userid), array('job_id', $id))));
     }
     $this->template->title = "Jobs";
     $this->template->content = View::forge('job/_details.twig', $data);
 }
开发者ID:vano00,项目名称:jobs,代码行数:13,代码来源:job.php

示例15: before_update

 /**
  * Sets the UpdatedBy property to the current user id
  *
  * @param Model Model object subject of this observer method
  */
 public function before_update(Orm\Model $obj)
 {
     // If there are any relations loop through and check if any of them have been changed
     $relation_changed = false;
     foreach ($this->_relations as $relation) {
         if ($this->relation_changed($obj, $relation)) {
             $relation_changed = true;
             break;
         }
     }
     if (($obj->is_changed() or $relation_changed) and $user_id = \Auth::get_user_id()) {
         $obj->{$this->_property} = $user_id[1];
     }
 }
开发者ID:indigophp,项目名称:fuel-core,代码行数:19,代码来源:UpdatedBy.php


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