Changeset 4238

Show
Ignore:
Timestamp:
06/27/07 11:07:48 (6 years ago)
Author:
diego_iastrubni
Message:

fix for ticket:1963 - now systems without mysql (pgsql and sqlite3) will also have a working version of mysql_real_escape_string, which is used to
check for user input in many pages.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.3/amp_conf/htdocs/admin/header.php

    r4170 r4238  
    7373  bind_textdomain_codeset('amp', 'utf8'); 
    7474  textdomain('amp'); 
     75} 
     76 
     77// systems running on sqlite3 (or pgsql) this function is not available 
     78// instead of changing the whole code, lets hack our own version of this function. 
     79// according to the documentation found here: http://il2.php.net/mysql_real_escape_string 
     80// this shold be enough. 
     81// Fixes ticket: http://freepbx.org/trac/ticket/1963 
     82if (!function_exists('mysql_real_escape_string')) { 
     83  function mysql_real_escape_string($str) { 
     84    $str = str_replace( "\x00", "\\" . "\x00", $str ); 
     85    $str = str_replace( "\x1a", "\\" . "\x1a", $str ); 
     86    $str = str_replace( "\n" , "\\". "\n"    , $str ); 
     87    $str = str_replace( "\r" , "\\". "\r"    , $str ); 
     88    $str = str_replace( "\\" , "\\". "\\"    , $str ); 
     89    $str = str_replace( "'" , "\\". "'"      , $str ); 
     90    $str = str_replace( '"' , "\\". '"'      , $str ); 
     91    return $str; 
     92  } 
    7593} 
    7694