<?php 
    echo PMA_generate_common_hidden_inputs($db, $table);
    if ($cfg['PropertiesIconic']) {
        echo '<img class="icon" src="' . $pmaThemeImage . 'b_insrow.png" width="16" height="16" alt="' . $strAddNewField . '"/>';
    }
    echo sprintf($strAddFields, '<input type="text" name="num_fields" size="2" maxlength="2" value="1" style="vertical-align: middle" onfocus="this.select()" />');
    // I tried displaying the drop-down inside the label but with Firefox
    // the drop-down was blinking
    $fieldOptions = '<select name="after_field" style="vertical-align: middle" onclick="this.form.field_where[2].checked=true" onchange="this.form.field_where[2].checked=true">';
    foreach ($aryFields as $fieldname) {
        $fieldOptions .= '<option value="' . htmlspecialchars($fieldname) . '">' . htmlspecialchars($fieldname) . '</option>' . "\n";
    }
    unset($aryFields);
    $fieldOptions .= '</select>';
    $choices = array('last' => $strAtEndOfTable, 'first' => $strAtBeginningOfTable, 'after' => sprintf($strAfter, ''));
    PMA_generate_html_radio('field_where', $choices, 'last', false);
    echo $fieldOptions;
    unset($fieldOptions, $choices);
    ?>
<input type="submit" value="<?php 
    echo $strGo;
    ?>
" style="vertical-align: middle" />
</form>
<hr />
    <?php 
}
/**
 * If there are more than 20 rows, displays browse/select/insert/empty/drop
 * links again
 */
Ejemplo n.º 2
0
    echo PMA_generate_common_hidden_inputs($db);
    ?>
    <fieldset>
        <legend>
    <?php 
    if ($cfg['PropertiesIconic']) {
        echo '<img class="icon" src="' . $pmaThemeImage . 'b_edit.png"' . ' alt="" width="16" height="16" />';
    }
    echo $strDBCopy . ':';
    $drop_clause = 'DROP TABLE / DROP VIEW';
    ?>
        </legend>
        <input type="text" name="newname" size="30" class="textfield" value="" /><br />
<?php 
    $choices = array('structure' => $strStrucOnly, 'data' => $strStrucData, 'dataonly' => $strDataOnly);
    PMA_generate_html_radio('what', $choices, 'data', true);
    unset($choices);
    ?>
        <input type="checkbox" name="create_database_before_copying" value="1"
            id="checkbox_create_database_before_copying"
            style="vertical-align: middle" checked="checked" />
        <label for="checkbox_create_database_before_copying">
            <?php 
    echo $strCreateDatabaseBeforeCopying;
    ?>
</label><br />
        <input type="checkbox" name="drop_if_exists" value="true"
            id="checkbox_drop" style="vertical-align: middle" />
        <label for="checkbox_drop"><?php 
    echo sprintf($strAddClause, $drop_clause);
    ?>
Ejemplo n.º 3
0
    <legend><?php 
    echo $strDisplayOrder;
    ?>
</legend>
    <select name="orderField" style="vertical-align: middle">
        <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' => $strAscending, 'DESC' => $strDescending);
    PMA_generate_html_radio('order', $choices, 'ASC', false, true, "formelement");
    unset($choices);
    ?>
</fieldset>
</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 $strGo;
    ?>
