function install() { if (self::$key === null) { $cryptokey = \Defuse\Crypto\Key::createNewRandomKey(); self::$key = $cryptokey->saveToAsciiSafeString(); } $authconfig = $this->getConfigIni()->getValue('auth', 'coordplugins'); $authconfigMaster = $this->getLocalConfigIni()->getValue('auth', 'coordplugins'); $forWS = in_array($this->entryPoint->type, array('json', 'jsonrpc', 'soap', 'xmlrpc')); if (!$authconfig || $forWS && $authconfig == $authconfigMaster) { if ($forWS) { $pluginIni = 'authsw.coord.ini.php'; } else { $pluginIni = 'auth.coord.ini.php'; } $authconfig = dirname($this->entryPoint->getConfigFile()) . '/' . $pluginIni; if ($this->firstExec('auth:' . $authconfig)) { // no configuration, let's install the plugin for the entry point $this->config->setValue('auth', $authconfig, 'coordplugins'); if (!file_exists(jApp::configPath($authconfig))) { $this->copyFile('var/config/' . $pluginIni, jApp::configPath($authconfig)); } } } $this->getLocalConfigIni()->setValue('persistant_encryption_key', self::$key, 'coordplugin_auth'); }
function install() { // installer le CSS $cssFile = jApp::wwwPath('css/localiz.css'); if (!file_exists($cssFile)) { $this->copyFile('css/localiz.css', $cssFile); } // installer le JS $jsFile = jApp::wwwPath('js/localiz.js'); if (!file_exists($jsFile)) { $this->copyFile('js/localiz.js', $jsFile); } // conf DB $localConfFile = jApp::configPath('localconfig.ini.php'); if (file_exists($localConfFile)) { $ini = new jIniFileModifier($localConfFile); $ini->setValue('db_driver', 'pgsql', 'localiz_plugin'); $ini->setValue('db_host', 'pgpool', 'localiz_plugin'); $ini->setValue('db_port', '5432', 'localiz_plugin'); $ini->setValue('db_database', 'refgeo2', 'localiz_plugin'); $ini->setValue('db_user', 'visu', 'localiz_plugin'); $ini->setValue('db_password', 'visu', 'localiz_plugin'); $ini->setValue('db_query', "select oid, geometrytype, value, label, longlabel, xmin, ymin, xmax, ymax from MYTABLE where label like '%s%%'", 'localiz_plugin'); /* Ex with plain text search "select oid, typcode, geometrytype(geom) as geometrytype, code as value, lib || complement as label, typ || ' ' || lib || complement || ' (' || code || ')' as longlabel, st_xmin(st_transform(bbox, 4326)) xmin, st_ymin(st_transform(bbox, 4326)) ymin, st_xmax(st_transform(bbox, 4326)) xmax, st_ymax(st_transform(bbox, 4326)) ymax from services.ref_search where (v @@ to_tsquery('fr', regexp_replace('%1$s', '\\s+', '&', 'g')) ) order by st_area(bbox) desc" */ $ini->save(); } }
function install() { if (self::$key === null) { self::$key = jAuth::getRandomPassword(30, true); } $authconfig = $this->config->getValue('auth', 'coordplugins'); $authconfigMaster = $this->config->getValue('auth', 'coordplugins', null, true); $forWS = in_array($this->entryPoint->type, array('json', 'jsonrpc', 'soap', 'xmlrpc')); if (!$authconfig || $forWS && $authconfig == $authconfigMaster) { if ($forWS) { $pluginIni = 'authsw.coord.ini.php'; } else { $pluginIni = 'auth.coord.ini.php'; } $authconfig = dirname($this->entryPoint->configFile) . '/' . $pluginIni; if ($this->firstExec('auth:' . $authconfig)) { // no configuration, let's install the plugin for the entry point $this->config->setValue('auth', $authconfig, 'coordplugins'); if (!file_exists(jApp::configPath($authconfig))) { $this->copyFile('var/config/' . $pluginIni, jApp::configPath($authconfig)); } } } $localConfigIni = $this->entryPoint->localConfigIni; $key = $localConfigIni->getValue('persistant_crypt_key', 'coordplugin_auth'); if ($key === 'exampleOfCryptKey' || $key == '') { $localConfigIni->getMaster()->setValue('persistant_crypt_key', self::$key, 'coordplugin_auth'); } }
/** * get the menus to be added inside the ohers menu item * @return $menus array of menus */ public function getMenus() { $menus = array(); if (file_exists(jApp::configPath() . '/havefnubb/hfnumenus.xml')) { $doc = new DOMDocument(); $doc->load(realpath(jApp::configPath()) . '/havefnubb/hfnumenus.xml'); $xpath = new DOMXPath($doc); $query = '/menus/menu'; $entries = $xpath->query($query); $gJConfig = jApp::config(); foreach ($entries as $idx => $menu) { $queryName = '//name[@lang="' . $gJConfig->locale . '"]'; $items = $xpath->query($queryName); $name = $items->item($idx)->nodeValue; $queryItemName = '//menu/itemName'; $items = $xpath->query($queryItemName); $itemName = $items->item($idx)->nodeValue; $queryUrl = '//menu/url'; $items = $xpath->query($queryUrl); $url = $items->item($idx)->nodeValue; $queryOrder = '//menu/order'; $items = $xpath->query($queryOrder); $order = $items->item($idx)->nodeValue; $menus[] = array('itemName' => $itemName, 'name' => $name, 'url' => $url, 'order' => $order); } } return $menus; }
/** * action to process the page after the submit */ function process() { $configFile = jApp::configPath('localconfig.ini.php'); if (!file_exists($configFile)) { copy(jApp::configPath('localconfig.ini.php.dist'), $configFile); } $ini = new jIniFileModifier($configFile); $_SESSION['installdemo'] = $_POST['installdemo'] == 'on'; $parameters = $ini->getValue('lizmap.installparam', 'modules'); if ($parameters === null) { $parameters = ''; } if (strpos($parameters, 'demo') === false) { if ($_SESSION['installdemo']) { $parameters .= trim($parameters) == '' ? 'demo' : ',demo'; } } else { if (!$_SESSION['installdemo']) { $parameters = str_replace('demo', '', $parameters); } } $ini->setValue('lizmap.installparam', $parameters, 'modules'); $ini->save(); unset($_SESSION['installdemo']); return 0; }
/** * Main page */ public function index() { $submit = $this->param('validate'); if ($submit == jLocale::get('hfnucontact~contact.form.saveBt')) { $form = jForms::fill('hfnucontact~admincontact'); $rep = $this->getResponse('redirect'); if (!$form->check()) { $rep->action = 'hfnucontact~admin:index'; return $rep; } $HfnucontactConfig = new jIniFileModifier(jApp::configPath('defaultconfig.ini.php')); $HfnucontactConfig->setValue('email_contact', $this->param('contact'), 'hfnucontact'); $HfnucontactConfig->save(); jMessage::add(jLocale::get('hfnucontact~contact.admin.form.email.saved'), 'ok'); jForms::destroy('hfnucontact~admincontact'); $rep->action = 'hfnucontact~admin:index'; return $rep; } else { $form = jForms::create('hfnucontact~admincontact'); } $form->setData('contact', jApp::config()->hfnucontact['email_contact']); $rep = $this->getResponse('html'); $tpl = new jTpl(); $tpl->assign('form', $form); $rep->body->assign('MAIN', $tpl->fetch('hfnucontact~admincontact')); $rep->body->assign('selectedMenuItem', 'contact'); return $rep; }
function install() { if (!$this->firstDbExec()) { return; } // --- install table for session storage if needed $sessionStorage = $this->config->getValue("storage", "sessions"); $sessionDao = $this->config->getValue("dao_selector", "sessions"); $sessionProfile = $this->config->getValue("dao_db_profile", "sessions"); if ($sessionStorage == "dao" && $sessionDao == "jelix~jsession") { $this->execSQLScript('sql/install_jsession.schema'); } // --- install table for jCache if needed $cachefile = jApp::configPath('profiles.ini.php'); if (file_exists($cachefile)) { $ini = new \Jelix\IniFile\IniModifier($cachefile); foreach ($ini->getSectionList() as $section) { if (substr($section, 0, 7) != 'jcache:') { continue; } $driver = $ini->getValue('driver', $section); $dao = $ini->getValue('dao', $section); $this->useDbProfile($ini->getValue('dbprofile', $section)); if ($driver == 'db' && $dao == 'jelix~jcache' && $this->firstExec('cachedb:' . $this->dbProfile)) { $this->execSQLScript('sql/install_jcache.schema'); } } } }
function testContext() { $appPath = jApp::appPath(); $varPath = jApp::varPath(); $logPath = jApp::logPath(); $configPath = jApp::configPath(); $wwwPath = jApp::wwwPath(); $scriptsPath = jApp::scriptsPath(); $tempPath = jApp::tempPath(); // first save jApp::saveContext(); // verify that we still have the current path $this->assertEquals($appPath, jApp::appPath()); $this->assertEquals($varPath, jApp::varPath()); $this->assertEquals($logPath, jApp::logPath()); $this->assertEquals($configPath, jApp::configPath()); $this->assertEquals($wwwPath, jApp::wwwPath()); $this->assertEquals($scriptsPath, jApp::scriptsPath()); $this->assertEquals($tempPath, jApp::tempPath()); // change the path jApp::initPaths('/myapp/'); $this->assertEquals('/myapp/', jApp::appPath()); $this->assertEquals('/myapp/var/', jApp::varPath()); $this->assertEquals('/myapp/var/log/', jApp::logPath()); $this->assertEquals('/myapp/var/config/', jApp::configPath()); $this->assertEquals('/myapp/www/', jApp::wwwPath()); $this->assertEquals('/myapp/scripts/', jApp::scriptsPath()); $this->assertEquals($tempPath, jApp::tempPath()); // second save jApp::saveContext(); jApp::initPaths('/myapp2/'); $this->assertEquals('/myapp2/', jApp::appPath()); $this->assertEquals('/myapp2/var/', jApp::varPath()); $this->assertEquals('/myapp2/var/log/', jApp::logPath()); $this->assertEquals('/myapp2/var/config/', jApp::configPath()); $this->assertEquals('/myapp2/www/', jApp::wwwPath()); $this->assertEquals('/myapp2/scripts/', jApp::scriptsPath()); $this->assertEquals($tempPath, jApp::tempPath()); // pop the second save, we should be with the first saved values jApp::restoreContext(); $this->assertEquals('/myapp/', jApp::appPath()); $this->assertEquals('/myapp/var/', jApp::varPath()); $this->assertEquals('/myapp/var/log/', jApp::logPath()); $this->assertEquals('/myapp/var/config/', jApp::configPath()); $this->assertEquals('/myapp/www/', jApp::wwwPath()); $this->assertEquals('/myapp/scripts/', jApp::scriptsPath()); $this->assertEquals($tempPath, jApp::tempPath()); // pop the first save, we should be with initial paths jApp::restoreContext(); $this->assertEquals($appPath, jApp::appPath()); $this->assertEquals($varPath, jApp::varPath()); $this->assertEquals($logPath, jApp::logPath()); $this->assertEquals($configPath, jApp::configPath()); $this->assertEquals($wwwPath, jApp::wwwPath()); $this->assertEquals($scriptsPath, jApp::scriptsPath()); $this->assertEquals($tempPath, jApp::tempPath()); }
function install() { if ($this->firstExec('cacheqgis')) { $profiles = new jIniFileModifier(jApp::configPath('profiles.ini.php')); if (!$profiles->isSection('jcache:qgisprojects')) { $profiles->setValues(array('enabled' => 1, 'driver' => 'file', 'ttl' => 0), 'jcache:qgisprojects'); $profiles->save(); } } }
function getTests() { $conf = parse_ini_file(jApp::configPath() . 'profiles.ini.php', true); if (isset($conf['jkvdb:' . $this->profile])) { return parent::getTests(); } else { $this->sendMessage('UTjKVDb cannot be run with ' . $this->profile . ' : undefined profile'); return array(); } }
/** * initialize the application paths * * Warning: given paths should be ended by a directory separator. * @param string $appPath application directory * @param string $wwwPath www directory * @param string $varPath var directory * @param string $logPath log directory * @param string $configPath config directory * @param string $scriptPath scripts directory */ public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null) { self::$appPath = $appPath; self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath; self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath; self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath; self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath; self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath; self::$_isInit = true; }
/** * @param jIniFileModifier $mainConfig the mainconfig.ini.php file * @param string $configFile the path of the configuration file, relative * to the var/config directory * @param string $file the filename of the entry point * @param string $type type of the entry point ('classic', 'cli', 'xmlrpc'....) */ function __construct($mainConfig, $configFile, $file, $type) { $this->type = $type; $this->isCliScript = $type == 'cmdline'; $this->configFile = $configFile; $this->scriptName = $this->isCliScript ? $file : '/' . $file; $this->file = $file; $this->configIni = new jIniMultiFilesModifier($mainConfig, jApp::configPath($configFile)); $this->config = jConfigCompiler::read($configFile, true, $this->isCliScript, $this->scriptName); }
public function setUp() { $conf = parse_ini_file(jApp::configPath() . 'auth_class.coord.ini.php', true); global $gJCoord; require_once JELIX_LIB_PATH . 'plugins/coord/auth/auth.coord.php'; if (isset($gJCoord->plugins['auth'])) { $this->oldAuthPlugin = $gJCoord->plugins['auth']; } $gJCoord->plugins['auth'] = new AuthCoordPlugin($conf); $this->config =& $gJCoord->plugins['auth']->config; $_SESSION[$this->config['session_name']] = new jAuthDummyUser(); jAuth::login('laurent', 'foo', false); }
function install() { $doc = new DOMDocument(); $doc->Load(dirname(__FILE__) . '/../module.xml'); $xpath = new DOMXPath($doc); $xpath->registerNamespace('jelix', "http://jelix.org/ns/module/1.0"); $query = "//jelix:module/jelix:info/jelix:version/text()"; $entries = $xpath->evaluate($query); $version = $entries->item(0)->nodeValue; $ini = new jIniFileModifier(jApp::configPath() . 'defaultconfig.ini.php'); $ini->setValue('version', $version, 'havefnubb'); $ini->save(); }
public function setUp() { if (!file_exists(jApp::configPath() . 'auth_ldap.coord.ini.php')) { $this->config = null; return; } $conf = parse_ini_file(jApp::configPath() . 'auth_ldap.coord.ini.php', true); global $gJCoord; require_once JELIX_LIB_PATH . 'plugins/coord/auth/auth.coord.php'; $gJCoord->plugins['auth'] = new AuthCoordPlugin($conf); $this->config =& $gJCoord->plugins['auth']->config; $_SESSION[$this->config['session_name']] = new jAuthDummyUser(); }
function onHfnuSearchEngineRun($event) { $HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true); $cleaner = jClasses::getService('hfnusearch~cleaner'); $words = $cleaner->stemPhrase($event->getParam('string')); $nb_words = count($words); // no words ; go back with nothing :P if (!$words) { return array('count' => 0, 'result' => array()); } $service = jClasses::getService($HfnuSearchConfig['classToPerformSearchEngine']); $result = $service->searchEngineRun($event); }
/** * Let use one of the available theme */ function useit() { $theme = (string) $this->param('theme'); $mainConfig = new jIniFileModifier(jApp::configPath() . 'defaultconfig.ini.php'); $mainConfig->setValue('theme', strtolower($theme)); $mainConfig->setValue('datepicker', strtolower($theme), 'forms'); $mainConfig->save(); jFile::removeDir(jApp::tempPath(), false); jMessage::add(jLocale::get('theme.selected'), 'information'); $rep = $this->getResponse('redirect'); $rep->action = 'default:index'; return $rep; }
function getTests() { if ($this->profile == '') { return array(); } $conf = parse_ini_file(jApp::configPath() . 'profiles.ini.php', true); if (isset($conf['jcache:' . $this->profile]) && $conf['jcache:' . $this->profile]['enabled']) { $this->conf = $conf['jcache:' . $this->profile]; return parent::getTests(); } else { $this->sendMessage('UTjCacheAPI cannot be run with ' . $this->profile . ': undefined profile'); return array(); } }
/** * set default parameters for Minify */ static function initOptions() { global $min_allowDebugFlag; global $min_errorLogger; global $min_enableBuilder; global $min_cachePath; global $min_documentRoot; global $min_cacheFileLocking; global $min_symlinks; global $min_serveOptions; global $min_uploaderHoursBehind; global $min_customConfigPaths; if (!isset($min_allowDebugFlag)) { $min_allowDebugFlag = false; } if (!isset($min_errorLogger)) { $min_errorLogger = false; } $min_enableBuilder = false; $min_cachePath = \jApp::tempPath('minify/'); if (!file_exists($min_cachePath)) { mkdir($min_cachePath, 0775); } if (!isset($min_documentRoot)) { $min_documentRoot = self::getDocumentRoot(); } if (!isset($min_cacheFileLocking)) { $min_cacheFileLocking = true; } if (!isset($min_serveOptions['bubbleCssImports'])) { $min_serveOptions['bubbleCssImports'] = false; } if (!isset($min_serveOptions['maxAge'])) { $min_serveOptions['maxAge'] = 1800; } $min_serveOptions['minApp']['groupsOnly'] = false; if (!isset($min_serveOptions['minApp']['maxFiles'])) { $min_serveOptions['minApp']['maxFiles'] = 10; } if (!isset($min_symlinks)) { $min_symlinks = array(); } if (!isset($min_uploaderHoursBehind)) { $min_uploaderHoursBehind = 0; } if (!isset($min_customConfigPaths)) { $min_customConfigPaths = array('groups' => \jApp::configPath('minifyGroupsConfig.php')); } ini_set('zlib.output_compression', '0'); }
function install() { $authconfig = $this->config->getValue('auth', 'coordplugins'); if ($authconfig && $this->entryPoint->type != 'cmdline' && $this->firstExec($authconfig)) { $conf = new jIniFileModifier(jApp::configPath($authconfig)); $driver = $conf->getValue('driver'); $daoName = $conf->getValue('dao', 'Db'); $formName = $conf->getValue('form', 'Db'); if ($driver == 'Db' && $daoName == 'jauthdb~jelixuser' && $formName == '') { $conf->setValue('form', 'jauthdb_admin~jelixuser', 'Db'); $conf->save(); } } }
/** * initialize the application paths * * Warning: given paths should be ended by a directory separator. * @param string $appPath application directory * @param string $wwwPath www directory * @param string $varPath var directory * @param string $logPath log directory * @param string $configPath config directory * @param string $scriptPath scripts directory */ public static function initPaths($appPath, $wwwPath = null, $varPath = null, $logPath = null, $configPath = null, $scriptPath = null) { self::$appPath = $appPath; self::$wwwPath = is_null($wwwPath) ? $appPath . 'www/' : $wwwPath; self::$varPath = is_null($varPath) ? $appPath . 'var/' : $varPath; self::$logPath = is_null($logPath) ? self::$varPath . 'log/' : $logPath; self::$configPath = is_null($configPath) ? self::$varPath . 'config/' : $configPath; self::$scriptPath = is_null($scriptPath) ? $appPath . 'scripts/' : $scriptPath; self::$_isInit = true; self::$_coord = null; self::$_config = null; self::$configAutoloader = null; self::$_mainConfigFile = null; }
/** * default searchEngineRun methode which make a search from the engine by querying the table define in the dao of the hfnusearch.ini.php file * @param object $event */ function searchEngineRun($event) { $cleaner = jClasses::getService('hfnusearch~cleaner'); $words = $cleaner->stemPhrase($event->getParam('string')); $page = (int) $event->getParam('page'); $limit = (int) $event->getParam('limit'); $id_forum = (int) $event->getParam('id_forum'); // no words ; go back with nothing :P if (!$words) { return array('count' => 0, 'result' => array()); } //1) open the config file $HfnuSearchConfig = parse_ini_file(jApp::configPath() . 'havefnu.search.ini.php', true); //2) get the dao we want to read $dataSource = $HfnuSearchConfig['dao']; //3) build an array with each one $dataSources = preg_split('/,/', $dataSource); foreach ($dataSources as $ds) { //4) get a factory of the current DAO $dao = jDao::get($ds); //getting the column name on which we need to make the query $indexSubject = $HfnuSearchConfig[$ds]['index_subject']; $indexMessage = $HfnuSearchConfig[$ds]['index_message']; //5) get all the record $conditions = jDao::createConditions(); $conditions->startGroup('OR'); if ($id_forum > 0) { $conditions->addCondition('id_forum', '=', $id_forum); } foreach ($words as $word) { $conditions->addCondition($indexSubject, 'LIKE', '%' . $word . '%'); $conditions->addCondition($indexMessage, 'LIKE', '%' . $word . '%'); } $conditions->endGroup(); $allRecord = $dao->findBy($conditions); if ($page > 0 and $limit > 0) { $record = $dao->findBy($conditions, $page, $limit); } else { $record = $allRecord; } foreach ($record as $rec) { if (jAcl2::check('hfnu.admin.post')) { $event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount())); } elseif (jAcl2::check('hfnu.forum.view', 'forum' . $rec->id_forum) and $rec->status < 7) { $event->Add(array('SearchEngineResult' => $rec, 'SearchEngineResultTotal' => $allRecord->rowCount())); } } } }
/** * */ function search() { $localConfig = jApp::configPath('localconfig.ini.php'); $ini = new jIniFileModifier($localConfig); $jdbParams = array("driver" => $ini->getValue('db_driver', 'localiz_plugin') ?: 'pgsql', "host" => $ini->getValue('db_host', 'localiz_plugin'), "port" => $ini->getValue('db_port', 'localiz_plugin') ?: 5432, "database" => $ini->getValue('db_database', 'localiz_plugin'), "user" => $ini->getValue('db_user', 'localiz_plugin') ?: 'postgres', "password" => $ini->getValue('db_password', 'localiz_plugin')); jProfiles::createVirtualProfile('jdb', 'localiz_plugin', $jdbParams); $cnx = jDb::getConnection('localiz_plugin'); $sql = sprintf($ini->getValue('db_query', 'localiz_plugin'), $this->param('term')); $res = $cnx->query($sql); $rep = $this->getResponse('json'); $rep->data = array(); foreach ($res as $record) { $rep->data[] = array('oid' => $record->oid, 'typcode' => $record->typcode, 'value' => $record->value, 'label' => $record->label, 'longlabel' => $record->longlabel, 'geometrytype' => $record->geometrytype, 'xmin' => $record->xmin, 'ymin' => $record->ymin, 'xmax' => $record->xmax, 'ymax' => $record->ymax); } return $rep; }
/** * save the global configuration data. */ public function save() { // Get access to the ini file $iniFile = jApp::configPath('lizmapLogConfig.ini.php'); $ini = new jIniFileModifier($iniFile); foreach ($this->properties as $prop) { if ($this->{$prop} != '') { $ini->setValue($prop, $this->{$prop}, 'general'); } else { $ini->removeValue($prop, 'general'); } } // Save the ini file $ini->save(); return $ini->isModified(); }
protected function _upgradeconf($module) { $conf = null; // get from entrypoint config $jacl2File = $this->getConfigIni()->getOverrider()->getValue($module, 'coordplugins'); if ($jacl2File == '') { // get from localConfig.ini.php $jacl2File = $this->getLocalConfigIni()->getOverrider()->getValue($module, 'coordplugins'); if ($jacl2File == '') { // get from mainConfig.ini.php $jacl2File = $this->getMainConfigIni()->getOverrider()->getValue($module, 'coordplugins'); $conf = $this->getMainConfigIni()->getOverrider(); } else { $conf = $this->getLocalConfigIni()->getOverrider(); } } else { $conf = $this->getConfigIni()->getOverrider(); } if ($jacl2File == '' || $jacl2File == '1') { return; } $jacl2File = jApp::configPath($jacl2File); if (!file_exists($jacl2File)) { $jacl2File = ''; $message = $module . "~errors.action.right.needed"; if ($this->entryPoint->type != 'classic') { $onerror = 1; } else { $onerror = 2; } $on_error_action = "jelix~error:badright"; } else { $ini = new \Jelix\IniFile\IniModifier($jacl2File); $message = $ini->getValue('error_message'); // = '); if ($message == "jelix~errors.acl.action.right.needed") { $message = $module . "~errors.action.right.needed"; } $onerror = $ini->getValue('on_error'); $on_error_action = $ini->getValue('on_error_action'); } $conf->setValue($module, '1', 'coordplugins'); $conf->setValue('on_error', $onerror, 'coordplugin_' . $module); $conf->setValue('error_message', $message, 'coordplugin_' . $module); $conf->setValue('on_error_action', $on_error_action, 'coordplugin_' . $module); $conf->save(); }
function install() { if (self::$key === null) { self::$key = jAuth::getRandomPassword(30, true); } $conf = $this->config->getValue('auth', 'coordplugins'); if ($conf != '1') { $conff = jApp::configPath($conf); if (file_exists($conff)) { $ini = new jIniFileModifier($conff); $ini->removeValue('persistant_crypt_key'); $ini->save(); } } $localConfigIni = $this->entryPoint->localConfigIni; $localConfigIni->getMaster()->setValue('persistant_crypt_key', self::$key, 'coordplugin_auth'); }
/** * load and read the configuration of the application * The combination of all configuration files (the given file * and the mainconfig.ini.php) is stored * in a single temporary file. So it calls the jConfigCompiler * class if needed * @param string $configFile the config file name * @return object it contains all configuration options * @see jConfigCompiler */ public static function load($configFile) { $config = array(); $file = jApp::tempPath() . str_replace('/', '~', $configFile); if (BYTECODE_CACHE_EXISTS) { $file .= '.conf.php'; } else { $file .= '.resultini.php'; } self::$fromCache = true; if (!file_exists($file)) { // no cache, let's compile self::$fromCache = false; } else { $t = filemtime($file); $dc = jApp::mainConfigFile(); $lc = jApp::configPath('localconfig.ini.php'); if (file_exists($dc) && filemtime($dc) > $t || filemtime(jApp::configPath($configFile)) > $t || file_exists($lc) && filemtime($lc) > $t) { // one of the config files have been modified: let's compile self::$fromCache = false; } else { // let's read the cache file if (BYTECODE_CACHE_EXISTS) { include $file; $config = (object) $config; } else { $config = jelix_read_ini($file); } // we check all directories to see if it has been modified if ($config->compilation['checkCacheFiletime']) { foreach ($config->_allBasePath as $path) { if (!file_exists($path) || filemtime($path) > $t) { self::$fromCache = false; break; } } } } } if (!self::$fromCache) { require_once JELIX_LIB_CORE_PATH . 'jConfigCompiler.class.php'; return jConfigCompiler::readAndCache($configFile); } else { return $config; } }
function install() { if ($this->entryPoint->type == 'cmdline') { return; } $aclconfig = $this->config->getValue('jacl2', 'coordplugins'); $aclconfigMaster = $this->config->getValue('jacl2', 'coordplugins', null, true); $forWS = in_array($this->entryPoint->type, array('json', 'jsonrpc', 'soap', 'xmlrpc')); $ownConfig = false; if (!$aclconfig || $forWS && $aclconfigMaster == $aclconfig) { $pluginIni = 'jacl2.coord.ini.php'; $configDir = dirname($this->entryPoint->configFile) . '/'; $ownConfig = true; $aclconfig = $configDir . $pluginIni; if ($this->firstExec('jacl2:' . $aclconfig)) { // no configuration, let's install the plugin for the entry point $this->config->setValue('jacl2', $aclconfig, 'coordplugins'); if (!file_exists(jApp::configPath($aclconfig))) { $this->copyFile('var/config/' . $pluginIni, jApp::configPath($aclconfig)); } } } if ($forWS && $ownConfig && $this->firstExec('jacl2:' . $aclconfig)) { $cf = new jIniFileModifier(jApp::configPath($aclconfig)); $cf->setValue('on_error', 1); $cf->save(); } $this->declarePluginsPath('module:jacl2db'); if (!$this->firstDbExec()) { return; } $this->declareDbProfile('jacl2_profile', null, false); $driver = $this->config->getValue('driver', 'acl2'); if ($driver != 'db') { $this->config->setValue('driver', 'db', 'acl2'); } $this->execSQLScript('install_jacl2.schema'); $this->execSQLScript('data.sql'); if ($this->getParameter('defaultuser') || $this->getParameter('defaultgroups')) { // declare some groups $this->execSQLScript('groups.sql'); } if ($this->getParameter('defaultuser')) { $this->execSQLScript('user.sql'); } }
protected function _prepareTpl() { $lang = jApp::config()->locale; if (!$this->param('no_lang_check')) { $locale = jLocale::getPreferedLocaleFromRequest(); if (!$locale) { $locale = 'en_US'; } jApp::config()->locale = $locale; } $messages = new \Jelix\Installer\Checker\Messages($lang); $reporter = new \Jelix\Installer\Reporter\HtmlBuffer($messages); $check = new \Jelix\Installer\Checker\Checker($reporter, $messages); $check->run(); $this->_tpl->assign('wwwpath', jApp::wwwPath()); $this->_tpl->assign('configpath', jApp::configPath()); $this->_tpl->assign('check', $reporter->trace); }
protected function _prepareTpl() { $lang = jApp::config()->locale; if (!$this->getParam('no_lang_check')) { $locale = jLocale::getPreferedLocaleFromRequest(); if (!$locale) { $locale = 'en_US'; } jApp::config()->locale = $locale; } $reporter = new checkZoneInstallReporter(); $check = new jInstallCheck($reporter, $lang); $reporter->messageProvider = $check->messages; $check->run(); $this->_tpl->assign('wwwpath', jApp::wwwPath()); $this->_tpl->assign('configpath', jApp::configPath()); $this->_tpl->assign('check', $reporter->trace); }