Changeset 5928 for trunk/phpgwapi


Ignore:
Timestamp:
04/12/12 11:15:33 (12 years ago)
Author:
marcosw
Message:

Ticket #2398 - Compatibilizacao com PHP-5.3 em alguns módulos do expresso

Location:
trunk/phpgwapi/inc
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpgwapi/inc/class.clientsniffer.inc.php

    r5912 r5928  
    7676 
    7777                        // Determine NAME Name and Version       
    78                         if ( eregi( 'MSIE ([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) || 
    79                                 eregi( 'Microsoft Internet Explorer ([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) )  
     78                        if ( preg_match( '/MSIE ([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) || 
     79                                preg_match( '/Microsoft Internet Explorer ([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) )  
    8080                        { 
    8181                                $this->VERSION = $info[1]; 
    8282                                $this->NAME = 'IE'; 
    8383                        }  
    84                         elseif ( eregi( 'Opera ([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) || 
    85                                 eregi( 'Opera/([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) )  
     84                        elseif ( preg_match( '/Opera ([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) || 
     85                                preg_match( '/Opera\/([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) )  
    8686                        { 
    8787                                $this->VERSION = $info[1]; 
    8888                                $this->NAME = 'Opera'; 
    8989                        } 
    90                         elseif ( eregi( 'iCab ([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) || 
    91                                 eregi( 'iCab/([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) )  
     90                        elseif ( preg_match( '/iCab ([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) || 
     91                                preg_match( '/iCab\/([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) )  
    9292                        { 
    9393                                $this->VERSION = $info[1]; 
    9494                                $this->NAME = 'iCab'; 
    9595                        } 
    96                         elseif ( eregi( 'Netscape6/([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) )  
     96                        elseif ( preg_match( '/Netscape6\/([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) )  
    9797                        { 
    9898                                $this->VERSION = $info[1]; 
    9999                                $this->NAME = 'Netscape'; 
    100100                        } 
    101                         elseif ( eregi( 'Mozilla/([0-9].[0-9a-zA-Z]{1,4})',$this->UA,$info) )  
     101                        elseif ( preg_match( '/Mozilla\/([0-9].[0-9a-zA-Z]{1,4})/i',$this->UA,$info) )  
    102102                        { 
    103103                                $this->VERSION = $info[1]; 
     
    111111 
    112112                        // Determine if AOL or WEBTV 
    113                         if( eregi( 'aol',$this->UA,$info)) 
     113                        if( preg_match( '/aol/i',$this->UA,$info)) 
    114114                        { 
    115115                                $this->AOL = true; 
    116116                        } 
    117                         elseif( eregi( 'webtv',$this->UA,$info)) 
     117                        elseif( preg_match( '/webtv/i',$this->UA,$info)) 
    118118                        { 
    119119                                $this->WEBTV = true; 
     
    138138 
    139139                        // Check for Windows 16-bit 
    140                         if( eregi('Win16',$this->UA)           ||  
    141                         eregi('windows 3.1',$this->UA)     ||  
    142                         eregi('windows 16-bit',$this->UA)  ||  
    143                         eregi('16bit',$this->UA)) 
     140                        if( preg_match('/Win16/i',$this->UA)           ||  
     141                        preg_match('/windows 3.1/i',$this->UA)     ||  
     142                        preg_match('/windows 16-bit/i',$this->UA)  ||  
     143                        preg_match('/16bit/i',$this->UA)) 
    144144                        { 
    145145                                $this->PLATFORM = 'Win16'; 
     
    148148 
    149149                        // Check for Windows 32-bit      
    150                         if(eregi('Win95',$this->UA) || eregi('windows 95',$this->UA))  
     150                        if(preg_match('/Win95/i',$this->UA) || preg_match('/windows 95/i',$this->UA))  
    151151                        { 
    152152                                $this->PLATFORM = 'Win32';  
    153153                                $this->OS = 'Win95';  
    154154                        } 
    155                         elseif(eregi('Win98',$this->UA) || eregi('windows 98',$this->UA))  
     155                        elseif(preg_match('/Win98/i',$this->UA) || preg_match('/windows 98/i',$this->UA))  
    156156                        { 
    157157                                $this->PLATFORM = 'Win32';  
    158158                                $this->OS = 'Win98';  
    159159                        } 
    160                         elseif(eregi('WinNT',$this->UA) || eregi('windows NT',$this->UA))  
     160                        elseif(preg_match('/WinNT/i',$this->UA) || preg_match('/windows NT/i',$this->UA))  
    161161                        { 
    162162                                $this->PLATFORM = 'Win32';  
     
    170170 
    171171                        // Check for OS/2 
    172                         if( eregi('os/2',$this->UA) || eregi('ibm-webexplorer',$this->UA)) 
     172                        if( preg_match('/os\/2/i',$this->UA) || preg_match('/ibm-webexplorer/i',$this->UA)) 
    173173                        { 
    174174                                $this->PLATFORM = 'OS2'; 
     
    177177 
    178178                        // Check for Mac 68000 
    179                         if( eregi('68k',$this->UA) || eregi('68000',$this->UA)) 
     179                        if( preg_match('/68k/i',$this->UA) || preg_match('/68000/i',$this->UA)) 
    180180                        { 
    181181                                $this->PLATFORM = 'Mac'; 
     
    184184 
    185185                        //Check for Mac PowerPC 
    186                         if( eregi('ppc',$this->UA) || eregi('powerpc',$this->UA)) 
     186                        if( preg_match('/ppc/i',$this->UA) || preg_match('/powerpc/i',$this->UA)) 
    187187                        { 
    188188                                $this->PLATFORM = 'Mac'; 
     
    193193 
    194194                        //SunOS 
    195                         if(eregi('sunos',$this->UA))  
     195                        if(preg_match('/sunos/i',$this->UA))  
    196196                        { 
    197197                                $this->PLATFORM = 'Unix'; 
    198198                                $this->OS = 'sun'; 
    199199                        } 
    200                         if(eregi('sunos 4',$this->UA))  
     200                        if(preg_match('/sunos 4/i',$this->UA))  
    201201                        { 
    202202                                $this->PLATFORM = 'Unix'; 
    203203                                $this->OS = 'sun4'; 
    204204                        } 
    205                         elseif(eregi('sunos 5',$this->UA))  
     205                        elseif(preg_match('/sunos 5/i',$this->UA))  
    206206                        { 
    207207                                $this->PLATFORM = 'Unix'; 
    208208                                $this->OS = 'sun5'; 
    209209                        } 
    210                         elseif(eregi('i86',$this->UA))  
     210                        elseif(preg_match('/i86/i',$this->UA))  
    211211                        { 
    212212                                $this->PLATFORM = 'Unix'; 
     
    215215 
    216216                        // Irix 
    217                         if(eregi('irix',$this->UA)) 
     217                        if(preg_match('/irix/',$this->UA)) 
    218218                        { 
    219219                                $this->PLATFORM = 'Unix'; 
    220220                                $this->OS = 'irix'; 
    221221                        } 
    222                         if(eregi('irix 6',$this->UA))  
     222                        if(preg_match('/irix 6/i',$this->UA))  
    223223                        { 
    224224                                $this->PLATFORM = 'Unix'; 
    225225                                $this->OS = 'irix6'; 
    226226                        } 
    227                         elseif(eregi('irix 5',$this->UA))  
     227                        elseif(preg_match('/irix 5/i',$this->UA))  
    228228                        { 
    229229                                $this->PLATFORM = 'Unix'; 
     
    232232 
    233233                        //HP-UX 
    234                         if(eregi('hp-ux',$this->UA)) 
     234                        if(preg_match('/hp-ux/i',$this->UA)) 
    235235                        { 
    236236                                $this->PLATFORM = 'Unix'; 
    237237                                $this->OS = 'hpux'; 
    238238                        } 
    239                         if(eregi('hp-ux',$this->UA) && preg_match('/10./',$this-UA))   
     239                        if(preg_match('/hp-ux/i',$this->UA) && preg_match('/10./',$this-UA))   
    240240                        { 
    241241                                $this->PLATFORM = 'Unix'; 
    242242                                $this->OS = 'hpux10'; 
    243243                        } 
    244                         elseif(eregi('hp-ux',$this->UA) && preg_match('/09./',$this-UA))   
     244                        elseif(preg_match('/hp-ux/i',$this->UA) && preg_match('/09./',$this-UA))   
    245245                        { 
    246246                                $this->PLATFORM = 'Unix'; 
     
    249249 
    250250                        //AIX 
    251                         if(eregi('aix',$this->UA)) 
     251                        if(preg_match('/aix/i',$this->UA)) 
    252252                        { 
    253253                                $this->PLATFORM = 'Unix'; 
    254254                                $this->OS = 'aix'; 
    255255                        } 
    256                         if(eregi('aix1',$this->UA)) 
     256                        if(preg_match('/aix1/i',$this->UA)) 
    257257                        { 
    258258                                $this->PLATFORM = 'Unix'; 
    259259                                $this->OS = 'aix1'; 
    260260                        } 
    261                         elseif(eregi('aix2',$this->UA)) 
     261                        elseif(preg_match('/aix2/i',$this->UA)) 
    262262                        { 
    263263                                $this->PLATFORM = 'Unix'; 
    264264                                $this->OS = 'aix2'; 
    265265                        } 
    266                         elseif(eregi('aix3',$this->UA)) 
     266                        elseif(preg_match('/aix3/i',$this->UA)) 
    267267                        { 
    268268                                $this->PLATFORM = 'Unix'; 
    269269                                $this->OS = 'aix3'; 
    270270                        } 
    271                         elseif(eregi('aix4',$this->UA)) 
     271                        elseif(preg_match('/aix4/i',$this->UA)) 
    272272                        { 
    273273                                $this->PLATFORM = 'Unix'; 
     
    276276 
    277277                        // Linux 
    278                         if(eregi('inux',$this->UA)) 
     278                        if(preg_match('/inux/i',$this->UA)) 
    279279                        { 
    280280                                $this->PLATFORM = 'Unix'; 
     
    283283 
    284284                        //Unixware 
    285                         if(eregi('unix_system_v',$this->UA)) 
     285                        if(preg_match('/unix_system_v/i',$this->UA)) 
    286286                        { 
    287287                                $this->PLATFORM = 'Unix'; 
     
    290290 
    291291                        //mpras 
    292                         if(eregi('ncr',$this->UA)) 
     292                        if(preg_match('/ncr/i',$this->UA)) 
    293293                        { 
    294294                                $this->PLATFORM = 'Unix'; 
     
    297297 
    298298                        //Reliant 
    299                         if(eregi('reliantunix',$this->UA)) 
     299                        if(preg_match('/reliantunix/i',$this->UA)) 
    300300                        { 
    301301                                $this->PLATFORM = 'Unix'; 
     
    304304 
    305305                        // DEC 
    306                         if(eregi('dec',$this->UA)           ||   
    307                         eregi('osfl',$this->UA)          ||  
    308                         eregi('alphaserver',$this->UA)   ||  
    309                         eregi('ultrix',$this->UA)        ||  
    310                         eregi('alphastation',$this->UA)) 
     306                        if(preg_match('/dec/i',$this->UA)           ||   
     307                        preg_match('/osfl/i',$this->UA)          ||  
     308                        preg_match('/alphaserver/i',$this->UA)   ||  
     309                        preg_match('/ultrix/i',$this->UA)        ||  
     310                        preg_match('/alphastation/i',$this->UA)) 
    311311                        { 
    312312                                $this->PLATFORM = 'Unix'; 
     
    315315 
    316316                        // Sinix 
    317                         if(eregi('sinix',$this->UA))     
     317                        if(preg_match('/sinix/i',$this->UA))     
    318318                        { 
    319319                                $this->PLATFORM = 'Unix'; 
     
    322322 
    323323                        // FreeBSD 
    324                         if(eregi('freebsd',$this->UA))     
     324                        if(preg_match('/freebsd/i',$this->UA))     
    325325                        { 
    326326                                $this->PLATFORM = 'Unix'; 
     
    329329 
    330330                        // BSD 
    331                         if(eregi('bsd',$this->UA))     
     331                        if(preg_match('/bsd/i',$this->UA))     
    332332                        { 
    333333                                $this->PLATFORM = 'Unix'; 
     
    336336 
    337337                        // VMS 
    338                         if(eregi('vax',$this->UA) || eregi('openvms',$this->UA))     
     338                        if(preg_match('/vax/i',$this->UA) || preg_match('/openvms/i',$this->UA))     
    339339                        { 
    340340                                $this->PLATFORM = 'Unix'; 
     
    343343 
    344344                        // SCO 
    345                         if(eregi('sco',$this->UA) || eregi('unix_sv',$this->UA))     
     345                        if(preg_match('/sco/i',$this->UA) || preg_match('/unix_sv/i',$this->UA))     
    346346                        { 
    347347                                $this->PLATFORM = 'Unix'; 
     
    352352 
    353353                        // make the code a bit easier to read 
    354                         $ie  = eregi('ie',$this->NAME); 
    355                         $ie5 = ( eregi('ie',$this->NAME) && ($this->MAJORVER >= 5) ); 
    356                         $ie4 = ( eregi('ie',$this->NAME) && ($this->MAJORVER >= 4) ); 
    357                         $ie3 = ( eregi('ie',$this->NAME) && ($this->MAJORVER >= 3) ); 
    358  
    359                         $nav  = eregi('netscape',$this->NAME); 
    360                         $nav5 = ( eregi('netscape',$this->NAME) && ($this->MAJORVER >= 5) ); 
    361                         $nav4 = ( eregi('netscape',$this->NAME) && ($this->MAJORVER >= 4) ); 
    362                         $nav3 = ( eregi('netscape',$this->NAME) && ($this->MAJORVER >= 3) ); 
    363                         $nav2 = ( eregi('netscape',$this->NAME) && ($this->MAJORVER >= 2) ); 
    364  
    365                         $opera = eregi('opera',$this->NAME); 
     354                        $ie  = preg_match('/ie/i',$this->NAME); 
     355                        $ie5 = ( preg_match('/ie/i',$this->NAME) && ($this->MAJORVER >= 5) ); 
     356                        $ie4 = ( preg_match('/ie/i',$this->NAME) && ($this->MAJORVER >= 4) ); 
     357                        $ie3 = ( preg_match('/ie/i',$this->NAME) && ($this->MAJORVER >= 3) ); 
     358 
     359                        $nav  = preg_match('/netscape/i',$this->NAME); 
     360                        $nav5 = ( preg_match('/netscape/i',$this->NAME) && ($this->MAJORVER >= 5) ); 
     361                        $nav4 = ( preg_match('/netscape/i',$this->NAME) && ($this->MAJORVER >= 4) ); 
     362                        $nav3 = ( preg_match('/netscape/i',$this->NAME) && ($this->MAJORVER >= 3) ); 
     363                        $nav2 = ( preg_match('/netscape/i',$this->NAME) && ($this->MAJORVER >= 2) ); 
     364 
     365                        $opera = preg_match('/opera/i',$this->NAME); 
    366366 
    367367                        // do the assumption 
  • trunk/phpgwapi/inc/class.common.inc.php

    r5912 r5928  
    713713                                while ($file = readdir($dh)) 
    714714                                { 
    715                                         if (eregi("\.css$", $file) && $file != 'phpgw.css') 
     715                                        if (preg_match('/\.css$/i', $file) && $file != 'phpgw.css') 
    716716                                        { 
    717717                                                $list[] = substr($file,0,strpos($file,'.')); 
     
    724724                                while ($file = readdir($dh)) 
    725725                                { 
    726                                         if (eregi("\.theme$", $file)) 
     726                                        if (preg_match('/\.theme$/i', $file)) 
    727727                                        { 
    728728                                                $list[] = substr($file,0,strpos($file,'.')); 
  • trunk/phpgwapi/inc/class.setup_html.inc.php

    r3540 r5928  
    316316                        while ($file = $dh->read()) 
    317317                        { 
    318                                 if (eregi("\.theme$", $file)) 
     318                                if (preg_match('/\.theme$/i', $file)) 
    319319                                { 
    320320                                        $list[] = substr($file,0,strpos($file,'.')); 
  • trunk/phpgwapi/inc/class.soapclient.inc.php

    r5509 r5928  
    144144                                        { 
    145145                                                // fault? 
    146                                                 if(eregi('fault',$return->name)) 
     146                                                if(preg_match('/fault/i',$return->name)) 
    147147                                                { 
    148148                                                        $this->debug('got fault'); 
  • trunk/phpgwapi/inc/class.validator.inc.php

    r5913 r5928  
    144144                        { 
    145145                                //echo ' is valid<br>host ' . $url_elements['host']; 
    146                                 if( eregi("[a-z]", $url_elements['host']) ) 
     146                                if( preg_match('/[a-z]/i', $url_elements['host']) ) 
    147147                                { 
    148148                                        //echo ' is name<br>'; 
     
    197197                                { 
    198198                                        //echo "Checking $seg<br>"; 
    199                                         if(eregi("[a-z0-9\-]{0,62}",$seg)) 
     199                                        if(preg_match('/[a-z0-9\-]{0,62}/i',$seg)) 
    200200                                        { 
    201201                                                $return = True;  
  • trunk/phpgwapi/inc/class.xml.inc.php

    r5915 r5928  
    11401140                } 
    11411141            } 
    1142             elseif ( eregi("^@", $step) ) 
     1142            elseif ( preg_match('/^@/i', $step) ) 
    11431143            { 
    11441144                // Use the attribute axis and select the attribute. 
     
    11461146                $axis["node-test"] = substr($step, 1); 
    11471147            } 
    1148             elseif ( eregi("\]$", $step) ) 
     1148            elseif ( preg_match('/\]$/i', $step) ) 
    11491149            { 
    11501150                // Use the child axis and select a position. 
     
    30863086                { 
    30873087                    // Check whether it's the language, the user asks for. 
    3088                     if ( eregi("^".$arguments, $this->nodes[$node] 
     3088                    if ( preg_match("/^$arguments/i", $this->nodes[$node] 
    30893089                        ["attributes"]["xml:lang"]) ) 
    30903090                    { 
     
    31063106        { 
    31073107            // Check whether it's the language, the user asks for. 
    3108             if ( eregi("^".$arguments, $this->nodes[$node]["attributes"] 
     3108            if ( preg_match("/^$arguments/i", $this->nodes[$node]["attributes"] 
    31093109                ["xml:lang"]) ) 
    31103110            { 
  • trunk/phpgwapi/inc/common_functions.inc.php

    r3486 r5928  
    339339                                break; 
    340340                        case 'ip': 
    341                                 if (eregi("^[0-9]{1,3}(\.[0-9]{1,3}){3}$",$string)) 
     341                                if (preg_match('/^[0-9]{1,3}(\.[0-9]{1,3}){3}$/i',$string)) 
    342342                                { 
    343343                                        $octets = split('\.',$string); 
     
    360360                                break; 
    361361                        case 'email': 
    362                                 if (eregi("^([[:alnum:]_%+=.-]+)@([[:alnum:]_.-]+)\.([a-z]{2,3}|[0-9]{1,3})$",$string)) 
     362                                if (preg_match('/^([[:alnum:]_%+=.-]+)@([[:alnum:]_.-]+)\.([a-z]{2,3}|[0-9]{1,3})$/i',$string)) 
    363363                                { 
    364364                                        return True; 
  • trunk/phpgwapi/inc/fpdf/font/makefont/makefont.php

    r2 r5928  
    168168        if(isset($fm['StdVW'])) 
    169169                $stemv=$fm['StdVW']; 
    170         elseif(isset($fm['Weight']) and eregi('(bold|black)',$fm['Weight'])) 
     170        elseif(isset($fm['Weight']) and preg_match('/(bold|black)/i',$fm['Weight'])) 
    171171                $stemv=120; 
    172172        else 
Note: See TracChangeset for help on using the changeset viewer.