get rid of openid config file
[phorkie.git] / www / secure.php
index 5893033574309b842d7286a5674cde0b4dbce604..e61408701f6be5be3496eddde69c76f4aaeb5281 100644 (file)
@@ -7,5 +7,20 @@ require_once 'www-header.php';
 $_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI'];
 if (!isset($_SESSION['identity'])) {
     header("Location: /login");
+    exit;
+}
+if ($GLOBALS['phorkie']['auth']['secure'] > 0 &&
+    $GLOBALS['phorkie']['auth']['userlist']) {
+    if (!in_array($_SESSION['identity'], $GLOBALS['phorkie']['users'])) {
+        header('HTTP/1.1 403 Forbidden');
+        $db = new Database();
+        render(
+            'forbidden',
+            array(
+                'recents'     => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'),
+            )
+        );
+        exit;
+    }
 }
 ?>