Initial Commit

This commit is contained in:
2013-02-08 20:18:32 +00:00
commit eaaf97ef7e
61 changed files with 3375 additions and 0 deletions

155
Classes/HtRule/Form.php Normal file
View File

@@ -0,0 +1,155 @@
<?php
class HtRule_Form
{
private $rule;
private $index;
public function __construct(HtRule $rule)
{
$this->rule = $rule;
$rules = new HtRule_List();
$this->index = array_search($rule, $rules->GetRules());
}
function Validate($values, &$error)
{
$params = $this->rule->GetParams();
foreach($params as $p)
{
/* @var $p HtRule_Param */
$name = $p->Name();
$value = get_request($name);
if ($value === False && $p->Type() != HtRule_Param::TYPE_BOOLEAN)
{
$error = "Missing value for ".$p->Title();
return False;
}
switch($p->Type())
{
case HtRule_Param::TYPE_STRING:
break;
case HtRule_Param::TYPE_TEXT:
break;
case HtRule_Param::TYPE_INT:
if (!preg_match('/-?[0-9]+/', $value))
{
$error = "Invalid integer for ".$p->Title();
return False;
}
break;
case HtRule_Param::TYPE_DECIMAL:
if (!is_numeric($value))
{
$error = "Invalid number for ".$p->Title();
return False;
}
break;
}//Switch
}//For each
return True;
}
function Save($values)
{
$params = $this->rule->GetParams();
foreach($params as $p)
{
/* @var $p HtRule_Param */
$name = $p->Name();
$value = get_request($name);
if ($p->Type() == HtRule_Param::TYPE_BOOLEAN)
$p->Value(False);
if ($value === False)
continue;
if ($p->Type() == HtRule_Param::TYPE_BOOLEAN &&
$value == 'yes')
$p->Value(True);
else
$p->Value($value);
}
}
function ShowForm()
{
$params = $this->rule->GetParams();
$formName = 'form_'.get_class($this->rule);
echo '<h3>Edit "'.$this->rule->GetName().'"</h3>';
echo '<div id="rule-edit-form"><form name="'.$formName.'" id="'.$formName.'" method="POST" class="ajaxForm" onsubmit="return rules.completeRuleEdit()">';
echo '<input type="hidden" name="id" value="'.$this->index.'"/>';
foreach($params as $p)
{
/* @var $p HtRule_Param */
$id = 'field-'.$p->Name();
$name = $p->Name();
$class = '';
if ($p->IsMulti())
{
$class .= ' multi';
$name .= '[]';
}
$value = $p->Value();
if ($p->Help() != "")
$help = 'class="tooltip" title="'.$p->Help().'"';
else
$help = '';
switch($p->Type())
{
case HtRule_Param::TYPE_STRING:
$class .= ' type-string';
if ($p->IsMulti())
{
echo '<div class="multi">';
foreach($p->Value() as $value)
{
echo "<label $help>".$p->Title().'</label>';
echo '<input type="text" name="'.$name.'" class="'.$id.' '.$class.'" value="'.$value.'"/>';
}
echo '</div>';
}
else
{
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label>';
echo '<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
}
break;
case HtRule_Param::TYPE_TEXT:
$class .= ' type-text';
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><textarea name="'.$name.'" id="'.$id.'" class="'.$class.'" rows="5">'.$value.'</textarea>';
break;
case HtRule_Param::TYPE_DUALTEXT:
$class .= ' type-dualtext';
echo '<label '.$help.' for="'.$id.'-0">'.$p->Title().'</label>'.
'<div style="clear:both;"></div>'.
'<textarea name="'.$name.'" id="'.$id.'-0" class="'.$class.'" wrap="off">'.((isset($value[0])) ? $value[0] : '').'</textarea>'.
'<textarea name="'.$name.'" id="'.$id.'-1" class="'.$class.'"wrap="off">'.((isset($value[1])) ? $value[1] : '').'</textarea>';
break;
case HtRule_Param::TYPE_INT:
$class .= ' type-int';
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
break;
case HtRule_Param::TYPE_DECIMAL:
$class .= ' type-decimal';
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="'.$value.'"/>';
break;
case HtRule_Param::TYPE_BOOLEAN:
$class .= ' type-checkbox';
$checked = '';
if ($value == True)
$checked = ' checked="checked"';
echo '<label '.$help.' for="'.$id.'">'.$p->Title().'</label><input type="checkbox" name="'.$name.'" id="'.$id.'" class="'.$class.'" value="yes"'.$checked.'/>';
break;
}//Switch
}//Foreach param
echo '<label>&nbsp;</label><input type="submit" class="button" value="Save" id="button-save"/><input type="button" class="button" value="Cancel" onclick="javascript:rules.cancelRuleEdit();" id="button-cancel"/>';
echo '</form></div>';
echo '<div style="clear:both;"></div>';
}//ShowForm
}

