Example #1
1
 public function beforeFilter()
 {
     $this->loadModel('User');
     parent::beforeFilter();
     // Disable content cache for Chrome
     $this->response->disableCache();
     // Delete the default auth message.  Just show them the login page
     //  people will get the idea pretty quickly.
     $this->Session->delete('Message.auth');
     /*if ($this->RequestHandler->isMobile()) {
           $this->layout = 'mobile';
           $this->isMobile = true;
       } else {
           $this->layout = 'mobile';
           $this->isMobile = true;
       }*/
     if ($this->request->is('ajax')) {
         $this->layout = 'ajax';
     }
     $this->Auth->allow('index', 'view', 'display');
     // Let everyone know about the user
     $this->set('loggedIn', $this->Auth->loggedIn());
     $user = $this->Auth->user();
     $this->isAdmin = $this->User->isAdmin($user);
     $this->isEditor = $this->User->isEditor($user);
     $this->set('loggedInuserId', $this->Auth->user('id'));
     $this->set('isAdmin', $this->isAdmin);
     $this->set('isEditor', $this->isEditor);
     $this->set('allowAccountCreation', Configure::read('App.allowPublicAccountCreation'));
 }
Example #2
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->player = null;
     $this->isPlayer = false;
     $this->isGameMaster = false;
     $this->helpers['Format'] = array('timezone' => $this->Auth->user('timezone'));
     if ($this->Auth->user()) {
         $playerId = $this->Auth->user('id');
         $this->AccessLog->save(array('plugin' => $this->request->plugin, 'controller' => $this->request->controller, 'action' => $this->request->action, 'params' => json_encode($this->request->params['pass']), 'post' => json_encode($_POST), 'get' => json_encode($_GET), 'player_id' => $playerId));
         $this->player = $this->Player->findById($playerId);
         unset($this->player['Player']['password']);
         if (!$this->request->is('ajax') && $this->request->is('get')) {
             $notifications = $this->Notification->unread($playerId, 5);
             $this->set('notificationsUnread', $notifications);
         }
         $this->isPlayer = $this->player['Player']['player_type_id'] == PLAYER_TYPE_PLAYER;
         $this->isGameMaster = $this->player['Player']['player_type_id'] == PLAYER_TYPE_GAME_MASTER;
         $this->set('myPendingActivitiesCount', $this->Log->countPendingFromPlayer($playerId));
         $this->set('activitiesNotReviewedCount', $this->Log->countNotReviewed());
         $this->set('teamPendingActivities', $this->Log->countPendingFromTeamNotFromPlayer($playerId));
         $this->set('allDomains', $this->Domain->allFromOwner($this->gameMasterId()));
     }
     $this->set('isPlayer', $this->isPlayer);
     $this->set('isGameMaster', $this->isGameMaster);
     $this->set('loggedPlayer', $this->player);
     $this->set('collapseSidebar', false);
 }
 /**
  * [beforeFilter description]
  * @return [type] [description]
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $endpoint = 'http://earthquake.usgs.gov/fdsnws/event/1/query.geojson?starttime=%DATEMIN%%2000:00:00&minmagnitude=2&endtime=%DATEMAX%%2023:59:59&orderby=time';
     $endpointTokens = ['%DATEMIN%', '%DATEMAX%'];
     $this->scrapper = new Scrapper($endpoint, $endpointTokens);
 }
 function beforeFilter()
 {
     parent::beforeFilter();
     if (!$this->authenticate_token()) {
         exit;
     }
 }
 public function beforeFilter()
 {
     $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'));
     $this->Auth->authenticate = array('Blowfish');
     $this->Auth->authError = __d('cake', 'You are not authorized to access the request action');
     parent::beforeFilter();
 }
Example #6
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     //Basic認証
     $this->autoRender = false;
     $loginId = 'yamaoka';
     $loginPassword = '******';
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         header('WWW-Authenticate: Basic realm="Please enter your ID and password"');
         header('HTTP/1.0 401 Unauthorized');
         die("id / password Required");
     } else {
         if ($_SERVER['PHP_AUTH_USER'] != $loginId || $_SERVER['PHP_AUTH_PW'] != $loginPassword) {
             header('WWW-Authenticate: Basic realm="Please enter your ID and password"');
             header('HTTP/1.0 401 Unauthorized');
             die("Invalid id / password combination.  Please try again");
         }
     }
     $typeArr = array("芝", "ダート");
     $this->set("typeArr", $typeArr);
     $turnArr = array("右", "左");
     $this->set("turnArr", $turnArr);
     $viewArr = array("非公開", "公開");
     $this->set("viewArr", $viewArr);
     $acceptArr = array("停止", "受付中");
     $this->set("acceptArr", $acceptArr);
     $kojiharuArr = array("-", "対象レース");
     $this->set("kojiharuArr", $kojiharuArr);
     $this->user = $this->Auth->user();
     $this->set("user", $this->user);
     //アクセス許可
     $this->Auth->allow('admin_login', 'admin_logout');
     $this->autoRender = true;
 }
 public function beforeFilter()
 {
     $this->Cookie->httpOnly = true;
     $currency = $this->currency();
     if (!$this->Auth->loggedIn() && $this->Cookie->read('rememberMe')) {
         $cookie = $this->Cookie->read('rememberMe');
         $this->loadModel('User');
         // If the User model is not loaded already
         $user = $this->User->find('first', array('conditions' => array('User.email' => $cookie['email'], 'User.password' => $cookie['password'])));
         if ($user && !$this->Auth->login($user['User'])) {
             $this->redirect('/users/logout');
             // destroy session & cookie
         }
     }
     $this->createArrayValue();
     $param = $this->request->params;
     $action = $param['action'];
     if ($this->params['prefix'] == '') {
         $this->Auth->allow();
     } elseif ($this->params['prefix'] == 'mpadmin') {
         if ($this->Session->read('Auth.User')) {
             if ($this->Auth->user('role_id') == 1) {
                 $this->Auth->allow();
             } else {
                 $this->Session->destroy();
                 $this->Session->setFlash(__('Your are not authorized here  '));
                 $this->redirect(array('prefix' => false, 'controller' => 'users', 'action' => 'login'));
             }
         } else {
             $this->Auth->allow('mpadmin_login');
         }
     }
     parent::beforeFilter();
     $this->set(compact('currency'));
 }
 function beforeFilter()
 {
     parent::beforeFilter();
     $pageRedirect = $this->Session->read('permission_error_redirect');
     $this->Session->delete('permission_error_redirect');
     $this->company_id = $this->Session->read('Company.id');
     if (empty($pageRedirect)) {
         $actionUrl = $this->params['url']['url'];
         if (isset($this->params['slug'])) {
             $website = $this->Website->find('Website.subdomain = "' . $this->params['slug'] . '"');
         } else {
             $website = null;
         }
         if (!$website) {
             $user = $this->Authsome->get();
             if (!$user) {
                 //anonymous?
                 if (!$this->UserGroup->isGuestAccess($actionUrl)) {
                     $this->Session->write('permission_error_redirect', '/users/login');
                     $this->Session->setFlash('Sorry, You don\'t have permission to view this page.');
                     $this->redirect('/users/login');
                 }
             } else {
                 if (!$this->UserGroup->isUserGroupAccess($user['User']['user_group_id'], $actionUrl)) {
                     $this->Session->write('permission_error_redirect', '/users/login');
                     $this->Session->setFlash('Sorry, You don\'t have permission to view this page. ' . $user['User']['user_group_id'] . ':(' . $actionUrl . ')');
                     $this->redirect('/users/dashboard');
                 }
             }
         }
     }
 }
Example #9
0
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->loadModel('Event');
     $sidebar_events = $this->Event->get_upcoming_events(4);
     $this->set('sidebar_events', $sidebar_events);
 }
Example #10
0
 public function beforeFilter()
 {
     $this->_setSettings();
     parent::beforeFilter();
     $ext = explode(".", $this->request->here);
     $ext = strtolower($ext[count($ext) - 1]);
     if (!in_array($ext, array("gif", "png", "php", "jpg", "pdf")) && !strstr($this->request->here, "/admin")) {
         $this->loadModel('Seo.SeoUri');
         $uri = $this->SeoUri->find('first', array('conditions' => array('SeoUri.uri' => $this->request->here)));
         if (empty($uri)) {
             $this->SeoUri->create();
             $this->SeoUri->save(array('SeoUri' => array('uri' => $this->request->here, 'is_approved' => 1, 'created' => date("Y-m-d H:i:s", time()), 'modified' => date("Y-m-d H:i:s", time()))));
         }
     }
     $this->Auth->authenticate = array('all' => array('userModel' => 'User'), 'Form');
     $this->Auth->allow('admin_add', 'getglobals');
     if ($this->request->param("prefix")) {
         $this->layout = "admin";
     }
     $this->loadModel('User');
     $this->set('authUser', $this->User->find('first', array('conditions' => array('User.id' => $this->Auth->User('id')))));
     $this->loadModel('Size');
     $this->set("sizes_cart", $this->Size->find('all'));
     $this->set("patterns", $this->_patterns);
     $this->set("_bycolorswt", $this->_bycolorswatchs());
     $this->_getglobals();
 }
Example #11
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     //$this->set('title_for_layout','Seção de Administração para o Aplicativo');
     $this->set('current_user', $this->Auth->user());
     $controller = $this->params['controller'];
     $action = $this->params['action'];
     $user = $this->Auth->user();
     $groupid = $user['group_id'];
     $this->Auth->allow('index');
     //'add'
     if ($action != 'index') {
         // || $action != 'add'
         if ($this->AccessControl->access($controller, $action) == 'admins' && $groupid == 1) {
             //
         } elseif ($this->AccessControl->access($controller, $action) == 'managers' && $groupid == 2) {
             //
         } else {
             if ($this->AccessControl->access($controller, $action) == false) {
                 //$this->Session->setFlash(__('Privilégio não cadastrado/Acesso Negado!'));
             } else {
                 $this->redirect(array('plugin' => 'admin', 'controller' => 'users', 'action' => 'login'));
             }
         }
     }
 }
Example #12
0
 /**
  * beforeFilter
  *
  * @return void
  * @throws MissingComponentException
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $aclFilterComponent = Configure::read('Site.acl_plugin') . 'Filter';
     if (empty($this->{$aclFilterComponent})) {
         throw new MissingComponentException(array('class' => $aclFilterComponent));
     }
     $this->{$aclFilterComponent}->auth();
     $this->RequestHandler->setContent('json', 'text/x-json');
     $this->Security->blackHoleCallback = 'securityError';
     $this->Security->requirePost('admin_delete');
     if (isset($this->request->params['admin'])) {
         $this->layout = 'admin';
     }
     if ($this->RequestHandler->isAjax()) {
         $this->layout = 'ajax';
     }
     if (Configure::read('Site.theme') && !isset($this->request->params['admin'])) {
         $this->theme = Configure::read('Site.theme');
     } elseif (Configure::read('Site.admin_theme') && isset($this->request->params['admin'])) {
         $this->theme = Configure::read('Site.admin_theme');
     }
     if (!isset($this->request->params['admin']) && Configure::read('Site.status') == 0) {
         $this->layout = 'maintenance';
         $this->response->statusCode(503);
         $this->set('title_for_layout', __('Site down for maintenance'));
         $this->render('../Elements/blank');
     }
     if (isset($this->request->params['locale'])) {
         Configure::write('Config.language', $this->request->params['locale']);
     }
 }
Example #13
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     Configure::config('configini', new IniReader());
     Configure::load('config.ini', 'configini');
     /*
      * "Auth" logic
      * Generate and test the security key
      */
     $api = json_decode($this->Setting->getOption('api'));
     if (empty($api) || empty($api->enabled) || !$api->enabled) {
         return $this->api401(__('API is disabled'));
     }
     // No key, refuse connexion
     if (empty($this->request->params['named']) || empty($this->request->params['named']['key'])) {
         return $this->api401(__('Security key is missing'));
     }
     // Get the key and remote it from the params
     $theirSecurityKey = $this->request->params['named']['key'];
     unset($this->request->params['named']['key']);
     // generate the security key
     $paramsUrl = '/' . $this->request->params['controller'] . '/' . $this->request->params['action'];
     $paramsUrl .= $this->Tools->paramsToUrl($this->request->params['named']);
     $securityKey = hash_hmac('sha1', $paramsUrl, $api->privateKey);
     if ($theirSecurityKey != $securityKey) {
         return $this->api401(__('Wrong security key'));
     }
 }
