<?php
/**
 * main configuration details
 * <br/><br/>
 * @author Yii
 * @version 1.0
 * @package Config
 * @copyright Copyright © 2014 GGBN http://www.ggbn.org
 <br/>The contents of this file are subject to the Mozilla Public License Version 1.1
 * @filesource
 * @license http://www.mozilla.org/MPL/ MPL
 */

// import secure data:
if (! (include ('db_data.php'))) {
	$connectionString = '';
	$username = '';
	$password = '';
	$giiPassword = '';
}

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array (
		'basePath' => dirname ( __FILE__ ) . DIRECTORY_SEPARATOR . '..',
		'name' => 'GGBN Portal',
		
		"aliases" => array (
				"images" => dirname ( __DIR__ ) . "/images/",
				"packages" => dirname ( __DIR__ ) . "/packages/" 
		),
		// preloading 'log' component
		'preload' => array (
				'log' 
		),
		
		// autoloading model and component classes
		'import' => array (
				'application.models.*',
				'application.components.*',
				'application.packages.project.*',
				'application.packages.api.*',
				'application.packages.solr.*',
				'system.zii.widgets.grid.CGridView.php' 
		),
		
		'modules' => array (
				// uncomment the following to enable the Gii tool
				'gii' => array (
						'class' => 'system.gii.GiiModule',
						'password' => $giiPassword,
						// If removed, Gii defaults to localhost only. Edit carefully to taste.
						'ipFilters' => array (
								'127.0.0.1',
								'::1' 
						) 
				) 
		)
		,
		
		// application components
		'components' => array (
				'user' => array (
						// enable cookie-based authentication
						'allowAutoLogin' => true 
				),
				'solr_details' => array (
						'class' => 'packages.solr.ASolrConnection',
						
						'clientOptions' => array (
								'hostname' => '160.45.63.68',
								'port' => 8080,
								'username' => '',
								'password' => '',
								'path' => 'solr/ggbn_details' 
						)
						// 'wt' => 'xml',
						 
				),
				'solr_core' => array (
						'class' => 'packages.solr.ASolrConnection',
						
						'clientOptions' => array (
								'hostname' => '160.45.63.68',
								'port' => 8080,
								'username' => '',
								'password' => '',
								'path' => 'solr/ggbn_core' 
						)
						// 'wt' => 'json',
						 
				),
				
				'urlManager' => array (
						'urlFormat' => 'path',
						'rules' => array (
								'search' => 'search/index',
								'<controller:\w+>/<id:\d+>' => '<controller>/view',
								'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
								'<controller:\w+>/<action:\w+>' => '<controller>/<action>' 
						)
						// '<controller:\w+>/<unitID:\d+>'=>'<controller>/view'
						,
						'showScriptName' => false 
				) // RE 03-02-2015: true macht keinen Unterschied

				,
				'db' => array (
						'connectionString' => $connectionString,
						'emulatePrepare' => true,
						// added the following line to debug full sql queries:
						'enableParamLogging' => true,
						'username' => $username,
						'password' => $password,
						'charset' => 'utf8' 
				),
				'errorHandler' => array (
						// use 'site/error' action to display errors
						'errorAction' => 'site/error' 
				),
				
				// TODO
				// the yii components have to be adapted to the log router somehow
				// otherwise it yii application terminates on an error while registering
				// the yii components
				// i tricked yii on that by putting the yii components
				// before the log component. - but maybe this is not a proper solution?
				// so i should get to learn more about log router
				
				'log' => array (
						'class' => 'CLogRouter',
						'routes' => array (
								array (
										'class' => 'CFileLogRoute',
										'levels' => 'error, warning' 
								),
								// uncomment the following to show log messages on web pages
								
								array (
										'class' => 'CWebLogRoute' 
								) 
						) 
				) 
		),
		// application-level parameters that can be accessed
		// using Yii::app()->params['paramName']
		'params' => array (
				// this is used in contact page
				'adminEmail' => 'contact@dnabank-network.org',
				'listPerPage' => 50 
		) // Gabi hinzugefügt siehe http://www.yiiframework.com/forum/index.php/topic/25901-pagination-solution-simple-and-complex-ways/
		                   // muss später über-Configs eingestellt werden können -> 50 dann default-Wert
		 
)
;