<?php
// namespace helpers;
// use core\language as Language;

/*
* URL Class
*/
class Url{

	/**
	* Redirect to chosen URL
	* @param string $url the URL to redirect to
	* @param boolean $fullpath if true use only url in redirect instead of using DIR
	*/
	public static function redirect($url=null,$fullpath=false){
		$lang_prefix = Language::get();
		if($fullpath == false){
			header('Location: '.DIR.$lang_prefix."\\".$url);
			exit;
		}else{
			header('Location: '.$url.$lang_prefix);
			exit;
		}
	}

	/**
	* Created the absolute address to the DEFAULT template folder
	* @return string URL to DEFAULT template folder
	*/
	public static function get_template_path(){
		return DIR.'templates/'.Session::get('template').'/';
	}

	/**
	* Created the absolute address to the template folder
	* @return string URL to template folder
	*/
	public static function get_tmpl_cust(){
		return DIR.'templates/';
	}

	/**
	* Go to the previous url.
	*/
	public static function previous(){
		header('Location: '. $_SERVER['HTTP_REFERER']);
		exit;
	}
}