47
Classes/HtRule/HtRule.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
abstract class HtRule
{
protected $params = array();
static function GetName()
{
return false;
}
public function __construct()
{
}
function GetParams()
{
return $this->params;
}
function AddParam(HtRule_Param $param)
{
$this->params[$param->Name()] = $param;
}
function ParamValues()
{
$values = array();
foreach($this->params as $param)
{
/* @var $param HtRule_Param */
$values[$param->Name()] = $param->Value();
}
return $values;
}
function RequireRewriteEngine()
{
return false;
}
function __toString()
{
return '';
}
}

188
Classes/HtRule/List.php Normal file
View File

@@ -0,0 +1,188 @@
<?php
class HtRule_List
{
public static function ListRules()
{
$files = glob('Classes/HtRule/Rule/*.php');
$classes = array();
foreach($files as $file)
{
$class = 'HtRule_Rule_'.basename($file,'.php');
include_once($file);
if (class_exists($class) && is_subclass_of($class, 'HtRule'))
{
$name = call_user_func(array($class,'GetName'));
if ($name)
{
$classes[$class] = $name;
}
}
}
asort($classes);
return $classes;
}
private $rules = array();
private $id = false;
private $changed = false;
public function __construct()
{
$this->Load();
}
public function __destruct()
{
$this->Save();
}
public function Load()
{
if (!isset($_SESSION['HtRules']['rules']))
{
$this->AddRule(new HtRule_Rule_EnableRewrite());
}
else
{
$this->rules = $_SESSION['HtRules']['rules'];
if (!is_array($this->rules))
$this->rules = array();
}
if (isset($_SESSION['HtRules']['id']))
$this->id = $_SESSION['HtRules']['id'];
}
public function Save()
{
if ($this->changed)
{
$this->id = false;
}
$_SESSION['HtRules']['rules'] = $this->rules;
$_SESSION['HtRules']['id'] = $this->id;
}
public function MarkChanged()
{
$this->changed = true;
}
public function SetID($id)
{
$this->id = $id;
}
public function GetID()
{
return $this->id;
}
public function SaveToFile()
{
$this->id = uniqid();
$ds = DIRECTORY_SEPARATOR;
$dir = BASE_PATH.$ds.'Saved'.$ds;
$dir .= substr($this->id, 0,2).$ds;
$dir .= substr($this->id, 2,2).$ds;
if (!is_dir($dir))
mkdir($dir, 0755, True);
file_put_contents($dir.$this->id.'.txt', serialize($this));
}
public function AddRule(HtRule $rule, $position=False)
{
if (count($this->rules) > 250)
return;
if ($position !== False)
{
array_splice($this->rules, $position, 0, array($rule));
}
else
$this->rules[] = $rule;
$this->MarkChanged();
return array_search($rule, $this->rules);
}
public function DeleteRule(HtRule $rule)
{
array_splice($this->rules, array_search($rule, $this->rules), 1);
$this->MarkChanged();
}
public function GetRules()
{
return $this->rules;
}
public function GetAtIndex($index)
{
if (isset($this->rules[$index]))
return $this->rules[$index];
return False;
}
public function ClearRules()
{
$this->rules = array();
$this->MarkChanged();
}
public function UpdateOrder(array $newOrder)
{
$newRules = array();
foreach($newOrder as $index)
{
$rule = $this->GetAtIndex($index);
if ($rule)
$newRules[] = $rule;
}
$this->rules = $newRules;
$this->MarkChanged();
}
public function GetHeaderText()
{
$str = '# Created by '.System::Config()->BasePath."\n";
if ($this->GetID())
$str .= '# Edit at '.System::Config()->BasePath.'rules/'.$this->GetID()."/\n";
$str.= "# ". date('D, jS F Y');
foreach($this->rules as $rule)
{
/* @var $rule HtRule */
if ($rule->RequireRewriteEngine())
{
$str .= "\n<IfModule mod_rewrite.c>";
break;
}
}
return $str;
}
public function GetFooterText()
{
$str = '';
foreach($this->rules as $rule)
{
/* @var $rule HtRule */
if ($rule->RequireRewriteEngine())
{
$str .= "</IfModule>";
break;
}
}
return $str;
}
public function __toString()
{
$str = $this->GetHeaderText()."\n\n";
foreach($this->rules as $rule)
{
/* @var $rule HtRule */
$str .= strval($rule);
$str .= "\n\n";
}
$str .= $this->GetFooterText();
return $str;
}
}

