/** * Продолжение инициализации только в случае работы web приложения */ protected function _initWeb() { if (!$this->noImageUrl) { $this->noImageUrl = CmsAsset::getAssetUrl('img/image-not-found.jpg'); } if ($this->debugEnabled === self::BOOL_Y) { /** * @var $debugModule \yii\debug\Module */ $debugModule = \Yii::$app->getModule('debug'); $debugModule->allowedIPs = explode(',', $this->debugAllowedIPs); $debugModule->bootstrap(\Yii::$app); } if ($this->enabledHttpAuth == self::BOOL_Y) { $this->_goHttpAuth(); } //Выполнение агентов на хитах, должны быть включены в настройка, нужна system. if ($this->enabledHitAgents == self::BOOL_Y) { $key = 'Agents'; Yii::beginProfile($key); $data = \Yii::$app->cache->get($key); if ($data === false) { $result = \Yii::$app->console->execute("cd " . ROOT_DIR . '; php yii cms/utils/agents-execute;'); \Yii::$app->cache->set($key, '1', (int) $this->hitAgentsInterval); } Yii::endProfile($key); } /** * Генерация SEO метатегов. * */ \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function (Event $e) { if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { \Yii::$app->response->getHeaders()->setDefault('X-Powered-CMS', $this->moduleCms->descriptor->toString()); /** * @var $view View */ $view = $e->sender; if (!isset($view->metaTags[self::$_huck])) { $view->registerMetaTag(["name" => base64_decode(self::$_huck), "content" => $this->moduleCms->descriptor->toString()], self::$_huck); } } }); \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function (UserEvent $e) { $e->identity->logged_at = \Yii::$app->formatter->asTimestamp(time()); $e->identity->save(false); if ($this->moduleAdmin()->requestIsAdmin()) { \Yii::$app->user->identity->updateLastAdminActivity(); } }); \Yii::$app->on(AdminController::EVENT_INIT, function (AdminInitEvent $e) { //Если http авторизация на сайте отключена а в админке включена if ($this->enabledHttpAuth == self::BOOL_N && $this->enabledHttpAuthAdmin == self::BOOL_Y && $this->moduleAdmin()->requestIsAdmin()) { $this->_goHttpAuth(); } if ($e->controller instanceof AdminModelEditorController) { $e->controller->eventActions = ArrayHelper::merge($e->controller->eventActions, ['related-properties' => ['class' => AdminOneModelRelatedPropertiesAction::className(), 'name' => 'Дополнительные свойства', "icon" => "glyphicon glyphicon-plus-sign"]]); } if ($e->controller instanceof AdminModelEditorController) { $e->controller->eventActions = ArrayHelper::merge($e->controller->eventActions, ['system' => ['class' => AdminOneModelSystemAction::className(), 'name' => 'Системные данные', "icon" => "glyphicon glyphicon-cog", "priority" => 9999]]); } }); }
public function init() { parent::init(); //Название проекта. if (!$this->appName) { $this->appName = \Yii::$app->name; } else { \Yii::$app->name = $this->appName; } //Язык if ($this->languageCode) { \Yii::$app->language = $this->languageCode; } else { $this->languageCode = \Yii::$app->language; } if (\Yii::$app instanceof Application) { } else { $this->relatedHandlers = ArrayHelper::merge([PropertyTypeText::className() => ['class' => PropertyTypeText::className()], PropertyTypeNumber::className() => ['class' => PropertyTypeNumber::className()], PropertyTypeList::className() => ['class' => PropertyTypeList::className()], PropertyTypeFile::className() => ['class' => PropertyTypeFile::className()], PropertyTypeTree::className() => ['class' => PropertyTypeTree::className()], PropertyTypeElement::className() => ['class' => PropertyTypeElement::className()], UserPropertyTypeDate::className() => ['class' => UserPropertyTypeDate::className()], UserPropertyTypeComboText::className() => ['class' => UserPropertyTypeComboText::className()], UserPropertyTypeColor::className() => ['class' => UserPropertyTypeColor::className()], UserPropertyTypeSelectFile::className() => ['class' => UserPropertyTypeSelectFile::className()]], $this->relatedHandlers); //web init if (!$this->noImageUrl) { $this->noImageUrl = CmsAsset::getAssetUrl('img/image-not-found.jpg'); } \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function (Event $e) { if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) { \Yii::$app->response->getHeaders()->setDefault('X-Powered-CMS', $this->descriptor->name . " {$this->descriptor->homepage}"); /** * @var $view View */ $view = $e->sender; if (!isset($view->metaTags[self::$_huck])) { $view->registerMetaTag(["name" => base64_decode(self::$_huck), "content" => $this->descriptor->name . " — {$this->descriptor->homepage}"], self::$_huck); } if (!isset($view->metaTags['cmsmagazine'])) { $view->registerMetaTag(["name" => 'cmsmagazine', "content" => "7170fe3a42c6f80cd95fd8bce765333d"], 'cmsmagazine'); } } }); \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function (UserEvent $e) { $e->identity->logged_at = \Yii::$app->formatter->asTimestamp(time()); $e->identity->save(false); if (\Yii::$app->admin->requestIsAdmin) { \Yii::$app->user->identity->updateLastAdminActivity(); } }); } }
) repeat-x scroll 0 0 #BACB8C;color:#363636;padding:20px;"> <div style="width:92%;margin:20px auto 20px;padding:10px;background:#fff;"> <table style="width: 100%;"> <tbody> <tr> <td colspan="2"> <?php echo $content; ?> </td> </tr> <tr> <td colspan="2"> <p style="background:url(<?php echo \yii\helpers\Url::base(true) . \Yii::$app->getAssetManager()->getAssetUrl(\skeeks\cms\assets\CmsAsset::register($this), 'mail/dashed.gif'); ?> ) repeat-x scroll 0 0 transparent;font-size:11px;padding:17px 0 0;line-height:21px;margin:0 0 21px;"></p> </td> </tr> <tr> <td valign="center" style="width:50px;"> <a href="<?php echo \Yii::$app->cms->moduleCms()->getDescriptor()->homepage; ?> " target="_blank" style="width: 50px;"> <img src="<?php echo \Yii::$app->cms->logo(); ?> ">