Add kiosk mode, public board access with read-only and auto-refresh

This commit is contained in:
Frédéric Guillot
2014-02-22 16:30:03 -05:00
parent a1923d3d7f
commit 2f4651411b
12 changed files with 121 additions and 19 deletions

View File

@@ -17,7 +17,7 @@ require __DIR__.'/schema.php';
abstract class Base
{
const APP_VERSION = 'master';
const DB_VERSION = 2;
const DB_VERSION = 3;
const DB_FILENAME = 'data/db.sqlite';
private static $dbInstance = null;
@@ -46,4 +46,17 @@ abstract class Base
die('Unable to migrate database schema!');
}
}
// Generate a random token from /dev/urandom or with uniqid()
public static function generateToken()
{
if (ini_get('open_basedir') === '') {
$token = file_get_contents('/dev/urandom', false, null, 0, 30);
}
else {
$token = uniqid(mt_rand(), true);
}
return hash('crc32b', $token);
}
}