diff -r 5bcdee999015 -r e0ec986c0af3 includes/functions.php --- 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(''); $template->add_header(' '); + + if ( get_class($template) == 'template_nodb' ) + $template->init_vars(); $template->tpl_strings['PAGE_NAME'] = $title; $template->header(true); - echo '

' . $message . '

If you are not redirected within ' . ( $timeout + 1 ) . ' seconds, please click here.

'; + echo '

' . $message . '

If you are not redirected within ' . $timeout . ' seconds, please click here.

'; $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 = "Next »"; $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';