280 if ( $timeout == 0 ) |
280 if ( $timeout == 0 ) |
281 { |
281 { |
282 header('Location: ' . $url); |
282 header('Location: ' . $url); |
283 header('HTTP/1.1 307 Temporary Redirect'); |
283 header('HTTP/1.1 307 Temporary Redirect'); |
284 } |
284 } |
|
285 |
|
286 if ( !is_object($template) ) |
|
287 { |
|
288 $template = new template_nodb(); |
|
289 $template->load_theme('oxygen', 'bleu', false); |
|
290 $template->tpl_strings['SITE_NAME'] = 'Enano'; |
|
291 $template->tpl_strings['SITE_DESC'] = 'This site is experiencing a critical error and cannot load.'; |
|
292 $template->tpl_strings['COPYRIGHT'] = '© ' . date('Y'); |
|
293 $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($title); |
|
294 } |
285 |
295 |
286 $template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />'); |
296 $template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />'); |
287 $template->add_header('<script type="text/javascript"> |
297 $template->add_header('<script type="text/javascript"> |
288 function __r() { |
298 function __r() { |
289 // FUNCTION AUTOMATICALLY GENERATED |
299 // FUNCTION AUTOMATICALLY GENERATED |
290 window.location="' . str_replace('"', '\\"', $url) . '"; |
300 window.location="' . str_replace('"', '\\"', $url) . '"; |
291 } |
301 } |
292 setTimeout(\'__r();\', ' . $timeout . '000); |
302 setTimeout(\'__r();\', ' . $timeout . '000); |
293 </script> |
303 </script> |
294 '); |
304 '); |
|
305 |
|
306 if ( get_class($template) == 'template_nodb' ) |
|
307 $template->init_vars(); |
295 |
308 |
296 $template->tpl_strings['PAGE_NAME'] = $title; |
309 $template->tpl_strings['PAGE_NAME'] = $title; |
297 $template->header(true); |
310 $template->header(true); |
298 echo '<p>' . $message . '</p><p>If you are not redirected within ' . ( $timeout + 1 ) . ' seconds, <a href="' . str_replace('"', '\\"', $url) . '">please click here</a>.</p>'; |
311 echo '<p>' . $message . '</p><p>If you are not redirected within ' . $timeout . ' seconds, <a href="' . str_replace('"', '\\"', $url) . '">please click here</a>.</p>'; |
299 $template->footer(true); |
312 $template->footer(true); |
300 |
313 |
301 $db->close(); |
314 $db->close(); |
302 exit(0); |
315 exit(0); |
303 |
316 |
2315 $block = '<td class="row1" style="text-align: center;">{LINK}</td>'; |
2328 $block = '<td class="row1" style="text-align: center;">{LINK}</td>'; |
2316 $end = '</tr></table></div>'; |
2329 $end = '</tr></table></div>'; |
2317 $blk = $template->makeParserText($block); |
2330 $blk = $template->makeParserText($block); |
2318 $inner = ''; |
2331 $inner = ''; |
2319 $cls = 'row2'; |
2332 $cls = 'row2'; |
|
2333 $total = $num_pages * $perpage - $perpage; |
2320 if ( $start > 0 ) |
2334 if ( $start > 0 ) |
2321 { |
2335 { |
2322 $url = sprintf($result_url, abs($start - $perpage)); |
2336 $url = sprintf($result_url, abs($start - $perpage)); |
2323 $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>« Prev</a>"; |
2337 $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>« Prev</a>"; |
2324 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2338 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2397 'LINK'=>$link |
2411 'LINK'=>$link |
2398 )); |
2412 )); |
2399 $inner .= $blk->run(); |
2413 $inner .= $blk->run(); |
2400 } |
2414 } |
2401 |
2415 |
2402 $total = $num_pages * $perpage - $perpage; |
|
2403 |
|
2404 if ( $this_page < $num_pages ) |
2416 if ( $this_page < $num_pages ) |
2405 { |
2417 { |
2406 // $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2418 // $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2407 // $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...')); |
2419 // $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...')); |
2408 // $inner .= $blk->run(); |
2420 // $inner .= $blk->run(); |
2421 |
2433 |
2422 } |
2434 } |
2423 |
2435 |
2424 if ( $start < $total ) |
2436 if ( $start < $total ) |
2425 { |
2437 { |
2426 $url = sprintf($result_url, abs($start + $perpage)); |
2438 $link_offset = abs($start + $perpage); |
|
2439 // i'm tired of debugging a defective sprintf |
|
2440 $url = htmlspecialchars(sprintf($result_url, strval($link_offset))); |
2427 $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>Next »</a>"; |
2441 $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>Next »</a>"; |
2428 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2442 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
2429 $blk->assign_vars(array( |
2443 $blk->assign_vars(array( |
2430 'CLASS'=>$cls, |
2444 'CLASS'=>$cls, |
2431 'LINK'=>$link |
2445 'LINK'=>$link |
2435 |
2449 |
2436 $inner .= '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '.$this_page.', '.$num_pages.', '.$perpage.', unescape(\'' . rawurlencode($result_url) . '\'));">↓</td>'; |
2450 $inner .= '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '.$this_page.', '.$num_pages.', '.$perpage.', unescape(\'' . rawurlencode($result_url) . '\'));">↓</td>'; |
2437 |
2451 |
2438 $paginator = "\n$begin$inner$end\n"; |
2452 $paginator = "\n$begin$inner$end\n"; |
2439 if ( $total > 1 ) |
2453 if ( $total > 1 ) |
|
2454 { |
2440 $out .= $paginator; |
2455 $out .= $paginator; |
|
2456 } |
2441 |
2457 |
2442 $cls = 'row2'; |
2458 $cls = 'row2'; |
2443 |
2459 |
2444 if ( sizeof($q) > 0 ) |
2460 if ( sizeof($q) > 0 ) |
2445 { |
2461 { |