コード例 #1
0
/**
 * Get HTML for the Change password dialog
 *
 * @param string $username username
 * @param string $hostname hostname
 *
 * @return string html snippet
 */
function PMA_getHtmlForChangePassword($username, $hostname)
{
    /**
     * autocomplete feature of IE kills the "onchange" event handler and it
     * must be replaced by the "onpropertychange" one in this case
     */
    $chg_evt_handler = PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7 ? 'onpropertychange' : 'onchange';
    $is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
    $html = '<form method="post" id="change_password_form" ' . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" ' . 'name="chgPassword" ' . 'class="ajax' . ($is_privileges ? ' submenu-item' : '') . '">';
    $html .= PMA_URL_getHiddenInputs();
    /** @var PMA_String $pmaStr */
    $pmaStr = $GLOBALS['PMA_String'];
    if ($pmaStr->strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
        $html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
    }
    $html .= '<fieldset id="fieldset_change_password">' . '<legend' . ($is_privileges ? ' data-submenu-label="' . __('Change password') . '"' : '') . '>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked " />' . '<label for="nopass_0">' . __('Password:'******'&nbsp;</label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>';
    if (PMA_MYSQL_INT_VERSION < 50705) {
        $html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" ' . 'value="new" checked="checked" />' . '<label for="radio_pw_hash_new">MySQL&nbsp;4.1+</label>' . '</td>' . '</tr>' . '<tr id="tr_element_before_generate_password">' . '<td>&nbsp;</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" ' . 'value="old" />' . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible') . '</label>' . '</td>' . '</tr>';
    } else {
        // See http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html
        $html .= '<input type="hidden" name="pw_hash" value="new" />';
    }
    $html .= '</table>' . '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="submit" name="change_pw" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
    return $html;
}
コード例 #2
0
/**
 * Returns the html for create table.
 *
 * @param string $db database name
 *
 * @return string
 */
function PMA_getHtmlForCreateTable($db)
{
    $html = '<form id="create_table_form_minimal" method="post" ' . 'action="tbl_create.php">';
    $html .= '<fieldset>';
    $html .= '<legend>';
    if (PMA_Util::showIcons('ActionLinksMode')) {
        $html .= PMA_Util::getImage('b_newtbl.png');
    }
    $html .= __('Create table');
    $html .= ' </legend>';
    $html .= PMA_URL_getHiddenInputs($db);
    $html .= '<div class="formelement">';
    $html .= __('Name') . ":";
    $html .= '  <input type="text" name="table" maxlength="64" ' . 'size="30" required="required" />';
    $html .= ' </div>';
    $html .= '  <div class="formelement">';
    $html .= __('Number of columns') . ":";
    $html .= '  <input type="number" min="1" name="num_fields" value="4" required="required" />';
    $html .= ' </div>';
    $html .= '  <div class="clearfloat"></div>';
    $html .= '</fieldset>';
    $html .= '<fieldset class="tblFooters">';
    $html .= '   <input type="submit" value="' . __('Go') . '" />';
    $html .= '</fieldset>';
    $html .= '</form>';
    return $html;
}
コード例 #3
0
ファイル: tbl_tracking.lib.php プロジェクト: minggLu/openemr
/**
 * Function to get html for data definition and data manipulation statements
 *
 * @param string $url_query    url query
 * @param int    $last_version last version
 *
 * @return string
 */
function PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query, $last_version)
{
    $html = '<div id="div_create_version">';
    $html .= '<form method="post" action="tbl_tracking.php?' . $url_query . '">';
    $html .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $html .= '<fieldset>';
    $html .= '<legend>';
    $html .= sprintf(__('Create version %1$s of %2$s'), $last_version + 1, htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']));
    $html .= '</legend>';
    $html .= '<input type="hidden" name="version" value="' . ($last_version + 1) . '" />';
    $html .= '<p>' . __('Track these data definition statements:') . '</p>';
    $html .= '<input type="checkbox" name="alter_table" value="true"' . ' checked="checked" /> ALTER TABLE<br/>';
    $html .= '<input type="checkbox" name="rename_table" value="true"' . ' checked="checked" /> RENAME TABLE<br/>';
    $html .= '<input type="checkbox" name="create_table" value="true"' . ' checked="checked" /> CREATE TABLE<br/>';
    $html .= '<input type="checkbox" name="drop_table" value="true"' . ' checked="checked" /> DROP TABLE<br/>';
    $html .= '<br/>';
    $html .= '<input type="checkbox" name="create_index" value="true"' . ' checked="checked" /> CREATE INDEX<br/>';
    $html .= '<input type="checkbox" name="drop_index" value="true"' . ' checked="checked" /> DROP INDEX<br/>';
    $html .= '<p>' . __('Track these data manipulation statements:') . '</p>';
    $html .= '<input type="checkbox" name="insert" value="true"' . ' checked="checked" /> INSERT<br/>';
    $html .= '<input type="checkbox" name="update" value="true"' . ' checked="checked" /> UPDATE<br/>';
    $html .= '<input type="checkbox" name="delete" value="true"' . ' checked="checked" /> DELETE<br/>';
    $html .= '<input type="checkbox" name="truncate" value="true"' . ' checked="checked" /> TRUNCATE<br/>';
    $html .= '</fieldset>';
    $html .= '<fieldset class="tblFooters">';
    $html .= '<input type="hidden" name="submit_create_version" value="1" />';
    $html .= '<input type="submit" value="' . __('Create version') . '" />';
    $html .= '</fieldset>';
    $html .= '</form>';
    $html .= '</div>';
    return $html;
}
コード例 #4
0
/**
 * Returns the html for log selector.
 *
 * @param Array $binary_logs Binary logs file names
 * @param Array $url_params  links parameters
 *
 * @return string
 */
function PMA_getLogSelector($binary_logs, $url_params)
{
    $html = "";
    if (count($binary_logs) > 1) {
        $html .= '<form action="server_binlog.php" method="get">';
        $html .= PMA_URL_getHiddenInputs($url_params);
        $html .= '<fieldset><legend>';
        $html .= __('Select binary log to view');
        $html .= '</legend><select name="log">';
        $full_size = 0;
        foreach ($binary_logs as $each_log) {
            $html .= '<option value="' . $each_log['Log_name'] . '"';
            if ($each_log['Log_name'] == $_REQUEST['log']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . $each_log['Log_name'];
            if (isset($each_log['File_size'])) {
                $full_size += $each_log['File_size'];
                $html .= ' (' . implode(' ', PMA_Util::formatByteDown($each_log['File_size'], 3, 2)) . ')';
            }
            $html .= '</option>';
        }
        $html .= '</select> ';
        $html .= count($binary_logs) . ' ' . __('Files') . ', ';
        if ($full_size > 0) {
            $html .= implode(' ', PMA_Util::formatByteDown($full_size));
        }
        $html .= '</fieldset>';
        $html .= '<fieldset class="tblFooters">';
        $html .= '<input type="submit" value="' . __('Go') . '" />';
        $html .= '</fieldset>';
        $html .= '</form>';
    }
    return $html;
}
コード例 #5
0
 /**
  * Test for PMA_selectServer
  *
  * @return void
  */
 public function testPMASelectServer()
 {
     $not_only_options = false;
     $ommit_fieldset = false;
     $GLOBALS['cfg']['DefaultTabServer'] = "DefaultTabServer";
     $GLOBALS['cfg']['Servers'] = array('0' => array('host' => 'host0', 'port' => 'port0', 'only_db' => 'only_db0', 'user' => 'user0', 'auth_type' => 'config'), '1' => array('host' => 'host1', 'port' => 'port1', 'only_db' => 'only_db1', 'user' => 'user1', 'auth_type' => 'config'));
     //$not_only_options=false & $ommit_fieldset=false
     $html = PMA_selectServer($not_only_options, $ommit_fieldset);
     $server = $GLOBALS['cfg']['Servers']['0'];
     //server items
     $this->assertContains($server['host'], $html);
     $this->assertContains($server['port'], $html);
     $this->assertContains($server['only_db'], $html);
     $this->assertContains($server['user'], $html);
     $not_only_options = true;
     $ommit_fieldset = true;
     $GLOBALS['cfg']['DisplayServersList'] = null;
     //$not_only_options=true & $ommit_fieldset=true
     $html = PMA_selectServer($not_only_options, $ommit_fieldset);
     //$GLOBALS['cfg']['DefaultTabServer']
     $this->assertContains($GLOBALS['cfg']['DefaultTabServer'], $html);
     //PMA_URL_getHiddenInputs
     $this->assertContains(PMA_URL_getHiddenInputs(), $html);
     //labels
     $this->assertContains(__('Current Server:'), $html);
     $this->assertContains('(' . __('Servers') . ')', $html);
     //server items
     $server = $GLOBALS['cfg']['Servers']['0'];
     $this->assertContains($server['host'], $html);
     $this->assertContains($server['port'], $html);
     $this->assertContains($server['only_db'], $html);
     $this->assertContains($server['user'], $html);
 }
コード例 #6
0
/**
 * Get HTML for the Change password dialog
 *
 * @param string $username username
 * @param string $hostname hostname
 *
 * @return string html snippet
 */
function PMA_getHtmlForChangePassword($username, $hostname)
{
    /**
     * autocomplete feature of IE kills the "onchange" event handler and it
     * must be replaced by the "onpropertychange" one in this case
     */
    $chg_evt_handler = PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7 ? 'onpropertychange' : 'onchange';
    $is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
    $html = '<form method="post" id="change_password_form" ' . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" ' . 'name="chgPassword" ' . 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';
    $html .= PMA_URL_getHiddenInputs();
    if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
        $html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
    }
    $html .= '<fieldset id="fieldset_change_password">' . '<legend' . ($is_privileges ? ' data-submenu-label="' . __('Change password') . '"' : '') . '>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked" />' . '<label for="nopass_0">' . __('Password:'******'&nbsp;</label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>';
    $html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td><td>';
    $serverType = PMA\libraries\Util::getServerType();
    $orig_auth_plugin = PMA_getCurrentAuthenticationPlugin('change', $username, $hostname);
    if ($serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50507 || $serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200) {
        $auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($username, $hostname, $orig_auth_plugin, 'change_pw', 'new');
        $html .= $auth_plugin_dropdown;
        $html .= '</td></tr>';
        $html .= '<tr id="tr_element_before_generate_password"></tr>';
        $html .= '</table>';
        $html .= '<div ' . ($orig_auth_plugin != 'sha256_password' ? 'style="display:none"' : '') . ' id="ssl_reqd_warning_cp">' . Message::notice(__('This method requires using an \'<i>SSL connection</i>\' ' . 'or an \'<i>unencrypted connection that encrypts the password ' . 'using RSA</i>\'; while connecting to the server.') . PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin'))->getDisplay() . '</div>';
        $html .= '<div ' . ($orig_auth_plugin != 'sha256_password' ? 'style="display:none"' : '') . ' id="ssl_reqd_warning_cp">' . Message::notice(__('This method requires using an \'<i>SSL connection</i>\' ' . 'or an \'<i>unencrypted connection that encrypts the password ' . 'using RSA</i>\'; while connecting to the server.') . PMA\libraries\Util::showMySQLDocu('sha256-authentication-plugin'))->getDisplay() . '</div>';
    } else {
        $auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown($username, $hostname, $orig_auth_plugin, 'change_pw', 'old');
        $html .= $auth_plugin_dropdown . '</td></tr>' . '<tr id="tr_element_before_generate_password"></tr>' . '</table>';
    }
    $html .= '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="hidden" name="change_pw" value="1" />' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
    return $html;
}
コード例 #7
0
/**
 * Returns the html for Database List
 *
 * @param Array  $databases         GBI return databases
 * @param int    $databases_count   database count
 * @param int    $pos               display pos
 * @param Array  $dbstats           database status
 * @param string $sort_by           sort by string
 * @param string $sort_order        sort order string
 * @param bool   $is_superuser      User status
 * @param Array  $cfg               configuration
 * @param string $replication_types replication types
 * @param string $replication_info  replication info
 * @param string $url_query         url query
 *
 * @return string
 */
function PMA_getHtmlForDatabase($databases, $databases_count, $pos, $dbstats, $sort_by, $sort_order, $is_superuser, $cfg, $replication_types, $replication_info, $url_query)
{
    $html = '<div id="tableslistcontainer">';
    reset($databases);
    $first_database = current($databases);
    // table col order
    $column_order = PMA_getColumnOrder();
    $_url_params = array('pos' => $pos, 'dbstats' => $dbstats, 'sort_by' => $sort_by, 'sort_order' => $sort_order);
    $html .= PMA_Util::getListNavigator($databases_count, $pos, $_url_params, 'server_databases.php', 'frame_content', $GLOBALS['cfg']['MaxDbList']);
    $_url_params['pos'] = $pos;
    $html .= '<form class="ajax" action="server_databases.php" ';
    $html .= 'method="post" name="dbStatsForm" id="dbStatsForm">' . "\n";
    $html .= PMA_URL_getHiddenInputs($_url_params);
    $_url_params['sort_by'] = 'SCHEMA_NAME';
    $_url_params['sort_order'] = $sort_by == 'SCHEMA_NAME' && $sort_order == 'asc' ? 'desc' : 'asc';
    $html .= '<table id="tabledatabases" class="data">' . "\n" . '<thead>' . "\n" . '<tr>' . "\n";
    $html .= PMA_getHtmlForColumnOrderWithSort($is_superuser, $cfg['AllowUserDropDatabase'], $_url_params, $sort_by, $sort_order, $column_order, $first_database);
    $html .= PMA_getHtmlForReplicationType($is_superuser, $replication_types, $cfg['ActionLinksMode']);
    $html .= '</tr>' . "\n" . '</thead>' . "\n";
    list($output, $column_order) = PMA_getHtmlAndColumnOrderForDatabaseList($databases, $is_superuser, $url_query, $column_order, $replication_types, $replication_info);
    $html .= $output;
    unset($output);
    $html .= PMA_getHtmlForTableFooter($cfg['AllowUserDropDatabase'], $is_superuser, $databases_count, $column_order, $replication_types, $first_database);
    $html .= '</table>' . "\n";
    $html .= PMA_getHtmlForTableFooterButtons($cfg['AllowUserDropDatabase'], $is_superuser, $sort_by, $sort_order, $dbstats);
    if (empty($dbstats)) {
        //we should put notice above database list
        $html = PMA_getHtmlForNoticeEnableStatistics($url_query, $html);
    }
    $html .= '</form>';
    $html .= '</div>';
    return $html;
}
コード例 #8
0
/**
 * return HTML for the sql query boxes
 *
 * @param boolean|string $query       query to display in the textarea
 *                                    or true to display last executed
 * @param boolean|string $display_tab sql|files|history|full|false
 *                                    what part to display
 *                                    false if not inside querywindow
 * @param string         $delimiter   delimiter
 *
 * @return string
 *
 * @usedby  server_sql.php
 * @usedby  db_sql.php
 * @usedby  tbl_sql.php
 * @usedby  tbl_structure.php
 * @usedby  tbl_tracking.php
 */
function PMA_getHtmlForSqlQueryForm($query = true, $display_tab = false, $delimiter = ';')
{
    $html = '';
    if (!$display_tab) {
        $display_tab = 'full';
    }
    // query to show
    if (true === $query) {
        $query = $GLOBALS['sql_query'];
    }
    // set enctype to multipart for file uploads
    if ($GLOBALS['is_upload']) {
        $enctype = ' enctype="multipart/form-data"';
    } else {
        $enctype = '';
    }
    $table = '';
    $db = '';
    if (!mb_strlen($GLOBALS['db'])) {
        // prepare for server related
        $goto = empty($GLOBALS['goto']) ? 'server_sql.php' : $GLOBALS['goto'];
    } elseif (!mb_strlen($GLOBALS['table'])) {
        // prepare for db related
        $db = $GLOBALS['db'];
        $goto = empty($GLOBALS['goto']) ? 'db_sql.php' : $GLOBALS['goto'];
    } else {
        $table = $GLOBALS['table'];
        $db = $GLOBALS['db'];
        $goto = empty($GLOBALS['goto']) ? 'tbl_sql.php' : $GLOBALS['goto'];
    }
    // start output
    $html .= '<form method="post" action="import.php" ' . $enctype;
    $html .= ' class="ajax lock-page"';
    $html .= ' id="sqlqueryform" name="sqlform">' . "\n";
    $html .= '<input type="hidden" name="is_js_confirmed" value="0" />' . "\n" . PMA_URL_getHiddenInputs($db, $table) . "\n" . '<input type="hidden" name="pos" value="0" />' . "\n" . '<input type="hidden" name="goto" value="' . htmlspecialchars($goto) . '" />' . "\n" . '<input type="hidden" name="message_to_show" value="' . __('Your SQL query has been executed successfully.') . '" />' . "\n" . '<input type="hidden" name="prev_sql_query" value="' . htmlspecialchars($query) . '" />' . "\n";
    // display querybox
    if ($display_tab === 'full' || $display_tab === 'sql') {
        $html .= PMA_getHtmlForSqlQueryFormInsert($query, $delimiter);
    }
    // display uploads
    if ($display_tab === 'files' && $GLOBALS['is_upload']) {
        $html .= PMA_getHtmlForSqlQueryFormUpload();
    }
    // Bookmark Support
    if ($display_tab === 'full' || $display_tab === 'history') {
        $cfgBookmark = PMA_Bookmark_getParams();
        if ($cfgBookmark) {
            $html .= PMA_getHtmlForSqlQueryFormBookmark();
        }
    }
    // Encoding setting form appended by Y.Kawada
    if (function_exists('PMA_Kanji_encodingForm')) {
        $html .= PMA_Kanji_encodingForm();
    }
    $html .= '</form>' . "\n";
    // print an empty div, which will be later filled with
    // the sql query results by ajax
    $html .= '<div id="sqlqueryresults"></div>';
    return $html;
}
コード例 #9
0
ファイル: index.lib.php プロジェクト: skduncan/pizza-order
/**
 * Get HTML for display indexes
 *
 * @return string $html_output
 */
function PMA_getHtmlForDisplayIndexes()
{
    $html_output = '<div id="index_div" class="ajax" >';
    $html_output .= PMA_Util::getDivForSliderEffect('indexes', __('Indexes'));
    $html_output .= PMA_Index::getView($GLOBALS['table'], $GLOBALS['db']);
    $html_output .= '<fieldset class="tblFooters" style="text-align: left;">' . '<form action="tbl_indexes.php" method="post">';
    $html_output .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $html_output .= sprintf(__('Create an index on &nbsp;%s&nbsp;columns'), '<input type="number" name="added_fields" value="1" ' . 'min="1" required="required" />');
    $html_output .= '<input type="hidden" name="create_index" value="1" />' . '<input class="add_index ajax"' . ' type="submit" value="' . __('Go') . '" />';
    $html_output .= '</form>' . '</fieldset>' . '</div>' . '</div>';
    return $html_output;
}
コード例 #10
0
    /**
     * Test for PMA_getHtmlForChangePassword
     *
     * @return void
     */
    public function testPMAGetHtmlForChangePassword()
    {
        $username = "******";
        $hostname = "pma_hostname";

        //Call the test function
        $html = PMA_getHtmlForChangePassword($username, $hostname);

        //PMA_PHP_SELF
        $this->assertContains(
            $GLOBALS['PMA_PHP_SELF'],
            $html
        );

        //PMA_URL_getHiddenInputs
        $this->assertContains(
            PMA_URL_getHiddenInputs(),
            $html
        );

        //$username & $hostname
        $this->assertContains(
            htmlspecialchars($username),
            $html
        );
        $this->assertContains(
            htmlspecialchars($hostname),
            $html
        );

        //labels
        $this->assertContains(
            __('Change password'),
            $html
        );
        $this->assertContains(
            __('No Password'),
            $html
        );
        $this->assertContains(
            __('Password:'******'Password:'******'Password Hashing:'),
            $html
        );
    }
コード例 #11
0
/**
 * Prints Html For Display Import Hidden Input
 *
 * @param String $import_type Import type: server, database, table
 * @param String $db          Selected DB
 * @param String $table       Selected Table
 *
 * @return string
 */
function PMA_getHtmlForHiddenInputs($import_type, $db, $table)
{
    $html = '';
    if ($import_type == 'server') {
        $html .= PMA_URL_getHiddenInputs('', '', 1);
    } elseif ($import_type == 'database') {
        $html .= PMA_URL_getHiddenInputs($db, '', 1);
    } else {
        $html .= PMA_URL_getHiddenInputs($db, $table, 1);
    }
    $html .= '    <input type="hidden" name="import_type" value="' . $import_type . '" />' . "\n";
    return $html;
}
コード例 #12
0
 /**
  * Tests for PMA_getHtmlForDataDefinitionAndManipulationStatements() method.
  *
  * @return void
  * @test
  */
 public function testPMAGetHtmlForDataDefinitionAndManipulationStatements()
 {
     $url_query = "url_query";
     $last_version = "10";
     $html = PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query, $last_version, $GLOBALS['db'], array($GLOBALS['table']));
     $this->assertContains('<div id="div_create_version">', $html);
     $this->assertContains($url_query, $html);
     $this->assertContains(PMA_URL_getHiddenInputs($GLOBALS['db']), $html);
     $item = sprintf(__('Create version %1$s of %2$s'), $last_version + 1, htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']));
     $this->assertContains($item, $html);
     $item = '<input type="checkbox" name="delete" value="true"' . ' checked="checked" /> DELETE<br/>';
     $this->assertContains($item, $html);
     $this->assertContains(__('Create version'), $html);
 }
コード例 #13
0
/**
 * Get HTML for the Change password dialog
 *
 * @param string $username username
 * @param string $hostname hostname
 *
 * @return string html snippet
 */
function PMA_getHtmlForChangePassword($username, $hostname)
{
    /**
     * autocomplete feature of IE kills the "onchange" event handler and it
     * must be replaced by the "onpropertychange" one in this case
     */
    $chg_evt_handler = PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7 ? 'onpropertychange' : 'onchange';
    $html = '<form method="post" id="change_password_form" ' . 'action="' . $GLOBALS['PMA_PHP_SELF'] . '" ' . 'name="chgPassword" ' . 'class="ajax" >';
    $html .= PMA_URL_getHiddenInputs();
    if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
        $html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
    }
    $html .= '<fieldset id="fieldset_change_password">' . '<legend>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked " />' . '<label for="nopass_0">' . __('Password:'******'&nbsp;</label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>' . '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" ' . 'value="new" checked="checked" />' . '<label for="radio_pw_hash_new">MySQL&nbsp;4.1+</label>' . '</td>' . '</tr>' . '<tr id="tr_element_before_generate_password">' . '<td>&nbsp;</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" ' . 'value="old" />' . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible') . '</label>' . '</td>' . '</tr>' . '</table>' . '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="submit" name="change_pw" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
    return $html;
}
コード例 #14
0
 /**
  * Test for PMA_getHtmlForCreateTable
  *
  * @return void
  */
 public function testPMAGetHtmlForCreateTable()
 {
     $db = "pma_db";
     //Call the test function
     $html = PMA_getHtmlForCreateTable($db);
     //getImage
     $this->assertContains(PMA\libraries\Util::getImage('b_table_add.png'), $html);
     //__('Create table')
     $this->assertContains(__('Create table'), $html);
     //PMA_URL_getHiddenInputs
     $this->assertContains(PMA_URL_getHiddenInputs($db), $html);
     //label
     $this->assertContains(__('Name'), $html);
     $this->assertContains(__('Number of columns'), $html);
     //button
     $this->assertContains(__('Go'), $html);
 }
コード例 #15
0
/**
 * Returns HTML code for the language selector
 *
 * @param boolean $use_fieldset whether to use fieldset for selection
 * @param boolean $show_doc     whether to show documentation links
 *
 * @return string
 *
 * @access  public
 */
function PMA_getLanguageSelectorHtml($use_fieldset = false, $show_doc = true)
{
    global $lang;
    $retval = '';
    // Display language selection only if there
    // is more than one language to choose from
    if (count($GLOBALS['available_languages']) > 1) {
        $retval .= '<form method="get" action="index.php" class="disableAjax">';
        $_form_params = array('db' => $GLOBALS['db'], 'table' => $GLOBALS['table']);
        $retval .= PMA_URL_getHiddenInputs($_form_params);
        // For non-English, display "Language" with emphasis because it's
        // not a proper word in the current language; we show it to help
        // people recognize the dialog
        $language_title = __('Language') . (__('Language') != 'Language' ? ' - <em>Language</em>' : '');
        if ($show_doc) {
            $language_title .= PMA_Util::showDocu('faq', 'faq7-2');
        }
        if ($use_fieldset) {
            $retval .= '<fieldset><legend lang="en" dir="ltr">' . $language_title . '</legend>';
        } else {
            $retval .= '<bdo lang="en" dir="ltr"><label for="sel-lang">' . $language_title . ': </label></bdo>';
        }
        $retval .= '<select name="lang" class="autosubmit" lang="en"' . ' dir="ltr" id="sel-lang">';
        uasort($GLOBALS['available_languages'], 'PMA_languageCmp');
        foreach ($GLOBALS['available_languages'] as $id => $tmplang) {
            $lang_name = PMA_languageName($tmplang);
            //Is current one active?
            if ($lang == $id) {
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $retval .= '<option value="' . $id . '"' . $selected . '>';
            $retval .= $lang_name;
            $retval .= '</option>';
        }
        $retval .= '</select>';
        if ($use_fieldset) {
            $retval .= '</fieldset>';
        }
        $retval .= '</form>';
    }
    return $retval;
}
コード例 #16
0
/**
 * Function to get html for relational field selection
 *
 * @param string $db            current database
 * @param string $table         current table
 * @param string $field         field
 * @param array  $foreignData   foreign column data
 * @param string $fieldkey      field key
 * @param string $current_value current columns's value
 *
 * @return string
 */
function PMA_getHtmlForRelationalFieldSelection($db, $table, $field, $foreignData, $fieldkey, $current_value)
{
    $gotopage = PMA_getHtmlForGotoPage($foreignData);
    $showall = PMA_getHtmlForShowAll($foreignData);
    $output = '<form class="ajax" ' . 'id="browse_foreign_form" name="browse_foreign_from" ' . 'action="browse_foreigners.php" method="post">' . '<fieldset>' . PMA_URL_getHiddenInputs($db, $table) . '<input type="hidden" name="field" value="' . htmlspecialchars($field) . '" />' . '<input type="hidden" name="fieldkey" value="' . (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
    if (isset($_REQUEST['rownumber'])) {
        $output .= '<input type="hidden" name="rownumber" value="' . htmlspecialchars($_REQUEST['rownumber']) . '" />';
    }
    $filter_value = isset($_REQUEST['foreign_filter']) ? htmlspecialchars($_REQUEST['foreign_filter']) : '';
    $output .= '<span class="formelement">' . '<label for="input_foreign_filter">' . __('Search:') . '</label>' . '<input type="text" name="foreign_filter" ' . 'id="input_foreign_filter" ' . 'value="' . $filter_value . '" data-old="' . $filter_value . '" ' . '/>' . '<input type="submit" name="submit_foreign_filter" value="' . __('Go') . '" />' . '</span>' . '<span class="formelement">' . $gotopage . '</span>' . '<span class="formelement">' . $showall . '</span>' . '</fieldset>' . '</form>';
    $output .= '<table width="100%" id="browse_foreign_table">';
    if (!is_array($foreignData['disp_row'])) {
        $output .= '</tbody>' . '</table>';
        return $output;
    }
    $header = '<tr>
        <th>' . __('Keyname') . '</th>
        <th>' . __('Description') . '</th>
        <td width="20%"></td>
        <th>' . __('Description') . '</th>
        <th>' . __('Keyname') . '</th>
    </tr>';
    $output .= '<thead>' . $header . '</thead>' . "\n" . '<tfoot>' . $header . '</tfoot>' . "\n" . '<tbody>' . "\n";
    $descriptions = array();
    $keys = array();
    foreach ($foreignData['disp_row'] as $relrow) {
        if ($foreignData['foreign_display'] != false) {
            $descriptions[] = $relrow[$foreignData['foreign_display']];
        } else {
            $descriptions[] = '';
        }
        $keys[] = $relrow[$foreignData['foreign_field']];
    }
    asort($keys);
    $horizontal_count = 0;
    $odd_row = true;
    $indexByDescription = 0;
    foreach ($keys as $indexByKeyname => $value) {
        list($html, $horizontal_count, $odd_row, $indexByDescription) = PMA_getHtmlForOneKey($horizontal_count, $header, $odd_row, $keys, $indexByKeyname, $descriptions, $indexByDescription, $current_value);
        $output .= $html;
    }
    $output .= '</tbody>' . '</table>';
    return $output;
}
コード例 #17
0
/**
 * 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 void
 */
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';
    }
    echo '<form method="' . $method . '" action="' . htmlspecialchars($action) . '" class="config-form disableAjax">';
    echo '<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;
        echo '<input type="hidden" name="check_page_refresh" ' . ' id="check_page_refresh" value="" />' . "\n";
    }
    echo PMA_URL_getHiddenInputs('', '', 0, 'server') . "\n";
    echo PMA_getHiddenFields((array) $hidden_fields);
}
コード例 #18
0
/**
 * Function to get html for data definition and data manipulation statements
 *
 * @param string $url_query    url query
 * @param int    $last_version last version
 * @param string $type         type of the table; table, view or both
 *
 * @return string
 */
function PMA_getHtmlForDataDefinitionAndManipulationStatements($url_query, $last_version, $type = 'both')
{
    $html = '<div id="div_create_version">';
    $html .= '<form method="post" action="tbl_tracking.php' . $url_query . '">';
    $html .= PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
    $html .= '<fieldset>';
    $html .= '<legend>';
    $html .= sprintf(__('Create version %1$s of %2$s'), $last_version + 1, htmlspecialchars($GLOBALS['db'] . '.' . $GLOBALS['table']));
    $html .= '</legend>';
    $html .= '<input type="hidden" name="version" value="' . ($last_version + 1) . '" />';
    $html .= '<p>' . __('Track these data definition statements:') . '</p>';
    if ($type == 'both' || $type == 'table') {
        $html .= '<input type="checkbox" name="alter_table" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'ALTER TABLE') !== false ? ' checked="checked"' : '') . ' /> ALTER TABLE<br/>';
        $html .= '<input type="checkbox" name="rename_table" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'RENAME TABLE') !== false ? ' checked="checked"' : '') . ' /> RENAME TABLE<br/>';
        $html .= '<input type="checkbox" name="create_table" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'CREATE TABLE') !== false ? ' checked="checked"' : '') . ' /> CREATE TABLE<br/>';
        $html .= '<input type="checkbox" name="drop_table" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'DROP TABLE') !== false ? ' checked="checked"' : '') . ' /> DROP TABLE<br/>';
    } elseif ($type == 'both' || $type == 'view') {
        $html .= '<input type="checkbox" name="alter_view" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'ALTER VIEW') !== false ? ' checked="checked"' : '') . ' /> ALTER VIEW<br/>';
        $html .= '<input type="checkbox" name="drop_view" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'DROP VIEW') !== false ? ' checked="checked"' : '') . ' /> DROP VIEW<br/>';
        $html .= '<input type="checkbox" name="create_view" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'CREATE VIEW') !== false ? ' checked="checked"' : '') . ' /> CREATE VIEW<br/>';
    }
    $html .= '<br/>';
    $html .= '<input type="checkbox" name="create_index" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'CREATE INDEX') !== false ? ' checked="checked"' : '') . ' /> CREATE INDEX<br/>';
    $html .= '<input type="checkbox" name="drop_index" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'DROP INDEX') !== false ? ' checked="checked"' : '') . ' /> DROP INDEX<br/>';
    $html .= '<p>' . __('Track these data manipulation statements:') . '</p>';
    $html .= '<input type="checkbox" name="insert" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'INSERT') !== false ? ' checked="checked"' : '') . ' /> INSERT<br/>';
    $html .= '<input type="checkbox" name="update" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'UPDATE') !== false ? ' checked="checked"' : '') . ' /> UPDATE<br/>';
    $html .= '<input type="checkbox" name="delete" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'DELETE') !== false ? ' checked="checked"' : '') . ' /> DELETE<br/>';
    $html .= '<input type="checkbox" name="truncate" value="true"' . (mb_stripos($GLOBALS['cfg']['Server']['tracking_default_statements'], 'TRUNCATE') !== false ? ' checked="checked"' : '') . ' /> TRUNCATE<br/>';
    $html .= '</fieldset>';
    $html .= '<fieldset class="tblFooters">';
    $html .= '<input type="hidden" name="submit_create_version" value="1" />';
    $html .= '<input type="submit" value="' . __('Create version') . '" />';
    $html .= '</fieldset>';
    $html .= '</form>';
    $html .= '</div>';
    return $html;
}
コード例 #19
0
/**
 * Get HTML for the Change password dialog
 *
 * @param string $username username
 * @param string $hostname hostname
 *
 * @return string html snippet
 */
function PMA_getHtmlForChangePassword($username, $hostname)
{
    /**
     * autocomplete feature of IE kills the "onchange" event handler and it
     * must be replaced by the "onpropertychange" one in this case
     */
    $chg_evt_handler = PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER >= 5 && PMA_USR_BROWSER_VER < 7 ? 'onpropertychange' : 'onchange';
    $is_privileges = basename($_SERVER['SCRIPT_NAME']) === 'server_privileges.php';
    $html = '<form method="post" id="change_password_form" ' . 'action="' . basename($GLOBALS['PMA_PHP_SELF']) . '" ' . 'name="chgPassword" ' . 'class="' . ($is_privileges ? 'submenu-item' : '') . '">';
    $html .= PMA_URL_getHiddenInputs();
    if (strpos($GLOBALS['PMA_PHP_SELF'], 'server_privileges') !== false) {
        $html .= '<input type="hidden" name="username" ' . 'value="' . htmlspecialchars($username) . '" />' . '<input type="hidden" name="hostname" ' . 'value="' . htmlspecialchars($hostname) . '" />';
    }
    $html .= '<fieldset id="fieldset_change_password">' . '<legend' . ($is_privileges ? ' data-submenu-label="' . __('Change password') . '"' : '') . '>' . __('Change password') . '</legend>' . '<table class="data noclick">' . '<tr class="odd">' . '<td colspan="2">' . '<input type="radio" name="nopass" value="1" id="nopass_1" ' . 'onclick="pma_pw.value = \'\'; pma_pw2.value = \'\'; ' . 'this.checked = true" />' . '<label for="nopass_1">' . __('No Password') . '</label>' . '</td>' . '</tr>' . '<tr class="even vmiddle">' . '<td>' . '<input type="radio" name="nopass" value="0" id="nopass_0" ' . 'onclick="document.getElementById(\'text_pma_pw\').focus();" ' . 'checked="checked" />' . '<label for="nopass_0">' . __('Password:'******'&nbsp;</label>' . '</td>' . '<td>' . '<input type="password" name="pma_pw" id="text_pma_pw" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '&nbsp;&nbsp;' . __('Re-type:') . '&nbsp;' . '<input type="password" name="pma_pw2" id="text_pma_pw2" size="10" ' . 'class="textfield"' . $chg_evt_handler . '="nopass[1].checked = true" />' . '</td>' . '</tr>';
    $default_auth_plugin = PMA_getCurrentAuthenticationPlugin('change', $username, $hostname);
    // See http://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html
    if (PMA_MYSQL_INT_VERSION >= 50705) {
        $html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_mysql_native" ' . 'value="mysql_native_password"';
        if ($default_auth_plugin == 'mysql_native_password') {
            $html .= '" checked="checked"';
        }
        $html .= ' />' . '<label for="radio_pw_hash_mysql_native">' . __('MySQL native password') . '</label>' . '</td>' . '</tr>' . '<tr id="tr_element_before_generate_password">' . '<td>&nbsp;</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_sha256" ' . 'value="sha256_password"';
        if ($default_auth_plugin == 'sha256_password') {
            $html .= '" checked="checked"';
        }
        $html .= ' />' . '<label for="radio_pw_hash_sha256">' . __('SHA256 password') . '</label>' . '</td>' . '</tr>';
    } elseif (PMA_MYSQL_INT_VERSION >= 50606) {
        $html .= '<tr class="vmiddle" id="tr_element_before_generate_password">' . '<td>' . __('Password Hashing:') . '</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" ' . 'value="' . $default_auth_plugin . '" checked="checked" />' . '<label for="radio_pw_hash_new">' . $default_auth_plugin . '</label>' . '</td>' . '</tr>';
    } else {
        $html .= '<tr class="vmiddle">' . '<td>' . __('Password Hashing:') . '</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_new" ' . 'value="mysql_native_password" checked="checked" />' . '<label for="radio_pw_hash_new">mysql_native_password</label>' . '</td>' . '</tr>' . '<tr id="tr_element_before_generate_password" >' . '<td>&nbsp;</td>' . '<td>' . '<input type="radio" name="pw_hash" id="radio_pw_hash_old" ' . 'value="old" />' . '<label for="radio_pw_hash_old">' . __('MySQL 4.0 compatible') . '</label>' . '</td>' . '</tr>';
    }
    $html .= '</table>';
    $html .= '<div ' . ($default_auth_plugin != 'sha256_password' ? 'style="display:none"' : '') . ' id="ssl_reqd_warning">' . PMA_Message::notice(__('This method requires using an \'<i>SSL connection</i>\' ' . 'or an \'<i>unencrypted connection that encrypts the password ' . 'using RSA</i>\'; while connecting to the server.') . PMA_Util::showMySQLDocu('sha256-authentication-plugin'))->getDisplay() . '</div>';
    $html .= '</fieldset>' . '<fieldset id="fieldset_change_password_footer" class="tblFooters">' . '<input type="hidden" name="change_pw" value="1" />' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>';
    return $html;
}
コード例 #20
0
/**
 * Function to get html for the common form header
 *
 * @param string $db    current database
 * @param string $table current table
 *
 * @return string
 */
function PMA_getHtmlForCommonFormHeader($db, $table)
{
    return '<form method="post" action="tbl_relation.php">' . "\n" . PMA_URL_getHiddenInputs($db, $table);
}
コード例 #21
0
/**
 * Returns HTML for add/edit user group dialog
 *
 * @param string $userGroup name of the user group in case of editing
 *
 * @return string HTML for add/edit user group dialog
 */
function PMA_getHtmlToEditUserGroup($userGroup = null)
{
    $html_output = '';
    if ($userGroup == null) {
        $html_output .= '<h2>' . __('Add user group') . '</h2>';
    } else {
        $html_output .= '<h2>' . sprintf(__('Edit user group: \'%s\''), htmlspecialchars($userGroup)) . '</h2>';
    }
    $html_output .= '<form name="userGroupForm" id="userGroupForm"' . ' action="server_user_groups.php" method="post">';
    $urlParams = array();
    if ($userGroup != null) {
        $urlParams['userGroup'] = $userGroup;
        $urlParams['editUserGroupSubmit'] = '1';
    } else {
        $urlParams['addUserGroupSubmit'] = '1';
    }
    $html_output .= PMA_URL_getHiddenInputs($urlParams);
    $html_output .= '<fieldset id="fieldset_user_group_rights">';
    $html_output .= '<legend>' . __('User group menu assignments') . '&nbsp;&nbsp;&nbsp;' . '<input type="checkbox" class="checkall_box" title="Check All">' . '<label for="addUsersForm_checkall">' . __('Check All') . '</label>' . '</legend>';
    if ($userGroup == null) {
        $html_output .= '<label for="userGroup">' . __('Group name:') . '</label>';
        $html_output .= '<input type="text" name="userGroup" ' . 'autocomplete="off" required="required" />';
        $html_output .= '<div class="clearfloat"></div>';
    }
    $allowedTabs = array('server' => array(), 'db' => array(), 'table' => array());
    if ($userGroup != null) {
        $groupTable = PMA_Util::backquote($GLOBALS['cfg']['Server']['pmadb']) . "." . PMA_Util::backquote($GLOBALS['cfg']['Server']['usergroups']);
        $sql_query = "SELECT * FROM " . $groupTable . " WHERE `usergroup`='" . PMA_Util::sqlAddSlashes($userGroup) . "'";
        $result = PMA_queryAsControlUser($sql_query, false);
        if ($result) {
            while ($row = $GLOBALS['dbi']->fetchAssoc($result)) {
                $key = $row['tab'];
                $value = $row['allowed'];
                if (substr($key, 0, 7) == 'server_' && $value == 'Y') {
                    $allowedTabs['server'][] = substr($key, 7);
                } elseif (substr($key, 0, 3) == 'db_' && $value == 'Y') {
                    $allowedTabs['db'][] = substr($key, 3);
                } elseif (substr($key, 0, 6) == 'table_' && $value == 'Y') {
                    $allowedTabs['table'][] = substr($key, 6);
                }
            }
        }
        $GLOBALS['dbi']->freeResult($result);
    }
    $html_output .= _getTabList(__('Server-level tabs'), 'server', $allowedTabs['server']);
    $html_output .= _getTabList(__('Database-level tabs'), 'db', $allowedTabs['db']);
    $html_output .= _getTabList(__('Table-level tabs'), 'table', $allowedTabs['table']);
    $html_output .= '</fieldset>';
    $html_output .= '<fieldset id="fieldset_user_group_rights_footer"' . ' class="tblFooters">';
    $html_output .= '<input type="submit" name="update_privs" value="Go">';
    $html_output .= '</fieldset>';
    return $html_output;
}
コード例 #22
0
 /**
  * Test for PMA_getHTMLforAddCentralColumn
  *
  * @return void
  */
 public function testPMAGetHTMLforAddCentralColumn()
 {
     $result = PMA_getHTMLforAddCentralColumn(20, 0, 'phpmyadmin');
     $this->assertContains('<table', $result);
     $this->assertContains('<form', $result);
     $this->assertContains(PMA_URL_getHiddenInputs('phpmyadmin') . '<input type="hidden" name="add_column" value="add">' . '<input type="hidden" name="pos" value="0" />' . '<input type="hidden" name="total_rows" value="20"/>', $result);
 }
コード例 #23
0
 /**
  * Test for PMA_getUsersOverview
  *
  * @return void
  */
 public function testPMAGetUsersOverview()
 {
     $result = array();
     $db_rights = array();
     $pmaThemeImage = "pmaThemeImage";
     $text_dir = "text_dir";
     $GLOBALS['cfgRelation']['menuswork'] = true;
     $html = PMA_getUsersOverview($result, $db_rights, $pmaThemeImage, $text_dir);
     //PMA_URL_getHiddenInputs
     $this->assertContains(PMA_URL_getHiddenInputs('', ''), $html);
     //items
     $this->assertContains(__('User'), $html);
     $this->assertContains(__('Host'), $html);
     $this->assertContains(__('Password'), $html);
     $this->assertContains(__('Global privileges'), $html);
     //PMA\libraries\Util::showHint
     $this->assertContains(PMA\libraries\Util::showHint(__('Note: MySQL privilege names are expressed in English.')), $html);
     //__('User group')
     $this->assertContains(__('User group'), $html);
     $this->assertContains(__('Grant'), $html);
     $this->assertContains(__('Action'), $html);
     //$pmaThemeImage
     $this->assertContains($pmaThemeImage, $html);
     //$text_dir
     $this->assertContains($text_dir, $html);
     //PMA_getFieldsetForAddDeleteUser
     $this->assertContains(PMA_getFieldsetForAddDeleteUser(), $html);
 }
コード例 #24
0
ファイル: index.php プロジェクト: deerob/phpmyadmin
    }
    /**
     * Displays the mysql server related links
     */
    if ($server > 0) {
        include_once 'libraries/check_user_privileges.lib.php';
        // Logout for advanced authentication
        if ($cfg['Server']['auth_type'] != 'config') {
            if ($cfg['ShowChgPassword']) {
                $conditional_class = 'ajax';
                PMA_printListItem(PMA\libraries\Util::getImage('s_passwd.png') . "&nbsp;" . __('Change password'), 'li_change_password', 'user_password.php' . $common_url_query, null, null, 'change_password_anchor', "no_bullets", $conditional_class);
            }
        }
        // end if
        echo '    <li id="li_select_mysql_collation" class="no_bullets" >';
        echo '        <form method="post" action="index.php">', "\n" . PMA_URL_getHiddenInputs(null, null, 4, 'collation_connection') . '            <label for="select_collation_connection">' . "\n" . '                ' . PMA\libraries\Util::getImage('s_asci.png') . "&nbsp;" . __('Server connection collation') . "\n" . PMA\libraries\Util::showMySQLDocu('Charset-connection') . ': ' . "\n" . '            </label>' . "\n" . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'collation_connection', 'select_collation_connection', $collation_connection, true, true) . '        </form>' . "\n" . '    </li>' . "\n";
    }
    // end of if ($server > 0)
    echo '</ul>';
    echo '</div>';
}
echo '<div class="group">';
echo '<h2>', __('Appearance settings'), '</h2>';
echo '  <ul>';
// Displays language selection combo
if (empty($cfg['Lang']) && count($GLOBALS['available_languages']) > 1) {
    echo '<li id="li_select_lang" class="no_bullets">';
    include_once 'libraries/display_select_lang.lib.php';
    echo PMA\libraries\Util::getImage('s_lang.png'), " ", PMA_getLanguageSelectorHtml();
    echo '</li>';
}
コード例 #25
0
ファイル: DisplayResults.class.php プロジェクト: nkeat12/dv
 /**
  * Prepare html form for multi row operations
  *
  * @param string $del_lnk the delete link of current row
  *
  * @return  string  $form_html          html content
  *
  * @access  private
  *
  * @see     _getTableHeaders()
  */
 private function _getFormForMultiRowOperations($del_lnk)
 {
     $form_html = '';
     if ($del_lnk == self::DELETE_ROW || $del_lnk == self::KILL_PROCESS) {
         $form_html .= '<form method="post" action="tbl_row_action.php" ' . 'name="resultsForm"' . ' id="resultsForm_' . $this->__get('unique_id') . '"';
         $form_html .= ' class="ajax" ';
         $form_html .= '>' . PMA_URL_getHiddenInputs($this->__get('db'), $this->__get('table'), 1) . '<input type="hidden" name="goto" value="sql.php" />';
     }
     $form_html .= '<table class="table_results data ajax"';
     $form_html .= ' data-uniqueId="' . $this->__get('unique_id') . '"';
     $form_html .= '>';
     return $form_html;
 }
