This repository has been archived on 2020-11-15. You can view files and clone it, but cannot push or open issues or pull requests.
vanilla-api-addon/controllers/class.sessioncontroller.php

22 lines
534 B
PHP

<?php if (!defined('APPLICATION')) exit();
class SessionController extends APIController
{
//TODO should allow for only one catgories to be looked at
public function Index()
{
$Session = Gdn::Session();
if($Session->User != False)
$this->SetJSON("user", array("TransientKey"=>$Session->TransientKey(), "UserID"=>$Session->UserID, "Name"=>$Session->User->Name, "User"=>True));
else
$this->SetJSON("user", array("TransientKey"=>$Session->TransientKey(), "UserID"=>0, "User"=>False));
$this->Render();
}
}
?>