leaderbin/classes/CustomModule.php
Josh Sherman 1006cbd436 Got that first API call done
Had to work out the API parent class a bit. Also closing #8 as the API docs are about done. Time to knock out the rest of the API calls so I can start using this shit.
2013-12-18 16:38:21 -05:00

30 lines
531 B
PHP

<?php
class CustomModule extends Module
{
protected $redis = false;
protected $uid = false;
public function __construct()
{
parent::__construct();
$this->redis = new CustomRedis();
if (substr(get_class($this), 0, 3) != 'api')
{
if (isset($_COOKIE['__auth']))
{
list($uid, $auth_token) = explode('|', base64_decode($_COOKIE['__auth']));
if ($this->redis->hget('user:' . $uid, 'auth') === $auth_token)
{
$this->uid = $uid;
$this->return['uid'] = $uid;
}
}
}
}
}
?>