public static function init() { $_SESSION[self::$sessionVariable] = new Session(); SysMessages::init(); if (!isset($_SESSION["DBData"])) { self::reloadDBData(); } Applications::init(); JSLoader::init(); if (!defined("PHYNX_VIA_INTERFACE")) { AppPlugins::init(); } }
public function scanPlugins($appFolder = null) { #file_put_contents(Util::getRootPath()."debug.txt", print_r(debug_backtrace(), true)); #echo "<pre>"; #print_r(); #echo "</pre>"; foreach ($this->appFolder as $key => $value) { if ($value == "plugins") { continue; } unset($this->menuEntries[array_search($key, $this->menuEntries)]); } #echo "scanning for plugins...<br />"; if ($appFolder == null) { $folder = "plugins"; if ($_SESSION["applications"]->getActiveApplication() != "nil") { $folder = $_SESSION["applications"]->getActiveApplication(); } } else { $folder = $appFolder; } $allowedPlugins = Environment::getS("allowedPlugins", array()); $extraPlugins = Environment::getS("pluginsExtra", array()); if (Applications::activeApplication() == "Zeus" or Applications::activeApplication() == "nil") { $extraPlugins = array(); } $allowedPlugins = array_merge($allowedPlugins, $extraPlugins); #$p = ".".(is_dir("./$folder/") ? "" : "."); $p = Util::getRootPath(); if ($p[strlen($p) - 1] == "/") { $p[strlen($p) - 1] = " "; } $p = trim($p); $_SESSION["messages"]->startMessage("checking for directory {$p}/{$folder}/: "); if (is_dir("{$p}/{$folder}/")) { $_SESSION["messages"]->endMessage("found"); $plugins = array(); $fp = opendir("{$p}/{$folder}/"); while (($file = readdir($fp)) !== false) { if ($file == "." or $file == "..") { continue; } if (is_dir("{$p}/{$folder}/{$file}")) { if (file_exists("{$p}/{$folder}/{$file}/plugin.xml")) { $file = "{$file}/plugin.xml"; } else { continue; } } if (stripos($file, "plugin") === false) { continue; } $plugins[] = $file; } sort($plugins); foreach ($plugins as $key => $file) { $f = explode(".", $file); if ($f[0][0] == "-") { continue; } if ($f[1] == "xml") { $c = new XMLPlugin("{$p}/{$folder}/{$file}", $allowedPlugins); } else { require_once "{$p}/{$folder}/{$file}"; $f = $f[0]; $c = new $f(); } $_SESSION["messages"]->startMessage("trying to register " . $c->registerName() . ": "); if (count($allowedPlugins) > 0 and !in_array($c->registerClassName(), $allowedPlugins)) { $_SESSION["messages"]->endMessage(" not allowed"); continue; } $pFolder = $c->registerFolder(); if (!is_array($pFolder)) { $this->folders[] = $pFolder; } else { foreach ($pFolder as $k => $v) { $this->folders[] = $v; } } $this->pluginToFolder[$c->registerClassName()] = $c->registerFolder(); $this->blockNonAdmin[$c->registerClassName()] = $c->registerBlockNonAdmin(); if ($c->registerMenuEntry() != "") { $this->menuEntries[$c->registerMenuEntry()] = $c->registerClassName(); } $this->appFolder[$c->registerClassName()] = $folder; if ($c->registerName() != "noName") { $this->classes[$c->registerName()] = $c->registerClassName(); } if ($c->registerName() != "noName" and $c->registerMenuEntryTarget() != "contentRight") { $this->targets[$c->registerClassName()] = $c->registerMenuEntryTarget(); } $this->icons[$c->registerClassName()] = $c->registerIcon(); if ($c->registerPluginIsAdminOnly()) { $this->isAdminOnlyByPlugin[$c->registerClassName()] = $c->registerPluginIsAdminOnly(); } elseif (!$c->registerPluginIsAdminOnly() and isset($this->isAdminOnlyByPlugin[$c->registerClassName()])) { unset($this->isAdminOnlyByPlugin[$c->registerClassName()]); } if ($c->registerDependencies() != "none") { $this->deps[$c->registerClassName()] = $c->registerDependencies(); } $this->versions[$c->registerClassName()] = $c->registerVersion(); if ($c->registerJavascriptFile() != "" and isset($_SESSION["JS"])) { if (is_array($c->registerJavascriptFile())) { foreach ($c->registerJavascriptFile() as $v) { JSLoader::addScriptS($v, $c->registerFolder(), $c->registerClassName(), $folder); } } else { JSLoader::addScriptS($c->registerJavascriptFile(), $c->registerFolder(), $c->registerClassName(), $folder); } } #if(method_exists($c, "registerUseGenericClasses")) # $this->isGeneric[$c->registerName()] = $c->registerUseGenericClasses(); #if(isset($this->isGeneric[$c->registerName()]) AND $this->isGeneric[$c->registerName()]){ # $this->collectors[$c->registerClassName()] = $c->registerName(); # $this->genericPlugins[$c->registerName()] = $c; #} $n = $c->registerClassName(); if ($n != "" and $appFolder == null) { try { $nc = new $n(); if (method_exists($nc, 'getCollectionOf')) { if (!isset($this->collectors[$c->registerClassName()])) { $this->collectors[$c->registerClassName()] = $nc->getCollectionOf(); } } } catch (ClassNotFoundException $e) { if ($n != "") { try { $n = $n . "GUI"; $nc = new $n(); if (method_exists($nc, 'getCollectionOf')) { if (!isset($this->collectors[$c->registerClassName()])) { $this->collectors[$c->registerClassName()] = $nc->getCollectionOf(); } } } catch (ClassNotFoundException $e2) { } } } } if ($f[1] == "xml") { $fld = $c->registerFolder(); if (!is_array($fld)) { $fld = array($fld); } foreach ($fld as $folderName) { $path = "./{$folder}/{$folderName}/" . $c->registerClassName() . ".class.php"; if (file_exists($path)) { require_once $path; } elseif (file_exists("." . $path)) { require_once "." . $path; } } } if ($appFolder == null) { $c->doSomethingElse(); } $_SESSION["messages"]->endMessage(" successful"); unset($c); } } else { $_SESSION["messages"]->endMessage("not found"); } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Booking</title> <meta name='description' content="" /> <meta name='keywords' content='' /> <link href='../css/common.css' rel='stylesheet' type='text/css' media='screen' /> <link href='css/design.css' rel='stylesheet' type='text/css' media='screen' /> <link rel='icon' type='image/png' href='../img/favicon.png'/> <script type='text/javascript' src='../js/jquery-1.11.js'></script> <?php echo JSLoader::loader($_SESSION['page']); ?> </head> <body> <header> <div id='header-top'> <div id='header-logo'> <a href='index.php'><img src='../img/logo.png' alt='logo' /></a> </div> <ul> <li><a href='index.php'>Panneau principal</a></li> <?php echo $optionsPratician; ?> <li><a href='index.php?p=alert'>Alertes (<?php echo AlertsManager::instance()->getNumberNewAlert($_SESSION['user']->getIdMember());