/
internal.php
240 lines (213 loc) · 9.44 KB
/
internal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* This file contains configuration parameters for the Yii framework.
* Do not change these unless you know what you are doing.
*
*/
if (!file_exists(dirname(__FILE__) . '/config.php')) {
$userConfig = require(dirname(__FILE__) . '/config-sample-mysql.php');
} else {
$userConfig = require(dirname(__FILE__) . '/config.php');
}
if (! date_default_timezone_set(@date_default_timezone_get()))
{
date_default_timezone_set('Europe/London');
}
if (function_exists('mb_internal_encoding')) {
// Needed to substring arabic etc
mb_internal_encoding('UTF-8');
if (ini_get('mbstring.internal_encoding'))
{
ini_set('mbstring.internal_encoding','UTF-8');
}
}
else {
// Do nothing, will be checked in installation
}
$internalConfig = array(
'basePath' => dirname(dirname(__FILE__)),
'name' => 'LimeSurvey',
'localeClass' => 'LSYii_Locale',
'defaultController' => 'surveys',
'aliases' => array(
// Third party path
'third_party' => realpath(__DIR__ . '/../../third_party'),
'core' => realpath(__DIR__ . '/../../application/core/packages'),
// yiistrap configuration
'bootstrap' => realpath(__DIR__ . '/../extensions/bootstrap'),
'questiontypes' => realpath(__DIR__ . '/../extensions/questionTypes'),
'vendor.twbs.bootstrap.dist' => realpath(__DIR__ . '/../extensions/bootstrap'),
// yiiwheels configuration
'yiiwheels' => realpath(__DIR__ . '/../extensions/yiiwheels'),
'vendor.twbs.bootstrap.dist',
// Twig aliases. We don't want to change the file ETwigViewRenderer, so we can update it without difficulties
// However, LimeSurvey directory tree is not a standard Yii Application tree.
// we use 'third_party' instead of 'vendor'
// This line just point application.vendor.Twig to application/third_party/Twig
// @see: ETwigViewRenderer::$twigPathAlias
'application.vendor.Twig'=>'application.third_party.Twig',
),
'modules'=>array(
'gii'=>array(
//'class'=>'system.gii.GiiModule',
//'password'=>'toto',
// 'ipFilters'=>array(...a list of IPs...),
// 'newFileMode'=>0666,
// 'newDirMode'=>0777,
),
),
'params'=>array(
'defaultPageSize'=>10 , // Default page size for most of the grids
'pageSizeOptions'=>array(5=>5,10=>10,20=>20,50=>50,100=>100), // Default page size options for most of the grids
'pageSizeOptionsTokens'=>array(5=>5,10=>10,25=>25,50=>50,100=>100, 250=>250, 500=>500, 1000=>1000, 2500=>2500, 5000=>5000, 10000=>10000), // Tokens needs different options
'defaultEllipsizeHeaderValue'=>30, // Default max characters before ellipsizing the headers of responses grid
'defaultEllipsizeQuestionValue'=>50, // Default max characters before ellipsizing the questions inside responses grid
),
'import' => array(
'application.core.*',
'application.core.db.*',
'application.models.*',
'application.controllers.*',
'application.modules.*',
'bootstrap.helpers.*',
'bootstrap.widgets.*',
'bootstrap.behaviors.*',
'yiiwheels.widgets.select2.WhSelect2',
'third_party.Twig.*'
),
'preload' => array ('log'),
'components' => array(
// yiistrap configuration
'bootstrap' => array(
'class' => 'bootstrap.components.TbApi',
),
// yiiwheels configuration
'yiiwheels' => array(
'class' => 'yiiwheels.YiiWheels',
),
'clientScript'=>array(
'packages' => array_merge(
require('third_party.php'),
require('packages.php')
)
),
'urlManager' => array(
'urlFormat' => 'get',
'rules' => require('routes.php'),
'showScriptName' => true,
),
// These are defaults and are later overwritten in LSYii_Application by a path based on config tempdir/tempurl
'assetManager' => array(
'excludeFiles' => array("config.xml", "assessment.pstpl", "clearall.pstpl", "completed.pstpl", "endgroup.pstpl", "endpage.pstpl", "groupdescription.pstpl", "load.pstpl", "navigator.pstpl", "printanswers.pstpl", "print_group.pstpl", "print_question.pstpl", "print_survey.pstpl", "privacy.pstpl", "question.pstpl", "register.pstpl", "save.pstpl", "startgroup.pstpl", "startpage.pstpl", "surveylist.pstpl", "survey.pstpl", "welcome.pstpl" ),
'baseUrl' => '/tmp/assets',
'basePath'=> dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'assets',
),
'request' => array(
'class'=>'LSHttpRequest',
'enableCsrfValidation'=>true, // CSRF protection
'enableCookieValidation'=>false, // Enable to activate cookie protection
'noCsrfValidationRoutes'=>array(
'remotecontrol',
'plugins/unsecure',
),
'csrfCookie' => array(
'secure' => ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']== 443))
),
),
'user' => array(
'class' => 'LSWebUser',
),
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
'vardump' => array(
'class' => 'CWebLogRoute',
'categories' => 'vardump', // tracevar function
),
'profile' => array(
'class' => 'CProfileLogRoute'
),
)
),
'cache'=>array(
'class' => defined('YII_DEBUG') && YII_DEBUG ? 'system.caching.CDummyCache' : 'CFileCache',
),
'db' => array(
'schemaCachingDuration' => 3600,
'class' => 'DbConnection',
'enableProfiling' => isset($userConfig['config']['debugsql']) && $userConfig['config']['debugsql'] >= 1,
'enableParamLogging' => isset($userConfig['config']['debugsql']) && $userConfig['config']['debugsql'] >= 1
),
'session' => array(
'cookieParams' => array(
'httponly' => true,
'secure' => ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT']== 443))
),
),
'messages' => array(
'class' => 'CGettextMessageSource',
'cachingDuration'=>3600,
'forceTranslation' => true,
'useMoFile' => true,
'basePath' => __DIR__ . DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'locale'
),
'pluginManager' => array(
'class' => "\\ls\\pluginmanager\\PluginManager",
'api' => "\\ls\\pluginmanager\\LimesurveyApi"
),
'format'=>array(
'class'=>'application.extensions.CustomFormatter'
),
'twigRenderer' => array(
'class' => 'application.core.LSETwigViewRenderer',
// All parameters below are optional, change them to your needs
'fileExtension' => '.twig',
'options' => array(
'autoescape' => true,
),
// Those extensions, include the sendbox, will be done later in the process
'extensions' => array(
'Twig_Extension_Sandbox',
'Twig_Extension_StringLoader',
),
'globals' => array(
'html' => 'CHtml'
),
'functions' => array(
'rot13' => 'str_rot13',
),
'filters' => array(
'jencode' => 'CJSON::encode',
),
'sandboxConfig' => array(
'tags' => array('if', 'for'),
'filters' => array('escape'),
'methods' => array(),
'properties' => array(),
'functions' => array()
)
// Change template syntax to Smarty-like (not recommended)
// Could be use to manage potential conflict with Expression Manager
/*
'lexerOptions' => array(
'tag_comment' => array('{*', '*}'),
'tag_block' => array('{', '}'),
'tag_variable' => array('{$', '}')
),
*/
),
)
);
$result = CMap::mergeArray($internalConfig, $userConfig);
/**
* Some workarounds for erroneous settings in user config.php.
* seems not to be used anymore...
*/
$result['defaultController']=($result['defaultController']=='survey') ? $internalConfig['defaultController'] : $result['defaultController'];
/**
* Allways add needed routes at end
*/
$result['components']['urlManager']['rules']['<_controller:\w+>/<_action:\w+>']='<_controller>/<_action>';
return $result;
/* End of file internal.php */
/* Location: ./application/config/internal.php */