This commit is contained in:
arzynik 2014-05-13 13:03:30 -07:00
parent 38e580855b
commit c3f07aed40

View File

@ -26,6 +26,19 @@ class Cockpit_Auth extends Crunchbutton_Auth_Base {
if ($this->user()->id_admin) {
c::admin($this->user());
}
$ghost = $_GET['_ghost'];
if (!$ghost) {
$ghost = $_COOKIE['_ghost'];
}
if ($ghost && $ghost != 'ME') {
$u = new Admin($ghost);
if ($u->id_admin) {
$this->user($u);
setcookie('_ghost', $u->id_admin, (new DateTime('3000-01-01'))->getTimestamp(), '/');
}
} elseif ($ghost == 'ME') {
setcookie('_ghost', '', (new DateTime('1999-01-01'))->getTimestamp(), '/');
}
}
public function setUser($user) {