當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。