60
Classes/HtRule/Param.php Normal file
View File

@@ -0,0 +1,60 @@
<?php
class HtRule_Param
{
const TYPE_STRING = 1;
const TYPE_TEXT = 2;
const TYPE_INT = 3;
const TYPE_DECIMAL = 4;
const TYPE_BOOLEAN = 5;
const TYPE_DUALTEXT = 6;
private $name;
private $title;
private $type;
private $multi;
private $default;
private $help;
private $value;
public function Name() { return $this->name; }
public function Title() { return $this->title; }
public function Type() { return $this->type; }
public function IsMulti() { return $this->multi; }
public function DefaultValue() { return $this->default; }
public function Help() { return $this->help; }
public function __construct($name, $title, $type, $default='', $help='', $multi=false)
{
$this->name = (string)$name;
$this->title = (string)$title;
$this->multi = (bool)$multi;
$this->type = (int)$type;
$this->default = (string)$default;
$this->help = (string)$help;
$this->Value($this->default);
if (!($type == self::TYPE_STRING ||
$type == self::TYPE_TEXT ||
$type == self::TYPE_INT ||
$type == self::TYPE_DECIMAL ||
$type == self::TYPE_BOOLEAN ||
$type == self::TYPE_DUALTEXT))
throw new Exception("Invalid Type");
}
function Value($newValue = null)
{
if ($newValue !== null)
{
if ($this->multi)
$this->value = $newValue;
else
$this->value = (string)$newValue;
}
return $this->value;
}
}

View File

@@ -0,0 +1,26 @@
<?php
class HtRule_Rule_AppendSlash extends HtRule
{
public static function GetName()
{
return 'Append /';
}
public function RequireRewriteEngine()
{
return True;
}
public function __toString()
{
$name = self::GetName();
return <<<EOT
# $name
RewriteCond %{REQUEST_URI} !^.*/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule (.*) $1/ [R=301,L]
EOT;
}
}

View File

@@ -0,0 +1,26 @@
<?php
class HtRule_Rule_Comment extends HtRule
{
public function __construct()
{
$this->AddParam(new HtRule_Param('text', 'Comment', HtRule_Param::TYPE_TEXT, 'A Comment'));
parent::__construct();
}
public static function GetName()
{
return 'Comment';
}
public function RequireRewriteEngine()
{
return False;
}
public function __toString()
{
$text = $this->params['text']->Value();
$text = '# '.str_replace("\n", "\n# ", $text);
return $text;
}
}

View File

@@ -0,0 +1,22 @@
<?php
class HtRule_Rule_Custom extends HtRule
{
public static function GetName()
{
return 'Custom Directives';
}
public function __construct()
{
$this->AddParam(new HtRule_Param('Text', 'Directives', HtRule_Param::TYPE_TEXT));
parent::__construct();
}
public function __toString()
{
$params = $this->ParamValues();
return $params['Text'];
}
}

