Blame view

frontend/config/main.php 17.9 KB
c237629a   Anastasia   first commit
1
  <?php
c237629a   Anastasia   first commit
2
      use frontend\components\UrlManager;
1a2eb53c   alex   сделал редирект д...
3
  use yii\helpers\Url;
608117b4   alex   Временно отключил...
4
      
c237629a   Anastasia   first commit
5
6
7
8
9
10
11
12
      $params = array_merge(
          require( __DIR__ . '/../../common/config/params.php' ),
          require( __DIR__ . '/../../common/config/params-local.php' ),
          require( __DIR__ . '/params.php' ),
          require( __DIR__ . '/params-local.php' )
      );
      
      return [
eaa321f3   alex   301 redirect from...
13
          'on beforeRequest' => function () {
1a2eb53c   alex   сделал редирект д...
14
15
  
  	        $pathInfo = Yii::$app->request->pathInfo;
eaa321f3   alex   301 redirect from...
16
              $query = Yii::$app->request->queryString;
1a2eb53c   alex   сделал редирект д...
17
  	        if (!empty($pathInfo) && substr($pathInfo, -1) === '/' && substr($pathInfo, 0, 1) !== "/") {
eaa321f3   alex   301 redirect from...
18
19
20
21
22
                  $url = '/' . substr($pathInfo, 0, -1);
                  if ($query) {
                      $url .= '?' . $query;
                  }
                  Yii::$app->response->redirect($url, 301);
1a2eb53c   alex   сделал редирект д...
23
24
              } # редирект с www.siteName.com//////////////////////// на www.siteName.com
  	        elseif (substr($pathInfo, 0, 1) == "/" && substr($pathInfo, 1, 1) == "/") {
1a2eb53c   alex   сделал редирект д...
25
26
  		        Yii::$app->response->redirect('/site/index', 301);
  	        }
eaa321f3   alex   301 redirect from...
27
          },
c237629a   Anastasia   first commit
28
29
30
          'id'                  => 'app-frontend',
          'homeUrl'             => '/',
          'basePath'            => dirname(__DIR__),
545a411b   alex   add autocompress
31
          'bootstrap'           => [ 'log','assetsAutoCompress' ],
c237629a   Anastasia   first commit
32
33
34
35
36
37
38
          'controllerNamespace' => 'frontend\controllers',
          'container' => [
              'singletons' => [
                  'artbox\core\services\Languages' =>'artbox\core\services\Languages',
              ]
          ],
          'modules'             => [
b60a88b8   Anastasia   - main page
39
              'feedback' => [
c237629a   Anastasia   first commit
40
41
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
c237629a   Anastasia   first commit
42
43
                  'attributes' => [
                      'name',
c237629a   Anastasia   first commit
44
                      'phone',
b60a88b8   Anastasia   - main page
45
                      'message',
c237629a   Anastasia   first commit
46
47
48
                  ],
                  'rules'      => [
                      [
c237629a   Anastasia   first commit
49
                          [
c237629a   Anastasia   first commit
50
51
52
53
54
55
56
                              'name',
                              'phone',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
d73fd852   alex   добавил переводы ...
57
58
59
                      'name'    => \Yii::t('app','Name'),
                      'message' => \Yii::t('app','Message'),
                      'phone'   => \Yii::t('app','Phone'),
c237629a   Anastasia   first commit
60
61
62
63
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
b60a88b8   Anastasia   - main page
64
                        'template' => '<div class="input-wr">{input}</div>'
c237629a   Anastasia   first commit
65
66
                      ],
                      'phone'   => [
b60a88b8   Anastasia   - main page
67
                          'template' => '<div class="input-wr phones_mask">{input}</div>'
c237629a   Anastasia   first commit
68
69
70
71
                      ],
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
b60a88b8   Anastasia   - main page
72
                          'template' => '<div class="input-wr">{input}</div>'
c237629a   Anastasia   first commit
73
74
                      ],
                  ],
b60a88b8   Anastasia   - main page
75
76
77
                  'buttonTemplate'  => '<div class="button-wr">{button}</div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Send',
c237629a   Anastasia   first commit
78
79
                  'sendEmail'       => false,
                  'ajax'            => true,
b60a88b8   Anastasia   - main page
80
81
                  'formId'          => 'feedback-form',
                  'scenario'        => 'callback',
c237629a   Anastasia   first commit
82
                  'successCallback' => 'function (data) {
b60a88b8   Anastasia   - main page
83
                   document.getElementById("feedback-form").reset();
b53dc2b2   Anastasia   - bug fix
84
                                $("#modal_close").click();
c237629a   Anastasia   first commit
85
                                if (data.status == "success"){
b60a88b8   Anastasia   - main page
86
                                document.getElementById("feedback-form").reset();
b53dc2b2   Anastasia   - bug fix
87
                                success();
b60a88b8   Anastasia   - main page
88
89
                                 var data = $("#feedback-form").data(\'yiiActiveForm\');
                                data.validated = false;
c237629a   Anastasia   first commit
90
91
92
93
                                }
                      }',
                  
              ],
b53dc2b2   Anastasia   - bug fix
94
95
96
97
98
              'contact' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "artbox\core\models\Feedback",
                  'attributes' => [
                      'name',
365b5721   Anastasia   email to phone in...
99
                      'phone',
b53dc2b2   Anastasia   - bug fix
100
101
102
103
104
105
106
107
108
109
110
111
                      'message',
                  ],
                  'rules'      => [
                      [
                          [
                              'name',
                              'email',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
d73fd852   alex   добавил переводы ...
112
113
                      'name'    => \Yii::t('app','Name'),
                      'message' => \Yii::t('app','Yours question'),
365b5721   Anastasia   email to phone in...
114
                      'phone'   => \Yii::t('app','Phone'),
b53dc2b2   Anastasia   - bug fix
115
116
117
118
119
120
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
365b5721   Anastasia   email to phone in...
121
122
                      'phone'   => [
                          'template' => '<div class="input-wr required phones_mask">{input}</div>'
b53dc2b2   Anastasia   - bug fix
123
124
125
126
127
128
129
130
131
132
133
134
135
                      ],
                      'message' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="button-wr submit-close-wr-c-a">{button}</div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Send',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'contact-form',
365b5721   Anastasia   email to phone in...
136
                  'scenario'        => 'callback',
b53dc2b2   Anastasia   - bug fix
137
138
139
140
141
142
143
144
145
                  'successCallback' => 'function (data) {
                   document.getElementById("contact-form").reset();
                                if (data.status == "success"){
                                document.getElementById("contact-form").reset();
                                success();
                                 var data = $("#contact-form").data(\'yiiActiveForm\');
                                data.validated = false;
                                }
                      }',
ebde7ea6   Anastasia   - forms
146
  
b53dc2b2   Anastasia   - bug fix
147
              ],
ebde7ea6   Anastasia   - forms
148
149
150
151
152
153
154
              'comments' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "common\models\Comment",
                  'attributes' => [
                      'name',
                      'email',
                      'comment',
68e72651   Anastasia   - blog
155
156
                      'entity_id',
                      'entity'
ebde7ea6   Anastasia   - forms
157
158
159
160
161
162
163
164
165
166
167
168
169
170
                  ],
                  'rules'      => [
                      [
                          [
                              'name',
                              'email',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
                      'name'    => 'ФИО',
                      'email' => 'Email',
                      'comment' => 'Ваш отзыв',
68e72651   Anastasia   - blog
171
172
                      'entity_id' => false,
                      'entity' => false
ebde7ea6   Anastasia   - forms
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
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'comment' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="button-wr submit-close-wr-c-a">{button} <div class="submit-close-c-a"><span>Закрыть окно</span></div></div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Отправить отзыв',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'comment-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
                   document.getElementById("comment-form").reset();
                                var data = $("#comment-form").data(\'yiiActiveForm\');
                                $("#comment-form").find(".submit-close-c-a span").click();
95fc39b2   Anastasia   - forms
199
                                $("#comment-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Ваш отзыв появится после проверки модератором</p>")
ebde7ea6   Anastasia   - forms
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
241
242
243
244
245
246
247
248
249
                                data.validated = false;
                      }',
  
              ],
              'questions' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "common\models\Question",
                  'attributes' => [
                      'name',
                      'email',
                      'question',
                      'service_id'
                  ],
                  'rules'      => [
                      [
                          [
                              'name',
                              'email',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
                      'name'    => 'ФИО',
                      'email' => 'Email',
                      'question' => 'Ваш вопрос',
                      'service_id' => false
                  ],
      
                  'inputOptions'    => [
                      'name'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="input-wr required">{input}</div>'
                      ],
                      'question' => [
                          'type'    => 'textarea',
                          'options' => [],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
                  'buttonTemplate'  => '<div class="button-wr submit-close-wr-c-a">{button} <div class="submit-close-c-a"><span>Закрыть окно</span></div></div>',
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Отправить вопрос',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'question-form',
                  'scenario'        => 'question',
                  'successCallback' => 'function (data) {
cc2da9cc   Anastasia   - question page
250
                   document.getElementById("question-form").reset();
ebde7ea6   Anastasia   - forms
251
252
253
254
255
256
257
                                var data = $("#question-form").data(\'yiiActiveForm\');
                                $("#question-form").find(".submit-close-c-a span").click();
                                $("#question-form").parent().parent().parent().find(".service-c-a-btns").after("<p>Спасибо за Вваш вопрос. Мы обязательно на него ответим</p>")
                                data.validated = false;
                      }',
  
              ],
fce22ac2   Anastasia   - visits
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
  
              'visit' => [
                  'class'      => 'artbox\core\forms\Module',
                  'activeRecord' => "common\models\Visit",
                  'attributes' => [
                      'name',
                      'phone',
                      'email',
                      'message',
                      
                      'entity',
                      'entity_id'
                  ],
                  'rules'      => [
                      [
                          [
                              'phone',
                          ],
                          'required',
                      ]
                  ],
                  'labels'     => [
d73fd852   alex   добавил переводы ...
280
281
282
283
                      'name'    =>\Yii::t('app','FIO'),
                      'email' =>\Yii::t('app','Email'),
                      'phone' => \Yii::t('app','Phone'),
                      'message' => \Yii::t('app','Message'),
fce22ac2   Anastasia   - visits
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
                      'entity_id' => false,
                      'entity' => false
                  ],
      
                  'inputOptions'    => [
                      'entity' => [
                         'type' => 'hiddenInput'
                      ],
                      'entity_id' => [
                          'type' => 'hiddenInput'
                      ],
                      'name'   => [
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                      'email'   => [
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                      'phone'   => [
                          'template' => '<div class="input-wr required phones_mask">{input}</div>',
                          'options' => [
                              'placeholder' => '(0__)___-__-__'
                          ]
                      ],
                      'message' => [
                          'type'    => 'textarea',
                          'options' => ['cols' => 30, 'rows'=> 10],
                          'template' => '<div class="input-wr">{input}</div>'
                      ],
                  ],
39392f19   Anastasia   - visit form
313
                  'buttonTemplate'  => '<div class="button-wr">{button}</div>',
fce22ac2   Anastasia   - visits
314
315
316
317
318
319
320
321
322
323
324
325
326
327
                  'buttonOptions'   => [],
                  'buttonContent'   => 'Отправить',
                  'sendEmail'       => false,
                  'ajax'            => true,
                  'formId'          => 'visit-form',
                  'scenario'        => 'default',
                  'successCallback' => 'function (data) {
                   document.getElementById("visit-form").reset();
                                var data = $("#visit-form").data(\'yiiActiveForm\');
                                data.validated = false;
                                success();
                      }',
  
              ],
c237629a   Anastasia   first commit
328
329
          ],
          'components'          => [
b60a88b8   Anastasia   - main page
330
331
332
333
334
335
336
              'assetManager'       => [
                  'bundles'         => [
                      'yii\bootstrap\BootstrapAsset' => [
                          'basePath' => '@webroot',
                          'baseUrl'  => '@web',
                          'css'       => [],
                      ],
43a24059   Anastasia   - servives
337
338
339
340
341
                      'frontend\assets\ArtboxModalAsset' => [
                          'basePath' => '@webroot',
                          'baseUrl'  => '@web',
                          'css'       => [],
                      ],
b60a88b8   Anastasia   - main page
342
343
344
                  ],
                  'appendTimestamp' => true,
              ],
c237629a   Anastasia   first commit
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
              'request'      => [
                  'csrfParam' => '_csrf-frontend',
                  'baseUrl'   => '',
              ],
              'user'         => [
                  'identityClass'   => 'common\models\User',
                  'enableAutoLogin' => true,
                  'identityCookie'  => [
                      'name'     => '_identity-frontend',
                      'httpOnly' => true,
                  ],
              ],
              'session'      => [
                  // this is the name of the session cookie used for login on the frontend
                  'name' => 'advanced-frontend',
              ],
              'log'          => [
                  'traceLevel' => YII_DEBUG ? 3 : 0,
                  'targets'    => [
                      [
                          'class'  => 'yii\log\FileTarget',
                          'levels' => [
                              'error',
                              'warning',
                          ],
                      ],
                  ],
              ],
c237629a   Anastasia   first commit
373
374
375
376
377
378
379
380
              'errorHandler' => [
                  'errorAction' => 'site/error',
              ],
              'urlManager'   => [
                  'class'           => UrlManager::className(),
                  'baseUrl'         => '/',
                  'enablePrettyUrl' => true,
                  'showScriptName'  => false,
eaa321f3   alex   301 redirect from...
381
                  'rules'           => [
139caeae   alex   поправил микрораз...
382
  
eaa321f3   alex   301 redirect from...
383
                  ],
c237629a   Anastasia   first commit
384
385
                  'hideDefaultLanguagePrefix' => true,
              ],
545a411b   alex   add autocompress
386
387
              'assetsAutoCompress' => [
                  'class'   => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
36308a03   Виталий   big update
388
                  'enabled' => false,
545a411b   alex   add autocompress
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
      
                  'readFileTimeout' => 3,
                  //Time in seconds for reading each asset file
      
                  'jsCompress'                => true,
                  //Enable minification js in html code
                  'jsCompressFlaggedComments' => true,
                  //Cut comments during processing js
      
                  'cssCompress' => true,
                  //Enable minification css in html code
      
                  'cssFileCompile'        => true,
                  //Turning association css files
                  'cssFileRemouteCompile' => false,
                  //Trying to get css files to which the specified path as the remote file, skchat him to her.
                  'cssFileCompress'       => true,
                  //Enable compression and processing before being stored in the css file
                  'cssFileBottom'         => false,
                  //Moving down the page css files
                  'cssFileBottomLoadOnJs' => false,
                  //Transfer css file down the page and uploading them using js
      
                  'jsFileCompile'                 => true,
                  //Turning association js files
                  'jsFileRemouteCompile'          => false,
                  //Trying to get a js files to which the specified path as the remote file, skchat him to her.
                  'jsFileCompress'                => true,
                  //Enable compression and processing js before saving a file
                  'jsFileCompressFlaggedComments' => true,
                  //Cut comments during processing js
      
03ffbf5b   Anastasia   asset autocompress
421
                  'htmlCompress'           => true,
545a411b   alex   add autocompress
422
423
424
                  //Enable compression html
                  'noIncludeJsFilesOnPjax' => true,
                  //Do not connect the js files when all pjax requests
03ffbf5b   Anastasia   asset autocompress
425
                  'htmlCompressOptions'    =>              //options for compressing output result
545a411b   alex   add autocompress
426
427
428
429
430
431
432
                      [
                          'extra'       => false,
                          //use more compact algorithm
                          'no-comments' => true
                          //cut all the html comments
                      ],
              ],
c237629a   Anastasia   first commit
433
434
435
436
          ],
          
          'params'              => $params,
      ];