continue; } foreach ($includes as $include) { include_once $include; } } # exception handler set_exception_handler(array('\\Sky\\ErrorHandler', 'run')); # canonical redirect hook / session compat / timezone set include 'lib/core/hooks/env-ini/env-ini.php'; # web services hooks include 'lib/core/hooks/web-services/mem-connect.php'; include 'lib/core/hooks/web-services/db-connect.php'; include 'lib/core/hooks/web-services/media-connect.php'; # create page router $router = new \Sky\PageRouter(array('codebase_paths' => $codebase_path_arr, 'db' => $db, 'page_path_404' => $page_404, 'page_path_default' => $default_page, 'uri' => $uri['path'])); # instantiate page using PageRouter $p = new \Sky\Page($router->getPageProperties()); $p->sky_start_time = $sky_start_time; $protocol = 'http'; if ($server_ssl_header && $_SERVER[$server_ssl_header]) { $protocol = 'https'; } if ($_SERVER['HTTPS']) { $protocol = 'https'; } $p->protocol = $_SERVER['HTTPS'] ? 'https' : 'http'; # create session if necessary include 'lib/core/hooks/web-services/session.php'; # $access_groups to global (for authenticate hook) # authentication hook
/** * creates the effect of a symlink and allows the passing of data (keys of $data) * to the included page to mimic the directory contents of $path * * $p->inherit('includes/somepath'); * * @param string $path * @param array $data associative * @throws PageException */ public function inherit($path, $data = array()) { // add first slash if it isn't there so exploding is accurate. $path = strpos($path, '/') !== 0 ? '/' . $path : $path; global $codebase_path_arr, $db; $router = new \Sky\PageRouter(array('codebase_paths' => $codebase_path_arr, 'db' => $db)); $qs = array_merge(explode('/', $path), $this->queryfolders); $router->checkPath($qs); $inherited_path = end($router->page_path); if (!$inherited_path) { throw new PageException('Page::inherit could not find this path. ' . $path); } // set variables $this->inherited_path = $inherited_path; $this->vars = array_merge($this->vars, $router->vars); $this->setAssetsByPath($this->inherited_path); $this->incpath = static::getIncPath($this->inherited_path); // need to set path for queryfolders to work properly $slug = static::getPathSlug($this->inherited_path); $qf = $this->queryfolders; $key = array_search($filename, $qf); $key = is_bool($key) ? 0 : $key + 1; $this->queryfolders = array_slice($qf, $key); // call this in a closure so that // the inherited page does not have any previously declared vars $this->includePath($this->inherited_path, $data); }