Translated using Weblate (Slovak)
[phpmyadmin.git] / tbl_find_replace.php
blob3b19ebf1fb6d9d84166fa78a18ad4f98af6c38b4
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Handles find and replace tab
6 * Displays find and replace form, allows previewing and do the replacing
8 * @package PhpMyAdmin
9 */
11 /**
12 * Gets some core libraries
14 require_once 'libraries/common.inc.php';
15 require_once 'libraries/TableSearch.class.php';
17 $response = PMA_Response::getInstance();
18 $table_search = new PMA_TableSearch($db, $table, "replace");
20 $connectionCharSet = $GLOBALS['dbi']->fetchValue(
21 "SHOW VARIABLES LIKE 'character_set_connection'", 0, 1
23 if (isset($_POST['find'])) {
24 $preview = $table_search->getReplacePreview(
25 $_POST['columnIndex'],
26 $_POST['find'],
27 $_POST['replaceWith'],
28 $_POST['useRegex'],
29 $connectionCharSet
31 $response->addJSON('preview', $preview);
32 exit;
35 $header = $response->getHeader();
36 $scripts = $header->getScripts();
37 $scripts->addFile('tbl_find_replace.js');
39 // Show secondary level of tabs
40 $htmlOutput = $table_search->getSecondaryTabs();
42 if (isset($_POST['replace'])) {
43 $htmlOutput .= $table_search->replace(
44 $_POST['columnIndex'],
45 $_POST['findString'],
46 $_POST['replaceWith'],
47 $_POST['useRegex'],
48 $connectionCharSet
50 $htmlOutput .= PMA_Util::getMessage(
51 __('Your SQL query has been executed successfully.'),
52 null, 'success'
56 if (! isset($goto)) {
57 $goto = $GLOBALS['cfg']['DefaultTabTable'];
59 // Defines the url to return to in case of error in the next sql statement
60 $params = array('db' => $db, 'table' => $table);
61 $err_url = $goto . '?' . PMA_URL_getCommon($params);
62 // Displays the find and replace form
63 $htmlOutput .= $table_search->getSelectionForm($goto);
64 $response->addHTML($htmlOutput);