class Listener
{
private static $initialSetup = true;
public static function visitor_setup(\XF\Entity\User &$visitor)
{
$isUserLoggedIn = $visitor['user_id'] != 0;
if ($isUserLoggedIn)
{
if(!\XF::app()->request()->getCookie('logged_in'))
{
\XF::app()->response()->setCookie('logged_in', 1, 365 * 86400);
if (self::$initialSetup)
{
//XenForo_Visitor::setup(0);
}
}
}
else
{
$scriptName = basename($_SERVER['SCRIPT_NAME'], '.php');
if ($scriptName == 'index')
{
if (!\XF::app()->request()->getCookie('logged_in'))
{
\XF::app()->response()->setCookie('logged_in', false);
}
}
}
self::$initialSetup = false;
}
}