当前位置: 首页>>代码示例>>PHP>>正文


PHP jApp::mainConfigFile方法代码示例

本文整理汇总了PHP中jApp::mainConfigFile方法的典型用法代码示例。如果您正苦于以下问题:PHP jApp::mainConfigFile方法的具体用法?PHP jApp::mainConfigFile怎么用?PHP jApp::mainConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jApp的用法示例。


在下文中一共展示了jApp::mainConfigFile方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load

 /**
  * 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;
     }
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:56,代码来源:jConfig.class.php

示例2: getDocumentRoot

function getDocumentRoot()
{
    if (isset($_SERVER['DOCUMENT_ROOT'])) {
        return $_SERVER['DOCUMENT_ROOT'];
    }
    require_once JELIX_LIB_PATH . "core/jConfigCompiler.class.php";
    $config = parse_ini_file(jApp::mainConfigFile());
    $urlengine = $config['urlengine'];
    if ($urlengine['scriptNameServerVariable'] == '') {
        $urlengine['scriptNameServerVariable'] = jConfigCompiler::findServerName('.php');
    }
    $urlScript = $_SERVER[$urlengine['scriptNameServerVariable']];
    $lastslash = strrpos($urlScript, '/');
    $urlScriptPath = substr($urlScript, 0, $lastslash) . '/';
    $basepath = $urlengine['basePath'];
    if ($basepath == '') {
        // for beginners or simple site, we "guess" the base path
        $basepath = $urlScriptPath;
    } elseif ($basepath != '/') {
        if ($basepath[0] != '/') {
            $basepath = '/' . $basepath;
        }
        if (substr($basepath, -1) != '/') {
            $basepath .= '/';
        }
        if (strpos($urlScriptPath, $basepath) !== 0) {
            throw new Exception('Jelix Error: basePath (' . $basepath . ') in config file doesn\'t correspond to current base path. You should setup it to ' . $urlengine['urlScriptPath']);
        }
    }
    if ($basepath == '/') {
        return jApp::wwwPath();
    }
    if (strpos(jApp::wwwPath(), $basepath) === false) {
        return jApp::wwwPath();
    }
    return substr(jApp::wwwPath(), 0, -strlen($basepath));
}
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:37,代码来源:jelix_minify.php

示例3: read

 /**
  * read the given ini file, for the current entry point, or for the entrypoint given
  * in $pseudoScriptName. Merge it with the content of mainconfig.ini.php
  * It also calculates some options.
  * If you are in a CLI script but you want to load a configuration file for a web entry point
  * or vice-versa, you need to indicate the $pseudoScriptName parameter with the name of the entry point
  * @param string $configFile the config file name
  * @param boolean $allModuleInfo may be true for the installer, which needs all informations
  *                               else should be false, these extra informations are
  *                               not needed to run the application
  * @param boolean $isCli  indicate if the configuration to read is for a CLI script or no
  * @param string $pseudoScriptName the name of the entry point, relative to the base path,
  *              corresponding to the readed configuration
  * @return object an object which contains configuration values
  */
 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         // if it equals to '/', this is because realpath has returned false in the application.init.php
         // so this is because the path doesn't exist.
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory is not writable -- (' . $tempPath . ')', 4);
     }
     if (!is_writable(jApp::logPath())) {
         throw new Exception('Application log directory is not writable -- (' . jApp::logPath() . ')', 4);
     }
     // this is the defaultconfig file of JELIX itself
     $config = jelix_read_ini(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     self::$commonConfig = clone $config;
     // read the main configuration of the app
     @jelix_read_ini(jApp::mainConfigFile(), $config);
     // read the local configuration of the app
     if (file_exists($configPath . 'localconfig.ini.php')) {
         @jelix_read_ini($configPath . 'localconfig.ini.php', $config);
     }
     // read the configuration specific to the entry point
     if ($configFile != 'mainconfig.ini.php' && $configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile}", 5);
         }
         if (false === @jelix_read_ini($configPath . $configFile, $config)) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
     }
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:52,代码来源:jConfigCompiler.class.php

