Ignore:
Timestamp:
Oct 7, 2013, 11:52:11 PM (11 years ago)
Author:
chronos
Message:
  • Fixed: SQL injection protection was not applied because of new dynamic URL handling.
  • Fixed: HTML entities encodin for search input string.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Search/Search.php

    r577 r586  
    4141                else if(array_key_exists('text', $_POST)) $Search = $_POST['text'];
    4242                else $Search = '';
     43                $SearchHTML = htmlentities($Search);
    4344       
    4445                $Output = '<table class="BaseTable"><tr><th>Skupina</th><th>Výsledků</th></tr>';
     
    5253                        foreach($Group['Items'] as $Item)
    5354                        {
    54                                 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"';
     55                                if($Item['Column'] != '') $sql .= ' OR (`'.$Item['Column'].'` LIKE "%'.$Search.'%")';
    5556                        }
    5657                        $DbResult = $this->Database->query($sql);
    5758                        $Line = $DbResult->fetch_row();
    58                         $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;user=0&amp;state=0&amp;text='.$Search.'&amp;entry=').'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>';
     59                        $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.
     60                          $Group['Id'].'&amp;user=0&amp;state=0&amp;text='.$SearchHTML.'&amp;entry=').'">'.
     61                          $Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>';
    5962                }
    6063       
    6164                $DbResult = $this->Database->query('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"');
    6265                $Line = $DbResult->fetch_row();
    63                 $Output .= '<tr><td><a href="'.$this->System->Link('/userlist.php?search='.$Search).'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>';
     66                $Output .= '<tr><td><a href="'.$this->System->Link('/userlist.php?search='.$SearchHTML).'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>';
    6467       
    6568                $DbResult = $this->Database->query('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"');
    6669                $Line = $DbResult->fetch_row();
    67                 $Output .= '<tr><td><a href="'.$this->System->Link('/team/?search='.$Search).'">Týmy</a></td><td>'.$Line[0].'</td></tr>';
     70                $Output .= '<tr><td><a href="'.$this->System->Link('/team/?search='.$SearchHTML).'">Týmy</a></td><td>'.$Line[0].'</td></tr>';
    6871       
    6972                $DbResult = $this->Database->query('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"');
    7073                $Line = $DbResult->fetch_row();
    7174                $Output .= '<tr><td><a href="'.$this->System->Link('/download.php?addon').'">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>';
    72                 $Output .= '<tr><td><a href="'.$this->System->Link('/aowow/?search='.$Search).'">Vyhledávací databáze AoWoW</a></td></tr>';
     75                $Output .= '<tr><td><a href="'.$this->System->Link('/aowow/?search='.$SearchHTML).'">Vyhledávací databáze AoWoW</a></td></tr>';
    7376       
    7477                $DbResult = $this->Database->query('SELECT count(*) FROM `Dictionary` WHERE '.
    7578                        '(`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = '.$this->System->Config['OriginalLanguage']);
    7679                $Line = $DbResult->fetch_row();
    77                 $Output .= '<tr><td><a href="'.$this->System->Link('/dictionary/?search='.$Search).'">Slovníček</a></td><td>'.$Line[0].'</td></tr>';
     80                $Output .= '<tr><td><a href="'.$this->System->Link('/dictionary/?search='.$SearchHTML).
     81      '">Slovníček</a></td><td>'.$Line[0].'</td></tr>';
    7882       
    7983                $Output .= '</table>';
Note: See TracChangeset for help on using the changeset viewer.