PHP Method Yii::t Code Examples

This page contains top rated real world PHP examples of method Yii::t extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: AccountsGridViewProfileWidget.php Project: dsyman2/X2CRM
0
 /**
  * @return array the config array passed to widget ()
  */
 public function getGridViewConfig()
 {
     if (!isset($this->_gridViewConfig)) {
         $this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('moduleName' => 'Accounts', 'defaultGvSettings' => array('gvCheckbox' => 30, 'name' => 184, 'type' => 153, 'phone' => 115), 'specialColumns' => array('name' => array('name' => 'name', 'header' => Yii::t('accounts', 'Name'), 'value' => '$data->link', 'type' => 'raw'))));
     }
     return $this->_gridViewConfig;
 }
Example #2
Show file File: RegistrationForm.php Project: kuzmina-mariya/unizaro-kamin
0
 public function checkEmail($attribute, $params)
 {
     $model = User::model()->find('email = :email', array(':email' => $this->{$attribute}));
     if ($model) {
         $this->addError('email', Yii::t('UserModule.user', 'Email already busy'));
     }
 }
Example #3
Show file File: LoginForm.php Project: paranoidxc/iwebhost
0
 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     $this->_identity = new UserIdentity($this->username, $this->password);
     if (!$this->_identity->authenticate()) {
         $this->addError('password', Yii::t('cp', 'Incorrect username or password.'));
     }
 }
Example #4
Show file File: UAccessController.php Project: shakyapranin/IMS
0
 /**
  * filterUserAdminControl 
  * 
  * @param mixed $filterChain 
  * @return void
  */
 public function filterUserAdminControl($filterChain)
 {
     // Get login action url
     if (is_array(Yii::app()->user->loginUrl)) {
         $loginUrl = trim(Yii::app()->user->loginUrl[0], '/');
     } else {
         $loginUrl = trim(Yii::app()->user->loginUrl, '/');
     }
     $errorAction = trim(Yii::app()->errorHandler->errorAction, '/');
     // If it's not error or login action
     if (strtolower($this->route) === strtolower($loginUrl) or strtolower($this->route) === strtolower($errorAction)) {
         $filterChain->run();
     } elseif ($this->freeAccess === true or in_array($this->action->id, $this->freeAccessActions)) {
         $filterChain->run();
     } elseif (Yii::app()->user->isGuest) {
         if ($this->_isRouteAllowed($this->_getGuestAllowedRoutes())) {
             $filterChain->run();
         } else {
             Yii::app()->user->returnUrl = array('/' . $this->route);
             $this->redirect(Yii::app()->user->loginUrl);
         }
     } elseif (User::checkRole('isSuperAdmin')) {
         $filterChain->run();
     } else {
         if ($this->_isRouteAllowed(array_merge($this->_getAllowedUserRoutes(), $this->_getGuestAllowedRoutes()))) {
             $filterChain->run();
         } else {
             throw new CHttpException(403, Yii::t("UserAdminModule.front", "You are not authorized to perform this action."));
         }
     }
 }
Example #5
Show file File: BootCrumb.php Project: rosko/AlmazService
0
 /**
  * Renders the content of the widget.
  */
 public function run()
 {
     $links = array();
     if ($this->homeLink === null || !(isset($this->homeLink['label']) && isset($this->homeLink['url']))) {
         $this->homeLink = array('label' => Yii::t('bootstrap', 'Home'), 'url' => Yii::app()->homeUrl);
     }
     if (!empty($this->links)) {
         $content = CHtml::link($this->homeLink['label'], $this->homeLink['url']);
         $links[] = $this->renderItem($content);
     } else {
         $links[] = $this->renderItem($this->homeLink['label'], true);
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $label = $this->encodeLabel ? CHtml::encode($label) : $label;
             $content = CHtml::link($label, $url);
             $links[] = $this->renderItem($content);
         } else {
             $links[] = $this->renderItem($this->encodeLabel ? CHtml::encode($url) : $url, true);
         }
     }
     echo CHtml::openTag('ul', $this->htmlOptions);
     echo implode('', $links);
     echo '</ul>';
 }
