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.
30 lines
531 B
PHP
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|