示例4: getEntryPointsList

 public function getEntryPointsList()
 {
     if ($this->entryPointList !== null) {
         return $this->entryPointList;
     }
     $listEps = $this->projectXml->documentElement->getElementsByTagName("entrypoints");
     if (!$listEps->length) {
         $this->entryPointList = array();
         return $this->entryPointList;
     }
     $listEp = $listEps->item(0)->getElementsByTagName("entry");
     if (!$listEp->length) {
         $this->entryPointList = array();
         return $this->entryPointList;
     }
     $mainConfig = new jIniFileModifier(jApp::mainConfigFile());
     $this->entryPointList = array();
     for ($i = 0; $i < $listEp->length; $i++) {
         $epElt = $listEp->item($i);
         $ep = new jInstallerEntryPoint($mainConfig, $epElt->getAttribute("config"), $epElt->getAttribute("file"), $epElt->getAttribute("type"));
         $this->entryPointList[] = $ep;
     }
     return $this->entryPointList;
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:24,代码来源:jInstallerApplication.class.php

示例5: checkAppPaths

 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
         throw new Exception($this->messages->get('path.core'));
     }
     if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(jApp::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(jApp::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(jApp::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(jApp::mainConfigFile()) && !is_writable(jApp::mainConfigFile())) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         } elseif (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(jApp::wwwPath())) {
         $this->error('path.www');
         $ok = false;
     }
     foreach ($this->otherPaths as $path) {
         $realPath = jFile::parseJelixPath($path);
         if (!file_exists($realPath)) {
             $this->error('path.custom.not.exists', array($path));
             $ok = false;
         } else {
             if (!is_writable($realPath)) {
                 $this->error('path.custom.writable', array($path));
                 $ok = false;
             } else {
                 $this->ok('path.custom.ok', array($path));
             }
         }
     }
     if ($ok) {
         $this->ok('paths.ok');
     } else {
         throw new Exception($this->messages->get('too.critical.error'));
     }
     /*if(!isset($GLOBALS['config_file']) ||
          empty($GLOBALS['config_file']) ||
          !file_exists(jApp::configPath($GLOBALS['config_file']))){
           throw new Exception($this->messages->get('config.file'));
       }*/
     return $ok;
 }
开发者ID:laurentj,项目名称:lizmap-web-client,代码行数:72,代码来源:jInstallChecker.class.php