Example #6
Show file File: AdminController.php Project: blrtromax/seobility
0
 /**
  * Displays a particular model.
  */
 public function actionView($id)
 {
     $this->layout = '//layouts/templates/admin';
     $model = System::loadModel('User', $id);
     $this->seo(Yii::t('admin', 'View user') . ' ' . $model->username);
     $this->render('view', array('model' => $model));
 }
Example #7
Show file File: ForumThreads.php Project: mmorpg2015/ghtweb5
0
 public function init()
 {
     $data = array('content' => array(), 'error' => Yii::t('main', 'Модуль отключен.'));
     if (config('forum_threads.allow') == 1) {
         $data = cache()->get(CacheNames::FORUM_THREADS);
         if ($data === FALSE) {
             $data = array();
             try {
                 // Подключаюсь к БД
                 $this->db = Yii::createComponent(array('class' => 'CDbConnection', 'connectionString' => 'mysql:host=' . config('forum_threads.db_host') . ';port=' . config('forum_threads.db_port') . ';dbname=' . config('forum_threads.db_name'), 'enableProfiling' => YII_DEBUG, 'enableParamLogging' => TRUE, 'username' => config('forum_threads.db_user'), 'password' => config('forum_threads.db_pass'), 'charset' => 'utf8', 'emulatePrepare' => TRUE, 'tablePrefix' => config('forum_threads.prefix')));
                 app()->setComponent('ForumThreadsDb', $this->db);
                 $forumType = config('forum_threads.type');
                 if (method_exists($this, $forumType)) {
                     $data['content'] = $this->{$forumType}();
                     foreach ($data['content'] as $k => $v) {
                         $data['content'][$k]['user_link'] = $this->getUserLink($v['starter_id'], $v['starter_name']);
                         $data['content'][$k]['theme_link'] = $this->getForumLink($v['id_topic'], $v['title'], $v['id_forum']);
                         $data['content'][$k]['start_date'] = $this->getStartDate($v['start_date']);
                     }
                     if (config('forum_threads.cache')) {
                         cache()->set(CacheNames::FORUM_THREADS, $data, config('forum_threads.cache') * 60);
                     }
                 } else {
                     $data['error'] = Yii::t('main', 'Метод для обработки форума: :type не найден.', array(':type' => '<b>' . $forumType . '</b>'));
                 }
             } catch (Exception $e) {
                 $data['error'] = $e->getMessage();
             }
         }
     }
     app()->controller->renderPartial('//forum-threads', $data);
 }
Example #8
Show file File: ProfileController.php Project: blrtromax/seobility
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  */
 public function actionEdit()
 {
     $model = $this->loadUser();
     $profile = $model->profile;
     // ajax validator
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'profile-form') {
         echo UActiveForm::validate(array($model, $profile));
         Yii::app()->end();
     }
     if (isset($_POST['User'])) {
         $model->attributes = $_POST['User'];
         $model->image = CUploadedFile::getInstance($model, 'image');
         $profile->attributes = $_POST['Profile'];
         if ($model->validate() && $profile->validate()) {
             $model->save();
             $profile->save();
             Yii::app()->user->updateSession();
             Yii::app()->user->setFlash('profileMessage', Yii::t('main', "Data saved successfully!"));
             $this->redirect(array('/user/profile'));
         } else {
             $profile->validate();
         }
     }
     $this->render('edit', array('model' => $model, 'profile' => $profile));
 }
Example #9
Show file File: BaseApplication.php Project: cookedsteak/lulucms2
0
 public function handleRequest($request)
 {
     if (empty($this->catchAll)) {
         list($route, $params) = $request->resolve();
     } else {
         $route = $this->catchAll[0];
         $params = array_splice($this->catchAll, 1);
     }
     try {
         LuLu::trace("Route requested: '{$route}'", __METHOD__);
         $this->requestedRoute = $route;
         $actionsResult = $this->runAction($route, $params);
         $result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult;
         if ($result instanceof \yii\web\Response) {
             return $result;
         } else {
             $response = $this->getResponse();
             if ($result !== null) {
                 $response->data = $result;
             }
             return $response;
         }
     } catch (InvalidRouteException $e) {
         throw new NotFoundHttpException(Yii::t('yii', 'Page not found.'), $e->getCode(), $e);
     }
 }
