#jpgraph
#pma
CKEditor_4.6.1
Date
backup
bibelpopup
classes
config
fetch_bibel
fetch_chorbuch
html2pdf-master
html2pdf_v4.03
images
jpgraph
kalender
language
lib
lieder
livesearch
msd
overlib
pma
doc
examples
js
libraries
cache
certs
classes
Charsets
Command
Config
Controllers
Database
Preferences
Server
Setup
Table
AbstractController.php
AddFieldController.php
ChangeController.php
ChartController.php
CreateController.php
DeleteController.php
ExportController.php
FindReplaceController.php
GetFieldController.php
GisVisualizationController.php
ImportController.php
IndexesController.php
MaintenanceController.php
OperationsController.php
PartitionController.php
PrivilegesController.php
RecentFavoriteController.php
RelationController.php
ReplaceController.php
SearchController.php
SqlController.php
StructureController.php
TrackingController.php
TriggersController.php
ZoomSearchController.php
AbstractController.php
BrowseForeignersController.php
ChangeLogController.php
CheckRelationsController.php
ColumnController.php
ConfigController.php
DatabaseController.php
ErrorReportController.php
ExportController.php
ExportTemplateController.php
GisDataEditorController.php
HomeController.php
ImportController.php
ImportStatusController.php
JavaScriptMessagesController.php
LicenseController.php
LintController.php
LogoutController.php
NavigationController.php
NormalizationController.php
PhpInfoController.php
SchemaExportController.php
SqlController.php
TableController.php
ThemesController.php
TransformationOverviewController.php
TransformationWrapperController.php
UserPasswordController.php
VersionCheckController.php
ViewCreateController.php
ViewOperationsController.php
Database
Dbal
Display
Engines
Exceptions
Export
Gis
Html
Import
Navigation
Plugins
Properties
Providers
Query
Server
Setup
Table
Twig
Utils
Advisor.php
Bookmark.php
BrowseForeigners.php
Charsets.php
CheckUserPrivileges.php
Config.php
Console.php
Core.php
CreateAddField.php
DatabaseInterface.php
DbTableExists.php
Encoding.php
Error.php
ErrorHandler.php
ErrorReport.php
Export.php
File.php
FileListing.php
Font.php
Footer.php
Git.php
Header.php
Import.php
Index.php
IndexColumn.php
InsertEdit.php
InternalRelations.php
IpAllowDeny.php
Language.php
LanguageManager.php
Linter.php
ListAbstract.php
ListDatabase.php
Logging.php
Menu.php
Message.php
Mime.php
Normalization.php
OpenDocument.php
Operations.php
OutputBuffering.php
ParseAnalyze.php
Partition.php
Pdf.php
Plugins.php
Profiling.php
RecentFavoriteTable.php
Relation.php
RelationCleanup.php
Replication.php
ReplicationGui.php
ReplicationInfo.php
Response.php
Routing.php
Sanitize.php
SavedSearches.php
Scripts.php
Session.php
Sql.php
SqlQueryForm.php
StorageEngine.php
SubPartition.php
SystemDatabase.php
Table.php
TablePartitionDefinition.php
Template.php
Theme.php
ThemeManager.php
Tracker.php
Tracking.php
Transformations.php
TwoFactor.php
Types.php
Url.php
UserPassword.php
UserPreferences.php
Util.php
Version.php
VersionInformation.php
ZipExtension.php
advisory_rules_generic.php
advisory_rules_mysql_before80003.php
common.inc.php
config.default.php
config.values.php
language_stats.inc.php
routes.php
services.php
services_controllers.php
services_loader.php
vendor_config.php
locale
setup
sql
templates
themes
tmp
vendor
CONTRIBUTING.md
ChangeLog
LICENSE
README
RELEASE-DATE-5.1.1
babel.config.json
composer.json
composer.lock
config.inc.php
config.sample.inc.php
favicon.ico
index.php
package.json
print.css
robots.txt
show_config_errors.php
url.php
yarn.lock
templates
templates_c
validation
++ Umstellung Luther 2017.sql
.gitattributes
.htaccess
Version8_bugs.txt
ajax.js_20170928
ansicht.php
ansicht.php_20200212
ansicht.php_20200915
ansicht.php_lut84_20180219
ansicht2.php
ansicht2.php_20200212
ansicht2.php_20200915
ansicht2.php_lut84_20180219
ausgabe.php
bes_gd.php
bibellookup.php_lut84_20180219
bibellookup_1984.php
bibellookup_2017.php
bibellookup_2017.php_20200212
changelog.php
config.inc.php
copy.js
faq_text.php
faq_text_ber.php
favicon.ico
fetch_data.php
ftp_ansicht.php
ftp_ansicht.php_20181214
func_agent.php
func_ansicht.php
func_ansicht.php_20200212
func_ansicht.php_20200915
func_ansicht.php_lut84_20180219
func_genUser.php
func_highlight.php
func_htmlclean.php
func_make_knk.php
func_make_knk_fa.php
func_make_knk_fa.php_lut84_20180219
func_make_reference_fa.php
func_make_reference_fa.php_lut84_20180219
func_rollenrechte.php
func_rollenrechte_20220202.php
func_write_lue_kat.php
further_publication.php
getSubCat.php
graph.php
graph_einzel.php
graph_hauptframe.php
graph_user.php
graph_user_hauptframe.php
hauptframe.php
hello.cgi
hello.pl
hilfe.php
historie.php
index.php
index2.php
indexframe.php
info.php
job_mail_delete_neue_user.php
job_mail_inaktiv.php
job_user_delete_neue_user.php
job_user_inaktiv.php
jquery.min.js
kat_cont.php
kat_cont.php_20201230
kat_cont.php_20221013
kat_cont_fa.php
kat_main.php
kat_main.php_lut84_20180219
kat_main_fa.php
kat_main_fa.php_lut84_20180219
katechismus.php
katechismus_fa.php
lesung.php
lieder.php
lieder.zip
livesearch.php
livestat.js
livestat.php
livestat2.php
login_log.php
logininfo.php
logout_admin.php
lue_ansicht.php
lue_bearbeiten.php
lue_erfassen.php
lue_inhalt.php
lue_inhalt.php_20200915
lue_inhalt.php_lut84_20180219
lue_notizen.php
lue_suche.php
lue_wahl.php
mail.php
make_ical.php
menuframe.php
nachsenden.php
notizen.php
outlook.php
outlook.php_20200212
outlook_ics.php
outlook_vcs.php
passwort_switch.php
pdf_gen.php
pdf_gen.php_20200915
pdf_gen.php_lut84_20180219
preview.php
profil.php
rollen.php
search_note.php
stichworte.php
suche.php
suche.php_20170928
suche_change.php
suche_simp.php
systemmail.php
test.php
test2.php
testmail.php
testmail2.php
topframe.php
upload.php
user_anlegen.php
user_bearbeiten.php
useronline.php
verweise.php
wort_bearbeiten.php
wort_bearbeiten.php_20170928
wort_erfassen.php
wort_erfassen.php_20170928
wort_exegese.php
wort_wahl.php
176 lines
5.3 KiB
PHP
176 lines
5.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpMyAdmin\Controllers\Table;
|
|
|
|
use PhpMyAdmin\Config\PageSettings;
|
|
use PhpMyAdmin\Export\Options;
|
|
use PhpMyAdmin\Html\Generator;
|
|
use PhpMyAdmin\Message;
|
|
use PhpMyAdmin\Plugins;
|
|
use PhpMyAdmin\Response;
|
|
use PhpMyAdmin\SqlParser\Parser;
|
|
use PhpMyAdmin\SqlParser\Statements\SelectStatement;
|
|
use PhpMyAdmin\SqlParser\Utils\Query;
|
|
use PhpMyAdmin\Template;
|
|
use PhpMyAdmin\Url;
|
|
use PhpMyAdmin\Util;
|
|
use function array_merge;
|
|
use function implode;
|
|
use function is_array;
|
|
|
|
class ExportController extends AbstractController
|
|
{
|
|
/** @var Options */
|
|
private $export;
|
|
|
|
/**
|
|
* @param Response $response
|
|
* @param string $db Database name.
|
|
* @param string $table Table name.
|
|
*/
|
|
public function __construct(
|
|
$response,
|
|
Template $template,
|
|
$db,
|
|
$table,
|
|
Options $export
|
|
) {
|
|
parent::__construct($response, $template, $db, $table);
|
|
$this->export = $export;
|
|
}
|
|
|
|
public function index(): void
|
|
{
|
|
global $db, $url_params, $table, $replaces, $cfg, $err_url;
|
|
global $sql_query, $where_clause, $num_tables, $unlim_num_rows;
|
|
|
|
$pageSettings = new PageSettings('Export');
|
|
$pageSettingsErrorHtml = $pageSettings->getErrorHTML();
|
|
$pageSettingsHtml = $pageSettings->getHTML();
|
|
|
|
$this->addScriptFiles(['export.js']);
|
|
|
|
Util::checkParameters(['db', 'table']);
|
|
|
|
$url_params = ['db' => $db, 'table' => $table];
|
|
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
|
$err_url .= Url::getCommon($url_params, '&');
|
|
|
|
$url_params['goto'] = Url::getFromRoute('/table/export');
|
|
$url_params['back'] = Url::getFromRoute('/table/export');
|
|
|
|
$message = '';
|
|
|
|
// When we have some query, we need to remove LIMIT from that and possibly
|
|
// generate WHERE clause (if we are asked to export specific rows)
|
|
|
|
if (! empty($sql_query)) {
|
|
$parser = new Parser($sql_query);
|
|
|
|
if (! empty($parser->statements[0])
|
|
&& ($parser->statements[0] instanceof SelectStatement)
|
|
) {
|
|
// Checking if the WHERE clause has to be replaced.
|
|
if (! empty($where_clause) && is_array($where_clause)) {
|
|
$replaces[] = [
|
|
'WHERE',
|
|
'WHERE (' . implode(') OR (', $where_clause) . ')',
|
|
];
|
|
}
|
|
|
|
// Preparing to remove the LIMIT clause.
|
|
$replaces[] = [
|
|
'LIMIT',
|
|
'',
|
|
];
|
|
|
|
// Replacing the clauses.
|
|
$sql_query = Query::replaceClauses(
|
|
$parser->statements[0],
|
|
$parser->list,
|
|
$replaces
|
|
);
|
|
}
|
|
|
|
$message = Generator::getMessage(Message::success());
|
|
}
|
|
|
|
if (! isset($sql_query)) {
|
|
$sql_query = '';
|
|
}
|
|
if (! isset($num_tables)) {
|
|
$num_tables = 0;
|
|
}
|
|
if (! isset($unlim_num_rows)) {
|
|
$unlim_num_rows = 0;
|
|
}
|
|
|
|
$GLOBALS['single_table'] = $_POST['single_table'] ?? $_GET['single_table'] ?? $GLOBALS['single_table'] ?? null;
|
|
|
|
$exportList = Plugins::getExport('table', isset($GLOBALS['single_table']));
|
|
|
|
if (empty($exportList)) {
|
|
$this->response->addHTML(Message::error(
|
|
__('Could not load export plugins, please check your installation!')
|
|
)->getDisplay());
|
|
|
|
return;
|
|
}
|
|
|
|
$exportType = 'table';
|
|
$isReturnBackFromRawExport = isset($_POST['export_type']) && $_POST['export_type'] === 'raw';
|
|
if (isset($_POST['raw_query']) || $isReturnBackFromRawExport) {
|
|
$exportType = 'raw';
|
|
}
|
|
|
|
$options = $this->export->getOptions(
|
|
$exportType,
|
|
$db,
|
|
$table,
|
|
$sql_query,
|
|
$num_tables,
|
|
$unlim_num_rows,
|
|
$exportList
|
|
);
|
|
|
|
$this->render('table/export/index', array_merge($options, [
|
|
'export_type' => $exportType,
|
|
'page_settings_error_html' => $pageSettingsErrorHtml,
|
|
'page_settings_html' => $pageSettingsHtml,
|
|
'message' => $message,
|
|
]));
|
|
}
|
|
|
|
public function rows(): void
|
|
{
|
|
global $active_page, $single_table, $where_clause;
|
|
|
|
if (isset($_POST['goto']) && (! isset($_POST['rows_to_delete']) || ! is_array($_POST['rows_to_delete']))) {
|
|
$this->response->setRequestStatus(false);
|
|
$this->response->addJSON('message', __('No row selected.'));
|
|
|
|
return;
|
|
}
|
|
|
|
// Needed to allow SQL export
|
|
$single_table = true;
|
|
|
|
// As we got the rows to be exported from the
|
|
// 'rows_to_delete' checkbox, we use the index of it as the
|
|
// indicating WHERE clause. Then we build the array which is used
|
|
// for the /table/change script.
|
|
$where_clause = [];
|
|
if (isset($_POST['rows_to_delete']) && is_array($_POST['rows_to_delete'])) {
|
|
foreach ($_POST['rows_to_delete'] as $i => $i_where_clause) {
|
|
$where_clause[] = $i_where_clause;
|
|
}
|
|
}
|
|
|
|
$active_page = Url::getFromRoute('/table/export');
|
|
|
|
$this->index();
|
|
}
|
|
}
|