Esempio n. 1
0
 public function startup()
 {
     if ($data = $this->Cookie->read($this->cookieVarname)) {
         $this->data = $data;
     }
     return parent::startup();
 }
Esempio n. 2
0
 /**
  * For this helper the controller has to be passed as reference
  * for manual startup with $disableStartup = true (requires this to be called prior to any other method)
  *
  * @return void
  */
 public function startup(Controller $Controller = null)
 {
     parent::startup($Controller);
     // Data preparation
     if (!empty($this->Controller->request->data) && !Configure::read('DataPreparation.notrim')) {
         $this->Controller->request->data = $this->trimDeep($this->Controller->request->data);
     }
     if (!empty($this->Controller->request->query) && !Configure::read('DataPreparation.notrim')) {
         $this->Controller->request->query = $this->trimDeep($this->Controller->request->query);
     }
     if (!empty($this->Controller->request->params['named']) && !Configure::read('DataPreparation.notrim')) {
         $this->Controller->request->params['named'] = $this->trimDeep($this->Controller->request->params['named']);
     }
     if (!empty($this->Controller->request->params['pass']) && !Configure::read('DataPreparation.notrim')) {
         $this->Controller->request->params['pass'] = $this->trimDeep($this->Controller->request->params['pass']);
     }
     // Information gathering
     if (!Configure::read('App.disableMobileDetection') && ($mobile = $this->Session->read('Session.mobile')) === null) {
         App::uses('UserAgentLib', 'Tools.Lib');
         $UserAgentLib = new UserAgentLib();
         $mobile = (int) $UserAgentLib->isMobile();
         $this->Session->write('Session.mobile', $mobile);
     }
     // Auto layout switch
     if ($this->Controller->request->is('ajax')) {
         $this->Controller->layout = 'ajax';
     }
 }
 /**
  * Take a comma seperated list of id's and save them in the matching order
  *
  * @param Controller $controller
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     $postedRanks = Hash::extract($controller->request->data, '{s}.updated-ranks');
     if ($controller->request->is('post') && !empty($postedRanks)) {
         $ranks = explode(',', $postedRanks[0]);
         $i = 0;
         foreach ($ranks as $order => $rowId) {
             $data[$i][$this->settings['model']][$this->settings['field']] = $rowId;
             $data[$i][$this->settings['model']][$this->settings['sortField']] = $order + 1;
             // As arrays count from 0, but our ranks count from 1
             $i++;
         }
         $element = 'default';
         if ($this->settings['useNiceAdmin']) {
             $element = 'NiceAdmin.alert-box';
         }
         $controller->loadModel($this->settings['model']);
         if ($controller->{$this->settings['model']}->saveAll($data, array('validate' => false))) {
             $controller->Session->setFlash($this->settings['model'] . ' order updated', $element, array('class' => 'alert-success'));
             $controller->redirect($controller->referer());
         } else {
             $controller->Session->setFlash($this->settings['model'] . ' order could not be updated, please try again', $element, array('class' => 'alert-error'));
         }
     }
 }
Esempio n. 4
0
 /**
  * MobileComponent::startup()
  *
  * @param Controller $Controller
  * @return void
  */
 public function startup(Controller $Controller)
 {
     parent::startup($Controller);
     if ($this->settings['on'] !== 'startup') {
         return;
     }
     $this->_init();
 }
 /**
  * Run after controller beforeFilter method
  * @param Controller $controller
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     if (isset($controller->request->params['name'])) {
         $this->__requestedModule = Inflector::camelize($controller->request->params['name']);
         $this->__needInstall();
     }
 }
 public function startup($controller)
 {
     parent::startup($controller);
     $collection = new ComponentCollection();
     $this->Acl = new AclComponent($collection);
     $controller = null;
     $this->Acl->startup($controller);
     $this->Aco = $this->Acl->Aco;
 }
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     $this->Controller = $controller;
     //  コントローラがページネーションを使っているか確かめる
     if (!isset($this->Controller->paginate)) {
         $this->Controller->paginate = array();
     }
 }
 public function startup(\Controller $controller)
 {
     // definindo alguns dados padrões
     $config = Configure::read('PagSeguro');
     if ($config) {
         $this->credenciais = new PagSeguroAccountCredentials($config['credenciais']['email'], $config['credenciais']['token']);
     }
     parent::startup($controller);
 }
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     $this->Controller = $controller;
     // Make sure the controller is using pagination
     if (!isset($this->Controller->paginate)) {
         $this->Controller->paginate = array();
     }
 }
 /**
  * perform needed initialization and cache the controller that called us
  */
 public function startup($controller)
 {
     parent::startup($controller);
     if (!defined('SESSION_UNSAFE')) {
         define('SESSION_UNSAFE', false);
     }
     if (CLI) {
         return;
     }
 }
 /**
  * 
  * Setup menus at startup
  * @param Controller $controller
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     /*
      * only at module page
      */
     if (isset($controller->request->params['name'])) {
         $moduleName = Inflector::camelize($controller->request->params['name']);
         $checkMenus = $this->isModuleHasMenus($moduleName);
         if ($checkMenus) {
             $this->parseModuleMenus($moduleName);
         }
     }
 }
 /**
  * called by controller after the component was instanciated first
  * @param object $controller the calling controller
  */
 public function startup($controller)
 {
     parent::startup($controller);
     $this->setCode($this->findLanguage());
     if (!defined('LANGUAGE_FALLBACK')) {
         define('LANGUAGE_FALLBACK', false);
     }
     if (!defined('LANGUAGE_WARNEMPTY')) {
         define('LANGUAGE_WARNEMPTY', true);
     }
     if (!defined('LANGUAGE_ESCAPE')) {
         define('LANGUAGE_ESCAPE', false);
     }
 }
 /**
  * Called after the Controller::beforeFilter() and before the controller action
  * 
  * @param $controller Controller
  * @return void
  */
 public function startup($controller)
 {
     parent::startup($controller);
     $this->_debug($this->Controller->request);
 }