View File

@@ -0,0 +1,38 @@
<?php
class HtRule_Rule_DenyFiles extends HtRule
{
public static function GetName()
{
return 'Deny access to File Types';
}
public function __construct()
{
$this->AddParam(new HtRule_Param('filetypes', 'File Type', HtRule_Param::TYPE_TEXT, ".sql\n.log", 'Specify the file extensions that you want to deny access to (one per line)', False));
parent::__construct();
}
public function __toString()
{
$params = $this->ParamValues();
$types = $params['filetypes'];
$types = str_replace("\r", "", $types);
$types = explode("\n", $types);
$rules = '';
for($i=0;$i < count($types);$i++)
{
$type = preg_quote($types[$i]);
$rules .= "RewriteCond %{REQUEST_FILENAME} $type$";
if ($i < count($types))
$rules .= ' [OR]';
$rules .= "\n";
}
$rules .= "RewriteRule .* - [F,L]\n";
return $rules;
}
}

View File

@@ -0,0 +1,31 @@
<?php
class HtRule_Rule_EnableRewrite extends HtRule
{
public static function GetName()
{
return 'Enable Rewrite Engine';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('base', 'Rewrite Base', HtRule_Param::TYPE_STRING, '/', 'With leading and trailing slashes'));
parent::__construct();
}
public function __toString()
{
$base = $this->params['base']->Value();
$name = self::GetName();
return <<<EOT
# $name
RewriteEngine On
RewriteBase $base
EOT;
}
}

View File

@@ -0,0 +1,36 @@
<?php
class HtRule_Rule_FromWWW extends HtRule
{
public static function GetName()
{
return 'Redirect from www.';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('domain', 'Domain Name', HtRule_Param::TYPE_STRING, 'domain.com', 'The domain without the www'));
$this->AddParam(new HtRule_Param('https', 'Use Https', HtRule_Param::TYPE_BOOLEAN, False, 'Redirect to https'));
parent::__construct();
}
public function __toString()
{
$domain = $this->params['domain']->Value();
$name = self::GetName();
$proto = 'http';
if ($this->params['https']->Value())
$proto = 'https';
return <<<EOT
# $name
RewriteCond %{HTTP_HOST} ^www.${domain}$
RewriteRule (.*) ${proto}://${domain}/$1 [R=301,L]
EOT;
}
}

View File

@@ -0,0 +1,33 @@
<?php
class HtRule_Rule_IndexToRoot extends HtRule
{
public static function GetName()
{
return 'Redirect index.php to /';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('indexfile', 'Index File', HtRule_Param::TYPE_STRING, 'index.php'));
parent::__construct();
}
public function __toString()
{
$name = self::GetName();
$file = str_replace('.', '\\.', $this->params['indexfile']->Value());
return <<<EOT
# $name
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteRule ^$file$ / [R=301,L]
EOT;
}
}

View File

@@ -0,0 +1,39 @@
<?php
class HtRule_Rule_MapIndex extends HtRule
{
public static function GetName()
{
return 'Map urls to index.php';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('Target', 'Target File', HtRule_Param::TYPE_STRING, 'index.php', 'The file to map request to'));
$this->AddParam(new HtRule_Param('AppendUrl', 'Append Url to rewrite', HtRule_Param::TYPE_BOOLEAN, False, 'This adds the url to the end of the rewritten url, ie /test/ => /index.php/test/'));
$this->AddParam(new HtRule_Param('AppendMethod', 'Method of appending', HtRule_Param::TYPE_STRING, '/', 'eg. ? or ?page= (/ May not work in a CGI environment)'));
parent::__construct();
}
public function __toString()
{
$params = $this->ParamValues();
$append = '';
if ($params['AppendUrl'])
$append .= $params['AppendMethod'].'$1';
return <<<EOT
# Map urls to $params[Target]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) $params[Target]{$append} [L,QSA]
EOT;
}
}

