ACC SHELL

Path : /srv/www/vhosts/agroing/web/controllers/
File Upload :
Current File : /srv/www/vhosts/agroing/web/controllers/home.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends MY_Controller {
	 public $data;
	 public $default_view = true;

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

	public function index(){
		die("why so serisous?");
	}

	public function site ($idr) {
		if(empty($idr))$this->uri->redirect();
		$this->sites->get_one($idr);
		if(empty($this->sites)) $this->uri->redirect(404);
		$this->load->model("sites_access_model");
		$this->sites_access_model->write_access($this->sites->id, Tools::ip_check(false));
		$this->data['site'] = $this->sites;
		if($this->sites->has_tag('error_404')) header("HTTP/1.0 404 Not Found"); // 404
	// search redirect
		if(!empty($_POST['q'])){
			$q = str_replace(array("'",'"',"\\","\/"),"",$_POST['q']);
			if($this->sites->new_one()->tag("search")->idr){
				$this->uri->redirect($this->uri->sef_tag("search")."?q=".$q);
			}
		}
		if($this->default_view){
			$this->load->view('_default/layout',$this->data);
		}
	}
	
	/***  how to get to this methods is in config/router  ***/
	
	public function routed_styles_css(){
		header("Content-type: text/css");
		echo $this->sites->tag("css")->part("text");
	}

	public function robots(){
		header("Content-type: text/plain");
		echo "Sitemap: http://".$_SERVER["HTTP_HOST"]."/sitemap.xml\nUser-agent: *\nDisallow:";
	}

	/**
	 * vraci sitemap webu dle specifikace
	 * http://cs.wikipedia.org/wiki/Sitemap
	 */
	public function sitemap_xml(){
		header ("Content-Type:text/xml");
//		header("Content-type: text/plain");
		echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
		$this->sites->idr = Settings_model::$root_relation['id'];
		foreach($this->sites->set_zero_sitemap(false)->tree() as $s){
			echo "<url><loc>http://".$_SERVER['SERVER_NAME'].$this->uri->sef_site($s->idr)."</loc></url>\n";
		}
		echo '</urlset>';
	}

}



ACC SHELL 2018