if($qspl[1] == "changegravs") {
return "gwvpmini_SwitchGravatars";
}
+ if($qspl[1] == "changessl") {
+ return "gwvpmini_SwitchForceSSL";
+ }
} else {\r
error_log("i got here, where next?");\r
return "gwvpmini_AdminMainPage";\r
function gwvpmini_AdminMainPageBody()
{
global $BASE_URL;
- global $can_register, $reg_reqs_confirm, $confirm_from_address, $use_gravatar;
+ global $can_register, $reg_reqs_confirm, $confirm_from_address, $use_gravatar, $force_ssl;
if($can_register) {
$register = "Registration Enabled (<a href=\"$BASE_URL/admin/changereg\">Disable</a>)";
$usegrav = "Gravatars are disabled (<a href=\"$BASE_URL/admin/changegravs\">Enable</a>)";
}
+ if($force_ssl) {\r
+ $forcessl = "Force SSL is enabled (<a href=\"$BASE_URL/admin/changessl\">Disable</a>)";\r
+ } else {\r
+ $forcessl = "Force SSL is disabled (<a href=\"$BASE_URL/admin/changessl\">Enable</a>)";\r
+ }\r
+
+
$totalusers = gwvpmini_GetNUsers();
echo "<table><tr valign=\"top\"><td>";
echo "<h2>Users - $totalusers</h2>";
- echo "$register<br>$regconfirm<br>$usegrav<br>";
+ echo "$register<br>$regconfirm<br>$usegrav<br>$forcessl<br>";
echo "<form method=\"post\" action=\"$BASE_URL/admin/changefromemail\">";
echo "Address emails are sent from <input type=\"text\" name=\"fromemail\" value=\"$confirm_from_address\"><input type=\"submit\" name=\"Update\" value=\"Update\"><br>";
echo "</form>";
\r
header("Location: $BASE_URL/admin");
}
+
+function gwvpmini_SwitchForceSSL()
+{
+ global $BASE_URL, $force_ssl;\r
+ \r
+ if($newst == 1) $stat = "disabled";\r
+ else $stat = "enabled";\r
+ \r
+ if($force_ssl) {\r
+ gwvpmini_setConfigVal("forcessl", "0");\r
+ } else {\r
+ gwvpmini_setConfigVal("forcessl", "1");\r
+ }\r
+ \r
+ gwvpmini_SendMessage("info", "forcessl $stat");\r
+ \r
+ header("Location: $BASE_URL/admin");\r
+
+}
?>
\ No newline at end of file
function gwvpmini_goWeb()
{
- global $CALL_ME_FUNCTIONS;
+ global $CALL_ME_FUNCTIONS, $force_ssl;
// first we determine if we have a valid setup and run the installer if not
/*if(!gwvpmini_issetup()) {
// next, we go thru the CALL_ME_FUNCTIONS - the purpose of call_me_functions is to determine if a function should be called based on
// the functions return (i.e. if function returns false, its not it, otherwise it returns a function name we have to call)
// this is important for our plugin structure later on - the key on the array serves an an ordering method
+
+ if($force_ssl) {
+ if(!isset($_SERVER['HTTPS'])) {
+ header("Location: https://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"], true);
+ return;
+ }
+ }
+
+
ksort($CALL_ME_FUNCTIONS);
foreach($CALL_ME_FUNCTIONS as $key => $val) {
//error_log("checking callmefunction $key as $val");