echo PMA_generate_common_hidden_inputs($db); ?> <fieldset> <legend> <?php if ($cfg['PropertiesIconic']) { echo PMA_getImage('b_edit.png'); } echo __('Copy database to') . ':'; $drop_clause = 'DROP TABLE / DROP VIEW'; ?> </legend> <input type="text" name="newname" size="30" class="textfield" value="" /><br /> <?php $choices = array('structure' => __('Structure only'), 'data' => __('Structure and data'), 'dataonly' => __('Data only')); PMA_displayHtmlRadio('what', $choices, 'data', true); unset($choices); ?> <input type="checkbox" name="create_database_before_copying" value="1" id="checkbox_create_database_before_copying" checked="checked" /> <label for="checkbox_create_database_before_copying"> <?php echo __('CREATE DATABASE before copying'); ?> </label><br /> <input type="checkbox" name="drop_if_exists" value="true" id="checkbox_drop" /> <label for="checkbox_drop"><?php echo sprintf(__('Add %s'), $drop_clause); ?>
value="<?php echo $searched; ?> " /></td> </tr> <tr><td class="right vtop"> <?php echo __('Find:'); ?> </td> <td><?php $choices = array('1' => __('at least one of the words') . PMA_showHint(__('Words are separated by a space character (" ").')), '2' => __('all words') . PMA_showHint(__('Words are separated by a space character (" ").')), '3' => __('the exact phrase'), '4' => __('as regular expression') . ' ' . PMA_showMySQLDocu('Regexp', 'Regexp')); // 4th parameter set to true to add line breaks // 5th parameter set to false to avoid htmlspecialchars() escaping in the label // since we have some HTML in some labels PMA_displayHtmlRadio('search_option', $choices, $search_option, true, false); unset($choices); ?> </td> </tr> <tr><td class="right vtop"> <?php echo __('Inside tables:'); ?> </td> <td rowspan="2"> <?php echo ' <select name="table_select[]" size="6" multiple="multiple">' . "\n"; foreach ($tables_names_only as $each_table) { if (in_array($each_table, $tables_selected)) { $is_selected = ' selected="selected"';
/** * shows/displays the created page names in a drop down list * User can select any page number and edit it using dashboard etc * * @return void * @access public */ public function selectPage() { global $db, $table, $cfgRelation; $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages']) . ' WHERE db_name = \'' . PMA_sqlAddSlashes($db) . '\''; $page_rs = PMA_query_as_controluser($page_query, false, PMA_DBI_QUERY_STORE); if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) { ?> <form method="get" action="schema_edit.php" name="frm_select_page"> <fieldset> <legend> <?php echo __('Please choose a page to edit') . "\n"; ?> </legend> <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> <input type="hidden" name="do" value="selectpage" /> <select name="chpage" id="chpage" class="autosubmit"> <option value="0"><?php echo __('Select page'); ?> </option> <?php while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) { echo "\n" . ' ' . '<option value="' . $curr_page['page_nr'] . '"'; if (isset($this->chosenPage) && $this->chosenPage == $curr_page['page_nr']) { echo ' selected="selected"'; } echo '>' . $curr_page['page_nr'] . ': ' . htmlspecialchars($curr_page['page_descr']) . '</option>'; } // end while echo "\n"; ?> </select> <?php $choices = array('0' => __('Edit'), '1' => __('Delete')); PMA_displayHtmlRadio('action_choose', $choices, '0', false); unset($choices); ?> </fieldset> <fieldset class="tblFooters"> <input type="submit" value="<?php echo __('Go'); ?> " /><br /> </fieldset> </form> <?php } // end IF echo "\n"; }
while ($page = PMA_DBI_fetch_assoc($table_info_result)) { echo '<option value="' . $page['page_nr'] . '">'; echo htmlspecialchars($page['page_descr']); echo '</option>'; } echo '</select>'; echo '</p>'; $choices['import'] = __('Import from selected page'); $choices['export'] = __('Export to selected page'); } $choices['create_export'] = __('Create a page and export to it'); if (1 == count($choices)) { echo $choices['create_export']; echo '<input type="hidden" name="mode" value="create_export" />'; } else { PMA_displayHtmlRadio('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class = ''); } echo '<br />'; echo '<label for="newpage">' . __('New page name: ') . '</label>'; echo '<input id="newpage" type="text" name="newpage" />'; echo '<p>' . __('Export/Import to scale') . ':'; ?> <select name="scale"> <option value="1">1:1</option> <option value="2">1:2</option> <option value="3" selected>1:3 (<?php echo __('recommended'); ?> )</option> <option value="4">1:4</option> <option value="5">1:5</option>
<legend><?php echo __('Display order:'); ?> </legend> <select name="orderField"> <option value="--nil--"></option> <?php foreach ($fields_list as $each_field) { echo ' ' . '<option value="' . htmlspecialchars($each_field) . '">' . htmlspecialchars($each_field) . '</option>' . "\n"; } // end for ?> </select> <?php $choices = array('ASC' => __('Ascending'), 'DESC' => __('Descending')); PMA_displayHtmlRadio('order', $choices, 'ASC', false, true, "formelement"); unset($choices); ?> </fieldset> <br style="clear: both;"/> </div> </fieldset> <fieldset class="tblFooters"> <input type="hidden" name="max_number_of_fields" value="<?php echo $fields_cnt; ?> " /> <input type="submit" name="submit" value="<?php echo __('Go'); ?>
function testDisplayHtmlRadioEscapeLabelEscapeLabelWithClass() { $name = "test_display_radio"; $choices = array('value_1' => 'choice_1', 'value_&2' => 'choice&_<2>'); $checked_choice = "value_2"; $class = "test_class"; $out = ""; foreach ($choices as $choice_value => $choice_label) { $html_field_id = $name . '_' . $choice_value; $out .= '<div class="' . $class . '">'; $out .= '<input type="radio" name="' . $name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"'; if ($choice_value == $checked_choice) { $out .= ' checked="checked"'; } $out .= ' />' . "\n"; $out .= '<label for="' . $html_field_id . '">' . htmlspecialchars($choice_label) . '</label>'; $out .= '<br />'; $out .= '</div>'; $out .= "\n"; } $this->expectOutputString($out); PMA_displayHtmlRadio($name, $choices, $checked_choice, true, true, $class); }
/** * Displays the headers of the results table * * @param array &$is_display which elements to display * @param array &$fields_meta the list of fields properties * @param integer $fields_cnt the total number of fields returned by * the SQL query * @param array $analyzed_sql the analyzed query * @param string $sort_expression sort expression * @param string $sort_expression_nodirection sort expression without direction * @param string $sort_direction sort direction * * @return boolean $clause_is_unique * * @global string $db the database name * @global string $table the table name * @global string $goto the URL to go back in case of errors * @global string $sql_query the SQL query * @global integer $num_rows the total number of rows returned by the * SQL query * @global array $vertical_display informations used with vertical display * mode * * @access private * * @see PMA_displayTable() */ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $analyzed_sql = '', $sort_expression = '', $sort_expression_nodirection = '', $sort_direction = '') { global $db, $table, $goto; global $sql_query, $num_rows; global $vertical_display, $highlight_columns; // required to generate sort links that will remember whether the // "Show all" button has been clicked $sql_md5 = md5($GLOBALS['sql_query']); $session_max_rows = $_SESSION['tmp_user_values']['query'][$sql_md5]['max_rows']; $direction = isset($_SESSION['tmp_user_values']['disp_direction']) ? $_SESSION['tmp_user_values']['disp_direction'] : ''; if ($analyzed_sql == '') { $analyzed_sql = array(); } // can the result be sorted? if ($is_display['sort_lnk'] == '1') { // Just as fallback $unsorted_sql_query = $sql_query; if (isset($analyzed_sql[0]['unsorted_query'])) { $unsorted_sql_query = $analyzed_sql[0]['unsorted_query']; } // Handles the case of multiple clicks on a column's header // which would add many spaces before "ORDER BY" in the // generated query. $unsorted_sql_query = trim($unsorted_sql_query); // sorting by indexes, only if it makes sense (only one table ref) if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['querytype']) && $analyzed_sql[0]['querytype'] == 'SELECT' && isset($analyzed_sql[0]['table_ref']) && count($analyzed_sql[0]['table_ref']) == 1) { // grab indexes data: $indexes = PMA_Index::getFromTable($table, $db); // do we have any index? if ($indexes) { if ($direction == 'horizontal' || $direction == 'horizontalflipped') { $span = $fields_cnt; if ($is_display['edit_lnk'] != 'nn') { $span++; } if ($is_display['del_lnk'] != 'nn') { $span++; } if ($is_display['del_lnk'] != 'kp' && $is_display['del_lnk'] != 'nn') { $span++; } } else { $span = $num_rows + floor($num_rows / $_SESSION['tmp_user_values']['repeat_cells']) + 1; } echo '<form action="sql.php" method="post">' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table); echo __('Sort by key') . ': <select name="sql_query" class="autosubmit">' . "\n"; $used_index = false; $local_order = isset($sort_expression) ? $sort_expression : ''; foreach ($indexes as $index) { $asc_sort = '`' . implode('` ASC, `', array_keys($index->getColumns())) . '` ASC'; $desc_sort = '`' . implode('` DESC, `', array_keys($index->getColumns())) . '` DESC'; $used_index = $used_index || $local_order == $asc_sort || $local_order == $desc_sort; if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|' . 'FOR UPDATE|LOCK IN SHARE MODE))@is', $unsorted_sql_query, $my_reg)) { $unsorted_sql_query_first_part = $my_reg[1]; $unsorted_sql_query_second_part = $my_reg[2]; } else { $unsorted_sql_query_first_part = $unsorted_sql_query; $unsorted_sql_query_second_part = ''; } echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $asc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Ascending') . ')</option>'; echo '<option value="' . htmlspecialchars($unsorted_sql_query_first_part . "\n" . ' ORDER BY ' . $desc_sort . $unsorted_sql_query_second_part) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . __('Descending') . ')</option>'; } echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"') . '>' . __('None') . '</option>'; echo '</select>' . "\n"; echo '</form>' . "\n"; } } } // Output data needed for grid editing echo '<input id="save_cells_at_once" type="hidden" value="' . $GLOBALS['cfg']['SaveCellsAtOnce'] . '" />'; echo '<div class="common_hidden_inputs">'; echo PMA_generate_common_hidden_inputs($db, $table); echo '</div>'; // Output data needed for column reordering and show/hide column if (PMA_isSelect()) { // generate the column order, if it is set $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']); $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER); if ($col_order) { echo '<input id="col_order" type="hidden" value="' . implode(',', $col_order) . '" />'; } $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB); if ($col_visib) { echo '<input id="col_visib" type="hidden" value="' . implode(',', $col_visib) . '" />'; } // generate table create time if (!PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) { echo '<input id="table_create_time" type="hidden" value="' . PMA_Table::sGetStatusInfo($GLOBALS['db'], $GLOBALS['table'], 'Create_time') . '" />'; } } $vertical_display['emptypre'] = 0; $vertical_display['emptyafter'] = 0; $vertical_display['textbtn'] = ''; // Display options (if we are not in print view) if (!(isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) { echo '<form method="post" action="sql.php" name="displayOptionsForm" ' . 'id="displayOptionsForm"'; if ($GLOBALS['cfg']['AjaxEnable']) { echo ' class="ajax" '; } echo '>'; $url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'display_options_form' => 1); echo PMA_generate_common_hidden_inputs($url_params); echo '<br />'; PMA_generateSliderEffect('displayoptions', __('Options')); echo '<fieldset>'; echo '<div class="formelement">'; $choices = array('P' => __('Partial texts'), 'F' => __('Full texts')); PMA_displayHtmlRadio('display_text', $choices, $_SESSION['tmp_user_values']['display_text']); echo '</div>'; // prepare full/partial text button or link $url_params_full_text = array('db' => $db, 'table' => $table, 'sql_query' => $sql_query, 'goto' => $goto, 'full_text_button' => 1); if ($_SESSION['tmp_user_values']['display_text'] == 'F') { // currently in fulltext mode so show the opposite link $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_partialtext.png'; $tmp_txt = __('Partial texts'); $url_params_full_text['display_text'] = 'P'; } else { $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_fulltext.png'; $tmp_txt = __('Full texts'); $url_params_full_text['display_text'] = 'F'; } $tmp_image = '<img class="fulltext" src="' . $tmp_image_file . '" alt="' . $tmp_txt . '" title="' . $tmp_txt . '" />'; $tmp_url = 'sql.php' . PMA_generate_common_url($url_params_full_text); $full_or_partial_text_link = PMA_linkOrButton($tmp_url, $tmp_image, array(), false); unset($tmp_image_file, $tmp_txt, $tmp_url, $tmp_image); if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) { echo '<div class="formelement">'; $choices = array('K' => __('Relational key'), 'D' => __('Relational display column')); PMA_displayHtmlRadio('relational_display', $choices, $_SESSION['tmp_user_values']['relational_display']); echo '</div>'; } echo '<div class="formelement">'; echo PMA_getCheckbox('display_binary', __('Show binary contents'), !empty($_SESSION['tmp_user_values']['display_binary']), false); echo '<br />'; echo PMA_getCheckbox('display_blob', __('Show BLOB contents'), !empty($_SESSION['tmp_user_values']['display_blob']), false); echo '<br />'; echo PMA_getCheckbox('display_binary_as_hex', __('Show binary contents as HEX'), !empty($_SESSION['tmp_user_values']['display_binary_as_hex']), false); echo '</div>'; // I would have preferred to name this "display_transformation". // This is the only way I found to be able to keep this setting sticky // per SQL query, and at the same time have a default that displays // the transformations. echo '<div class="formelement">'; echo PMA_getCheckbox('hide_transformation', __('Hide browser transformation'), !empty($_SESSION['tmp_user_values']['hide_transformation']), false); echo '</div>'; if (!PMA_DRIZZLE) { echo '<div class="formelement">'; $choices = array('GEOM' => __('Geometry'), 'WKT' => __('Well Known Text'), 'WKB' => __('Well Known Binary')); PMA_displayHtmlRadio('geometry_display', $choices, $_SESSION['tmp_user_values']['geometry_display']); echo '</div>'; } echo '<div class="clearfloat"></div>'; echo '</fieldset>'; echo '<fieldset class="tblFooters">'; echo '<input type="submit" value="' . __('Go') . '" />'; echo '</fieldset>'; echo '</div>'; echo '</form>'; } // Start of form for multi-rows edit/delete/export if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp') { echo '<form method="post" action="tbl_row_action.php" name="resultsForm" ' . 'id="resultsForm"'; if ($GLOBALS['cfg']['AjaxEnable']) { echo ' class="ajax" '; } echo '>' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 1); echo '<input type="hidden" name="goto" value="sql.php" />' . "\n"; } echo '<table id="table_results" class="data'; if ($GLOBALS['cfg']['AjaxEnable']) { echo ' ajax'; } echo '">' . "\n"; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { echo '<thead><tr>' . "\n"; } // 1. Displays the full/partial text button (part 1)... if ($direction == 'horizontal' || $direction == 'horizontalflipped') { $colspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' colspan="4"' : ''; } else { $rowspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' rowspan="4"' : ''; } // ... before the result table if ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn' && $is_display['text_btn'] == '1') { $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { ?> <th colspan="<?php echo $fields_cnt; ?> "></th> </tr> <tr> <?php // end horizontal/horizontalflipped mode } else { ?> <tr> <th colspan="<?php echo $num_rows + floor($num_rows / $_SESSION['tmp_user_values']['repeat_cells']) + 1; ?> "></th> </tr> <?php } // end vertical mode } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && $is_display['text_btn'] == '1') { // ... at the left column of the result table header if possible // and required $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { ?> <th <?php echo $colspan; ?> ><?php echo $full_or_partial_text_link; ?> </th> <?php // end horizontal/horizontalflipped mode } else { $vertical_display['textbtn'] = ' <th ' . $rowspan . ' class="vmiddle">' . "\n" . ' ' . "\n" . ' </th>' . "\n"; } // end vertical mode } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) { // ... elseif no button, displays empty(ies) col(s) if required $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 0; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { ?> <td<?php echo $colspan; ?> ></td> <?php // end horizontal/horizontalfipped mode } else { $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n"; } // end vertical mode } elseif ($GLOBALS['cfg']['RowActionLinks'] == 'none' && ($direction == 'horizontal' || $direction == 'horizontalflipped')) { // ... elseif display an empty column if the actions links are disabled to // match the rest of the table echo '<th></th>'; } // 2. Displays the fields' name // 2.0 If sorting links should be used, checks if the query is a "JOIN" // statement (see 2.1.3) // 2.0.1 Prepare Display column comments if enabled // ($GLOBALS['cfg']['ShowBrowseComments']). // Do not show comments, if using horizontalflipped mode, // because of space usage if ($GLOBALS['cfg']['ShowBrowseComments'] && $direction != 'horizontalflipped') { $comments_map = array(); if (isset($analyzed_sql[0]) && is_array($analyzed_sql[0])) { foreach ($analyzed_sql[0]['table_ref'] as $tbl) { $tb = $tbl['table_true_name']; $comments_map[$tb] = PMA_getComments($db, $tb); unset($tb); } } } if ($GLOBALS['cfgRelation']['commwork'] && $GLOBALS['cfgRelation']['mimework'] && $GLOBALS['cfg']['BrowseMIME'] && !$_SESSION['tmp_user_values']['hide_transformation']) { include_once './libraries/transformations.lib.php'; $GLOBALS['mime_map'] = PMA_getMIME($db, $table); } // See if we have to highlight any header fields of a WHERE query. // Uses SQL-Parser results. $highlight_columns = array(); if (isset($analyzed_sql) && isset($analyzed_sql[0]) && isset($analyzed_sql[0]['where_clause_identifiers'])) { $wi = 0; if (isset($analyzed_sql[0]['where_clause_identifiers']) && is_array($analyzed_sql[0]['where_clause_identifiers'])) { foreach ($analyzed_sql[0]['where_clause_identifiers'] as $wci_nr => $wci) { $highlight_columns[$wci] = 'true'; } } } if (PMA_isSelect()) { // prepare to get the column order, if available $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']); $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER); $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB); } else { $col_order = false; $col_visib = false; } for ($j = 0; $j < $fields_cnt; $j++) { // assign $i with appropriate column order $i = $col_order ? $col_order[$j] : $j; // See if this column should get highlight because it's used in the // where-query. if (isset($highlight_columns[$fields_meta[$i]->name]) || isset($highlight_columns[PMA_backquote($fields_meta[$i]->name)])) { $condition_field = true; } else { $condition_field = false; } // 2.0 Prepare comment-HTML-wrappers for each row, if defined/enabled. if (isset($comments_map) && isset($comments_map[$fields_meta[$i]->table]) && isset($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name])) { $comments = '<span class="tblcomment">' . htmlspecialchars($comments_map[$fields_meta[$i]->table][$fields_meta[$i]->name]) . '</span>'; } else { $comments = ''; } // 2.1 Results can be sorted if ($is_display['sort_lnk'] == '1') { // 2.1.1 Checks if the table name is required; it's the case // for a query with a "JOIN" statement and if the column // isn't aliased, or in queries like // SELECT `1`.`master_field` , `2`.`master_field` // FROM `PMA_relation` AS `1` , `PMA_relation` AS `2` if (isset($fields_meta[$i]->table) && strlen($fields_meta[$i]->table)) { $sort_tbl = PMA_backquote($fields_meta[$i]->table) . '.'; } else { $sort_tbl = ''; } // 2.1.2 Checks if the current column is used to sort the // results // the orgname member does not exist for all MySQL versions // but if found, it's the one on which to sort $name_to_use_in_sort = $fields_meta[$i]->name; $is_orgname = false; if (isset($fields_meta[$i]->orgname) && strlen($fields_meta[$i]->orgname)) { $name_to_use_in_sort = $fields_meta[$i]->orgname; $is_orgname = true; } // $name_to_use_in_sort might contain a space due to // formatting of function expressions like "COUNT(name )" // so we remove the space in this situation $name_to_use_in_sort = str_replace(' )', ')', $name_to_use_in_sort); if (empty($sort_expression)) { $is_in_sort = false; } else { // Field name may be preceded by a space, or any number // of characters followed by a dot (tablename.fieldname) // so do a direct comparison for the sort expression; // this avoids problems with queries like // "SELECT id, count(id)..." and clicking to sort // on id or on count(id). // Another query to test this: // SELECT p.*, FROM_UNIXTIME(p.temps) FROM mytable AS p // (and try clicking on each column's header twice) if (!empty($sort_tbl) && strpos($sort_expression_nodirection, $sort_tbl) === false && strpos($sort_expression_nodirection, '(') === false) { $new_sort_expression_nodirection = $sort_tbl . $sort_expression_nodirection; } else { $new_sort_expression_nodirection = $sort_expression_nodirection; } $is_in_sort = false; $sort_name = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort; if ($sort_name == str_replace('`', '', $new_sort_expression_nodirection) || $sort_name == str_replace('`', '', $sort_expression_nodirection)) { $is_in_sort = true; } } // 2.1.3 Check the field name for a bracket. // If it contains one, it's probably a function column // like 'COUNT(`field`)' // It still might be a column name of a view. See bug #3383711 // Check is_orgname. if (strpos($name_to_use_in_sort, '(') !== false && !$is_orgname) { $sort_order = "\n" . 'ORDER BY ' . $name_to_use_in_sort . ' '; } else { $sort_order = "\n" . 'ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' '; } unset($name_to_use_in_sort); unset($is_orgname); // 2.1.4 Do define the sorting URL if (!$is_in_sort) { // patch #455484 ("Smart" order) $GLOBALS['cfg']['Order'] = strtoupper($GLOBALS['cfg']['Order']); if ($GLOBALS['cfg']['Order'] === 'SMART') { $sort_order .= preg_match('@time|date@i', $fields_meta[$i]->type) ? 'DESC' : 'ASC'; } else { $sort_order .= $GLOBALS['cfg']['Order']; } $order_img = ''; } elseif ('DESC' == $sort_direction) { $sort_order .= ' ASC'; $order_img = ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg{$i}", 'title' => '')); $order_img .= ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg{$i} hide", 'title' => '')); } else { $sort_order .= ' DESC'; $order_img = ' ' . PMA_getImage('s_asc.png', __('Ascending'), array('class' => "soimg{$i}", 'title' => '')); $order_img .= ' ' . PMA_getImage('s_desc.png', __('Descending'), array('class' => "soimg{$i} hide", 'title' => '')); } if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|' . 'LOCK IN SHARE MODE))@is', $unsorted_sql_query, $regs3)) { $sorted_sql_query = $regs3[1] . $sort_order . $regs3[2]; } else { $sorted_sql_query = $unsorted_sql_query . $sort_order; } $_url_params = array('db' => $db, 'table' => $table, 'sql_query' => $sorted_sql_query, 'session_max_rows' => $session_max_rows); $order_url = 'sql.php' . PMA_generate_common_url($_url_params); // 2.1.5 Displays the sorting URL // enable sort order swapping for image $order_link_params = array(); if (isset($order_img) && $order_img != '') { if (strstr($order_img, 'asc')) { $order_link_params['onmouseover'] = "\$('.soimg{$i}').toggle()"; $order_link_params['onmouseout'] = "\$('.soimg{$i}').toggle()"; } elseif (strstr($order_img, 'desc')) { $order_link_params['onmouseover'] = "\$('.soimg{$i}').toggle()"; $order_link_params['onmouseout'] = "\$('.soimg{$i}').toggle()"; } } if ($GLOBALS['cfg']['HeaderFlipType'] == 'auto') { if (PMA_USR_BROWSER_AGENT == 'IE') { $GLOBALS['cfg']['HeaderFlipType'] = 'css'; } else { $GLOBALS['cfg']['HeaderFlipType'] = 'fake'; } } if ($direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') { $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;'; } $order_link_params['title'] = __('Sort'); $order_link_content = $direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake' ? PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), "<br />\n") : htmlspecialchars($fields_meta[$i]->name); $order_link = PMA_linkOrButton($order_url, $order_link_content . $order_img, $order_link_params, false, true); if ($direction == 'horizontal' || $direction == 'horizontalflipped') { echo '<th'; $th_class = array(); $th_class[] = 'draggable'; if ($col_visib && !$col_visib[$j]) { $th_class[] = 'hide'; } if ($condition_field) { $th_class[] = 'condition'; } $th_class[] = 'column_heading'; if ($GLOBALS['cfg']['BrowsePointerEnable'] == true) { $th_class[] = 'pointer'; } if ($GLOBALS['cfg']['BrowseMarkerEnable'] == true) { $th_class[] = 'marker'; } echo ' class="' . implode(' ', $th_class); if ($direction == 'horizontalflipped') { echo ' vbottom'; } echo '" data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">' . $order_link . $comments . '</th>'; } $vertical_display['desc'][] = ' <th ' . 'class="draggable' . ($condition_field ? ' condition' : '') . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">' . "\n" . $order_link . $comments . ' </th>' . "\n"; } else { if ($direction == 'horizontal' || $direction == 'horizontalflipped') { echo '<th'; $th_class = array(); $th_class[] = 'draggable'; if ($col_visib && !$col_visib[$j]) { $th_class[] = 'hide'; } if ($condition_field) { $th_class[] = 'condition'; } echo ' class="' . implode(' ', $th_class); if ($direction == 'horizontalflipped') { echo ' vbottom'; } echo '"'; if ($direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') { echo ' style="direction: ltr; writing-mode: tb-rl;"'; } echo ' data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">'; if ($direction == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'fake') { echo PMA_flipstring(htmlspecialchars($fields_meta[$i]->name), '<br />'); } else { echo htmlspecialchars($fields_meta[$i]->name); } echo "\n" . $comments . '</th>'; } $vertical_display['desc'][] = ' <th ' . 'class="draggable' . ($condition_field ? ' condition"' : '') . '" data-column="' . htmlspecialchars($fields_meta[$i]->name) . '">' . "\n" . ' ' . htmlspecialchars($fields_meta[$i]->name) . "\n" . $comments . ' </th>'; } // end else (2.2) } // end for // 3. Displays the needed checkboxes at the right // column of the result table header if possible and required... if (($GLOBALS['cfg']['RowActionLinks'] == 'right' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn') && $is_display['text_btn'] == '1') { $vertical_display['emptyafter'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 1; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { echo "\n"; ?> <th <?php echo $colspan; ?> ><?php echo $full_or_partial_text_link; ?> </th> <?php // end horizontal/horizontalflipped mode } else { $vertical_display['textbtn'] = ' <th ' . $rowspan . ' class="vmiddle">' . "\n" . ' ' . "\n" . ' </th>' . "\n"; } // end vertical mode } elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && (!isset($GLOBALS['is_header_sent']) || !$GLOBALS['is_header_sent'])) { $vertical_display['emptyafter'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 4 : 1; if ($direction == 'horizontal' || $direction == 'horizontalflipped') { echo "\n"; ?> <td<?php echo $colspan; ?> ></td> <?php // end horizontal/horizontalflipped mode } else { $vertical_display['textbtn'] = ' <td' . $rowspan . '></td>' . "\n"; } // end vertical mode } if ($direction == 'horizontal' || $direction == 'horizontalflipped') { ?> </tr> </thead> <?php } return true; }
} // Provide a line with links to the relevant database and table if (isset($dbname) && empty($dbname_is_wildcard)) { echo '[ ' . __('Database') . ' <a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['url_query'] . '&db=' . $url_dbname . '&reload=1">' . htmlspecialchars($dbname) . ': ' . PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabDatabase']) . "</a> ]\n"; if (isset($tablename)) { echo ' [ ' . __('Table') . ' <a href="' . $GLOBALS['cfg']['DefaultTabTable'] . '?' . $GLOBALS['url_query'] . '&db=' . $url_dbname . '&table=' . htmlspecialchars(urlencode($tablename)) . '&reload=1">' . htmlspecialchars($tablename) . ': ' . PMA_getTitleForTarget($GLOBALS['cfg']['DefaultTabTable']) . "</a> ]\n"; } unset($url_dbname); } if (!isset($dbname) && !$user_does_not_exists) { include_once 'libraries/display_change_password.lib.php'; echo '<form action="server_privileges.php" method="post" onsubmit="return checkPassword(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '') . '<input type="hidden" name="old_username" value="' . htmlspecialchars($username) . '" />' . "\n" . '<input type="hidden" name="old_hostname" value="' . htmlspecialchars($hostname) . '" />' . "\n" . '<fieldset id="fieldset_change_copy_user">' . "\n" . ' <legend>' . __('Change Login Information / Copy User') . '</legend>' . "\n"; PMA_displayLoginInformationFields('change'); echo ' <fieldset>' . "\n" . ' <legend>' . __('Create a new user with the same privileges and ...') . '</legend>' . "\n"; $choices = array('4' => __('... keep the old one.'), '1' => __('... delete the old one from the user tables.'), '2' => __('... revoke all active privileges from the old one and delete it afterwards.'), '3' => __('... delete the old one from the user tables and reload the privileges afterwards.')); PMA_displayHtmlRadio('mode', $choices, '4', true); unset($choices); echo ' </fieldset>' . "\n" . '</fieldset>' . "\n" . '<fieldset id="fieldset_change_copy_user_footer" class="tblFooters">' . "\n" . ' <input type="submit" name="change_copy" value="' . __('Go') . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n"; } } } elseif (isset($_REQUEST['adduser'])) { // Add user $GLOBALS['url_query'] .= '&adduser=1'; echo '<h2>' . "\n" . PMA_getIcon('b_usradd.png') . __('Add user') . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="addUsersForm_' . $random_n . '" action="server_privileges.php" method="post">' . "\n" . PMA_generate_common_hidden_inputs('', ''); PMA_displayLoginInformationFields('new'); echo '<fieldset id="fieldset_add_user_database">' . "\n" . '<legend>' . __('Database for user') . '</legend>' . "\n"; echo PMA_getCheckbox('createdb-1', __('Create database with same name and grant all privileges'), false, false); echo '<br />' . "\n"; echo PMA_getCheckbox('createdb-2', __('Grant all privileges on wildcard name (username\\_%)'), false, false); echo '<br />' . "\n"; if (!empty($dbname)) {
<?php echo PMA_generate_common_hidden_inputs($db, $table); if ($cfg['PropertiesIconic']) { echo PMA_getImage('b_insrow.png', __('Add column')); } echo sprintf(__('Add %s column(s)'), '<input type="text" name="num_fields" size="2" maxlength="2" value="1" onfocus="this.select()" />'); // I tried displaying the drop-down inside the label but with Firefox // the drop-down was blinking $column_selector = '<select name="after_field" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">'; foreach ($columns_list as $one_column_name) { $column_selector .= '<option value="' . htmlspecialchars($one_column_name) . '">' . htmlspecialchars($one_column_name) . '</option>'; } unset($columns_list, $one_column_name); $column_selector .= '</select>'; $choices = array('last' => __('At End of Table'), 'first' => __('At Beginning of Table'), 'after' => sprintf(__('After %s'), '')); PMA_displayHtmlRadio('field_where', $choices, 'last', false); echo $column_selector; unset($column_selector, $choices); ?> <input type="submit" value="<?php echo __('Go'); ?> " /> </form> <iframe class="IE_hack"></iframe> <hr /> <div id="index_div" <?php echo $GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : ''; ?> > <?php
<fieldset> <legend><?php echo __('Partition maintenance'); ?> </legend> <?php $html_select = '<select name="partition_name">' . "\n"; foreach ($partition_names as $one_partition) { $one_partition = htmlspecialchars($one_partition); $html_select .= '<option value="' . $one_partition . '">' . $one_partition . '</option>' . "\n"; } $html_select .= '</select>' . "\n"; printf(__('Partition %s'), $html_select); unset($partition_names, $one_partition, $html_select); $choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair')); PMA_displayHtmlRadio('partition_operation', $choices, '', false); unset($choices); echo PMA_showMySQLDocu('partitioning_maintenance', 'partitioning_maintenance'); // I'm not sure of the best way to display that; this link does // not depend on the Go button $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA_backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;')); ?> <br /><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?> "> <?php echo __('Remove partitioning'); ?> </a> </fieldset>