Example #10
Show file File: PinjamanpegTController.php Project: nelitaaas/Tugas-Besar
0
 /**
  * Specifies the access control rules.
  * This method is used by the 'accessControl' filter.
  * @return array access control rules
  */
 public function accessRules()
 {
     if (!Yii::app()->user->checkAccess(Yii::app()->controller->action->id)) {
         throw new CHttpException(401, Yii::t('mds', 'You are prohibited to access this page. Contact Super Administrator'));
     }
     return array(array('allow', 'actions' => array('index', 'view', 'create', 'update', 'admin', 'delete', 'print', 'details', 'bayar', 'PrintDetails', 'bayarkan'), 'users' => array('@')), array('deny', 'users' => array('*')));
 }
Example #11
Show file File: AdminOrderStatusController.php Project: skeeks-cms/cms-shop
0
 public function init()
 {
     $this->name = \Yii::t('skeeks/shop/app', 'Order statuses');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopOrderStatus::className();
     parent::init();
 }
Example #12
Show file File: Flatmacpanel.php Project: paranoidxc/iwebhost
0
    public function init()
    {
        $this->close = Yii::t('cp', 'Close');
        $this->min = Yii::t('cp', 'Min');
        $this->max = Yii::t('cp', 'Max');
        $r = <<<EOT
    <table class="mac_panel">
       <tr class="panel_top">
        <td class="left"></td> 
        <td class="middle drag_handle">
          <span class="title">{$this->title}</span>
        </td>
        <td class="left_ct" >
          <span class="ct close" title="{$this->close}"></span>
          <!--<span class="ct min" title="{$this->min}"></span>-->
          <span class="ct max" title="{$this->max}"></span>
        </td>
        <td class="right"></td>
      </tr>
    </table>
    \t<!-- mac panel middle start -->
     <table class="mac_panel" id="content">
       <tr class="panel_middle">
         <td class="left"></td>
         <td class="middle">        
EOT;
        echo $r;
    }
Example #13
Show file File: CFileLogRoute.php Project: YSeanKo/MCS
0
 /**
  * @param string $value directory for storing log files.
  * @throws CException if the path is invalid
  */
 public function setLogPath($value)
 {
     $this->_logPath = realpath($value);
     if ($this->_logPath === false || !is_dir($this->_logPath) || !is_writable($this->_logPath)) {
         throw new CException(Yii::t('yii', 'CFileLogRoute.logPath "{path}" does not point to a valid directory. Make sure the directory exists and is writable by the Web server process.', array('{path}' => $value)));
     }
 }
Example #14
Show file File: BatchAction.php Project: jerrylsxu/yiifcms
0
 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             Comment::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Comment::model()->updateAll(['status' => Comment::STATUS_SHOW], $criteria);
             break;
         case 'hide':
             //隐藏
             Comment::model()->updateAll(['status' => Comment::STATUS_HIDE], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
Example #15
Show file File: LoginAction.php Project: sepaker/yupe
0
 public function run()
 {
     if (Yii::app()->user->isAuthenticated()) {
         $this->controller->redirect(Url::redirectUrl(Yii::app()->getUser()->getReturnUrl()));
     }
     /**
      * Если было совершено больше 3х попыток входа
      * в систему, используем сценарий с капчей:
      **/
     $badLoginCount = Yii::app()->authenticationManager->getBadLoginCount(Yii::app()->getUser());
     $module = Yii::app()->getModule('user');
     $scenario = $badLoginCount > (int) $module->badLoginCount ? LoginForm::LOGIN_LIMIT_SCENARIO : '';
     $form = new LoginForm($scenario);
     if (Yii::app()->getRequest()->getIsPostRequest() && !empty($_POST['LoginForm'])) {
         $form->setAttributes(Yii::app()->getRequest()->getPost('LoginForm'));
         if ($form->validate() && Yii::app()->authenticationManager->login($form, Yii::app()->getUser(), Yii::app()->getRequest())) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('UserModule.user', 'You authorized successfully!'));
             if (Yii::app()->getUser()->isSuperUser() && $module->loginAdminSuccess) {
                 $redirect = $module->loginAdminSuccess;
             } else {
                 $redirect = empty($module->loginSuccess) ? Yii::app()->getBaseUrl() : $module->loginSuccess;
             }
             $redirect = Yii::app()->getUser()->getReturnUrl($redirect);
             Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), 0);
             $this->controller->redirect(Url::redirectUrl($redirect));
         } else {
             $form->addError('email', Yii::t('UserModule.user', 'Email or password was typed wrong!'));
             Yii::app()->authenticationManager->setBadLoginCount(Yii::app()->getUser(), $badLoginCount + 1);
         }
     }
     $this->controller->render($this->id, array('model' => $form));
 }