Example #14
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->Auth->userScope = array('User.status' => 1);
     $this->Auth->allow('login');
     $this->Auth->fields = array('username' => 'username', 'password' => 'password');
     /* 
     if($this->Auth->user()){
     $userid = $this->Session->read('Auth.User.id');	
     
     $this->loadModel('Inbox');
     $notifquery="SELECT
     			(SELECT SUM(sender_read) FROM mfc353_2.inboxes WHERE sender_id=$userid)
     			+
     			(SELECT SUM(receiver_read) FROM mfc353_2.inboxes WHERE receiver_id=$userid)
     			as SumCount";
     $notif=$this->Inbox->query($notifquery);
     
     $notifications=$notif[0][0]['SumCount'];
     	if($notifications!=0){
     	if($notifications=1)
     	$notification="You have $notifications unread message in your inbox!";
     	else
     	$notification="You have $notifications unread messages in your inbox!";
     	$this->Session->setFlash(__($notification), 'good');
     	}
     }
     */
 }
Example #15
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     //$this->_setupSecurity();
     $this->loadModel('Description');
     $desc = $this->Description->find('all', array('conditions' => array('Description.pagetype' => 'history', 'Description.visible' => true)));
     $history_menu = array();
     foreach ($desc as $d) {
         $history_menu[$d['Description']['name']] = array('controller' => 'firearms', 'action' => 'learn', 'history', $d['Description']['slug']);
     }
     $desc = $this->Description->find('all', array('conditions' => array('Description.pagetype' => 'firearm', 'Description.visible' => true)));
     $firearm_menu = array();
     foreach ($desc as $d) {
         $firearm_menu[$d['Description']['name']] = array('controller' => 'firearms', 'action' => 'learn', 'firearm', $d['Description']['slug']);
     }
     /*
     $desc=$this->Description->find('all',array('conditions'=>array('Description.pagetype'=>'Gun','Description.visible'=>true)));
     $gun_menu=array();
     foreach ($desc as $d){
     	$gun_menu[$d['Description']['name']]=array('controller'=>'firearms','action'=>'gunview',$d['Description']['id']);
     }
     $desc=$this->Description->find('all',array('conditions'=>array('Description.pagetype'=>'Feature','Description.visible'=>true)));
     $f_menu=array();
     foreach ($desc as $d){
     	$f_menu[$d['Description']['name']]=array('controller'=>'firearms','action'=>'featureview',$d['Description']['id']);
     }
     */
     $menu_array = array('Firearms History' => array('dropdown' => $history_menu), 'Our Firearms' => array('dropdown' => $firearm_menu), 'Packages' => array('controller' => 'firearms', 'action' => 'packages'));
     $this->set(compact('menu_array'));
 }