View File

@@ -0,0 +1,45 @@
<?php
class HtRule_Rule_RedirectDomain extends HtRule
{
public function __construct()
{
$this->AddParam(new HtRule_Param('permanent', 'Permanent', HtRule_Param::TYPE_BOOLEAN, true, ''));
$this->AddParam(new HtRule_Param('subdomains', 'Include All Subdomains', HtRule_Param::TYPE_BOOLEAN, true, ''));
$this->AddParam(new HtRule_Param('to', 'Destination Domain', HtRule_Param::TYPE_STRING, 'http://newdomain.com/', 'The full url to direct to'));
$this->AddParam(new HtRule_Param('from', 'Source Domains', HtRule_Param::TYPE_TEXT, 'olddomain.com', ''));
parent::__construct();
}
public static function GetName()
{
return 'Redirect Domains';
}
public function __toString()
{
$values = $this->ParamValues();
$type = ($values['permanent']) ? 301 : 302;
$typeText = ($values['permanent']) ? 'Permanent' : 'Temporary';
$domains = explode("\n", str_replace("\r", '', $values['from']));
$subdomains = ($values['subdomains']) ? '' : '^';
$rules = "# Redirect Domains ($typeText)".PHP_EOL;
if (empty($domains))
return $rules;
foreach($domains as $domain)
{
$rules .= "RewriteCond %{HTTP_HOST} {$subdomains}".preg_quote($domain)."$ [OR]".PHP_EOL;
}
$rules = substr($rules, 0, strlen($rules)-strlen(" [OR]".PHP_EOL)).PHP_EOL;
$destination = rtrim($values['to'], '/');
$destination = preg_quote($destination);
$rules .= "RewriteRule ^(.*)$ {$destination}/$1 [R=$type,L]";
return $rules;
}
}

View File

@@ -0,0 +1,96 @@
<?php
class HtRule_Rule_RedirectUrls extends HtRule
{
public function __construct()
{
$this->AddParam(new HtRule_Param('permanent', 'Permanent Redirects', HtRule_Param::TYPE_BOOLEAN, True, ''));
$this->AddParam(new HtRule_Param('host', 'Check Host', HtRule_Param::TYPE_BOOLEAN, false, 'Check the hostname is correct for each redirect'));
$this->AddParam(new HtRule_Param('ignorewww', 'Ignore www. prefix', HtRule_Param::TYPE_BOOLEAN, false, 'Ignores the www, from the domain name. Requires check host be enabled'));
$this->AddParam(new HtRule_Param('urls', 'Urls', HtRule_Param::TYPE_DUALTEXT, '', 'Full Urls, from on the left, to on the right', True));
parent::__construct();
}
public static function GetName()
{
return 'Redirect Urls';
}
public function __toString()
{
$values = $this->ParamValues();
$type = ($values['permanent']) ? 301 : 302;
$typeText = ($values['permanent']) ? 'Permanent' : 'Temporary';
$urls = $values['urls'];
$rules = '';
if (is_array($urls) && count($urls) == 2)
{
$fromUrls = explode("\n", str_replace("\r", '', $urls[0]));
$toUrls = explode("\n", str_replace("\r", '', $urls[1]));
foreach($fromUrls as $key => $from)
{
$from = trim($from);
if ($from == "")
continue;
if (isset($toUrls[$key]))
{
$to = trim($toUrls[$key]);
if ($to == "")
continue;
$rule = $this->CreateRewrite($from, $to, $type, $values['host'], @$values['ignorewww']);
if ($rule)
$rules .= $rule.PHP_EOL;
}
}
}
return <<<EOT
# Redirect Urls ($typeText)
$rules
EOT;
}
private function CreateRewrite($from, $to, $type, $checkhost, $ignorewww)
{
$from = parse_url($from);
$toUrl = $to;
$to = parse_url($to);
if (!$from || !$to)
return False;
$default = array('scheme'=>false,'host'=>false,'port'=>false,'path'=>false,'query'=>false,'fragment'=>false);
$from = array_replace($default, $from);
$to = array_replace($default, $to);
$rule = '';
if ($checkhost)
{
$domain = $from['host'];
$domainCheck = '^'.str_replace(array('.','\-'),array('\.','\-'),$domain).'$';
if ($ignorewww)
{
$domain = preg_replace('/^www\./', '', $domain);
$domainCheck = "^(www\.)?".str_replace(array('.','\-'),array('\.','\-'),$domain)."\$";
}
$rule .= 'RewriteCond %{HTTP_HOST} '.$domainCheck.PHP_EOL;
}
if (!empty($from['query']))
{
$end = '';
if ($to['query'] == false)
$end = '?';
$rule .= "RewriteCond %{QUERY_STRING} ^".str_replace('.','\.',$from['query'])."\$".PHP_EOL;
$rule .= "RewriteRule ^".ltrim(preg_quote($from['path']),'/')."\$ $toUrl$end [R=$type,L]";
}
else
{
$rule .= "RewriteRule ^".ltrim(preg_quote($from['path']),'/')."\$ $toUrl [R=$type,L]";
}
return $rule;
}
}

