当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::init方法代码示例

本文整理汇总了PHP中Controller::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::init方法的具体用法?PHP Controller::init怎么用?PHP Controller::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser()) {
         $this->redirect('home/index');
     }
 }
开发者ID:andrelohmann,项目名称:roof-for-refugees.org,代码行数:10,代码来源:MessageController.php

示例2: init

 public function init()
 {
     parent::init();
     if (!Yii::app()->getUser()->getIsGuest()) {
         Layout::addBlock('sidebar.left', array('id' => 'profile_sidebar', 'content' => $this->widget('ProfileWidget', array('userModel' => Yii::app()->getUser()->getModel()), true)));
     }
 }
开发者ID:jayrulez,项目名称:kcconline,代码行数:7,代码来源:CourseController.php

示例3: init

 /**
  * 初始化
  * @see CController::init()
  */
 public function init()
 {
     parent::init();
     //前端控制器在此获得分类,从顶级分类(0)开始分层往下取,得到所有层次的分类
     //        ppr(XXcache::system('_catalog')); //这里是遍历出来未按照从属排序
     //        ppr($this->_catalog); //这里重新按从属排序
     $this->_catalog = Catalog::get(0, XXcache::system('_catalog'));
     //系统配置
     $this->_conf = XXcache::system('_config');
     $this->_seoTitle = $this->_conf['seo_title'];
     $this->_seoKeywords = $this->_conf['seo_keywords'];
     $this->_seoDescription = $this->_conf['seo_description'];
     if ($this->_conf['site_status'] == 'close') {
         self::_closed();
     }
     $this->_thisUrl = higu();
     if ($this->_conf['cache_page_status'] == 'open') {
         $value = Yii::app()->cache->get($this->_thisUrl);
         if ($value === false) {
             echo 'nocache';
         } else {
             echo 'cache';
             echo $value;
         }
     }
 }
开发者ID:lp19851119,项目名称:114la,代码行数:30,代码来源:XFrontBase.php

示例4: init

 function init()
 {
     parent::init();
     if (!(Director::isDev() || Director::is_cli() || Permission::check("ADMIN"))) {
         return Security::permissionFailure($this);
     }
 }
开发者ID:helpfulrobot,项目名称:burnbright-silverstripe-shop-dispatchit,代码行数:7,代码来源:DispatchITExporter.php

示例5: init

	function init() {
		parent::init();
		
		// check for valid url mapping
		// lacking this information can cause really nasty bugs,
		// e.g. when running Director::test() from a FunctionalTest instance
		global $_FILE_TO_URL_MAPPING;
		if(Director::is_cli()) {
			if(isset($_FILE_TO_URL_MAPPING)) {
				$fullPath = $testPath = $_SERVER['SCRIPT_FILENAME'];
				while($testPath && $testPath != "/") {
					$matched = false;
					if(isset($_FILE_TO_URL_MAPPING[$testPath])) {
						$matched = true;
					    break;
					}
					$testPath = dirname($testPath);
				}
				if(!$matched) {
					echo 'Warning: You probably want to define '.
						'an entry in $_FILE_TO_URL_MAPPING that covers "' . Director::baseFolder() . '"' . "\n";
				}
			}
			else {
				echo 'Warning: You probably want to define $_FILE_TO_URL_MAPPING in '.
					'your _ss_environment.php as instructed on the "sake" page of the doc.silverstripe.com wiki' . "\n";
			}
		}
		
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:30,代码来源:DevelopmentAdmin.php

示例6: init

 function init()
 {
     Yii::app()->bootstrap;
     Yii::app()->params['useBootstrap'] = true;
     parent::init();
     $this->menuTitle = Yii::t('common', 'Operations');
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:7,代码来源:ModuleAdminController.php

示例7: init

 function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         Security::permissionFailure();
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-sitetreeimporter,代码行数:7,代码来源:SiteTreeImporter.php

示例8: init

 /**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser() || !Member::currentUser()->IsAdmin()) {
         $this->redirect('cloud/index');
     }
 }
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:10,代码来源:BoxAdminController.php

示例9: init

 public function init()
 {
     parent::init();
     if ($this->modelClass === NULL) {
         throw new CHttpException(500, 'Model class is not declared in ' . get_called_class());
     }
 }
开发者ID:schlypel,项目名称:YiiBackboneBoilerplate,代码行数:7,代码来源:RestController.php

示例10: init

 public function init()
 {
     parent::init();
     $passwdErrorTimes = zmf::getCookie('checkWithCaptcha');
     $time = zmf::config('adminErrorTimes');
     if ($time > 0) {
         if ($passwdErrorTimes >= $time) {
             header('Content-Type: text/html; charset=utf-8');
             echo '您暂时已被禁止访问';
             Yii::app()->end();
         }
     }
     $uid = zmf::uid();
     if ($uid) {
         //            $randKey_cookie = zmf::getCookie('adminRandKey' . $uid);
         //            $randKey_cache = zmf::getFCache('adminRandKey' . $uid);
         //            if (!$randKey_cookie || ($randKey_cache != $randKey_cookie)) {
         //                Yii::app()->user->logout();
         //                $this->message(0, '登录已过期,请重新登录', Yii::app()->createUrl('admin/site/login'));
         //            }
         $this->userInfo = Users::getOne($uid);
         $this->uid = $uid;
     } else {
         $currentUrl = Yii::app()->request->url;
         if (strpos($currentUrl, '/site/') === false) {
             $this->message(0, '请先登录', Yii::app()->createUrl('/site/login'));
         }
     }
 }
开发者ID:ph7pal,项目名称:momo,代码行数:29,代码来源:Admin.php

示例11: init

 public function init()
 {
     parent::init();
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
 }
开发者ID:helpfulrobot,项目名称:nadzweb-membernotification,代码行数:7,代码来源:MemberNotificationController.php

示例12: init

 /**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser() || !Member::currentUser()->IsContentAuthor()) {
         $this->redirect('Security/login?BackURL=cloud/index');
     }
 }
开发者ID:andrelohmann,项目名称:vagrant-cloud,代码行数:10,代码来源:PasswordAdminController.php

示例13: init

 /**
  * 
  * @return void
  */
 public function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         return $this->redirect('/', 403);
     }
 }
开发者ID:deviateltd,项目名称:silverstripe-cacheable,代码行数:11,代码来源:CacheableCacheInspectorController.php

示例14: init

 public function init()
 {
     parent::init();
     // Prevent clickjacking, see https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
     $this->response->addHeader('X-Frame-Options', 'SAMEORIGIN');
     $this->extend('onAfterInit');
 }
开发者ID:helpfulrobot,项目名称:antons-silverstripe-ssp,代码行数:7,代码来源:SSPSecurity.php

示例15: init

 /**
  * Initialises the controller and ensures that only
  * ADMIN level users can access this controller
  */
 public function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         return $this->httpError(403);
     }
 }
开发者ID:mparkhill,项目名称:silverstripe-codeblocks,代码行数:11,代码来源:CodeBlockController.php


注:本文中的Controller::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。