/** * @return AbstractConfDriver */ public function getConfImpl() { if (!isset(self::$confImpl) || isset($this->pluginConf["UNIQUE_INSTANCE_CONFIG"]["instance_name"]) && self::$confImpl->getId() != $this->pluginConf["UNIQUE_INSTANCE_CONFIG"]["instance_name"]) { if (isset($this->pluginConf["UNIQUE_INSTANCE_CONFIG"])) { self::$confImpl = ConfService::instanciatePluginFromGlobalParams($this->pluginConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver"); AJXP_PluginsService::getInstance()->setPluginUniqueActiveForType("conf", self::$confImpl->getName()); } } return self::$confImpl; }
/** * Initialise the driver. * * Expects options containing a key 'SQL_DRIVER' with constructor values from dibi::connect() * * Example: * "SQL_DRIVER" => Array( * 'driver' => 'sqlite', * 'file' => "./server/ajxp.db" * ) * * Example 2: * "SQL_DRIVER" => Array( * 'driver' => 'mysql', * 'host' => 'localhost', * 'username' => 'root', * 'password' => '***', * 'database' => 'dbname' * ) * * @see AbstractConfDriver#init($options) */ public function init($options) { parent::init($options); $this->sqlDriver = AJXP_Utils::cleanDibiDriverParameters($options["SQL_DRIVER"]); try { if (!dibi::isConnected()) { dibi::connect($this->sqlDriver); } if (AJXP_SERVER_DEBUG && AJXP_VERSION_DB != "##DB_VERSION##") { $res = dibi::query("select MAX(db_build) from [ajxp_version]"); if (!empty($res)) { $dbVersion = intval($res->fetchSingle()); $current = intval(AJXP_VERSION_DB); if ($dbVersion > 0 && $dbVersion < $current) { // We need to upgrade now! error_log("[Pydio] DB Upgrade Required! You may encounter strange issues. Make sure to manually apply the DB update."); $this->logError("[DB]", "DB Upgrade Required! You may encounter strange issues. Make sure to manually apply the DB update."); } } } } catch (DibiException $e) { //throw $e; echo get_class($e), ': ', $e->getMessage(), "\n"; exit(1); } }
function init($options) { parent::init($options); $this->repoSerialFile = $options["REPOSITORIES_FILEPATH"]; $this->usersSerialDir = $options["USERS_DIRPATH"]; $this->rolesSerialFile = $options["ROLES_FILEPATH"]; }
/** * Load plugin class with dependencies first * * @param AJXP_Plugin $plugin * @param array $pluginsPool */ private function recursiveLoadPlugin($plugin, $pluginsPool) { if ($plugin->loadingState != "") { return; } $dependencies = $plugin->getDependencies(); $plugin->loadingState = "lock"; foreach ($dependencies as $dependencyId) { if (isset($pluginsPool[$dependencyId])) { $this->recursiveLoadPlugin($pluginsPool[$dependencyId], $pluginsPool); } else { if (strpos($dependencyId, "+") !== false) { foreach (array_keys($pluginsPool) as $pId) { if (strpos($pId, str_replace("+", "", $dependencyId)) === 0) { $this->recursiveLoadPlugin($pluginsPool[$pId], $pluginsPool); } } } } } $plugType = $plugin->getType(); if (!isset($this->registry[$plugType])) { $this->registry[$plugType] = array(); } $options = $this->confStorage->loadPluginConfig($plugType, $plugin->getName()); if ($plugin->isEnabled() || isset($options["AJXP_PLUGIN_ENABLED"]) && $options["AJXP_PLUGIN_ENABLED"] === true) { $plugin = $this->instanciatePluginClass($plugin); } $plugin->loadConfigs($options); $this->registry[$plugType][$plugin->getName()] = $plugin; $plugin->loadingState = "loaded"; }
/** * Save Temporary Data. * Implementation uses serialised files because of the overhead incurred with a full db implementation. * * @param $key String key of data to save. * @param $value Value to save * @return null (AJXP_Utils::saveSerialFile() returns nothing) */ function saveTemporaryData($key, $value) { $dirPath = $this->storage->getOption("USERS_DIRPATH"); if ($dirPath == "") { $dirPath = AJXP_INSTALL_PATH . "/data/users"; AJXP_Logger::logAction("setTemporaryData", array("Warning" => "The conf.sql driver is missing a mandatory option USERS_DIRPATH!")); } return AJXP_Utils::saveSerialFile($dirPath . "/" . $this->getId() . "-temp-" . $key . ".ser", $value); }
public function init($options) { parent::init($options); $this->repoSerialFile = AJXP_VarsFilter::filter($this->options["REPOSITORIES_FILEPATH"]); $this->usersSerialDir = AJXP_VarsFilter::filter($this->options["USERS_DIRPATH"]); $this->rolesSerialFile = AJXP_VarsFilter::filter($this->options["ROLES_FILEPATH"]); $this->aliasesIndexFile = dirname($this->repoSerialFile) . "/aliases.ser"; $this->pluginsConfigsFile = dirname($this->repoSerialFile) . "/plugins_configs.ser"; }
/** * Save Temporary Data. * Implementation uses serialised files because of the overhead incurred with a full db implementation. * * @param $key String key of data to save. * @param $value Value to save */ public function saveTemporaryData($key, $value) { $dirPath = $this->storage->getOption("USERS_DIRPATH"); if ($dirPath == "") { $dirPath = AJXP_INSTALL_PATH . "/data/users"; AJXP_Logger::info(__CLASS__, "setTemporaryData", array("Warning" => "The conf.sql driver is missing a mandatory option USERS_DIRPATH!")); } $id = AuthService::ignoreUserCase() ? strtolower($this->getId()) : $this->getId(); AJXP_Utils::saveSerialFile($dirPath . "/" . $id . "/temp-" . $key . ".ser", $value); }
/** * Initialise the driver. * * Expects options containing a key 'SQL_DRIVER' with constructor values from dibi::connect() * * Example: * "SQL_DRIVER" => Array( * 'driver' => 'sqlite', * 'file' => "./server/ajxp.db" * ) * * Example 2: * "SQL_DRIVER" => Array( * 'driver' => 'mysql', * 'host' => 'localhost', * 'username' => 'root', * 'password' => '***', * 'database' => 'dbname' * ) * * @see server/classes/AbstractConfDriver#init($options) */ function init($options) { parent::init($options); $this->sqlDriver = $options["SQL_DRIVER"]; try { dibi::connect($this->sqlDriver); } catch (DibiException $e) { echo get_class($e), ': ', $e->getMessage(), "\n"; exit(1); } }
public function loadManifest() { parent::loadManifest(); if (!AJXP_Utils::detectApplicationFirstRun()) { $actions = $this->xPath->query("server_settings|registry_contributions"); foreach ($actions as $ac) { $ac->parentNode->removeChild($ac); } $this->reloadXPath(); } }
public function reloadRolesIfRequired() { if ($this->lastSessionSerialization && count($this->roles) && $this->storage->rolesLastUpdated(array_keys($this->roles)) > $this->lastSessionSerialization) { $newRoles = AuthService::getRolesList(array_keys($this->roles)); foreach ($newRoles as $rId => $newRole) { $this->roles[$rId] = $newRoles[$rId]; } $this->recomputeMergedRole(); return true; } return false; }
/** * Initialise the driver. * * Expects options containing a key 'SQL_DRIVER' with constructor values from dibi::connect() * * Example: * "SQL_DRIVER" => Array( * 'driver' => 'sqlite', * 'file' => "./server/ajxp.db" * ) * * Example 2: * "SQL_DRIVER" => Array( * 'driver' => 'mysql', * 'host' => 'localhost', * 'username' => 'root', * 'password' => '***', * 'database' => 'dbname' * ) * * @see AbstractConfDriver#init($options) */ public function init($options) { parent::init($options); $this->sqlDriver = AJXP_Utils::cleanDibiDriverParameters($options["SQL_DRIVER"]); try { dibi::connect($this->sqlDriver); } catch (DibiException $e) { //throw $e; echo get_class($e), ': ', $e->getMessage(), "\n"; exit(1); } }
/** * Initialise the driver. * * Expects options containing a key 'SQL_DRIVER' with constructor values from dibi::connect() * * Example: * "SQL_DRIVER" => Array( * 'driver' => 'sqlite', * 'file' => "./server/ajxp.db" * ) * * Example 2: * "SQL_DRIVER" => Array( * 'driver' => 'mysql', * 'host' => 'localhost', * 'username' => 'root', * 'password' => '***', * 'database' => 'dbname' * ) * * @see AbstractConfDriver#init($options) */ function init($options) { parent::init($options); require_once AJXP_BIN_FOLDER . "/dibi.compact.php"; $this->sqlDriver = $options["SQL_DRIVER"]; try { dibi::connect($this->sqlDriver); } catch (DibiException $e) { echo get_class($e), ': ', $e->getMessage(), "\n"; exit(1); } }
/** * Load plugin class with dependencies first * * @param AJXP_Plugin $plugin * @param array $pluginsPool */ private function recursiveLoadPlugin($plugin, $pluginsPool) { if ($plugin->loadingState != "") { return; } $dependencies = $plugin->getDependencies(); $plugin->loadingState = "lock"; foreach ($dependencies as $dependencyId) { if (isset($pluginsPool[$dependencyId])) { $this->recursiveLoadPlugin($pluginsPool[$dependencyId], $pluginsPool); } } $plugType = $plugin->getType(); if (!isset($this->registry[$plugType])) { $this->registry[$plugType] = array(); } $plugin = $this->instanciatePluginClass($plugin); $options = $this->confStorage->loadPluginConfig($plugType, $plugin->getName()); $plugin->loadConfigs($options); $this->registry[$plugType][$plugin->getName()] = $plugin; $plugin->loadingState = "loaded"; }
function saveTemporaryData($key, $value) { $fastCheck = $this->storage->getOption("FAST_CHECKS"); $fastCheck = $fastCheck == "true" || $fastCheck == true; return AJXP_Utils::saveSerialFile($this->storage->getOption("USERS_DIRPATH") . "/" . $this->getId() . "/" . $key . ".ser", $value, !$fastCheck); }
/** * Update the plugins parameters. OptionsLinks can be an array associating keys of $data * to pluginID/plugin_parameter_name * * @param AbstractConfDriver $confDriver * @param array $data * @param null|array $optionsLinks */ public function feedPluginsOptions($confDriver, $data, $optionsLinks = null) { if (isset($optionsLinks)) { $direct = $optionsLinks; } else { $data["ENABLE_NOTIF"] = true; // Prepare plugins configs $direct = array("APPLICATION_TITLE" => "core.ajaxplorer/APPLICATION_TITLE", "APPLICATION_LANGUAGE" => "core.ajaxplorer/DEFAULT_LANGUAGE", "ENABLE_NOTIF" => "core.notifications/USER_EVENTS", "APPLICATION_WELCOME" => "gui.ajax/CUSTOM_WELCOME_MESSAGE"); $mailerEnabled = $data["MAILER_ENABLE"]["status"]; if ($mailerEnabled == "yes") { // Enable core.mailer $data["MAILER_SYSTEM"] = $data["MAILER_ENABLE"]["MAILER_SYSTEM"]; $data["MAILER_ADMIN"] = $data["MAILER_ENABLE"]["MAILER_ADMIN"]; $direct = array_merge($direct, array("MAILER_SYSTEM" => "mailer.phpmailer-lite/MAILER", "MAILER_ADMIN" => "core.mailer/FROM")); } } foreach ($direct as $key => $value) { list($pluginId, $param) = explode("/", $value); $options = array(); $confDriver->_loadPluginConfig($pluginId, $options); $options[$param] = $data[$key]; $confDriver->_savePluginConfig($pluginId, $options); } }
function saveTemporaryData($key, $value) { return AJXP_Utils::saveSerialFile($this->storage->getOption("USERS_DIRPATH") . "/" . $this->getId() . "/" . $key . ".ser", $value); }
public function saveTemporaryData($key, $value) { $fastCheck = $this->storage->getOption("FAST_CHECKS"); $fastCheck = $fastCheck == "true" || $fastCheck == true; AJXP_Utils::saveSerialFile($this->getStoragePath() . "/" . $key . ".ser", $value, !$fastCheck); }