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

« back to all changes in this revision

Viewing changes to libraries/import/sql.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:
4
4
 * SQL import plugin for phpMyAdmin
5
5
 *
6
6
 * @version $Id: sql.php 12370 2009-04-17 16:58:53Z lem9 $
 
7
 * @package phpMyAdmin-Import
7
8
 */
8
9
if (! defined('PHPMYADMIN')) {
9
10
    exit;
35
36
                    'Server_SQL_mode',
36
37
                ),
37
38
            ),
 
39
            array(
 
40
                'type' => 'bool', 
 
41
                'name' => 'no_auto_value_on_zero', 
 
42
                'text' => 'strDoNotAutoIncrementZeroValues',
 
43
                'doc'       => array(
 
44
                    'manual_MySQL_Database_Administration',
 
45
                    'Server_SQL_mode',
 
46
                    'sqlmode_no_auto_value_on_zero'
 
47
                ),
 
48
 
 
49
            ),
38
50
        );
39
51
    }
40
52
 
56
68
    $sql_delimiter = ';';
57
69
}
58
70
 
59
 
// Handle compatibility option
60
 
if (isset($_REQUEST['sql_compatibility'])) {
61
 
    PMA_DBI_try_query('SET SQL_MODE="' . $_REQUEST['sql_compatibility'] . '"');
62
 
}
 
71
// Handle compatibility options
 
72
$sql_modes = array();
 
73
if (isset($_REQUEST['sql_compatibility']) && 'NONE' != $_REQUEST['sql_compatibility']) {
 
74
    $sql_modes[] = $_REQUEST['sql_compatibility'];
 
75
}
 
76
if (isset($_REQUEST['sql_no_auto_value_on_zero'])) {
 
77
    $sql_modes[] = 'NO_AUTO_VALUE_ON_ZERO';
 
78
}
 
79
if (count($sql_modes) > 0) {
 
80
    PMA_DBI_try_query('SET SQL_MODE="' . implode(',', $sql_modes) . '"');
 
81
}
 
82
unset($sql_modes);
63
83
 
64
84
/**
65
85
 * will be set in PMA_importGetNextChunk()
88
108
    }
89
109
    // Current length of our buffer
90
110
    $len = strlen($buffer);
91
 
    
 
111
 
92
112
    // Grab some SQL queries out of it
93
113
    while ($i < $len) {
94
114
        $found_delimiter = false;
97
117
        // this is about 7 times faster that looking for each sequence i
98
118
        // one by one with strpos()
99
119
        if (preg_match('/(\'|"|#|-- |\/\*|`|(?i)DELIMITER)/', $buffer, $matches, PREG_OFFSET_CAPTURE, $i)) {
100
 
            // in $matches, index 0 contains the match for the complete 
 
120
            // in $matches, index 0 contains the match for the complete
101
121
            // expression but we don't use it
102
122
            $first_position = $matches[1][1];
103
123
        } else {