[Openfirst-cvscommit] base/includes functions.php,1.13,1.14 globals.php,1.22,1.23
Brought to you by:
xtimg
From: Jamie <ast...@us...> - 2005-11-23 21:52:34
|
Update of /cvsroot/openfirst/base/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2803/includes Modified Files: functions.php globals.php Log Message: magic quotes support (which should die, btw) Index: functions.php =================================================================== RCS file: /cvsroot/openfirst/base/includes/functions.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** functions.php 22 Nov 2005 16:26:53 -0000 1.13 --- functions.php 23 Nov 2005 21:52:26 -0000 1.14 *************** *** 217,219 **** --- 217,250 ---- echo '</pre>'; } + + /** Check magic quotes settings + */ + function ofCheckMagicQuotes() { + set_magic_quotes_runtime(false); //Back, you foul demons! Back! Back! + ini_set('magic_quotes_sybase', false); + if (get_magic_quotes_gpc()) { // Gah! + // Quite making our lives difficult!! + ofFixMagicQuotes($_GET); + ofFixMagicQuotes($_POST); + ofFixMagicQuotes($_COOKIES); + } + } + + /** Fixes magic quote munging! + */ + function ofFixMagicQuotes(&$arr) { + $sybase = (bool)ini_get('magic_quotes_sybase'); + foreach( $arr as $key => $val ) { + if( is_array( $val ) ) { + ofFixMagicQuotes( $arr[$key] ); + } else { + if ($sybase) { + // We really should just die() here and make them get a decent configuration. + $arr[$key] = str_replace("''", "'", $val); + } else { + $arr[$key] = stripslashes( $val ); + } + } + } + } ?> \ No newline at end of file Index: globals.php =================================================================== RCS file: /cvsroot/openfirst/base/includes/globals.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** globals.php 22 Nov 2005 16:34:07 -0000 1.22 --- globals.php 23 Nov 2005 21:52:26 -0000 1.23 *************** *** 111,114 **** --- 111,118 ---- require_once('functions.php'); + // This should been done at the earliest possible time. + // Which is now. + ofCheckMagicQuotes(); + if (!defined('OPENFIRST_NO_INSTALLATION')) { require_once('dbase.php'); |