getHiddenFields() public static method

$values = array( 'aaa' => aaa, 'bbb' => array( 'bbb_0', 'bbb_1', ), 'ccc' => array( 'a' => 'ccc_a', 'b' => 'ccc_b', ), ); echo URL::getHiddenFields($values); produces:
public static getHiddenFields ( array $values, string $pre = '' ) : string
$values array hidden values
$pre string prefix
return string form fields of type hidden
/**
 * Displays top part of the form
 *
 * @param string $action        default: $_SERVER['REQUEST_URI']
 * @param string $method        'post' or 'get'
 * @param array  $hidden_fields array of form hidden fields (key: field name)
 *
 * @return string
 */
function PMA_displayFormTop($action = null, $method = 'post', $hidden_fields = null)
{
    static $has_check_page_refresh = false;
    if ($action === null) {
        $action = $_SERVER['REQUEST_URI'];
    }
    if ($method != 'post') {
        $method = 'get';
    }
    $htmlOutput = '<form method="' . $method . '" action="' . htmlspecialchars($action) . '" class="config-form disableAjax">';
    $htmlOutput .= '<input type="hidden" name="tab_hash" value="" />';
    // we do validation on page refresh when browser remembers field values,
    // add a field with known value which will be used for checks
    if (!$has_check_page_refresh) {
        $has_check_page_refresh = true;
        $htmlOutput .= '<input type="hidden" name="check_page_refresh" ' . ' id="check_page_refresh" value="" />' . "\n";
    }
    $htmlOutput .= URL::getHiddenInputs('', '', 0, 'server') . "\n";
    $htmlOutput .= URL::getHiddenFields((array) $hidden_fields);
    return $htmlOutput;
}
Example #2
0
/**
 * generates the error report form to collect user description and preview the
 * report before being sent
 *
 * @return String the form
 */
function PMA_getErrorReportForm()
{
    $datas = array('report_data' => PMA_getPrettyReportData(), 'hidden_inputs' => URL::getHiddenInputs(), 'hidden_fields' => null);
    $reportData = PMA_getReportData();
    if (!empty($reportData)) {
        $datas['hidden_fields'] = URL::getHiddenFields($reportData);
    }
    return PMA\libraries\Template::get('error/report_form')->render($datas);
}
Example #3
0
 /**
  * Generates the HTML code for displaying the fast filter for tables
  *
  * @param Node $node The node for which to generate the fast filter html
  *
  * @return string LI element used for the fast filter
  */
 private function _fastFilterHtml($node)
 {
     $retval = '';
     $filter_db_min = (int) $GLOBALS['cfg']['NavigationTreeDisplayDbFilterMinimum'];
     $filter_item_min = (int) $GLOBALS['cfg']['NavigationTreeDisplayItemFilterMinimum'];
     if ($node === $this->_tree && $this->_tree->getPresence() >= $filter_db_min) {
         $url_params = array('pos' => 0);
         $retval .= '<li class="fast_filter db_fast_filter">';
         $retval .= '<form class="ajax fast_filter">';
         $retval .= URL::getHiddenFields($url_params);
         $retval .= '<input class="searchClause" type="text"';
         $retval .= ' name="searchClause" accesskey="q"';
         // allow html5 placeholder attribute
         $placeholder_key = 'value';
         if (PMA_USR_BROWSER_AGENT !== 'IE' || PMA_USR_BROWSER_VER > 9) {
             $placeholder_key = 'placeholder';
         }
         $retval .= " {$placeholder_key}='" . __("Type to filter these, Enter to search all");
         $retval .= "' />";
         $retval .= '<span title="' . __('Clear fast filter') . '">X</span>';
         $retval .= "</form>";
         $retval .= "</li>";
         return $retval;
     }
     if ($node->type == Node::CONTAINER && ($node->real_name == 'tables' || $node->real_name == 'views' || $node->real_name == 'functions' || $node->real_name == 'procedures' || $node->real_name == 'events') && method_exists($node->realParent(), 'getPresence') && $node->realParent()->getPresence($node->real_name) >= $filter_item_min) {
         $paths = $node->getPaths();
         $url_params = array('pos' => $this->_pos, 'aPath' => $paths['aPath'], 'vPath' => $paths['vPath'], 'pos2_name' => $node->real_name, 'pos2_value' => 0);
         $retval .= "<li class='fast_filter'>";
         $retval .= "<form class='ajax fast_filter'>";
         $retval .= URL::getHiddenFields($url_params);
         $retval .= "<input class='searchClause' type='text'";
         $retval .= " name='searchClause2'";
         // allow html5 placeholder attribute
         $placeholder_key = 'value';
         if (PMA_USR_BROWSER_AGENT !== 'IE' || PMA_USR_BROWSER_VER > 9) {
             $placeholder_key = 'placeholder';
         }
         $retval .= " {$placeholder_key}='" . __("Type to filter these, Enter to search all") . "' />";
         $retval .= "<span title='" . __('Clear fast filter') . "'>X</span>";
         $retval .= "</form>";
         $retval .= "</li>";
     }
     return $retval;
 }
Example #4
0
 /**
  * Prepare sort by key dropdown - html code segment
  *
  * @param Index[] $indexes            the indexes of the table for sort criteria
  * @param string  $sort_expression    the sort expression
  * @param string  $unsorted_sql_query the unsorted sql query
  *
  * @return  string  $drop_down_html         html content
  *
  * @access  private
  *
  * @see     _getTableHeaders()
  */
 private function _getSortByKeyDropDown($indexes, $sort_expression, $unsorted_sql_query)
 {
     $drop_down_html = '';
     $drop_down_html .= '<form action="sql.php" method="post" ' . 'class="print_ignore">' . "\n" . URL::getHiddenInputs($this->__get('db'), $this->__get('table')) . URL::getHiddenFields(array('sort_by_key' => '1')) . __('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 = '';
         }
         $drop_down_html .= '<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()) . ' (ASC)</option>';
         $drop_down_html .= '<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()) . ' (DESC)</option>';
     }
     $drop_down_html .= '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"') . '>' . __('None') . '</option>' . '</select>' . "\n" . '</form>' . "\n";
     return $drop_down_html;
 }