*/ require_once 'libraries/common.inc.php'; require_once 'libraries/TableSearch.class.php'; $response = PMA_Response::getInstance(); $table_search = new PMA_TableSearch($db, $table, "replace"); $connectionCharSet = $GLOBALS['dbi']->fetchValue("SHOW VARIABLES LIKE 'character_set_connection'", 0, 1); if (isset($_POST['find'])) { $preview = $table_search->getReplacePreview($_POST['columnIndex'], $_POST['find'], $_POST['replaceWith'], $connectionCharSet); $response->addJSON('preview', $preview); exit; } $header = $response->getHeader(); $scripts = $header->getScripts(); $scripts->addFile('tbl_find_replace.js'); // Show secondary level of tabs $htmlOutput = $table_search->getSecondaryTabs(); if (isset($_POST['replace'])) { $htmlOutput .= $table_search->replace($_POST['columnIndex'], $_POST['findString'], $_POST['replaceWith'], $connectionCharSet); $htmlOutput .= PMA_Util::getMessage(__('Your SQL query has been executed successfully.'), null, 'success'); } if (!isset($goto)) { $goto = $GLOBALS['cfg']['DefaultTabTable']; } // Defines the url to return to in case of error in the next sql statement $err_url = $goto . '?' . PMA_URL_getCommon($db, $table); // Displays the find and replace form $htmlOutput .= $table_search->getSelectionForm($goto); $response->addHTML($htmlOutput); ?> >>>>>>> b875702c9c06ab5012e52ff4337439b03918f453
$url_query .= '&goto=tbl_select.php&back=tbl_select.php'; // Gets tables informations require_once './libraries/tbl_info.inc.php'; if (!isset($goto)) { $goto = $GLOBALS['cfg']['DefaultTabTable']; } // Defines the url to return to in case of error in the next sql statement $err_url = $goto . PMA_URL_getCommon(array('db' => $db, 'table' => $table)); //Set default datalabel if not selected if (!isset($_POST['zoom_submit']) || $_POST['dataLabel'] == '') { $dataLabel = PMA_getDisplayField($db, $table); } else { $dataLabel = $_POST['dataLabel']; } // Displays the zoom search form $response->addHTML($table_search->getSecondaryTabs()); $response->addHTML($table_search->getSelectionForm($goto, $dataLabel)); /* * Handle the input criteria and generate the query result * Form for displaying query results */ if (isset($_POST['zoom_submit']) && $_POST['criteriaColumnNames'][0] != 'pma_null' && $_POST['criteriaColumnNames'][1] != 'pma_null' && $_POST['criteriaColumnNames'][0] != $_POST['criteriaColumnNames'][1]) { //Query generation part $sql_query = $table_search->buildSqlQuery(); $sql_query .= ' LIMIT ' . $_POST['maxPlotLimit']; //Query execution part $result = $GLOBALS['dbi']->query($sql_query . ";", null, PMA_DatabaseInterface::QUERY_STORE); $fields_meta = $GLOBALS['dbi']->getFieldsMeta($result); $data = array(); while ($row = $GLOBALS['dbi']->fetchAssoc($result)) { //Need a row with indexes as 0,1,2 for the getUniqueCondition
/** * Test for getSecondaryTabs * * @return void */ public function testGetSecondaryTabs() { $tableSearch = new PMA_TableSearch("PMA", "PMA_BookMark", "zoom"); $html = $tableSearch->getSecondaryTabs(); $this->assertContains('<ul id="topmenu2">', $html); //sub tabs $this->assertContains(__('Table search'), $html); $this->assertContains(__('Zoom search'), $html); $this->assertContains(__('Find and replace'), $html); }