includes/functions.php
changeset 279 8acd77a6c19d
parent 271 f088805540ae
parent 276 acfdccf7a2bf
child 304 e2cb5f1432c8
equal deleted inserted replaced
278:53ba55d33abb 279:8acd77a6c19d
   282   {
   282   {
   283     header('Location: ' . $url);
   283     header('Location: ' . $url);
   284     header('HTTP/1.1 307 Temporary Redirect');
   284     header('HTTP/1.1 307 Temporary Redirect');
   285   }
   285   }
   286   
   286   
   287   $title = $lang->get($title);
   287   if ( !is_object($template) )
   288   $message = $lang->get($message);
   288   {
       
   289     $template = new template_nodb();
       
   290     $template->load_theme('oxygen', 'bleu', false);
       
   291     $template->tpl_strings['SITE_NAME'] = 'Enano';
       
   292     $template->tpl_strings['SITE_DESC'] = 'This site is experiencing a critical error and cannot load.';
       
   293     $template->tpl_strings['COPYRIGHT'] = 'Powered by Enano CMS - &copy; 2007 Dan Fuhry. This program is Free Software; see the <a href="' . scriptPath . '/install.php?mode=license">GPL file</a> included with this package for details.';
       
   294     $template->tpl_strings['PAGE_NAME'] = htmlspecialchars($title);
       
   295   }
   289 
   296 
   290   $template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />');
   297   $template->add_header('<meta http-equiv="refresh" content="' . $timeout . '; url=' . str_replace('"', '\\"', $url) . '" />');
   291   $template->add_header('<script type="text/javascript">
   298   $template->add_header('<script type="text/javascript">
   292       function __r() {
   299       function __r() {
   293         // FUNCTION AUTOMATICALLY GENERATED
   300         // FUNCTION AUTOMATICALLY GENERATED
   294         window.location="' . str_replace('"', '\\"', $url) . '";
   301         window.location="' . str_replace('"', '\\"', $url) . '";
   295       }
   302       }
   296       setTimeout(\'__r();\', ' . $timeout . '000);
   303       setTimeout(\'__r();\', ' . $timeout . '000);
   297     </script>
   304     </script>
   298     ');
   305     ');
       
   306   
       
   307   if ( get_class($template) == 'template_nodb' )
       
   308     $template->init_vars();
   299 
   309 
   300   $template->tpl_strings['PAGE_NAME'] = $title;
   310   $template->tpl_strings['PAGE_NAME'] = $title;
   301   $template->header(true);
   311   $template->header(true);
   302   echo '<p>' . $message . '</p>';
   312   echo '<p>' . $message . '</p>';
   303   $subst = array(
   313   $subst = array(
  2323   $block = '<td class="row1" style="text-align: center;">{LINK}</td>';
  2333   $block = '<td class="row1" style="text-align: center;">{LINK}</td>';
  2324   $end = '</tr></table></div>';
  2334   $end = '</tr></table></div>';
  2325   $blk = $template->makeParserText($block);
  2335   $blk = $template->makeParserText($block);
  2326   $inner = '';
  2336   $inner = '';
  2327   $cls = 'row2';
  2337   $cls = 'row2';
       
  2338   $total = $num_pages * $perpage - $perpage;
  2328   if ( $start > 0 )
  2339   if ( $start > 0 )
  2329   {
  2340   {
  2330     $url = sprintf($result_url, abs($start - $perpage));
  2341     $url = sprintf($result_url, abs($start - $perpage));
  2331     $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; Prev</a>";
  2342     $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>&laquo; Prev</a>";
  2332     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2343     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2405         'LINK'=>$link
  2416         'LINK'=>$link
  2406         ));
  2417         ));
  2407       $inner .= $blk->run();
  2418       $inner .= $blk->run();
  2408     }
  2419     }
  2409 
  2420 
  2410     $total = $num_pages * $perpage - $perpage;
       
  2411 
       
  2412     if ( $this_page < $num_pages )
  2421     if ( $this_page < $num_pages )
  2413     {
  2422     {
  2414       // $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2423       // $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2415       // $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...'));
  2424       // $blk->assign_vars(array('CLASS'=>$cls,'LINK'=>'...'));
  2416       // $inner .= $blk->run();
  2425       // $inner .= $blk->run();
  2429 
  2438 
  2430   }
  2439   }
  2431 
  2440 
  2432   if ( $start < $total )
  2441   if ( $start < $total )
  2433   {
  2442   {
  2434     $url = sprintf($result_url, abs($start + $perpage));
  2443     $link_offset = abs($start + $perpage);
       
  2444     $url = htmlspecialchars(sprintf($result_url, strval($link_offset)));
  2435     $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>Next &raquo;</a>";
  2445     $link = "<a href=".'"'."$url".'"'." style='text-decoration: none;'>Next &raquo;</a>";
  2436     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2446     $cls = ( $cls == 'row1' ) ? 'row2' : 'row1';
  2437     $blk->assign_vars(array(
  2447     $blk->assign_vars(array(
  2438       'CLASS'=>$cls,
  2448       'CLASS'=>$cls,
  2439       'LINK'=>$link
  2449       'LINK'=>$link
  2443 
  2453 
  2444   $inner .= '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '.$this_page.', '.$num_pages.', '.$perpage.', unescape(\'' . rawurlencode($result_url) . '\'));">&darr;</td>';
  2454   $inner .= '<td class="row2" style="cursor: pointer;" onclick="paginator_goto(this, '.$this_page.', '.$num_pages.', '.$perpage.', unescape(\'' . rawurlencode($result_url) . '\'));">&darr;</td>';
  2445 
  2455 
  2446   $paginator = "\n$begin$inner$end\n";
  2456   $paginator = "\n$begin$inner$end\n";
  2447   if ( $total > 1 )
  2457   if ( $total > 1 )
       
  2458   {
  2448     $out .= $paginator;
  2459     $out .= $paginator;
       
  2460   }
  2449 
  2461 
  2450   $cls = 'row2';
  2462   $cls = 'row2';
  2451 
  2463 
  2452   if ( sizeof($q) > 0 )
  2464   if ( sizeof($q) > 0 )
  2453   {
  2465   {