Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
0
function t($str, array $args = array(), array $options = array())
{
    return \ICanBoogie\I18n\t($str, $args, $options);
}
#
# patches
#
\Brickrouge\Helpers::patch('render_exception', 'ICanBoogie\\Debug::format_alert');
\Brickrouge\Helpers::patch('t', __NAMESPACE__ . '\\t');
#
# application
#
$core = new \Icybee\Core(array('config paths' => array(__DIR__, \Icybee\DIR), 'locale paths' => array(__DIR__, \Icybee\DIR), 'modules paths' => array(\Icybee\DIR . 'modules' . DIRECTORY_SEPARATOR, \ICanBoogie\Modules\DIR)));
$_SERVER['ICANBOOGIE_READY_TIME_FLOAT'] = microtime(true);
#
# session
#
$core->session = \ICanBoogie\Session::get_session($core);
#
# language
#
if (isset($_GET['hl'])) {
    $core->session->install['locale'] = $_GET['hl'];
}
if (isset($core->session->install['locale'])) {
    $core->locale = $core->session->install['locale'];
}
#
# document
#
$core->document = \Brickrouge\get_document();