Ejemplo n.º 1
0
/**
 * Returns the html for Table footer buttons
 *
 * @param bool   $is_allowUserDropDatabase Allow user drop database
 * @param bool   $is_superuser             User status
 * @param string $sort_by                  sort by string
 * @param string $sort_order               sort order string
 * @param Array  $dbstats                  database status
 *
 * @return string
 */
function PMA_getHtmlForTableFooterButtons($is_allowUserDropDatabase, $is_superuser, $sort_by, $sort_order, $dbstats)
{
    $html = "";
    if ($is_superuser || $is_allowUserDropDatabase) {
        $html .= '<img class="selectallarrow" src="' . $GLOBALS['pmaThemeImage'] . 'arrow_' . $GLOBALS['text_dir'] . '.png"' . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n" . '<input type="checkbox" id="dbStatsForm_checkall" ' . 'class="checkall_box" title="' . __('Check All') . '" /> ' . '<label for="dbStatsForm_checkall">' . __('Check All') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
        $html .= PMA_Util::getButtonOrImage('', 'mult_submit' . ' ajax', 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
    }
    return $html;
}
/**
 * Returns the html for Table footer buttons
 *
 * @param bool $is_allowUserDropDb Allow user drop database
 * @param bool $is_superuser       User status
 *
 * @return string
 */
function PMA_getHtmlForTableFooterButtons($is_allowUserDropDb, $is_superuser)
{
    if (!$is_superuser && !$is_allowUserDropDb) {
        return '';
    }
    $html = PMA_Util::getWithSelected($GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], "dbStatsForm");
    $html .= PMA_Util::getButtonOrImage('', 'mult_submit' . ' ajax', 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
    return $html;
}
/**
 * Get HTML for display the users overview
 * (if less than 50 users, display them immediately)
 *
 * @param array  $result        ran sql query
 * @param array  $db_rights     user's database rights array
 * @param string $pmaThemeImage a image source link
 * @param string $text_dir      text directory
 *
 * @return string HTML snippet
 */
function PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir)
{
    while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
        $row['privs'] = PMA_extractPrivInfo($row, true);
        $db_rights[$row['User']][$row['Host']] = $row;
    }
    @$GLOBALS['dbi']->freeResult($result);
    $user_group_count = 0;
    if ($GLOBALS['cfgRelation']['menuswork']) {
        $user_group_count = PMA_getUserGroupCount();
    }
    $html_output = '<form name="usersForm" id="usersForm" action="server_privileges.php" ' . 'method="post">' . "\n" . PMA_URL_getHiddenInputs('', '') . '<table id="tableuserrights" class="data">' . "\n" . '<thead>' . "\n" . '<tr><th></th>' . "\n" . '<th>' . __('User') . '</th>' . "\n" . '<th>' . __('Host') . '</th>' . "\n" . '<th>' . __('Password') . '</th>' . "\n" . '<th>' . __('Global privileges') . ' ' . PMA_Util::showHint(__('Note: MySQL privilege names are expressed in English.')) . '</th>' . "\n";
    if ($GLOBALS['cfgRelation']['menuswork']) {
        $html_output .= '<th>' . __('User group') . '</th>' . "\n";
    }
    $html_output .= '<th>' . __('Grant') . '</th>' . "\n" . '<th colspan="' . ($user_group_count > 0 ? '3' : '2') . '">' . __('Action') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
    $html_output .= '<tbody>' . "\n";
    $html_output .= PMA_getHtmlTableBodyForUserRights($db_rights);
    $html_output .= '</tbody>' . '</table>' . "\n";
    $html_output .= '<div style="float:left;">' . PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "usersForm") . "\n";
    $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
    $html_output .= '<input type="hidden" name="initial" ' . 'value="' . (isset($_GET['initial']) ? $_GET['initial'] : '') . '" />';
    $html_output .= '</div>' . '<div class="clear_both" style="clear:both"></div>';
    // add/delete user fieldset
    $html_output .= PMA_getFieldsetForAddDeleteUser();
    $html_output .= '</form>' . "\n";
    return $html_output;
}
Ejemplo n.º 4
0
 /**
  * Prepare multi field edit/delete links
  *
  * @param integer &$dt_result   the link id associated to the query
  *                              which results have to be displayed
  * @param array   $analyzed_sql the analyzed query
  * @param string  $del_link     the display element - 'del_link'
  *
  * @return string $links_html html content
  *
  * @access  private
  *
  * @see     getTable()
  */
 private function _getMultiRowOperationLinks(&$dt_result, $analyzed_sql, $del_link)
 {
     $links_html = '';
     $url_query = $this->__get('url_query');
     $delete_text = $del_link == self::DELETE_ROW ? __('Delete') : __('Kill');
     $links_html .= '<img class="selectallarrow" width="38" height="22"' . ' src="' . $this->__get('pma_theme_image') . 'arrow_' . $this->__get('text_dir') . '.png' . '"' . ' alt="' . __('With selected:') . '" />';
     $links_html .= '<input type="checkbox" ' . 'id="resultsForm_' . $this->__get('unique_id') . '_checkall" ' . 'class="checkall_box" title="' . __('Check All') . '" /> ' . '<label for="resultsForm_' . $this->__get('unique_id') . '_checkall">' . __('Check All') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
     $links_html .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_change', __('Edit'), 'b_edit.png', 'edit');
     $links_html .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete', $delete_text, 'b_drop.png', 'delete');
     if (isset($analyzed_sql[0]) && $analyzed_sql[0]['querytype'] == self::QUERY_TYPE_SELECT) {
         $links_html .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
     }
     $links_html .= "\n";
     $links_html .= '<input type="hidden" name="sql_query"' . ' value="' . htmlspecialchars($this->__get('sql_query')) . '" />' . "\n";
     if (!empty($url_query)) {
         $links_html .= '<input type="hidden" name="url_query"' . ' value="' . $url_query . '" />' . "\n";
     }
     // fetch last row of the result set
     $GLOBALS['dbi']->dataSeek($dt_result, $this->__get('num_rows') - 1);
     $row = $GLOBALS['dbi']->fetchRow($dt_result);
     // $clause_is_unique is needed by getTable() to generate the proper param
     // in the multi-edit and multi-delete form
     list($where_clause, $clause_is_unique, $condition_array) = PMA_Util::getUniqueCondition($dt_result, $this->__get('fields_cnt'), $this->__get('fields_meta'), $row);
     unset($where_clause, $condition_array);
     // reset to first row for the loop in _getTableBody()
     $GLOBALS['dbi']->dataSeek($dt_result, 0);
     $links_html .= '<input type="hidden" name="clause_is_unique"' . ' value="' . $clause_is_unique . '" />' . "\n";
     $links_html .= '</form>' . "\n";
     return $links_html;
 }
