Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
committerChristian Foellmann <foellmann@foe-services.de>2014-04-05 17:35:38 +0400
commit9eb27ef6ebc763ddc6f6278462b8ffeed6de0e36 (patch)
treed3b4a1c7ae68cafb05b9d60040c9c22d457cee62 /libraries/db_table_exists.lib.php
parentd472216554769ba596795f23a70c1809fa8897a3 (diff)
INIT phpmyadmin 4.1.12 multilanguage
Diffstat (limited to 'libraries/db_table_exists.lib.php')
-rw-r--r--libraries/db_table_exists.lib.php104
1 files changed, 104 insertions, 0 deletions
diff --git a/libraries/db_table_exists.lib.php b/libraries/db_table_exists.lib.php
new file mode 100644
index 0000000000..706629e488
--- /dev/null
+++ b/libraries/db_table_exists.lib.php
@@ -0,0 +1,104 @@
+<?php
+/* vim: set expandtab sw=4 ts=4 sts=4: */
+/**
+ * Ensure the database and the table exist (else move to the "parent" script)
+ * and display headers
+ *
+ * @package PhpMyAdmin
+ */
+if (! defined('PHPMYADMIN')) {
+ exit;
+}
+
+if (empty($is_db)) {
+ if (strlen($db)) {
+ $is_db = @$GLOBALS['dbi']->selectDb($db);
+ } else {
+ $is_db = false;
+ }
+
+ if (! $is_db) {
+ // not a valid db name -> back to the welcome page
+ if (! defined('IS_TRANSFORMATION_WRAPPER')) {
+ $response = PMA_Response::getInstance();
+ if ($response->isAjax()) {
+ $response->isSuccess(false);
+ $response->addJSON(
+ 'message',
+ PMA_Message::error(__('No databases selected.'))
+ );
+ } else {
+ $url_params = array('reload' => 1);
+ if (isset($message)) {
+ $url_params['message'] = $message;
+ }
+ if (! empty($sql_query)) {
+ $url_params['sql_query'] = $sql_query;
+ }
+ if (isset($show_as_php)) {
+ $url_params['show_as_php'] = $show_as_php;
+ }
+ PMA_sendHeaderLocation(
+ $cfg['PmaAbsoluteUri'] . 'index.php'
+ . PMA_URL_getCommon($url_params, '&')
+ );
+ }
+ exit;
+ }
+ }
+} // end if (ensures db exists)
+
+if (empty($is_table)
+ && !defined('PMA_SUBMIT_MULT')
+ && ! defined('TABLE_MAY_BE_ABSENT')
+) {
+ // Not a valid table name -> back to the db_sql.php
+
+ if (strlen($table)) {
+ $is_table = isset(PMA_Table::$cache[$db][$table]);
+
+ if (! $is_table) {
+ $_result = $GLOBALS['dbi']->tryQuery(
+ 'SHOW TABLES LIKE \'' . PMA_Util::sqlAddSlashes($table, true)
+ . '\';',
+ null, PMA_DatabaseInterface::QUERY_STORE
+ );
+ $is_table = @$GLOBALS['dbi']->numRows($_result);
+ $GLOBALS['dbi']->freeResult($_result);
+ }
+ } else {
+ $is_table = false;
+ }
+
+ if (! $is_table) {
+ if (! defined('IS_TRANSFORMATION_WRAPPER')) {
+ if (strlen($table)) {
+ // SHOW TABLES doesn't show temporary tables, so try select
+ // (as it can happen just in case temporary table, it should be
+ // fast):
+
+ /**
+ * @todo should this check really
+ * only happen if IS_TRANSFORMATION_WRAPPER?
+ */
+ $_result = $GLOBALS['dbi']->tryQuery(
+ 'SELECT COUNT(*) FROM ' . PMA_Util::backquote($table) . ';',
+ null,
+ PMA_DatabaseInterface::QUERY_STORE
+ );
+ $is_table = ($_result && @$GLOBALS['dbi']->numRows($_result));
+ $GLOBALS['dbi']->freeResult($_result);
+ }
+
+ if (! $is_table) {
+ include './db_sql.php';
+ exit;
+ }
+ }
+
+ if (! $is_table) {
+ exit;
+ }
+ }
+} // end if (ensures table exists)
+?>