本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}