\n\n" . $content;
$template = new Template();
$template->assign_var('STYLESHEET', $stylesheet);
$template->assign_var('CONTENT', $content);
$template->assign_var('VERSION', SLB_VERSION);
$template->set_filenames(array('setup' => 'setup.tpl'));
$template->pparse('setup');
die();
}
/// Display an error message in the template, and die.
function slb_die($error, $show_main = true)
{
$content = '';
$message = "
$error
";
if($show_main)
$content .= slb_main_page();
slb_output($content, $message);
die();
}
/// Validate the submitted password.
if(isset($_POST['auth']))
{
sleep(1); // This isn't secure, but better than nothing.
if($_POST['auth'] == $db_password)
$_SESSION['authed'] = true;
else
slb_die('Incorrect password.', false);
}
/// Show login form if not authenticated.
if(!isset($_SESSION['authed']))
{
$content = <<
CONTENT;
slb_output($content, 'Please enter the same password used for database access.');
}
/// Build the changelog table for viewing/editing with the new changelog form.
function slb_main_page()
{
global $changelogs;
$content = "
Changelogs:
\n\n";
if(count($changelogs) == 0)
$content .= "
No changelogs have been setup.
\n\n";
else
{
$content .= '
' . "\n" .
"
Name
SVN URL
Revision
Action
\n";
foreach($changelogs as $id => $cl)
{
$content .= <<
${cl['title']}
${cl['svn']}
${cl['latest']}
CONTENT;
}
$content .= "\n
";
}
$content .= "\n\n" . slb_changelog_form();
return $content;
}
/// Build the XHTML form for adding or editing a changelog.
function slb_changelog_form($id = false)
{
global $changelogs;
$id_input = ''; $header = 'Add New'; $submit_value = 'Add';
$prefix_input = "
CONTENT;
}
$content .= <<
CONTENT;
}
slb_output($content);
}
// If we're still running here, we default to the main page.
slb_output(slb_main_page());
?>