function __construct($header) { //TODO use https when loggin in // use ssh for login // $host = "https://" . OLIV_SSH_HOST . "/" . OLIV_BASE . "index.php"; $host = "http://" . system::OLIV_SSH_HOST() . "/" . system::OLIV_BASE() . "index.php"; // load login content xml $this->content = OLIVModule::load_content($header); // select template for logged of not logged if (status::OLIV_USER()) { $header->param->template = "logged"; $this->content->username = OLIVUser::getName(status::OLIV_USER()); if (status::OLIV_SU()) { $this->content->su = status::OLIV_SU(); } else { $this->content->user_groups = OLIVUser::getGroupName(status::OLIV_USER()); } } else { // check if wrong login if (argv::action() == "login") { $header->param->template = "incorrect"; } } // load correct template $this->template = OLIVModule::load_template($header); }
public function header() { $base = system::OLIV_PROTOCOL() . system::OLIV_HOST() . system::OLIV_BASE(); $o = "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"; // set page to utf-8 $o .= "<base href='{$base}'>"; // link base referenz $o .= "<title>" . status::oliv_page() . "</title>"; // page title in browser $o .= "<link href='" . OLIVImage::_(system::OLIV_ICON()) . "' type='image/x-icon' rel='shortcut icon'>"; // icon in browser return $o; }
//DEBUG //echoall($_SERVER[HTTPS]); //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // set document root path $pathArray = explode("/", $_SERVER['SCRIPT_FILENAME']); system::set('OLIV_SCRIPT_NAME', array_pop($pathArray)); system::set('OLIV_DOCUMENT_ROOT', implode("/", $pathArray) . "/"); $pathArray = explode("/", $_SERVER['SCRIPT_NAME']); array_pop($pathArray); if (!$pathArray[0]) { array_shift($pathArray); } system::set('OLIV_BASE', implode("/", $pathArray) . "/"); // clear / if base is root directory if (system::OLIV_BASE() == "/") { system::set('OLIV_BASE', ""); } system::set('OLIV_HOST', $_SERVER['HTTP_HOST'] . "/"); //------------------------------------------------------------------------------ // set http / https protocol if (isset($_SERVER['HTTPS'])) { system::set('OLIV_PROTOCOL', "https://"); } else { system::set('OLIV_PROTOCOL', "http://"); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // load system definitions if (file_exists(system::OLIV_CORE_PATH() . "system.xml")) { $coreXml = simplexml_load_file(system::OLIV_CORE_PATH() . "system.xml");
public static function makeUrl($lang, $url) { $valArray = array(); if ($url) { $routeArray = array(system::OLIV_PROTOCOL() . system::OLIV_HOST() . system::OLIV_BASE() . system::OLIV_SCRIPT_NAME()); if ($lang) { array_push($routeArray, $lang); } else { $lang = status::lang(); } // use friendly name for url $path = OLIVRoute::makePath($url); // tranlsate and combine path foreach ($path as $entry) { array_push($valArray, OLIVRoute::translateFriendlyName($lang, $entry)); } $val = implode("/", $valArray); if ($val) { array_push($routeArray, $val); } return implode("/", $routeArray); } }