diff --git a/browse_foreigners.php b/browse_foreigners.php index daba389733..b7c194f2e7 100644 --- a/browse_foreigners.php +++ b/browse_foreigners.php @@ -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'] diff --git a/chk_rel.php b/chk_rel.php index 3ba2323429..183ee4f338 100644 --- a/chk_rel.php +++ b/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) ); diff --git a/db_datadict.php b/db_datadict.php index 5cd979e86c..94e8beb860 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -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 '
' , "\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 ' '; - if ($foreigner = PMA_searchColumnInForeigners($res_rel, $column_name)) { + if ($foreigner = Relation::searchColumnInForeigners($res_rel, $column_name)) { echo htmlspecialchars( $foreigner['foreign_table'] . ' -> ' diff --git a/db_operations.php b/db_operations.php index 503a0ae5c0..174a36f09b 100644 --- a/db_operations.php +++ b/db_operations.php @@ -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 diff --git a/db_qbe.php b/db_qbe.php index a2b1e4a314..b571480be9 100644 --- a/db_qbe.php +++ b/db_qbe.php @@ -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; diff --git a/db_tracking.php b/db_tracking.php index 3f8f148180..32cbbe7ad7 100644 --- a/db_tracking.php +++ b/db_tracking.php @@ -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) diff --git a/export.php b/export.php index 9f153c8bca..c121f49901 100644 --- a/export.php +++ b/export.php @@ -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? diff --git a/index.php b/index.php index 3d236fd025..8c36ea173e 100644 --- a/index.php +++ b/index.php @@ -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 ) { diff --git a/libraries/central_columns.lib.php b/libraries/central_columns.lib.php index 28ee1f9c52..344d2572cc 100644 --- a/libraries/central_columns.lib.php +++ b/libraries/central_columns.lib.php @@ -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 diff --git a/libraries/classes/Bookmark.php b/libraries/classes/Bookmark.php index a4168d1a7e..01b0978d03 100644 --- a/libraries/classes/Bookmark.php +++ b/libraries/classes/Bookmark.php @@ -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'], diff --git a/libraries/classes/Console.php b/libraries/classes/Console.php index d33d968510..dab6e341be 100644 --- a/libraries/classes/Console.php +++ b/libraries/classes/Console.php @@ -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') diff --git a/libraries/classes/Controllers/Database/DatabaseStructureController.php b/libraries/classes/Controllers/Database/DatabaseStructureController.php index f13513b87d..6fc46929d6 100644 --- a/libraries/classes/Controllers/Database/DatabaseStructureController.php +++ b/libraries/classes/Controllers/Database/DatabaseStructureController.php @@ -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); } diff --git a/libraries/classes/Controllers/Table/TableRelationController.php b/libraries/classes/Controllers/Table/TableRelationController.php index 6d3d4137ac..de49fe7358 100644 --- a/libraries/classes/Controllers/Table/TableRelationController.php +++ b/libraries/classes/Controllers/Table/TableRelationController.php @@ -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(), ) ) ); diff --git a/libraries/classes/Controllers/Table/TableSearchController.php b/libraries/classes/Controllers/Table/TableSearchController.php index 9c325fc715..c0016f4d8d 100644 --- a/libraries/classes/Controllers/Table/TableSearchController.php +++ b/libraries/classes/Controllers/Table/TableSearchController.php @@ -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( diff --git a/libraries/classes/Controllers/Table/TableStructureController.php b/libraries/classes/Controllers/Table/TableStructureController.php index 5d2c70d940..28a5b7f96d 100644 --- a/libraries/classes/Controllers/Table/TableStructureController.php +++ b/libraries/classes/Controllers/Table/TableStructureController.php @@ -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); } diff --git a/libraries/classes/DbQbe.php b/libraries/classes/DbQbe.php index 65eeea356e..7c4e859b9f 100644 --- a/libraries/classes/DbQbe.php +++ b/libraries/classes/DbQbe.php @@ -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') { diff --git a/libraries/classes/DisplayResults.php b/libraries/classes/DisplayResults.php index eabada6697..99ec87d68d 100644 --- a/libraries/classes/DisplayResults.php +++ b/libraries/classes/DisplayResults.php @@ -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'], diff --git a/libraries/classes/Footer.php b/libraries/classes/Footer.php index d5938d0892..d8a66be6d6 100644 --- a/libraries/classes/Footer.php +++ b/libraries/classes/Footer.php @@ -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'], diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 1c3703f7cb..93bbf7f20f 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -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']) { diff --git a/libraries/classes/Menu.php b/libraries/classes/Menu.php index d214743533..91d3ef050d 100644 --- a/libraries/classes/Menu.php +++ b/libraries/classes/Menu.php @@ -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(); diff --git a/libraries/classes/Navigation/Navigation.php b/libraries/classes/Navigation/Navigation.php index f801b52c7b..f4e7fa2f3d 100644 --- a/libraries/classes/Navigation/Navigation.php +++ b/libraries/classes/Navigation/Navigation.php @@ -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) { diff --git a/libraries/classes/Navigation/Nodes/Node.php b/libraries/classes/Navigation/Nodes/Node.php index c8ca16dc5b..9017ae3a65 100644 --- a/libraries/classes/Navigation/Nodes/Node.php +++ b/libraries/classes/Navigation/Nodes/Node.php @@ -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( diff --git a/libraries/classes/Navigation/Nodes/NodeDatabase.php b/libraries/classes/Navigation/Nodes/NodeDatabase.php index 4698c68c5e..27ab2559d9 100644 --- a/libraries/classes/Navigation/Nodes/NodeDatabase.php +++ b/libraries/classes/Navigation/Nodes/NodeDatabase.php @@ -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( diff --git a/libraries/classes/Navigation/Nodes/NodeDatabaseChild.php b/libraries/classes/Navigation/Nodes/NodeDatabaseChild.php index d0616857eb..7a7d5cbff4 100644 --- a/libraries/classes/Navigation/Nodes/NodeDatabaseChild.php +++ b/libraries/classes/Navigation/Nodes/NodeDatabaseChild.php @@ -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; diff --git a/libraries/classes/Operations.php b/libraries/classes/Operations.php index e26a0e45c5..15ac55378b 100644 --- a/libraries/classes/Operations.php +++ b/libraries/classes/Operations.php @@ -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 .= ''; $html_output .= '' + . 'value="' . htmlspecialchars(Relation::getDbComment($db)) . '" />' . ''; $html_output .= '
' . '' @@ -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 .= ''; $html_output .= '