コード例 #26
0
/**
 * Get HTML snippet for display user properties
 *
 * @param boolean $dbname_is_wildcard whether database name is wildcard or not
 * @param string  $url_dbname         url database name that urlencode() string
 * @param string  $username           username
 * @param string  $hostname           host name
 * @param string  $dbname             database name
 * @param string  $tablename          table name
 *
 * @return string $html_output
 */
function PMA_getHtmlForUserProperties($dbname_is_wildcard, $url_dbname, $username, $hostname, $dbname, $tablename)
{
    $html_output = '<div id="edit_user_dialog">';
    $html_output .= PMA_getHtmlHeaderForUserProperties($dbname_is_wildcard, $url_dbname, $dbname, $username, $hostname, $tablename);
    $sql = "SELECT '1' FROM `mysql`.`user`" . " WHERE `User` = '" . PMA_Util::sqlAddSlashes($username) . "'" . " AND `Host` = '" . PMA_Util::sqlAddSlashes($hostname) . "';";
    $user_does_not_exists = (bool) (!$GLOBALS['dbi']->fetchValue($sql));
    if ($user_does_not_exists) {
        $html_output .= PMA_Message::error(__('The selected user was not found in the privilege table.'))->getDisplay();
        $html_output .= PMA_getHtmlForLoginInformationFields();
        //exit;
    }
    $_params = array('username' => $username, 'hostname' => $hostname);
    if (!is_array($dbname) && mb_strlen($dbname)) {
        $_params['dbname'] = $dbname;
        if (mb_strlen($tablename)) {
            $_params['tablename'] = $tablename;
        }
    } else {
        $_params['dbname'] = $dbname;
    }
    $html_output .= '<form class="submenu-item" name="usersForm" ' . 'id="addUsersForm" action="server_privileges.php" method="post">' . "\n";
    $html_output .= PMA_URL_getHiddenInputs($_params);
    $html_output .= PMA_getHtmlToDisplayPrivilegesTable(PMA_ifSetOr($dbname, is_array($dbname) ? $dbname[0] : '*', 'length'), PMA_ifSetOr($tablename, '*', 'length'));
    $html_output .= '</form>' . "\n";
    if (!is_array($dbname) && !mb_strlen($tablename) && empty($dbname_is_wildcard)) {
        // no table name was given, display all table specific rights
        // but only if $dbname contains no wildcards
        $html_output .= '<form class="submenu-item" action="server_privileges.php" ' . 'id="db_or_table_specific_priv" method="post">' . "\n";
        // unescape wildcards in dbname at table level
        $unescaped_db = PMA_Util::unescapeMysqlWildcards($dbname);
        list($html_rightsTable, $found_rows) = PMA_getHtmlForAllTableSpecificRights($username, $hostname, $unescaped_db);
        $html_output .= $html_rightsTable;
        if (!mb_strlen($dbname)) {
            // no database name was given, display select db
            $html_output .= PMA_getHtmlForSelectDbInEditPrivs($found_rows);
        } else {
            $html_output .= PMA_displayTablesInEditPrivs($dbname, $found_rows);
        }
        $html_output .= '</fieldset>' . "\n";
        $html_output .= '<fieldset class="tblFooters">' . "\n" . '    <input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . "\n" . '</form>' . "\n";
    }
    // Provide a line with links to the relevant database and table
    if (!is_array($dbname) && mb_strlen($dbname) && empty($dbname_is_wildcard)) {
        $html_output .= PMA_getLinkToDbAndTable($url_dbname, $dbname, $tablename);
    }
    if (!is_array($dbname) && !mb_strlen($dbname) && !$user_does_not_exists) {
        //change login information
        $html_output .= PMA_getHtmlForChangePassword($username, $hostname);
        $html_output .= PMA_getChangeLoginInformationHtmlForm($username, $hostname);
    }
    $html_output .= '</div>';
    return $html_output;
}
コード例 #27
0
/**
 * Get HTML snippet for partition maintenance
 *
 * @param array $partition_names array of partition names for a specific db/table
 * @param array $url_params      url parameters
 *
 * @return string $html_output
 */
