[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 // phpSysInfo - A PHP System Information Script 3 // http://phpsysinfo.sourceforge.net/ 4 // This program is free software; you can redistribute it and/or 5 // modify it under the terms of the GNU General Public License 6 // as published by the Free Software Foundation; either version 2 7 // of the License, or (at your option) any later version. 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // You should have received a copy of the GNU General Public License 13 // along with this program; if not, write to the Free Software 14 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 15 // $Id: class.error.inc.php,v 1.4 2006/02/27 21:01:44 bigmichi1 Exp $ 16 17 class Error { 18 19 // Array which holds the error messages 20 var $arrErrorList = array(); 21 // current number of errors encountered 22 var $errors = 0; 23 24 /** 25 * 26 * addError() 27 * 28 * @param strCommand string Command, which cause the Error 29 * @param strMessage string additional Message, to describe the Error 30 * @param intLine integer on which line the Error occours 31 * @param strFile string in which File the Error occours 32 * 33 * @return - 34 * 35 **/ 36 function addError( $strCommand, $strMessage, $intLine, $strFile ) { 37 $this->arrErrorList[$this->errors]['command'] = $strCommand; 38 $this->arrErrorList[$this->errors]['message'] = $strMessage; 39 $this->arrErrorList[$this->errors]['line'] = $intLine; 40 $this->arrErrorList[$this->errors]['file'] = basename( $strFile ); 41 $this->errors++; 42 } 43 44 /** 45 * 46 * ErrorsAsHTML() 47 * 48 * @param - 49 * 50 * @return string string which contains a HTML table which can be used to echo out the errors 51 * 52 **/ 53 function ErrorsAsHTML() { 54 $strHTMLString = ""; 55 $strWARNString = ""; 56 $strHTMLhead = "<table width=\"100%\" border=\"0\">\n" 57 . " <tr>\n" 58 . " <td><font size=\"-1\"><b>File</b></font></td>\n" 59 . " <td><font size=\"-1\"><b>Line</b></font></td>\n" 60 . " <td><font size=\"-1\"><b>Command</b></font></td>\n" 61 . " <td><font size=\"-1\"><b>Message</b></font></td>\n" 62 . " </tr>\n"; 63 $strHTMLfoot = "</table>"; 64 65 if( $this->errors > 0 ) { 66 foreach( $this->arrErrorList as $arrLine ) { 67 if( $arrLine['command'] == "WARN" ) { 68 $strWARNString .= "<font size=\"-1\"><b>WARNING: " . htmlspecialchars( $arrLine['message'] ) . "</b></font><br/>\n"; 69 } else { 70 $strHTMLString .= " <tr>\n" 71 . " <td><font size=\"-1\">" . htmlspecialchars( $arrLine['file'] ) . "</font></td>\n" 72 . " <td><font size=\"-1\">" . $arrLine['line'] . "</font></td>\n" 73 . " <td><font size=\"-1\">" . htmlspecialchars( $arrLine['command'] ) . "</font></td>\n" 74 . " <td><font size=\"-1\">" . htmlspecialchars( $arrLine['message'] ) . "</font></td>\n" 75 . " </tr>\n"; 76 } 77 } 78 } 79 80 if( !empty( $strHTMLString ) ) { 81 $strHTMLString = $strWARNString . $strHTMLhead . $strHTMLString . $strHTMLfoot; 82 } else { 83 $strHTMLString = $strWARNString; 84 } 85 86 return $strHTMLString; 87 } 88 89 /** 90 * 91 * ErrorsExist() 92 * 93 * @param - 94 * 95 * @return true there are errors logged 96 * false no errors logged 97 * 98 **/ 99 function ErrorsExist() { 100 if( $this->errors > 0 ) { 101 return true; 102 } else { 103 return false; 104 } 105 } 106 } 107 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |