forked from humhub/humhub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.php
59 lines (47 loc) · 1.28 KB
/
Application.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
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2015 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\components;
use Yii;
/**
* @inheritdoc
*/
class Application extends \yii\web\Application
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'humhub\\controllers';
/**
* @inheritdoc
*/
public function beforeAction($action)
{
/**
* Check if it's already installed - if not force controller module
*/
if (!$this->params['installed'] && $this->controller->module != null && $this->controller->module->id != 'installer') {
$this->controller->redirect(\yii\helpers\Url::to(['/installer/index']));
return false;
}
/**
* More random widget autoId prefix
* Ensures to be unique also on ajax partials
*/
\yii\base\Widget::$autoIdPrefix = 'h' . mt_rand(1, 999999) . 'w';
return parent::beforeAction($action);
}
/**
* @inheritdoc
*/
public function preInit(&$config)
{
if (!isset($config['timeZone']) && date_default_timezone_get()) {
$config['timeZone'] = date_default_timezone_get();
}
parent::preInit($config);
}
}