private function scan($path) { $modules = array(); $cnt = 0; if ($modDir = olivopendir($path)) { while ($file = readdir($modDir)) { if (olivis_dir($path . $file) and $file != "." and $file != "..") { $filePath = "{$file}/"; // get modules define.xml if (olivfile_exists($path . $filePath)) { // load module information $xml = olivxml_load_file($path . $filePath . "define.xml"); //------------------------------------------------------------------------------ // check for session directory $sessionDir = system::oliv_module_path() . $filePath; if (sessionfile_exists($sessionDir)) { $contentPath = $xml->content; $templatePath = $xml->template; // write directory permissions to module header $xml->content['permission'] = get_permission(session_path($sessionDir) . $contentPath); $xml->template['permission'] = get_permission(session_path($sessionDir) . $templatePath); } else { // session directory don't exist $xml->status = "NO_SESSION_DIR"; $xml->permission = 0; } //------------------------------------------------------------------------------ // save module metadata $modules[(string) $xml->name] = $xml; $cnt++; } } } closedir($modDir); system::set("modules", $modules); return $cnt; } else { OLIVError::fire("module::scan - directory {$path} not found"); } return FALSE; }
// governing rights and limitations. // // You should have received a copy of the GPL along with this // program. If not, go to http://www.gnu.org/licenses/gpl.html // or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // //------------------------------------------------------------------------------ // Error handling class // // Version 0.1 //------------------------------------------------------------------------------ if (!system::OLIVCORE()) { die("error.php - OLIVCore not present"); } system::set('OLIVERROR', "alive"); $_error = ""; $_warning = ""; $_debug = ""; class OLIVError { //------------------------------------------------------------------------------ // fires message immediately public static function fire($text) { echo OLIVError::renderError($text); } //------------------------------------------------------------------------------ // render a text using the oliv_error id public static function renderError($text) {
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // //------------------------------------------------------------------------------ // html class // // Version 0.1 //------------------------------------------------------------------------------ // core initialisation completed // set core alive if (!system::OLIVCORE()) { die("html.php - OLIVCore not present"); } if (!system::OLIVERROR()) { die("html.php - OLIVError not present"); } system::set("OLIVHtml", "alive"); //------------------------------------------------------------------------------ class OLIVHtml { public function __construct() { echo $this->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>";
// or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // //------------------------------------------------------------------------------ // Multilangual static text rendering // // V0.1 //------------------------------------------------------------------------------ // todo: insert printf, sprintf method if (!system::OLIVCORE()) { die("text.php - OLIVCore not present"); } if (!system::OLIVERROR()) { die("text.php - OLIVError not present"); } system::set("OLIVTEXT", "alive"); // global static text xml $_TEXT; //------------------------------------------------------------------------------ class OLIVText { // returns language text, defined by status::lang // if not present, use system::oliv_default_lang // if no text is found at all, FALSE is returned // // param text ... xml node containing text // <node>Textstring</node> = single language // <node> // <text lang="langcode1">Textstring lang 1</text> // <text lang="langcode2">Textstring lang 2</text> // <text lang="...">...</text>
public function init($session) { // ------------------------------------------------------------------------------ // set session if ($session) { system::set('OLIV_SESSION', $session . "/"); } else { die("***FATAL ERROR: init.php - no session defined"); } // core path for multisession defined if (!system::OLIV_CORE_PATH()) { die("Core path not defined"); } // ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------ // load basic system methods OLIVCore::loadScript("library/init.php"); if (!system::OLIVENV()) { die("Environment not set"); } // ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------ // load system language if (!system::OLIVTEXT()) { die("INIT: OLIVTEXT not found"); } OLIVText::load(system::OLIV_LANGUAGE_PATH(), system::OLIV_CORE_TEXT()); // ------------------------------------------------------------------------------ // initialice main components // ------------------------------------------------------------------------------ // connect to database // $this->daba = new OLIVDatabase($this->coreXml->_("core.database")); // initialise router $this->route = new OLIVRoute(); // initialise html $this->html = new OLIVHtml(); // load module metadata $this->module = new OLIVModule(); // load plugin metadata $this->plugin = new OLIVPlugin(); // load site template $this->template = new OLIVTemplate(system::OLIV_TEMPLATE_PATH() . system::OLIV_TEMPLATE() . "/", system::OLIV_TEMPLATE()); // initialise page $this->page = new OLIVPage(); // initialise preprocessor $this->processor = new OLIVProcessor(); // initialise renderer $this->render = new OLIVRender(); // ------------------------------------------------------------------------------ // set core status // ------------------------------------------------------------------------------ // extract command and value if (status::val()) { // extract cmd and param $cmdArray = explode("/", cut_slash(status::val())); // TODO define commands in system section ??? // search for command and retranslate if (count($cmdArray)) { $cmd = OLIVText::getId($cmdArray[0]); status::set('command', $cmd); // save command } // if command found, extract command from val if (count($cmdArray) > 1 and $cmd) { array_shift($cmdArray); // remove command from val status::set('val', implode("/", $cmdArray)); // save val } } // ------------------------------------------------------------------------------ // initialize clipboard // get content from clipboard parameter if ($clipboard = argv::clipboard()) { OLIVClipboard::_($clipboard); } // get clipboard from cut/copy command $command = status::command(); if ($command) { OLIVClipboard::$command(status::val()); } }
// governing rights and limitations. // // You should have received a copy of the GPL along with this // program. If not, go to http://www.gnu.org/licenses/gpl.html // or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // //------------------------------------------------------------------------------ // indexing class // // Version 0.1 //------------------------------------------------------------------------------ if (!system::OLIVCORE()) { die("index.php - OLIVCore not present"); } system::set('OLIVINDEX', "alive"); $_INDEX; class OLIVIndex { //------------------------------------------------------------------------------ // load index idx xml object public function __construct() { global $_INDEX; if (!($_INDEX = sessionxml_load_file("index.idx"))) { $_INDEX = new simpleXmlElement("<index><root/></index>"); } // echoall($_INDEX); } //------------------------------------------------------------------------------ // check if index has entries
// set val from friendly url if (array_key_exists('val', $pathInfo)) { status::set('val', $pathInfo['val']); } //------------------------------------------------------------------------------ // update clipboard //------------------------------------------------------------------------------ // language definition => loaded from argv //TODO // if not in parameters // look for HTTP_USER_AGENT // set to default language //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // from here all scrips are available system::set('OLIVENV', 'alive'); //------------------------------------------------------------------------------ // display noscript message ?> <noscript><div id="noscript">Kein Javascript</div></noscript> <?php //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ // login state // define USER for session if (array_key_exists('user', $_SESSION)) { $user = $_SESSION['user']; } else { $user = $_SESSION['user'] = ""; } // change user login state
// governing rights and limitations. // // You should have received a copy of the GPL along with this // program. If not, go to http://www.gnu.org/licenses/gpl.html // or write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // //------------------------------------------------------------------------------ // database class // // Version 0.1 //------------------------------------------------------------------------------ if (!system::OLIVCORE()) { die("database.php - OLIVCore not present"); } system::set('OLIVDABA', 'alive'); class OLIVDatabase { private $dbResource; private $sqlResource; private $name; private $prefix; private $insertId; private $relation; private $id; // create database // $database = simpleXmlElement(server,name,user,password) public function __construct($db) { $this->name = $db->getName(); // load relation list for table