00001 <?php 00006 include_once("core/system/JBaseObject.class.php"); 00007 include_once("core/system/JSystem.class.php"); 00008 00012 class HtmlInterface extends JBaseObject 00013 { 00014 var $webpath; 00015 var $modules; 00016 var $errorloading; 00017 00018 00025 function HtmlInterface($modname=null) 00026 { 00027 $this->errorloading = false; 00028 00029 $this->webpath = JSystem::GetConfig("JamesWebDir"); 00030 $this->modules =& Modules::GetInstance(); 00031 if ($modname !== null) 00032 { 00033 $result = JSystem::InitModule($modname); 00034 if (JSystem::IsError($result)) 00035 $this->errorloading = $result; 00036 } 00037 } 00038 00043 function GetInterfacePath() 00044 { 00045 return $this->GetModulePath($this->GetInterfaceModule()); 00046 } 00047 00052 function &GetInterfaceModule() 00053 { 00054 $interface = JSystem::GetConfig("HtmlInterfaceModule"); 00055 return $this->modules->GetModule($interface); 00056 } 00057 00062 function GetLoginPath() 00063 { 00064 return $this->GetModulePath($this->GetLoginModule()); 00065 } 00066 00071 function &GetLoginModule() 00072 { 00073 $login = JSystem::GetConfig("HtmlLoginModule"); 00074 00075 return $this->modules->GetModule($login); 00076 } 00077 00082 function GetCurrentModulePath() 00083 { 00084 $module =& JSystem::GetCurrentModule(); 00085 return $this->GetModulePath($module); 00086 } 00087 00093 function GetModulePath($module) 00094 { 00095 $url = $this->webpath; 00096 $url .= $module->GetRelativePath()."/init.php"; 00097 00098 return $url; 00099 } 00100 00107 function LoadCurrentModule() 00108 { 00109 // if (!headers_sent()) 00110 // { 00111 $path = $this->GetCurrentModulePath(); 00112 header("Location: ".$path); 00113 /* } 00114 else 00115 return false; 00116 */ 00117 return true; 00118 } 00119 00124 function CheckSession() 00125 { 00126 // Check if there was an error loading 00127 if (JSystem::IsError($this->errorloading)) 00128 { 00129 $path = JSystem::GetConfig("JamesWebDir") . "/index.php"; 00130 header("Location: ".$path); 00131 die(); 00132 } 00133 00134 // If not, checks if the user is still logged. 00135 if (!JSystem::IsLogged()) 00136 { 00137 $path = JSystem::GetConfig("JamesWebDir") . "/index.php"; 00138 header("Location: ".$path); 00139 die(); 00140 } 00141 } 00142 00147 function GetCSSPath() 00148 { 00149 $path = JSystem::GetConfig("JamesWebDir"); 00150 $path .= "/estilo/james.css"; 00151 00152 return $path; 00153 } 00154 } 00155 ?>