Ejemplo n.º 5
0
/**
 * Function to get html for displaying last version number
 *
 * @param array  $sql_result    sql result
 * @param int    $last_version  last version
 * @param array  $url_params    url parameters
 * @param string $url_query     url query
 * @param string $pmaThemeImage path to theme's image folder
 * @param string $text_dir      text direction
 *
 * @return string
 */
function PMA_getHtmlForTableVersionDetails($sql_result, $last_version, $url_params, $url_query, $pmaThemeImage, $text_dir)
{
    $tracking_active = false;
    $html = '<form method="post" action="tbl_tracking.php" name="versionsForm"' . ' id="versionsForm" class="ajax">';
    $html .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $html .= '<table id="versions" class="data">';
    $html .= '<thead>';
    $html .= '<tr>';
    $html .= '<th></th>';
    $html .= '<th>' . __('Version') . '</th>';
    $html .= '<th>' . __('Created') . '</th>';
    $html .= '<th>' . __('Updated') . '</th>';
    $html .= '<th>' . __('Status') . '</th>';
    $html .= '<th>' . __('Action') . '</th>';
    $html .= '<th>' . __('Show') . '</th>';
    $html .= '</tr>';
    $html .= '</thead>';
    $html .= '<tbody>';
    $style = 'odd';
    $GLOBALS['dbi']->dataSeek($sql_result, 0);
    $delete = PMA_Util::getIcon('b_drop.png', __('Delete version'));
    $report = PMA_Util::getIcon('b_report.png', __('Tracking report'));
    $structure = PMA_Util::getIcon('b_props.png', __('Structure snapshot'));
    while ($version = $GLOBALS['dbi']->fetchArray($sql_result)) {
        if ($version['version'] == $last_version) {
            if ($version['tracking_active'] == 1) {
                $tracking_active = true;
            } else {
                $tracking_active = false;
            }
        }
        $delete_link = 'tbl_tracking.php' . $url_query . '&amp;version=' . htmlspecialchars($version['version']) . '&amp;submit_delete_version=true';
        $checkbox_id = 'selected_versions_' . htmlspecialchars($version['version']);
        $html .= '<tr class="' . $style . '">';
        $html .= '<td class="center">';
        $html .= '<input type="checkbox" name="selected_versions[]"' . ' class="checkall" id="' . $checkbox_id . '"' . ' value="' . htmlspecialchars($version['version']) . '"/>';
        $html .= '</td>';
        $html .= '<th class="floatright">';
        $html .= '<label for="' . $checkbox_id . '">' . htmlspecialchars($version['version']) . '</label>';
        $html .= '</th>';
        $html .= '<td>' . htmlspecialchars($version['date_created']) . '</td>';
        $html .= '<td>' . htmlspecialchars($version['date_updated']) . '</td>';
        $html .= '<td>' . PMA_getVersionStatus($version) . '</td>';
        $html .= '<td><a class="delete_version_anchor ajax"' . ' href="' . $delete_link . '" >' . $delete . '</a></td>';
        $html .= '<td><a href="tbl_tracking.php';
        $html .= PMA_URL_getCommon($url_params + array('report' => 'true', 'version' => $version['version']));
        $html .= '">' . $report . '</a>';
        $html .= '&nbsp;&nbsp;';
        $html .= '<a href="tbl_tracking.php';
        $html .= PMA_URL_getCommon($url_params + array('snapshot' => 'true', 'version' => $version['version']));
        $html .= '">' . $structure . '</a>';
        $html .= '</td>';
        $html .= '</tr>';
        if ($style == 'even') {
            $style = 'odd';
        } else {
            $style = 'even';
        }
    }
    $html .= '</tbody>';
    $html .= '</table>';
    $html .= PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "versionsForm");
    $html .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete_version', __('Delete version'), 'b_drop.png', 'delete_version');
    $html .= '</form>';
    if ($tracking_active) {
        $html .= PMA_getHtmlForActivateDeactivateTracking('deactivate', $url_query, $last_version);
    } else {
        $html .= PMA_getHtmlForActivateDeactivateTracking('activate', $url_query, $last_version);
    }
    return $html;
}
Ejemplo n.º 6
0
/**
 * Get HTML for "check all" check box with "with selected" actions in table
 * structure
 *
 * @param string  $pmaThemeImage       pma theme image url
 * @param string  $text_dir            test directory
 * @param boolean $tbl_is_view         whether table is view or not
 * @param boolean $db_is_system_schema whether db is information schema or not
 * @param string  $tbl_storage_engine  table storage engine
 *
 * @return string $html_output
 */