Example #16
0
 public function beforeFilter()
 {
     parent::beforeFilter();
     //$this->layout = 'bootstrap';
     $this->set('title_for_layout', 'Pizzaria FicaCalmo');
     $this->set('current_user', $this->Auth->user());
     $controller = $this->params['controller'];
     $action = $this->params['action'];
     $user = $this->Auth->user();
     $_SESSION['current_user'] = $user['username'];
     $groupid = $user['group_id'];
     $this->Auth->allow('index', 'addregisto', 'addcliente');
     //'add'
     if ($action != 'index') {
         // || $action != 'add'
         if ($this->AccessControl->access($controller, $action) == 'admins' && $groupid == 1) {
             //
         } elseif ($this->AccessControl->access($controller, $action) == 'managers' && $groupid == 2) {
             //
         } else {
             if ($this->AccessControl->access($controller, $action) == false) {
                 //$this->Session->setFlash(__('Privilégio não cadastrado/Acesso Negado!'));
             } else {
                 $this->redirect(array('plugin' => 'admin', 'controller' => 'users', 'action' => 'login'));
             }
         }
     }
 }
 /**
  * [beforeFilter description]
  * @return [type] [description]
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $endpoint = 'http://sismologia.cl/events/listados/%YEAR%/%MONTH%/%YEAR%%MONTH%%DAY%.html';
     $endpointTokens = ['%YEAR%', '%MONTH%', '%DAY%'];
     $this->scrapper = new Scrapper($endpoint, $endpointTokens);
 }
 public function beforeFilter()
 {
     $this->Redirects->apply($this->request->url);
     $this->Auth->authenticate = array('Blowfish' => array('userModel' => 'User'));
     $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
     $this->Auth->deny();
     $whiteList = array();
     //        if ( $this->Auth->user() ) {
     //            $this->Auth->allow();
     //        } else {
     //            $this->Auth->allow($whiteList);
     //        }
     $this->Auth->allow();
     $this->Auth->authError = 'Suas permissões não concedem acesso ao recurso solicitado.';
     if ($this->Auth->user() && !$this->isAuthorized()) {
         $this->Session->setFlash($this->Auth->authError, 'default', array('class' => 'alert alert-error'));
         $this->redirect('/');
     }
     if ($this->params['prefix'] == 'admin') {
         $this->layout = 'admin';
     }
     $this->set('keywords', '');
     $this->set('description', '');
     parent::beforeFilter();
 }
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->set('compress', $this->compress);
     $this->set('version', $this->version);
     $this->set('title_for_layout', "Sardonix Idiomas | Inglês, Italiano e Português | {$this->getPageName()}");
     $this->set('description', "Cursos de Inglês, Italiano e Português em Novo Hamburgo | {$this->getPageName()} | Sardonix Idiomas");
     $this->set('keywords', 'cursos de idiomas, ingles, italiano, portugues, aulas particulares, grupos pequenos');
     $this->set('cep', '93520-000');
     $this->set('lat', -29.680013);
     $this->set('lng', -51.12933);
     $this->set('address', 'Rua Bento Gonçalves, 3023, Loja 1, Centro, Novo Hamburgo - RS');
     $this->set('email', '*****@*****.**');
     $this->set('phone', '(51) 3066-8188');
     $news = $this->New->find('all', array('order' => 'datetime DESC'));
     $this->set('news', $news);
     $url = '';
     if (!($this->params['controller'] == 'pages' && $this->params['action'] == 'home')) {
         $url .= $this->params['controller'] . '/';
         if ($this->params['action'] != 'index') {
             $url .= $this->params['action'];
         }
     }
     $this->set('url', $url);
     $this->set('testimonials', $this->Testimonial->find('all'));
     $cursos = array('Comunicação' => 'O formato Comunicação é planejado para as pessoas que querem aprender as formas de comunicação e expressão do quotidiano. O idioma é direcionado para a conversação diária, também com foco na estrutura, mas com mais ênfase nas situações comunicativas e práticas.', 'Comercial' => 'O formato Comercial foca o idioma utilizado em organizações, ou seja; o idioma comercial. Além do vocabulário especialmente selecionado para o mundo empresarial, esse formato também trabalha com estrutura e situações comunicativas do quotidiano no mundo dos negócios.', 'Profissional' => 'O formato Profissional é totalmente orientado para estrutura e moldado para alunos que pretendem fazer provas de proficiência em língua estrangeira, como por exemplo: TOEIC, PET, IELTS e TOEFL.', 'Dinâmico' => 'O formato Dinâmico é um “coringa”, pois, ele se adaptará às necessidades específicas de cada aluno sendo que esse pode ser direcionado para o formato Comunicação, Comercial ou Profissional. Existe um aumento significativo da carga horária para que o objetivo seja alcançado – um aprendizado em um tempo menor.');
     $this->set('cursos', $cursos);
 }
Example #20
0
 /**
  * Before any controllers are loaded
  */
 public function beforeFilter()
 {
     /*	Setup Auth variables */
     $this->Auth->authenticate = array('Form' => array('fields' => array('username' => 'email', 'password' => 'password', 'salt' => 'salt')));
     $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
     $this->Auth->fields = array('username' => 'email', 'password' => 'password', 'salt' => 'salt');
     $this->Auth->autoRedirect = false;
     $this->Auth->flashElement = 'flash_error';
     $this->Auth->allow('display');
     # For pages
     if ($this->Auth->loggedIn() === true) {
         $user = $this->Auth->user();
         if (!isset($user['User'])) {
             $this->user = array('User' => $user);
         } else {
             $this->user = $user;
         }
     } else {
         $this->user = null;
     }
     # All the sets for global
     $this->set('user', $this->user);
     # Not logged in, and not an admin, redirect away
     if (isset($this->params['admin']) && $this->params['admin'] === true && $this->user) {
         if ($this->user['User']['group_id'] == 1) {
             $this->Auth->allow('*');
             $this->layout = 'admin';
         } else {
             $this->redirect('/');
         }
     }
     parent::beforeFilter();
 }
