40 lines
803 B
PHP
Raw Normal View History

<?php
2016-08-24 21:17:58 -04:00
namespace Miniflux\Model\User;
2014-02-08 14:13:14 -05:00
use PicoDb\Database;
2016-08-24 21:17:58 -04:00
use Miniflux\Session;
use Miniflux\Request;
use Miniflux\Model\Config;
use Miniflux\Model\RememberMe;
use Miniflux\Model\Database as DatabaseModel;
// Check if the user is logged in
function is_loggedin()
{
return ! empty($_SESSION['loggedin']);
}
2015-01-17 18:53:40 -05:00
// Destroy the session and the rememberMe cookie
function logout()
{
2015-01-17 18:53:40 -05:00
RememberMe\destroy();
Session\close();
}
// Get the credentials from the current selected database
function get_credentials()
{
2015-08-14 21:33:39 -04:00
return Database::getInstance('db')
2015-01-28 05:26:36 +01:00
->hashtable('settings')
->get('username', 'password');
}
// Set last login date
function set_last_login()
{
return Database::getInstance('db')
->hashtable('settings')
->put(array('last_login' => time()));
}