function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine)
{
    $html_output = '<img class="selectallarrow" ' . 'src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" ' . 'width="38" height="22" alt="' . __('With selected:') . '" />';
    $html_output .= '<input type="checkbox" id="fieldsForm_checkall" ' . 'class="checkall_box" title="' . __('Check All') . '" />' . '<label for="fieldsForm_checkall">' . __('Check All') . '</label>';
    $html_output .= '<i style="margin-left: 2em">' . __('With selected:') . '</i>';
    $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_browse', __('Browse'), 'b_browse.png', 'browse');
    if (!$tbl_is_view && !$db_is_system_schema) {
        $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit change_columns_anchor ajax', 'submit_mult_change', __('Change'), 'b_edit.png', 'change');
        $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop');
        if ('ARCHIVE' != $tbl_storage_engine) {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', __('Primary'), 'b_primary.png', 'primary');
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', __('Unique'), 'b_unique.png', 'unique');
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index');
        }
        if (!empty($tbl_storage_engine) && $tbl_storage_engine == 'MYISAM') {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_spatial.png', 'spatial');
        }
        if (!empty($tbl_storage_engine) && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA')) {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext');
        }
    }
    return $html_output;
}
Ejemplo n.º 7
0
/**
 * Get HTML for "check all" check box with "with selected" actions in table
 * structure
 *
 * @param string  $pmaThemeImage       pma theme image url
 * @param string  $text_dir            test directory
 * @param boolean $tbl_is_view         whether table is view or not
 * @param boolean $db_is_system_schema whether db is information schema or not
 * @param string  $tbl_storage_engine  table storage engine
 *
 * @return string $html_output
 */
