public function init() { $uri = Yii::app()->request->requestUri; if (strpos($uri, 'favicon') !== false || strpos($uri, 'robots') !== false) { Yii::app()->end(); } parent::init(); $this->view = Yii::app()->getViewRenderer(); $reqUri = Yii::app()->getRequest()->getRequestUri(); if (strpos($reqUri, '?') !== false) { $reqUri = substr($reqUri, 0, strpos($reqUri, '?')); } $this->view->currentURI = $reqUri; $this->view->currentCaption = $this->getCurrentCaption($reqUri); $fscname = null; // if (Yii::app()->user->getId() !== null) { $fscname = Yii::app()->user->fscname; $this->view->sitemedia = array('uri' => Yii::app()->params['mediauri'], 'jssuffix' => Yii::app()->params['mediasuffix']); } if ($fscname) { $this->view->userinfo = array('fscname' => $fscname); $this->renderMenu(); } }
public function init() { $this->baseUrl = Y::config('baseUrl'); Yii::app()->language = isset($_GET['lang']) ? $_GET['lang'] : "ru"; parent::init(); }
public function init() { if (Yii::app()->user->isGuest) { $this->redirect(Yii::app()->createUrl('auth/login')); } return parent::init(); }
public function init() { parent::init(); if (!Ibos::app()->user->isGuest && Ibos::app()->user->isNeedReset && !Ibos::app()->request->isAjaxRequest) { Ibos::app()->request->redirect(Ibos::app()->createUrl("user/default/reset")); } }
public function init() { if (Yii::app()->user->id) { Yii::app()->theme = Yii::app()->user->theme; } parent::init(); }
public function init() { // enable the KCFINDER uploads $KCFINDER = array('disabled' => false, 'uploadURL' => Yii::app()->baseUrl . "/uploads/", 'uploadDir' => Yii::app()->basePath . "/../uploads/"); Yii::app()->session['KCFINDER'] = $KCFINDER; parent::init(); }
/** * @inheritDoc */ public function init() { parent::init(); if ($this->layout === null) { $this->layout = $this->module->defaultLayout; } }
public function init() { if ($layout = $this->getModule()->adminLayout) { $this->layout = $layout; } parent::init(); }
public function init() { parent::init(); Yii::import('ext.ThemePicker.EThemePicker'); EThemePicker::setTheme(); Yii::app()->params['title'] = Yii::app()->name; $controller = Yii::app()->controller; if (!file_exists('install_lock.txt')) { if (!$controller instanceof InstallController) { $this->redirect('install/install'); } } if (isset($_GET['lang']) && $_GET['lang'] != "") { //當點擊轉換語言時 Yii::app()->user->setState("language", $_GET['lang']); //相當於與設置一個cookie Yii::app()->language = Yii::app()->user->getState("language"); //轉換成相應的記錄語言 } if (Yii::app()->user->getState("language")) { //如果設置了有session記錄 Yii::app()->language = Yii::app()->user->getState("language"); //轉換成相應的記錄語言 } else { Yii::app()->user->setState("language", "en_us"); //沒有session則設置一個session.默認語言為en_us Yii::app()->language = Yii::app()->user->getState("language"); //轉換成相應的記錄語言 } }
public function init() { parent::init(); if (empty($this->modelName)) { throw new CException("You should set modelName before using JsonApiController."); } }
function init() { // MFM CController parent::init(); $app = Yii::app(); if (isset($_POST['_lang'])) { $app->language = $_POST['_lang']; $app->session['_lang'] = $app->language; } else { if (isset($app->session['_lang'])) { $app->language = $app->session['_lang']; } } //----------------------------- if (!Yii::app()->user->isGuest) { $identity = new UserIdentity(Yii::app()->user->username, Yii::app()->user->password); $identity->authenticate(false); if ($identity->errorCode != ERROR_NONE) { Yii::app()->user->logout(); Yii::app()->user->setState('status', User::STATUS_GUEST); $this->redirect(Yii::app()->homeUrl); } } else { Yii::app()->user->setState('status', User::STATUS_GUEST); } }
public function init() { if ($this->_mustHaveRec && !isset($this->actionParams['rec'])) { throw new CHttpException(403); } parent::init(); }
/** * Инициализация контроллера */ public function init($action) { parent::init(); $this->uid = get_uid(false); $this->is_adm = hasPermissions('projects', $this->uid); $this->layout = '//layouts/content-with-right-narrow-sidebar'; }
function init() { parent::init(); ClassSession::savedSessionId(); /// just to be SURE it is set Yii::app()->setTimeZone(Yii::app()->params['timezone']); }
public function init() { parent::init(); if (Yii::app()->request->getIsAjaxRequest()) { $this->layout = '//layouts/clear'; } }
public function init() { parent::init(); if (!$this->isLogged()) { $this->redirect(array('site/adminLogin')); } }
/** * initialize */ function init() { parent::init(); if (Yii::app()->getRequest()->getParam('printview')) { Yii::app()->layout = 'print'; } }
public function init() { if (!extension_loaded('apc')) { throw new CException('PHP\'s APC extension must be loaded!'); } parent::init(); }
function init() { global $db, $user, $mainframe, $hideMenu; $hideMenu = 0; $task = Request::getVar("task", ""); if ($task != "") { $cmd = "action{$task}()"; if (method_exists($this, $cmd)) { $this->{$cmd}(); } } $db = $this->db = Yii::app()->db; Yii::app()->name = "Back end"; $user = $this->user = Yii::app()->session['userbackend']; $mainframe = MainFrame::getInstance($this->db, $this->user); parent::init(); $app = Yii::app(); if (!$mainframe->isLogin()) { $duration = time() + 300; // 365 days } else { $remember_admin = (isset($_COOKIE['remember_admin']) and $_COOKIE['remember_admin'] == 1) ? 1 : 0; if ($remember_admin == 1) { $duration = time() + 86400 * 30; } else { $duration = time() + 900; } // 15 minutes } $cookie = new CHttpCookie(session_name(), session_id(), array("expire" => $duration)); $app->getRequest()->getCookies()->add($cookie->name, $cookie); }
public function init() { parent::init(); $user = Yii::app()->user; $isGuest = $user->getIsGuest(); $this->topMenu = array(array('label' => 'Home', 'url' => array('dashboard/index')), array('label' => 'Account' . (!$isGuest ? ' (' . Yii::app()->user->name . ')' : ''), 'items' => array(array('label' => 'Logout', 'url' => array('user/logout'), 'visible' => !$isGuest), array('label' => 'Login', 'url' => array('user/login'), 'visible' => $isGuest), array('label' => 'Register', 'url' => array('user/register'), 'visible' => $isGuest)))); }
public function init() { Yii::app()->clientScript->registerCoreScript('jquery'); Yii::app()->clientScript->registerScriptFile('/js/main.js', CClientScript::POS_END); $this->user = User::model()->findByPk(Yii::app()->user->id); parent::init(); }
public function init() { // for google: redirecting $host = $_SERVER['HTTP_HOST']; $this->pageTitle = CHtml::encode(Yii::app()->name); $this->_counter(); if (!defined('YII_DEBUG') && Yii::app()->params['googleAnalytics']) { Yii::app()->getClientScript()->registerScriptFile('http://www.google-analytics.com/ga.js'); } $this->baseUrl = Yii::app()->theme->baseUrl . '/'; $this->imageUrl = Yii::app()->baseUrl . '/bilder/'; // style foreach (Yii::app()->params['cssFiles'] as $f) { $file = $f[0]; if (isset($f[1])) { if ($f[1] == '/') { Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . $file); } if ($f[1] == 'themes') { Yii::app()->clientScript->registerCssFile($this->baseUrl . $file); } } else { Yii::app()->clientScript->registerCssFile($this->baseUrl . $file); } } parent::init(); }
public function init() { parent::init(); stat_collector::setStamp(); // stamp $this->uid = get_uid(); $this->is_adm = hasPermissions('tservices'); // разметка страницы с левым сайдбаром $this->layout = '//layouts/content-with-right-sidebar'; // в сайдбаре вывести фильтр с учётом текущей категории $this->getClips()->add('sidebar', $this->widget('TServiceFilter', array(), true)); // чтобы отрисовать фильтр и опции # TODO добиться, чтобы $this->widget('TServiceFilter') и $this->createWidget($this,'TServiceFilter') возвращал один и тот же объект $this->filter_widget = $this->createWidget($this, 'TServiceFilter', array()); // копия, чтобы узнать, какие опции были выбраны $prof_id = $this->filter_widget->filter->category ? $this->filter_widget->filter->category : $this->filter_widget->filter->category_group; //---------------------------------------------------------------------- //@todo: возможно нужно общее хранилище собираемых данных //в течении работы скрипта с последующей передачей в GA и Adriver? GaJsHelper::getInstance()->setTuCategories($this->filter_widget->filter->category_group, $this->filter_widget->filter->category); adriver::getInstance()->setTuCategories($this->filter_widget->filter->category_group, $this->filter_widget->filter->category); //---------------------------------------------------------------------- SeoTags::getInstance()->initTserviceList($prof_id, $this->filter_widget->filter->category > 0); $this->getClips()->add('header', $this->widget('TServiceNavigation', array('category_group' => $this->filter_widget->filter->category_group, 'category' => $this->filter_widget->filter->category, 'filter_get_params' => $this->filter_widget->getUserFriendlyUrl(false)), true)); $this->getClips()->add('content_top', $this->widget('TServiceCatalogHeader', array(), true)); $this->getClips()->add('categories', $this->widget('TServiceCatalogCategories', array('category_group' => $this->filter_widget->filter->category_group, 'filter_get_params' => $this->filter_widget->getUserFriendlyUrl(false)), true)); // в футере каталога вывести список специализаций фрилансеров $this->getClips()->add('footer', $this->widget('TServiceFreelancersCategories', array(), true)); $tserviceModel = TServiceModel::model(); $this->counter_users = $tserviceModel->countUsers(); $this->counter_tu = $tserviceModel->countTservices(); }
public function init() { parent::init(); $user = Yii::app()->user; Yii::app()->clientScript->registerPackage("jquery")->registerScriptFile("/js/jquery.form.js")->registerScriptFile("/js/jquery.cookie.js")->registerScriptFile("/js/global.js?16")->registerCssFile(Yii::app()->user->ini["t.iface"] == 1 ? "/css/v3.1.css?3" : "/css/v3.css?13"); if (!$user->isGuest) { Yii::app()->clientScript->registerScriptFile("/js/user.js?3"); Yii::app()->clientScript->registerScriptFile("/js/chat.js?3"); if ($user->can("betatest")) { $A = Yii::app()->params["blog_topics"]; $A["common"][70] = "Стройплощадка"; Yii::app()->params["blog_topics"] = $A; } Yii::app()->clientScript->registerScript("user_init", "var User = new CUser({id: " . Yii::app()->user->id . ", login: '******'});\n", CClientScript::POS_HEAD); // Статистика использования интерфейса $higgsStat = Yii::app()->cache->get("higgsStat"); $higgsStat[$user->id] = $user->ini["t.iface"]; Yii::app()->cache->set("higgsStat", $higgsStat); unset($higgsStat); } else { Yii::app()->clientScript->registerScript("user_init", "var User = new CUser({id: 0, login: '******'});\n", CClientScript::POS_HEAD); } CHtml::$afterRequiredLabel = ""; if (Yii::app()->user->isPaid) { Yii::app()->clientScript->registerScriptFile("/js/paiduser.js"); } if (Yii::app()->user->ini["t.iface"] == 1) { Yii::app()->clientScript->registerCss("user_ini_css", Yii::app()->user->ini->getCss()); } }
/** * Инициализация контроллера. */ public function init() { parent::init(); $this->is_adm = hasPermissions('tservices'); $this->is_emp = (bool) is_emp(); $this->layout = '//layouts/content-with-right-sidebar-fixed'; $this->order_model = TServiceOrderModel::model(); }
public function init() { parent::init(); $this->module = Yii::app()->getModule('plugin'); $this->folder = Yii::getPathOfAlias($this->module->pluginRoot); $this->PluginManger = new PluginManger(); $this->adminLayout = $this->module->layout; }
public function init() { parent::init(); $theme = Yii::app()->settings->theme; if ($theme !== null && $theme != '') { Yii::app()->theme = $theme; } }
public function init() { parent::init(); $this->user = Yii::app()->session['user']; $this->_table = 'users'; $this->db = EduDataBase::getConnection(); $this->layout = null; }
public function init() { parent::init(); // $this->_initLanguage(); if (YII_DEBUG) { Yii::app()->clientScript->registerScriptFile('/js/plugins/debug.js'); } }
/** * */ public function init() { /** @var EmailModule $audit */ $email = Yii::app()->getModule('email'); if ($email->homeUrl) { Yii::app()->homeUrl = $email->homeUrl; } parent::init(); }