Ticket #1963: fix-mysql-real-escape-string.dpatch

File fix-mysql-real-escape-string.dpatch, 1.6 kB (added by diego_iastrubni, 2 years ago)

fix for this problem (patch against the 2.2.1 release)

Line 
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## fix-mysql-real-escape-string.dpatch by Diego Iastrubni <diego.iastrubni@xorcom.com>
3 ##
4 ## DP: systems running on sqlite3 (or pgsql) this function is not available
5 ## DP: instead of changing the whole code, lets hack our own version of this function.
6 ## DP: according to the documentation found here: http://il2.php.net/mysql_real_escape_string
7 ## DP: this shold be enough.
8
9
10
11 @DPATCH@
12 diff -urNad upstream~/amp_conf/htdocs/admin/header.php upstream/amp_conf/htdocs/admin/header.php
13 --- upstream~/amp_conf/htdocs/admin/header.php  2006-12-09 01:48:17.000000000 +0200
14 +++ upstream/amp_conf/htdocs/admin/header.php   2007-05-30 12:31:59.000000000 +0300
15 @@ -74,6 +74,24 @@
16         textdomain('amp');
17  }
18  
19 +// systems running on sqlite3 (or pgsql) this function is not available
20 +// instead of changing the whole code, lets hack our own version of this function.
21 +// according to the documentation found here: http://il2.php.net/mysql_real_escape_string
22 +// this shold be enough.
23 +if (!function_exists('mysql_real_escape_string')) {
24 +       function mysql_real_escape_string($str) {
25 +               $str = str_replace( "\x00", "\\" . "\x00", $str );
26 +               $str = str_replace( "\x1a", "\\" . "\x1a", $str );
27 +               $str = str_replace( "\n" , "\\". "\n"    , $str );
28 +               $str = str_replace( "\r" , "\\". "\r"    , $str );
29 +               $str = str_replace( "\\" , "\\". "\\"    , $str );
30 +               $str = str_replace( "'" , "\\". "'"      , $str );
31 +               $str = str_replace( '"' , "\\". '"'      , $str );
32 +               return $str;
33 +       }
34 +}
35 +
36 +
37  if (!$quietmode) {
38  ?>
39  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads