public function initialize(Controller $Controller) { parent::initialize($Controller); $this->countryDataFile = dirname(dirname(dirname(__FILE__))) . DS . 'Lib' . DS . 'geoip' . DS . 'country.dat'; $this->cityDataFile = dirname(dirname(dirname(__FILE__))) . DS . 'Lib' . DS . 'geoip' . DS . 'city.dat'; $this->__autoUserLocation(); return true; }
public function initialize($Controller) { parent::initialize($Controller); $this->__checkBadLogins(); $this->__blockByIp(); $this->__setupAuth(); $this->__setupSecurity(); }
public function initialize($Controller) { parent::initialize($Controller); if ($this->getAction(false) == 'cancel') { $Controller->Event->trigger('editCanceled', !empty($Controller->request->data[$Controller->modelClass]['id']) ? $Controller->request->data[$Controller->modelClass]['id'] : null); $Controller->redirect($Controller->getPageRedirectVar()); } }
/** * Bind the behavior for view counts. * * This is done here due to the fact that we need to know what action * we are on, and its only used some of the time. The other option is * to bind it always and unbind it here but that is more overhead. * * @var object $Controller the controller being used * @var array $settings the config * * @return null nothing needed */ public function initialize(Controller $Controller, $settings = array()) { parent::initialize($Controller); if ($this->Controller->Session->read('Spam.bot') || strstr($this->Controller->request->url, '?spam=true')) { return; } if (empty($this->Controller->modelClass)) { // no model being used. return; } $settings = array_merge($this->__settings, (array) $settings); $check = $settings['admin'] === false && !(isset($Controller->request->params['admin']) && $Controller->request->params['admin']) && in_array($Controller->request->params['action'], $settings['actions']); if ($check) { $Controller->{$Controller->modelClass}->Behaviors->attach('ViewCounter.Viewable'); $Controller->{$Controller->modelClass}->__referer = $this->Controller->referer(); } }