@ini_set('display_errors', '1'); } /** * Set the base url as a constant. * * It will be used in app and template files. With a trailing slash. */ $base_url = isset($_SERVER['HTTPS']) ? "https" : "http"; $base_url .= "://" . $_SERVER['HTTP_HOST']; $base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']); $base_url = rtrim($base_url, '/') . '/'; define('BASE_URL', $base_url); /** * Set the current URI (relative path) into a constant */ define('CURRENT_URI', current_uri()); /** * Detect if the request is an AJAX request, or a standard HTTP request. */ define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); /** * Init the Php Html Micro Starter Kit * and assign config and all instances to it. */ $ph4 = new App\Core\Phmisk(); /** * Init the ORM Database layer * * @link https://github.com/mikecao/sparrow * @link https://packagist.org/packages/unlight/sparrow */
function check_current_uri($check_uri, $is_internal_uri = false) { return current_uri($is_internal_uri) == trim($check_uri, '/'); }
protected function check_not_auth_action() { if (conf('base.isDisplayTopPageWithoutAuth') && check_current_uri(Config::get('routes._root_'), true)) { return true; } if (conf('base.closedSite.isEnabled')) { if (check_current_uri($this->get_login_page_uri())) { return true; } if (in_array(site_get_current_page_id('/'), conf('base.closedSite.accessAccepted.actions'))) { return true; } return in_array(current_uri(true), conf('base.closedSite.accessAccepted.uris')); } return in_array(Site_Util::get_action_name(IS_API), $this->check_not_auth_action); }
function uri_segments() { return explode('/', current_uri()); }