00001 <?php 00008 // Dependent on SmartyFactory class 00009 ClassFactory::importClass('SmartyFactory'); 00010 00015 class Redirect { 00025 public static function redirect($redirTo, $lang=null) { 00026 // Attempt to redirect automatically via HTTP header 00027 Header('Location: '.$redirTo); 00028 00029 // Emergency redirect by JavaScript 00030 // (or by user, if there is no JavaScript) 00031 $smarty = SmartyFactory::createSmarty(); 00032 $smarty->assign('redirTo', $redirTo); 00033 if (isset($lang)) 00034 $smarty->assign('lang', $lang); 00035 $smarty->display('Redirect.tpl'); 00036 exit(); 00037 } 00038 // Avoid class instantiation 00039 private function __construct() { } 00040 }; 00041 ?>