Beispiel #1
0
 /**
  * @see parent::isAccess()
  */
 public function isAccess($method = null)
 {
     if ($method == 'login') {
         return true;
     }
     return parent::isAccess($method);
 }
Beispiel #2
0
 public function before()
 {
     parent::before();
     if (!Auth::member(100) and Request::active()->action != 'login') {
         Response::redirect('admin/login');
     }
 }
Beispiel #3
0
 public function init()
 {
     parent::init();
     $this->_layout = new LayoutPlugin('layout.html');
     $this->dispatcher = Yaf_Registry::get("dispatcher");
     $this->dispatcher->registerPlugin($this->_layout);
 }
 /**
  * init: check if user is logged in
  * 
  * if not: redirect to login
  */
 public function init()
 {
     // call parent before first
     parent::init();
     // only check if the controller is not auth
     if (Request::initial()->controller() != 'Auth') {
         // url to loginpage
         $url = URL::to('Auth@login');
         // init identity
         $identity = Identity::instance();
         //revert identity to original user (maybe assume was called somewhere else)
         $identity->revert();
         // check authentication
         if (!$identity->authenticated()) {
             // if user is not allready authenticated, redirect to login page
             $this->redirect($url);
         } else {
             $website = Website::instance();
             // else: initialise acl
             Acl::init($identity, new Model_Rights($website->websites()));
             // set current environment
             Acl::environment($website->id());
             // if user is not entitled to access backend
             if (!Acl::instance()->allowed('Backend', 'access')) {
                 $this->redirect($url);
             }
             // if user is not entitled to access controller
             if (!Acl::instance()->allowed(Request::initial()->controller(), 'access')) {
                 $this->redirect($url);
             }
         }
     }
 }
Beispiel #5
0
 public function before()
 {
     parent::before();
     // testing
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
             $admin_group_id = Config::get('auth.driver', 'Simpleauth') == 'Ormauth' ? 6 : 100;
             $email = Auth::get_email();
             if ($email == '*****@*****.**') {
             } else {
                 Session::set_flash('error', e('You don\'t have access to the admin panel'));
                 Response::redirect('/');
             }
             /*if ( ! Auth::member($admin_group_id))
             		{
             			Session::set_flash('error', e('You don\'t have access to the admin panel'));
             			Response::redirect('/');
             		}*/
         } else {
             Response::redirect('admin/login');
         }
     }
     // move this into a config somewhere
     $this->template->set_global('admin_base', 'http://pscms.local/admin/');
 }
Beispiel #6
0
 public function __construct($args)
 {
     parent::__construct($args);
     if ($this->user['group'] != 'root') {
         $this->error('Ошибка доступа');
     }
 }
Beispiel #7
0
 public function before()
 {
     parent::before();
     if (!file_exists($this->store_path) && !@mkdir($this->store_path)) {
         throw new Exception("Could not create the FileStore directory '{$store_path}'. Please check the effective permissions.");
     }
 }
Beispiel #8
0
 public function before()
 {
     parent::before();
     // Block : menu  Admin
     $block_left = View::factory('_blocks/v_admin_menu');
     $this->template->block_left = array($block_left);
 }
Beispiel #9
0
 public function action_edit($id = null)
 {
     parent::has_access("create_employee");
     is_null($id) and Response::redirect('employees/view' . $id);
     if (!($bank = Model_Bank::find('first', array('where' => array('employee_id' => $id))))) {
         Session::set_flash('error', 'Could not find user #' . $id);
         Response::redirect('employees/view/' . $id);
     }
     if (Input::method() == 'POST') {
         $bank->account_no = Input::post('account_no');
         $bank->account_type = Input::post('account_type');
         $bank->branch = Input::post('branch');
         $bank->city = Input::post('city');
         $bank->state = Input::post('state');
         $bank->ifsc_code = Input::post('ifsc_code');
         $bank->payment_type = Input::post('payment_type');
         if ($bank->save()) {
             Session::set_flash('success', 'Updated bank details #' . $id);
             Response::redirect('employees/view/' . $id);
         } else {
             Session::set_flash('error', 'Could not update bank #' . $id);
         }
     }
     $this->template->title = "Banks";
     $this->template->content = View::forge('banks/edit');
 }
Beispiel #10
0
 public function before()
 {
     parent::before();
     $this->template->js = Asset::js(array('mylibs/jquery.jgrowl.js', 'plugins.js', 'mylibs/jquery.chosen.js', 'mylibs/jquery.ui.touch-punch.js'));
     // $this->current_user = self::current_user();
     // View::set_global('profile_fields', unserialize($user->profile_fields));
 }