function PMA_getHtmlForPartitionMaintenance($partition_names, $url_params)
{
    $choices = array('ANALYZE' => __('Analyze'), 'CHECK' => __('Check'), 'OPTIMIZE' => __('Optimize'), 'REBUILD' => __('Rebuild'), 'REPAIR' => __('Repair'), 'TRUNCATE' => __('Truncate'));
    $partition_method = Partition::getPartitionMethod($GLOBALS['db'], $GLOBALS['table']);
    // add COALESCE or DROP option to choices array depeding on Partition method
    if ($partition_method == 'RANGE' || $partition_method == 'LIST') {
        $choices['DROP'] = __('Drop');
    } else {
        $choices['COALESCE'] = __('Coalesce');
    }
    $html_output = '<div class="operations_half_width">' . '<form id="partitionsForm" class="ajax" ' . 'method="post" action="tbl_operations.php" >' . PMA_URL_getHiddenInputs($GLOBALS['db'], $GLOBALS['table']) . '<fieldset>' . '<legend>' . __('Partition maintenance') . PMA\libraries\Util::showMySQLDocu('partitioning_maintenance') . '</legend>';
    $html_select = '<select id="partition_name" name="partition_name[]"' . ' multiple="multiple" required="required">' . "\n";
    $first = true;
    foreach ($partition_names as $one_partition) {
        $one_partition = htmlspecialchars($one_partition);
        $html_select .= '<option value="' . $one_partition . '"';
        if ($first) {
            $html_select .= ' selected="selected"';
            $first = false;
        }
        $html_select .= '>' . $one_partition . '</option>' . "\n";
    }
    $html_select .= '</select>' . "\n";
    $html_output .= sprintf(__('Partition %s'), $html_select);
    $html_output .= '<div class="clearfloat" />';
    $html_output .= PMA\libraries\Util::getRadioFields('partition_operation', $choices, 'ANALYZE', false, true, 'floatleft');
    $this_url_params = array_merge($url_params, array('sql_query' => 'ALTER TABLE ' . PMA\libraries\Util::backquote($GLOBALS['table']) . ' REMOVE PARTITIONING;'));
    $html_output .= '<div class="clearfloat" /><br />';
    $html_output .= '<a href="sql.php' . PMA_URL_getCommon($this_url_params) . '">' . __('Remove partitioning') . '</a>';
    $html_output .= '</fieldset>' . '<fieldset class="tblFooters">' . '<input type="hidden" name="submit_partition" value="1">' . '<input type="submit" value="' . __('Go') . '" />' . '</fieldset>' . '</form>' . '</div>';
    return $html_output;
}
コード例 #28
0
require_once 'libraries/mysql_charsets.inc.php';
require_once 'libraries/structure.lib.php';
require_once 'libraries/index.lib.php';
require_once 'libraries/tbl_info.inc.php';
if (!defined('PHPMYADMIN')) {
    exit;
}
/* TABLE INFORMATION */
// table header
$HideStructureActions = '';
if ($GLOBALS['cfg']['HideStructureActions'] === true) {
    $HideStructureActions .= ' HideStructureActions';
}
$html_form = '<form method="post" action="tbl_structure.php" name="fieldsForm" ' . 'id="fieldsForm" class="ajax' . $HideStructureActions . '">';
$response->addHTML($html_form);
$response->addHTML(PMA_URL_getHiddenInputs($db, $table));
$tabletype = '<input type="hidden" name="table_type" value=';
if ($db_is_system_schema) {
    $tabletype .= '"information_schema" />';
} else {
    if ($tbl_is_view) {
        $tabletype .= '"view" />';
    } else {
        $tabletype .= '"table" />';
    }
}
$response->addHTML($tabletype);
$tablestructure = '<table id="tablestructure" class="data topmargin">';
$response->addHTML($tablestructure);
$response->addHTML(PMA_getHtmlForTableStructureHeader($db_is_system_schema, $tbl_is_view));
$response->addHTML('<tbody>');
コード例 #29
0
/**
 * Creates the HTML code that shows the routine execution dialog.
 *
 * @param array $routine Data for the routine returned by
 *                       PMA_RTN_getDataFromName()
 *
 * @return string   HTML code for the routine execution dialog.
 */
