Merge pull request #13608 from mauriciofauth/relation
Refactor relation functions to static methods
This commit is contained in:
commit
360685525d
@ -5,7 +5,9 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/browse_foreigners.lib.php';
|
||||
@ -24,7 +26,7 @@ foreach ($request_params as $one_request_param) {
|
||||
}
|
||||
}
|
||||
|
||||
PhpMyAdmin\Util::checkParameters(array('db', 'table', 'field'));
|
||||
Util::checkParameters(array('db', 'table', 'field'));
|
||||
|
||||
$response = Response::getInstance();
|
||||
$response->getFooter()->setMinimal();
|
||||
@ -36,12 +38,12 @@ $header->setBodyId('body_browse_foreigners');
|
||||
* Displays the frame
|
||||
*/
|
||||
|
||||
$foreigners = PMA_getForeigners($db, $table);
|
||||
$foreigners = Relation::getForeigners($db, $table);
|
||||
$foreign_limit = PMA_getForeignLimit(
|
||||
isset($_REQUEST['foreign_showAll']) ? $_REQUEST['foreign_showAll'] : null
|
||||
);
|
||||
|
||||
$foreignData = PMA_getForeignData(
|
||||
$foreignData = Relation::getForeignData(
|
||||
$foreigners, $_REQUEST['field'], true,
|
||||
isset($_REQUEST['foreign_filter'])
|
||||
? $_REQUEST['foreign_filter']
|
||||
|
||||
13
chk_rel.php
13
chk_rel.php
@ -5,29 +5,30 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
// If request for creating the pmadb
|
||||
if (isset($_REQUEST['create_pmadb'])) {
|
||||
if (PMA_createPMADatabase()) {
|
||||
PMA_fixPMATables('phpmyadmin');
|
||||
if (Relation::createPmaDatabase()) {
|
||||
Relation::fixPmaTables('phpmyadmin');
|
||||
}
|
||||
}
|
||||
|
||||
// If request for creating all PMA tables.
|
||||
if (isset($_REQUEST['fixall_pmadb'])) {
|
||||
PMA_fixPMATables($GLOBALS['db']);
|
||||
Relation::fixPmaTables($GLOBALS['db']);
|
||||
}
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
// If request for creating missing PMA tables.
|
||||
if (isset($_REQUEST['fix_pmadb'])) {
|
||||
PMA_fixPMATables($cfgRelation['db']);
|
||||
Relation::fixPmaTables($cfgRelation['db']);
|
||||
}
|
||||
|
||||
$response = Response::getInstance();
|
||||
$response->addHTML(
|
||||
PMA_getRelationsParamDiagnostic($cfgRelation)
|
||||
Relation::getRelationsParamDiagnostic($cfgRelation)
|
||||
);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -37,7 +37,7 @@ $header->enablePrintView();
|
||||
/**
|
||||
* Gets the relations settings
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
/**
|
||||
* Check parameters
|
||||
@ -50,7 +50,7 @@ PhpMyAdmin\Util::checkParameters(array('db'));
|
||||
$err_url = 'db_sql.php' . Url::getCommon(array('db' => $db));
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$comment = PMA_getDbComment($db);
|
||||
$comment = Relation::getDbComment($db);
|
||||
|
||||
/**
|
||||
* Displays DB comment
|
||||
@ -69,7 +69,7 @@ $tables = $GLOBALS['dbi']->getTables($db);
|
||||
|
||||
$count = 0;
|
||||
foreach ($tables as $table) {
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
|
||||
echo '<div>' , "\n";
|
||||
|
||||
@ -95,7 +95,7 @@ foreach ($tables as $table) {
|
||||
$columns = $GLOBALS['dbi']->getColumns($db, $table);
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
! empty($cfgRelation['relation']), $db, $table
|
||||
);
|
||||
|
||||
@ -171,7 +171,7 @@ foreach ($tables as $table) {
|
||||
|
||||
if ($have_rel) {
|
||||
echo ' <td>';
|
||||
if ($foreigner = PMA_searchColumnInForeigners($res_rel, $column_name)) {
|
||||
if ($foreigner = Relation::searchColumnInForeigners($res_rel, $column_name)) {
|
||||
echo htmlspecialchars(
|
||||
$foreigner['foreign_table']
|
||||
. ' -> '
|
||||
|
||||
@ -13,8 +13,9 @@
|
||||
*/
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -199,14 +200,14 @@ if (strlen($GLOBALS['db']) > 0
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
/**
|
||||
* Check if comments were updated
|
||||
* (must be done before displaying the menu tabs)
|
||||
*/
|
||||
if (isset($_REQUEST['comment'])) {
|
||||
PMA_setDbComment($GLOBALS['db'], $_REQUEST['comment']);
|
||||
Relation::setDbComment($GLOBALS['db'], $_REQUEST['comment']);
|
||||
}
|
||||
|
||||
require 'libraries/db_common.inc.php';
|
||||
@ -303,7 +304,7 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) {
|
||||
. '.' . Util::backquote($cfgRelation['pdf_pages']) . '
|
||||
WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($GLOBALS['db'])
|
||||
. '\'';
|
||||
$test_rs = PMA_queryAsControlUser(
|
||||
$test_rs = Relation::queryAsControlUser(
|
||||
$test_query,
|
||||
false,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SavedSearches;
|
||||
use PhpMyAdmin\Sql;
|
||||
@ -19,7 +19,7 @@ require_once 'libraries/common.inc.php';
|
||||
$response = Response::getInstance();
|
||||
|
||||
// Gets the relation settings
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
$savedSearchList = array();
|
||||
$savedSearch = null;
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Tracker;
|
||||
use PhpMyAdmin\Tracking;
|
||||
@ -110,7 +111,7 @@ if ($num_tables == 0 && count($data['ddlog']) == 0) {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// Prepare statement to get HEAD version
|
||||
$all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
|
||||
@ -121,7 +122,7 @@ $all_tables_query = ' SELECT table_name, MAX(version) as version FROM ' .
|
||||
' GROUP BY table_name' .
|
||||
' ORDER BY table_name ASC';
|
||||
|
||||
$all_tables_result = PMA_queryAsControlUser($all_tables_query);
|
||||
$all_tables_result = Relation::queryAsControlUser($all_tables_query);
|
||||
|
||||
// If a HEAD version exists
|
||||
if (is_object($all_tables_result)
|
||||
|
||||
@ -9,9 +9,10 @@
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Plugins\ExportPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
|
||||
/**
|
||||
* Get the variables sent or posted to this script and a core script
|
||||
@ -408,7 +409,7 @@ do {
|
||||
|| isset($GLOBALS[$what . '_comments']);
|
||||
$do_mime = isset($GLOBALS[$what . '_mime']);
|
||||
if ($do_relation || $do_comments || $do_mime) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
}
|
||||
|
||||
// Include dates in export?
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\RecentFavoriteTable;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\ThemeManager;
|
||||
@ -560,7 +561,7 @@ if (@file_exists('config')) {
|
||||
}
|
||||
|
||||
if ($server > 0) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['allworks']
|
||||
&& $cfg['PmaNoRelation_DisableWarning'] == false
|
||||
) {
|
||||
|
||||
@ -7,8 +7,9 @@
|
||||
*/
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* Defines the central_columns parameters for the current user
|
||||
@ -24,7 +25,7 @@ function PMA_centralColumnsGetParams()
|
||||
return $cfgCentralColumns;
|
||||
}
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($cfgRelation['centralcolumnswork']) {
|
||||
$cfgCentralColumns = array(
|
||||
@ -409,7 +410,7 @@ function PMA_makeConsistentWithList($db, $selected_tables)
|
||||
$has_list = PMA_getCentralColumnsFromTable($db, $table, true);
|
||||
$GLOBALS['dbi']->selectDb($db, $GLOBALS['userlink']);
|
||||
foreach ($has_list as $column) {
|
||||
$column_status = PMA_checkChildForeignReferences(
|
||||
$column_status = Relation::checkChildForeignReferences(
|
||||
$db, $table, $column['col_name']
|
||||
);
|
||||
//column definition can only be changed if
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -207,7 +208,7 @@ class Bookmark
|
||||
return $cfgBookmark;
|
||||
}
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
$cfgBookmark = array(
|
||||
'user' => $GLOBALS['cfg']['Server']['user'],
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Bookmark;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -127,7 +128,7 @@ class Console
|
||||
$cfgBookmark = Bookmark::getParams();
|
||||
|
||||
$image = Util::getImage('console.png', __('SQL Query Console'));
|
||||
$_sql_history = PMA_getHistory($GLOBALS['cfg']['Server']['user']);
|
||||
$_sql_history = Relation::getHistory($GLOBALS['cfg']['Server']['user']);
|
||||
$bookmarkContent = static::getBookmarkContent();
|
||||
|
||||
return Template::get('console/display')
|
||||
|
||||
@ -15,6 +15,7 @@ use PhpMyAdmin\Controllers\DatabaseController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\RecentFavoriteTable;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -234,7 +235,7 @@ class DatabaseStructureController extends DatabaseController
|
||||
|
||||
// Request for Synchronization of favorite tables.
|
||||
if (isset($_REQUEST['sync_favorite_tables'])) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['favoritework']) {
|
||||
$this->synchronizeFavoriteTables($fav_instance, $user, $favorite_tables);
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Controllers\TableController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -130,20 +131,20 @@ class TableRelationController extends TableController
|
||||
|
||||
// If we did an update, refresh our data
|
||||
if (isset($_POST['destination_db']) && $this->cfgRelation['relwork']) {
|
||||
$this->existrel = PMA_getForeigners(
|
||||
$this->existrel = Relation::getForeigners(
|
||||
$this->db, $this->table, '', 'internal'
|
||||
);
|
||||
}
|
||||
if (isset($_POST['destination_foreign_db'])
|
||||
&& Util::isForeignKeySupported($this->tbl_storage_engine)
|
||||
) {
|
||||
$this->existrel_foreign = PMA_getForeigners(
|
||||
$this->existrel_foreign = Relation::getForeigners(
|
||||
$this->db, $this->table, '', 'foreign'
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->cfgRelation['displaywork']) {
|
||||
$this->disp = PMA_getDisplayField($this->db, $this->table);
|
||||
$this->disp = Relation::getDisplayField($this->db, $this->table);
|
||||
}
|
||||
|
||||
// display secondary level tabs if necessary
|
||||
@ -157,7 +158,7 @@ class TableRelationController extends TableController
|
||||
'table' => $GLOBALS['table']
|
||||
),
|
||||
'is_foreign_key_supported' => Util::isForeignKeySupported($engine),
|
||||
'cfg_relation' => PMA_getRelationsParam(),
|
||||
'cfg_relation' => Relation::getRelationsParam(),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Controllers\TableController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Sql;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -155,7 +156,7 @@ class TableSearchController extends TableController
|
||||
} // end for
|
||||
|
||||
// Retrieve foreign keys
|
||||
$this->_foreigners = PMA_getForeigners($this->db, $this->table);
|
||||
$this->_foreigners = Relation::getForeigners($this->db, $this->table);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,7 +266,7 @@ class TableSearchController extends TableController
|
||||
|
||||
//Set default datalabel if not selected
|
||||
if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') {
|
||||
$dataLabel = PMA_getDisplayField($this->db, $this->table);
|
||||
$dataLabel = Relation::getDisplayField($this->db, $this->table);
|
||||
} else {
|
||||
$dataLabel = $_POST['dataLabel'];
|
||||
}
|
||||
@ -854,7 +855,7 @@ class TableSearchController extends TableController
|
||||
)
|
||||
);
|
||||
//Gets link to browse foreign data(if any) and criteria inputbox
|
||||
$foreignData = PMA_getForeignData(
|
||||
$foreignData = Relation::getForeignData(
|
||||
$this->_foreigners, $this->_columnNames[$column_index], false, '', ''
|
||||
);
|
||||
$value = Template::get('table/search/input_box')->render(
|
||||
|
||||
@ -12,6 +12,7 @@ use PhpMyAdmin\Controllers\TableController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Sql;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
@ -257,7 +258,7 @@ class TableStructureController extends TableController
|
||||
'table' => $this->table
|
||||
),
|
||||
'is_foreign_key_supported' => Util::isForeignKeySupported($engine),
|
||||
'cfg_relation' => PMA_getRelationsParam(),
|
||||
'cfg_relation' => Relation::getRelationsParam(),
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -304,7 +305,7 @@ class TableStructureController extends TableController
|
||||
/**
|
||||
* Gets the relation settings
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
/**
|
||||
* Runs common work
|
||||
@ -1029,7 +1030,7 @@ class TableStructureController extends TableController
|
||||
if (isset($_REQUEST['field_orig']) && is_array($_REQUEST['field_orig'])) {
|
||||
foreach ($_REQUEST['field_orig'] as $fieldindex => $fieldcontent) {
|
||||
if ($_REQUEST['field_name'][$fieldindex] != $fieldcontent) {
|
||||
PMA_REL_renameField(
|
||||
Relation::renameField(
|
||||
$this->db, $this->table, $fieldcontent,
|
||||
$_REQUEST['field_name'][$fieldindex]
|
||||
);
|
||||
@ -1172,7 +1173,7 @@ class TableStructureController extends TableController
|
||||
$mime_map = array();
|
||||
|
||||
if ($GLOBALS['cfg']['ShowPropertyComments']) {
|
||||
$comments_map = PMA_getComments($this->db, $this->table);
|
||||
$comments_map = Relation::getComments($this->db, $this->table);
|
||||
if ($cfgRelation['mimework'] && $GLOBALS['cfg']['BrowseMIME']) {
|
||||
$mime_map = Transformations::getMIME($this->db, $this->table, true);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -1433,7 +1434,7 @@ class DbQbe
|
||||
// So we select candidate tables which are foreign tables.
|
||||
$foreign_tables = array();
|
||||
foreach ($candidate_columns as $one_table) {
|
||||
$foreigners = PMA_getForeigners($this->_db, $one_table);
|
||||
$foreigners = Relation::getForeigners($this->_db, $one_table);
|
||||
foreach ($foreigners as $key => $foreigner) {
|
||||
if ($key != 'foreign_keys_data') {
|
||||
if (in_array($foreigner['foreign_table'], $candidate_columns)) {
|
||||
@ -1622,7 +1623,7 @@ class DbQbe
|
||||
// having relationships with unfinalized tables
|
||||
foreach ($unfinalized as $oneTable) {
|
||||
|
||||
$references = PMA_getChildReferences($this->_db, $oneTable);
|
||||
$references = Relation::getChildReferences($this->_db, $oneTable);
|
||||
foreach ($references as $column => $columnReferences) {
|
||||
foreach ($columnReferences as $reference) {
|
||||
|
||||
@ -1705,7 +1706,7 @@ class DbQbe
|
||||
{
|
||||
$relations[$oneTable] = array();
|
||||
|
||||
$foreigners = PMA_getForeigners($GLOBALS['db'], $oneTable);
|
||||
$foreigners = Relation::getForeigners($GLOBALS['db'], $oneTable);
|
||||
foreach ($foreigners as $field => $foreigner) {
|
||||
// Foreign keys data
|
||||
if ($field == 'foreign_keys_data') {
|
||||
|
||||
@ -12,6 +12,7 @@ use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\Transformations\Text_Plain_Link;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Sql;
|
||||
@ -310,7 +311,7 @@ class DisplayResults
|
||||
)
|
||||
);
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['db']) {
|
||||
$this->transformation_info[$cfgRelation['db']] = array();
|
||||
$relDb = &$this->transformation_info[$cfgRelation['db']];
|
||||
@ -1607,7 +1608,7 @@ class DisplayResults
|
||||
if (empty($field->table)) {
|
||||
continue;
|
||||
}
|
||||
$ret[$field->table] = PMA_getComments(
|
||||
$ret[$field->table] = Relation::getComments(
|
||||
empty($field->database) ? $this->__get('db') : $field->database,
|
||||
$field->table
|
||||
);
|
||||
@ -4761,7 +4762,7 @@ class DisplayResults
|
||||
// configuration storage. If no PMA storage, we won't be able
|
||||
// to use the "column to display" notion (for example show
|
||||
// the name related to a numeric id).
|
||||
$exist_rel = PMA_getForeigners(
|
||||
$exist_rel = Relation::getForeigners(
|
||||
$this->__get('db'), $this->__get('table'), '', self::POSITION_BOTH
|
||||
);
|
||||
|
||||
@ -4769,7 +4770,7 @@ class DisplayResults
|
||||
|
||||
foreach ($exist_rel as $master_field => $rel) {
|
||||
if ($master_field != 'foreign_keys_data') {
|
||||
$display_field = PMA_getDisplayField(
|
||||
$display_field = Relation::getDisplayField(
|
||||
$rel['foreign_db'], $rel['foreign_table']
|
||||
);
|
||||
$map[$master_field] = array(
|
||||
@ -4781,7 +4782,7 @@ class DisplayResults
|
||||
} else {
|
||||
foreach ($rel as $key => $one_key) {
|
||||
foreach ($one_key['index_list'] as $index => $one_field) {
|
||||
$display_field = PMA_getDisplayField(
|
||||
$display_field = Relation::getDisplayField(
|
||||
isset($one_key['ref_db_name'])
|
||||
? $one_key['ref_db_name']
|
||||
: $GLOBALS['db'],
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Scripts;
|
||||
@ -246,7 +247,7 @@ class Footer
|
||||
|| isset($GLOBALS['controllink'])
|
||||
&& $GLOBALS['controllink']))
|
||||
) {
|
||||
PMA_setHistory(
|
||||
Relation::setHistory(
|
||||
Core::ifSetOr($GLOBALS['db'], ''),
|
||||
Core::ifSetOr($GLOBALS['table'], ''),
|
||||
$GLOBALS['cfg']['Server']['user'],
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\TransformationsPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Transformations;
|
||||
@ -504,7 +505,7 @@ class InsertEdit
|
||||
*/
|
||||
public static function getNullifyCodeForNullColumn($column, $foreigners, $foreignData)
|
||||
{
|
||||
$foreigner = PMA_searchColumnInForeigners($foreigners, $column['Field']);
|
||||
$foreigner = Relation::searchColumnInForeigners($foreigners, $column['Field']);
|
||||
if (mb_strstr($column['True_Type'], 'enum')) {
|
||||
if (mb_strlen($column['Type']) > 20) {
|
||||
$nullify_code = '1';
|
||||
@ -740,7 +741,7 @@ class InsertEdit
|
||||
. ($readOnly ? ' disabled' : '')
|
||||
. ' tabindex="' . ($tabindex + $tabindex_for_value) . '"'
|
||||
. ' id="field_' . $idindex . '_3">';
|
||||
$html_output .= PMA_foreignDropdown(
|
||||
$html_output .= Relation::foreignDropdown(
|
||||
$foreignData['disp_row'], $foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'], $data,
|
||||
$GLOBALS['cfg']['ForeignKeyMaxLimit']
|
||||
@ -2090,8 +2091,8 @@ class InsertEdit
|
||||
public static function getDisplayValueForForeignTableColumn($where_comparison,
|
||||
$map, $relation_field
|
||||
) {
|
||||
$foreigner = PMA_searchColumnInForeigners($map, $relation_field);
|
||||
$display_field = PMA_getDisplayField(
|
||||
$foreigner = Relation::searchColumnInForeigners($map, $relation_field);
|
||||
$display_field = Relation::getDisplayField(
|
||||
$foreigner['foreign_db'],
|
||||
$foreigner['foreign_table']
|
||||
);
|
||||
@ -2133,7 +2134,7 @@ class InsertEdit
|
||||
public static function getLinkForRelationalDisplayField($map, $relation_field,
|
||||
$where_comparison, $dispval, $relation_field_value
|
||||
) {
|
||||
$foreigner = PMA_searchColumnInForeigners($map, $relation_field);
|
||||
$foreigner = Relation::searchColumnInForeigners($map, $relation_field);
|
||||
if ('K' == $_SESSION['tmpval']['relational_display']) {
|
||||
// user chose "relational key" in the display options, so
|
||||
// the title contains the display field
|
||||
@ -2596,7 +2597,7 @@ class InsertEdit
|
||||
$comments_map = array();
|
||||
|
||||
if ($GLOBALS['cfg']['ShowPropertyComments']) {
|
||||
$comments_map = PMA_getComments($db, $table);
|
||||
$comments_map = Relation::getComments($db, $table);
|
||||
}
|
||||
|
||||
return $comments_map;
|
||||
@ -2854,7 +2855,7 @@ class InsertEdit
|
||||
|
||||
// The function column
|
||||
// -------------------
|
||||
$foreignData = PMA_getForeignData(
|
||||
$foreignData = Relation::getForeignData(
|
||||
$foreigners, $column['Field'], false, '', ''
|
||||
);
|
||||
if ($GLOBALS['cfg']['ShowFunctionFields']) {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Tracker;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -137,7 +138,7 @@ class Menu
|
||||
return Util::cacheGet($cache_key);
|
||||
}
|
||||
$allowedTabs = Util::getMenuTabList($level);
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['menuswork']) {
|
||||
$groupTable = Util::backquote($cfgRelation['db'])
|
||||
. "."
|
||||
@ -152,7 +153,7 @@ class Menu
|
||||
. $userTable . " WHERE `username` = '"
|
||||
. $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "')";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
$tabName = mb_substr(
|
||||
@ -292,12 +293,12 @@ class Menu
|
||||
} // end if
|
||||
} else {
|
||||
// no table selected, display database comment if present
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// Get additional information about tables for tooltip is done
|
||||
// in Util::getDbInfo() only once
|
||||
if ($cfgRelation['commwork']) {
|
||||
$comment = PMA_getDbComment($this->_db);
|
||||
$comment = Relation::getDbComment($this->_db);
|
||||
/**
|
||||
* Displays table comment
|
||||
*/
|
||||
@ -448,7 +449,7 @@ class Menu
|
||||
/**
|
||||
* Gets the relation settings
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
$tabs = array();
|
||||
|
||||
|
||||
@ -10,9 +10,10 @@ namespace PhpMyAdmin\Navigation;
|
||||
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* The navigation panel - displays server, db and table selection tree
|
||||
@ -98,7 +99,7 @@ class Navigation
|
||||
. "'" . $GLOBALS['dbi']->escapeString($dbName) . "',"
|
||||
. "'" . (! empty($tableName)? $GLOBALS['dbi']->escapeString($tableName) : "" )
|
||||
. "')";
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
Relation::queryAsControlUser($sqlQuery, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,7 +150,7 @@ class Navigation
|
||||
? " AND `table_name`='" . $GLOBALS['dbi']->escapeString($tableName) . "'"
|
||||
: ""
|
||||
);
|
||||
PMA_queryAsControlUser($sqlQuery, false);
|
||||
Relation::queryAsControlUser($sqlQuery, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,7 +176,7 @@ class Navigation
|
||||
. " AND `db_name`='" . $GLOBALS['dbi']->escapeString($dbName) . "'"
|
||||
. " AND `table_name`='"
|
||||
. (! empty($tableName) ? $GLOBALS['dbi']->escapeString($tableName) : '') . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
$result = Relation::queryAsControlUser($sqlQuery, false);
|
||||
|
||||
$hidden = array();
|
||||
if ($result) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -806,7 +807,7 @@ class Node
|
||||
*/
|
||||
public function getNavigationHidingData()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$navTable = Util::backquote($cfgRelation['db'])
|
||||
. "." . Util::backquote(
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -386,7 +387,7 @@ class NodeDatabase extends Node
|
||||
}
|
||||
|
||||
// Remove hidden items so that they are not displayed in navigation tree
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$hiddenItems = $this->getHiddenItems(substr($type, 0, -1));
|
||||
foreach ($retval as $key => $item) {
|
||||
@ -410,7 +411,7 @@ class NodeDatabase extends Node
|
||||
public function getHiddenItems($type)
|
||||
{
|
||||
$db = $this->real_name;
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (empty($cfgRelation['navigationhiding'])) {
|
||||
return array();
|
||||
}
|
||||
@ -421,7 +422,7 @@ class NodeDatabase extends Node
|
||||
. " AND `item_type`='" . $type
|
||||
. "'" . " AND `db_name`='" . $GLOBALS['dbi']->escapeString($db)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
$result = Relation::queryAsControlUser($sqlQuery, false);
|
||||
$hiddenItems = array();
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchArray($result)) {
|
||||
@ -668,7 +669,7 @@ class NodeDatabase extends Node
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
if ($this->hiddenCount > 0) {
|
||||
$params = array(
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -34,7 +35,7 @@ abstract class NodeDatabaseChild extends Node
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$item = $this->real_name;
|
||||
|
||||
@ -13,6 +13,7 @@ use PhpMyAdmin\Engines\Innodb;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partition;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\StorageEngine;
|
||||
use PhpMyAdmin\Table;
|
||||
@ -47,7 +48,7 @@ class Operations
|
||||
$html_output .= '</legend>';
|
||||
$html_output .= '<input type="text" name="comment" '
|
||||
. 'class="textfield"'
|
||||
. 'value="' . htmlspecialchars(PMA_getDBComment($db)) . '" />'
|
||||
. 'value="' . htmlspecialchars(Relation::getDbComment($db)) . '" />'
|
||||
. '</fieldset>';
|
||||
$html_output .= '<fieldset class="tblFooters">'
|
||||
. '<input type="submit" value="' . __('Go') . '" />'
|
||||
@ -1279,7 +1280,7 @@ class Operations
|
||||
|
||||
// display "Add constraints" choice only if there are
|
||||
// foreign keys
|
||||
if (PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
|
||||
if (Relation::getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'foreign')) {
|
||||
$html_output .= '<input type="checkbox" name="add_constraints" '
|
||||
. 'value="1" id="checkbox_constraints" checked="checked"/>';
|
||||
$html_output .= '<label for="checkbox_constraints">'
|
||||
|
||||
@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -371,7 +372,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
$do_relation && !empty($cfgRelation['relation']),
|
||||
$db,
|
||||
$table
|
||||
@ -404,7 +405,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
. __('Comments')
|
||||
. '</strong></td>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$schema_insert .= '<td class="print"><strong>'
|
||||
|
||||
@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -494,7 +495,7 @@ class ExportLatex extends ExportPlugin
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
$do_relation && !empty($cfgRelation['relation']),
|
||||
$db,
|
||||
$table
|
||||
@ -530,7 +531,7 @@ class ExportLatex extends ExportPlugin
|
||||
}
|
||||
if ($do_comments) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{' . __('Comments') . '}}';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$header .= ' & \\multicolumn{1}{|c|}{\\textbf{MIME}}';
|
||||
|
||||
@ -17,6 +17,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -452,7 +453,7 @@ class ExportOdt extends ExportPlugin
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
$do_relation && !empty($cfgRelation['relation']),
|
||||
$db,
|
||||
$table
|
||||
@ -497,7 +498,7 @@ class ExportOdt extends ExportPlugin
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
. '<text:p>' . __('Comments') . '</text:p>'
|
||||
. '</table:table-cell>';
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$GLOBALS['odt_buffer'] .= '<table:table-cell office:value-type="string">'
|
||||
@ -518,7 +519,7 @@ class ExportOdt extends ExportPlugin
|
||||
$col_as
|
||||
);
|
||||
if ($do_relation && $have_rel) {
|
||||
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
|
||||
$foreigner = Relation::searchColumnInForeigners($res_rel, $field_name);
|
||||
if ($foreigner) {
|
||||
$rtable = $foreigner['foreign_table'];
|
||||
$rfield = $foreigner['foreign_field'];
|
||||
|
||||
@ -21,6 +21,7 @@ use PhpMyAdmin\Properties\Options\Items\NumberPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\SqlParser\Components\CreateDefinition;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
@ -996,7 +997,7 @@ class ExportSql extends ExportPlugin
|
||||
$tables,
|
||||
$metadataTypes
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (!isset($cfgRelation['db'])) {
|
||||
return true;
|
||||
}
|
||||
@ -1048,7 +1049,7 @@ class ExportSql extends ExportPlugin
|
||||
$table,
|
||||
$metadataTypes
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (isset($table)) {
|
||||
$types = array(
|
||||
@ -1837,7 +1838,7 @@ class ExportSql extends ExportPlugin
|
||||
$schema_create = '';
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
$do_relation && !empty($cfgRelation['relation']),
|
||||
$db,
|
||||
$table
|
||||
|
||||
@ -16,6 +16,7 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -362,7 +363,7 @@ class ExportTexytext extends ExportPlugin
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
// Check if we can use Relations
|
||||
list($res_rel, $have_rel) = PMA_getRelationsAndStatus(
|
||||
list($res_rel, $have_rel) = Relation::getRelationsAndStatus(
|
||||
$do_relation && !empty($cfgRelation['relation']),
|
||||
$db,
|
||||
$table
|
||||
@ -382,7 +383,7 @@ class ExportTexytext extends ExportPlugin
|
||||
}
|
||||
if ($do_comments) {
|
||||
$text_output .= '|' . __('Comments');
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$text_output .= '|' . htmlspecialchars('MIME');
|
||||
|
||||
@ -10,6 +10,7 @@ namespace PhpMyAdmin\Plugins\Export\Helpers;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Pdf as PdfLib;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
use TCPDF_STATIC;
|
||||
@ -463,7 +464,7 @@ class Pdf extends PdfLib
|
||||
if ($do_relation) {
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
$res_rel = Relation::getForeigners($db, $table);
|
||||
$have_rel = !empty($res_rel);
|
||||
} else {
|
||||
$have_rel = false;
|
||||
@ -516,7 +517,7 @@ class Pdf extends PdfLib
|
||||
// Now let's start to write the table structure
|
||||
|
||||
if ($do_comments) {
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$comments = Relation::getComments($db, $table);
|
||||
}
|
||||
if ($do_mime && $cfgRelation['mimework']) {
|
||||
$mime_map = Transformations::getMIME($db, $table, true);
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
namespace PhpMyAdmin\Plugins;
|
||||
|
||||
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* Provides a common interface that will have to be implemented by all of the
|
||||
@ -349,7 +350,7 @@ abstract class ExportPlugin
|
||||
$aliases = array()
|
||||
) {
|
||||
$relation = '';
|
||||
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
|
||||
$foreigner = Relation::searchColumnInForeigners($res_rel, $field_name);
|
||||
if ($foreigner) {
|
||||
$ftable = $foreigner['foreign_table'];
|
||||
$ffield = $foreigner['foreign_field'];
|
||||
|
||||
@ -12,6 +12,7 @@ use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Plugins\Schema\Pdf\TableStatsPdf;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\TableStatsSvg;
|
||||
use PhpMyAdmin\Plugins\Schema\Dia\TableStatsDia;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* Dia Relation Schema Class
|
||||
@ -83,7 +84,7 @@ class DiaRelationSchema extends ExportRelationSchema
|
||||
|
||||
$seen_a_relation = false;
|
||||
foreach ($alltables as $one_table) {
|
||||
$exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
|
||||
$exist_rel = Relation::getForeigners($this->db, $one_table, '', 'both');
|
||||
if (!$exist_rel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ use PhpMyAdmin\Plugins\Schema\Dia\TableStatsDia;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Plugins\Schema\Pdf\TableStatsPdf;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\TableStatsSvg;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* EPS Relation Schema Class
|
||||
@ -91,7 +92,7 @@ class EpsRelationSchema extends ExportRelationSchema
|
||||
|
||||
$seen_a_relation = false;
|
||||
foreach ($alltables as $one_table) {
|
||||
$exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
|
||||
$exist_rel = Relation::getForeigners($this->db, $one_table, '', 'both');
|
||||
if (!$exist_rel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -265,7 +266,7 @@ class ExportRelationSchema
|
||||
. Util::backquote($GLOBALS['cfgRelation']['db']) . '.'
|
||||
. Util::backquote($GLOBALS['cfgRelation']['pdf_pages'])
|
||||
. ' WHERE page_nr = ' . $this->pageNumber;
|
||||
$_name_rs = PMA_queryAsControlUser($_name_sql);
|
||||
$_name_rs = Relation::queryAsControlUser($_name_sql);
|
||||
$_name_row = $GLOBALS['dbi']->fetchRow($_name_rs);
|
||||
$filename = $_name_row[0] . $extension;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Plugins\Schema\Pdf;
|
||||
|
||||
use PhpMyAdmin\Pdf as PdfLib;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -241,7 +242,7 @@ class Pdf extends PdfLib
|
||||
. Util::backquote($GLOBALS['cfgRelation']['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($this->_db)
|
||||
. '\' AND page_nr = \'' . $this->_pageNumber . '\'';
|
||||
$test_rs = PMA_queryAsControlUser($test_query);
|
||||
$test_rs = Relation::queryAsControlUser($test_query);
|
||||
$pages = @$GLOBALS['dbi']->fetchAssoc($test_rs);
|
||||
$pg_name = ucfirst($pages['page_descr']);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin\Plugins\Schema\Pdf;
|
||||
|
||||
use PhpMyAdmin\Pdf as PdfLib;
|
||||
use PhpMyAdmin\Plugins\Schema\ExportRelationSchema;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -185,7 +186,7 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
// and finding its foreigns is OK (then we can support innodb)
|
||||
$seen_a_relation = false;
|
||||
foreach ($alltables as $one_table) {
|
||||
$exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
|
||||
$exist_rel = Relation::getForeigners($this->db, $one_table, '', 'both');
|
||||
if (!$exist_rel) {
|
||||
continue;
|
||||
}
|
||||
@ -546,8 +547,8 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
$this->diagram->SetFont($this->_ff, '', 8);
|
||||
$this->diagram->ln();
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$comments = PMA_getComments($this->db, $table);
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$comments = Relation::getComments($this->db, $table);
|
||||
if ($cfgRelation['mimework']) {
|
||||
$mime_map = Transformations::getMIME($this->db, $table, true);
|
||||
}
|
||||
@ -583,7 +584,7 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($this->db, $table);
|
||||
$res_rel = Relation::getForeigners($this->db, $table);
|
||||
|
||||
/**
|
||||
* Displays the comments of the table if MySQL >= 3.23
|
||||
@ -679,7 +680,7 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
$this->diagram->SetLink(
|
||||
$this->diagram->PMA_links['doc'][$table][$field_name], -1
|
||||
);
|
||||
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
|
||||
$foreigner = Relation::searchColumnInForeigners($res_rel, $field_name);
|
||||
|
||||
$linksTo = '';
|
||||
if ($foreigner) {
|
||||
|
||||
@ -14,6 +14,7 @@ use PhpMyAdmin\Plugins\Schema\Pdf\TableStatsPdf;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\Svg;
|
||||
use PhpMyAdmin\Plugins\Schema\Svg\TableStatsSvg;
|
||||
use PhpMyAdmin\Plugins\Schema\Dia\TableStatsDia;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* RelationStatsSvg Relation Schema Class
|
||||
@ -103,7 +104,7 @@ class SvgRelationSchema extends ExportRelationSchema
|
||||
|
||||
$seen_a_relation = false;
|
||||
foreach ($alltables as $one_table) {
|
||||
$exist_rel = PMA_getForeigners($this->db, $one_table, '', 'both');
|
||||
$exist_rel = Relation::getForeigners($this->db, $one_table, '', 'both');
|
||||
if (!$exist_rel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin\Plugins\Schema;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -136,7 +137,7 @@ abstract class TableStats
|
||||
*/
|
||||
protected function loadDisplayField()
|
||||
{
|
||||
$this->displayfield = PMA_getDisplayField($this->db, $this->tableName);
|
||||
$this->displayfield = Relation::getDisplayField($this->db, $this->tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -103,7 +104,7 @@ class RecentFavoriteTable
|
||||
" WHERE `username` = '" . $GLOBALS['dbi']->escapeString($GLOBALS['cfg']['Server']['user']) . "'";
|
||||
|
||||
$return = array();
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
$row = $GLOBALS['dbi']->fetchArray($result);
|
||||
if (isset($row[0])) {
|
||||
@ -348,7 +349,7 @@ class RecentFavoriteTable
|
||||
if ($server_id == 0) {
|
||||
return '';
|
||||
}
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
// Not to show this once list is synchronized.
|
||||
if ($cfgRelation['favoritework'] && ! isset($_SESSION['tmpval']['favorites_synced'][$server_id])) {
|
||||
$params = array('ajax_request' => true, 'favorite_table' => true,
|
||||
@ -381,7 +382,7 @@ class RecentFavoriteTable
|
||||
*/
|
||||
private function _getPmaTable()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! empty($cfgRelation['db'])
|
||||
&& ! empty($cfgRelation[$this->_tableType])
|
||||
) {
|
||||
|
||||
2100
libraries/classes/Relation.php
Normal file
2100
libraries/classes/Relation.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -312,7 +313,7 @@ class SavedSearches
|
||||
. "'" . $GLOBALS['dbi']->escapeString(json_encode($this->getCriterias()))
|
||||
. "')";
|
||||
|
||||
$result = (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
$result = (bool)Relation::queryAsControlUser($sqlQuery);
|
||||
if (!$result) {
|
||||
return false;
|
||||
}
|
||||
@ -346,7 +347,7 @@ class SavedSearches
|
||||
. "`search_data` = '"
|
||||
. $GLOBALS['dbi']->escapeString(json_encode($this->getCriterias())) . "' "
|
||||
. "WHERE id = " . $this->getId();
|
||||
return (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
return (bool)Relation::queryAsControlUser($sqlQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -374,7 +375,7 @@ class SavedSearches
|
||||
$sqlQuery = "DELETE FROM " . $savedSearchesTbl
|
||||
. "WHERE id = '" . $GLOBALS['dbi']->escapeString($this->getId()) . "'";
|
||||
|
||||
return (bool)PMA_queryAsControlUser($sqlQuery);
|
||||
return (bool)Relation::queryAsControlUser($sqlQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -402,7 +403,7 @@ class SavedSearches
|
||||
. "FROM " . $savedSearchesTbl . " "
|
||||
. "WHERE id = '" . $GLOBALS['dbi']->escapeString($this->getId()) . "' ";
|
||||
|
||||
$resList = PMA_queryAsControlUser($sqlQuery);
|
||||
$resList = Relation::queryAsControlUser($sqlQuery);
|
||||
|
||||
if (false === ($oneResult = $GLOBALS['dbi']->fetchArray($resList))) {
|
||||
$message = Message::error(__('Error while loading the search.'));
|
||||
@ -449,7 +450,7 @@ class SavedSearches
|
||||
|
||||
$sqlQuery .= "order by search_name ASC ";
|
||||
|
||||
$resList = PMA_queryAsControlUser($sqlQuery);
|
||||
$resList = Relation::queryAsControlUser($sqlQuery);
|
||||
|
||||
$list = array();
|
||||
while ($oneResult = $GLOBALS['dbi']->fetchArray($resList)) {
|
||||
|
||||
@ -10,10 +10,11 @@ namespace PhpMyAdmin\Server;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* Privileges class
|
||||
@ -523,7 +524,7 @@ class Privileges
|
||||
*/
|
||||
public static function getHtmlToChooseUserGroup($username)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$groupTable = Util::backquote($cfgRelation['db'])
|
||||
. "." . Util::backquote($cfgRelation['usergroups']);
|
||||
$userTable = Util::backquote($cfgRelation['db'])
|
||||
@ -540,7 +541,7 @@ class Privileges
|
||||
|
||||
$allUserGroups = array('' => '');
|
||||
$sql_query = "SELECT DISTINCT `usergroup` FROM " . $groupTable;
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchRow($result)) {
|
||||
$allUserGroups[$row[0]] = $row[0];
|
||||
@ -570,7 +571,7 @@ class Privileges
|
||||
*/
|
||||
public static function setUserGroup($username, $userGroup)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (empty($cfgRelation['db']) || empty($cfgRelation['users']) || empty($cfgRelation['usergroups'])) {
|
||||
return;
|
||||
}
|
||||
@ -599,7 +600,7 @@ class Privileges
|
||||
}
|
||||
}
|
||||
if (isset($upd_query)) {
|
||||
PMA_queryAsControlUser($upd_query);
|
||||
Relation::queryAsControlUser($upd_query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2841,7 +2842,7 @@ class Privileges
|
||||
*/
|
||||
public static function getUserGroupCount()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$user_group_table = Util::backquote($cfgRelation['db'])
|
||||
. '.' . Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = 'SELECT COUNT(*) FROM ' . $user_group_table;
|
||||
@ -2861,7 +2862,7 @@ class Privileges
|
||||
*/
|
||||
public static function getUserGroupForUser($username)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (empty($cfgRelation['db'])
|
||||
|| empty($cfgRelation['users'])
|
||||
@ -2952,7 +2953,7 @@ class Privileges
|
||||
|
||||
// if $cfg['Servers'][$i]['users'] and $cfg['Servers'][$i]['usergroups'] are
|
||||
// enabled
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (!empty($cfgRelation['users']) && !empty($cfgRelation['usergroups'])) {
|
||||
$new_user_string .= '<td class="usrGroup"></td>';
|
||||
}
|
||||
@ -3560,12 +3561,12 @@ class Privileges
|
||||
*/
|
||||
public static function getHtmlTableBodyForUserRights($db_rights)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['menuswork']) {
|
||||
$users_table = Util::backquote($cfgRelation['db'])
|
||||
. "." . Util::backquote($cfgRelation['users']);
|
||||
$sql_query = 'SELECT * FROM ' . $users_table;
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
$group_assignment = array();
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
|
||||
@ -14,6 +14,7 @@ use PhpMyAdmin\DisplayResults;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlParser\Statements\AlterStatement;
|
||||
use PhpMyAdmin\SqlParser\Statements\DropStatement;
|
||||
@ -192,9 +193,9 @@ class Sql
|
||||
*/
|
||||
public static function getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_value)
|
||||
{
|
||||
$foreigners = PMA_getForeigners($db, $table, $column);
|
||||
$foreigners = Relation::getForeigners($db, $table, $column);
|
||||
|
||||
$foreignData = PMA_getForeignData($foreigners, $column, false, '', '');
|
||||
$foreignData = Relation::getForeignData($foreigners, $column, false, '', '');
|
||||
|
||||
if ($foreignData['disp_row'] == null) {
|
||||
//Handle the case when number of values
|
||||
@ -214,7 +215,7 @@ class Sql
|
||||
. __('Browse foreign values')
|
||||
. '</a>';
|
||||
} else {
|
||||
$dropdown = PMA_foreignDropdown(
|
||||
$dropdown = Relation::foreignDropdown(
|
||||
$foreignData['disp_row'],
|
||||
$foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'],
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
@ -45,7 +46,7 @@ class SystemDatabase
|
||||
*/
|
||||
public function getExistingTransformationData($db)
|
||||
{
|
||||
$cfgRelation = \PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// Get the existing transformation details of the same database
|
||||
// from pma__column_info table
|
||||
@ -72,7 +73,7 @@ class SystemDatabase
|
||||
function getNewTransformationDataSql(
|
||||
$pma_transformation_data, $column_map, $view_name, $db
|
||||
) {
|
||||
$cfgRelation = \PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// Need to store new transformation details for VIEW
|
||||
$new_transformations_sql = sprintf(
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\SqlParser\Components\Expression;
|
||||
use PhpMyAdmin\SqlParser\Components\OptionsArray;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
@ -799,7 +800,7 @@ class Table
|
||||
|
||||
// must use DatabaseInterface::QUERY_STORE here, since we execute
|
||||
// another query inside the loop
|
||||
$table_copy_rs = PMA_queryAsControlUser(
|
||||
$table_copy_rs = Relation::queryAsControlUser(
|
||||
$table_copy_query, true, DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -819,7 +820,7 @@ class Table
|
||||
. implode('\', \'', $value_parts) . '\', \''
|
||||
. implode('\', \'', $new_value_parts) . '\')';
|
||||
|
||||
PMA_queryAsControlUser($new_table_query);
|
||||
Relation::queryAsControlUser($new_table_query);
|
||||
$last_id = $GLOBALS['dbi']->insertId();
|
||||
} // end while
|
||||
|
||||
@ -1160,7 +1161,7 @@ class Table
|
||||
}
|
||||
}
|
||||
|
||||
PMA_getRelationsParam();
|
||||
Relation::getRelationsParam();
|
||||
|
||||
// Drops old table if the user has requested to move it
|
||||
if ($move) {
|
||||
@ -1179,7 +1180,7 @@ class Table
|
||||
$GLOBALS['dbi']->query($sql_drop_query);
|
||||
|
||||
// Renable table in configuration storage
|
||||
PMA_REL_renameTable(
|
||||
Relation::renameTable(
|
||||
$source_db, $target_db,
|
||||
$source_table, $target_table
|
||||
);
|
||||
@ -1197,7 +1198,7 @@ class Table
|
||||
|
||||
if ($GLOBALS['cfgRelation']['commwork']) {
|
||||
// Get all comments and MIME-Types for current table
|
||||
$comments_copy_rs = PMA_queryAsControlUser(
|
||||
$comments_copy_rs = Relation::queryAsControlUser(
|
||||
'SELECT column_name, comment'
|
||||
. ($GLOBALS['cfgRelation']['mimework']
|
||||
? ', mimetype, transformation, transformation_options'
|
||||
@ -1245,7 +1246,7 @@ class Table
|
||||
. '\''
|
||||
: '')
|
||||
. ')';
|
||||
PMA_queryAsControlUser($new_comment_query);
|
||||
Relation::queryAsControlUser($new_comment_query);
|
||||
} // end while
|
||||
$GLOBALS['dbi']->freeResult($comments_copy_rs);
|
||||
unset($comments_copy_rs);
|
||||
@ -1484,7 +1485,7 @@ class Table
|
||||
$this->_db_name = $new_db;
|
||||
|
||||
// Renable table in configuration storage
|
||||
PMA_REL_renameTable(
|
||||
Relation::renameTable(
|
||||
$old_db, $new_db,
|
||||
$old_name, $new_name
|
||||
);
|
||||
@ -1679,7 +1680,7 @@ class Table
|
||||
*/
|
||||
protected function getUiPrefsFromDb()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$pma_table = Util::backquote($cfgRelation['db']) . "."
|
||||
. Util::backquote($cfgRelation['table_uiprefs']);
|
||||
|
||||
@ -1689,7 +1690,7 @@ class Table
|
||||
. " AND `db_name` = '" . $GLOBALS['dbi']->escapeString($this->_db_name) . "'"
|
||||
. " AND `table_name` = '" . $GLOBALS['dbi']->escapeString($this->_name) . "'";
|
||||
|
||||
$row = $this->_dbi->fetchArray(PMA_queryAsControlUser($sql_query));
|
||||
$row = $this->_dbi->fetchArray(Relation::queryAsControlUser($sql_query));
|
||||
if (isset($row[0])) {
|
||||
return json_decode($row[0], true);
|
||||
} else {
|
||||
@ -1704,7 +1705,7 @@ class Table
|
||||
*/
|
||||
protected function saveUiPrefsToDb()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$pma_table = Util::backquote($cfgRelation['db']) . "."
|
||||
. Util::backquote($cfgRelation['table_uiprefs']);
|
||||
|
||||
@ -1779,7 +1780,7 @@ class Table
|
||||
*/
|
||||
protected function loadUiPrefs()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$server_id = $GLOBALS['server'];
|
||||
|
||||
// set session variable if it's still undefined
|
||||
@ -1917,7 +1918,7 @@ class Table
|
||||
$this->uiprefs[$property] = $value;
|
||||
|
||||
// check if pmadb is set
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['uiprefswork']) {
|
||||
return $this->saveUiprefsToDb();
|
||||
}
|
||||
@ -1940,7 +1941,7 @@ class Table
|
||||
unset($this->uiprefs[$property]);
|
||||
|
||||
// check if pmadb is set
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['uiprefswork']) {
|
||||
return $this->saveUiprefsToDb();
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statements\AlterStatement;
|
||||
use PhpMyAdmin\SqlParser\Statements\CreateStatement;
|
||||
@ -64,10 +65,10 @@ class Tracker
|
||||
return false;
|
||||
}
|
||||
/* We need to avoid attempt to track any queries
|
||||
* from PMA_getRelationsParam
|
||||
* from Relation::getRelationsParam
|
||||
*/
|
||||
self::$enabled = false;
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
/* Restore original state */
|
||||
self::$enabled = true;
|
||||
if (! $cfgRelation['trackingwork']) {
|
||||
@ -131,10 +132,10 @@ class Tracker
|
||||
return self::$_tracking_cache[$dbname][$tablename];
|
||||
}
|
||||
/* We need to avoid attempt to track any queries
|
||||
* from PMA_getRelationsParam
|
||||
* from Relation::getRelationsParam
|
||||
*/
|
||||
self::$enabled = false;
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
/* Restore original state */
|
||||
self::$enabled = true;
|
||||
if (! $cfgRelation['trackingwork']) {
|
||||
@ -271,7 +272,7 @@ class Tracker
|
||||
'" . $GLOBALS['dbi']->escapeString($tracking_set)
|
||||
. "' )";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
$result = Relation::queryAsControlUser($sql_query);
|
||||
|
||||
if ($result) {
|
||||
// Deactivate previous version
|
||||
@ -305,7 +306,7 @@ class Tracker
|
||||
$sql_query .= " AND `version` = '"
|
||||
. $GLOBALS['dbi']->escapeString($version) . "'";
|
||||
}
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
$result = Relation::queryAsControlUser($sql_query);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -367,7 +368,7 @@ class Tracker
|
||||
'" . $GLOBALS['dbi']->escapeString($tracking_set)
|
||||
. "' )";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
$result = Relation::queryAsControlUser($sql_query);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -396,7 +397,7 @@ class Tracker
|
||||
" AND `table_name` = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
$result = Relation::queryAsControlUser($sql_query);
|
||||
|
||||
return $result;
|
||||
}
|
||||
@ -442,7 +443,7 @@ class Tracker
|
||||
" AND `table_name` = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
$result = PMA_queryAsControlUser($sql_query);
|
||||
$result = Relation::queryAsControlUser($sql_query);
|
||||
|
||||
return (boolean) $result;
|
||||
}
|
||||
@ -503,7 +504,7 @@ class Tracker
|
||||
$sql_query .= " AND FIND_IN_SET('"
|
||||
. $statement . "',tracking) > 0" ;
|
||||
}
|
||||
$row = $GLOBALS['dbi']->fetchArray(PMA_queryAsControlUser($sql_query));
|
||||
$row = $GLOBALS['dbi']->fetchArray(Relation::queryAsControlUser($sql_query));
|
||||
return isset($row[0])
|
||||
? $row[0]
|
||||
: -1;
|
||||
@ -533,7 +534,7 @@ class Tracker
|
||||
$sql_query .= " AND `version` = '" . $GLOBALS['dbi']->escapeString($version)
|
||||
. "' " . " ORDER BY `version` DESC LIMIT 1";
|
||||
|
||||
$mixed = $GLOBALS['dbi']->fetchAssoc(PMA_queryAsControlUser($sql_query));
|
||||
$mixed = $GLOBALS['dbi']->fetchAssoc(Relation::queryAsControlUser($sql_query));
|
||||
|
||||
// Parse log
|
||||
$log_schema_entries = explode('# log ', $mixed['schema_sql']);
|
||||
@ -878,7 +879,7 @@ class Tracker
|
||||
. $GLOBALS['dbi']->escapeString($result['tablename']) . "' " .
|
||||
" AND `version` = '" . $GLOBALS['dbi']->escapeString($version) . "' ";
|
||||
|
||||
PMA_queryAsControlUser($sql_query);
|
||||
Relation::queryAsControlUser($sql_query);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -890,7 +891,7 @@ class Tracker
|
||||
*/
|
||||
private static function _getTrackingTable()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
return Util::backquote($cfgRelation['db'])
|
||||
. '.' . Util::backquote($cfgRelation['tracking']);
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -255,7 +256,7 @@ class Tracking
|
||||
*/
|
||||
public static function getListOfVersionsOfTable()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$sql_query = " SELECT * FROM " .
|
||||
Util::backquote($cfgRelation['db']) . "." .
|
||||
Util::backquote($cfgRelation['tracking']) .
|
||||
@ -265,7 +266,7 @@ class Tracking
|
||||
$GLOBALS['dbi']->escapeString($_REQUEST['table']) . "' " .
|
||||
" ORDER BY version DESC ";
|
||||
|
||||
return PMA_queryAsControlUser($sql_query);
|
||||
return Relation::queryAsControlUser($sql_query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -409,8 +410,7 @@ class Tracking
|
||||
*/
|
||||
public static function getSqlResultForSelectableTables()
|
||||
{
|
||||
include_once 'libraries/relation.lib.php';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
$sql_query = " SELECT DISTINCT db_name, table_name FROM " .
|
||||
Util::backquote($cfgRelation['db']) . "." .
|
||||
@ -419,7 +419,7 @@ class Tracking
|
||||
"' " .
|
||||
" ORDER BY db_name, table_name";
|
||||
|
||||
return PMA_queryAsControlUser($sql_query);
|
||||
return Relation::queryAsControlUser($sql_query);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1640,7 +1640,7 @@ class Tracking
|
||||
. $GLOBALS['dbi']->escapeString($table_name)
|
||||
. '\' AND `version` = \'' . $version_number . '\'';
|
||||
|
||||
$table_result = PMA_queryAsControlUser($table_query);
|
||||
$table_result = Relation::queryAsControlUser($table_query);
|
||||
$version_data = $GLOBALS['dbi']->fetchArray($table_result);
|
||||
|
||||
$tbl_link = 'tbl_tracking.php' . $url_query . '&table='
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
@ -249,7 +250,7 @@ class Transformations
|
||||
*/
|
||||
public static function getMIME($db, $table, $strict = false, $fullName = false)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (! $cfgRelation['mimework']) {
|
||||
return false;
|
||||
@ -326,7 +327,7 @@ class Transformations
|
||||
public static function setMIME($db, $table, $key, $mimetype, $transformation,
|
||||
$transformationOpts, $inputTransform, $inputTransformOpts, $forcedelete = false
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (! $cfgRelation['mimework']) {
|
||||
return false;
|
||||
@ -345,7 +346,7 @@ class Transformations
|
||||
AND `table_name` = \'' . $GLOBALS['dbi']->escapeString($table) . '\'
|
||||
AND `column_name` = \'' . $GLOBALS['dbi']->escapeString($key) . '\'';
|
||||
|
||||
$test_rs = PMA_queryAsControlUser(
|
||||
$test_rs = Relation::queryAsControlUser(
|
||||
$test_qry, true, DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -407,7 +408,7 @@ class Transformations
|
||||
}
|
||||
|
||||
if (isset($upd_query)) {
|
||||
return PMA_queryAsControlUser($upd_query);
|
||||
return Relation::queryAsControlUser($upd_query);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -430,7 +431,7 @@ class Transformations
|
||||
*/
|
||||
public static function clear($db, $table = '', $column = '')
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (! isset($cfgRelation['column_info'])) {
|
||||
return false;
|
||||
|
||||
@ -40,6 +40,7 @@ use PhpMyAdmin\LanguageManager;
|
||||
use PhpMyAdmin\Logging;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\AuthenticationPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Session;
|
||||
use PhpMyAdmin\ThemeManager;
|
||||
@ -120,12 +121,6 @@ mb_internal_encoding('utf-8');
|
||||
*/
|
||||
ini_set('precision', 14);
|
||||
|
||||
/**
|
||||
* the relation lib, tracker needs it
|
||||
*/
|
||||
require './libraries/relation.lib.php';
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* start procedural code label_start_procedural */
|
||||
|
||||
@ -937,15 +932,15 @@ if (! defined('PMA_MINIMUM_COMMON')
|
||||
&& $GLOBALS['cfg']['ZeroConf'] == true
|
||||
) {
|
||||
if (! empty($GLOBALS['db'])) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (empty($cfgRelation['db'])) {
|
||||
PMA_fixPMATables($GLOBALS['db'], false);
|
||||
Relation::fixPmaTables($GLOBALS['db'], false);
|
||||
}
|
||||
}
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (empty($cfgRelation['db'])) {
|
||||
if ($GLOBALS['dblist']->databases->exists('phpmyadmin')) {
|
||||
PMA_fixPMATables('phpmyadmin', false);
|
||||
Relation::fixPmaTables('phpmyadmin', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,13 +7,12 @@
|
||||
*/
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Function to get html to display a page selector
|
||||
*
|
||||
@ -78,13 +77,13 @@ function PMA_getHtmlForPageSaveAs($db)
|
||||
*/
|
||||
function PMA_getPageIdsAndNames($db)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$page_query = "SELECT `page_nr`, `page_descr` FROM "
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db']) . "."
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. " WHERE db_name = '" . $GLOBALS['dbi']->escapeString($db) . "'"
|
||||
. " ORDER BY `page_descr`";
|
||||
$page_rs = PMA_queryAsControlUser(
|
||||
$page_rs = Relation::queryAsControlUser(
|
||||
$page_query, false, PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -185,7 +184,7 @@ function PMA_getSideMenuParamsArray()
|
||||
{
|
||||
$params = array();
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($GLOBALS['cfgRelation']['designersettingswork']) {
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins\ExportPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -249,7 +250,7 @@ function PMA_getOptionsForExportTemplates($export_type)
|
||||
$ret = '<option value="">-- ' . __('Select a template') . ' --</option>';
|
||||
|
||||
// Get the relation settings
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
$query = "SELECT `id`, `template_name` FROM "
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db']) . '.'
|
||||
@ -259,7 +260,7 @@ function PMA_getOptionsForExportTemplates($export_type)
|
||||
. "' AND `export_type` = '" . $GLOBALS['dbi']->escapeString($export_type) . "'"
|
||||
. " ORDER BY `template_name`;";
|
||||
|
||||
$result = PMA_queryAsControlUser($query);
|
||||
$result = Relation::queryAsControlUser($query);
|
||||
if (!$result) {
|
||||
return $ret;
|
||||
}
|
||||
@ -986,7 +987,7 @@ function PMA_getExportDisplay(
|
||||
$export_type, $db, $table, $sql_query, $num_tables,
|
||||
$unlim_num_rows, $multi_values
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if (isset($_REQUEST['single_table'])) {
|
||||
$GLOBALS['single_table'] = $_REQUEST['single_table'];
|
||||
@ -1099,7 +1100,7 @@ function PMA_handleExportTemplateActions($cfgRelation)
|
||||
break;
|
||||
}
|
||||
|
||||
$result = PMA_queryAsControlUser($query, false);
|
||||
$result = Relation::queryAsControlUser($query, false);
|
||||
|
||||
$response = Response::getInstance();
|
||||
if (! $result) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
@ -48,7 +49,7 @@ function PMA_getPrettyReportData()
|
||||
*/
|
||||
function PMA_getReportData($exception_type = 'js')
|
||||
{
|
||||
$relParams = PMA_getRelationsParam();
|
||||
$relParams = Relation::getRelationsParam();
|
||||
// common params for both, php & js exceptions
|
||||
$report = array(
|
||||
"pma_version" => PMA_VERSION,
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -74,7 +75,7 @@ function PMA_getHtmlForColumnsList(
|
||||
function PMA_getHtmlForCreateNewColumn(
|
||||
$num_fields, $db, $table, $columnMeta=array()
|
||||
) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$content_cells = array();
|
||||
$available_mime = array();
|
||||
$mime_map = array();
|
||||
@ -82,7 +83,7 @@ function PMA_getHtmlForCreateNewColumn(
|
||||
$mime_map = Transformations::getMIME($db, $table);
|
||||
$available_mime = Transformations::getAvailableMIMEtypes();
|
||||
}
|
||||
$comments_map = PMA_getComments($db, $table);
|
||||
$comments_map = Relation::getComments($db, $table);
|
||||
for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
|
||||
$content_cells[$columnNumber] = array(
|
||||
'columnNumber' => $columnNumber,
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin-Designer
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Table;
|
||||
|
||||
/**
|
||||
@ -16,7 +17,7 @@ if (! defined('PHPMYADMIN')) {
|
||||
|
||||
$GLOBALS['PMD']['STYLE'] = 'default';
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
/**
|
||||
* Retrieves table info and stores it in $GLOBALS['PMD']
|
||||
@ -63,7 +64,7 @@ function PMA_getTablesInfo()
|
||||
$one_table['ENGINE']
|
||||
);
|
||||
|
||||
$DF = PMA_getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
|
||||
$DF = Relation::getDisplayField($GLOBALS['db'], $one_table['TABLE_NAME']);
|
||||
if ($DF != '') {
|
||||
$retval[$GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i]] = $DF;
|
||||
}
|
||||
@ -124,7 +125,7 @@ function PMA_getScriptContr()
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($val = @$GLOBALS['dbi']->fetchRow($alltab_rs)) {
|
||||
$row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'internal');
|
||||
$row = Relation::getForeigners($GLOBALS['db'], $val[0], '', 'internal');
|
||||
|
||||
if ($row !== false) {
|
||||
foreach ($row as $field => $value) {
|
||||
@ -138,7 +139,7 @@ function PMA_getScriptContr()
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$row = PMA_getForeigners($GLOBALS['db'], $val[0], '', 'foreign');
|
||||
$row = Relation::getForeigners($GLOBALS['db'], $val[0], '', 'foreign');
|
||||
|
||||
if ($row !== false) {
|
||||
foreach ($row['foreign_keys_data'] as $one_key) {
|
||||
@ -248,7 +249,7 @@ function PMA_getScriptTabs()
|
||||
*/
|
||||
function PMA_getTablePositions($pg)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return null;
|
||||
}
|
||||
@ -282,7 +283,7 @@ function PMA_getTablePositions($pg)
|
||||
*/
|
||||
function PMA_getPageName($pg)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return null;
|
||||
}
|
||||
@ -310,7 +311,7 @@ function PMA_getPageName($pg)
|
||||
*/
|
||||
function PMA_deletePage($pg)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return false;
|
||||
}
|
||||
@ -318,7 +319,7 @@ function PMA_deletePage($pg)
|
||||
$query = "DELETE FROM " . PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['table_coords'])
|
||||
. " WHERE " . PhpMyAdmin\Util::backquote('pdf_page_number') . " = " . intval($pg);
|
||||
$success = PMA_queryAsControlUser(
|
||||
$success = Relation::queryAsControlUser(
|
||||
$query, true, PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -326,7 +327,7 @@ function PMA_deletePage($pg)
|
||||
$query = "DELETE FROM " . PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. " WHERE " . PhpMyAdmin\Util::backquote('page_nr') . " = " . intval($pg);
|
||||
$success = PMA_queryAsControlUser(
|
||||
$success = Relation::queryAsControlUser(
|
||||
$query, true, PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
}
|
||||
@ -344,7 +345,7 @@ function PMA_deletePage($pg)
|
||||
*/
|
||||
function PMA_getDefaultPage($db)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return null;
|
||||
}
|
||||
@ -379,7 +380,7 @@ function PMA_getDefaultPage($db)
|
||||
*/
|
||||
function PMA_getLoadingPage($db)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return null;
|
||||
}
|
||||
@ -419,9 +420,9 @@ function PMA_getLoadingPage($db)
|
||||
*/
|
||||
function PMA_createNewPage($pageName, $db)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
$pageNumber = PMA_REL_createPage(
|
||||
$pageNumber = Relation::createPage(
|
||||
$pageName,
|
||||
$cfgRelation,
|
||||
$db
|
||||
@ -440,7 +441,7 @@ function PMA_createNewPage($pageName, $db)
|
||||
*/
|
||||
function PMA_saveTablePositions($pg)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['pdfwork']) {
|
||||
return false;
|
||||
}
|
||||
@ -455,7 +456,7 @@ function PMA_saveTablePositions($pg)
|
||||
. " AND `pdf_page_number` = '" . $GLOBALS['dbi']->escapeString($pg)
|
||||
. "'";
|
||||
|
||||
$res = PMA_queryAsControlUser(
|
||||
$res = Relation::queryAsControlUser(
|
||||
$query,
|
||||
true,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
@ -482,7 +483,7 @@ function PMA_saveTablePositions($pg)
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['t_x'][$key]) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($_REQUEST['t_y'][$key]) . "')";
|
||||
|
||||
$res = PMA_queryAsControlUser(
|
||||
$res = Relation::queryAsControlUser(
|
||||
$query, true, PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
}
|
||||
@ -501,12 +502,12 @@ function PMA_saveTablePositions($pg)
|
||||
*/
|
||||
function PMA_saveDisplayField($db, $table, $field)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (!$cfgRelation['displaywork']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$disp = PMA_getDisplayField($db, $table);
|
||||
$disp = Relation::getDisplayField($db, $table);
|
||||
if ($disp && $disp === $field) {
|
||||
$field = '';
|
||||
}
|
||||
@ -543,8 +544,8 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update, $DB
|
||||
&& $type_T1 == $type_T2
|
||||
) {
|
||||
// relation exists?
|
||||
$existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
|
||||
$foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2);
|
||||
$existrel_foreign = Relation::getForeigners($DB2, $T2, '', 'foreign');
|
||||
$foreigner = Relation::searchColumnInForeigners($existrel_foreign, $F2);
|
||||
if ($foreigner
|
||||
&& isset($foreigner['constraint'])
|
||||
) {
|
||||
@ -630,7 +631,7 @@ function PMA_addNewRelation($db, $T1, $F1, $T2, $F2, $on_delete, $on_update, $DB
|
||||
. "'" . $GLOBALS['dbi']->escapeString($T1) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($F1) . "')";
|
||||
|
||||
if (PMA_queryAsControlUser($q, false, PhpMyAdmin\DatabaseInterface::QUERY_STORE)
|
||||
if (Relation::queryAsControlUser($q, false, PhpMyAdmin\DatabaseInterface::QUERY_STORE)
|
||||
) {
|
||||
return array(true, __('Internal relationship has been added.'));
|
||||
}
|
||||
@ -668,8 +669,8 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
&& $type_T1 == $type_T2
|
||||
) {
|
||||
// InnoDB
|
||||
$existrel_foreign = PMA_getForeigners($DB2, $T2, '', 'foreign');
|
||||
$foreigner = PMA_searchColumnInForeigners($existrel_foreign, $F2);
|
||||
$existrel_foreign = Relation::getForeigners($DB2, $T2, '', 'foreign');
|
||||
$foreigner = Relation::searchColumnInForeigners($existrel_foreign, $F2);
|
||||
|
||||
if (isset($foreigner['constraint'])) {
|
||||
$upd_query = 'ALTER TABLE ' . PhpMyAdmin\Util::backquote($DB2)
|
||||
@ -699,7 +700,7 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
. " AND foreign_table = '" . $GLOBALS['dbi']->escapeString($T1) . "'"
|
||||
. " AND foreign_field = '" . $GLOBALS['dbi']->escapeString($F1) . "'";
|
||||
|
||||
$result = PMA_queryAsControlUser(
|
||||
$result = Relation::queryAsControlUser(
|
||||
$delete_query,
|
||||
false,
|
||||
PhpMyAdmin\DatabaseInterface::QUERY_STORE
|
||||
@ -726,7 +727,7 @@ function PMA_removeRelation($T1, $F1, $T2, $F2)
|
||||
*/
|
||||
function PMA_saveDesignerSetting($index, $value)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$cfgDesigner = array(
|
||||
'user' => $GLOBALS['cfg']['Server']['user'],
|
||||
'db' => $cfgRelation['db'],
|
||||
@ -758,7 +759,7 @@ function PMA_saveDesignerSetting($index, $value)
|
||||
. " WHERE username = '"
|
||||
. $GLOBALS['dbi']->escapeString($cfgDesigner['user']) . "';";
|
||||
|
||||
$success = PMA_queryAsControlUser($save_query);
|
||||
$success = Relation::queryAsControlUser($save_query);
|
||||
} else {
|
||||
$save_data = array($index => $value);
|
||||
|
||||
@ -769,7 +770,7 @@ function PMA_saveDesignerSetting($index, $value)
|
||||
. " VALUES('" . $cfgDesigner['user'] . "',"
|
||||
. " '" . json_encode($save_data) . "');";
|
||||
|
||||
$success = PMA_queryAsControlUser($query);
|
||||
$success = Relation::queryAsControlUser($query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,8 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* Cleanup column related relation stuff
|
||||
*
|
||||
@ -17,7 +19,7 @@
|
||||
*/
|
||||
function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM '
|
||||
@ -28,7 +30,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
. '\''
|
||||
. ' AND column_name = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
@ -40,7 +42,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
. '\''
|
||||
. ' AND display_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
@ -53,7 +55,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
. '\''
|
||||
. ' AND master_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
@ -64,7 +66,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
. '\''
|
||||
. ' AND foreign_field = \'' . $GLOBALS['dbi']->escapeString($column)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,7 +80,7 @@ function PMA_relationsCleanupColumn($db, $table, $column)
|
||||
*/
|
||||
function PMA_relationsCleanupTable($db, $table)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM '
|
||||
@ -87,7 +89,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
@ -97,7 +99,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
@ -107,7 +109,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
@ -118,7 +120,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. '\''
|
||||
. ' AND master_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
@ -127,7 +129,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. '\''
|
||||
. ' AND foreign_table = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['uiprefswork']) {
|
||||
@ -137,7 +139,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\''
|
||||
. ' AND table_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['navwork']) {
|
||||
@ -150,7 +152,7 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
. ' OR (item_name = \'' . $GLOBALS['dbi']->escapeString($table)
|
||||
. '\''
|
||||
. ' AND item_type = \'table\'))';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,14 +165,14 @@ function PMA_relationsCleanupTable($db, $table)
|
||||
*/
|
||||
function PMA_relationsCleanupDatabase($db)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($cfgRelation['commwork']) {
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['column_info'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
@ -178,7 +180,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['bookmark'])
|
||||
. ' WHERE dbase = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['displaywork']) {
|
||||
@ -186,7 +188,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['table_info'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['pdfwork']) {
|
||||
@ -194,13 +196,13 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['pdf_pages'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['table_coords'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['relwork']) {
|
||||
@ -209,14 +211,14 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE master_db = \''
|
||||
. $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
|
||||
$remove_query = 'DELETE FROM '
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['relation'])
|
||||
. ' WHERE foreign_db = \'' . $GLOBALS['dbi']->escapeString($db)
|
||||
. '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['uiprefswork']) {
|
||||
@ -224,7 +226,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['table_uiprefs'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['navwork']) {
|
||||
@ -232,7 +234,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['navigationhiding'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['savedsearcheswork']) {
|
||||
@ -240,7 +242,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['savedsearches'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['centralcolumnswork']) {
|
||||
@ -248,7 +250,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
. PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. '.' . PhpMyAdmin\Util::backquote($cfgRelation['central_columns'])
|
||||
. ' WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\'';
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +263,7 @@ function PMA_relationsCleanupDatabase($db)
|
||||
*/
|
||||
function PMA_relationsCleanupUser($username)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
if ($cfgRelation['bookmarkwork']) {
|
||||
$remove_query = "DELETE FROM "
|
||||
@ -269,7 +271,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['bookmark'])
|
||||
. " WHERE `user` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['historywork']) {
|
||||
@ -278,7 +280,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['history'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['recentwork']) {
|
||||
@ -287,7 +289,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['recent'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['favoritework']) {
|
||||
@ -296,7 +298,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['favorite'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['uiprefswork']) {
|
||||
@ -305,7 +307,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['table_uiprefs'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['userconfigwork']) {
|
||||
@ -314,7 +316,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['userconfig'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['menuswork']) {
|
||||
@ -323,7 +325,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['users'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['navwork']) {
|
||||
@ -332,7 +334,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['navigationhiding'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['savedsearcheswork']) {
|
||||
@ -341,7 +343,7 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['savedsearches'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
|
||||
if ($cfgRelation['designersettingswork']) {
|
||||
@ -350,7 +352,6 @@ function PMA_relationsCleanupUser($username)
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['designer_settings'])
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($remove_query);
|
||||
Relation::queryAsControlUser($remove_query);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
/**
|
||||
@ -20,13 +21,13 @@ function PMA_getHtmlForListingUsersofAGroup($userGroup)
|
||||
. sprintf(__('Users of \'%s\' user group'), htmlspecialchars($userGroup))
|
||||
. '</h2>';
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$usersTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['users']);
|
||||
$sql_query = "SELECT `username` FROM " . $usersTable
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
if ($GLOBALS['dbi']->numRows($result) == 0) {
|
||||
$html_output .= '<p>'
|
||||
@ -60,11 +61,11 @@ function PMA_getHtmlForListingUsersofAGroup($userGroup)
|
||||
function PMA_getHtmlForUserGroupsTable()
|
||||
{
|
||||
$html_output = '<h2>' . __('User groups') . '</h2>';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$groupTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = "SELECT * FROM " . $groupTable . " ORDER BY `usergroup` ASC";
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
|
||||
if ($result && $GLOBALS['dbi']->numRows($result)) {
|
||||
$html_output .= '<form name="userGroupsForm" id="userGroupsForm"'
|
||||
@ -178,7 +179,7 @@ function _getAllowedTabNames($row, $level)
|
||||
*/
|
||||
function PMA_deleteUserGroup($userGroup)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$userTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['users']);
|
||||
$groupTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
@ -186,11 +187,11 @@ function PMA_deleteUserGroup($userGroup)
|
||||
$sql_query = "DELETE FROM " . $userTable
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
Relation::queryAsControlUser($sql_query, true);
|
||||
$sql_query = "DELETE FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
Relation::queryAsControlUser($sql_query, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,13 +243,13 @@ function PMA_getHtmlToEditUserGroup($userGroup = null)
|
||||
'table' => array()
|
||||
);
|
||||
if ($userGroup != null) {
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$groupTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = "SELECT * FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "'";
|
||||
$result = PMA_queryAsControlUser($sql_query, false);
|
||||
$result = Relation::queryAsControlUser($sql_query, false);
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
|
||||
$key = $row['tab'];
|
||||
@ -327,7 +328,7 @@ function _getTabList($title, $level, $selected)
|
||||
function PMA_editUserGroup($userGroup, $new = false)
|
||||
{
|
||||
$tabs = PhpMyAdmin\Util::getMenuTabList();
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$groupTable = PhpMyAdmin\Util::backquote($cfgRelation['db'])
|
||||
. "." . PhpMyAdmin\Util::backquote($cfgRelation['usergroups']);
|
||||
|
||||
@ -335,7 +336,7 @@ function PMA_editUserGroup($userGroup, $new = false)
|
||||
$sql_query = "DELETE FROM " . $groupTable
|
||||
. " WHERE `usergroup`='" . $GLOBALS['dbi']->escapeString($userGroup)
|
||||
. "';";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
Relation::queryAsControlUser($sql_query, true);
|
||||
}
|
||||
|
||||
$sql_query = "INSERT INTO " . $groupTable
|
||||
@ -355,5 +356,5 @@ function PMA_editUserGroup($userGroup, $new = false)
|
||||
}
|
||||
}
|
||||
$sql_query .= ";";
|
||||
PMA_queryAsControlUser($sql_query, true);
|
||||
Relation::queryAsControlUser($sql_query, true);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
use PhpMyAdmin\Di\Container;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -85,9 +86,9 @@ if (isset($selected) && is_array($selected)) {
|
||||
|
||||
$is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php');
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
$comments_map = PMA_getComments($db, $table);
|
||||
$comments_map = Relation::getComments($db, $table);
|
||||
|
||||
$move_columns = array();
|
||||
if (isset($fields_meta)) {
|
||||
@ -117,12 +118,12 @@ if (isset($_REQUEST['submit_num_fields'])
|
||||
$regenerate = 1;
|
||||
}
|
||||
|
||||
$foreigners = PMA_getForeigners($db, $table, '', 'foreign');
|
||||
$foreigners = Relation::getForeigners($db, $table, '', 'foreign');
|
||||
$child_references = null;
|
||||
// From MySQL 5.6.6 onwards columns with foreign keys can be renamed.
|
||||
// Hence, no need to get child references
|
||||
if ($GLOBALS['dbi']->getVersion() < 50606) {
|
||||
$child_references = PMA_getChildReferences($db, $table);
|
||||
$child_references = Relation::getChildReferences($db, $table);
|
||||
}
|
||||
|
||||
for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
|
||||
@ -285,7 +286,7 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
|
||||
&& isset($form_params['table'])
|
||||
&& $GLOBALS['dbi']->getVersion() < 50606
|
||||
) {
|
||||
$columnMeta['column_status'] = PMA_checkChildForeignReferences(
|
||||
$columnMeta['column_status'] = Relation::checkChildForeignReferences(
|
||||
$form_params['db'],
|
||||
$form_params['table'],
|
||||
$columnMeta['Field'],
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Sanitize;
|
||||
|
||||
if (!defined('PHPMYADMIN')) {
|
||||
@ -51,28 +52,13 @@ echo PhpMyAdmin\Template::get('list/unordered')->render(
|
||||
);
|
||||
echo '<div class="clearfloat"></div>';
|
||||
|
||||
|
||||
// show "configuration saved" message and reload navigation panel if needed
|
||||
if (!empty($_GET['saved'])) {
|
||||
Message::rawSuccess(__('Configuration has been saved.'))->display();
|
||||
}
|
||||
|
||||
/* debug code
|
||||
$arr = $cf->getConfigArray();
|
||||
$arr2 = array();
|
||||
foreach ($arr as $k => $v) {
|
||||
$arr2[] = "<b>$k</b> " . var_export($v, true);
|
||||
}
|
||||
$arr2 = implode(', ', $arr2);
|
||||
$arr2 .= '<br />Blacklist: ' . (empty($cfg['UserprefsDisallow'])
|
||||
? '<i>empty</i>'
|
||||
: implode(', ', $cfg['UserprefsDisallow']));
|
||||
$msg = Message::notice('Settings: ' . $arr2);
|
||||
$msg->display();
|
||||
//*/
|
||||
|
||||
// warn about using session storage for settings
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['userconfigwork']) {
|
||||
$msg = __(
|
||||
'Your preferences will be saved for current session only. Storing them '
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
@ -47,7 +48,7 @@ function PMA_userprefsPageInit(ConfigFile $cf)
|
||||
*/
|
||||
function PMA_loadUserprefs()
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if (! $cfgRelation['userconfigwork']) {
|
||||
// no pmadb table, use session storage
|
||||
if (! isset($_SESSION['userconfig'])) {
|
||||
@ -85,7 +86,7 @@ function PMA_loadUserprefs()
|
||||
*/
|
||||
function PMA_saveUserprefs(array $config_array)
|
||||
{
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$server = isset($GLOBALS['server'])
|
||||
? $GLOBALS['server']
|
||||
: $GLOBALS['cfg']['ServerDefault'];
|
||||
|
||||
@ -7,9 +7,10 @@
|
||||
*/
|
||||
|
||||
// Include common functionalities
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\Navigation\Navigation;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
|
||||
require_once './libraries/common.inc.php';
|
||||
|
||||
@ -30,7 +31,7 @@ if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
if (isset($_REQUEST['hideNavItem'])) {
|
||||
if (! empty($_REQUEST['itemName'])
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Plugins\SchemaPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
/**
|
||||
* Gets some core libraries
|
||||
@ -18,7 +19,7 @@ require_once 'libraries/common.inc.php';
|
||||
* get all variables needed for exporting relational schema
|
||||
* in $cfgRelation
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
require_once 'libraries/pmd_common.php';
|
||||
require_once 'libraries/plugin_interface.lib.php';
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Server\Privileges;
|
||||
|
||||
@ -22,7 +23,7 @@ require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/display_change_password.lib.php';
|
||||
require_once 'libraries/check_user_privileges.lib.php';
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
/**
|
||||
* Does the common work
|
||||
|
||||
@ -5,13 +5,14 @@
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/server_users.lib.php';
|
||||
require_once 'libraries/server_user_groups.lib.php';
|
||||
|
||||
PMA_getRelationsParam();
|
||||
Relation::getRelationsParam();
|
||||
if (! $GLOBALS['cfgRelation']['menuswork']) {
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\InsertEdit;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Util;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -92,7 +93,7 @@ if (! empty($disp_message)) {
|
||||
$table_columns = InsertEdit::getTableColumns($db, $table);
|
||||
|
||||
// retrieve keys into foreign fields, if any
|
||||
$foreigners = PMA_getForeigners($db, $table);
|
||||
$foreigners = Relation::getForeigners($db, $table);
|
||||
|
||||
// Retrieve form parameters for insert/edit form
|
||||
$_form_params = InsertEdit::getFormParametersForInsertForm(
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
|
||||
/**
|
||||
@ -24,7 +25,7 @@ $scripts = $header->getScripts();
|
||||
$scripts->addFile('export.js');
|
||||
|
||||
// Get the relation settings
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// handling export template actions
|
||||
if (isset($_REQUEST['templateAction']) && $cfgRelation['exporttemplateswork']) {
|
||||
|
||||
@ -9,6 +9,7 @@ use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Partition;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -43,10 +44,10 @@ $url_params['goto'] = $url_params['back'] = 'tbl_operations.php';
|
||||
/**
|
||||
* Gets relation settings
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
|
||||
// reselect current db (needed in some cases probably due to
|
||||
// the calling of relation.lib.php)
|
||||
// the calling of PhpMyAdmin\Relation)
|
||||
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
|
||||
|
||||
/**
|
||||
@ -457,7 +458,7 @@ unset($partition_names);
|
||||
|
||||
if ($cfgRelation['relwork'] && ! $pma_table->isEngine("INNODB")) {
|
||||
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
|
||||
$foreign = PMA_getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'internal');
|
||||
$foreign = Relation::getForeigners($GLOBALS['db'], $GLOBALS['table'], '', 'internal');
|
||||
|
||||
if (! empty($foreign)) {
|
||||
$response->addHTML(
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
|
||||
use PhpMyAdmin\Controllers\Table\TableRelationController;
|
||||
use PhpMyAdmin\Di\Container;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -41,7 +42,7 @@ $options_array = array(
|
||||
'NO_ACTION' => 'NO ACTION',
|
||||
'RESTRICT' => 'RESTRICT',
|
||||
);
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = Relation::getRelationsParam();
|
||||
$tbl_storage_engine = mb_strtoupper(
|
||||
$dbi->getTable($db, $table)->getStatusInfo('Engine')
|
||||
);
|
||||
@ -54,17 +55,17 @@ $dependency_definitions = array(
|
||||
"upd_query" => $upd_query
|
||||
);
|
||||
if ($cfgRelation['relwork']) {
|
||||
$dependency_definitions['existrel'] = PMA_getForeigners(
|
||||
$dependency_definitions['existrel'] = Relation::getForeigners(
|
||||
$db, $table, '', 'internal'
|
||||
);
|
||||
}
|
||||
if (Util::isForeignKeySupported($tbl_storage_engine)) {
|
||||
$dependency_definitions['existrel_foreign'] = PMA_getForeigners(
|
||||
$dependency_definitions['existrel_foreign'] = Relation::getForeigners(
|
||||
$db, $table, '', 'foreign'
|
||||
);
|
||||
}
|
||||
if ($cfgRelation['displaywork']) {
|
||||
$dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
|
||||
$dependency_definitions['disp'] = Relation::getDisplayField($db, $table);
|
||||
} else {
|
||||
$dependency_definitions['disp'] = 'asas';
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\InsertEdit;
|
||||
use PhpMyAdmin\Plugins\IOTransformationsPlugin;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Transformations;
|
||||
@ -381,7 +382,7 @@ if ($response->isAjax() && ! isset($_POST['ajax_page_request'])) {
|
||||
|
||||
if (isset($_REQUEST['rel_fields_list']) && $_REQUEST['rel_fields_list'] != '') {
|
||||
|
||||
$map = PMA_getForeigners($db, $table, '', 'both');
|
||||
$map = Relation::getForeigners($db, $table, '', 'both');
|
||||
|
||||
$relation_fields = array();
|
||||
parse_str($_REQUEST['rel_fields_list'], $relation_fields);
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="id_tbody_<?= $t_n_url; ?>" style="<?= (isset($tab_pos[$t_n]) && empty($tab_pos[$t_n]["V"])) ? 'display: none' : ''; ?>">
|
||||
<?php $display_field = PMA_getDisplayField(
|
||||
<?php $display_field = PhpMyAdmin\Relation::getDisplayField(
|
||||
$_GET['db'],
|
||||
$GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]
|
||||
);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php $cfgRelation = PMA_getRelationsParam(); ?>
|
||||
<?php $cfgRelation = PhpMyAdmin\Relation::getRelationsParam(); ?>
|
||||
<form action="db_designer.php" method="post" name="edit_delete_pages" id="edit_delete_pages" class="ajax">
|
||||
<?= PhpMyAdmin\Url::getHiddenInputs($db); ?>
|
||||
<fieldset id="page_edit_delete_options">
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?php $cfgRelation = PMA_getRelationsParam(); ?>
|
||||
<?php $cfgRelation = PhpMyAdmin\Relation::getRelationsParam(); ?>
|
||||
<!-- Do not expand HTML here, invisible characters will make javascript crash -->
|
||||
<div id="script_server" class="hide"><?= htmlspecialchars($GLOBALS['server']); ?></div>
|
||||
<div id="script_db" class="hide"><?= htmlspecialchars($_GET['db']); ?></div>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$cfgRelation = PhpMyAdmin\Relation::getRelationsParam();
|
||||
$choices = array(
|
||||
'same' => __('Save to selected page'),
|
||||
'new' => __('Create a page and save to it')
|
||||
|
||||
@ -151,7 +151,7 @@
|
||||
|
||||
<?php if ($cfgRelation['displaywork']): ?>
|
||||
<?php $save_row = array_values($columns);?>
|
||||
<?php $disp = PMA_getDisplayField($db, $table); ?>
|
||||
<?php $disp = PhpMyAdmin\Relation::getDisplayField($db, $table); ?>
|
||||
<fieldset>
|
||||
<label><?= __('Choose column to display:'); ?></label>
|
||||
<select name="display_field">
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
// Get inputbox based on different column types
|
||||
// (Foreign key, geometrical, enum)
|
||||
if ($_foreigners
|
||||
&& PMA_searchColumnInForeigners($_foreigners, $column_name)): ?>
|
||||
&& PhpMyAdmin\Relation::searchColumnInForeigners($_foreigners, $column_name)): ?>
|
||||
<?php if (is_array($foreignData['disp_row'])): ?>
|
||||
<select name="criteriaValues[<?= $column_index; ?>]"
|
||||
id="<?= $column_id , $column_index ?>">
|
||||
<?= PMA_foreignDropdown(
|
||||
<?= PhpMyAdmin\Relation::foreignDropdown(
|
||||
$foreignData['disp_row'], $foreignData['foreign_field'],
|
||||
$foreignData['foreign_display'], '', $foreignMaxLimit
|
||||
) ?>
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
$column_index++
|
||||
): ?>
|
||||
<?php
|
||||
$foreignData = PMA_getForeignData(
|
||||
$foreignData = PhpMyAdmin\Relation::getForeignData(
|
||||
$_foreigners,
|
||||
$_columnNames[$column_index],
|
||||
false,
|
||||
@ -57,7 +57,7 @@
|
||||
): ?>
|
||||
<?php
|
||||
$fieldpopup = $_columnNames[$column_index];
|
||||
$foreignData = PMA_getForeignData($_foreigners, $fieldpopup, false, '', '' );?>
|
||||
$foreignData = PhpMyAdmin\Relation::getForeignData($_foreigners, $fieldpopup, false, '', '' );?>
|
||||
<tr class="noclick">
|
||||
<!-- Display column Names -->
|
||||
<th><?= htmlspecialchars($_columnNames[$column_index]); ?></th>
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
use PhpMyAdmin\Bookmark;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Tests for Bookmark class
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
*/
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
*/
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
use PhpMyAdmin\DbQbe;
|
||||
|
||||
@ -12,7 +12,6 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DisplayResults;
|
||||
use PhpMyAdmin\Plugins\Transformations\Text_Plain_Link;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -14,7 +14,6 @@ use PhpMyAdmin\ErrorHandler;
|
||||
use PhpMyAdmin\Footer;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,6 @@ use PhpMyAdmin\Header;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -20,7 +20,6 @@ use ReflectionProperty;
|
||||
use stdClass;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Tests for PhpMyAdmin\InsertEdit
|
||||
|
||||
@ -13,7 +13,6 @@ $GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -14,7 +14,6 @@ use PhpMyAdmin\Menu;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,6 @@ namespace PhpMyAdmin\Tests;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -1,29 +1,24 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* tests for relation.lib.php
|
||||
* tests for PhpMyAdmin\Relation
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Tests for libraries/relation.lib.php
|
||||
* Tests for PhpMyAdmin\Relation
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
* @group medium
|
||||
*/
|
||||
class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
class RelationTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
@ -45,12 +40,10 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$GLOBALS['pmaThemePath'] = $GLOBALS['PMA_Theme']->getPath();
|
||||
$GLOBALS['cfg']['ServerDefault'] = 0;
|
||||
|
||||
include_once 'libraries/relation.lib.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_queryAsControlUser
|
||||
* Test for Relation::queryAsControlUser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -73,22 +66,22 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$sql = "insert into PMA_bookmark A,B values(1, 2)";
|
||||
$this->assertEquals(
|
||||
'executeResult1',
|
||||
PMA_queryAsControlUser($sql)
|
||||
Relation::queryAsControlUser($sql)
|
||||
);
|
||||
$this->assertEquals(
|
||||
'executeResult2',
|
||||
PMA_queryAsControlUser($sql, false)
|
||||
Relation::queryAsControlUser($sql, false)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getRelationsParam & PMA_getRelationsParamDiagnostic
|
||||
* Test for Relation::getRelationsParam & Relation::getRelationsParamDiagnostic
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMAGetRelationsParam()
|
||||
{
|
||||
$relationsPara = PMA_getRelationsParam();
|
||||
$relationsPara = Relation::getRelationsParam();
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$relationsPara['relwork']
|
||||
@ -106,7 +99,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$relationsPara['db']
|
||||
);
|
||||
|
||||
$retval = PMA_getRelationsParamDiagnostic($relationsPara);
|
||||
$retval = Relation::getRelationsParamDiagnostic($relationsPara);
|
||||
//check $cfg['Servers'][$i]['pmadb']
|
||||
$this->assertContains(
|
||||
"\$cfg['Servers'][\$i]['pmadb']",
|
||||
@ -153,7 +146,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
);
|
||||
|
||||
$relationsPara['db'] = false;
|
||||
$retval = PMA_getRelationsParamDiagnostic($relationsPara);
|
||||
$retval = Relation::getRelationsParamDiagnostic($relationsPara);
|
||||
|
||||
$result = __('General relation features');
|
||||
$this->assertContains(
|
||||
@ -173,7 +166,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getDisplayField
|
||||
* Test for Relation::getDisplayField
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -183,27 +176,27 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$table = 'CHARACTER_SETS';
|
||||
$this->assertEquals(
|
||||
'DESCRIPTION',
|
||||
PMA_getDisplayField($db, $table)
|
||||
Relation::getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'TABLES';
|
||||
$this->assertEquals(
|
||||
'TABLE_COMMENT',
|
||||
PMA_getDisplayField($db, $table)
|
||||
Relation::getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
$table = 'PMA';
|
||||
$this->assertEquals(
|
||||
false,
|
||||
PMA_getDisplayField($db, $table)
|
||||
Relation::getDisplayField($db, $table)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_getComments
|
||||
* Test for Relation::getComments
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -236,7 +229,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$db = 'information_schema';
|
||||
$this->assertEquals(
|
||||
array(''),
|
||||
PMA_getComments($db)
|
||||
Relation::getComments($db)
|
||||
);
|
||||
|
||||
$db = 'information_schema';
|
||||
@ -246,12 +239,12 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
'field1' => 'Comment1',
|
||||
'field2' => 'Comment1'
|
||||
),
|
||||
PMA_getComments($db, $table)
|
||||
Relation::getComments($db, $table)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_tryUpgradeTransformations
|
||||
* Test for Relation::tryUpgradeTransformations
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -275,14 +268,14 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
$GLOBALS['cfg']['Server']['column_info'] = 'column_info';
|
||||
|
||||
// Case 1
|
||||
$actual = PMA_tryUpgradeTransformations();
|
||||
$actual = Relation::tryUpgradeTransformations();
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$actual
|
||||
);
|
||||
|
||||
// Case 2
|
||||
$actual = PMA_tryUpgradeTransformations();
|
||||
$actual = Relation::tryUpgradeTransformations();
|
||||
$this->assertEquals(
|
||||
true,
|
||||
$actual
|
||||
@ -290,7 +283,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for PMA_searchColumnInForeigners
|
||||
* Test for Relation::searchColumnInForeigners
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -316,7 +309,7 @@ class PMA_Relation_Test extends PHPUnit_Framework_TestCase
|
||||
)
|
||||
);
|
||||
|
||||
$foreigner = PMA_searchColumnInForeigners($foreigners, 'id');
|
||||
$foreigner = Relation::searchColumnInForeigners($foreigners, 'id');
|
||||
$expected = array();
|
||||
$expected['foreign_field'] = 'id';
|
||||
$expected['foreign_db'] = 'GSoC14';
|
||||
@ -15,7 +15,6 @@ use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/relation_cleanup.lib.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -9,12 +9,12 @@
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Table;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ class TableTest extends PMATestCase
|
||||
$GLOBALS['sql_drop_table'] = true;
|
||||
$GLOBALS['cfg']['Server']['table_uiprefs'] = "pma__table_uiprefs";
|
||||
|
||||
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
|
||||
$GLOBALS['cfgRelation'] = Relation::getRelationsParam();
|
||||
$GLOBALS['dblist'] = new DataBasePMAMock();
|
||||
$GLOBALS['dblist']->databases = new DataBaseMock();
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ use PhpMyAdmin\Tracker;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,6 @@ use PhpMyAdmin\Tracking;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* Tests for PhpMyAdmin\Tracking
|
||||
|
||||
@ -13,7 +13,6 @@ use PhpMyAdmin\Transformations;
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
|
||||
/**
|
||||
* tests for transformation wrappers
|
||||
|
||||
@ -17,7 +17,6 @@ use PhpMyAdmin\Url;
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -14,7 +14,6 @@ use PhpMyAdmin\Tests\Stubs\Response as ResponseStub;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
*/
|
||||
use PhpMyAdmin\Controllers\Table\TableSearchController;
|
||||
use PhpMyAdmin\Di\Container;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Tests\Stubs\Response as ResponseStub;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\TypesMySQL;
|
||||
@ -44,7 +45,7 @@ class TableSearchControllerTest extends PMATestCase
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
|
||||
$GLOBALS['cfgRelation'] = PMA_getRelationsParam();
|
||||
$GLOBALS['cfgRelation'] = Relation::getRelationsParam();
|
||||
$GLOBALS['PMA_Types'] = new TypesMySQL();
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
|
||||
use PhpMyAdmin\Dbi\DbiMysql;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
use PhpMyAdmin\Dbi\DbiMysqli;
|
||||
use PhpMyAdmin\Theme;
|
||||
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
/**
|
||||
|
||||
@ -17,7 +17,6 @@ $GLOBALS['server'] = 0;
|
||||
$GLOBALS['cfg']['Server']['DisableIS'] = false;
|
||||
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/check_user_privileges.lib.php';
|
||||
require_once 'test/PMATestCase.php';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user