From db6505607b2356e91fe396badf50243407f3345b Mon Sep 17 00:00:00 2001
From: Malf Furious <m@lfurio.us>
Date: Sun, 7 Feb 2016 16:13:11 -0500
Subject: Add in-app administrative setting: settSSL

This is the in-app version of $_SCROTT['settSSL'] system-level setting.
Setting::settSSL() overrides $_SCROTT['settSSL'] only if the latter is set to 'neither'.
If both are set to 'neither', the app will run on either HTTP or HTTPS depending on how the page was requested.
---
 app/class/setting.class.php | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

(limited to 'app')

diff --git a/app/class/setting.class.php b/app/class/setting.class.php
index e3ef7f1..9cafdfd 100644
--- a/app/class/setting.class.php
+++ b/app/class/setting.class.php
@@ -41,6 +41,24 @@ class Setting extends Framework
         $db->query($query);
     }
 
+    /*
+     * Force or forbid SSL connections?
+     */
+    static function settSSL($value = null)
+    {
+        $opt = "settSSL";
+
+        if ($value != null)
+            self::setValue($opt, $value);
+
+        $value = self::getValue($opt);
+
+        if ($value === false)
+            return "neither";
+
+        return $value;
+    }
+
     /*
      * Should the app allow the public to signup their own accounts with Scrott?
      */
-- 
cgit v1.2.3