/** * * before filter * * @return void */ public function beforeFilter() { parent::beforeFilter(); $this->Auth->allow(); if (!fileExistsInPath(APP . DS . 'tmp' . DS . 'newsletter_init.lock')) { $this->init(); } }
public function admin_toggle($id = null) { if (!$id) { $this->notice('invalid'); } $data = $this->Campaign->find('first', array('fields' => array('Campaign.id', 'Campaign.active'), 'conditions' => array('Campaign.id' => $id), 'contain' => array('Newsletter' => array('fields' => array('Newsletter.id'))))); if (!$data['Campaign']['active'] && empty($data['Newsletter'])) { $this->notice(__('You can not enable a campaign with no mails.'), array('level' => 'warning', 'redirect' => true)); } return parent::admin_toggle($id); }
function beforeFilter() { parent::beforeFilter(); $this->Auth->allow('unsubscribe', 'subscribe', 'confirm_subscription'); }
/** * * before filter * * @access public */ public function beforeFilter() { parent::beforeFilter(); //$this->Auth->allow('*'); }
function beforeFilter() { parent::beforeFilter(); $this->Auth->allow('read'); }
public function admin_add() { parent::admin_add(); $campaigns = $this->Newsletter->Campaign->find('list'); if (empty($campaigns)) { $this->notice(__('Please create a campaign before creating a newsletter'), array('level' => 'notice', 'redirect' => array('controller' => 'campaigns'))); } $this->set(compact('campaigns')); }
public function admin_edit($id) { parent::admin_edit($id); $users = $this->NewsletterSubscriber->User->find('list'); $this->set(compact('users')); }
function admin_mass() { $model = $this->modelNames[0]; $ids = $this->__massGetIds($this->data[$model]); switch ($this->__massGetAction($this->params['form'])) { case 'delete': return parent::__massActionDelete($this->__canDelete($ids)); break; default: parent::admin_mass(); break; } // switch }
function admin_toggle($id = null) { if (!$id) { $this->Session->setFlash(__('Please select a campaign', true)); $this->redirect($this->referer()); } $data = $this->Campaign->find('first', array('fields' => array('Campaign.id', 'Campaign.active'), 'conditions' => array('Campaign.id' => $id), 'contain' => array('Newsletter' => array('fields' => array('Newsletter.id'))))); if (!$data['Campaign']['active'] && empty($data['Newsletter'])) { $this->Session->setFlash(__('You can not enable a campaign with no mails.', true)); $this->redirect($this->referer()); } return parent::admin_toggle($id); }
function beforeFilter() { parent::beforeFilter(); // @todo make sure function track is allowed by all }
function admin_delete($id = null) { if (!$id) { $this->Session->setFlash(__('That template could not be found', true)); $this->redirect($this->referer()); } $template = $this->Template->read(null, $id); if (!empty($template['Campaign'])) { $this->Session->setFlash(__('There are some campaigns using that template', true)); $this->redirect($this->referer()); } if (!empty($template['Newsletter'])) { $this->Session->setFlash(__('There are some newsletters using that template', true)); $this->redirect($this->referer()); } parent::admin_delete($id); }
function beforeFilter() { Cache::config('newsletter_task', array('engine' => 'File', 'duration' => '+1 hours')); if (!empty($this->params['admin']) && !NewsletterConfig::load('cron') && !Cache::read('newsletter_task', 'newsletter_task')) { App::import('Lib', 'Newsletter.NewsletterTask'); NewsletterTask::sync(); Cache::write('newsletter_task', 1, 'newsletter_task'); } parent::beforeFilter(); }