示例#1
1
文件: website.php 项目: jokke/ORL
 public function __construct()
 {
     parent::__construct();
     $this->template->links = array('Home' => 'home', 'Browse' => 'folders', 'Search' => 'search', 'About' => 'about', 'Contact' => 'contact');
     $this->db = Database::instance();
     // makes database object available to all controllers
     $this->session = Session::instance();
     $authentic = new Auth();
     if ($authentic->logged_in() || $authentic->auto_login()) {
         $this->user = $authentic->get_user();
     } else {
         $this->session->set("requested_url", "/" . url::current());
         // this will redirect from the login page back to this page
         url::redirect('/auth/login');
     }
     // if ($authentic->auto_login()) {
     //     $this->user = $authentic->get_user();
     //     url::redirect('/document/view/1');
     // }
     // if (!$authentic->logged_in()) {
     //
     //     $this->session->set("requested_url","/".url::current()); // this will redirect from the login page back to this page
     //     url::redirect('/auth/login');
     // } else {
     //     $this->user = $authentic->get_user(); //now you have access to user information stored in the database
     // }
 }
 public function __construct()
 {
     parent::__construct();
     $active = $this->uri->segment(2) ? $this->uri->segment(2) : 'core';
     // Add the menu to the template
     $this->template->menu = new View('kodoc/menu', array('active' => $active));
 }
示例#3
0
 public function __construct()
 {
     parent::__construct();
     $this->administrator_model = new Administrator_Model();
     $this->search = array('display' => '');
     $this->_get_session_msg();
 }
示例#4
0
    public function __construct()
    {
        parent::__construct();
		
        $this->session = new Session();
		// $profiler = new Profiler;
    }
示例#5
0
    public function __construct()
    {
		parent::__construct();
		
		// Set Table Prefix
		$this->table_prefix = Kohana::config('database.default.table_prefix');
		
		// Load Header & Footer
        $this->template->header  = new View('keitai/header');
        $this->template->footer  = new View('keitai/footer');

		$this->template->header->site_name = Kohana::config('settings.site_name');
		$this->template->header->site_tagline = Kohana::config('settings.site_tagline');

		plugin::add_javascript('keitai/views/js/jquery');
		plugin::add_javascript('keitai/views/js/jquery.treeview');
		plugin::add_javascript('keitai/views/js/expand');
		plugin::add_stylesheet('keitai/views/css/styles');
		plugin::add_stylesheet('keitai/views/css/jquery.treeview');
		
		$this->template->header->show_map = FALSE;
		$this->template->header->js = "";
		$this->template->header->breadcrumbs = "";
		
		// Google Analytics
		$google_analytics = Kohana::config('settings.google_analytics');
		$this->template->footer->google_analytics = $this->_google_analytics($google_analytics);

		$this->template->header->latlong = (isset($_GET['latlong'])) ? $_GET['latlong'] : "";
		$this->template->footer->latlong = (isset($_GET['latlong'])) ? $_GET['latlong'] : "";
	}
示例#6
0
文件: courses.php 项目: vobinh/PHP
 public function __construct()
 {
     parent::__construct();
     $this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/home');
     // Init session
     $this->_get_session_template();
     $this->questionnaires_model = new Questionnaires_Model();
     $this->answer_model = new Answer_Model();
     $this->category_model = new Category_Model();
     $this->test_model = new Test_Model();
     $this->testing_model = new Testing_Model();
     $this->payment_model = new Payment_Model();
     $this->testingdetail_model = new Testingdetail_Model();
     $this->testing_category_model = new Testingcategory_Model();
     $this->promotion_model = new Promotion_Model();
     $this->courses_model = new Courses_Model();
     $this->study_model = new Study_Model();
     $this->lesson_model = new Lesson_Model();
     $this->lesson_annotation_model = new Lesson_annotation_Model();
     $this->member_certificate_model = new Member_certificate_Model();
     $this->certificate_model = new Certificate_Model();
     $this->data_template_model = new Data_template_Model();
     if ($this->sess_cus == "") {
         url::redirect(url::base());
         die;
     }
 }