Esempio n. 14
0
 /**
  * Startup component
  *
  * @param object $controller Instantiating controller
  * @access public
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
 }
Esempio n. 15
0
 /**
  * 
  * @param Controller $controller
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     $this->Controller = $controller;
 }
Esempio n. 16
0
 /**
  * Check module user access
  * Only for checking module 
  * @param Controller $controller
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     /*
      * only at requested module
      */
     if (isset($this->__Controller->request->params['isCloggyModule']) && $this->__Controller->request->params['isCloggyModule'] == 1) {
         //setup aro data
         $this->generateAro();
         //run acl for module
         $this->proceedAcl('controller');
         //get flag
         $isAllowed = $this->isAroAllowed();
         /*
          * if not allowed proceed callback
          */
         if (!$isAllowed) {
             $this->proceedCallback();
         }
     }
 }
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     //configure config
     Configure::config('cloggy', new CloggyModuleConfigReader('CloggySearch'));
 }
 /**
  * Component startup. Main execution method.
  *
  * Called after the Controller::beforeFilter() and before the controller
  * action.
  *
  * @param Controller $controller A reference to the instantiating controller object.
  * @return bool True on successful startup. (Always true.)
  */
 public function startup(Controller $controller)
 {
     parent::startup($controller);
     $methods = array_flip(array_map('strtolower', $controller->methods));
     $action = strtolower($controller->request->params['action']);
     $isMissingAction = $controller->scaffold === false && !isset($methods[$action]);
     if ($isMissingAction) {
         return true;
     }
     if ($this->isAllowed($controller)) {
         return true;
     }
     if (!$this->getUser()) {
         return false;
     }
     if ($this->isLoginAction($controller) || $this->isAuthorized($this->user())) {
         return true;
     }
     return false;
 }
 function startup()
 {
     parent::startup($this);
 }