--- a/includes/functions.php Sun Nov 18 18:44:55 2007 -0500
+++ b/includes/functions.php Wed Nov 21 15:10:57 2007 -0500
@@ -282,6 +282,16 @@
header('Location: ' . $url);
header('HTTP/1.1 307 Temporary Redirect');
}
+
+ if ( !is_object($template) )
+ {
+ $template = new template_nodb();
+ $template->load_theme('oxygen', 'bleu', false);
+ $template->tpl_strings['SITE_NAME'] = 'Enano';
+ $template->tpl_strings['SITE_DESC'] = 'This site is experiencing a critical error and cannot load.';
+ $template->tpl_strings['COPYRIGHT'] = '© ' . date('Y');
+ $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($title);
+ }
$template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />');
$template->add_header('<script type="text/javascript">
@@ -292,10 +302,13 @@
setTimeout(\'__r();\', ' . $timeout . '000);
</script>
');
+
+ if ( get_class($template) == 'template_nodb' )
+ $template->init_vars();
$template->tpl_strings['PAGE_NAME'] = $title;
$template->header(true);
- echo '<p>' . $message . '</p><p>If you are not redirected within ' . ( $timeout + 1 ) . ' seconds, <a href="' . str_replace('"', '\\"', $url) . '">please click here</a>.</p>';
+ echo '<p>' . $message . '</p><p>If you are not redirected within ' . $timeout . ' seconds, <a href="' . str_replace('"', '\\"', $url) . '">please click here</a>.</p>';
$template->footer(true);
$db->close();
@@ -2317,6 +2330,7 @@
$blk = $template->makeParserText($block);
$inner = '';
$cls = 'row2';
+ $total = $num_pages * $perpage - $perpage;
if ( $start > 0 )
{
$url = sprintf($result_url, abs($start - $perpage));
@@ -2399,8 +2413,6 @@
$inner .= $blk->run();
}
- $total = $num_pages * $perpage - $perpage;
-
if ( $this_page < $num_pages )
{
// $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
@@ -2423,7 +2435,9 @@
if ( $start < $total )
{
- $url = sprintf($result_url, abs($start + $perpage));
+ $link_offset = abs($start + $perpage);
+ // i'm tired of debugging a defective sprintf
+ $url = htmlspecialchars(sprintf($result_url, strval($link_offset)));
$link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>Next »</a>";
$cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
$blk->assign_vars(array(
@@ -2437,7 +2451,9 @@
$paginator = "\n$begin$inner$end\n";
if ( $total > 1 )
+ {
$out .= $paginator;
+ }
$cls = 'row2';