" />
/**
 * Displays the headers of the results table
 *
 * @uses    $_SESSION['userconf']['disp_direction']
 * @uses    $_SESSION['userconf']['repeat_cells']
 * @uses    $_SESSION['userconf']['max_rows']
 * @uses    $_SESSION['userconf']['display_text']
 * @uses    $_SESSION['userconf']['display_binary']
 * @param   array    which elements to display
 * @param   array    the list of fields properties
 * @param   integer  the total number of fields returned by the SQL query
 * @param   array    the analyzed query
 *
 * @return  boolean  always true
 *
 * @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;
    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 ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_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['userconf']['repeat_cells']) + 1;
                }
                echo '<form action="sql.php" method="post">' . "\n";
                echo PMA_generate_common_hidden_inputs($db, $table);
                echo $GLOBALS['strSortByKey'] . ': <select name="sql_query" onchange="this.form.submit();">' . "\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;
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $asc_sort) . '"' . ($local_order == $asc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . $GLOBALS['strAscending'] . ')</option>';
                    echo '<option value="' . htmlspecialchars($unsorted_sql_query . ' ORDER BY ' . $desc_sort) . '"' . ($local_order == $desc_sort ? ' selected="selected"' : '') . '>' . htmlspecialchars($index->getName()) . ' (' . $GLOBALS['strDescending'] . ')</option>';
                }
                echo '<option value="' . htmlspecialchars($unsorted_sql_query) . '"' . ($used_index ? '' : ' selected="selected"') . '>' . $GLOBALS['strNone'] . '</option>';
                echo '</select>' . "\n";
                echo '<noscript><input type="submit" value="' . $GLOBALS['strGo'] . '" /></noscript>';
                echo '</form>' . "\n";
            }
        }
    }
    $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">';
        $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_generate_slider_effect('displayoptions', $GLOBALS['strOptions']);
        echo '<fieldset>';
        echo '<div class="formelement">';
        $choices = array('P' => $GLOBALS['strPartialText'], 'F' => $GLOBALS['strFullText']);
        PMA_generate_html_radio('display_text', $choices, $_SESSION['userconf']['display_text']);
        echo '</div>';
        if ($GLOBALS['cfgRelation']['relwork'] && $GLOBALS['cfgRelation']['displaywork']) {
            echo '<div class="formelement">';
            $choices = array('K' => $GLOBALS['strRelationalKey'], 'D' => $GLOBALS['strRelationalDisplayField']);
            PMA_generate_html_radio('relational_display', $choices, $_SESSION['userconf']['relational_display']);
            echo '</div>';
        }
        echo '<div class="formelement">';
        PMA_generate_html_checkbox('display_binary', $GLOBALS['strShow'] . ' BINARY', !empty($_SESSION['userconf']['display_binary']), false);
        echo '<br />';
        PMA_generate_html_checkbox('display_blob', $GLOBALS['strShow'] . ' BLOB', !empty($_SESSION['userconf']['display_blob']), 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">';
        PMA_generate_html_checkbox('hide_transformation', $GLOBALS['strHide'] . ' ' . $GLOBALS['strMIME_transformation'], !empty($_SESSION['userconf']['hide_transformation']), false);
        echo '</div>';
        echo '<div class="clearfloat"></div>';
        echo '</fieldset>';
        echo '<fieldset class="tblFooters">';
        echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
        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="rowsDeleteForm" id="rowsDeleteForm">' . "\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">' . "\n";
    if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
        echo '<thead><tr>' . "\n";
    }
    // 1. Displays the full/partial text button (part 1)...
    if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
        $colspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' colspan="3"' : '';
    } else {
        $rowspan = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? ' rowspan="3"' : '';
    }
    //     ... 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' ? 3 : 0;
        if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
            ?>
    <th colspan="<?php 
            echo $fields_cnt;
            ?>
"></th>
</tr>
<tr>
            <?php 
        } else {
            ?>
<tr>
    <th colspan="<?php 
            echo $num_rows + floor($num_rows / $_SESSION['userconf']['repeat_cells']) + 1;
            ?>
"></th>
</tr>
            <?php 
        }
        // end vertical mode
    } elseif ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && $is_display['text_btn'] == '1') {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 3 : 0;
        if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
            ?>
    <th <?php 
            echo $colspan;
            ?>
></th>
            <?php 
        } else {
            $vertical_display['textbtn'] = '    <th ' . $rowspan . ' valign="middle">' . "\n" . '        ' . "\n" . '    </th>' . "\n";
        }
        // end vertical mode
    } elseif ($GLOBALS['cfg']['ModifyDeleteAtLeft'] && ($is_display['edit_lnk'] != 'nn' || $is_display['del_lnk'] != 'nn')) {
        $vertical_display['emptypre'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 3 : 0;
        if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
            ?>
    <td<?php 
            echo $colspan;
            ?>
></td>
            <?php 
        } else {
            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
        }
        // end vertical mode
    }
    // 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'] && $_SESSION['userconf']['disp_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['userconf']['hide_transformation']) {
        require_once './libraries/transformations.lib.php';
        $GLOBALS['mime_map'] = PMA_getMIME($db, $table);
    }
    if ($is_display['sort_lnk'] == '1') {
        $select_expr = $analyzed_sql[0]['select_expr_clause'];
    }
    // garvin: 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';
            }
        }
    }
    for ($i = 0; $i < $fields_cnt; $i++) {
        // garvin: 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;
            if (isset($fields_meta[$i]->orgname)) {
                $name_to_use_in_sort = $fields_meta[$i]->orgname;
            }
            // $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 (avoids problems with queries
                // like "SELECT id, count(id)..." and clicking to sort
                // on id or on count(id))
                $is_in_sort = str_replace('`', '', $sort_tbl) . $name_to_use_in_sort == str_replace('`', '', $sort_expression_nodirection) ? true : false;
            }
            // 2.1.3 Check the field name for a bracket.
            //       If it contains one, it's probably a function column
            //       like 'COUNT(`field`)'
            if (strpos($name_to_use_in_sort, '(') !== false) {
                $sort_order = ' ORDER BY ' . $name_to_use_in_sort . ' ';
            } else {
                $sort_order = ' ORDER BY ' . $sort_tbl . PMA_backquote($name_to_use_in_sort) . ' ';
            }
            unset($name_to_use_in_sort);
            // 2.1.4 Do define the sorting URL
            if (!$is_in_sort) {
                // loic1: 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 = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_desc.png" width="11" height="9" alt="' . $GLOBALS['strDescending'] . '" title="' . $GLOBALS['strDescending'] . '" id="soimg' . $i . '" />';
            } else {
                $sort_order .= ' DESC';
                $order_img = ' <img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 's_asc.png" width="11" height="9" alt="' . $GLOBALS['strAscending'] . '" title="' . $GLOBALS['strAscending'] . '" id="soimg' . $i . '" />';
            }
            if (preg_match('@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|FOR UPDATE|LOCK IN SHARE MODE))@i', $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);
            $order_url = 'sql.php' . PMA_generate_common_url($_url_params);
            // 2.1.5 Displays the sorting URL
            // added 20004-06-09: Michael Keck <*****@*****.**>
            //                    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'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
                    $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
                } elseif (strstr($order_img, 'desc')) {
                    $order_link_params['onmouseover'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_asc.png\'; }';
                    $order_link_params['onmouseout'] = 'if(document.getElementById(\'soimg' . $i . '\')){ document.getElementById(\'soimg' . $i . '\').src=\'' . $GLOBALS['pmaThemeImage'] . 's_desc.png\'; }';
                }
            }
            if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
                $order_link_params['style'] = 'direction: ltr; writing-mode: tb-rl;';
            }
            $order_link_params['title'] = $GLOBALS['strSort'];
            $order_link_content = $_SESSION['userconf']['disp_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 ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
                echo '<th';
                if ($condition_field) {
                    echo ' class="condition"';
                }
                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
                    echo ' valign="bottom"';
                }
                echo '>' . $order_link . $comments . '</th>';
            }
            $vertical_display['desc'][] = '    <th ' . ($condition_field ? ' class="condition"' : '') . '>' . "\n" . $order_link . $comments . '    </th>' . "\n";
        } else {
            if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
                echo '<th';
                if ($condition_field) {
                    echo ' class="condition"';
                }
                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
                    echo ' valign="bottom"';
                }
                if ($_SESSION['userconf']['disp_direction'] == 'horizontalflipped' && $GLOBALS['cfg']['HeaderFlipType'] == 'css') {
                    echo ' style="direction: ltr; writing-mode: tb-rl;"';
                }
                echo '>';
                if ($_SESSION['userconf']['disp_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 ' . ($condition_field ? ' class="condition"' : '') . '>' . "\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']['ModifyDeleteAtRight'] && ($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' ? 3 : 1;
        if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
            echo "\n";
            ?>
<th <?php 
            echo $colspan;
            ?>
>
</th>
            <?php 
        } else {
            $vertical_display['textbtn'] = '    <th ' . $rowspan . ' valign="middle">' . "\n" . '        ' . "\n" . '    </th>' . "\n";
        }
        // end vertical mode
    } elseif ($GLOBALS['cfg']['ModifyDeleteAtRight'] && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') && !$GLOBALS['is_header_sent']) {
        $vertical_display['emptyafter'] = $is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn' ? 3 : 1;
        if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
            echo "\n";
            ?>
<td<?php 
            echo $colspan;
            ?>
></td>
            <?php 
        } else {
            $vertical_display['textbtn'] = '    <td' . $rowspan . '></td>' . "\n";
        }
        // end vertical mode
    }
    if ($_SESSION['userconf']['disp_direction'] == 'horizontal' || $_SESSION['userconf']['disp_direction'] == 'horizontalflipped') {
        ?>
</tr>
</thead>
        <?php 
    }
    return true;
}
    $default_choice = 0;
    $choices = array(
        '0' => $GLOBALS['strCreateUserDatabaseNone'],
        '1' => $GLOBALS['strCreateUserDatabaseName'],
        '2' => $GLOBALS['strCreateUserDatabaseWildcard']);

    if ( !empty($dbname) ) {
        $choices['3'] = sprintf($GLOBALS['strCreateUserDatabasePrivileges'], htmlspecialchars($dbname));
        $default_choice = 3;
        echo '<input type="hidden" name="dbname" value="' . htmlspecialchars($dbname) . '" />' . "\n";
    }

    // 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_generate_html_radio('createdb', $choices, $default_choice, true, false);
    unset($choices);
    unset($default_choice);

    echo '</fieldset>' . "\n";
    PMA_displayPrivTable('*', '*', FALSE);
    echo '    <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n"
       . '        <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n"
       . '    </fieldset>' . "\n"
       . '</form>' . "\n";
} else {
    // check the privileges for a particular database.
    echo '<table id="tablespecificuserrights" class="data">' . "\n"
       . '<caption class="tblHeaders">' . "\n"
       . PMA_getIcon('b_usrcheck.png')
       . '    ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' .  htmlspecialchars($checkprivs) . '</a>') . "\n"
Ejemplo n.º 6
0
<fieldset>
 <legend><?php 
        echo $strPartitionMaintenance;
        ?>
</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($GLOBALS['strPartition'], $html_select);
        unset($partition_names, $one_partition, $html_select);
        $choices = array('ANALYZE' => $strAnalyze, 'CHECK' => $strCheck, 'OPTIMIZE' => $strOptimize, 'REBUILD' => $strRebuild, 'REPAIR' => $strRepair);
        PMA_generate_html_radio('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 $strRemovePartitioning;
        ?>
</a>
</fieldset>
Ejemplo n.º 7
0
    <select name="chpage" onchange="this.form.submit()">
        <?php 
        while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
            echo "\n" . '        ' . '<option value="' . $curr_page['page_nr'] . '"';
            if (isset($chpage) && $chpage == $curr_page['page_nr']) {
                echo ' selected="selected"';
            }
            echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
        }
        // end while
        echo "\n";
        ?>
    </select>
<?php 
        $choices = array('0' => $strEdit, '1' => $strDelete);
        PMA_generate_html_radio('action_choose', $choices, '0', false);
        unset($choices);
        ?>
       <input type="submit" value="<?php 
        echo $strGo;
        ?>
" /><br />
    </fieldset>
</form>
        <?php 
    }
    echo "\n";
    // Possibility to create a new page:
    ?>
<form method="post" action="pdf_pages.php" name="crpage">
    <fieldset>
Ejemplo n.º 8
0
                value="<?php 
echo $searched;
?>
" /></td>
    </tr>
    <tr><td align="right" valign="top">
            <?php 
echo $GLOBALS['strSearchType'];
?>
</td>
            <td><?php 
$choices = array('1' => $GLOBALS['strSearchOption1'] . PMA_showHint($GLOBALS['strSplitWordsWithSpace']), '2' => $GLOBALS['strSearchOption2'] . PMA_showHint($GLOBALS['strSplitWordsWithSpace']), '3' => $GLOBALS['strSearchOption3'], '4' => $GLOBALS['strSearchOption4'] . ' ' . PMA_showMySQLDocu('Regexp', 'Regexp'));
// 4th parameter set to false 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_generate_html_radio('search_option', $choices, $search_option, true, false);
unset($choices);
?>
            </td>
    </tr>
    <tr><td align="right" valign="top">
            <?php 
echo $GLOBALS['strSearchInTables'];
?>
</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"';
Ejemplo n.º 9
0
            PMA_displayLoginInformationFields('change');
            echo '    <fieldset>' . "\n" . '        <legend>' . $GLOBALS['strChangeCopyMode'] . '</legend>' . "\n";
            $choices = array('4' => $GLOBALS['strChangeCopyModeCopy'], '1' => $GLOBALS['strChangeCopyModeJustDelete'], '2' => $GLOBALS['strChangeCopyModeRevoke'], '3' => $GLOBALS['strChangeCopyModeDeleteAndReload']);
            PMA_generate_html_radio('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="' . $GLOBALS['strGo'] . '" />' . "\n" . '</fieldset>' . "\n" . '</form>' . "\n";
        }
    }
} elseif (isset($_REQUEST['adduser'])) {
    // Add a new user
    $GLOBALS['url_query'] .= '&amp;adduser=1';
    echo '<h2>' . "\n" . PMA_getIcon('b_usradd.png') . $GLOBALS['strAddUser'] . "\n" . '</h2>' . "\n" . '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post" onsubmit="return checkAddUser(this);">' . "\n" . PMA_generate_common_hidden_inputs('', '');
    PMA_displayLoginInformationFields('new');
    echo '<fieldset id="fieldset_add_user_database">' . "\n" . '<legend>' . $GLOBALS['strCreateUserDatabase'] . '</legend>' . "\n";
    $choices = array('0' => $GLOBALS['strCreateUserDatabaseNone'], '1' => $GLOBALS['strCreateUserDatabaseName'], '2' => $GLOBALS['strCreateUserDatabaseWildcard']);
    PMA_generate_html_radio('createdb', $choices, '0', true);
    unset($choices);
    echo '</fieldset>' . "\n";
    PMA_displayPrivTable('*', '*', FALSE);
    echo '    <fieldset id="fieldset_add_user_footer" class="tblFooters">' . "\n" . '        <input type="submit" name="adduser_submit" value="' . $GLOBALS['strGo'] . '" />' . "\n" . '    </fieldset>' . "\n" . '</form>' . "\n";
} else {
    // check the privileges for a particular database.
    echo '<table id="tablespecificuserrights" class="data">' . "\n" . '<caption class="tblHeaders">' . "\n" . PMA_getIcon('b_usrcheck.png') . '    ' . sprintf($GLOBALS['strUsersHavingAccessToDb'], '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url($checkprivs) . '">' . htmlspecialchars($checkprivs) . '</a>') . "\n" . '</caption>' . "\n" . '<thead>' . "\n" . '    <tr><th>' . $GLOBALS['strUser'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strHost'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strType'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strPrivileges'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strGrantOption'] . '</th>' . "\n" . '        <th>' . $GLOBALS['strAction'] . '</th>' . "\n" . '    </tr>' . "\n" . '</thead>' . "\n" . '<tbody>' . "\n";
    $odd_row = TRUE;
    unset($row, $row1, $row2);
    // now, we build the table...
    $list_of_privileges = '`User`, ' . '`Host`, ' . '`Select_priv`, ' . '`Insert_priv`, ' . '`Update_priv`, ' . '`Delete_priv`, ' . '`Create_priv`, ' . '`Drop_priv`, ' . '`Grant_priv`, ' . '`Index_priv`, ' . '`Alter_priv`, ' . '`References_priv`, ' . '`Create_tmp_table_priv`, ' . '`Lock_tables_priv`, ' . '`Create_view_priv`, ' . '`Show_view_priv`, ' . '`Create_routine_priv`, ' . '`Alter_routine_priv`, ' . '`Execute_priv`';
    $list_of_compared_privileges = '`Select_priv` = \'N\'' . ' AND `Insert_priv` = \'N\'' . ' AND `Update_priv` = \'N\'' . ' AND `Delete_priv` = \'N\'' . ' AND `Create_priv` = \'N\'' . ' AND `Drop_priv` = \'N\'' . ' AND `Grant_priv` = \'N\'' . ' AND `References_priv` = \'N\'' . ' AND `Create_tmp_table_priv` = \'N\'' . ' AND `Lock_tables_priv` = \'N\'' . ' AND `Create_view_priv` = \'N\'' . ' AND `Show_view_priv` = \'N\'' . ' AND `Create_routine_priv` = \'N\'' . ' AND `Alter_routine_priv` = \'N\'' . ' AND `Execute_priv` = \'N\'';
    if (PMA_MYSQL_INT_VERSION >= 50106) {
        $list_of_privileges .= ', `Event_priv`, ' . '`Trigger_priv`';
        $list_of_compared_privileges .= ' AND `Event_priv` = \'N\'' . ' AND `Trigger_priv` = \'N\'';