'CLogRouter'); } // Add logging of trace $config['components']['log']['routes'][] = array( 'class' => 'CWebLogRoute', // you can include more levels separated by commas... trace is shown on debug only 'levels' => 'trace', // you can include more separated by commas 'categories' => 'vardump', // show in firebug/console 'showInFireBug' => true ); // if debugsql = 1 we add sql logging to the output if (array_key_exists('debugsql', $config['config']) && $config['config']['debugsql'] == 1) { // Add logging of trace $config['components']['log']['routes'][] = array( 'class' => 'CWebLogRoute', // you can include more levels separated by commas... trace is shown on debug only 'levels' => 'trace', // you can include more separated by commas 'categories' => 'system.db.*', // show in firebug/console 'showInFireBug' => true ); $config['components']['db']['enableProfiling'] = true; $config['components']['db']['enableParamLogging'] = true; } } if (!isset($config['components']['request'])) { $config['components']['request']=array(); } if (!isset($config['components']['session'])) { $config['components']['session']=array(); } $config['components']['session']=array_merge_recursive($config['components']['session'],array( 'cookieParams' => array( 'httponly' => true, ), )); if (!isset($config['components']['assetManager'])) { $config['components']['assetManager']=array(); } $config['components']['assetManager']=array_merge_recursive($config['components']['assetManager'],array( 'basePath'=> dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'assets' // Enable to activate cookie protection )); parent::__construct($config); Yii::setPathOfAlias('bootstrap' , Yii::getPathOfAlias('ext.bootstrap')); // Load the default and environmental settings from different files into self. $ls_config = require(__DIR__ . '/../config/config-defaults.php'); $email_config = require(__DIR__ . '/../config/email.php'); $version_config = require(__DIR__ . '/../config/version.php'); $settings = array_merge($ls_config, $version_config, $email_config); if(file_exists(__DIR__ . '/../config/config.php')) { $ls_config = require(__DIR__ . '/../config/config.php'); if(is_array($ls_config['config'])) { $settings = array_merge($settings, $ls_config['config']); } } foreach ($settings as $key => $value) $this->setConfig($key, $value); App()->getAssetManager()->setBaseUrl(Yii::app()->getBaseUrl(false) . '/tmp/assets'); // Now initialize the plugin manager $this->initPluginManager(); } public function init() { parent::init(); Yii::import('application.helpers.ClassFactory'); ClassFactory::registerClass('Token_', 'Token'); ClassFactory::registerClass('Response_', 'Response'); } /** * This method handles initialization of the plugin manager * * When you want to insert your own plugin manager, or experiment with different settings * then this is where you should do that. */ public function initPluginManager() { Yii::import('application.libraries.PluginManager.*'); Yii::import('application.libraries.PluginManager.Storage.*'); Yii::import('application.libraries.PluginManager.Question.*'); $this->pluginManager = new PluginManager($this->getApi()); // And load the active plugins $this->pluginManager->loadPlugins(); } /** * Loads a helper * * @access public * @param string $helper * @return void */ public function loadHelper($helper) { Yii::import('application.helpers.' . $helper . '_helper', true); } /** * Loads a library * * @access public * @param string $helper * @return void */ public function loadLibrary($library) { Yii::import('application.libraries.'.$library, true); } /** * Sets a configuration variable into the config * * @access public * @param string $name * @param mixed $value * @return void */ public function setConfig($name, $value) { $this->config[$name] = $value; } /** * Set a 'flash message'. * * A flahs message will be shown on the next request and can contain a message * to tell that the action was successful or not. The message is displayed and * cleared when it is shown in the view using the widget: * * $this->widget('application.extensions.FlashMessage.FlashMessage'); * * * @param string $message * @param string $type * @return LSYii_Application Provides a fluent interface */ public function setFlashMessage($message,$type='default') { $aFlashMessage=$this->session['aFlashMessage']; $aFlashMessage[]=array('message'=>$message,'type'=>$type); $this->session['aFlashMessage'] = $aFlashMessage; return $this; } /** * Loads a config from a file * * @access public * @param string $file * @return void */ public function loadConfig($file) { $config = require_once(APPPATH . '/config/' . $file . '.php'); if(is_array($config)) { foreach ($config as $k => $v) $this->setConfig($k, $v); } } /** * Returns a config variable from the config * * @access public * @param string $name * @param type $default Value to return when not found, default is false * @return mixed */ public function getConfig($name, $default = false) { return isset($this->config[$name]) ? $this->config[$name] : $default; } /** * For future use, cache the language app wise as well. * * @access public * @param Limesurvey_lang * @return void */ public function setLang(Limesurvey_lang $lang) { $this->lang = $lang; } /** * Get the Api object. */ public function getApi() { if (!isset($this->api)) { $this->api = new LimesurveyApi(); } return $this->api; } /** * Get the pluginManager * * @return PluginManager */ public function getPluginManager() { return $this->pluginManager; } }