public function outputHeaders($ext, $full_path) { SC::set('header_suppress_cache_control', 1); $cache_duration = 86400 * 7; // 7 days $last_mod_duration = 86400 * 2; // 2 days $last_mod_date = date('r', SC::get('board_config.time_now') - $last_mod_duration); $to_cache_date = date('r', SC::get('board_config.time_now') + $cache_duration); header("Expires: {$to_cache_date}"); header("Last-Modified: {$last_mod_date}"); header("Cache-Control: max-age={$cache_duration}"); // make an etag based on the full path // header('Etag: ' .'"'. crc32($full_path) . '"'); if ($ext == ".js") { header("Content-type: text/javascript"); } if ($ext == ".css") { header("Content-type: text/css"); } }
/** * Data function returns a container object, where all internal * data is stored. * @return Container * @access private */ private function data() { static $data; if (isset($data)) { return $data; } $data = new Container(); $params = array("cache" => SC::get('board_config.always_cache_bust') ? SC::get('board_config.time_now') . '_' . mt_rand(1, 999999) : SC::get('board_config.cache_bust'), 'yui_version' => '2.6.0'); $data->set("settings", $params); // Until all content is in grids, we need this var // REMOVE ONCE EVERY SINGLE PAGE ON THE SITE IS IN GRIDS $data->set('enable_nongrid', TRUE); if (isset($_GET['login_success']) && SC::get('userdata.user_id') < 1 && empty($_COOKIE)) { SC::set('board_config.sys_message', 'Gaia Online requires browser cookies. Please enable cookies in your browser and try again. Mmmm cookies.'); } $data->set('ext_script_js', array()); $data->set('script_js', array()); $data->set('script_css', array()); $data->set('script_css_ie', array()); return $data; }
/** * Perform the desired action. * @param string The name of the action. * @return void * @access public */ public function dispatch($request_name = NULL) { while (true) { try { $request = $this->instantiate($request_name, 'request', 'request'); SC::set('CIRCUIT_REQUEST_NAME', $request_name); } catch (Exception $e) { $request = $this->instantiate(CIRCUIT_APP_404, 'request'); } try { if (method_exists($request, 'load')) { $request->load($this->observer); } if (method_exists($request, 'forward') && ($request_name = $request->forward($this->observer))) { continue; } $action_name = method_exists($request, 'selectAction') ? $request->selectAction($this->observer) : $request_name; } catch (Exception $e) { $this->handleException($e); return $this->instantiate('Default.MessageDie', 'view')->execute($this); } break; } $action_result = null; if ($action_name) { try { $action = $this->instantiate($action_name, 'action'); $action_result = $action->execute($this); } catch (Exception $e) { $action_result = $this->handleException($e); } } $this->clearExceptionListeners(); $selectView = 'selectView_' . str_replace('.', '_', $action_name); $view_name = method_exists($request, $selectView) ? $request->{$selectView}($action_result) : (method_exists($request, 'selectView') ? $request->selectView($action_result) : $request_name); try { $view = $this->instantiate($view_name, 'view'); } catch (Exception $e) { $view = $this->instantiate(CIRCUIT_APP_404, 'view'); } $view->execute($this); }