function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir, $tbl_is_view, $db_is_system_schema, $tbl_storage_engine)
{
    $html_output = PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "fieldsForm");
    $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_browse', __('Browse'), 'b_browse.png', 'browse');
    if (!$tbl_is_view && !$db_is_system_schema) {
        $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit change_columns_anchor ajax', 'submit_mult_change', __('Change'), 'b_edit.png', 'change');
        $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop');
        if ('ARCHIVE' != $tbl_storage_engine) {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_primary', __('Primary'), 'b_primary.png', 'primary');
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_unique', __('Unique'), 'b_unique.png', 'unique');
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_index', __('Index'), 'b_index.png', 'index');
        }
        if (!empty($tbl_storage_engine) && $tbl_storage_engine == 'MYISAM') {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_spatial', __('Spatial'), 'b_spatial.png', 'spatial');
        }
        if (!empty($tbl_storage_engine) && ($tbl_storage_engine == 'MYISAM' || $tbl_storage_engine == 'ARIA' || $tbl_storage_engine == 'MARIA')) {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_fulltext', __('Fulltext'), 'b_ftext.png', 'ftext');
        }
        if (isset($GLOBALS['cfgRelation']['central_columnswork']) && $GLOBALS['cfgRelation']['central_columnswork']) {
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_central_columns_add', __('Add to central columns'), 'centralColumns_add.png', 'add_to_central_columns');
            $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_central_columns_remove', __('Remove from central columns'), 'centralColumns_delete.png', 'remove_from_central_columns');
        }
    }
    return $html_output;
}
/**
 * Creates a list of items containing the relevant
 * information and some action links.
 *
 * @param string $type  One of ['routine'|'trigger'|'event']
 * @param array  $items An array of items
 *
 * @return string HTML code of the list of items
 */
