FIX: Disappearing \ in the regex

Scans for, and displays main/alt relations in your Guild

Moderator: PleegWat

FIX: Disappearing \ in the regex

Postby PleegWat » Wed Jul 12, 2006 3:12 pm

In config.lib.php, around line 78, find:
Code: Select all
        if (!(array_key_exists('process',$_POST) && ($_POST['process'] == 'process'))) {
            return 
'';
        } 


Add below:

Code: Select all
        // Slash global data if magic_quotes_gpc is off.
        
if ( !get_magic_quotes_gpc() )
        {
            
$_GET $this->slash_global_data($_GET);
            
$_POST $this->slash_global_data($_POST);
        } 


At the very end of the file, find:

Code: Select all
}

$config = new config($tablename);
 


Add above:

Code: Select all
    /**
    * Applies addslashes() to the provided data
    *
    * @param    mixed   $data   Array of data or a single string
    * @return   mixed           Array or string of data
    */
    
function slash_global_data(&$data)
    {
        if ( 
is_array($data) )
        {
            foreach ( 
$data as $k => $v )
            {
                
$data[$k] = ( is_array($v) ) ? slash_global_data($v) : addslashes($v);
            }
        }
        return 
$data;
    } 


This fix will be in the next release, but I've got some other work underway so I don't want to push now.

A workaround is doubling all \ in the regex setting. (so instead of /([\w]+)/ use /([\\w]+)/)


EDIT: Whoops, forgot to attach a fixed file
Attachments
config.lib.zip
(3.58 KiB) Downloaded 303 times
Last edited by PleegWat on Wed Jul 12, 2006 3:46 pm, edited 2 times in total.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Return to AltMonitor

Who is online

Users browsing this forum: No registered users and 1 guest

cron