Server IP : 85.214.239.14 / Your IP : 3.145.79.214 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/root/var/www/wordpress/phpMyAdmin/libraries/classes/Database/ |
Upload File : |
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Handles DB Multi-table query * * @package PhpMyAdmin */ declare(strict_types=1); namespace PhpMyAdmin\Database; use PhpMyAdmin\DatabaseInterface; use PhpMyAdmin\ParseAnalyze; use PhpMyAdmin\Sql; use PhpMyAdmin\Template; /** * Class to handle database Multi-table querying * * @package PhpMyAdmin */ class MultiTableQuery { /** * DatabaseInterface instance * * @access private * @var DatabaseInterface */ private $dbi; /** * Database name * * @access private * @var string */ private $db; /** * Default number of columns * * @access private * @var integer */ private $defaultNoOfColumns; /** * Table names * * @access private * @var array */ private $tables; /** * @var Template */ public $template; /** * Constructor * * @param DatabaseInterface $dbi DatabaseInterface instance * @param Template $template Template instance * @param string $dbName Database name * @param integer $defaultNoOfColumns Default number of columns */ public function __construct( DatabaseInterface $dbi, Template $template, $dbName, $defaultNoOfColumns = 3 ) { $this->dbi = $dbi; $this->db = $dbName; $this->defaultNoOfColumns = $defaultNoOfColumns; $this->template = $template; $this->tables = $this->dbi->getTables($this->db); } /** * Get Multi-Table query page HTML * * @return string Multi-Table query page HTML */ public function getFormHtml() { $tables = []; foreach ($this->tables as $table) { $tables[$table]['hash'] = md5($table); $tables[$table]['columns'] = array_keys( $this->dbi->getColumns($this->db, $table) ); } return $this->template->render('database/multi_table_query/form', [ 'db' => $this->db, 'tables' => $tables, 'default_no_of_columns' => $this->defaultNoOfColumns, ]); } /** * Displays multi-table query results * * @param string $sqlQuery The query to parse * @param string $db The current database * @param string $pmaThemeImage Uri of the PMA theme image * * @return void */ public static function displayResults($sqlQuery, $db, $pmaThemeImage) { list( $analyzedSqlResults, $db, ) = ParseAnalyze::sqlQuery($sqlQuery, $db); extract($analyzedSqlResults); $goto = 'db_multi_table_query.php'; $sql = new Sql(); $sql->executeQueryAndSendQueryResponse( null, // analyzed_sql_results false, // is_gotofile $db, // db null, // table null, // find_real_end null, // sql_query_for_bookmark - see below null, // extra_data null, // message_to_show null, // message null, // sql_data $goto, // goto $pmaThemeImage, // pmaThemeImage null, // disp_query null, // disp_message null, // query_type $sqlQuery, // sql_query null, // selectedTables null // complete_query ); } }