示例#7
0
文件: article.php 项目: vobinh/PHP
 public function __construct()
 {
     parent::__construct();
     $this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/index');
     $this->articles_model = new Articles_Model();
     //View
 }
示例#8
0
 /**
  * Overriding the render method gives us a single point to check that this page
  * is authorised.
  */
 public function _render()
 {
     if (!$this->page_authorised()) {
         $this->access_denied('page');
     }
     parent::_render();
 }
示例#9
0
 public function __construct()
 {
     parent::__construct();
     $this->auth = Auth::instance();
     $this->template->app_name = Kohana::config('bc.bc');
     $this->template->page_title = __('Login');
 }
示例#10
0
 public function __construct()
 {
     parent::__construct();
     // Set Table Prefix
     $this->table_prefix = Kohana::config('database.default.table_prefix');
     set_time_limit(60);
 }
示例#11
0
 function __construct()
 {
     parent::__construct();
     $session = Session::instance();
     // Load Header & Footer
     $this->template->header = new View('mhi/mhi_header');
     $this->template->footer = new View('mhi/mhi_footer');
     $this->template->footer->ushahidi_stats = Stats_Model::get_javascript();
     $this->template->header->site_name = Kohana::config('settings.site_name');
     // Initialize JS variables. js_files is an array of ex: html::script('media/js/jquery.validate.min');
     // Add the sign in box javascript
     $this->template->header->js = new View('mhi/mhi_js_signin');
     $this->template->header->js_files = array();
     // Google Analytics
     $google_analytics = Kohana::config('settings.google_analytics');
     $this->template->footer->google_analytics = $this->_google_analytics($google_analytics);
     // If we aren't at the top level MHI site or MHI isn't enabled, don't allow access to any of this jazz
     /*
     if (Kohana::config('config.enable_mhi') == FALSE OR Kohana::config('settings.subdomain') != '')
     	throw new Kohana_User_Exception('MHI Access Error', "MHI disabled for this site.");
     */
     // Login Form variables
     $this->template->header->errors = '';
     $this->template->header->form = array('username' => '');
     $this->template->header->form_error = '';
     $this->template->header->mhi_user_id = $session->get('mhi_user_id');
 }
示例#12
0
 public function __construct()
 {
     parent::__construct();
     // This must be included
     $this->search = array('keyword' => '');
     $this->_get_submit();
 }
示例#13
0
 function __construct()
 {
     parent::__construct();
     // Load site wide dependencies
     $this->database = new Database();
     $this->profiler = new Profiler();
 }
示例#14
0
 public function __construct()
 {
     parent::__construct();
     // Inicio de Session
     $this->session = Session::instance();
     // Si la variable cat no está definida, definirla
     if (!isset($_SESSION['cat'])) {
         $_SESSION['cat'] = 0;
     }
     if (!isset($_SESSION['localidad'])) {
         $_SESSION['localidad'] = 0;
     }
     $this->template->links = array('Acerca de IMGListados' => 'about', 'Datos' => 'datos', 'Rubros' => 'rubros', 'Exportar Listados' => 'listados');
     $this->template->footer = 'Copyright ' . $this->thiYear($this->y) . ' - ' . html::anchor('http://www.imgdigital.com.ar', 'IMG Digital', array('target' => '_blank')) . '- ' . html::anchor('http://www.imgdigital.com.ar/imglistados', 'IMGListados', array('target' => '_blank'));
     $this->template->login = new View('login');
     // Da acceso a todos los controladores la base de datos
     $this->db = Database::instance();
     //Listado de Categorías
     $this->categorias = ORM::factory('categoria')->select_list();
     //$this->template->cats =  $this->categorias;
     //Listado de Localidades
     $this->localidades = ORM::factory('localidad')->select_list();
     //$this->template->localidades = $this->localidades;
     //$this->profiler = new Profiler;
 }
示例#15
0
文件: login.php 项目: vobinh/PHP
 public function __construct()
 {
     parent::__construct();
     $this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/index');
     $this->_get_session_template();
     $this->login_model = new Login_Model();
 }