Example #21
0
 function beforeFilter()
 {
     parent::beforeFilter();
     /* レイアウトの指定  */
     if (isset($this->params['prefix'])) {
         $this->layout = $this->params['prefix'];
     }
     /* ユーザ画面用 */
     /* セッションから取り出したログイン情報をセット */
     $auth = $this->Session->read("auth");
     $this->set("auth", $auth);
     /* ログイン必須の機能でログインされていない場合はログイン画面へ転送 */
     if ($this->needAuth && $this->action != "login") {
         if (empty($auth)) {
             $this->redirect("/users/login/");
             exit;
         }
     }
     /**
      * 拡張子が.jsonの場合
      */
     if ($this->RequestHandler->ext == 'json') {
         Configure::write('debug', 0);
         $this->RequestHandler->setContent('json');
         $this->RequestHandler->respondAs('application/json; charset=UTF-8');
     }
     /**
      * XML出力の時はSQLデバッグ文を出さない
      */
     if ($this->RequestHandler->isXml()) {
         Configure::write('debug', 0);
     }
 }
Example #22
0
 public function beforeFilter()
 {
     $this->Auth->allow(array('clear_cache'));
     $this->helpers = empty($this->helpers) ? array() : $this->helpers;
     $this->helpers += array('Session');
     $this->home = Configure::read('Environment.Routes.home') ?: '/';
     $returnTo = $this->Session->read('Environment.returnTo');
     if (is_array($returnTo) || is_string($returnTo)) {
         $params = $this->request->params;
         $exceptions = empty(static::$returnException[$params['controller']]) ? array() : static::$returnException[$params['controller']];
         if (!in_array($params['action'], $exceptions)) {
             if ($this->Session->delete('Environment.returnTo')) {
                 return $this->redirect($returnTo);
             }
         }
     }
     $this->clientConfiguration = empty($this->clientConfiguration) ? array() : $this->clientConfiguration;
     $facebookSettings = Configure::read('Facebook') ? array('fbAppId' => Configure::read('Facebook.appId'), 'fbAppUrl' => Configure::read('Facebook.appUrl')) : array();
     if ($this->request->prefix === 'panel') {
         $this->theme = 'CakeStrap';
         $this->layout = 'default';
         $environmentType = Configure::read('Environment.Type');
         $this->clientConfiguration += $facebookSettings + array('enviromentType' => $environmentType, 'basePath' => Router::url('/'), 'baseUrl' => Router::url('/', true), 'pageType' => $this->request->prefix);
         $this->set('config', (object) $this->clientConfiguration);
         $this->set('referer', $this->referer());
     }
     $this->request->actionTitle = ucfirst(str_replace("{$this->request->prefix}_", '', $this->request->action));
     return parent::beforeFilter();
 }
