diff --git a/libraries/auth/config.auth.lib.php b/libraries/auth/config.auth.lib.php
deleted file mode 100644
index dbcc0bf847..0000000000
--- a/libraries/auth/config.auth.lib.php
+++ /dev/null
@@ -1,135 +0,0 @@
- authentication failed
- *
- * @global string the MySQL error message PHP returns
- * @global string the connection type (persistent or not)
- * @global string the MySQL server port to use
- * @global string the MySQL socket port to use
- * @global array the current server settings
- * @global string the font face to use in case of failure
- * @global string the default font size to use in case of failure
- * @global string the big font size to use in case of failure
- * @global boolean tell the "mysqlDie()" function headers have been
- * sent
- *
- * @return boolean always true (no return indeed)
- *
- * @access public
- */
-function PMA_auth_fails()
-{
- $conn_error = PMA_DBI_getError();
- if (! $conn_error) {
- $conn_error = __('Cannot connect: invalid settings.');
- }
-
- /* HTML header */
- $response = PMA_Response::getInstance();
- $response->getFooter()->setMinimal();
- $header = $response->getHeader();
- $header->setTitle(__('Access denied'));
- $header->disableMenu();
-
-?>
-
-
|
- source_mtime == 0) {
- echo ' ' . sprintf(__('You probably did not create a configuration file. You might want to use the %1$ssetup script%2$s to create one.'), '', '') . ' ' . "\n"; - } elseif (! isset($GLOBALS['errno']) - || (isset($GLOBALS['errno']) && $GLOBALS['errno'] != 2002) - && $GLOBALS['errno'] != 2003 - ) { - // if we display the "Server not responding" error, do not confuse users - // by telling them they have a settings problem - // (note: it's true that they could have a badly typed host name, but - // anyway the current message tells that the server - // rejected the connection, which is not really what happened) - // 2002 is the error given by mysqli - // 2003 is the error given by mysql - trigger_error(__('phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.'), E_USER_WARNING); - } - PMA_CommonFunctions::getInstance()->mysqlDie( - $conn_error, '', true, '', false - ); - } - $GLOBALS['error_handler']->dispUserErrors(); -?> - |
-
| ' . "\n"; - PMA_selectServer(true, true); - echo ' | ' . "\n"; - echo '
' . $line . '
'; - $inf = explode('|', $line); - if (!empty($inf[1]) && strlen(trim($inf[1])) > 0) { - $qry = ' - INSERT INTO - ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['column_info']) . ' - (db_name, table_name, column_name, comment) - VALUES ( - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($tab)) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[0])) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[1])) . '\')'; - PMA_importRunQuery($qry, $qry . '-- ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]), true); - } // end inf[1] exists - if (!empty($inf[2]) && strlen(trim($inf[2])) > 0) { - $for = explode('->', $inf[2]); - $qry = ' - INSERT INTO - ' . $common_functions->backquote($cfgRelation['db']) . '.' . $common_functions->backquote($cfgRelation['relation']) . ' - (master_db, master_table, master_field, foreign_db, foreign_table, foreign_field) - VALUES ( - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($tab)) . '\', - \'' . $common_functions->sqlAddSlashes(trim($inf[0])) . '\', - \'' . $common_functions->sqlAddSlashes($GLOBALS['db']) . '\', - \'' . $common_functions->sqlAddSlashes(trim($for[0])) . '\', - \'' . $common_functions->sqlAddSlashes(trim($for[1])) . '\')'; - PMA_importRunQuery($qry, $qry . '-- ' . htmlspecialchars($tab) . '.' . htmlspecialchars($inf[0]) . '(' . htmlspecialchars($inf[2]) . ')', true); - } // end inf[2] exists - } // End lines loop -} // End import -// Commit any possible data in buffers -PMA_importRunQuery(); -?> diff --git a/libraries/import/ldi.php b/libraries/import/ldi.php deleted file mode 100644 index 735d17cb5d..0000000000 --- a/libraries/import/ldi.php +++ /dev/null @@ -1,159 +0,0 @@ - 0) { - $tmp = PMA_DBI_fetch_row($result); - if ($tmp[1] == 'ON') { - $GLOBALS['cfg']['Import']['ldi_local_option'] = true; - } - } - PMA_DBI_free_result($result); - unset($result); - } - $plugin_list['ldi'] = array( - 'text' => __('CSV using LOAD DATA'), - // Following is nonsense, however we want to default to our parser for csv - 'extension' => 'ldi', - 'options' => array( - array( - 'type' => 'begin_group', - 'name' => 'general_opts' - ), - array( - 'type' => 'bool', - 'name' => 'replace', - 'text' => __('Replace table data with file') - ), - array( - 'type' => 'bool', - 'name' => 'ignore', - 'text' => __('Do not abort on INSERT error') - ), - array( - 'type' => 'text', - 'name' => 'terminated', - 'text' => __('Columns terminated by'), - 'size' => 2, - 'len' => 2 - ), - array( - 'type' => 'text', - 'name' => 'enclosed', - 'text' => __('Columns enclosed by'), - 'size' => 2, - 'len' => 2 - ), - array( - 'type' => 'text', - 'name' => 'escaped', - 'text' => __('Columns escaped by'), - 'size' => 2, - 'len' => 2 - ), - array( - 'type' => 'text', - 'name' => 'new_line', - 'text' => __('Lines terminated by'), - 'size' => 2 - ), - array( - 'type' => 'text', - 'name' => 'columns', - 'text' => __('Column names') - ), - array( - 'type' => 'bool', - 'name' => 'local_option', - 'text' => __('Use LOCAL keyword') - ), - array( - 'type' => 'end_group' - ) - ), - 'options_text' => __('Options'), - ); - /* We do not define function when plugin is just queried for information above */ - return; -} - -if ($import_file == 'none' || $compression != 'none' || $charset_conversion) { - // We handle only some kind of data! - $message = PMA_Message::error(__('This plugin does not support compressed imports!')); - $error = true; - return; -} - -$sql = 'LOAD DATA'; -if (isset($ldi_local_option)) { - $sql .= ' LOCAL'; -} -$sql .= ' INFILE \'' . $common_functions->sqlAddSlashes($import_file) . '\''; -if (isset($ldi_replace)) { - $sql .= ' REPLACE'; -} elseif (isset($ldi_ignore)) { - $sql .= ' IGNORE'; -} -$sql .= ' INTO TABLE ' . $common_functions->backquote($table); - -if (strlen($ldi_terminated) > 0) { - $sql .= ' FIELDS TERMINATED BY \'' . $ldi_terminated . '\''; -} -if (strlen($ldi_enclosed) > 0) { - $sql .= ' ENCLOSED BY \'' . $common_functions->sqlAddSlashes($ldi_enclosed) . '\''; -} -if (strlen($ldi_escaped) > 0) { - $sql .= ' ESCAPED BY \'' . $common_functions->sqlAddSlashes($ldi_escaped) . '\''; -} -if (strlen($ldi_new_line) > 0) { - if ($ldi_new_line == 'auto') { - $ldi_new_line = ($common_functions->whichCrlf() == "\n") - ? '\n' - : '\r\n'; - } - $sql .= ' LINES TERMINATED BY \'' . $ldi_new_line . '\''; -} -if ($skip_queries > 0) { - $sql .= ' IGNORE ' . $skip_queries . ' LINES'; - $skip_queries = 0; -} -if (strlen($ldi_columns) > 0) { - $sql .= ' ('; - $tmp = preg_split('/,( ?)/', $ldi_columns); - $cnt_tmp = count($tmp); - for ($i = 0; $i < $cnt_tmp; $i++) { - if ($i > 0) { - $sql .= ', '; - } - /* Trim also `, if user already included backquoted fields */ - $sql .= $common_functions->backquote(trim($tmp[$i], " \t\r\n\0\x0B`")); - } // end for - $sql .= ')'; -} - -PMA_importRunQuery($sql, $sql); -PMA_importRunQuery(); -$finished = true; -?> diff --git a/libraries/import/xml.php b/libraries/import/xml.php deleted file mode 100644 index 7f54554b1c..0000000000 --- a/libraries/import/xml.php +++ /dev/null @@ -1,318 +0,0 @@ - __('XML'), - 'extension' => 'xml', - 'options' => array( - ), - 'options_text' => __('Options'), - ); - /* We do not define function when plugin is just queried for information above */ - return; -} - -$i = 0; -$len = 0; -$buffer = ""; - -/** - * Read in the file via PMA_importGetNextChunk so that - * it can process compressed files - */ -while (! ($finished && $i >= $len) && ! $error && ! $timeout_passed) { - $data = PMA_importGetNextChunk(); - if ($data === false) { - /* subtract data we didn't handle yet and stop processing */ - $offset -= strlen($buffer); - break; - } elseif ($data === true) { - /* Handle rest of buffer */ - } else { - /* Append new data to buffer */ - $buffer .= $data; - unset($data); - } -} - -unset($data); - -/** - * Disable loading of external XML entities. - */ -libxml_disable_entity_loader(); - -/** - * Load the XML string - * - * The option LIBXML_COMPACT is specified because it can - * result in increased performance without the need to - * alter the code in any way. It's basically a freebee. - */ -$xml = simplexml_load_string($buffer, "SimpleXMLElement", LIBXML_COMPACT); - -unset($buffer); - -/** - * The XML was malformed - */ -if ($xml === false) { - PMA_Message::error(__('The XML file specified was either malformed or incomplete. Please correct the issue and try again.'))->display(); - unset($xml); - $GLOBALS['finished'] = false; - return; -} - -/** - * Table accumulator - */ -$tables = array(); -/** - * Row accumulator - */ -$rows = array(); - -/** - * Temp arrays - */ -$tempRow = array(); -$tempCells = array(); - -/** - * CREATE code included (by default: no) - */ -$struct_present = false; - -/** - * Analyze the data in each table - */ -$namespaces = $xml->getNameSpaces(true); - -/** - * Get the database name, collation and charset - */ -$db_attr = $xml->children($namespaces['pma'])->{'structure_schemas'}->{'database'}; - -if ($db_attr instanceof SimpleXMLElement) { - $db_attr = $db_attr->attributes(); - $db_name = (string)$db_attr['name']; - $collation = (string)$db_attr['collation']; - $charset = (string)$db_attr['charset']; -} else { - /** - * If the structure section is not present - * get the database name from the data section - */ - $db_attr = $xml->children()->attributes(); - $db_name = (string)$db_attr['name']; - $collation = null; - $charset = null; -} - -/** - * The XML was malformed - */ -if ($db_name === null) { - PMA_Message::error(__('The XML file specified was either malformed or incomplete. Please correct the issue and try again.'))->display(); - unset($xml); - $GLOBALS['finished'] = false; - return; -} - -/** - * Retrieve the structure information - */ -if (isset($namespaces['pma'])) { - /** - * Get structures for all tables - */ - $struct = $xml->children($namespaces['pma']); - - $create = array(); - - foreach ($struct as $tier1 => $val1) { - foreach ($val1 as $tier2 => $val2) { - // Need to select the correct database for the creation of tables, - // views, triggers, etc. - /** - * @todo Generating a USE here blocks importing of a table - * into another database. - */ - $attrs = $val2->attributes(); - $create[] = "USE " . PMA_CommonFunctions::getInstance()->backquote($attrs["name"]); - - foreach ($val2 as $val3) { - /** - * Remove the extra cosmetic spacing - */ - $val3 = str_replace(" ", "", (string)$val3); - $create[] = $val3; - } - } - } - - $struct_present = true; -} - -/** - * Move down the XML tree to the actual data - */ -$xml = $xml->children()->children(); - -$data_present = false; - -/** - * Only attempt to analyze/collect data if there is data present - */ -if ($xml && @$xml->count()) { - $data_present = true; - - /** - * Process all database content - */ - foreach ($xml as $k1 => $v1) { - $tbl_attr = $v1->attributes(); - - $isInTables = false; - for ($i = 0; $i < count($tables); ++$i) { - if (! strcmp($tables[$i][TBL_NAME], (string)$tbl_attr['name'])) { - $isInTables = true; - break; - } - } - - if ($isInTables == false) { - $tables[] = array((string)$tbl_attr['name']); - } - - foreach ($v1 as $k2 => $v2) { - $row_attr = $v2->attributes(); - if (! array_search((string)$row_attr['name'], $tempRow)) { - $tempRow[] = (string)$row_attr['name']; - } - $tempCells[] = (string)$v2; - } - - $rows[] = array((string)$tbl_attr['name'], $tempRow, $tempCells); - - $tempRow = array(); - $tempCells = array(); - } - - unset($tempRow); - unset($tempCells); - unset($xml); - - /** - * Bring accumulated rows into the corresponding table - */ - $num_tbls = count($tables); - for ($i = 0; $i < $num_tbls; ++$i) { - for ($j = 0; $j < count($rows); ++$j) { - if (! strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) { - if (! isset($tables[$i][COL_NAMES])) { - $tables[$i][] = $rows[$j][COL_NAMES]; - } - - $tables[$i][ROWS][] = $rows[$j][ROWS]; - } - } - } - - unset($rows); - - if (! $struct_present) { - $analyses = array(); - - $len = count($tables); - for ($i = 0; $i < $len; ++$i) { - $analyses[] = PMA_analyzeTable($tables[$i]); - } - } -} - -unset($xml); -unset($tempRows); -unset($tempCells); -unset($rows); - -/** - * Only build SQL from data if there is data present - */ -if ($data_present) { - /** - * Set values to NULL if they were not present - * to maintain PMA_buildSQL() call integrity - */ - if (! isset($analyses)) { - $analyses = null; - if (! $struct_present) { - $create = null; - } - } -} - -/** - * string $db_name (no backquotes) - * - * array $table = array(table_name, array() column_names, array()() rows) - * array $tables = array of "$table"s - * - * array $analysis = array(array() column_types, array() column_sizes) - * array $analyses = array of "$analysis"s - * - * array $create = array of SQL strings - * - * array $options = an associative array of options - */ - -/* Set database name to the currently selected one, if applicable */ -if (strlen($db)) { - /* Override the database name in the XML file, if one is selected */ - $db_name = $db; - $options = array('create_db' => false); -} else { - if ($db_name === null) { - $db_name = 'XML_DB'; - } - - /* Set database collation/charset */ - $options = array( - 'db_collation' => $collation, - 'db_charset' => $charset, - ); -} - -/* Created and execute necessary SQL statements from data */ -PMA_buildSQL($db_name, $tables, $analyses, $create, $options); - -unset($analyses); -unset($tables); -unset($create); - -/* Commit any possible data in buffers */ -PMA_importRunQuery(); -?> diff --git a/libraries/transformations/text_plain__dateformat.inc.php b/libraries/transformations/text_plain__dateformat.inc.php deleted file mode 100644 index 8ee04944fa..0000000000 --- a/libraries/transformations/text_plain__dateformat.inc.php +++ /dev/null @@ -1,105 +0,0 @@ - __('Displays a TIME, TIMESTAMP, DATETIME or numeric unix timestamp column as formatted date. The first option is the offset (in hours) which will be added to the timestamp (Default: 0). Use second option to specify a different date/time format string. Third option determines whether you want to see local date or UTC one (use "local" or "utc" strings) for that. According to that, date format has different value - for "local" see the documentation for PHP\'s strftime() function and for "utc" it is done using gmdate() function.'), - ); -} - -/** - * - */ -function PMA_transformation_text_plain__dateformat($buffer, $options = array(), $meta = '') -{ - // possibly use a global transform and feed it with special options - - // further operations on $buffer using the $options[] array. - if (empty($options[0])) { - $options[0] = 0; - } - - if (empty($options[2])) { - $options[2] = 'local'; - } else { - $options[2] = strtolower($options[2]); - } - - if (empty($options[1])) { - if ($options[2] == 'local') { - $options[1] = __('%B %d, %Y at %I:%M %p'); - } else { - $options[1] = 'Y-m-d H:i:s'; - } - } - - $timestamp = -1; - - // INT columns will be treated as UNIX timestamps - // and need to be detected before the verification for - // MySQL TIMESTAMP - if ($meta->type == 'int') { - $timestamp = $buffer; - - // Detect TIMESTAMP(6 | 8 | 10 | 12 | 14) - // TIMESTAMP (2 | 4) not supported here. - // (Note: prior to MySQL 4.1, TIMESTAMP has a display size, for example - // TIMESTAMP(8) means YYYYMMDD) - } else if (preg_match('/^(\d{2}){3,7}$/', $buffer)) { - - if (strlen($buffer) == 14 || strlen($buffer) == 8) { - $offset = 4; - } else { - $offset = 2; - } - - $d = array(); - $d['year'] = substr($buffer, 0, $offset); - $d['month'] = substr($buffer, $offset, 2); - $d['day'] = substr($buffer, $offset + 2, 2); - $d['hour'] = substr($buffer, $offset + 4, 2); - $d['minute'] = substr($buffer, $offset + 6, 2); - $d['second'] = substr($buffer, $offset + 8, 2); - - if (checkdate($d['month'], $d['day'], $d['year'])) { - $timestamp = mktime($d['hour'], $d['minute'], $d['second'], $d['month'], $d['day'], $d['year']); - } - // If all fails, assume one of the dozens of valid strtime() syntaxes (http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html) - } else { - if (preg_match('/^[0-9]\d{1,9}$/', $buffer)) { - $timestamp = (int)$buffer; - } else { - $timestamp = strtotime($buffer); - } - } - - // If all above failed, maybe it's a Unix timestamp already? - if ($timestamp < 0 && preg_match('/^[1-9]\d{1,9}$/', $buffer)) { - $timestamp = $buffer; - } - - // Reformat a valid timestamp - if ($timestamp >= 0) { - $timestamp -= $options[0] * 60 * 60; - $source = $buffer; - if ($options[2] == 'local') { - $text = PMA_CommonFunctions::getInstance()->localisedDate($timestamp, $options[1]); - } elseif ($options[2] == 'utc') { - $text = gmdate($options[1], $timestamp); - } else { - $text = 'INVALID DATE TYPE'; - } - $buffer = '' . $text . ''; - } - - return $buffer; -} - -?>