示例#16
0
文件: contact.php 项目: vobinh/PHP
 public function __construct()
 {
     parent::__construct();
     $this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/index');
     // Init session
     $this->_get_session();
 }
示例#17
0
 public function __construct()
 {
     parent::__construct();
     //$this->session = Session::instance();
     //$this->auth = new Auth;
     // Check to see if the request is a HXR call
     if (request::is_ajax()) {
         // Send the 403 header
         header('HTTP/1.1 403 Forbidden');
         //$t = new View('blank');
         return;
     }
     /*
     		if (Kohana::config_load('cw', true))
     			$this->cfg  = Kohana::config('cw');
     */
     /*		if (IN_PRODUCTION === FALSE)
     		{
     			$this->profiler = new Profiler;
     		}*/
     $t =& $this->template;
     $t->header = new View('components/header');
     $t->footer = new View('components/footer');
     //$this->db = Database::instance();
 }
示例#18
0
 public function __construct()
 {
     parent::__construct();
     $this->template->title = 'Kohana Forum';
     # configure filters.
     $url_array = $this->uri->segment_array();
     $this->action = empty($url_array['2']) ? 'category' : $url_array['2'];
     $this->filter = isset($url_array['3']) ? $url_array['3'] : '';
     $this->filter2 = isset($url_array['4']) ? $url_array['4'] : '';
     # configure sorters.
     $this->sort = isset($_GET['sort']) ? $_GET['sort'] : 'newest';
     $this->sort_by = (empty($_GET['sort']) or 'votes' == $_GET['sort']) ? 'vote_count' : 'created';
     $this->order = (empty($_GET['sort']) or 'oldest' != $_GET['sort']) ? 'desc' : 'asc';
     /*
      * Notes:
      * We make everything run through _index or _ajax
      * because it's easier to delegate modular functionality
      * based on whether a request is ajax or not.
      * mapping publically (i.e. site.com/controller/method)
      * would mean we'd have to have ajax/non-ajax logic within each method
      * which i think is harder to maintain and read.
      */
     # handle ajax requests of course =0
     if (request::is_ajax()) {
         die($this->_ajax());
     }
     # handle non-ajax.
     die($this->_index());
 }
示例#19
0
文件: admin_test.php 项目: vobinh/PHP
 public function __construct()
 {
     $this->test_model = new Test_Model();
     $this->payment_model = new Payment_Model();
     parent::__construct();
     $this->_get_session_msg();
 }
示例#20
0
 public function before()
 {
     parent::before();
     $param = $this->request->param('forum');
     $forum = Model_Forum::factory($param)->load();
     try {
         if (!$forum->loaded()) {
             throw new Kohana_Exception('Forumet :forum existerar inte.', array(':forum' => $param));
         }
         $roles = $forum->roles->as_array(NULL, 'name');
         if (!$this->auth->has_roles($roles)) {
             throw new Kohana_Exception('Du måste vara inloggad för att ha tillgång till forum/:forum.', array(':forum' => $forum->name));
         }
     } catch (Kohana_Exception $e) {
         $this->message_add($e->getMessage(), 'error');
         $this->request->redirect('forum');
     }
     // Save forum for later use
     $this->_forum = $forum;
     // REST-thingy
     switch (Request::$method) {
         case 'POST':
             $this->request->action = 'create';
             break;
         case 'DELETE':
             $this->request->action = 'delete';
             break;
     }
 }
示例#21
0
 /**
  * Overload to reroute to view-action if a gallery is defined
  */
 public function before()
 {
     parent::before();
     if ($galleri = $this->request->param('galleri')) {
         $this->request->action = 'view';
     }
 }
