Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: sqlvalidator.lib.php,v 2.2 2003/11/26 22:52:23 rabus Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 00035 // We need the PEAR libraries, so do a minimum version check first 00036 // I'm not sure if PEAR was available before this point 00037 // For now we actually use a configuration flag 00038 if ($cfg['SQLValidator']['use'] == TRUE) { 00039 require_once('./libraries/sqlvalidator.class.php'); 00040 } // if ($cfg['SQLValidator']['use'] == TRUE) 00041 00042 00055 function PMA_validateSQL($sql) 00056 { 00057 global $cfg; 00058 00059 $str = ''; 00060 00061 if ($cfg['SQLValidator']['use']) { 00062 if (isset($GLOBALS['sqlvalidator_error']) 00063 && $GLOBALS['sqlvalidator_error']) { 00064 $str = sprintf($GLOBALS['strValidatorError'], '<a href="./Documentation.html#faqsqlvalidator" target="documentation">', '</a>'); 00065 } else { 00066 // create new class instance 00067 $srv = new PMA_SQLValidator(); 00068 00069 // Checks for username settings 00070 // The class defaults to anonymous with an empty password 00071 // automatically 00072 if ($cfg['SQLValidator']['username'] != '') { 00073 $srv->setCredentials($cfg['SQLValidator']['username'], $cfg['SQLValidator']['password']); 00074 } 00075 00076 // Identify ourselves to the server properly... 00077 $srv->appendCallingProgram('phpMyAdmin', PMA_VERSION); 00078 00079 // ... and specify what database system we are using 00080 $srv->setTargetDbms('MySQL', PMA_MYSQL_STR_VERSION); 00081 00082 // Log on to service 00083 $srv->start(); 00084 00085 // Do service validation 00086 $str = $srv->validationString($sql); 00087 } 00088 00089 } // end if 00090 00091 /* 00092 else { 00093 // The service is not available so note that properly 00094 $str = $GLOBALS['strValidatorDisabled']; 00095 } // end if... else... 00096 */ 00097 00098 // Gives string back to caller 00099 return $str; 00100 } // end of the "PMA_validateSQL()" function 00101 00102 ?>