Example #1
0
 protected function check_cookie()
 {
     $user_id = Util_Server_Request::get_cookie('userid');
     $user_name = Util_Server_Request::get_cookie('username');
     $user_role = Util_Server_Request::get_cookie('userrole');
     $time = Util_Server_Request::get_cookie('time');
     $secstr = Util_Server_Request::get_cookie('secstr');
     $seckey = LF\lb_read_system('seckey');
     return $secstr === md5($user_id . '$' . $user_name . '$' . $user_role . '$' . $time . '$' . $seckey);
 }
Example #2
0
 public function act()
 {
     $space_id = (int) Request::get_cookie('current_space');
     $space = LF\M('Space')->get_by_id($space_id);
     if ($space) {
         $space_name = $space['name'];
     } else {
         $space_id = 0;
         $space_name = '默认空间';
     }
     $item_num = LF\M('Item')->get_count_by_space($space_id);
     $case_num = LF\M('Case')->get_count_by_space($space_id);
     $view = LF\V('Html.List.Index');
     $view->add_data('current_space_id', $space_id);
     $view->add_data('current_space_name', $space_name);
     $view->add_data('item_num', (int) $item_num['count']);
     $view->add_data('case_num', (int) $case_num['count']);
     $view->add_data('page_num', ceil((int) $item_num['count'] / 10));
     $view->init('List.Index');
 }
Example #3
0
 public function get_cookie($file = '')
 {
     $saved_file = Request::get_cookie('cookiefile');
     if ($saved_file) {
         $file = $saved_file;
     } else {
         $file = $file ? $file : 'local-' . microtime();
         Cookie::set_cookie('cookiefile', $file, time() + 90 * 24 * 3600);
     }
     return APP_PATH . '/tmp/cookie/' . $file;
 }