function PMA_RTE_getList($type, $items)
{
    global $table;
    /**
     * Conditional classes switch the list on or off
     */
    $class1 = 'hide';
    $class2 = '';
    if (!$items) {
        $class1 = '';
        $class2 = ' hide';
    }
    /**
     * Generate output
     */
    $retval = "<!-- LIST OF " . PMA_RTE_getWord('docu') . " START -->\n";
    $retval .= '<form id="rteListForm" class="ajax" action="';
    switch ($type) {
        case 'routine':
            $retval .= 'db_routines.php';
            break;
        case 'trigger':
            if (!empty($table)) {
                $retval .= 'tbl_triggers.php';
            } else {
                $retval .= 'db_triggers.php';
            }
            break;
        case 'event':
            $retval .= 'db_events.php';
            break;
        default:
            break;
    }
    $retval .= '">';
    $retval .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $retval .= "<fieldset>\n";
    $retval .= "    <legend>\n";
    $retval .= "        " . PMA_RTE_getWord('title') . "\n";
    $retval .= "        " . PMA_Util::showMySQLDocu(PMA_RTE_getWord('docu')) . "\n";
    $retval .= "    </legend>\n";
    $retval .= "    <div class='{$class1}' id='nothing2display'>\n";
    $retval .= "      " . PMA_RTE_getWord('nothing') . "\n";
    $retval .= "    </div>\n";
    $retval .= "    <table class='data{$class2}'>\n";
    $retval .= "        <!-- TABLE HEADERS -->\n";
    $retval .= "        <tr>\n";
    // th cells with a colspan need corresponding td cells, according to W3C
    switch ($type) {
        case 'routine':
            $retval .= "            <th></th>\n";
            $retval .= "            <th>" . __('Name') . "</th>\n";
            $retval .= "            <th colspan='4'>" . __('Action') . "</th>\n";
            $retval .= "            <th>" . __('Type') . "</th>\n";
            $retval .= "            <th>" . __('Returns') . "</th>\n";
            $retval .= "        </tr>\n";
            $retval .= "        <tr style='display: none'>\n";
            // see comment above
            for ($i = 0; $i < 7; $i++) {
                $retval .= "            <td></td>\n";
            }
            break;
        case 'trigger':
            $retval .= "            <th></th>\n";
            $retval .= "            <th>" . __('Name') . "</th>\n";
            if (empty($table)) {
                $retval .= "            <th>" . __('Table') . "</th>\n";
            }
            $retval .= "            <th colspan='3'>" . __('Action') . "</th>\n";
            $retval .= "            <th>" . __('Time') . "</th>\n";
            $retval .= "            <th>" . __('Event') . "</th>\n";
            $retval .= "        </tr>\n";
            $retval .= "        <tr style='display: none'>\n";
            // see comment above
            for ($i = 0; $i < (empty($table) ? 7 : 6); $i++) {
                $retval .= "            <td></td>\n";
            }
            break;
        case 'event':
            $retval .= "            <th></th>\n";
            $retval .= "            <th>" . __('Name') . "</th>\n";
            $retval .= "            <th>" . __('Status') . "</th>\n";
            $retval .= "            <th colspan='3'>" . __('Action') . "</th>\n";
            $retval .= "            <th>" . __('Type') . "</th>\n";
            $retval .= "        </tr>\n";
            $retval .= "        <tr style='display: none'>\n";
            // see comment above
            for ($i = 0; $i < 6; $i++) {
                $retval .= "            <td></td>\n";
            }
            break;
        default:
            break;
    }
    $retval .= "        </tr>\n";
    $retval .= "        <!-- TABLE DATA -->\n";
    $count = 0;
    foreach ($items as $item) {
        $rowclass = $count % 2 == 0 ? 'odd' : 'even';
        if ($GLOBALS['is_ajax_request'] && empty($_REQUEST['ajax_page_request'])) {
            $rowclass .= ' ajaxInsert hide';
        }
        // Get each row from the correct function
        switch ($type) {
            case 'routine':
                $retval .= PMA_RTN_getRowForList($item, $rowclass);
                break;
            case 'trigger':
                $retval .= PMA_TRI_getRowForList($item, $rowclass);
                break;
            case 'event':
                $retval .= PMA_EVN_getRowForList($item, $rowclass);
                break;
            default:
                break;
        }
        $count++;
    }
    $retval .= "    </table>\n";
    if (count($items)) {
        $retval .= '<div class="withSelected">';
        $retval .= PMA_Util::getWithSelected($GLOBALS['pmaThemeImage'], $GLOBALS['text_dir'], 'rteListForm');
        $retval .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_export.png', 'export');
        $retval .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_drop', __('Drop'), 'b_drop.png', 'drop');
        $retval .= '</div>';
    }
    $retval .= "</fieldset>\n";
    $retval .= "</form>\n";
    $retval .= "<!-- LIST OF " . PMA_RTE_getWord('docu') . " END -->\n";
    return $retval;
}
Ejemplo n.º 9
0
/**
 * Get HTML for "check all" check box with "with selected" dropdown
 *
 * @param string $pmaThemeImage pma theme image url
 * @param string $text_dir      url for text directory
 *
 * @return string $html_output
 */