示例#22
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load database
     $this->db = new Database();
     $this->auth = new Auth();
     $this->session = Session::instance();
     $this->auth->auto_login();
     if (!$this->auth->logged_in('admin') && !$this->auth->logged_in('login')) {
         url::redirect('login');
     }
     //fetch latest version of ushahidi
     $version_number = $this->_fetch_core_version();
     $this->template->version = $this->_find_core_version($version_number);
     // Get Session Information
     $user = new User_Model($_SESSION['auth_user']->id);
     $this->template->admin_name = $user->name;
     // Retrieve Default Settings
     $this->template->site_name = Kohana::config('settings.site_name');
     $this->template->mapstraction = Kohana::config('settings.mapstraction');
     $this->template->api_url = Kohana::config('settings.api_url');
     // Javascript Header
     $this->template->map_enabled = FALSE;
     $this->template->flot_enabled = FALSE;
     $this->template->protochart_enabled = FALSE;
     $this->template->colorpicker_enabled = FALSE;
     $this->template->editor_enabled = FALSE;
     $this->template->js = '';
     // Load profiler
     // $profiler = new Profiler;
 }
示例#23
0
 /**
  * Methode : page envoyer le mailing
  */
 public function envoyer()
 {
     if ($_POST) {
         $texte = $this->input->post('texte');
         $format = $this->input->post('format');
         $sujet = $this->input->post('sujet');
         $format = $format == 1 ? TRUE : FALSE;
         $users = $this->user->select();
         $nbr_envois = 0;
         foreach ($users as $user) {
             if ($format) {
                 $view = new View('mailing/template');
                 $view->name = ucfirst(mb_strtolower($user->username));
                 $view->content = $texte;
                 $message = $view->render();
             } else {
                 $message = $texte;
             }
             if (email::send($user->email, Kohana::config('email.from'), $sujet, $message, $format)) {
                 $nbr_envois++;
             }
         }
         return url::redirect('mailing?msg=' . urlencode(Kohana::lang('mailing.send_valide', number_format($nbr_envois))));
     } else {
         return parent::redirect_erreur('mailing');
     }
 }
示例#24
0
 public function __construct()
 {
     socialFeed::get_favicon_from('http://www.delicious.com/sydlawrence');
     $this->session = Session::instance();
     $this->db = new Database();
     parent::__construct();
     $_POST = $this->input->xss_clean($_POST);
     if ($this->input->post('attempt_login')) {
         $return = login::attempt_login();
         if (isset($return->id) && $return->id > 0) {
             $this->user = $return;
         } else {
             $this->__set_options(array('error' => $return));
         }
         if (isset($_GET['redirect'])) {
             url::redirect(urldecode($_GET['redirect']));
         }
     }
     $this->user = login::check_login();
     if ($this->input->get('logout')) {
         Auth::instance()->logout(TRUE);
         url::redirect();
     }
     $this->page = Page_Model::get_by_url();
     $this->feed = Feed_Model::get_by_url();
     $this->feedpost = Feedpost_Model::get_by_url();
     $this->__setup();
     $this->header = new View('includes/header');
     $this->footer = new View('includes/footer');
     $this->__binds();
 }
示例#25
0
文件: forgotpass.php 项目: vobinh/PHP
 public function __construct()
 {
     parent::__construct();
     $this->template = new View('templates/' . $this->site['config']['TEMPLATE'] . '/client/user');
     $this->_get_session_template();
     $this->Data_template_Model = new Data_template_Model();
 }
示例#26
0
 public function before()
 {
     // For nagivation active link show
     $path = $this->request->param('path');
     $this->request->controller = substr($path, strpos($path, '/'));
     parent::before();
 }
示例#27
0
 public function __construct()
 {
     parent::__construct();
     if ($this->is_ajax_request() == TRUE) {
         $this->template = new View('layout/default_json');
     }
 }
示例#28
0
 public function __construct()
 {
     $this->testingdetail_model = new Testingdetail_Model();
     $this->questionnaires_model = new Questionnaires_Model();
     $this->answer_model = new Answer_Model();
     parent::__construct();
 }