Example #16
Show file File: ArrayOwlCarousel.php Project: czechcamus/dasport
0
 public function init()
 {
     parent::init();
     if (!$this->items) {
         throw new InvalidConfigException(\Yii::t('front', 'No required parameter given') . ' - items');
     }
 }
Example #17
Show file File: LoginForm.php Project: Greka163/Yii-blog-new
0
 /**
  * Authenticates the password.
  * This is the 'authenticate' validator as declared in rules().
  */
 public function authenticate($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $identity = new UserIdentity($this->username, $this->password);
         $identity->authenticate();
         switch ($identity->errorCode) {
             case UserIdentity::ERROR_NONE:
                 $duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
                 // 30 days
                 Yii::app()->user->login($identity, $duration);
                 break;
             case UserIdentity::ERROR_USERNAME_INVALID:
                 $this->addError('username', Yii::t('lan', 'Username is incorrect.'));
                 break;
             case UserIdentity::ERROR_BANNED:
                 $this->addError('username', Yii::t('lan', 'User is banned.'));
                 break;
             case UserIdentity::ERROR_CONFIRMREGISTRATION:
                 $this->addError('username', Yii::t('lan', 'Confirm user email.'));
                 break;
             default:
                 $this->addError('password', Yii::t('lan', 'Password is incorrect.'));
                 break;
         }
     }
 }
Example #18
Show file File: OrderNotifyService.php Project: yupe/yupe
0
 /**
  * @param Order $order
  */
 public function sendOrderChangesNotify(Order $order)
 {
     $theme = Yii::t('OrderModule.order', 'Order #{n} in {site} store is changed', ['{n}' => $order->id, '{site}' => Yii::app()->getModule('yupe')->siteName]);
     $from = $this->module->notifyEmailFrom ?: Yii::app()->getModule('yupe')->email;
     $body = $this->view->renderPartial('/order/email/orderChangeStatus', ['order' => $order], true);
     $this->mail->send($from, $order->email, $theme, $body);
 }
Example #19
Show file File: LoginForm.php Project: mmorpg2015/ghtweb5
0
 public function login()
 {
     $login = parent::getLogin();
     $password = parent::getPassword();
     $identity = new AdminIdentity($login, $password);
     $identity->authenticate();
     switch ($identity->errorCode) {
         case AdminIdentity::ERROR_USERNAME_INVALID:
         case AdminIdentity::ERROR_PASSWORD_INVALID:
             $this->addError('login', Yii::t('backend', 'Аккаунт не найден.'));
             break;
         case AdminIdentity::ERROR_STATUS_BANNED:
             $this->addError('login', Yii::t('backend', 'Аккаунт забанен.'));
             break;
         case AdminIdentity::ERROR_STATUS_INACTIVE:
             $this->addError('login', Yii::t('backend', 'Аккаунт не активирован.'));
             break;
         case AdminIdentity::ERROR_STATUS_IP_NO_ACCESS:
             $this->addError('login', Yii::t('backend', 'Доступ к аккаунту для вашего IP запрещён.'));
             break;
         default:
             $duration = 3600 * 24 * 7;
             // 7 days
             admin()->login($identity, $duration);
             return TRUE;
     }
     return FALSE;
 }
Example #20
Show file File: DictionaryBackendController.php Project: kuzmina-mariya/4seasons
0
 public function loadModel($id)
 {
     if (($model = DictionaryGroup::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('DictionaryModule.dictionary', 'Requested page was not found'));
     }
     return $model;
 }
