Example #1
0
 /**
  * Loads the main configuration ini file and adds it to the registry.
  * The 'config' directory will be updated to have the provided profile
  * appended to it, e.g. './config' becomes './config/default'
  *
  * @param string $profile
  * @return object
  */
 public function loadConfig($profile)
 {
     if (Registry::has('config') && Registry::has('config_ini')) {
         return Registry::get('config');
     }
     $configDir = $this->getDir('config') . '/' . $profile;
     try {
         $configIni = new Config_ini();
         $configIni->load($configDir . '/config.ini.php');
         Registry::register('config_ini', $configIni);
         // Merge the ini configuration in to the main config library
         $config = new Config();
         $config->load($configIni);
         Registry::register('config', $config);
         // Store the profile name and update the 'config' dir value
         $this->setDir('config', $configDir);
         $this->configProfile = $profile;
         $this->configPath = $configDir . '/config.ini.php';
         return $config;
     } catch (Config_Ini_FileNoExist $e) {
         throw new Zula_Exception('Zula configuration file "' . $configDir . '/config.ini.php" does not exist or is not readable', 8);
     }
 }
Example #2
0
    $dispatchConfig = array();
}
if ($zula->getMode() == 'normal' && $config->get('theme/use_global')) {
    if ($zula->getState() == 'setup') {
        $themeName = 'purity';
    } else {
        $themeName = $config->get('theme/' . $router->getSiteType() . '_default');
    }
    define('_THEME_NAME', $themeName);
    try {
        $theme = new Theme($themeName);
        try {
            $theme->setJsAggregation($config->get('cache/js_aggregate'))->setGoogleCdn($config->get('cache/google_cdn'));
        } catch (Config_KeyNoExist $e) {
        }
        Registry::register('theme', $theme);
        $dispatchContent = $dispatcher->dispatch($requestedUrl, $dispatchConfig);
        if ($dispatcher->getStatusCode() === 403 && $session->isLoggedIn() === false) {
            // User did not have permission, fallback to 'session' module
            $dispatchContent = $dispatcher->dispatch(new Router_Url('session'));
        }
        if (is_bool($dispatchContent)) {
            $output = $dispatchContent;
        } else {
            header('Content-Type: text/html; charset=utf-8');
            // Include a themes init file, to allow a theme to configure some things
            $initFile = $zula->getDir('themes') . '/' . $themeName . '/init.php';
            if (is_readable($initFile)) {
                include $initFile;
            }
            /**
Example #3
0
 * as a identifier to the project that is using Zula, for example the
 * TextDomain of controllers/modules will be prefixed with this value
 * followed by a hypthen '-'.
 */
define('_PROJECT_ID', 'tangocms');
define('_PROJECT_NAME', 'TangoCMS');
/**
 * Include common functions, 'starup' checks such as PHP version check
 * and also some Unicode checks.
 */
require 'application/zula/common.php';
include 'application/zula/checks.php';
// Load and get an instance of the base Zula framework class
require 'application/zula/zula.php';
$zula = Zula::getInstance(dirname(__FILE__), isset($state) ? $state : 'development');
Registry::register('zula', $zula);
// _AJAX_REQUEST is DEPRECATED please use Zula::getMode() instead
define('_AJAX_REQUEST', $zula->getMode() == 'standalone');
if (UNICODE_MBSTRING === false) {
    // Load needed unicode libraries
    require $zula->getDir('3rd_party') . '/phputf8/utils/unicode.php';
    require $zula->getDir('3rd_party') . '/phputf8/native/core.php';
}
/**
 * Default directories in Zula should be fine, though you can configure
 * them from here if you want, via Zula::setDir()
 */
if ($zula->getState() == 'setup') {
    define('_REAL_MODULE_DIR', $zula->getDir('modules'));
    // Reconfigure some directories so they work correctly when installing
    $zula->setDir('modules', './modules');