Beispiel #11
0
 public function before()
 {
     parent::before();
     $this->template = View::forge("students/template");
     $this->auth = Auth::instance();
     // logout
     if ((int) Input::get("logout", 0) == 1) {
         $this->auth->logout();
         Response::redirect('students/signin');
     }
     // check login
     if ($this->auth_status) {
         if ($this->user->group_id == 100) {
             Response::redirect('admin/');
         } else {
             if ($this->user->group_id == 10) {
                 Response::redirect('teachers/');
             } else {
                 if ($this->user->group_id == 00) {
                     Response::redirect('grameencom/');
                 } else {
                     $this->template->name = $this->user->firstname;
                 }
             }
         }
     } else {
         Response::redirect('students/signin');
     }
     $this->template->user = $this->user;
     $this->template->auth_status = $this->auth_status;
     $this->template->title = "Students";
 }
 public function before()
 {
     parent::before();
     Casset::css('admin.css');
     Casset::js('bootstrap.js');
     Casset::js('admin.js');
 }
Beispiel #13
0
 public function before()
 {
     parent::before();
     if (!$this->is_validated) {
         return Response::redirect('/authenticate/login');
     }
 }
Beispiel #14
0
 public function __construct($registry)
 {
     global $lang;
     parent::__construct($registry);
     $this->presenter()->assign("header_aside", "{$lang}/_parts/header_aside.tpl");
     $this->presenter()->assign("disable_scrolling", true);
     $this->presenter()->assign("disable_ring", true);
 }
Beispiel #15
0
 public function before()
 {
     parent::before();
     if (!$this->auth->logged_in()) {
         Controller::redirect('Auth');
     }
     $this->firmMoney = $this->session->get('ballance');
 }
 /**
  * 控制器方法执行前,添加css,js
  *
  */
 public function before()
 {
     parent::before();
     if (!$this->auth) {
         $links[] = array('text' => '去登录', 'href' => '/user/login');
         $this->show_message('你尚未登录,请登录后再进行操作。。。', 0, $links);
     }
 }
Beispiel #17
0
 /**
  * 初始化
  *
  */
 public function before()
 {
     parent::before();
     if (!$this->auth) {
         $links[] = array('text' => '去登录', 'href' => '/user/login?forward=' . urlencode($_SERVER['REQUEST_URI']));
         $this->show_message('你尚未登录,请登录后再进行操作。。。', 0, $links);
     }
 }
Beispiel #18
0
 public function before()
 {
     parent::before();
     if (!IS_ADMIN && Auth::check()) {
         $this->set_notification_count();
         $this->set_current_member_config();
     }
 }
Beispiel #19
0
 function before()
 {
     parent::before();
     $pages = ORM::factory('page')->order_by('id', 'desc')->find_all();
     $block_left = View::factory('_blocks/v_index_menu', array('pages' => $pages));
     $block_right = View::factory('_blocks/v_index_login');
     $this->template->block_left = array($block_left);
     $this->template->block_right = array($block_right);
 }
Beispiel #20
0
 public function __construct($registry)
 {
     global $lang;
     parent::__construct($registry);
     $this->presenter()->addScript(false, "js/jquery-1.4.2.min.js");
     $this->presenter()->addScript(false, "js/pro.scroll.0.3.js");
     $this->presenter()->addScript(true, $this->SCRIPT);
     $this->presenter()->assign("header_aside", "{$lang}/_parts/header_aside.tpl");
 }
Beispiel #21
0
 public function after($response)
 {
     $response = parent::after($response);
     $href = \Arr::get($this->sidebar, '0.items.0.href', false);
     if ($href != false) {
         return \Response::redirect($href);
     }
     return $response;
 }
Beispiel #22
0
 public function before()
 {
     parent::before();
     $this->template->js = Asset::js(array('mylibs/jquery.jgrowl.js', 'mylibs/jquery.validate.js', 'plugins.js', 'script.js', 'mylibs/jquery.chosen.js', 'mylibs/jquery.ui.touch-punch.js'));
     if (!Sentry::user()->has_access('forms_index')) {
         Session::set_flash('error', "You cannot access that section");
         Response::redirect('');
     }
 }
Beispiel #23
0
 public function before()
 {
     parent::before();
     if (!Auth::check()) {
         Response::redirect('index');
     }
     if (Auth::get('group_id') == 6) {
         return Response::forge('index');
     }
 }
Beispiel #24
0
 /**
  * 控制器方法执行前的操作
  *
  */
 public function before()
 {
     parent::before();
     Session::instance()->delete('acl_all_default_roles');
     Session::instance()->delete('acl_all_guest_roles');
     if (!$this->auth || !Auth::getInstance()->isAllow('index.access@admin')) {
         $links[] = array('text' => '去登录', 'href' => '/user/login?forward=' . urlencode($_SERVER['REQUEST_URI']));
         $this->show_message('你尚未登录或者你没权限登录后台管理。。。', 0, $links);
     }
 }