function PMA_getCentralColumnsTableFooter($pmaThemeImage, $text_dir)
{
    $html_output = PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "tableslistcontainer");
    $html_output .= PMA_Util::getButtonOrImage('edit_central_columns', 'mult_submit change_central_columns', 'submit_mult_change', __('Edit'), 'b_edit.png', 'edit central columns');
    $html_output .= PMA_Util::getButtonOrImage('delete_central_columns', 'mult_submit', 'submit_mult_central_columns_remove', __('Delete'), 'b_drop.png', 'remove_from_central_columns');
    return $html_output;
}
Ejemplo n.º 10
0
</a>
        <?php 
        echo '</td>' . '<td>' . '<a href="' . $tmp_link . '">' . $versions . '</a>' . '&nbsp;&nbsp;' . '<a href="' . $tmp_link . '&amp;report=true&amp;version=' . $version_data['version'] . '">' . $report . '</a>' . '&nbsp;&nbsp;' . '<a href="' . $tmp_link . '&amp;snapshot=true&amp;version=' . $version_data['version'] . '">' . $structure . '</a>' . '</td>' . '</tr>';
        if ($style == 'even') {
            $style = 'odd';
        } else {
            $style = 'even';
        }
    }
    unset($tmp_link);
    ?>
    </tbody>
    </table>
    <?php 
    echo PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "trackedForm");
    echo PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete_tracking', __('Delete tracking'), 'b_drop.png', 'delete_tracking');
    ?>
    </form>
    </div>
    <?php 
}
$untracked_tables = PMA_getUntrackedTables($GLOBALS['db']);
// If untracked tables exist
if (count($untracked_tables) > 0) {
    PMA_displayUntrackedTables($GLOBALS['db'], $untracked_tables, $url_query, $pmaThemeImage, $text_dir);
}
// If available print out database log
if (count($data['ddlog']) > 0) {
    $log = '';
    foreach ($data['ddlog'] as $entry) {
        $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n";
Ejemplo n.º 11
0
    if ($is_superuser || $cfg['AllowUserDropDatabase']) {
        $common_url_query = PMA_generate_common_url(
            array(
                'sort_by' => $sort_by,
                'sort_order' => $sort_order,
                'dbstats' => $dbstats
            )
        );
        echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"'
           . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n"
           . '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> '
           . '<label for="checkall">' . __('Check All') . '</label> '
           . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
        echo PMA_Util::getButtonOrImage(
            'drop_selected_dbs',
            'mult_submit' . ($cfg['AjaxEnable'] ? ' ajax' : ''),
            'drop_selected_dbs',
            __('Drop'), 'b_deltbl.png'
        );
    }

    if (empty($dbstats)) {
        echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
            echo '<a href="server_databases.php?' . $url_query . '&amp;dbstats=1"'
                . ' title="' . __('Enable Statistics') . '">' . "\n"
                . '            ' . __('Enable Statistics');
        echo '</a></strong><br />' . "\n";
        PMA_Message::notice(
            __('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.')
        )->display();
        echo '</li>' . "\n" . '</ul>' . "\n";
    }
Ejemplo n.º 12
0
/**
 * Display untracked tables
 *
 * @param string $db               current database
 * @param array  $untracked_tables untracked tables
 * @param string $url_query        url query string
 * @param string $pmaThemeImage    path to theme's image folder
 * @param string $text_dir         text direction
 *
 * @return void
 */
function PMA_displayUntrackedTables($db, $untracked_tables, $url_query, $pmaThemeImage, $text_dir)
{
    ?>
    <h3><?php 
    echo __('Untracked tables');
    ?>
</h3>
    <form method="post" action="db_tracking.php" name="untrackedForm"
        id="untrackedForm" class="ajax">
    <?php 
    echo PMA_URL_getHiddenInputs($db);
    ?>
    <table id="noversions" class="data">
    <thead>
    <tr>
        <th></th>
        <th style="width: 300px"><?php 
    echo __('Table');
    ?>
</th>
        <th><?php 
    echo __('Action');
    ?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    // Print out list of untracked tables
    $style = 'odd';
    foreach ($untracked_tables as $key => $tablename) {
        $style = PMA_displayOneUntrackedTable($db, $tablename, $url_query, $style);
    }
    ?>
    </tbody>
    </table>
    <?php 
    echo PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "untrackedForm");
    echo PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_track', __('Track table'), 'eye.png', 'track');
    ?>
    </form>
    <?php 
}
Ejemplo n.º 13
0
        }
    }
    foreach ($replication_types as $type) {
        if (${"server_{$type}_status"}) {
            echo '    <th></th>' . "\n";
        }
    }
    if ($is_superuser) {
        echo '    <th></th>' . "\n";
    }
    echo '</tr>' . "\n";
    echo '</tfoot>' . "\n" . '</table>' . "\n";
    unset($column_order, $stat_name, $stat, $databases, $table_columns);
    if ($is_superuser || $cfg['AllowUserDropDatabase']) {
        $common_url_query = PMA_generate_common_url(array('sort_by' => $sort_by, 'sort_order' => $sort_order, 'dbstats' => $dbstats));
        echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"' . ' width="38" height="22" alt="' . __('With selected:') . '" />' . "\n" . '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> ' . '<label for="checkall">' . __('Check All') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
        echo PMA_Util::getButtonOrImage('', 'mult_submit' . ' ajax', 'drop_selected_dbs', __('Drop'), 'b_deltbl.png');
    }
    if (empty($dbstats)) {
        echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
        echo '<a href="server_databases.php?' . $url_query . '&amp;dbstats=1"' . ' title="' . __('Enable Statistics') . '">' . "\n" . '            ' . __('Enable Statistics');
        echo '</a></strong><br />' . "\n";
        PMA_Message::notice(__('Note: Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server.'))->display();
        echo '</li>' . "\n" . '</ul>' . "\n";
    }
    echo '</form>';
    echo '</div>';
} else {
    echo __('No databases');
}
unset($databases_count);
Ejemplo n.º 14
0
/**
 * Display tracked tables
 *
 * @param string $db                current database
 * @param object $all_tables_result result set of tracked tables
 * @param string $url_query         url query string
 * @param string $pmaThemeImage     path to theme's image folder
 * @param string $text_dir          text direction
 * @param array  $cfgRelation       configuration storage info
 *
 * @return void
 */
