示例#1
0
 protected function process()
 {
     $this->response->content_type = 'text/plain';
     if (Session::exists()) {
         $this->app->session;
     }
     $rc = 'pong';
     if ($this->request['timer'] !== null) {
         $boot_time = self::format_time($_SERVER['ICANBOOGIE_READY_TIME_FLOAT']);
         $run_time = self::format_time(microtime(true));
         $rc .= ", in {$run_time} (ready in {$boot_time})";
     }
     return $rc;
 }
示例#2
0
 /**
  * Returns the user object.
  *
  * If the user identifier can be retrieved from the session, it is used to find the
  * corresponding user.
  *
  * If no user could be found, a guest user object is returned.
  *
  * This is the getter for the `$core->user` property.
  *
  * @param Core $core
  *
  * @return User The user object, or guest user object.
  */
 public static function get_user(Core $core)
 {
     $user = null;
     $uid = $core->user_id;
     $model = $core->models['users'];
     try {
         if ($uid) {
             $user = $model[$uid];
         }
     } catch (\Exception $e) {
     }
     if (!$user) {
         if (Session::exists()) {
             unset($core->session->users['user_id']);
         }
         $user = new User($model);
     }
     return $user;
 }