summaryrefslogtreecommitdiff
path: root/models/base.php
diff options
context:
space:
mode:
authorFrédéric Guillot <contact@fredericguillot.com>2014-02-22 16:30:03 -0500
committerFrédéric Guillot <contact@fredericguillot.com>2014-02-22 16:30:03 -0500
commit2f4651411b1827e1e5859ba6053052b508f455e0 (patch)
treeea07631e7a5e5850367f873c7a9c1a0e07e10638 /models/base.php
parenta1923d3d7f9276e859d6fd6bee339f0ea00f6544 (diff)
Add kiosk mode, public board access with read-only and auto-refresh
Diffstat (limited to 'models/base.php')
-rw-r--r--models/base.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/models/base.php b/models/base.php
index 981c7839..3c071623 100644
--- a/models/base.php
+++ b/models/base.php
@@ -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);
+ }
}