Jeff PHP framework
0.99
Modular, extensible, OOP, MVC, lightweight php framework designed to ease the programmers in the development of web applications.
|
00001 <?php 00032 abstract class Error { 00033 00040 public static function codeMessages() { 00041 00042 return array( 00043 1=>__("compulsoryFieldsError"), 00044 ); 00045 00046 } 00047 00061 public static function syserrorMessage($class, $function, $message, $line, $noDebugMsg=null) { 00062 00063 @ob_clean(); 00064 ob_start(); 00065 $buffer = "<html>\n"; 00066 $buffer .= "<head>\n"; 00067 $buffer .= "<style type=\"text/css\">"; 00068 $buffer .= "@import url('".REL_CSS."/syserror.css');"; 00069 $buffer .= "</style>\n"; 00070 $buffer .= "</head>\n\n"; 00071 $buffer .= "<body>\n"; 00072 $buffer .= "<div>\n"; 00073 $buffer .= "<div id=\"errorImg\">\n"; 00074 $buffer .= "</div>\n"; 00075 $buffer .= "<table border=\"1\">\n"; 00076 $buffer .= "<tr>"; 00077 if(DEBUG) { 00078 $buffer .= "<th>".__("Class/File")."</th><th>".__("Function")."</th><th>".__("Message")."</th>"; 00079 if($line) $buffer .= "<th>".__("Line")."</th>"; 00080 $buffer .= "</tr>\n"; 00081 $buffer .= "<tr>"; 00082 $buffer .= "<td>".$class."</td><td>".$function."</td><td>".$message."</td>"; 00083 if($line) $buffer .= "<td>".$line."</td>"; 00084 } 00085 else { 00086 if($noDebugMsg) $buffer .= "<td>".$noDebugMsg."</td>"; 00087 } 00088 $buffer .= "</tr>\n"; 00089 $buffer .= "</table>\n"; 00090 $buffer .= "</div>\n"; 00091 $buffer .= "</body>\n"; 00092 $buffer .= "</html>"; 00093 00094 echo $buffer; 00095 ob_end_flush(); 00096 exit(); 00097 00098 } 00099 00110 public static function errorMessage($message, $link) { 00111 00112 ob_clean(); 00113 $codeMessages = self::codeMessages(); 00114 00115 $msg = (is_int($message['error']))? $codeMessages[$message['error']]:$message['error']; 00116 00117 $buffer = __("Error").": "; 00118 $buffer .= " ".jsVar($msg)."\\n"; 00119 if(isset($message['hint'])) { 00120 $buffer .= __("Hints").":"; 00121 $buffer .= " ".jsVar($message['hint']); 00122 } 00123 $_SESSION['ERRORMSG'] = $buffer; 00124 00125 header("Location: $link"); 00126 exit(); 00127 00128 } 00129 00138 public static function warningMessage($message, $link) { 00139 00140 ob_clean(); 00141 00142 $msg = $message['warning']; 00143 00144 $buffer = __("Attention!"); 00145 $buffer .= " ".jsVar($msg)."\\n"; 00146 if(isset($message['hint'])) { 00147 $buffer .= __("Hints").":"; 00148 $buffer .= " ".jsVar($message['hint']); 00149 } 00150 $_SESSION['ERRORMSG'] = $buffer; 00151 00152 header("Location: $link"); 00153 exit(); 00154 00155 } 00156 00162 public static function getErrorMessage() { 00163 00164 $errorMsg = (isset($_SESSION['ERRORMSG']))?$_SESSION['ERRORMSG']:""; 00165 if(isset($_SESSION['ERRORMSG'])) unset($_SESSION['ERRORMSG']); 00166 00167 return $errorMsg; 00168 00169 } 00170 00171 00172 } 00173 00174 ?>