Exemplo n.º 1
0
 public function initialize(Controller $Controller)
 {
     parent::initialize($Controller);
     if (!self::_isSiftable($Controller)) {
         return;
     }
     if (empty($Controller->request->data['Sifter'])) {
         if (empty($Controller->request->params['named'])) {
             return true;
         }
         $Controller->request->params['named'] = Hash::expand($Controller->request->params['named']);
         return self::_sift($Controller);
     }
     $Model = $Controller->{$Controller->modelClass};
     $field = array_filter((array) $Model->sifterConfig('fields'));
     if (self::_isAjax($Controller)) {
         if (!array_key_exists($Controller->request->data['Sifter']['search_field'], $field) || empty($Controller->request->data['Sifter']['search_value'])) {
             return true;
         }
         return self::_setAutoComplete($Controller, array($Controller->request->data['Sifter']['search_field'] => $field[$Controller->request->data['Sifter']['search_field']]));
     } elseif ($Controller->request->is('post')) {
         unset($Controller->request->data['Sifter']);
         $url = array();
         foreach (Hash::filter($Controller->request->data) as $model => $fields) {
             foreach ($fields as $field => $data) {
                 $url[$model . '.' . $field] = $data;
             }
         }
         return $Controller->redirect(Hash::merge($url, array_diff_key($Controller->request->params, array('plugin' => null, 'controller' => null, 'action' => null, 'named' => null, 'pass' => null))));
     }
 }
Exemplo n.º 2
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->WorkflowActions = ClassRegistry::init('SimpleWorkflow.WorkflowActions');
     $this->UserWorkflowActions = ClassRegistry::init('SimpleWorkflow.UserWorkflowActions');
     $this->MapUserActionWorkflow = ClassRegistry::init('SimpleWorkflow.MapUserActionWorkflow');
 }
 /**
  * Initialize
  *
  * @since	0.1
  * @author	Anthony Putignano <*****@*****.**>
  * @param	Controller	$controller	A reference to the instantiating controller object
  * @return	void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     if (!isset($this->Storage)) {
         $this->Storage = new OAuth2Storage($this->settings);
     }
     if (!isset($this->Server)) {
         $this->Server = new OAuth2_Server($this->Storage, $this->settings, array(new OAuth2_GrantType_AuthorizationCode($this->Storage), new OAuth2_GrantType_RefreshToken($this->Storage, array('always_issue_new_refresh_token' => false))));
     }
     if (!isset($this->Request)) {
         $this->Request = new OAuth2_Request($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
     }
     if (!isset($this->ServerReflection)) {
         $this->ServerReflection = new ReflectionClass('OAuth2_Server');
     }
     $methods = $this->ServerReflection->getMethods();
     foreach ($methods as $method) {
         $this->availableMethods[$method->name] = null;
         $MethodReflection = new ReflectionMethod('OAuth2_Server', $method->name);
         $params = $MethodReflection->getParameters();
         if (!empty($params) && !empty($params[0]->name) && $params[0]->name === 'request') {
             $this->availableMethods[$method->name] = 'request';
         }
     }
 }
Exemplo n.º 4
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     if (count($controller->request->query) && !empty($this->settings)) {
         $conditions = array();
         foreach ($controller->request->query as $key => $value) {
             if (empty($this->settings[$key]) || empty($value) || empty($this->settings[$key]['field'])) {
                 continue;
             }
             if (empty($this->settings[$key]['type'])) {
                 $this->settings[$key]['type'] = 'default';
             }
             $controller->request->data($key, $value);
             switch ($this->settings[$key]['type']) {
                 case 'range':
                     list($key, $value) = $this->_range($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
                 case 'text':
                     list($key, $value) = $this->_text($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
                 default:
                     list($key, $value) = $this->_default($this->settings[$key]['field'], $value);
                     $conditions[$key] = $value;
                     break;
             }
             $conditions[$key] = $value;
         }
         $controller->request->filter = $conditions;
         $this->conditions = $conditions;
     }
 }
 /**
  * Called before the Controller::beforeFilter().
  * 
  * @param $controller 
  * @return void
  */
 public function initialize($controller)
 {
     parent::initialize($controller);
     $this->LightOpenID = new LightOpenID(env('SERVER_NAME'));
     $this->Controller =& $controller;
     $this->Controller->loadModel('AuthService.OpenidUser');
     $this->Controller->loadModel('User');
 }
Exemplo n.º 6
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->controller = $controller;
     foreach ($controller->uses as $model) {
         $this->{$model} = $controller->{$model};
     }
 }
Exemplo n.º 7
0
 /**
  * MobileComponent::initialize()
  *
  * @param Controller $Controller
  * @return void
  */
 public function initialize(Controller $Controller)
 {
     parent::initialize($Controller);
     $this->Controller = $Controller;
     if ($this->settings['on'] !== 'initialize') {
         return;
     }
     $this->_init();
 }