Example #21
Show file File: CategoriesController.php Project: Wiedzal/narisuemvse
0
 public function actionEdit($id)
 {
     $this->pageTitle = Yii::t('app', 'Редактирование категории');
     $model = ShopCategories::model()->findByPk($id);
     if (!$model) {
         throw new CHttpException(404, Yii::t('app', 'Категория не найдена'));
     }
     //var_dump($model->url);die;
     // var_dump($model->path);die;
     //var_dump($model->breadcrumbs);
     //die;
     $this->breadcrumbs = array_merge($this->breadcrumbs, array('Редактирование категории "' . $model->title . '"'));
     $possibleParents = $model->getPossibleParents();
     if (!empty($_POST) && array_key_exists('ShopCategories', $_POST)) {
         $this->performAjaxValidation($model);
         $model->attributes = $_POST['ShopCategories'];
         //var_dump($model->attributes);die;
         if ($model->validate()) {
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', 'Категория "' . $model->title . '" успешно отредактирована');
                 Yii::app()->request->redirect($this->createUrl('index'));
             }
         }
     }
     //var_dump($possibleParents);die;
     $this->render('edit', array('model' => $model, 'possibleParents' => $possibleParents));
 }
Example #22
Show file File: FileBehave.php Project: infoweb-internet-solutions/yii2-cms
0
 public function getHint()
 {
     if ($this->owner->isNewRecord || !$this->file) {
         return '';
     }
     return Html::a(Yii::t('app', 'View attached file'), $this->fileUrl, ['target' => '_blank']);
 }
Example #23
Show file File: CEAcceleratorCache.php Project: alsvader/hackbanero
0
 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of eAccelerator.
  * @throws CException if eAccelerator extension is not loaded, is disabled or the cache functions are not compiled in.
  */
 public function init()
 {
     parent::init();
     if (!function_exists('eaccelerator_get')) {
         throw new CException(Yii::t('yii', 'CEAcceleratorCache requires PHP eAccelerator extension to be loaded, enabled or compiled with the "--with-eaccelerator-shared-memory" option.'));
     }
 }
Example #24
Show file File: TbBreadcrumbs.php Project: VrainSystem/Proyecto_PROFIT
0
 /**
  * Renders the content of the widget.
  * @throws CException
  */
 public function run()
 {
     // Hide empty breadcrumbs.
     if (empty($this->links)) {
         return;
     }
     $links = array();
     if (!isset($this->homeLink)) {
         $content = CHtml::link(Yii::t('zii', 'Inicio'), Yii::app()->homeUrl);
         $links[] = $this->renderItem($content);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->renderItem($this->homeLink);
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $content = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
             $links[] = $this->renderItem($content);
         } else {
             $links[] = $this->renderItem($this->encodeLabel ? CHtml::encode($url) : $url, true);
         }
     }
     echo CHtml::tag('ul', $this->htmlOptions, implode('', $links));
 }
Example #25
Show file File: RecoveryAction.php Project: kuzmina-mariya/gallery
0
 public function run()
 {
     // Незачем выполнять последующие действия
     // для авторизованного пользователя:
     if (Yii::app()->user->isAuthenticated()) {
         $this->controller->redirect(Yii::app()->getUser()->getReturnUrl());
     }
     $module = Yii::app()->getModule('user');
     // Если восстановление отключено - ошбочка ;)
     if ($module->recoveryDisabled) {
         throw new CHttpException(404, Yii::t('UserModule.user', 'requested page was not found!'));
     }
     // Новая форма восстановления пароля:
     $form = new RecoveryForm();
     if (($data = Yii::app()->getRequest()->getPost('RecoveryForm')) !== null) {
         $form->setAttributes($data);
         if ($form->validate() && Yii::app()->userManager->passwordRecovery($form->email)) {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('UserModule.user', 'Letter with password recovery instructions was sent on email which you choose during register'));
             $this->controller->redirect(array('/user/account/backendlogin'));
         } else {
             Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::ERROR_MESSAGE, Yii::t('UserModule.user', 'Password recovery error.'));
         }
     }
     $this->controller->render('recovery', array('model' => $form));
 }
