~ubuntu-branches/ubuntu/lucid/phpmyadmin/lucid

« back to all changes in this revision

Viewing changes to libraries/sqlparser.lib.php

  • Committer: Bazaar Package Importer
  • Author(s): Michal Čihař
  • Date: 2009-06-30 14:05:13 UTC
  • mfrom: (1.2.1 upstream) (36.1.2 karmic)
  • Revision ID: james.westby@ubuntu.com-20090630140513-hz71do3sij2jhm4s
* New upstream version fixing XSS (PMASA-2009-5).
* Document no empty password in README.Debian and the shipped sample
  configuration file (LP: #388703).
* Install service file for avahi (if web service enabled and if avahi is
  installed) (LP: #369244).
* Mention protecting of setup if not using provided configuration snippets
  for webservers.
* Call ucf with --debconf-ok in postrm (Closes: #534894).

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 * page for it to work, I recommend '<link rel="stylesheet" type="text/css"
28
28
 * href="syntax.css.php" />' at the moment.)
29
29
 *
30
 
 * @version $Id: sqlparser.lib.php 12194 2009-01-18 12:20:16Z lem9 $
 
30
 * @version $Id: sqlparser.lib.php 12376 2009-04-19 11:31:14Z lem9 $
 
31
 * @package phpMyAdmin
31
32
 */
32
33
if (! defined('PHPMYADMIN')) {
33
34
    exit;
55
56
    }
56
57
 
57
58
    if (!defined('DEBUG_TIMING')) {
58
 
        // currently we don't need the $pos (token position in query)
59
 
        // for other purposes than LIMIT clause verification,
60
 
        // so many calls to this function do not include the 4th parameter
 
59
        /**
 
60
         * currently we don't need the $pos (token position in query)
 
61
         * for other purposes than LIMIT clause verification,
 
62
         * so many calls to this function do not include the 4th parameter
 
63
         */
61
64
        function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize, $pos = 0)
62
65
        {
63
66
            $arr[] = array('type' => $type, 'data' => $data, 'pos' => $pos);
64
67
            $arrsize++;
65
68
        } // end of the "PMA_SQP_arrayAdd()" function
66
69
    } else {
 
70
        /**
 
71
         * This is debug variant of above.
 
72
         * @ignore
 
73
         */
67
74
        function PMA_SQP_arrayAdd(&$arr, $type, $data, &$arrsize, $pos = 0)
68
75
        {
69
76
            global $timer;
151
158
    {
152
159
        global $SQP_errorString;
153
160
        $debugstr = 'ERROR: ' . $message . "\n";
154
 
        $debugstr .= 'SVN: $Id: sqlparser.lib.php 12194 2009-01-18 12:20:16Z lem9 $' . "\n";
 
161
        $debugstr .= 'SVN: $Id: sqlparser.lib.php 12376 2009-04-19 11:31:14Z lem9 $' . "\n";
155
162
        $debugstr .= 'MySQL: '.PMA_MYSQL_STR_VERSION . "\n";
156
163
        $debugstr .= 'USR OS, AGENT, VER: ' . PMA_USR_OS . ' ' . PMA_USR_BROWSER_AGENT . ' ' . PMA_USR_BROWSER_VER . "\n";
157
164
        $debugstr .= 'PMA: ' . PMA_VERSION . "\n";
1150
1157
                        break;
1151
1158
                } // end switch
1152
1159
 
1153
 
                if ($subresult['querytype'] == 'SELECT' 
 
1160
                if ($subresult['querytype'] == 'SELECT'
1154
1161
                 && ! $in_group_concat
1155
1162
                 && ! ($seen_subquery && $arr[$i - 1]['type'] == 'punct_bracket_close_round')) {
1156
1163
                    if (!$seen_from) {
1705
1712
                    $limit_clause .= $sep;
1706
1713
                }
1707
1714
            }
1708
 
            if ($after_limit && $seen_limit) { 
 
1715
            if ($after_limit && $seen_limit) {
1709
1716
                $section_after_limit .= $arr[$i]['data'] . $sep;
1710
1717
            }
1711
1718
 
1735
1742
        $foreign_key_number = -1;
1736
1743
        $seen_create_table = FALSE;
1737
1744
        $seen_create = FALSE;
 
1745
        $seen_alter = FALSE;
1738
1746
        $in_create_table_fields = FALSE;
1739
1747
        $brackets_level = 0;
1740
1748
        $in_timestamp_options = FALSE;
1755
1763
                    $seen_create = TRUE;
1756
1764
                }
1757
1765
 
 
1766
                if ($upper_data == 'ALTER') {
 
1767
                    $seen_alter = TRUE;
 
1768
                }
 
1769
 
1758
1770
                if ($upper_data == 'TABLE' && $seen_create) {
1759
1771
                    $seen_create_table = TRUE;
1760
1772
                    $create_table_fields = array();
1916
1928
                }
1917
1929
 
1918
1930
                if ($seen_references) {
 
1931
                    if ($seen_alter && $brackets_level > 0) {
 
1932
                        $foreign[$foreign_key_number]['ref_index_list'][] = $identifier;
1919
1933
                    // here, the first bracket level corresponds to the
1920
1934
                    // bracket of CREATE TABLE
1921
1935
                    // so if we are on level 2, it must be the index list
1922
1936
                    // of the foreign key REFERENCES
1923
 
                    if ($brackets_level > 1) {
 
1937
                    } elseif ($brackets_level > 1) {
1924
1938
                        $foreign[$foreign_key_number]['ref_index_list'][] = $identifier;
1925
1939
                    } elseif ($arr[$i+1]['type'] == 'punct_qualifier') {
1926
1940
                        // identifier is `db`.`table`