function PMA_displayTrackedTables($db, $all_tables_result, $url_query, $pmaThemeImage, $text_dir, $cfgRelation)
{
    ?>
    <div id="tracked_tables">
    <h3><?php 
    echo __('Tracked tables');
    ?>
</h3>

    <form method="post" action="db_tracking.php" name="trackedForm"
        id="trackedForm" class="ajax">
    <?php 
    echo PMA_URL_getHiddenInputs($db);
    ?>
    <table id="versions" class="data">
    <thead>
    <tr>
        <th></th>
        <th><?php 
    echo __('Table');
    ?>
</th>
        <th><?php 
    echo __('Last version');
    ?>
</th>
        <th><?php 
    echo __('Created');
    ?>
</th>
        <th><?php 
    echo __('Updated');
    ?>
</th>
        <th><?php 
    echo __('Status');
    ?>
</th>
        <th><?php 
    echo __('Action');
    ?>
</th>
        <th><?php 
    echo __('Show');
    ?>
</th>
    </tr>
    </thead>
    <tbody>
    <?php 
    // Print out information about versions
    $delete = PMA_Util::getIcon('b_drop.png', __('Delete tracking'));
    $versions = PMA_Util::getIcon('b_versions.png', __('Versions'));
    $report = PMA_Util::getIcon('b_report.png', __('Tracking report'));
    $structure = PMA_Util::getIcon('b_props.png', __('Structure snapshot'));
    $style = 'odd';
    while ($one_result = $GLOBALS['dbi']->fetchArray($all_tables_result)) {
        list($table_name, $version_number) = $one_result;
        $table_query = ' SELECT * FROM ' . PMA_Util::backquote($cfgRelation['db']) . '.' . PMA_Util::backquote($cfgRelation['tracking']) . ' WHERE `db_name` = \'' . PMA_Util::sqlAddSlashes($_REQUEST['db']) . '\' AND `table_name`  = \'' . PMA_Util::sqlAddSlashes($table_name) . '\' AND `version` = \'' . $version_number . '\'';
        $table_result = PMA_queryAsControlUser($table_query);
        $version_data = $GLOBALS['dbi']->fetchArray($table_result);
        $tbl_link = 'tbl_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']);
        $delete_link = 'db_tracking.php' . $url_query . '&amp;table=' . htmlspecialchars($version_data['table_name']) . '&amp;delete_tracking=true&amp';
        $checkbox_id = "selected_tbl_" . htmlspecialchars($version_data['table_name']);
        ?>
        <tr class="<?php 
        echo $style;
        ?>
">
            <td class="center">
                <input type="checkbox" name="selected_tbl[]"
                class="checkall" id="<?php 
        echo $checkbox_id;
        ?>
"
                value="<?php 
        echo htmlspecialchars($version_data['table_name']);
        ?>
"/>
            </td>
            <th>
                <label for="<?php 
        echo $checkbox_id;
        ?>
">
                    <?php 
        echo htmlspecialchars($version_data['table_name']);
        ?>
                </label>
            </th>
            <td class="right"><?php 
        echo $version_data['version'];
        ?>
</td>
            <td><?php 
        echo $version_data['date_created'];
        ?>
</td>
            <td><?php 
        echo $version_data['date_updated'];
        ?>
</td>
            <td>
            <?php 
        PMA_displayStatusButton($version_data, $tbl_link);
        ?>
            </td>
            <td>
            <a class="delete_tracking_anchor ajax"
               href="<?php 
        echo $delete_link;
        ?>
" >
            <?php 
        echo $delete;
        ?>