Example #23
0
 public function beforeFilter()
 {
     // debug($this->request->params);
     parent::beforeFilter();
     $gallerySidebar = $this->__gallerySidebar();
     // debug($this->request->params['prefix']);
     $admin = isset($this->request->params['prefix']) && $this->request->params['prefix'] == 'admin' ? 'admin/' : false;
     if (!$admin) {
         $this->Auth->allow();
     }
     if ($admin) {
         $this->layout = 'default';
     } else {
         $this->layout = 'index';
     }
     if (isset($this->params['language']) && $this->params['language'] == 'kz') {
         Configure::write('Config.language', 'kz');
     } elseif (isset($this->params['language']) && $this->params['language'] == 'en') {
         Configure::write('Config.language', 'en');
     } else {
         Configure::write('Config.language', 'ru');
     }
     // debug($this->request->params);
     // debug($this->params['language']);
     $lang = $this->params['language'] ? $this->params['language'] . '/' : '';
     $this->set(compact('admin', 'lang', 'gallerySidebar'));
 }
Example #24
0
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->getConfig = Configure::read('webConfig');
     $this->theme = $this->getConfig['template'];
     $this->layout = $this->getConfig['template'];
     //Collemos a configuración da tenda da bbdd
     $this->set('config', $this->getConfig);
     //Collemos os tamaños das imxes da bbdd para cada controlador
     if (isset($this->getConfig['image_' . $this->params->controller])) {
         $imageSize = explode('x', $this->getConfig['image_' . $this->params->controller]);
         $this->set('imageSize', $imageSize);
     }
     //Collemos o nome da web (para os meta tags)
     $this->set('webName', $this->getConfig['webName']);
     $this->Auth->allow('index', 'view', 'contact', 'about');
     $this->setDefaults();
     //MODO MANTEMENTO
     //----------------------------------------------------------------------
     $this->manteinance();
     //Default language for dashboard
     $dashboardActions = array('add', 'edit', 'viewList');
     $controller = Inflector::camelize(Inflector::singularize($this->params['controller']));
     if (in_array($this->params['action'], $dashboardActions)) {
         $this->{$controller}->locale = $this->getConfig['default_language'];
     } else {
         $this->{$controller}->locale = Configure::read('Config.language');
     }
 }
