From cc08ee5fb17395cd29daa7e4c8d96828d0228159 Mon Sep 17 00:00:00 2001 From: cubiclesoft Date: Sat, 28 Apr 2018 16:25:05 -0700 Subject: [PATCH] Now automatically creating a default admin hook. --- install.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 69e54b0..82bb383 100644 --- a/install.php +++ b/install.php @@ -739,14 +739,29 @@ function InstallSuccess($message) if (substr($adminurl, -1) != "/") $adminurl .= "/"; $adminurl .= $admindir . "/admin.php"; InstallSuccess("Successfully created a randomly named directory and moved 'admin.php' into it."); + + $adminhookfile = SSO_ROOT_PATH . "/" . $admindir . "/admin_hook.php"; } else { $adminurl = dirname(BB_GetFullRequestURLBase()); if (substr($adminurl, -1) != "/") $adminurl .= "/"; $adminurl .= "admin.php"; + + $adminhookfile = SSO_ROOT_PATH . "/admin_hook.php"; } + // Create a basic admin hook file. + $data = "<" . "?php\n"; + $data .= "\tif (!defined(\"SSO_FILE\")) exit();\n"; + $data .= "\n"; + $data .= "\tif (\$_SERVER[\"REMOTE_ADDR\"] !== " . $_SERVER["REMOTE_ADDR"] . ") exit();\n"; + $data .= "\n"; + $data .= "\t\$bb_usertoken = " . substr($rng->GenerateToken(), 0, 32) . ";\n"; + $data .= "\t\$sso_site_admin = true;\n"; + if (file_put_contents($adminhookfile, $data) === false) InstallError("Unable to create the admin hook file."); + InstallSuccess("Successfully created the admin hook file."); + // Set up the main configuration file. $data = "<" . "?php\n"; $data .= "\tdefine(\"SSO_HTTP_SERVER\", \"\");\n"; @@ -817,7 +832,6 @@ function InstallSuccess($message) ?>
Next: Start using Single-Sign On
- (Read the installation instructions or the above link might not work.)