</a>
        <?php 
        echo '</td>' . '<td>' . '<a href="' . $tbl_link . '">' . $versions . '</a>' . '&nbsp;&nbsp;' . '<a href="' . $tbl_link . '&amp;report=true&amp;version=' . $version_data['version'] . '">' . $report . '</a>' . '&nbsp;&nbsp;' . '<a href="' . $tbl_link . '&amp;snapshot=true&amp;version=' . $version_data['version'] . '">' . $structure . '</a>' . '</td>' . '</tr>';
        if ($style == 'even') {
            $style = 'odd';
        } else {
            $style = 'even';
        }
    }
    ?>
    </tbody>
    </table>
    <?php 
    echo PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "trackedForm");
    echo PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_delete_tracking', __('Delete tracking'), 'b_drop.png', 'delete_tracking');
    ?>
    </form>
    </div>
    <?php 
}
            <td><?php 
            echo $my_link;
            ?>
</td>
            </tr>
            <?php 
            if ($style == 'even') {
                $style = 'odd';
            } else {
                $style = 'even';
            }
        }
    }
    ?>
    </tbody>
    </table>
    <?php 
    echo PMA_Util::getWithSelected($pmaThemeImage, $text_dir, "untrackedForm");
    echo PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_track', __('Track table'), 'eye.png', 'track');
    ?>
    </form>
    <?php 
}
// If available print out database log
if (count($data['ddlog']) > 0) {
    $log = '';
    foreach ($data['ddlog'] as $entry) {
        $log .= '# ' . $entry['date'] . ' ' . $entry['username'] . "\n" . $entry['statement'] . "\n";
    }
    echo PMA_Util::getMessage(__('Database Log'), $log);
}
/**
 * Get HTML for display the users overview
 * (if less than 50 users, display them immediately)
 *
 * @param array  $result            ran sql query
 * @param array  $db_rights         user's database rights array
 * @param string $link_edit         standard link to edit privileges
 * @param string $pmaThemeImage     a image source link
 * @param string $text_dir          text directory
 * @param string $conditional_class if ajaxable 'Ajax' otherwise ''
 * @param string $link_export       standard link to export privileges
 *
 * @return string HTML snippet
 */
function PMA_getUsersOverview($result, $db_rights, $link_edit, $pmaThemeImage, $text_dir, $conditional_class, $link_export)
{
    while ($row = PMA_DBI_fetch_assoc($result)) {
        $row['privs'] = PMA_extractPrivInfo($row, true);
        $db_rights[$row['User']][$row['Host']] = $row;
    }
    @PMA_DBI_free_result($result);
    $html_output = '<form name="usersForm" id="usersForm" action="server_privileges.php" ' . 'method="post">' . "\n" . PMA_generate_common_hidden_inputs('', '') . '<table id="tableuserrights" class="data">' . "\n" . '<thead>' . "\n" . '<tr><th></th>' . "\n" . '<th>' . __('User') . '</th>' . "\n" . '<th>' . __('Host') . '</th>' . "\n" . '<th>' . __('Password') . '</th>' . "\n" . '<th>' . __('Global privileges') . ' ' . PMA_Util::showHint(__('Note: MySQL privilege names are expressed in English')) . '</th>' . "\n" . '<th>' . __('Grant') . '</th>' . "\n" . '<th colspan="2">' . __('Action') . '</th>' . "\n" . '</tr>' . "\n" . '</thead>' . "\n";
    $html_output .= '<tbody>' . "\n";
    $html_output .= PMA_getTableBodyForUserRightsTable($db_rights, $link_edit, $link_export);
    $html_output .= '</tbody>' . '</table>' . "\n";
    $html_output .= '<div style="float:left;">' . '<img class="selectallarrow"' . ' src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png"' . ' width="38" height="22"' . ' alt="' . __('With selected:') . '" />' . "\n" . '<input type="checkbox" id="checkall" title="' . __('Check All') . '" /> ' . '<label for="checkall">' . __('Check All') . '</label> ' . '<i style="margin-left: 2em">' . __('With selected:') . '</i>' . "\n";
    $html_output .= PMA_Util::getButtonOrImage('submit_mult', 'mult_submit', 'submit_mult_export', __('Export'), 'b_tblexport.png', 'export');
    $html_output .= '<input type="hidden" name="initial" ' . 'value="' . (isset($_GET['initial']) ? $_GET['initial'] : '') . '" />';
    $html_output .= '</div>' . '<div class="clear_both" style="clear:both"></div>';
    // add/delete user fieldset
    $html_output .= PMA_getFieldsetForAddDeleteUser($conditional_class);
    $html_output .= '</form>' . "\n";
    return $html_output;
}