Example #25
0
 function beforeFilter()
 {
     $this->Auth->fields['username'] = '******';
     $this->Auth->authorize = 'controller';
     $this->Auth->autoRedirect = false;
     $this->Auth->loginAction = '/admin/login';
     $this->Auth->logoutRedirect = '/';
     $this->Auth->userScope = array('User.active = 1');
     if (strstr($this->action, 'admin_') !== false) {
         $this->layout = 'admin';
     } else {
         $this->Auth->allow(array('*'));
         $this->layout = 'default';
     }
     if (!$this->Session->check('Areas')) {
         $this->ObjectMunicipal->contain('ObjectMunicipalArea');
         $areas = $this->ObjectMunicipal->find('all');
         $this->Session->write('Areas', $areas);
     }
     if (!$this->Session->read('SearchCounter')) {
         $num_items = $this->ObjectItem->find('count', array('conditions' => array('ObjectItem.is_active' => '1')));
         $this->set('SearchCounter', $num_items);
     }
     parent::beforeFilter();
 }
 public function beforeFilter()
 {
     parent::beforeFilter();
     if ($this->RequestHandler->responseType() == 'json') {
         $this->RequestHandler->setContent('json', 'application/json');
     }
 }
Example #27
0
 public function beforeFilter()
 {
     // debug($this->request->params);
     parent::beforeFilter();
     // debug($this->request->params['prefix']);
     $admin = isset($this->request->params['prefix']) && $this->request->params['prefix'] == 'admin' ? 'admin/' : false;
     if (!$admin) {
         $this->Auth->allow();
     }
     if ($admin) {
         $this->layout = 'default';
     } else {
         $this->layout = 'index';
     }
     if (isset($this->params['language']) && $this->params['language'] == 'kz') {
         Configure::write('Config.language', 'kz');
         $this->Technology->locale = 'kz';
     } elseif (isset($this->params['language']) && $this->params['language'] == 'en') {
         Configure::write('Config.language', 'en');
     } else {
         Configure::write('Config.language', 'ru');
         $this->Technology->locale = 'ru';
     }
     // debug($this->request->params);
     // debug($this->params['language']);
     // $this->Technology->locale = 'ru';
     // $this->Technology->bindTranslation(array('title' => 'titleTranslation', 'body' => 'bodyTranslation'));
     $technologies = $this->Technology->find('all');
     $this->Service->locale = 'ru';
     $menu_left = $this->_serviceMenu(1);
     $menu_right = $this->_serviceMenu(2);
     $lang = $this->params['language'] ? $this->params['language'] . '/' : '';
     $this->set(compact('admin', 'lang', 'technologies', 'menu_left', 'menu_right'));
 }
 function beforeFilter()
 {
     parent::beforeFilter();
     $this->loginConfig();
     $this->setLoginData();
     $this->pluginObjtects();
 }
 /**
  * Antes de filtrar
  * 
  * 1 - Define o layout do prefixo 'admin'
  * 
  * @return void
  */
 public function beforeFilter()
 {
     if ($this->_isPrefix('admin')) {
         $this->layout = 'admin';
         array_push($this->helpers, 'TwitterBootstrap.BootstrapForm');
     }
     return parent::beforeFilter();
 }
Example #30
0
 /**
  * Callback default
  * 
  * @return void
  */
 public function beforeFilter()
 {
     $this->__setupAuth();
     if ($this->userLogged === true) {
         $this->__buildMenu();
     }
     parent::beforeFilter();
 }