ACC SHELL

Path : /srv/www/vhosts/agroing/web/core/
File Upload :
Current File : /srv/www/vhosts/agroing/web/core/MY_Controller.php

<?php
/**
 * Glogal controller
 */
class MY_Controller extends CI_Controller {
	public $sites;
	public $settings;
	public $user;
	public $base;
	public $data;

	public function __construct(){
		parent::__construct();

		// My autoloader - replace default CI autoloading models because of Netbeans showing documentations
		require_once(BASEPATH."/core/Model.php");
		require_once("models/base_model.php");
		require_once("models/relations_model.php");
		require_once("models/sites_model.php");
		require_once("models/settings_model.php");
		require_once("models/users_model.php");
		require_once("models/files_model.php");
		require_once("models/export_model.php");

		// pokud je zavolan install tak nasledujici se nesmi spustit
		if(!_INSTALL){
			$this->settings = new Settings_model();
			$this->sites = new Sites_model();
			$this->users = new Users_model();
			$this->base = new Base_model();   // for operations without special model
			$this->export = new Export_model();

			$this->data['domain'] = Settings_model::$domain;
			$this->data['root_idr'] = $this->data['domain'];
			$this->data['settings'] = $this->settings->get_all();
			$this->data['controller'] = $this->uri->rsegment(1);
			$this->data['action'] = $this->uri->rsegment(2);
			$this->data['uri_array'] = $this->uri->segment_array();
		}

		// set static paths of libraries
		Form::$img_path = "/views/_default/www/js/form/img/";
		Form::$img_app_path = "./views/_default/www/js/form/img/";
		Form::$ajax_path = "/ajax/form";
		Form::$log_tool = Tools::get_instance();
		Form::$ajax = true;

		Files_model::$files_folder = "./w/" . $this->data['settings']['name'] . "/files/";
		Image::$img_prefix = "/w/" . $this->data['settings']['name'] . "/files/";
		Image::$cache_src = "/w/" . $this->data['settings']['name'] . "/cache/";

		$this->data['img'] = new Image(); // calling imgs from $img in every view

		/**
		* takes every adress parameter with ":" to _GET variable
	f	* ex:  /var:value/  ->  $_GET['var'] == value
		*/
		if(!empty($this->data['uri_array'])){
			foreach($this->data['uri_array'] as $d){
				if(strpos($d,":")!==false){
					$e = explode(":",$d);
					$_GET[$e[0]] = $e[1];
				}
			}
		}

		if(isset($_GET['error']) && $_GET['error']==404){
			header("HTTP/1.0 404 Not Found");
			Tools::flash("404 - Tato stránka bohužel neexistuje. Byli jste přesměrováni na hlavní stranu","warn");
			$this->uri->redirect(); // redirect to home
		}

		if(!_INSTALL){
			$this->data['view_content'] = ""; // alternative view
			$this->data['view_render'] = ""; // alternative path to view
			$this->data['default_path'] = "/views/_default/www/";
			$this->data['path'] = "/views/".$this->data['settings']['name']."/www/";
			$this->data['files_path'] = "/w/".$this->data['settings']['name']."/files/";
		}

		$this->uri->save_history();

		$this->data['user'] = Ses::user_array();

		// profiler exceptions
		$profiler_exceptions=array(
				'sitemap.xml',
				'robots.txt',
		);
		if(!PRODUCTION && ENABLE_PROFILER 
				&& (!empty($this->data['uri_array'][1]) && !in_array($this->data['uri_array'][1], $profiler_exceptions))){
			$this->output->enable_profiler();
		}
	}
}
?>

ACC SHELL 2018