Example #26
Show file File: SpaceControllerBehavior.php Project: alefernie/intranet
0
 public function checkAccess()
 {
     // Save users last action on this space
     $membership = $this->space->getMembership(Yii::app()->user->id);
     if ($membership != null) {
         $membership->updateLastVisit();
     } else {
         // Super Admin can always enter
         if (!Yii::app()->user->isAdmin()) {
             // Space invisible?
             if ($this->space->visibility == Space::VISIBILITY_NONE) {
                 // Not Space Member
                 throw new CHttpException(404, Yii::t('SpaceModule.behaviors_SpaceControllerBehavior', 'Space is invisible!'));
             }
         }
     }
     // Delete all pending notifications for this space
     $notifications = Notification::model()->findAllByAttributes(array('space_id' => $this->space->id, 'user_id' => Yii::app()->user->id), 'seen != 1');
     foreach ($notifications as $n) {
         // Ignore Approval Notifications
         if ($n->class == "SpaceApprovalRequestNotification" || $n->class == "SpaceInviteNotification") {
             continue;
         }
         $n->seen = 1;
         $n->save();
     }
 }
Example #27
Show file File: RegisterController.php Project: kolbensky/rybolove
0
 /**
  * Creates account for new users
  */
 public function actionRegister()
 {
     if (!Yii::app()->user->isGuest) {
         Yii::app()->request->redirect('/');
     }
     $user = new User('register');
     $profile = new UserProfile();
     if (Yii::app()->request->isPostRequest && isset($_POST['User'], $_POST['UserProfile'])) {
         $user->attributes = $_POST['User'];
         $profile->attributes = $_POST['UserProfile'];
         $valid = $user->validate();
         $valid = $profile->validate() && $valid;
         if ($valid) {
             $user->save();
             $profile->save();
             $profile->setUser($user);
             // Add user to authenticated group
             Yii::app()->authManager->assign('Authenticated', $user->id);
             $this->addFlashMessage(Yii::t('UsersModule.core', 'Спасибо за регистрацию на нашем сайте.'));
             // Authenticate user
             $identity = new UserIdentity($user->username, $_POST['User']['password']);
             if ($identity->authenticate()) {
                 Yii::app()->user->login($identity, Yii::app()->user->rememberTime);
                 Yii::app()->request->redirect($this->createUrl('/users/profile/index'));
             }
         }
     }
     $this->render('register', array('user' => $user, 'profile' => $profile));
 }
Example #28
Show file File: WebUser.php Project: song-yuan/wymenujp
0
 public function login($identity, $duration = 0)
 {
     if (!$this->_checkMod($identity->role)) {
         return false;
     }
     //::app()->session['loginrole']=$identity->role;
     //var_dump(Yii::app()->session);exit;
     $id = $identity->getId();
     $states = $identity->getPersistentStates();
     if ($this->beforeLogin($id, $states, false)) {
         $this->changeIdentity($id, $identity->getName(), get_object_vars($identity));
         if ($duration > 0) {
             if ($this->allowAutoLogin) {
                 $this->saveToCookie($duration);
             } else {
                 throw new CException(Yii::t('yii', '{class}.allowAutoLogin must be set true in order to use cookie-based authentication.', array('{class}' => get_class($this))));
             }
         }
         if ($this->absoluteAuthTimeout) {
             $this->setState(self::AUTH_ABSOLUTE_TIMEOUT_VAR, time() + $this->absoluteAuthTimeout);
         }
         $this->afterLogin(false);
     }
     return !$this->getIsGuest();
 }
Example #29
Show file File: AdminDeliveryController.php Project: skeeks-cms/cms-shop
0
 public function init()
 {
     $this->name = \Yii::t('skeeks/shop/app', 'Delivery services');
     $this->modelShowAttribute = "name";
     $this->modelClassName = ShopDelivery::className();
     parent::init();
 }
Example #30
Show file File: CZendDataCache.php Project: IuriiP/yii-tracker
-1
 /**
  * Initializes this application component.
  * This method is required by the {@link IApplicationComponent} interface.
  * It checks the availability of Zend Data Cache.
  * @throws CException if Zend Data Cache extension is not loaded.
  */
 public function init()
 {
     parent::init();
     if (!function_exists('zend_shm_cache_store')) {
         throw new CException(Yii::t('yii', 'CZendDataCache requires PHP Zend Data Cache extension to be loaded.'));
     }
 }