当前位置: 首页>>代码示例>>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;未经允许,请勿转载。