示例#29
0
 public function __construct()
 {
     parent::__construct();
     // Load cache
     $this->cache = new Cache();
     // Load session
     $this->session = new Session();
     // Load language views
     if (isset($_GET['lang'])) {
         $this->view_lang .= "-" . substr($_GET['lang'], 0, 2);
     }
     // Load Header & Footer
     $this->template->header = new View($this->view_lang . '/header');
     $this->template->footer = new View($this->view_lang . '/footer');
     // Retrieve Default Settings
     $site_name = Kohana::config('settings.site_name');
     // Prevent Site Name From Breaking up if its too long
     // by reducing the size of the font
     if (strlen($site_name) > 20) {
         $site_name_style = " style=\"font-size:21px;\"";
     } else {
         $site_name_style = "";
     }
     $this->template->header->site_name = $site_name;
     $this->template->header->site_name_style = $site_name_style;
     $this->template->header->site_tagline = Kohana::config('settings.site_tagline');
     $this->template->header->api_url = Kohana::config('settings.api_url');
     // Display News Feed?
     $this->template->header->allow_feed = Kohana::config('settings.allow_feed');
     // Javascript Header
     $this->template->header->map_enabled = FALSE;
     $this->template->header->validator_enabled = FALSE;
     $this->template->header->datepicker_enabled = FALSE;
     $this->template->header->photoslider_enabled = FALSE;
     $this->template->header->videoslider_enabled = FALSE;
     $this->template->header->main_page = FALSE;
     $this->template->header->js = '';
     $this->template->header->this_page = "";
     // Google Analytics
     $google_analytics = Kohana::config('settings.google_analytics');
     $this->template->footer->google_analytics = $this->_google_analytics($google_analytics);
     // Create Language Session
     if (isset($_GET['lang']) && !empty($_GET['lang'])) {
         $_SESSION['lang'] = $_GET['lang'];
     }
     if (isset($_SESSION['lang']) && !empty($_SESSION['lang'])) {
         Kohana::config_set('locale.language', $_SESSION['lang']);
     }
     $this->template->header->site_language = Kohana::config('locale.language');
     //Set up tracking gif
     if ($_SERVER['SERVER_NAME'] != 'localhost' && $_SERVER['SERVER_NAME'] != '127.0.0.1') {
         $track_url = $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
     } else {
         $track_url = 'null';
     }
     $this->template->footer->tracker_url = 'http://tracker.ushahidi.com/track.php?url=' . urlencode($track_url) . '&lang=' . $this->template->header->site_language . '';
     // Load profiler
     // $profiler = new Profiler;
 }
示例#30
0
 public function __construct()
 {
     parent::__construct();
     $this->data = new Data_Model();
     $this->config = new Config_Model();
     $this->rrdtool = new Rrdtool_Model();
     $this->config->read_config();
     Kohana::config_set('locale.language', $this->config->conf['lang']);
     Kohana::config_set('core.site_domain', $this->config->conf['base_url']);
     // Check for mod_rewrite
     $this->check_mod_rewrite();
     $this->start = $this->input->get('start', FALSE);
     $this->end = $this->input->get('end', FALSE);
     $this->theme = $this->input->get('theme', FALSE);
     $this->view = "";
     $this->controller = Router::$controller;
     if (isset($_GET['view']) && $_GET['view'] != "") {
         $this->view = pnp::clean($_GET['view']);
     }
     $this->data->getTimeRange($this->start, $this->end, $this->view);
     if (Router::$controller != "image" && Router::$controller != "image_special") {
         $this->session = Session::instance();
         if ($this->theme) {
             $this->session->set('theme', $this->theme);
         }
         # New session
         if ($this->session->get("theme", "new") == "new") {
             $this->theme = $this->config->conf['ui-theme'];
             $this->session->set("theme", $this->theme);
         } else {
             $this->theme = $this->session->get('theme');
         }
         if ($this->start && $this->end) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("start", $this->start);
                 $this->session->set("end", $this->end);
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
         if ($this->start && !$this->end) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("start", $this->start);
                 $this->session->set("end", "");
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
         if ($this->end && !$this->start) {
             if ($this->session->get('timerange-reset', 0) == 0) {
                 $this->session->set("end", $this->end);
                 $this->session->set("start", "");
             } else {
                 $this->session->set('timerange-reset', 0);
             }
         }
     }
     $this->template = $this->add_view('template');
 }