function PMA_RTN_getExecuteForm($routine)
{
    global $db, $cfg;
    // Escape special characters
    $routine['item_name'] = htmlentities($routine['item_name'], ENT_QUOTES);
    for ($i = 0; $i < $routine['item_num_params']; $i++) {
        $routine['item_param_name'][$i] = htmlentities($routine['item_param_name'][$i], ENT_QUOTES);
    }
    // Create the output
    $retval = "";
    $retval .= "<!-- START ROUTINE EXECUTE FORM -->\n\n";
    $retval .= "<form action='db_routines.php' method='post'\n";
    $retval .= "       class='rte_form ajax' onsubmit='return false'>\n";
    $retval .= "<input type='hidden' name='item_name'\n";
    $retval .= "       value='{$routine['item_name']}' />\n";
    $retval .= "<input type='hidden' name='item_type'\n";
    $retval .= "       value='{$routine['item_type']}' />\n";
    $retval .= PMA_URL_getHiddenInputs($db) . "\n";
    $retval .= "<fieldset>\n";
    if ($GLOBALS['is_ajax_request'] != true) {
        $retval .= "<legend>{$routine['item_name']}</legend>\n";
        $retval .= "<table class='rte_table'>\n";
        $retval .= "<caption class='tblHeaders'>\n";
        $retval .= __('Routine parameters');
        $retval .= "</caption>\n";
    } else {
        $retval .= "<legend>" . __('Routine parameters') . "</legend>\n";
        $retval .= "<table class='rte_table' style='width: 100%;'>\n";
    }
    $retval .= "<tr>\n";
    $retval .= "<th>" . __('Name') . "</th>\n";
    $retval .= "<th>" . __('Type') . "</th>\n";
    if ($cfg['ShowFunctionFields']) {
        $retval .= "<th>" . __('Function') . "</th>\n";
    }
    $retval .= "<th>" . __('Value') . "</th>\n";
    $retval .= "</tr>\n";
    // Get a list of data types that are not yet supported.
    $no_support_types = PMA\libraries\Util::unsupportedDatatypes();
    for ($i = 0; $i < $routine['item_num_params']; $i++) {
        // Each parameter
        if ($routine['item_type'] == 'PROCEDURE' && $routine['item_param_dir'][$i] == 'OUT') {
            continue;
        }
        $rowclass = $i % 2 == 0 ? 'even' : 'odd';
        $retval .= "\n<tr class='{$rowclass}'>\n";
        $retval .= "<td>{$routine['item_param_name'][$i]}</td>\n";
        $retval .= "<td>{$routine['item_param_type'][$i]}</td>\n";
        if ($cfg['ShowFunctionFields']) {
            $retval .= "<td>\n";
            if (stristr($routine['item_param_type'][$i], 'enum') || stristr($routine['item_param_type'][$i], 'set') || in_array(mb_strtolower($routine['item_param_type'][$i]), $no_support_types)) {
                $retval .= "--\n";
            } else {
                $field = array('True_Type' => mb_strtolower($routine['item_param_type'][$i]), 'Type' => '', 'Key' => '', 'Field' => '', 'Default' => '', 'first_timestamp' => false);
                $retval .= "<select name='funcs[" . $routine['item_param_name'][$i] . "]'>";
                $retval .= PMA\libraries\Util::getFunctionsForField($field, false, array());
                $retval .= "</select>";
            }
            $retval .= "</td>\n";
        }
        // Append a class to date/time fields so that
        // jQuery can attach a datepicker to them
        $class = '';
        if ($routine['item_param_type'][$i] == 'DATETIME' || $routine['item_param_type'][$i] == 'TIMESTAMP') {
            $class = 'datetimefield';
        } else {
            if ($routine['item_param_type'][$i] == 'DATE') {
                $class = 'datefield';
            }
        }
        $retval .= "<td class='nowrap'>\n";
        if (in_array($routine['item_param_type'][$i], array('ENUM', 'SET'))) {
            if ($routine['item_param_type'][$i] == 'ENUM') {
                $input_type = 'radio';
            } else {
                $input_type = 'checkbox';
            }
            foreach ($routine['item_param_length_arr'][$i] as $value) {
                $value = htmlentities(PMA\libraries\Util::unquote($value), ENT_QUOTES);
                $retval .= "<input name='params[" . $routine['item_param_name'][$i] . "][]' " . "value='" . $value . "' type='" . $input_type . "' />" . $value . "<br />\n";
            }
        } else {
            if (in_array(mb_strtolower($routine['item_param_type'][$i]), $no_support_types)) {
                $retval .= "\n";
            } else {
                $retval .= "<input class='{$class}' type='text' name='params[" . $routine['item_param_name'][$i] . "]' />\n";
            }
        }
        $retval .= "</td>\n";
        $retval .= "</tr>\n";
    }
    $retval .= "\n</table>\n";
    if ($GLOBALS['is_ajax_request'] != true) {
        $retval .= "</fieldset>\n\n";
        $retval .= "<fieldset class='tblFooters'>\n";
        $retval .= "    <input type='submit' name='execute_routine'\n";
        $retval .= "           value='" . __('Go') . "' />\n";
        $retval .= "</fieldset>\n";
    } else {
        $retval .= "<input type='hidden' name='execute_routine' value='true' />";
        $retval .= "<input type='hidden' name='ajax_request' value='true' />";
    }
    $retval .= "</form>\n\n";
    $retval .= "<!-- END ROUTINE EXECUTE FORM -->\n\n";
    return $retval;
}
コード例 #30
0
                </div>
                <br />
                <?php 
echo '<input type="submit" name="submit_export" value="', __('Go'), '" />';
?>
            </form>
        </div>
        <div class="group">
            <h2><?php 
echo __('Reset');
?>
</h2>
            <form class="group-cnt prefs-form disableAjax" name="prefs_reset"
                  action="prefs_manage.php" method="post">
                <?php 
echo PMA_URL_getHiddenInputs(), __('You can reset all your settings and restore them to default ' . 'values.');
?>
                <br /><br />
                <input type="submit" name="submit_clear"
                       value="<?php 
echo __('Reset');
?>
"/>
            </form>
        </div>
    </div>
    <br class="clearfloat" />
</div>

<?php 
if ($response->isAjax()) {