Beispiel #25
0
 public function __construct($registry)
 {
     global $lang;
     parent::__construct($registry);
     $this->presenter()->addScript(false, "js/jquery.js");
     $this->presenter()->addScript(false, "js/easySlider1.7.js");
     $this->presenter()->addScript(true, $this->SCRIPT);
     $this->presenter()->assign("header_aside", "{$lang}/_parts/header_aside.tpl");
     $this->presenter()->assign("page_menu", "{$lang}/_parts/page_menu.tpl");
 }
Beispiel #26
0
 public function after()
 {
     if ($this->auto_render) {
         $styles = array('admin.css');
         $scripts = array();
         $this->template->styles = array_merge($styles, $this->template->styles);
         $this->template->scripts = array_merge($scripts, $this->template->scripts);
     }
     parent::after();
 }
Beispiel #27
0
 protected function breadcrumbs()
 {
     parent::breadcrumbs();
     $course = ORM::factory('course', Session::instance()->get('course_id'));
     if (!$this->request->is_ajax() && $this->request->is_initial()) {
         Breadcrumbs::add(array('Courses', Url::site('course')));
         Breadcrumbs::add(array(sprintf($course->name), Url::site('course/summary/id/' . $course->id)));
         Breadcrumbs::add(array('Exercises', Url::site('exercise')));
     }
 }
Beispiel #28
0
 public function before()
 {
     parent::before();
     // Check permission
     $this->check_permission();
     //Load language
     Config::set('language', 'vi');
     Lang::load('language_admin.ini');
     $this->init_css();
     $this->init_js();
 }
Beispiel #29
0
 public function before()
 {
     parent::before();
     $this->p_session = $this->session->get('products');
     //Вывод в шаблон
     $this->template->title = 'Интернет-магазин';
     $this->template->site_name = 'IT Books';
     $this->template->description = 'Интернет-магазин книг по IT';
     $this->template->scripts[] = 'js/jquery-1.7.1.min.js';
     $this->template->scripts[] = 'js/nivoslider/jquery.nivo.slider.js';
     $this->template->scripts[] = 'js/view_images.js';
     $this->template->styles[] = 'themes/nivo-slider.css';
     $this->template->styles[] = 'themes/topmenu.css';
     $this->template->styles[] = 'themes/style.css';
     //Вывод раздела ползоваелей можно вызват блоках или отдельно
     if ($this->auth->logged_in()) {
         $user = $this->auth->get_user();
         $userarea = View::factory('v_userarea')->bind('user', $user);
     } else {
         $userarea = View::factory('v_nologin');
     }
     //Получаем категории можно вызвать в блоках
     $categories = ORM::factory('category');
     $categories = $categories->fulltree()->as_array();
     $left_categories = View::factory('v_categories')->bind('categories', $categories);
     //$this->template->left_categories = View::factory('v_categories')->bind('categories', $categories);
     //вывод поизводителей можно вызвать в блоках или отдельно
     $manufactures = ORM::factory('manufactures')->find_all();
     $manufactures = View::factory('v_manufactures', array('manufactures' => $manufactures));
     $this->template->manufactures = $manufactures;
     //собираем мимни корзину для блоков
     $carts = ORM::factory('product');
     if ($this->p_session != Null) {
         foreach ($this->p_session as $id => $count) {
             $carts->or_where('id', 'IN', array($id));
         }
         $carts = $carts->find_all();
         $this->payment = $carts;
     } else {
         $carts = null;
     }
     //$this->template->minicart = $mini_cart;
     $minicart = View::factory('v_minicart', array('carts' => $carts, 'p_session' => $this->p_session));
     //// конец корзыны
     $products = ORM::factory("product")->limit(10)->find_all()->as_array();
     $products = View::factory('v_lastproducts', array('products' => $products));
     $this->template->block_center = array('products' => $products);
     //Подключение блоков
     $this->template->userarea = $userarea;
     $this->template->search_form = View::factory('v_searchform');
     //	$this->template->block_center = View::factory('v_index');
     $this->template->block_left = array('left_categories' => $left_categories);
     $this->template->block_right = array('minicart' => $minicart, 'manufactures' => $manufactures);
 }
Beispiel #30
0
 public function before()
 {
     parent::before();
     if (Request::active()->controller !== 'Controller_Admin' or !in_array(Request::active()->action, array('login', 'logout'))) {
         if (Auth::check()) {
         } else {
             \Cookie::set('redirect_back_url', \Uri::string(), 60 * 10);
             \Response::redirect('admin/login');
         }
     }
 }