View File

@@ -0,0 +1,36 @@
<?php
class HtRule_Rule_ToWWW extends HtRule
{
public static function GetName()
{
return 'Redirect to www.';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('domain', 'Domain Name', HtRule_Param::TYPE_STRING, 'domain.com', 'The domain without the www'));
$this->AddParam(new HtRule_Param('https', 'Use Https', HtRule_Param::TYPE_BOOLEAN, False, 'Redirect to https'));
parent::__construct();
}
public function __toString()
{
$domain = $this->params['domain']->Value();
$name = self::GetName();
$proto = 'http';
if ($this->params['https']->Value())
$proto = 'https';
return <<<EOT
# $name
RewriteCond %{HTTP_HOST} ^${domain}$
RewriteRule (.*) ${proto}://www.${domain}/$1 [R=301,L]
EOT;
}
}

View File

@@ -0,0 +1,48 @@
<?php
class HtRule_Rule_UseHttps extends HtRule
{
public static function GetName()
{
return 'Force SSL';
}
public function RequireRewriteEngine()
{
return True;
}
public function __construct()
{
$this->AddParam(new HtRule_Param('DetectHttps', 'Detect Using %{HTTPS}', HtRule_Param::TYPE_BOOLEAN, True, 'This will work on most servers'));
$this->AddParam(new HtRule_Param('Domain', 'Rewrite To Domain', HtRule_Param::TYPE_STRING, 'www.domain.com', 'The full domain to rewrite to'));
$this->AddParam(new HtRule_Param('DetectPort', 'Detect By Port Number', HtRule_Param::TYPE_BOOLEAN, False, 'HTTP uses port 80 whereas HTTPS uses port 443 (default ports)'));
$this->AddParam(new HtRule_Param('HttpsPort', 'Https Port', HtRule_Param::TYPE_INT, 443, 'Redirect the request if the port in use is not this port'));
parent::__construct();
}
public function __toString()
{
$params = $this->ParamValues();
$rule = "# Force clients to use https\n";
if ($params['DetectPort'])
{
$rule .= "RewriteCond %{SERVER_PORT} !$params[HttpsPort]";
if ($params['DetectHttps'])
$rule .= " [OR]";
$rule .= "\n";
}
if ($params['DetectHttps'])
$rule .= "RewriteCond %{HTTPS} !=on\n";
$port = '';
if ($params['HttpsPort'] != 443)
$port = ':'.$params['HttpsPort'];
$rule .= "RewriteRule (.*) https://$params[Domain]{$port}/$1 [R=301,L]";
return $rule;
}
}

26
Classes/System.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
class System
{
private static $db;
private static $config;
public static function Init(array $config)
{
self::$config = (object) $config;
self::StartSession();
}
public static function Config()
{
return self::$config;
}
public static function StartSession()
{
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
session_set_cookie_params(60*60*24, self::$config->BasePath, $_SERVER['HTTP_HOST'], False, True);
session_start();
}
}