It works by limiting access based on a global field, then the login value
and the auth[perms] value.
if STORE_CLOSED is set to 1, store will be closed to everyone unless the
$login = 1 (meaning you'd like to try to log in) or $auth["perms"] = "admin"
(meaning your an admin thats already logged in.
this way, admins can get in and do their work while others are locked out.
so here are the hacks
config.php:
after the DEBUG section, add this section
[code]
# STORE_CLOSED Directive
# Shows "store closed" message and disables non-admin access.
# Good while developing
define("STORE_CLOSED","1");
define("CLOSED_MSG","The site is temporarily closed for maintanence. Please
try again in a few minutes.<p>Thank you.");
[/code]
index.php
wrap the HEADER ... FOOTER section with the following
before the header is inserted:
[code]
// Check for maintanence
if (!STORE_CLOSED || $login || ($auth["perms"] == "admin")) {
[/code]
after the footer is inserted:
[code]
} else {
echo CLOSED_MSG;
}
[/code]
the following are not required, but will notify the admins if they've left
the store closed (oops!).
s_header.ihtml
add this notification so that you'll know if you've left the site closed
replaces the first table column of the "Logged in as" table row
[code]
<td width="150" valign="top"><?php if (STORE_CLOSED) { echo "<font
style='color: red'><strong> Store Mode: Closed</strong></font>"; } else {
echo " "; } ?></td>
[/code]
c_header.ihtml
same thing here...
[code]
<td width="150" valign="top"><?php if (STORE_CLOSED) { echo "<font
style='color: red'><strong> Store Mode: Closed</strong></font>"; } else {
echo " "; } ?></td>
[/code]
header.ihtml
this adds the notice just under the header table at the beginning of the
second main table row...
[code]
<tr><td valign="top"><?php if (STORE_CLOSED) echo "<br><center><font
style='color: red'><strong> Store Mode: Closed</strong></font></center>";
?><br><table width="100%" cellspacing="0" cellpadding="4" border="0">
[/code]