Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create server, database and table SqlControllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
- Loading branch information
1 parent
b247fbe
commit 4d9da96
Showing
7 changed files
with
175 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/* vim: set expandtab sw=4 ts=4 sts=4: */ | ||
/** | ||
* Holds the PhpMyAdmin\Controllers\Database\SqlController | ||
* @package PhpMyAdmin\Controllers\Database | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PhpMyAdmin\Controllers\Database; | ||
|
||
use PhpMyAdmin\Config\PageSettings; | ||
use PhpMyAdmin\SqlQueryForm; | ||
|
||
/** | ||
* Database SQL executor | ||
* @package PhpMyAdmin\Controllers\Database | ||
*/ | ||
class SqlController extends AbstractController | ||
{ | ||
/** | ||
* @param array $params Request parameters | ||
* @return string HTML | ||
*/ | ||
public function index(array $params): string | ||
{ | ||
global $goto, $back; | ||
|
||
PageSettings::showGroup('Sql'); | ||
|
||
require ROOT_PATH . 'libraries/db_common.inc.php'; | ||
|
||
$sqlQueryForm = new SqlQueryForm(); | ||
|
||
/** | ||
* After a syntax error, we return to this script | ||
* with the typed query in the textarea. | ||
*/ | ||
$goto = 'db_sql.php'; | ||
$back = 'db_sql.php'; | ||
|
||
return $sqlQueryForm->getHtml( | ||
true, | ||
false, | ||
isset($params['delimiter']) | ||
? htmlspecialchars($params['delimiter']) | ||
: ';' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/* vim: set expandtab sw=4 ts=4 sts=4: */ | ||
/** | ||
* Holds the PhpMyAdmin\Controllers\Server\SqlController | ||
* @package PhpMyAdmin\Controllers\Server | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PhpMyAdmin\Controllers\Server; | ||
|
||
use PhpMyAdmin\Config\PageSettings; | ||
use PhpMyAdmin\Controllers\AbstractController; | ||
use PhpMyAdmin\SqlQueryForm; | ||
|
||
/** | ||
* Server SQL executor | ||
* @package PhpMyAdmin\Controllers\Server | ||
*/ | ||
class SqlController extends AbstractController | ||
{ | ||
/** | ||
* @return string HTML | ||
*/ | ||
public function index(): string | ||
{ | ||
PageSettings::showGroup('Sql'); | ||
|
||
require_once ROOT_PATH . 'libraries/server_common.inc.php'; | ||
|
||
$sqlQueryForm = new SqlQueryForm(); | ||
|
||
return $sqlQueryForm->getHtml(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
/* vim: set expandtab sw=4 ts=4 sts=4: */ | ||
/** | ||
* Holds the PhpMyAdmin\Controllers\Table\SqlController | ||
* | ||
* @package PhpMyAdmin\Controllers\Table | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace PhpMyAdmin\Controllers\Table; | ||
|
||
use PhpMyAdmin\Config\PageSettings; | ||
use PhpMyAdmin\SqlQueryForm; | ||
|
||
/** | ||
* Table SQL executor | ||
* @package PhpMyAdmin\Controllers\Table | ||
*/ | ||
class SqlController extends AbstractController | ||
{ | ||
/** | ||
* @param array $params Request parameters | ||
* @return string HTML | ||
*/ | ||
public function index(array $params): string | ||
{ | ||
global $url_query, $err_url, $goto, $back; | ||
|
||
PageSettings::showGroup('Sql'); | ||
|
||
require ROOT_PATH . 'libraries/tbl_common.inc.php'; | ||
|
||
$url_query .= '&goto=tbl_sql.php&back=tbl_sql.php'; | ||
$err_url = 'tbl_sql.php' . $err_url; | ||
|
||
/** | ||
* After a syntax error, we return to this script | ||
* with the typed query in the textarea. | ||
*/ | ||
$goto = 'tbl_sql.php'; | ||
$back = 'tbl_sql.php'; | ||
|
||
$sqlQueryForm = new SqlQueryForm(); | ||
|
||
return $sqlQueryForm->getHtml( | ||
true, | ||
false, | ||
isset($params['delimiter']) | ||
? htmlspecialchars($params['delimiter']) | ||
: ';' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ | |
exit; | ||
} | ||
|
||
global $db, $table; | ||
|
||
// Check parameters | ||
PhpMyAdmin\Util::checkParameters(['db', 'table']); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters