Ignore:
Timestamp:
Oct 18, 2008, 2:45:45 AM (16 years ago)
Author:
rvelices
Message:
  • merge rev 2765,2769 from branch 2.0
  • 2765 mysql potential injection paranoia + code compaction in common.inc.php
  • 2769 added an image sort order by privacy level (admins only)
  • 2769 fix an IE6 display issue with quick search on index page
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/common.inc.php

    r2700 r2770  
    3737if( !get_magic_quotes_gpc() )
    3838{
     39  function sanitize_mysql_kv(&$v, $k)
     40  {
     41    $v = addslashes($v);
     42  }
    3943  if( is_array( $_GET ) )
    4044  {
    41     while( list($k, $v) = each($_GET) )
    42     {
    43       if( is_array($_GET[$k]) )
    44       {
    45         while( list($k2, $v2) = each($_GET[$k]) )
    46         {
    47           $_GET[$k][$k2] = addslashes($v2);
    48         }
    49         @reset($_GET[$k]);
    50       }
    51       else
    52       {
    53         $_GET[$k] = addslashes($v);
    54       }
    55     }
    56     @reset($_GET);
    57   }
    58 
    59   if( is_array($_POST) )
    60   {
    61     while( list($k, $v) = each($_POST) )
    62     {
    63       if( is_array($_POST[$k]) )
    64       {
    65         while( list($k2, $v2) = each($_POST[$k]) )
    66         {
    67           $_POST[$k][$k2] = addslashes($v2);
    68         }
    69         @reset($_POST[$k]);
    70       }
    71       else
    72       {
    73         $_POST[$k] = addslashes($v);
    74       }
    75     }
    76     @reset($_POST);
    77   }
    78 
    79   if( is_array($_COOKIE) )
    80   {
    81     while( list($k, $v) = each($_COOKIE) )
    82     {
    83       if( is_array($_COOKIE[$k]) )
    84       {
    85         while( list($k2, $v2) = each($_COOKIE[$k]) )
    86         {
    87           $_COOKIE[$k][$k2] = addslashes($v2);
    88         }
    89         @reset($_COOKIE[$k]);
    90       }
    91       else
    92       {
    93         $_COOKIE[$k] = addslashes($v);
    94       }
    95     }
    96     @reset($_COOKIE);
     45    array_walk_recursive( $_GET, 'sanitize_mysql_kv' );
     46  }
     47  if( is_array( $_POST ) )
     48  {
     49    array_walk_recursive( $_POST, 'sanitize_mysql_kv' );
     50  }
     51  if( is_array( $_COOKIE ) )
     52  {
     53    array_walk_recursive( $_COOKIE, 'sanitize_mysql_kv' );
    9754  }
    9855}
Note: See TracChangeset for help on using the changeset viewer.