Exemplo n.º 8
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     App::import('Vendor', 'PHPExcel', array('file' => 'PHPExcel/PHPExcel.php'));
     if (!class_exists('PHPExcel')) {
         throw new CakeException('Vendor class PHPExcel not found!');
     }
     $dataArray = array();
 }
Exemplo n.º 9
0
 /**
  * Initialize the component
  *
  * Setup properties and injects API methods to the controller
  * @return void
  */
 public function initialize(Controller $controller)
 {
     $this->_controller = $controller;
     parent::initialize($controller);
     $this->_apiVersionPrefix = str_replace('.', '_', $this->_apiVersion);
     $methods = $this->_apiMethods;
     foreach ($methods as &$method) {
         $method = $this->_apiVersionPrefix . '_' . $method;
     }
     $controller->methods = array_keys(array_flip($controller->methods) + array_flip($methods));
 }
 /**
  * Initialize component
  *
  * @return array
  * @author Daniel Quappe
  */
 public function initialize(Controller $Controller)
 {
     $this->Controller = $Controller;
     //$res = App::import('Vendor', 'Payment.sofortlib/sofortLib');
     $res = App::import('Vendor', 'Payment.sofortlib/sofortLib_sofortueberweisung_classic');
     //$res2 = App::import('Vendor', 'Payment.sofortlib/sofortLib_classic_notification.inc');
     if (!$res) {
         trigger_error('sofortlib cannot be found');
     }
     parent::initialize($Controller);
 }
Exemplo n.º 11
0
 /**
  * Controllers initialize function.
  */
 public function initialize($Controller)
 {
     parent::initialize($Controller);
     $this->Controller = $Controller;
     Configure::write('CORE.current_route', Router::currentRoute());
     $this->__registerPlugins();
     $this->__paginationRecall();
     if (Configure::read('Website.force_www')) {
         $this->forceWwwUrl();
     }
 }
Exemplo n.º 12
0
 public function initialize(Controller $controller)
 {
     $this->Controller = $controller;
     $this->Status = ClassRegistry::init('Status');
     $this->Regulation = ClassRegistry::init('Regulation');
     $this->Code = ClassRegistry::init('Code');
     $this->Department = ClassRegistry::init('Department');
     $this->Chapter = ClassRegistry::init('Chapter');
     $this->CustomsDuty = ClassRegistry::init('CustomsDuty');
     $this->Country = ClassRegistry::init('Country');
     parent::initialize($controller);
 }
 /**
  * Overrides initialize
  *
  * Overrides applied before the controller’s beforeFilter method.
  *
  * @param Controller $controller
  * @return boolean|void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $settings = $this->settings;
     if (isset($settings['api_key'])) {
         $this->WakaTime->setApiKey($settings['api_key']);
     } elseif (Configure::check('wakatime.api_key')) {
         $this->WakaTime->setApiKey(Configure::read('wakatime.api_key'));
     } else {
         throw new InvalidArgumentException('WakaTime API key is required.');
     }
     return true;
 }
 /**
  * Controller名とAction名に大文字が含まれる場合に例外を投げる
  * [a-z][0-9][_]のみを有効とする
  * @throws BadRequestException
  * @param controller
  * @return void
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     //requestのcontroller名とaction名を取得
     $reqController = $controller->request->controller;
     $reqAction = $controller->request->action;
     if ($reqController !== strtolower($reqController)) {
         // 大文字が含まれている
         throw new BadRequestException(__('This address is not valid'));
     }
     if ($reqAction !== strtolower($reqAction)) {
         // 大文字が含まれている
         throw new BadRequestException(__('This address is not valid'));
     }
 }
Exemplo n.º 15
0
 public function initialize($controller, $settings = array())
 {
     if (Configure::read('debug') != 0) {
         ini_set('soap.wsdl_cache_enabled', false);
     }
     $this->controller = $controller;
     if (isset($settings['wsdl']) && !empty($settings['wsdl'])) {
         $this->__settings['wsdl'] = $settings['wsdl'];
     }
     if (isset($settings['prefix'])) {
         $this->__settings['prefix'] = $settings['prefix'];
     }
     if (isset($settings['action'])) {
         $this->__settings['action'] = is_array($settings['action']) ? $settings['action'] : array($settings['action']);
     }
     parent::initialize($controller);
 }
Exemplo n.º 16
0
 public function initialize(Controller $Controller)
 {
     parent::initialize($Controller);
     $this->Controller = $Controller;
     if (isset($this->Controller->request->params['named']['mobile'])) {
         if ($this->Controller->request->params['named']['mobile'] == '-1') {
             $noMobile = null;
         } else {
             $wantsMobile = (bool) $this->Controller->request->params['named']['mobile'];
             $noMobile = (int) (!$wantsMobile);
         }
         $this->Session->write('User.nomobile', $noMobile);
     }
     $this->setMobile();
     $urlParams = Router::getParams(true);
     if (!isset($urlParams['named'])) {
         $urlParams['named'] = array();
     }
     if (!isset($urlParams['pass'])) {
         $urlParams['pass'] = array();
     }
     $urlParams = am($urlParams, $urlParams['named'], $urlParams['pass']);
     unset($urlParams['named']);
     unset($urlParams['pass']);
     if (isset($urlParams['prefix'])) {
         unset($urlParams['prefix']);
     }
     if ($this->setMobile) {
         $url = Router::url(am($urlParams, array('mobile' => 0)));
         $this->Controller->set('desktopUrl', $url);
     } else {
         $url = Router::url(am($urlParams, array('mobile' => 1)));
         $this->Controller->set('mobileUrl', $url);
     }
     Configure::write('User.mobile', $this->isMobile);
     Configure::write('User.setMobile', $this->setMobile);
 }
Exemplo n.º 17
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->controller = $controller;
 }
Exemplo n.º 18
0
 /**
  * 初期化
  *
  * @param Controller $controller
  * @return void
  */
 public function initialize(Controller $controller)
 {
     $this->controller = $controller;
     if ($this->isApiRequest($controller->request)) {
         foreach (Hash::normalize($this->configMethods) as $method => $enabled) {
             if ($enabled) {
                 $this->{$method}($controller);
             }
         }
     }
     return parent::initialize($controller);
 }
 public function initialize(Controller $controller)
 {
     $this->Participation = ClassRegistry::init('Participation');
     parent::initialize($controller);
 }
 public function initialize(Controller $controller)
 {
     $this->Completion = ClassRegistry::init('Completion');
     parent::initialize($controller);
 }
