Exemplo n.º 1
0
 /**
  *	Execute common functionality
  *
  *	@access	public
  *	@param	none
  *	@return void
  *
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('api');
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Sanity checks; driver specific
     switch (APP_CDN_DRIVER) {
         case 'AWS_LOCAL':
             //	TODO: Sanity checks, if any.
             break;
         case 'LOCAL':
             //	TODO: Sanity checks, if any.
             break;
     }
     //	TODO: Sanity checks: common
     // --------------------------------------------------------------------------
     //	Define variables
     $this->_cdn_root = NAILS_PATH . 'modules/cdn/';
     $this->_cachedir = DEPLOY_CACHE_DIR;
     $this->_cache_headers_set = FALSE;
     $this->_cache_headers_max_age = APP_CDN_CACHE_MAX_AGE;
     $this->_cache_headers_last_modified = '';
     $this->_cache_headers_expires = '';
     $this->_cache_headers_file = '';
     $this->_cache_headers_hit = 'MISS';
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('cdn');
     // --------------------------------------------------------------------------
     //	Load CDN library
     $this->load->library('cdn');
 }
Exemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Load config
     $this->config->load('auth');
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('auth');
     // --------------------------------------------------------------------------
     //	Load model
     $this->load->model('auth_model');
 }
Exemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Check this module is enabled in settings
     if (!module_is_enabled('cms')) {
         //	Cancel execution, module isn't enabled
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('cms');
 }
Exemplo n.º 5
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Enabled?
     if (!module_is_enabled('sitemap')) {
         show_404();
     }
     // --------------------------------------------------------------------------
     $this->load->model('sitemap/sitemap_model');
     $this->_filename_json = $this->sitemap_model->get_filename_json();
     $this->_filename_xml = $this->sitemap_model->get_filename_xml();
 }
Exemplo n.º 6
0
 /**
  * Constructor
  *
  * @access	public
  * @param	none
  * @return	void
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('cron');
     // --------------------------------------------------------------------------
     //	Command line only
     if (ENVIRONMENT == 'production' && !$this->input->is_cli_request()) {
         header($this->input->server('SERVER_PROTOCOL') . ' 401 Unauthorized');
         die('<h1>' . lang('unauthorised') . '</h1>');
     }
     // --------------------------------------------------------------------------
     //	E_ALL E_STRICT error reporting, for as error free code as possible
     error_reporting(E_ALL | E_STRICT);
 }
Exemplo n.º 7
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Check this module is enabled in settings
     if (!module_is_enabled('shop')) {
         //	Cancel execution, module isn't enabled
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('shop');
     // --------------------------------------------------------------------------
     //	Load the models
     $this->load->model('shop/shop_model');
     $this->load->model('shop/shop_basket_model');
     $this->load->model('shop/shop_brand_model');
     $this->load->model('shop/shop_category_model');
     $this->load->model('shop/shop_collection_model');
     $this->load->model('shop/shop_currency_model');
     $this->load->model('shop/shop_order_model');
     $this->load->model('shop/shop_product_model');
     $this->load->model('shop/shop_product_type_model');
     $this->load->model('shop/shop_range_model');
     $this->load->model('shop/shop_shipping_model');
     $this->load->model('shop/shop_sale_model');
     $this->load->model('shop/shop_tag_model');
     $this->load->model('shop/shop_voucher_model');
     $this->load->model('shop/shop_skin_model');
     // --------------------------------------------------------------------------
     //	Load up the shop's skin
     $_skin = app_setting('skin', 'shop') ? app_setting('skin', 'shop') : 'getting-started';
     $this->_skin = $this->shop_skin_model->get($_skin);
     if (!$this->_skin) {
         show_fatal_error('Failed to load shop skin "' . $_skin . '"', 'Shop skin "' . $_skin . '" failed to load at ' . APP_NAME . ', the following reason was given: ' . $this->shop_skin_model->last_error());
     }
     // --------------------------------------------------------------------------
     //	Pass to $this->data, for the views
     $this->data['skin'] = $this->_skin;
     // --------------------------------------------------------------------------
     //	Shop's name
     $this->_shop_name = app_setting('name', 'shop') ? app_setting('name', 'shop') : 'Shop';
 }
Exemplo n.º 8
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	Check this module is enabled in settings
     if (!module_is_enabled('blog')) {
         //	Cancel execution, module isn't enabled
         show_404();
     }
     // --------------------------------------------------------------------------
     //	Load language file
     $this->lang->load('blog/blog');
     // --------------------------------------------------------------------------
     //	Load the models
     $this->load->model('blog/blog_model');
     $this->load->model('blog/blog_post_model');
     $this->load->model('blog/blog_widget_model');
     $this->load->model('blog/blog_skin_model');
     // --------------------------------------------------------------------------
     if (app_setting('categories_enabled', 'blog')) {
         $this->load->model('blog/blog_category_model');
     }
     if (app_setting('tags_enabled', 'blog')) {
         $this->load->model('blog/blog_tag_model');
     }
     // --------------------------------------------------------------------------
     //	Load up the blog's skin
     $_skin = app_setting('skin', 'blog') ? app_setting('skin', 'blog') : 'getting-started';
     $this->_skin = $this->blog_skin_model->get($_skin);
     if (!$this->_skin) {
         show_fatal_error('Failed to load blog skin "' . $_skin . '"', 'Blog skin "' . $_skin . '" failed to load at ' . APP_NAME . ', the following reason was given: ' . $this->blog_skin_model->last_error());
     }
     // --------------------------------------------------------------------------
     //	Pass to $this->data, for the views
     $this->data['skin'] = $this->_skin;
     // --------------------------------------------------------------------------
     //	Blog name
     $this->_blog_name = app_setting('name', 'blog') ? app_setting('name', 'blog') : 'Blog';
 }
Exemplo n.º 9
0
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     $this->_cache_dir = DEPLOY_CACHE_DIR;
 }
Exemplo n.º 10
0
 /**
  * Common constructor for all admin pages
  *
  * @access	public
  * @return	void
  *
  **/
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------------------------------------
     //	IP whitelist?
     $_ip_whitelist = json_decode(APP_ADMIN_IP_WHITELIST);
     if ($_ip_whitelist) {
         if (!ip_in_range($this->input->ip_address(), $_ip_whitelist)) {
             show_404();
         }
     }
     // --------------------------------------------------------------------------
     //	Admins only please
     if (!$this->user_model->is_admin()) {
         unauthorised();
     }
     // --------------------------------------------------------------------------
     //	Load up the generic admin langfile
     $this->lang->load('admin_generic');
     // --------------------------------------------------------------------------
     //	Check that admin is running on the SECURE_BASE_URL url
     if (APP_SSL_ROUTING) {
         $_host1 = $this->input->server('HTTP_HOST');
         $_host2 = parse_url(SECURE_BASE_URL);
         if (!empty($_host2['host']) && $_host2['host'] != $_host1) {
             //	Not on the secure URL, redirect with message
             $_redirect = $this->input->server('REQUEST_URI');
             if ($_redirect) {
                 $this->session->set_flashdata('message', lang('admin_not_secure'));
                 redirect($_redirect);
             }
         }
     }
     // --------------------------------------------------------------------------
     //	Load admin helper and config
     $this->load->model('admin_model');
     $this->config->load('admin');
     if (file_exists(FCPATH . 'application/config/admin.php')) {
         $this->config->load('admin');
     }
     // --------------------------------------------------------------------------
     //	Load up the modules which have been enabled for this installation and the
     //	user has permission to see.
     $this->_loaded_modules = array();
     $this->data['loaded_modules'] =& $this->_loaded_modules;
     $this->_load_active_modules();
     // --------------------------------------------------------------------------
     //	Check the user has permission to view this module (skip the dashboard
     //	we need to show them _something_)
     $_active_module = $this->uri->segment(2);
     $_active_method = $this->uri->segment(3, 'index');
     $_acl = active_user('acl');
     if (!$this->user_model->is_superuser() && !isset($this->_loaded_modules[$_active_module])) {
         //	If this is the dashboard, we should see if the user has permission to
         //	access any other modules before we 404 their ass.
         if ($_active_module == 'dashboard' || $_active_module == '') {
             //	Look at the user's ACL
             if (isset($_acl['admin'])) {
                 //	If they have other modules defined, loop them until one is found
                 //	which appears in the loaded modules list. If this doesn't happen
                 //	then they'll fall back to the 'no loaded modules' page.
                 foreach ($_acl['admin'] as $module => $methods) {
                     if (isset($this->_loaded_modules[$module])) {
                         redirect('admin/' . $module);
                         break;
                     }
                 }
             }
         } else {
             // Oh well, it's not, 404 bitches!
             show_404();
         }
     } elseif (!$this->user_model->is_superuser()) {
         //	Module is OK, check to make sure they can access this method
         if (!isset($_acl['admin'][$_active_module][$_active_method])) {
             unauthorised();
         }
     }
     // --------------------------------------------------------------------------
     //	Load libraries and helpers
     $this->load->library('cdn');
     $this->load->helper('admin');
     // --------------------------------------------------------------------------
     //	Add the current module to the $page variable (for convenience)
     $this->data['page'] = new stdClass();
     if (isset($this->_loaded_modules[$this->uri->segment(2)])) {
         $this->data['page']->module = $this->_loaded_modules[$this->uri->segment(2)];
     } else {
         $this->data['page']->moduled = FALSE;
     }
     // --------------------------------------------------------------------------
     //	Unload any previously loaded assets, admin handles it's own assets
     $this->asset->clear_all();
     //	CSS
     $this->asset->load('fancybox/source/jquery.fancybox.css', 'BOWER');
     $this->asset->load('jquery-toggles/toggles.css', 'BOWER');
     $this->asset->load('jquery-toggles/themes/toggles-modern.css', 'BOWER');
     $this->asset->load('tipsy/src/stylesheets/tipsy.css', 'BOWER');
     $this->asset->load('ionicons/css/ionicons.min.css', 'BOWER');
     $this->asset->load('nails.admin.css', TRUE);
     //	JS
     $this->asset->load('jquery/dist/jquery.min.js', 'BOWER');
     $this->asset->load('fancybox/source/jquery.fancybox.pack.js', 'BOWER');
     $this->asset->load('jquery-toggles/toggles.min.js', 'BOWER');
     $this->asset->load('tipsy/src/javascripts/jquery.tipsy.js', 'BOWER');
     $this->asset->load('jquery.scrollTo/jquery.scrollTo.min.js', 'BOWER');
     $this->asset->load('jquery-cookie/jquery.cookie.js', 'BOWER');
     $this->asset->load('nails.default.min.js', TRUE);
     $this->asset->load('nails.admin.min.js', TRUE);
     $this->asset->load('nails.forms.min.js', TRUE);
     $this->asset->load('nails.api.min.js', TRUE);
     //	Libraries
     $this->asset->library('jqueryui');
     $this->asset->library('select2');
     $this->asset->library('ckeditor');
     //	Look for any Admin styles provided by the app
     if (file_exists(FCPATH . 'assets/css/admin.css')) {
         $this->asset->load('admin.css');
     }
     //	Inline assets
     $_js = 'var _nails,_nails_admin,_nails_forms;';
     $_js .= '$(function(){';
     $_js .= 'if ( typeof( NAILS_JS ) === \'function\' ){';
     $_js .= '_nails = new NAILS_JS();';
     $_js .= '_nails.init();';
     $_js .= '}';
     $_js .= 'if ( typeof( NAILS_Admin ) === \'function\' ){';
     $_js .= '_nails_admin = new NAILS_Admin();';
     $_js .= '_nails_admin.init();';
     $_js .= '}';
     $_js .= 'if ( typeof( NAILS_Forms ) === \'function\' ){';
     $_js .= '_nails_forms = new NAILS_Forms();';
     $_js .= '}';
     $_js .= 'if ( typeof( NAILS_API ) === \'function\' ){';
     $_js .= '_nails_api = new NAILS_API();';
     $_js .= '}';
     $_js .= '});';
     $this->asset->inline('<script>' . $_js . '</script>');
     // --------------------------------------------------------------------------
     //	Initialise the admin change log model
     $this->load->model('admin_changelog_model');
 }