Permalink
Browse files

Now automatically creating a default admin hook.

  • Loading branch information...
cubiclesoft committed Apr 28, 2018
1 parent 1718406 commit cc08ee5fb17395cd29daa7e4c8d96828d0228159
Showing with 15 additions and 1 deletion.
  1. +15 −1 install.php
View
@@ -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)
?>
<br />
Next: <a href="<?php echo htmlspecialchars($adminurl); ?>">Start using Single-Sign On</a><br />
(Read the installation instructions or the above link might not work.)<br />
<?php
}
else

0 comments on commit cc08ee5

Please sign in to comment.