Exemplo n.º 21
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->getConfig = Configure::read('webConfig');
 }
Exemplo n.º 22
0
 public function initialize(Controller $controller)
 {
     $controller->helpers[] = 'Pannel.Pannelblocks';
     parent::initialize($controller);
 }
Exemplo n.º 23
0
 public function initialize(Controller $controller, $settings = array())
 {
     parent::initialize($controller);
     $this->controller = $controller;
     $this->systemPath = WWW_ROOT . 'system' . DS;
 }
Exemplo n.º 24
0
 function initialize()
 {
     parent::initialize($this);
 }
Exemplo n.º 25
0
 /**
  * Controller callback run before controller's beforeFilter
  * > initiate controller and user
  * > check user loggedIn or not
  * > only check ACL if user loggedIn
  * 
  * @param Controller $controller
  */
 public function initialize(Controller $controller)
 {
     /*
      * initialize objects
      */
     parent::initialize($controller);
     App::uses('CloggyRulesAcl', 'Cloggy.Controller/Component/Acl');
     $this->__Controller = $controller;
     //setup rules
     $this->setRules();
 }
Exemplo n.º 26
0
	public function initialize()
	{
		parent::initialize();

		$this->Templates->session_id	= $_SESSION['id'];
		$this->Templates->session_login	= $_SESSION['login'];
		$this->Templates->admin_module	= ManagerAdmin::get_module();
	}
 /**
  * Initialize component
  * @param Controller $controller
  */
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->__Controller = $controller;
     $this->__base = '/' . Configure::read('Cloggy.url_prefix');
 }
 public function initialize(Controller $controller)
 {
     $this->CollectionItemField = ClassRegistry::init('CollectionItemField');
     parent::initialize($controller);
 }
Exemplo n.º 29
0
 public function initialize(Controller $controller)
 {
     parent::initialize($controller);
     $this->controllerName = $controller->params['controller'];
     $this->modelName = ucfirst(Inflector::singularize($this->controllerName));
 }
Exemplo n.º 30
0
//if(file_exists(APPPATH.'install/index.php')) {
//include_once APPPATH.'install/index.php';
//}
// Set error handlers
set_error_handler(array('Exception_Exido', 'handlerError'));
set_exception_handler(array('Exception_Exido', 'handlerException'));
// Initialize framework
Exido::initialize();
// Load basic include paths
Exido::setIncludePaths();
// You can attach a log writer by uncomment next line
//Exido::$log->attach(new Log_File(APPPATH.'data/cache/log'));
// Load additional components
Component::load();
// Initialize loaded components
Component::initialize();
// Include internalization languages
//Exido::$i18n->attach(new I18n_File('en_US'));
Exido::$i18n->attach(new I18n_File('ru_RU'));
// Set application time zone. Depends on language loaded.
// It's UTC default.
// @see  http://php.net/timezones
date_default_timezone_set(__('__time_zone'));
// Set application locale. Depends on language loaded.
// It's en_US.UTF-8 by default.
// @see  http://php.net/setlocale
setlocale(LC_ALL, __('__locale'));
// Set application charset. Depends on language loaded.
// It's UTF-8 default.
header('Content-Type: text/html; charset=' . __('__charset'), true);
// Determine routing