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:
authorMaurício Meneghini Fauth <mauriciofauth@gmail.com>2017-11-06 03:21:58 +0300
committerMaurício Meneghini Fauth <mauriciofauth@gmail.com>2017-11-06 03:21:58 +0300
commit5a70c1d8951d9f6bd129bdf596e951f3f195e544 (patch)
tree94bf7c0670d52edb4a8b573fa07d0555a2360702 /db_central_columns.php
parent663799d0c2d8b8e3322bb5f47cbfa8ec6dec2b97 (diff)
Replace globals with DI in CentralColumns class
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'db_central_columns.php')
-rw-r--r--db_central_columns.php85
1 files changed, 71 insertions, 14 deletions
diff --git a/db_central_columns.php b/db_central_columns.php
index d23aa1bcba..b655c7137b 100644
--- a/db_central_columns.php
+++ b/db_central_columns.php
@@ -34,12 +34,14 @@ if (isset($_POST['edit_save']) || isset($_POST['add_new_column'])) {
$collation = $_POST['collation'];
if (isset($orig_col_name) && $orig_col_name) {
echo CentralColumns::updateOneColumn(
+ $GLOBALS['dbi'], $GLOBALS['cfg']['Server']['user'],
$db, $orig_col_name, $col_name, $col_type, $col_attribute,
$col_length, $col_isNull, $collation, $col_extra, $col_default
);
exit;
} else {
$tmp_msg = CentralColumns::updateOneColumn(
+ $GLOBALS['dbi'], $GLOBALS['cfg']['Server']['user'],
$db, "", $col_name, $col_type, $col_attribute,
$col_length, $col_isNull, $collation, $col_extra, $col_default
);
@@ -47,18 +49,34 @@ if (isset($_POST['edit_save']) || isset($_POST['add_new_column'])) {
}
if (isset($_POST['populateColumns'])) {
$selected_tbl = $_POST['selectedTable'];
- echo CentralColumns::getHtmlForColumnDropdown($db, $selected_tbl);
+ echo CentralColumns::getHtmlForColumnDropdown(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $db,
+ $selected_tbl
+ );
exit;
}
if (isset($_POST['getColumnList'])) {
- echo CentralColumns::getListRaw($db, $_POST['cur_table']);
+ echo CentralColumns::getListRaw(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $db,
+ $_POST['cur_table']
+ );
exit;
}
if (isset($_POST['add_column'])) {
$selected_col = array();
$selected_tbl = $_POST['table-select'];
$selected_col[] = $_POST['column-select'];
- $tmp_msg = CentralColumns::syncUniqueColumns($selected_col, false, $selected_tbl);
+ $tmp_msg = CentralColumns::syncUniqueColumns(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $selected_col,
+ false,
+ $selected_tbl
+ );
}
$response = Response::getInstance();
$header = $response->getHeader();
@@ -66,7 +84,7 @@ $scripts = $header->getScripts();
$scripts->addFile('vendor/jquery/jquery.uitablefilter.js');
$scripts->addFile('vendor/jquery/jquery.tablesorter.js');
$scripts->addFile('db_central_columns.js');
-$cfgCentralColumns = CentralColumns::getParams();
+$cfgCentralColumns = CentralColumns::getParams($GLOBALS['cfg']['Server']['user']);
$pmadb = $cfgCentralColumns['db'];
$pmatable = $cfgCentralColumns['table'];
$max_rows = intval($GLOBALS['cfg']['MaxRows']);
@@ -75,13 +93,21 @@ if (isset($_REQUEST['edit_central_columns_page'])) {
$selected_fld = $_REQUEST['selected_fld'];
$selected_db = $_REQUEST['db'];
$edit_central_column_page = CentralColumns::getHtmlForEditingPage(
- $selected_fld, $selected_db
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $GLOBALS['cfg']['MaxRows'],
+ $GLOBALS['cfg']['CharEditing'],
+ $selected_fld,
+ $selected_db
);
$response->addHTML($edit_central_column_page);
exit;
}
if (isset($_POST['multi_edit_central_column_save'])) {
- $message = CentralColumns::updateMultipleColumn();
+ $message = CentralColumns::updateMultipleColumn(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user']
+ );
if (!is_bool($message)) {
$response->setRequestStatus(false);
$response->addJSON('message', $message);
@@ -90,19 +116,34 @@ if (isset($_POST['multi_edit_central_column_save'])) {
if (isset($_POST['delete_save'])) {
$col_name = array();
parse_str($_POST['col_name'], $col_name);
- $tmp_msg = CentralColumns::deleteColumnsFromList($col_name['selected_fld'], false);
+ $tmp_msg = CentralColumns::deleteColumnsFromList(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $col_name['selected_fld'],
+ false
+ );
}
if (isset($_REQUEST['total_rows']) && $_REQUEST['total_rows']) {
$total_rows = $_REQUEST['total_rows'];
} else {
- $total_rows = CentralColumns::getCount($db);
+ $total_rows = CentralColumns::getCount(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $db
+ );
}
if (Core::isValid($_REQUEST['pos'], 'integer')) {
$pos = intval($_REQUEST['pos']);
} else {
$pos = 0;
}
-$addNewColumn = CentralColumns::getHtmlForAddNewColumn($db, $total_rows);
+$addNewColumn = CentralColumns::getHtmlForAddNewColumn(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['MaxRows'],
+ $GLOBALS['cfg']['CharEditing'],
+ $db,
+ $total_rows
+);
$response->addHTML($addNewColumn);
if ($total_rows <= 0) {
$response->addHTML(
@@ -110,13 +151,18 @@ if ($total_rows <= 0) {
'The central list of columns for the current database is empty.'
) . '</fieldset>'
);
- $columnAdd = CentralColumns::getHtmlForAddCentralColumn($total_rows, $pos, $db);
+ $columnAdd = CentralColumns::getHtmlForAddCentralColumn($GLOBALS['dbi'], $total_rows, $pos, $db);
$response->addHTML($columnAdd);
exit;
}
-$table_navigation_html = CentralColumns::getHtmlForTableNavigation($total_rows, $pos, $db);
+$table_navigation_html = CentralColumns::getHtmlForTableNavigation(
+ $GLOBALS['cfg']['MaxRows'],
+ $total_rows,
+ $pos,
+ $db
+);
$response->addHTML($table_navigation_html);
-$columnAdd = CentralColumns::getHtmlForAddCentralColumn($total_rows, $pos, $db);
+$columnAdd = CentralColumns::getHtmlForAddCentralColumn($GLOBALS['dbi'], $total_rows, $pos, $db);
$response->addHTML($columnAdd);
$deleteRowForm = '<form method="post" id="del_form" action="db_central_columns.php">'
. Url::getHiddenInputs(
@@ -135,11 +181,22 @@ $tableheader = CentralColumns::getTableHeader(
'column_heading', __('Click to sort.'), 2
);
$response->addHTML($tableheader);
-$result = CentralColumns::getColumnsList($db, $pos, $max_rows);
+$result = CentralColumns::getColumnsList(
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['Server']['user'],
+ $db,
+ $pos,
+ $max_rows
+);
$row_num = 0;
foreach ($result as $row) {
$tableHtmlRow = CentralColumns::getHtmlForCentralColumnsTableRow(
- $row, $row_num, $db
+ $GLOBALS['dbi'],
+ $GLOBALS['cfg']['MaxRows'],
+ $GLOBALS['cfg']['CharEditing'],
+ $row,
+ $row_num,
+ $db
);
$response->addHTML($tableHtmlRow);
$row_num++;