<?php

// 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.
Yii::setPathOfAlias('editable', dirname(__FILE__) . '/../extensions/x-editable');
return array(
    'basePath' => dirname(__FILE__) . DIRECTORY_SEPARATOR . '..',
    'name' => 'Jozour',
    // preloading 'log' component
    'preload' => array('log', 'options'),
    'sourceLanguage' => 'en_us',
    'aliases' => array(
        'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'), // change this if necessary
    ),
    // autoloading model and component classes
    'import' => array(
        'application.models.*',
        'application.components.*',
        'application.modules.admin.models.*',
        'application.modules.admin.modules.fmenu.models.*',
        'application.modules.admin.modules.fslider.models.*',
        'application.modules.admin.modules.ftabber.models.*',
        'application.components.shortcodes.*',
        'application.modules.admin.modules.user.models.*',
        'application.modules.admin.modules.user.components.*',
        'application.modules.admin.modules.rights.*',
        'application.modules.admin.modules.rights.components.*',
        'application.modules.admin.modules.fmessage.components.*',
        'application.modules.admin.modules.fmessage.models.*',
        'application.modules.admin.modules.widgets.components.*',
        'application.modules.admin.modules.widgets.models.*',
        'application.modules.admin.modules.falbums.models.*',
        'application.modules.admin.modules.fnewsletter.models.*',
        'editable.*',
        'bootstrap.helpers.TbHtml',
        'bootstrap.helpers.TbArray',
        'bootstrap.behaviors.TbWidget',
    ),
    'modules' => array(
        'admin' => array(
            'modules' => array(
                'fmenu',
                'fslider',
                'ftabber',
                'fmessage',
                'fnewsletter',
                'falbums',
                'formBuilder',
                'widgets',
                'user' => array(
                    'hash' => 'md5', # encrypting method (php hash function)
                    'sendActivationMail' => false, # send activation email
                    'loginNotActiv' => false, # allow access for non-activated users
                    'activeAfterRegister' => false, # activate user on registration (only sendActivationMail = false)
                    'autoLogin' => true, # automatically login from registration
                    'registrationUrl' => array("/admin/user/registration"),
                    'recoveryUrl' => array("/admin/user/recovery/recovery"),
                    'loginUrl' => array("/admin/user/login"),
                    'logoutUrl' => array("/admin/user/logout"),
                    'profileUrl' => array("/admin/user/profile"),
                    'returnUrl' => array("/admin/user/profile"),
                    'returnLogoutUrl' => array("/admin/user/login"),
                ),
                'rights' => array(
                    'superuserName' => 'admin', // Name of the role with super user privileges. 
                    'authenticatedName' => 'Authenticated', // Name of the authenticated user role. 
                    'userIdColumn' => 'id', // Name of the user id column in the database. 
                    'userNameColumn' => 'username', // Name of the user name column in the database. 
                    'enableBizRule' => true, // Whether to enable authorization item business rules. 
                    'enableBizRuleData' => false, // Whether to enable data for business rules. 
                    'displayDescription' => true, // Whether to use item description instead of name. 
                    'flashSuccessKey' => 'success', // Key to use for setting success flash messages. 
                    'flashErrorKey' => 'error', // Key to use for setting error flash messages. 
                    'install' => true, // Whether to install rights. 
                    'baseUrl' => '/admin/rights/', // Base URL for Rights. Change if module is nested. 
                    'layout' => 'admin.views.layouts.main', // Layout to use for displaying Rights. 
                    'appLayout' => 'admin.views.layouts.main', // Application layout. 
                    'cssFile' => false, // Style sheet file to use for Rights. 
                    'install' => true, // Whether to enable installer. 
                    'debug' => true, // Whether to enable debug mode. 
                ),
            ),
        ),
        'gii' => array(
            'class' => 'system.gii.GiiModule',
            'password' => false,
            // If removed, Gii defaults to localhost only. Edit carefully to taste.
            'ipFilters' => array('127.0.0.1', '::1'),
            'generatorPaths' => array('admin.gii'), // a path alias
        ),
    ),
    // application components
    'components' => array(
        'image' => array(
            'class' => 'application.extensions.image.CImageComponent',
            'driver' => 'GD', // GD or ImageMagick
        ),
        'bootstrap' => array(
            'class' => 'bootstrap.components.TbApi',
        ),
        'messages' => array(
            'onMissingTranslation' => array('MessageSourceHandler', 'onMissingTranslation'),
//            'class' => 'CDbMessageSource',
//            'sourceMessageTable' => 'fmessage_sourcemessage',
//            'translatedMessageTable' => 'fmessage_message'
        ),
        'coreMessages' => array(
            'onMissingTranslation' => array('MessageSourceHandler', 'onMissingTranslation'),
            'class' => 'CDbMessageSource',
            'sourceMessageTable' => 'fmessage_sourcemessage',
            'translatedMessageTable' => 'fmessage_message'
        ),
        'options' => array(
            'class' => 'application.components.OptionsManager'
        ),
        'user' => array(
// enable cookie-based authentication
            'class' => 'RWebUser',
            'allowAutoLogin' => true,
            'loginUrl' => array("/admin/user/login"),
        ),
        'editable' => array(
            'class' => 'editable.EditableConfig',
            'form' => 'bootstrap', //form style: 'bootstrap', 'jqueryui', 'plain' 
            'mode' => 'inline', //mode: 'popup' or 'inline'  
            'defaults' => array(//default settings for all editable elements
                'emptytext' => 'Click to edit',
            //'ajaxOptions' => array('dataType' => 'json') //usefull for json exchange with server
            )
        ),
        'authManager' => array(
            'class' => 'RDbAuthManager', // Provides support authorization item sorting. 
            'assignmentTable' => 'authassignment',
            'itemChildTable' => 'authitemchild',
            'itemTable' => 'authitem',
            'rightsTable' => 'rights',
            'defaultRoles' => array('Authenticated', 'Guest'),
        ),
        'urlManager' => array(
//            'class' => 'application.extensions.urlManager.LangUrlManager',
//            'languages' => array('en', 'ar',),
//            'langParam' => 'lang',
            'urlFormat' => 'path',
            'showScriptName' => false,
            'rules' => array(
                'admin' => 'admin/default/index',
                '<action:(index|search|contact)>' => 'site/<action>',
                // 
                '<controller:(page|category)>/<slug:[\w-]+>' => '<controller>/view',
                '<controller:(project)>/<slug:[\w-]+>' => '<controller>/category',
                '<controller:(project)>/<category:[\w-]+>/<slug:[\w-]+>' => '<controller>/view',
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                '<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
            ),
        ),
        'clientScript' => array(
            'scriptMap' => array(
                'jquery.yiitab.js' => false,
                'jquery-ui.css' => false,
            ),
        ),
        'db' => array(
            'connectionString' => 'mysql:host=localhost;dbname=jozour',
            'emulatePrepare' => true,
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
            'tablePrefix' => '',
        ),
        'errorHandler' => array(
// use 'site/error' action to display errors
            'errorAction' => 'site/error',
        ),
        'log' => array(
            'class' => 'CLogRouter',
            'routes' => array(
                array(
                    'class' => 'CFileLogRoute',
                    'levels' => 'error, warning',
                ),
            ),
        ),
    ),
    // application-level parameters that can be accessed
// using Yii::app()->params['paramName']
    'params' => array(
// this is used in contact page
        'adminEmail' => 'info@jozour.sy',
        'uploadDir' => realpath(dirname(__FILE__) . '/../../uploads') . DIRECTORY_SEPARATOR,
        'uploadUrl' => dirname($_SERVER['SCRIPT_NAME']) . '/uploads/',
        'encryptionKey' => 'FIDY=;JmXheVAdASTFj$xczk^-b2zi~Ps@Xhv!8^+ne7Y(~<5%oC~pqxcFpXBwcS',
    ),
);
