THIS source compiler<?php
/* DAT/MESSAGES.PHP - Admin code for Admin supplementary "templates"
This file, although not readily editable by an HTML editor, has several
"templates" for Admin to display messages and stuff.
NOTE I've been a little sloppy on the FORM ACTION= strings...
*/
function _message($message) {
global $messages; // UGH! a global, but $messages is a global...
return $messages[$message];
}
if (!isset($formtitle)) $formtitle = '';
$messages['yerpassword'] = <<<HTML
<!--messages.php-->
<div id="password">
<code>\$PASS</code>
<p>The next step if you want a new password is to update the Admin user record in the database table <b>users</b>, where <b>userid</b> is your Login ID. You need to change the header field of 'password:' to the new value. <em>We are probably two or three releases away from doing this for you!</em></p>
<p>(A sideeffect of the code is that once the user database has been created, the AD_PASS define in DEFINES.PHP is actually no longer relevant to the login
process and only the user table value is used.)</p>
<form title="\$formtitle" method="get" action="{\$_SERVER['PHP_SELF']}">
<p><input type="submit" value="done">
<input type="hidden" name="arg" value="\$arg"></p>
</form>
</div>
<p>\$status</p>
HTML;
$messages['password'] = <<<HTML
<!--messages.php-->
<div id="password">
Please carefully enter the 'admin' password and click <b>generate</b> to create an encrypted password.
<form title="\$formtitle" method="post" name="password" action="\$url">
<p>Password:
<input style="margin-top:-5px;" type="text" name="password" value="\$p" size=16 maxlength=32></p>
<p><input type="submit" name="button" value="generate">
<input type="submit" name="button" value="cancel">
<span style="color:red;"><b>\$status</b></span>
</p>
</form>
</div>
HTML;
if (config('configuresalts')) {
$messages['defines'] = <<<HTML
<!--htm/admin/messages.php-->
<div id="defines">
The following things are required to continue.
<form title="\$formtitle" method="post" name="defines" action="\$url">
<span> <!-- needed to force the next DIV down! ugh! --></span>
<fieldset style="float:left;"><legend>Admin Account</legend>
<input type="text" name="ad_name" value="\$ad_name" size=16 maxlength=32> Login ID
<br>
<input type="text" name="ad_pass" value="\$ad_pass" size=16 maxlength=32> Password
</fieldset>
<!-- this can't be a P as it won't line up! argh! -->
<div>'Login ID' can be of case-insensitive letters, numbers and underscores (no spaces). There are no requirements on the password other than that it must exist -- we assume you know that passwords should be long and of mixed characters for the Internet (passwords are case-sensitive).</div>
<br style="clear:left;">
<fieldset style="float:left;"><legend>MySQL Parameters</legend>
<input type="text" name="db_user" value="\$db_user" size=16 maxlength=32> User
<br>
<input type="text" name="db_pass" value="\$db_pass" size=16 maxlength=32> Password
<br>
<input type="text" name="db_name" value="\$db_name" size=16 maxlength=32> Database
</fieldset>
<!-- this can be a P and it lines up right! wtf! -->
<p>No PHP code can create a MySQL user account. That can only be done by a MySQL administration program installed on your computer or on your website. The database will be created if it does not exist if the user has been granted CREATE privileges.</p>
<br style="clear:left;">
<fieldset style="float:left;"><legend>Password Salts</legend>
<input type="text" name="salt1" value="\$salt1" size=30 maxlength=60><br>
<input type="text" name="salt2" value="\$salt2" size=30 maxlength=60><br>
<input type="hidden" name="salt3" value="\$salt3">
</fieldset>
<p>Enter two salts here. The code does not validate them in any way and they will be used exactly as entered. Please read the PHP.NET reference to the <tt>crypt()</tt> function for how to create a proper salt string.</p>
<br style="clear:left;">
<p>
<input type="submit" name="button" value="write" title="values are good, write them">
<input type="submit" name="button" value="test" title="test these values">
<input type="submit" name="button" value="cancel">
<span style="color:red;"><b>\$status</b></span>
</p>
</form>
</div>
HTML;
} else {
$messages['defines'] = <<<HTML
<!--htm/admin/messages.php-->
<div id="defines">
The following things are required to continue.
<form title="\$formtitle" method="post" name="defines" action="\$url">
<span> <!-- needed to force the next DIV down! ugh! --></span>
<fieldset style="float:left;"><legend>Admin Account</legend>
<input type="text" name="ad_name" value="\$ad_name" size=16 maxlength=32> Login ID
<br>
<input type="text" name="ad_pass" value="\$ad_pass" size=16 maxlength=32> Password
</fieldset>
<!-- this can't be a P as it won't line up! argh! -->
<div>'Login ID' can be of case-insensitive letters, numbers and underscores (no spaces). There are no requirements on the password other than that it must exist -- we assume you know that passwords should be long and of mixed characters for the Internet (passwords are case-sensitive).</div>
<br style="clear:left;">
<fieldset style="float:left;"><legend>MySQL Parameters</legend>
<input type="text" name="db_user" value="\$db_user" size=16 maxlength=32> User
<br>
<input type="text" name="db_pass" value="\$db_pass" size=16 maxlength=32> Password
<br>
<input type="text" name="db_name" value="\$db_name" size=16 maxlength=32> Database
</fieldset>
<!-- this can be a P and it lines up right! wtf! -->
<p>No PHP code can create a MySQL user account. That can only be done by a MySQL administration program installed on your computer or on your website. The database will be created if it does not exist if the user has been granted CREATE privileges.</p>
<br style="clear:left;">
<p>
<input type="submit" name="button" value="write" title="values are good, write them">
<input type="submit" name="button" value="test" title="test these values">
<input type="submit" name="button" value="cancel">
<span style="color:red;"><b>\$status</b></span>
</p>
</form>
</div>
HTML;
}
$messages['goodtogo'] = <<<HTML
<!--messages.php-->
<div>
You will next be redirected back to the Admin page. However, it will still be in testing mode due to a setting in the CONFIG.INI file.<br><br>The next step will be to use the (<a>ini</a>) command to edit <b><a class="nohover">config.ini</a></b> and comment out (or delete) 'testing = 1' at the top of the file.
<form title="\$formtitle" method="get" action="{\$_SERVER['PHP_SELF']}">
<p><input type="submit" value="done">
</form>
</div>
<p>\$status</p>
HTML;
// confirmation dialogs
// NOTE these use the following ($_url)
$_url = '?'.htmlspecialchars($_SERVER['QUERY_STRING']);
$messages['confirm'] = <<<HTML
\$preamble
<div id="confirm">
<p>Really Do This?</p>
<p>\$action</p>
<form title="$formtitle" method="post" action="$_url">
<input type="submit" name="yes" value="yes">
<input type="submit" name="button" value="cancel">
</form>
</div>
HTML;
// optionally create one for each delete action like this:
$messages['confirm_comment'] = <<<HTML
Preparing to delete comment \$id (post \$id)...
<div id="confirm">
<p>Really Do This?</p>
<p>delete comment \$id</p>
<form title="$formtitle" method="post" action="$_url">
<input type="submit" name="yes" value="yes">
<input type="submit" name="button" value="cancel">
</form>
</div>
HTML;
// preview gets inserted into the HTML for previewing a post
$messages['preview'] = <<<HTML
<div style='position: fixed; bottom: 10px;'>
<span style='padding: 5px 4px 3px 5px; border: 1px solid orange; background-color: yellow; font: 13px monospace; opacity: 0.6;'>
This is your preview. Any links are as they would be in real life but internal links will not work correctly.
</span>
</div>
HTML;
$messages['testing'] = <<<HTML
<div id="test">
<b>THIS</b> is running in 'file' mode.<br><br>The posts are text files but otherwise the site is fully functional except that commenting is disabled. (Permissions are usually preserved in ZIP archives.)
</div>
HTML;
$messages['temporary'] = <<<HTML
<div id="test">
<b>THIS</b> is running in 'temporary' mode.<br><br>The Database is real but all tables are TEMPORARY.<br><br>The next step is to delete 'dbtemporary' in <b>config.ini</b>.
</div>
HTML;
$messages['visitors'] = <<<HTML
<div id="test">
<b>Visitors</b> is an experimental way of tracking visitors who post comments. It needs to be enabled by 'visitorcode = 1' in the CONFIG.INI file. See <a href="doc/visitors.html" target="_blank">visitors</a>.
</div>
HTML;
$messages['setup'] = <<<HTML
<span><input id="setup" type="submit" name="button" value="setup">
<span><b>setup</b><br><br>This will allow you to create an admin name and password, to setup the MySQL parameters and enable you to exit 'testing mode'.</span></span>
HTML;
?>
Source Code Index