示例6: run

 public function run()
 {
     $this->loadAppConfig();
     $module = $this->getParam('module');
     $initialVersion = $this->getOption('-ver');
     if ($initialVersion === false) {
         $initialVersion = '0.1pre';
     }
     // note: since module name are used for name of generated name,
     // only this characters are allowed
     if ($module == null || preg_match('/([^a-zA-Z_0-9])/', $module)) {
         throw new Exception("'" . $module . "' is not a valid name for a module");
     }
     // check if the module already exist or not
     $path = '';
     try {
         $path = $this->getModulePath($module);
     } catch (Exception $e) {
     }
     if ($path != '') {
         throw new Exception("module '" . $module . "' already exists");
     }
     // verify the given repository
     $repository = $this->getParam('repository', 'app:modules/');
     if (substr($repository, -1) != '/') {
         $repository .= '/';
     }
     $repositoryPath = jFile::parseJelixPath($repository);
     $iniDefault = new jIniFileModifier(jApp::mainConfigFile());
     $this->updateModulePath($iniDefault, $iniDefault->getValue('modulesPath'), $repository, $repositoryPath);
     if ($this->verbose()) {
         echo "modulePath updated in the main configuration\n";
     }
     if (!$this->allEntryPoint) {
         $list = $this->getEntryPointsList();
         foreach ($list as $k => $entryPoint) {
             if ($entryPoint['file'] == $this->entryPointName) {
                 $ini = new jIniFileModifier(jApp::configPath($entryPoint['config']));
                 break;
             }
         }
         if (!$ini) {
             throw new Exception("entry point is unknown");
         }
         $this->updateModulePath($ini, jApp::config()->modulesPath, $repository, $repositoryPath);
         if ($this->verbose()) {
             echo "modulePath updated in the configuration " . $entryPoint['config'] . "\n";
         }
     }
     $path = $repositoryPath . $module . '/';
     $this->createDir($path);
     jApp::setConfig(null);
     if ($this->getOption('-admin')) {
         $this->removeOption('-nosubdir');
         $this->removeOption('-addinstallzone');
     }
     $param = array();
     $param['module'] = $module;
     $param['default_id'] = $module . $this->config->infoIDSuffix;
     $param['version'] = $initialVersion;
     $this->createFile($path . 'module.xml', 'module/module.xml.tpl', $param);
     // create all sub directories of a module
     if (!$this->getOption('-nosubdir')) {
         $this->createDir($path . 'classes/');
         $this->createDir($path . 'zones/');
         $this->createDir($path . 'controllers/');
         $this->createDir($path . 'templates/');
         $this->createDir($path . 'classes/');
         $this->createDir($path . 'daos/');
         $this->createDir($path . 'forms/');
         $this->createDir($path . 'locales/');
         $this->createDir($path . 'locales/en_US/');
         $this->createDir($path . 'locales/fr_FR/');
         $this->createDir($path . 'install/');
         if ($this->verbose()) {
             echo "Sub directories have been created in the new module {$module}.\n";
         }
         $this->createFile($path . 'install/install.php', 'module/install.tpl', $param);
         $this->createFile($path . 'urls.xml', 'module/urls.xml.tpl', array());
     }
     $isdefault = $this->getOption('-defaultmodule');
     // activate the module in the application
     if ($isdefault) {
         $iniDefault->setValue('startModule', $module);
         $iniDefault->setValue('startAction', 'default:index');
         if ($this->verbose()) {
             echo "The new module {$module} becomes the default module\n";
         }
     }
     $iniDefault->setValue($module . '.access', $this->allEntryPoint ? 2 : 1, 'modules');
     $iniDefault->save();
     $list = $this->getEntryPointsList();
     $install = new jIniFileModifier(jApp::configPath('installer.ini.php'));
     // install the module for all needed entry points
     foreach ($list as $k => $entryPoint) {
         $configFile = jApp::configPath($entryPoint['config']);
         $epconfig = new jIniFileModifier($configFile);
         if ($this->allEntryPoint) {
             $access = 2;
         } else {
//.........这里部分代码省略.........
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:101,代码来源:createmodule.cmd.php

示例7: run

 public function run()
 {
     $this->loadAppConfig();
     $entrypoint = $this->getParam('entrypoint');
     if (($p = strpos($entrypoint, '.php')) !== false) {
         $entrypoint = substr($entrypoint, 0, $p);
     }
     $ep = $this->getEntryPointInfo($entrypoint);
     if ($ep == null) {
         try {
             $cmd = JelixScript::getCommand('createentrypoint', $this->config);
             $cmd->initOptParam(array(), array('name' => $entrypoint));
             $cmd->run();
             $this->projectXml = null;
             $ep = $this->getEntryPointInfo($entrypoint);
         } catch (Exception $e) {
             throw new Exception("The entrypoint has not been created because of this error: " . $e->getMessage() . ". No other files have been created.\n");
         }
     }
     $installConfig = new jIniFileModifier(jApp::configPath('installer.ini.php'));
     $inifile = new jIniMultiFilesModifier(jApp::mainConfigFile(), jApp::configPath($ep['config']));
     $params = array();
     $this->createFile(jApp::appPath('responses/adminHtmlResponse.class.php'), 'responses/adminHtmlResponse.class.php.tpl', $params, "Response for admin interface");
     $this->createFile(jApp::appPath('responses/adminLoginHtmlResponse.class.php'), 'responses/adminLoginHtmlResponse.class.php.tpl', $params, "Response for login page");
     $inifile->setValue('html', 'adminHtmlResponse', 'responses');
     $inifile->setValue('htmlauth', 'adminLoginHtmlResponse', 'responses');
     $inifile->setValue('startModule', 'master_admin');
     $inifile->setValue('startAction', 'default:index');
     $modulePath = $inifile->getValue("modulesPath", 0, null, true);
     if (strpos($modulePath, 'lib:jelix-admin-modules') === false) {
         // we set it on mainconfig.ini.php, so if the url engine is "significant"
         // it could know the admin modules during the parsing of modules
         $inifile->setValue('modulesPath', 'lib:jelix-admin-modules/,' . $modulePath, 0, null, true);
     }
     $installConfig->setValue('jacl.installed', '0', $entrypoint);
     $inifile->setValue('jacl.access', '0', 'modules');
     $installConfig->setValue('jacldb.installed', '0', $entrypoint);
     $inifile->setValue('jacldb.access', '0', 'modules');
     $installConfig->setValue('junittests.installed', '0', $entrypoint);
     $inifile->setValue('junittests.access', '0', 'modules');
     $installConfig->setValue('jsoap.installed', '0', $entrypoint);
     $inifile->setValue('jsoap.access', '0', 'modules');
     $urlconf = $inifile->getValue($entrypoint, 'simple_urlengine_entrypoints', null, true);
     if ($urlconf === null || $urlconf == '') {
         // in defaultconfig
         $inifile->setValue($entrypoint, 'jacl2db_admin~*@classic, jauthdb_admin~*@classic, master_admin~*@classic, jpref_admin~*@classic', 'simple_urlengine_entrypoints', null, true);
         // in the config of the entry point
         $inifile->setValue($entrypoint, 'jacl2db~*@classic, jauth~*@classic, jacl2db_admin~*@classic, jauthdb_admin~*@classic, master_admin~*@classic, jpref_admin~*@classic', 'simple_urlengine_entrypoints');
     } else {
         $urlconf2 = $inifile->getValue($entrypoint, 'simple_urlengine_entrypoints');
         if (strpos($urlconf, 'jacl2db_admin~*@classic') === false) {
             $urlconf .= ',jacl2db_admin~*@classic';
         }
         if (strpos($urlconf, 'jauthdb_admin~*@classic') === false) {
             $urlconf .= ',jauthdb_admin~*@classic';
         }
         if (strpos($urlconf, 'master_admin~*@classic') === false) {
             $urlconf .= ',master_admin~*@classic';
         }
         if (strpos($urlconf2, 'jacl2db_admin~*@classic') === false) {
             $urlconf2 .= ',jacl2db_admin~*@classic';
         }
         if (strpos($urlconf2, 'jauthdb_admin~*@classic') === false) {
             $urlconf2 .= ',jauthdb_admin~*@classic';
         }
         if (strpos($urlconf2, 'master_admin~*@classic') === false) {
             $urlconf2 .= ',master_admin~*@classic';
         }
         if (strpos($urlconf2, 'jacl2db~*@classic') === false) {
             $urlconf2 .= ',jacl2db~*@classic';
         }
         if (strpos($urlconf2, 'jauth~*@classic') === false) {
             $urlconf2 .= ',jauth~*@classic';
         }
         if (strpos($urlconf2, 'jpref_admin~*@classic') === false) {
             $urlconf2 .= ',jpref_admin~*@classic';
         }
         $inifile->setValue($entrypoint, $urlconf, 'simple_urlengine_entrypoints', null, true);
         $inifile->setValue($entrypoint, $urlconf2, 'simple_urlengine_entrypoints');
     }
     if (null == $inifile->getValue($entrypoint, 'basic_significant_urlengine_entrypoints', null, true)) {
         $inifile->setValue($entrypoint, '1', 'basic_significant_urlengine_entrypoints', null, true);
     }
     $inifile->save();
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     $verbose = $this->verbose();
     $reporter = new textInstallReporter($verbose ? 'notice' : 'warning');
     $installer = new jInstaller($reporter);
     $installer->installModules(array('master_admin'), $entrypoint . '.php');
     $authini = new jIniFileModifier(jApp::configPath($entrypoint . '/auth.coord.ini.php'));
     $authini->setValue('after_login', 'master_admin~default:index');
     $authini->setValue('timeout', '30');
     $authini->save();
     $profile = $this->getOption('-profile');
     if (!$this->getOption('-noauthdb')) {
         if ($profile != '') {
             $authini->setValue('profile', $profile, 'Db');
         }
         $authini->save();
         $installer->setModuleParameters('jauthdb', array('defaultuser' => true));
//.........这里部分代码省略.........
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:101,代码来源:initadmin.cmd.php

示例8: handleCustomTestSuite

 protected function handleCustomTestSuite()
 {
     $modulesTests = -1;
     /*
     $this->options[0] is an array of all options '--xxx'.
       each values is an array(0=>'optionname', 1=>'value if given')
     $this->options[1] is a list of parameters given after options
       it can be array(0=>'test name', 1=>'filename')
     */
     foreach ($this->options[0] as $option) {
         switch ($option[0]) {
             case '--entrypoint':
                 $this->entryPoint = $option[1];
                 break;
             case '--all-modules':
                 $modulesTests = 0;
                 break;
             case '--module':
                 $modulesTests = 1;
                 // test is the module name
                 // testFile is the test file inside the module
                 break;
             case '--testtype':
                 $this->testType = $option[1];
                 break;
         }
     }
     if (isset($this->options[1][1]) && $modulesTests != 0) {
         // a specifique test file
         $this->arguments['testFile'] = $this->options[1][1];
     } else {
         $this->arguments['testFile'] = '';
     }
     $appInfos = new \Jelix\Core\Infos\AppInfos();
     $ep = $appInfos->getEntryPointInfo($this->entryPoint);
     $mainConfig = new \Jelix\IniFile\IniModifier(jApp::mainConfigFile());
     $this->epInfo = new \Jelix\Installer\EntryPoint($mainConfig, $ep["config"], $ep["file"], $ep["type"]);
     // let's load configuration now, and coordinator. it could be needed by tests
     // (during load of their php files or during execution)
     jApp::setConfig(jConfigCompiler::readAndCache($this->epInfo->configFile, null, $this->entryPoint));
     jApp::setCoord(new jCoordinator('', false));
     if ($modulesTests == 0) {
         // we add all modules in the test list
         $suite = $this->getAllModulesTestSuites();
         if (count($suite)) {
             $this->arguments['test'] = $suite;
             unset($this->arguments['testFile']);
         } else {
             $this->showMessage("Error: no tests in modules\n");
             exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
         }
     } else {
         if ($modulesTests == 1 && !$this->version36) {
             $suite = $this->getModuleTestSuite($this->options[1][0]);
             if (count($suite)) {
                 $this->arguments['test'] = $suite;
                 if (isset($this->options[1][1])) {
                     // a specifique test file
                     $this->arguments['testFile'] = $this->options[1][1];
                 } else {
                     $this->arguments['testFile'] = '';
                 }
             } else {
                 $this->showMessage("Error: no tests in the module\n");
                 exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
             }
         } else {
             if ($modulesTests == 1) {
                 if (isset($this->options[1][1])) {
                     // a specifique test file
                     $suite = $this->getModuleTestSuite($this->options[1][0], $this->options[1][1]);
                 } else {
                     $suite = $this->getModuleTestSuite($this->options[1][0]);
                 }
                 if (count($suite)) {
                     $this->arguments['test'] = $suite;
                 } else {
                     $this->showMessage("Error: no tests in the module\n");
                     exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT);
                 }
             }
         }
     }
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:84,代码来源:command.php

示例9: loadconf

 protected function loadconf()
 {
     $ini = new \Jelix\IniFile\IniModifier(jApp::mainConfigFile());
     $emailConfig = array('webmasterEmail' => $ini->getValue('webmasterEmail', 'mailer'), 'webmasterName' => $ini->getValue('webmasterName', 'mailer'), 'mailerType' => $ini->getValue('mailerType', 'mailer'), 'hostname' => $ini->getValue('hostname', 'mailer'), 'sendmailPath' => $ini->getValue('sendmailPath', 'mailer'), 'smtpHost' => $ini->getValue('smtpHost', 'mailer'), 'smtpPort' => $ini->getValue('smtpPort', 'mailer'), 'smtpSecure' => $ini->getValue('smtpSecure', 'mailer'), 'smtpHelo' => $ini->getValue('smtpHelo', 'mailer'), 'smtpAuth' => $ini->getValue('smtpAuth', 'mailer'), 'smtpUsername' => $ini->getValue('smtpUsername', 'mailer'), 'smtpPassword' => $ini->getValue('smtpPassword', 'mailer'), 'smtpTimeout' => $ini->getValue('smtpTimeout', 'mailer'), 'errors' => array());
     if (!in_array($emailConfig['mailerType'], array('mail', 'sendmail', 'smtp'))) {
         $emailConfig['mailerType'] = 'mail';
     }
     return $emailConfig;
 }
开发者ID:mdouchin,项目名称:jelix,代码行数:9,代码来源:confmail.page.php

示例10: compile

 /**
  *
  */
 public function compile($aSelector)
 {
     $sourceFile = $aSelector->getPath();
     $cachefile = $aSelector->getCompiledFilePath();
     $xml = simplexml_load_file($sourceFile);
     if (!$xml) {
         return false;
     }
     /*
     <urls>
      <classicentrypoint name="index" default="true">
         <url pathinfo="/test/:mois/:annee" module="" action="">
               <param name="mois" escape="true" regexp="\d{4}"/>
               <param name="annee" escape="false" />
               <static name="bla" value="cequejeveux" />
         </url>
         <url handler="" module="" action=""  />
      </classicentrypoint>
     </urls>
     
     The compiler generates two files.
     
     It generates a php file for each entrypoint. A file contains a $PARSE_URL
     array:
     
         $PARSE_URL = array($isDefault, $infoparser, $infoparser, ... )
     
     where:
         $isDefault: true if it is the default entry point. In this case and
         where the url parser doesn't find a corresponding action, it will
         ignore else it will generate an error
     
         $infoparser = array('module','action', 'regexp_pathinfo',
                             'handler selector', array('secondaries','actions'),
                             false // needs https or not
                             )
         or
         $infoparser = array('module','action','regexp_pathinfo',
            array('year','month'), // list of dynamic value included in the url,
                                   // alphabetical ascendant order
            array(true, false),    // list of boolean which indicates for each
                                   // dynamic value, if it is an escaped value or not
            array('bla'=>'whatIWant' ), // list of static values
            array('secondaries','actions'),
            false  // need https or not
         )
     
     It generates an other file common to all entry point. It contains an
     array which contains informations to create urls
     
         $CREATE_URL = array(
            'news~show@classic' => // the action selector
               array(0,'entrypoint', https true/false, 'handler selector')
               or
               array(1,'entrypoint', https true/false,
                     array('year','month',), // list of dynamic values included in the url
                     array(0, 1..), // list of integer which indicates for each
                                    // dynamic value: 0: urlencode, 1:urlencode except '/', 2:escape, 4: lang, 8: locale
                     "/news/%1/%2/", // the url
                     array('bla'=>'whatIWant' ) // list of static values
                     )
               or
               When there are  several urls to the same action, it is an array of this kind of the previous array:
               array(4, array(1,...), array(1,...)...)
     
               or
               array(2,'entrypoint', https true/false), // for the patterns "@request"
               or
               array(3,'entrypoint', https true/false), // for the patterns "module~@request"
     */
     $this->createUrlInfos = array();
     $this->createUrlContent = "<?php \nif (jApp::config()->compilation['checkCacheFiletime'] &&( \n";
     $this->createUrlContent .= "filemtime('" . $sourceFile . '\') > ' . filemtime($sourceFile);
     $this->createUrlContentInc = '';
     $this->readProjectXml();
     $this->retrieveModulePaths(basename(jApp::mainConfigFile()));
     // for an app on a simple http server behind an https proxy, we shouldn't check HTTPS
     $this->checkHttps = jApp::config()->urlengine['checkHttpsOnParsing'];
     foreach ($xml->children() as $tagname => $tag) {
         if (!preg_match("/^(.*)entrypoint\$/", $tagname, $m)) {
             //TODO : error
             continue;
         }
         $type = $m[1];
         if ($type == '') {
             if (isset($tag['type'])) {
                 $type = (string) $tag['type'];
             }
             if ($type == '') {
                 $type = 'classic';
             }
         }
         $this->defaultUrl = new significantUrlInfoParsing($type, (string) $tag['name'], isset($tag['default']) ? (string) $tag['default'] == 'true' : false, isset($tag['https']) ? (string) $tag['https'] == 'true' : false);
         if (isset($tag['noentrypoint']) && (string) $tag['noentrypoint'] == 'true') {
             $this->defaultUrl->entryPointUrl = '';
         }
         $optionalTrailingSlash = isset($tag['optionalTrailingSlash']) && $tag['optionalTrailingSlash'] == 'true';
//.........这里部分代码省略.........
开发者ID:aeag,项目名称:lizmap-web-client,代码行数:101,代码来源:jSignificantUrlsCompiler.class.php

示例11: __construct

 /**
  * initialize the installation
  *
  * it reads configurations files of all entry points, and prepare object for
  * each module, needed to install/upgrade modules.
  * @param jIInstallReporter $reporter  object which is responsible to process messages (display, storage or other..)
  * @param string $lang  the language code for messages
  */
 function __construct($reporter, $lang = '')
 {
     $this->reporter = $reporter;
     $this->messages = new jInstallerMessageProvider($lang);
     $this->mainConfig = new jIniFileModifier(jApp::mainConfigFile());
     $localConfig = jApp::configPath('localconfig.ini.php');
     if (!file_exists($localConfig)) {
         $localConfigDist = jApp::configPath('localconfig.ini.php.dist');
         if (file_exists($localConfigDist)) {
             copy($localConfigDist, $localConfig);
         } else {
             file_put_contents($localConfig, ';<' . '?php die(\'\');?' . '>');
         }
     }
     $this->localConfig = new jIniMultiFilesModifier($this->mainConfig, $localConfig);
     $this->installerIni = $this->getInstallerIni();
     $this->readEntryPointData(simplexml_load_file(jApp::appPath('project.xml')));
     $this->installerIni->save();
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:27,代码来源:jInstaller.class.php

示例12: run

 public function run()
 {
     // retrieve the type of entry point we want to create
     $type = $this->getOption('-type');
     if (!$type) {
         $type = 'classic';
     } else {
         if (!in_array($type, array('classic', 'jsonrpc', 'xmlrpc', 'soap', 'cmdline'))) {
             throw new Exception("invalid type");
         }
     }
     // retrieve the name of the entry point
     $name = $this->getParam('name');
     if (preg_match('/(.*)\\.php$/', $name, $m)) {
         $name = $m[1];
     }
     // the full path of the entry point
     if ($type == 'cmdline') {
         $entryPointFullPath = jApp::scriptsPath($name . '.php');
         $entryPointTemplate = 'scripts/cmdline.php.tpl';
     } else {
         $entryPointFullPath = jApp::wwwPath($name . '.php');
         $entryPointTemplate = 'www/' . ($type == 'classic' ? 'index' : $type) . '.php.tpl';
     }
     if (file_exists($entryPointFullPath)) {
         throw new Exception("the entry point already exists");
     }
     $entryPointDir = dirname($entryPointFullPath) . '/';
     $this->loadProjectXml();
     // retrieve the config file name
     $configFile = $this->getParam('config');
     if ($configFile == null) {
         if ($type == 'cmdline') {
             $configFile = 'cmdline/' . $name . '.ini.php';
         } else {
             $configFile = $name . '/config.ini.php';
         }
     }
     // let's create the config file if needed
     $configFilePath = jApp::configPath($configFile);
     if (!file_exists($configFilePath)) {
         $this->createDir(dirname($configFilePath));
         // the file doesn't exists
         // if there is a -copy-config parameter, we copy this file
         $originalConfig = $this->getOption('-copy-config');
         if ($originalConfig) {
             if (!file_exists(jApp::configPath($originalConfig))) {
                 throw new Exception("unknown original configuration file");
             }
             file_put_contents($configFilePath, file_get_contents(jApp::configPath($originalConfig)));
             if ($this->verbose()) {
                 echo "Configuration file {$configFile} has been created from the config file {$originalConfig}.\n";
             }
         } else {
             // else we create a new config file, with the startmodule of the default
             // config as a module name.
             $mainConfig = parse_ini_file(jApp::mainConfigFile(), true);
             $param = array();
             if (isset($mainConfig['startModule'])) {
                 $param['modulename'] = $mainConfig['startModule'];
             } else {
                 $param['modulename'] = 'jelix';
             }
             $this->createFile($configFilePath, 'var/config/index/config.ini.php.tpl', $param, "Configuration file");
         }
     }
     require_once JELIX_LIB_PATH . 'utils/jIniMultiFilesModifier.class.php';
     $inifile = new jIniMultiFilesModifier(jApp::mainConfigFile(), $configFilePath);
     $param = array();
     $param['modulename'] = $inifile->getValue('startModule');
     // creation of the entry point
     $this->createDir($entryPointDir);
     $param['rp_app'] = $this->getRelativePath($entryPointDir, jApp::appPath());
     $param['config_file'] = $configFile;
     $this->createFile($entryPointFullPath, $entryPointTemplate, $param, "Entry point");
     if ($type != 'cmdline') {
         if (null === $inifile->getValue($name, 'simple_urlengine_entrypoints', null, true)) {
             $inifile->setValue($name, '', 'simple_urlengine_entrypoints', null, true);
         }
         if (null === $inifile->getValue($name, 'basic_significant_urlengine_entrypoints', null, true)) {
             $inifile->setValue($name, '1', 'basic_significant_urlengine_entrypoints', null, true);
         }
         $inifile->save();
     }
     $this->updateProjectXml($name . ".php", $configFile, $type);
     if ($this->verbose()) {
         echo "Project.xml has been updated.\n";
     }
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     $installer = new jInstaller(new textInstallReporter('warning'));
     $installer->installEntryPoint($name . ".php");
     if ($this->verbose()) {
         echo "All modules have been initialized for the new entry point.\n";
     }
 }
开发者ID:CREASIG,项目名称:lizmap-web-client,代码行数:95,代码来源:createentrypoint.cmd.php

示例13: __construct

 /**
  * initialize the installation
  *
  * it reads configurations files of all entry points, and prepare object for
  * each module, needed to install/upgrade modules.
  * @param jIInstallReporter $reporter  object which is responsible to process messages (display, storage or other..)
  * @param string $lang  the language code for messages
  */
 function __construct($reporter, $lang = '')
 {
     $this->reporter = $reporter;
     $this->messages = new jInstallerMessageProvider($lang);
     $this->mainConfig = new jIniFileModifier(jApp::mainConfigFile());
     $this->installerIni = $this->getInstallerIni();
     $this->readEntryPointData(simplexml_load_file(jApp::appPath('project.xml')));
     $this->installerIni->save();
 }
开发者ID:aurellemeless,项目名称:favoris,代码行数:17,代码来源:jInstaller.class.php


注:本文中的jApp::mainConfigFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。