當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Token::get_by_valid_token方法代碼示例

本文整理匯總了PHP中Token::get_by_valid_token方法的典型用法代碼示例。如果您正苦於以下問題:PHP Token::get_by_valid_token方法的具體用法?PHP Token::get_by_valid_token怎麽用?PHP Token::get_by_valid_token使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Token的用法示例。


在下文中一共展示了Token::get_by_valid_token方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: all_get

 public function all_get($token)
 {
     $token_entry = new Token();
     $token_entry->get_by_valid_token($token)->get();
     if ($token_entry->exists()) {
         $settings = new Setting();
         $settings->get();
         $response = new stdClass();
         $response->status = true;
         $response->settings = new stdClass();
         foreach ($settings as $setting) {
             $response->settings->{$setting->setting_key} = $setting->setting_value;
         }
         $this->response($response);
     } else {
         $response = new stdClass();
         $response->status = false;
         $response->error = 'Token not found or session expired';
         $this->response($response);
     }
 }
開發者ID:NaszvadiG,項目名稱:crono,代碼行數:21,代碼來源:settings.php

示例2: weekTotal_get

 public function weekTotal_get($token)
 {
     //YEARWEEK(FROM_UNIXTIME(stop_time)) = YEARWEEK(CURRENT_DATE)
     $token_entry = new Token();
     $token_entry->get_by_valid_token($token)->get();
     $response = new stdClass();
     if ($token_entry->exists()) {
         //TODO
         $timer_entries = new Timer_entry();
         //Selecting the entry
         $timer_entries->getThisWeek()->where('active', 0)->select_sum('(stop_time - start_time)', 'totalTime')->get();
         $response->status = true;
         $response->totalThisWeek = 0;
         if ($timer_entries->exists()) {
             if (!$timer_entries->totalTime) {
                 $response->totalThisWeek = from_unix_timespan_to_string(0);
             }
             $response->totalThisWeek = from_unix_timespan_to_string($timer_entries->totalTime);
         }
     } else {
         $response->status = false;
         $response->error = 'Token not found or session expired';
     }
     $this->response($response);
 }
開發者ID:NaszvadiG,項目名稱:crono,代碼行數:25,代碼來源:timer.php

示例3: user_delete

 public function user_delete($id, $token)
 {
     $token_entry = new Token();
     $token_entry->get_by_valid_token($token)->get();
     $response = new stdClass();
     if ($token_entry->exists() && $token_entry->user->get()->is_admin) {
         if ($token_entry->user_id != $id) {
             $user = new User();
             $user->get_by_id($id);
             $user->delete();
             $response->status = TRUE;
             $this->response($response);
         } else {
             $response->status = FALSE;
             $response->error = 'Cannot delete active user!';
             $this->response($response);
         }
     } else {
         $response->status = FALSE;
         $response->error = 'Token not found, not an admin or session expired';
         $this->response($response);
     }
 }
開發者ID:NaszvadiG,項目名稱:crono,代碼行數:23,代碼來源:account.php

示例4: index_post

 /**
  * Create a new project
  * @route POST projects/
  */
 public function index_post()
 {
     $token_entry = new Token();
     $token_entry->get_by_valid_token($this->post('token'))->get();
     $response = new stdClass();
     if ($token_entry->exists()) {
         $project = new Project();
         $project->name = $this->post('name');
         $project->customer_id = $this->post('customer_id');
         if ($project->save()) {
             $response->status = true;
         } else {
             $response->status = false;
             $response->error = 'Project not saved!';
         }
     } else {
         $response->status = false;
         $response->error = 'Token not found or session expired';
     }
     $this->response($response);
 }
開發者ID:NaszvadiG,項目名稱:crono,代碼行數:25,代碼來源:projects.php


注:本文中的Token::get_by_valid_token方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。