/**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser()) {
         $this->redirect('home/index');
     }
 }
Example #2
0
 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)));
     }
 }
Example #3
0
 /**
  * 初始化
  * @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;
         }
     }
 }
 function init()
 {
     parent::init();
     if (!(Director::isDev() || Director::is_cli() || Permission::check("ADMIN"))) {
         return Security::permissionFailure($this);
     }
 }
	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";
			}
		}
		
	}
 function init()
 {
     Yii::app()->bootstrap;
     Yii::app()->params['useBootstrap'] = true;
     parent::init();
     $this->menuTitle = Yii::t('common', 'Operations');
 }
 function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         Security::permissionFailure();
     }
 }
 /**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser() || !Member::currentUser()->IsAdmin()) {
         $this->redirect('cloud/index');
     }
 }
 public function init()
 {
     parent::init();
     if ($this->modelClass === NULL) {
         throw new CHttpException(500, 'Model class is not declared in ' . get_called_class());
     }
 }
Example #10
0
 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'));
         }
     }
 }
 public function init()
 {
     parent::init();
     if (!Member::currentUser()) {
         return $this->httpError(403);
     }
 }
 /**
  * Initialise the controller
  */
 public function init()
 {
     parent::init();
     if (!Member::currentUser() || !Member::currentUser()->IsContentAuthor()) {
         $this->redirect('Security/login?BackURL=cloud/index');
     }
 }
 /**
  * 
  * @return void
  */
 public function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         return $this->redirect('/', 403);
     }
 }
 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');
 }
 /**
  * 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);
     }
 }
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function init()
 {
     //Yii::app()->user->loginUrl= array('/site/admin') ;
     Yii::app()->theme = 'admin';
     $this->layout = 'column1';
     parent::init();
 }
 /**
  * Run the analysis
  * @param bool $runAnalysis If it's set to false the analysis won't be started. If $fastOnly is true and $runAnalysis
  * if false only the fast analyzer are executed. The pending_analysis flag is set to true
  * @param bool $fastOnly If it set to true the slow analyzer are not started
  */
 public static function run($runAnalysis = true, $fastOnly = false)
 {
     Controller::init();
     Logger::log("Controller avviato");
     $count = Controller::updateCache();
     Logger::log($count, "nuovi eventi nei log");
     if ($runAnalysis) {
         if ($count > 0 || Config::get("debug") || Utils::getMiscResult("pending_analysis") == "yes") {
             Controller::runAnalysis($fastOnly);
         } else {
             Logger::log("Nessuna azione eseguita");
         }
     } else {
         if ($count > 0 || Config::get("debug")) {
             Utils::saveMiscResult("pending_analysis", "yes");
             if ($fastOnly) {
                 Logger::log("Running fast-only analysis even if \$runAnalysis is false");
                 Controller::runAnalysis($fastOnly);
             } else {
                 Logger::log("Analysis skipped...");
             }
         } else {
             Logger::log("Nessuna azione eseguita");
         }
     }
 }
Example #18
0
 protected function init()
 {
     parent::init();
     $this->resp->headers->set('Content-type', 'application/json');
     //allow request from every where
     $this->resp->headers->set('access-control-allow-origin', '*');
 }
Example #19
0
 public function init()
 {
     parent::init();
     if (isset($_GET["src"]) && $_GET["src"] == "ads") {
         Yii::app()->session['src'] = 'ads';
     }
     //get userPhone
     if (Yii::app()->user->isGuest) {
         $identity = new UserIdentity(null, null);
         $type = 'autoLogin';
         if ($identity->userAuthenticate($type, $this->deviceOs)) {
             Yii::app()->user->login($identity);
         }
     }
     $this->userPhone = Yii::app()->user->getState('msisdn');
     $this->banners = WapBannerModel::getBanner('wap');
     //chk is subscribe
     if (!empty($this->userPhone)) {
         $this->isSub = WapUserSubscribeModel::model()->chkIsSubscribe($this->userPhone);
     }
     if (Yii::app()->user->getState('is3g') == 1) {
         $this->is3g = true;
     }
     $isTouch = $this->_isTouchLayout();
     if (!$isTouch) {
         $this->layout = 'application.views.wap.layouts.main';
     }
 }
 public function init()
 {
     parent::init();
     $renderer = new DebugView();
     $renderer->writeHeader();
     $renderer->writeInfo("SilverStripe Development Tools: Logs", Director::absoluteBaseURL());
 }
 public function init()
 {
     parent::init();
     $member = Member::currentUser();
     $this->member = $member;
     $request = $this->getRequest();
     //echo $request->getVar('test');
     //Setting dates based on request variables
     //We could add some sanity check herre
     $this->start = $request->getVar('start');
     $this->end = $request->getVar('end');
     if ($request->getVar('allDay') == 'true') {
         $this->allDay = true;
     }
     //Setting event based on request vars
     if (($eventID = (int) $request->getVar('eventID')) && $eventID > 0) {
         $event = Event::get()->byID($eventID);
         if ($event && $event->exists()) {
             if ($event->ClassName == 'PrivateEvent') {
                 //Only show private events to their owners
                 if ($event->OwnerID == $member->ID) {
                     $this->event = $event;
                 }
             } else {
                 $this->event = $event;
             }
         }
     }
 }
 /**
  * Init expanding parent init with custom initializations
  *
  * @return boolean
  */
 public function init()
 {
     $retVal = parent::init();
     // Add custom init code here...
     $this->publicLibraries = $this->initPublicLibraries();
     return $retVal;
 }
 function init()
 {
     parent::init();
     // Special case for dev/build: Defer permission checks to DatabaseAdmin->init() (see #4957)
     $requestedDevBuild = stripos($this->request->getURL(), 'dev/build') === 0;
     // We allow access to this controller regardless of live-status or ADMIN permission only
     // if on CLI.  Access to this controller is always allowed in "dev-mode", or of the user is ADMIN.
     $canAccess = $requestedDevBuild || Director::isDev() || Director::is_cli() || Permission::check("ADMIN");
     if (!$canAccess) {
         return Security::permissionFailure($this);
     }
     // 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 = BASE_PATH;
             while ($testPath && $testPath != "/" && !preg_match('/^[A-Z]:\\\\$/', $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.org wiki' . "\n";
         }
     }
 }
 public function init()
 {
     parent::init();
     if (!Permission::check('CMS_ACCESS')) {
         Security::permissionFailure();
     }
 }
 public function init()
 {
     parent::init();
     if (!Permission::check('ADMIN')) {
         return Security::permissionFailure($this);
     }
 }
 function init()
 {
     if (!Director::is_cli() && !Director::isDev() && !Permission::check("ADMIN")) {
         Security::permissionFailure();
     }
     parent::init();
 }
Example #27
0
 public function init()
 {
     parent::init();
     if (!Director::is_cli() && !Permission::check('ADMIN')) {
         return Security::permissionFailure();
     }
 }
Example #28
0
 function init()
 {
     parent::init();
     if (isset(Yii::app()->request->cookies['prefLang'])) {
         $this->language = Yii::app()->request->cookies['prefLang'];
     }
 }
 public function init()
 {
     parent::init();
     if (!in_array('官网自助配置', $this->premits)) {
         die('权限不足(permission denied)');
     }
 }
 public function init()
 {
     if (!Member::currentUserID() || !$this->access_allowed()) {
         $this->httpError(404);
     }
     parent::init();
 }