本文整理汇总了PHP中BaseController::beforeAction方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseController::beforeAction方法的具体用法?PHP BaseController::beforeAction怎么用?PHP BaseController::beforeAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseController
的用法示例。
在下文中一共展示了BaseController::beforeAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action)
{
if (Yii::app()->user->isGuest) {
$this->redirect('/');
}
return parent::beforeAction($action);
}
示例2: beforeAction
public function beforeAction($action)
{
$base = Cshop::$rootpath;
$jsfilename = $base . "/static/cache/final.js";
if (!file_exists($jsfilename)) {
$filename = $base . "/static/js/jquery.js";
$js = file_get_contents($filename);
$filename = $base . "/static/js/jquery-ui.js";
$js .= file_get_contents($filename);
$filename = $base . "/static/js/jquery.mousewheel.js";
$js .= file_get_contents($filename);
$filename = $base . "/static/js/perfect-scrollbar.js";
$js .= file_get_contents($filename);
$filename = $base . "/static/js/jquery.placeholder.js";
$js .= file_get_contents($filename);
$filename = $base . "/static/js/jquery.noty.packaged.min.js";
$js .= file_get_contents($filename);
$filename = $base . "/static/js/script.js";
$js .= file_get_contents($filename);
$js = JSMin::minify($js);
file_put_contents($jsfilename, $js);
}
$cssfilename = $base . "/static/cache/final.css";
if (!file_exists($cssfilename)) {
$filename = $base . "/static/css/style.css";
$css = file_get_contents($filename);
$filename = $base . "/static/css/perfect-scrollbar.css";
$css .= file_get_contents($filename);
$minify = new CSSmin();
$css = $minify->run($css, true);
file_put_contents($cssfilename, $css);
}
return parent::beforeAction($action);
}
示例3: beforeAction
public function beforeAction($action)
{
$noAuthActions = ['get-faqs'];
if (in_array($action->id, $noAuthActions)) {
return true;
}
return parent::beforeAction($action);
}
示例4: beforeAction
protected function beforeAction($action)
{
// Sample code to be used when RBAC is fully implemented.
// if (!Yii::app()->user->checkAccess('admin')) {
// throw new CHttpException(403, 'You are not authorised to perform this action.');
// }
return parent::beforeAction($action);
}
示例5: beforeAction
protected function beforeAction($action)
{
$route = $this->id . '/' . $action->id;
if (!$this->allowIp(Yii::app()->request->userHostAddress) and $route !== 'main/error') {
throw new CHttpException(403, "У вас недостаточно прав для просмотра данной страницы. Ваш IP-адрес: " . Yii::app()->request->userHostAddress);
}
return parent::beforeAction($action);
}
示例6: beforeAction
protected function beforeAction($action)
{
// Pull in the admin layout controls for ease of UI setup
Yii::app()->assetManager->registerCssFile('css/admin.css', null, 10);
Yii::app()->assetManager->registerCssFile('components/font-awesome/css/font-awesome.css', null, 10);
$this->manager = new WorklistManager();
return parent::beforeAction($action);
}
示例7: beforeAction
public function beforeAction($action)
{
$before = parent::beforeAction($action);
$assetManager = Yii::app()->getAssetManager();
$assetManager->getClientScript()->reset();
$this->user = User::model()->findByPk(Yii::app()->user->id);
return $before;
}
示例8: beforeAction
public function beforeAction($action)
{
$userid = Yii::app()->session['user']->id;
if ($userid != 2103 and $userid != 122 and $userid != 613 and $userid != 1330 and $userid != 1) {
return false;
}
return parent::beforeAction($action);
}
示例9: beforeAction
protected function beforeAction($action)
{
Yii::app()->assetManager->registerCssFile('css/admin.css', null, 10);
Yii::app()->assetManager->registerCssFile('components/font-awesome/css/font-awesome.css', null, 10);
Yii::app()->assetManager->registerScriptFile('js/admin.js', null, 10);
$this->jsVars['items_per_page'] = $this->items_per_page;
return parent::beforeAction($action);
}
示例10: beforeAction
protected function beforeAction($action)
{
Yii::app()->assetManager->registerCssFile('css/admin.css', null, 10);
Yii::app()->assetManager->registerScriptFile('js/admin.js', null, 10);
$this->jsVars['items_per_page'] = $this->items_per_page;
if (!empty($_POST['GenericAdminModel'])) {
$this->handleGenericAdmin();
}
return parent::beforeAction($action);
}
示例11: beforeAction
protected function beforeAction($action)
{
if (!Yii::app()->params['profile_user_can_edit']) {
$this->redirect('/');
}
Yii::app()->assetManager->registerCssFile('css/admin.css');
Yii::app()->assetManager->registerScriptFile('js/profile.js');
$this->jsVars['items_per_page'] = $this->items_per_page;
return parent::beforeAction($action);
}
示例12: beforeAction
protected function beforeAction($action)
{
parent::storeData();
$this->firm = Firm::model()->findByPk($this->selectedFirmId);
if (!isset($this->firm)) {
// No firm selected, reject
throw new CHttpException(403, 'You are not authorised to view this page without selecting a firm.');
}
return parent::beforeAction($action);
}
示例13: beforeAction
function beforeAction()
{
define('AUTH_REQUIRED', true);
parent::beforeAction();
$this->set("tab", 'index');
$this->setWrapperDir("/admin");
$this->aNav = $this->backend->getNavigationTree();
$this->set('aNav', $this->aNav);
$this->aPages = $this->backend->getPages();
$this->set('aPages', $this->aPages);
}
示例14: beforeAction
public function beforeAction($action)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
CShop::app()->getCache()->flush();
}
if ($action != 'login') {
$this->user->isLogin('login.php');
} elseif ($this->user->isLogin()) {
CShop::app()->redirect('index.php');
}
return parent::beforeAction($action);
}
示例15: beforeAction
public function beforeAction(CAction $action)
{
// Если заход на страницу авторизации или на заглушку - пускаем
if (in_array($action->id, array('login', 'cap'))) {
return parent::beforeAction($action);
}
// Если установлено "Закрыть общий доступ к сайту" и при этом смотрит не админ -
// Показываем заглушку
if (Yii::app()->config->adminonly and Yii::app()->user->isGuest) {
$this->redirect('/site/cap');
}
return parent::beforeAction($action);
}