예제 #1
0
    echo '</tr>' . "\n";
    echo '</tbody>' . "\n" . '</table>' . "\n";
    unset($column_order, $stat_name, $stat, $databases, $table_columns);
    if ($is_superuser || $cfg['AllowUserDropDatabase']) {
        $common_url_query = PMA_generate_common_url() . '&amp;sort_by=' . $sort_by . '&amp;sort_order=' . $sort_order . '&amp;dbstats=' . $dbstats;
        echo '<img class="selectallarrow" src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" width="38" height="22" alt="' . $strWithChecked . '" />' . "\n" . '<a href="./server_databases.php?' . $common_url_query . '&amp;checkall=1" onclick="if (markAllRows(\'tabledatabases\')) return false;">' . "\n" . '    ' . $strCheckAll . '</a> / ' . "\n" . '<a href="./server_databases.php?' . $common_url_query . '" onclick="if (unMarkAllRows(\'tabledatabases\')) return false;">' . "\n" . '    ' . $strUncheckAll . '</a>' . "\n" . '<i>' . $strWithChecked . '</i>' . "\n";
        PMA_buttonOrImage('drop_selected_dbs', 'mult_submit', 'drop_selected_dbs', $strDrop, 'b_deltbl.png');
    }
    echo '<ul><li id="li_switch_dbstats"><strong>' . "\n";
    if (empty($dbstats)) {
        echo '        <a href="./server_databases.php?' . $url_query . '&amp;dbstats=1"' . ' title="' . $strDatabasesStatsEnable . '">' . "\n" . '            ' . $strDatabasesStatsEnable;
    } else {
        echo '        <a href="./server_databases.php?' . $url_query . '"' . ' title="' . $strDatabasesStatsDisable . '">' . "\n" . '            ' . $strDatabasesStatsDisable;
    }
    echo '</a></strong><br />' . "\n";
    PMA_Message::warning('strDatabasesStatsHeavyTraffic')->display();
    echo '</li>' . "\n" . '</ul>' . "\n";
    echo '</form>';
} else {
    echo $strNoDatabases;
}
unset($databases_count);
/**
 * Create new database.
 */
if ($cfg['ShowCreateDb']) {
    echo '<ul><li id="li_create_database">' . "\n";
    require './libraries/display_create_database.lib.php';
    echo '    </li>' . "\n";
    echo '</ul>' . "\n";
}
예제 #2
0
if (isset($_REQUEST['submit_sql']) && ! empty($sql_query)) {
    $goto      = 'db_sql.php';
    $zero_rows = htmlspecialchars($GLOBALS['strSuccess']);
    require './sql.php';
    exit;
} else {
    $sub_part  = '_qbe';
    require './libraries/db_common.inc.php';
    $url_query .= '&amp;goto=db_qbe.php';
    $url_params['goto'] = 'db_qbe.php';
    require './libraries/db_info.inc.php';
}

if (isset($_REQUEST['submit_sql'])
 && ! preg_match('@^SELECT@i', $sql_query)) {
    PMA_Message::warning('strHaveToShow')->display();
}


/**
 * Initialize some variables
 */
$col_cnt = PMA_ifSetOr($_REQUEST['col_cnt'], 3, 'numeric');
$add_col = PMA_ifSetOr($_REQUEST['add_col'], 0, 'numeric');
$add_row = PMA_ifSetOr($_REQUEST['add_row'], 0, 'numeric');

$rows    = PMA_ifSetOr($_REQUEST['rows'],    0, 'numeric');
$ins_col = PMA_ifSetOr($_REQUEST['ins_col'], null, 'array');
$del_col = PMA_ifSetOr($_REQUEST['del_col'], null, 'array');

$prev_criteria = isset($_REQUEST['prev_criteria'])
<input type="text" name="index[Key_name]" id="input_index_name" size="25"
    value="<?php echo htmlspecialchars($index->getName()); ?>" onfocus="this.select()" />
</div>

<div class="formelement">
<label for="select_index_type"><?php echo $strIndexType; ?></label>
<select name="index[Index_type]" id="select_index_type" onchange="return checkIndexName()">
    <?php echo $index->generateIndexSelector(); ?>
</select>
<?php echo PMA_showMySQLDocu('SQL-Syntax', 'ALTER_TABLE'); ?>
</div>


<br class="clearfloat" />
<?php
PMA_Message::warning('strPrimaryKeyWarning')->display();
?>

<table>
<thead>
<tr><th><?php echo $strField; ?></th>
    <th><?php echo $strSize; ?></th>
</tr>
</thead>
<tbody>
<?php
$odd_row = true;
foreach ($index->getColumns() as $column) {
    ?>
<tr class="<?php echo $odd_row ? 'odd' : 'even'; ?>">
    <td><select name="index[columns][names][]">
         $sql_query .= ';';
         $display_query .= $sql_query . "\n";
     }
     // end if... else....
     if (!empty($sql_query)) {
         PMA_DBI_try_query($sql_query);
         $tmp_error = PMA_DBI_getError();
         if (!empty($tmp_error)) {
             $seen_error = true;
         }
         if (substr($tmp_error, 1, 4) == '1216' || substr($tmp_error, 1, 4) == '1452') {
             PMA_mysqlDie($tmp_error, $sql_query, FALSE, '', FALSE);
             echo PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
         }
         if (substr($tmp_error, 1, 4) == '1005') {
             $message = PMA_Message::warning('strForeignKeyError');
             $message->addParam($master_field);
             $message->display();
             echo PMA_showMySQLDocu('manual_Table_types', 'InnoDB_foreign_key_constraints') . "\n";
         }
         unset($tmp_error);
         $sql_query = '';
     }
 }
 // end foreach
 if (!empty($display_query)) {
     if ($seen_error) {
         PMA_showMessage($strError, null, 'error');
     } else {
         PMA_showMessage($strSuccess, null, 'success');
     }
    ?>
        <div class="formelementrow">
        <label for="input_import_file"><?php 
    echo $strLocationTextfile;
    ?>
</label>
        <input style="margin: 5px" type="file" name="import_file" id="input_import_file" onchange="match_file(this.value);" />
    <?php 
    echo PMA_displayMaximumUploadSize($max_upload_size) . "\n";
    // some browsers should respect this :)
    echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
    ?>
        </div>
    <?php 
} else {
    PMA_Message::warning('strUploadsNotAllowed')->display();
}
if (!empty($cfg['UploadDir'])) {
    $extensions = '';
    foreach ($import_list as $key => $val) {
        if (!empty($extensions)) {
            $extensions .= '|';
        }
        $extensions .= $val['extension'];
    }
    $matcher = '@\\.(' . $extensions . ')(\\.(' . PMA_supportedDecompressions() . '))?$@';
    $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, isset($timeout_passed) && $timeout_passed && isset($local_import_file) ? $local_import_file : '');
    echo '<div class="formelementrow">' . "\n";
    if ($files === FALSE) {
        PMA_Message::error('strWebServerUploadDirectoryError')->display();
    } elseif (!empty($files)) {
예제 #6
0
     echo ' - ' . ($dbname_is_wildcard ? $GLOBALS['strDatabases'] : $GLOBALS['strDatabase']);
     if (isset($tablename)) {
         echo ' <i><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&amp;username='******'&amp;hostname=' . htmlspecialchars(urlencode($hostname)) . '&amp;dbname=' . htmlspecialchars($url_dbname) . '&amp;tablename=">' . htmlspecialchars($dbname) . '</a></i>';
         echo ' - ' . $GLOBALS['strTable'] . ' <i>' . htmlspecialchars($tablename) . '</i>';
     } else {
         echo ' <i>' . htmlspecialchars($dbname) . '</i>';
     }
 } else {
     echo ' <i>\'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</i>' . "\n";
 }
 echo '</h2>' . "\n";
 $sql = "SELECT '1' FROM `mysql`.`user`" . " WHERE `User` = '" . PMA_sqlAddslashes($username) . "'" . " AND `Host` = '" . PMA_sqlAddslashes($hostname) . "';";
 $user_does_not_exists = (bool) (!PMA_DBI_fetch_value($sql));
 unset($sql);
 if ($user_does_not_exists) {
     PMA_Message::warning('strUserNotFound')->display();
     PMA_displayLoginInformationFields();
     //require_once './libraries/footer.inc.php';
 }
 echo '<form name="usersForm" id="usersForm" action="server_privileges.php" method="post">' . "\n";
 $_params = array('username' => $username, 'hostname' => $hostname);
 if (isset($dbname)) {
     $_params['dbname'] = $dbname;
     if (isset($tablename)) {
         $_params['tablename'] = $tablename;
     }
 }
 echo PMA_generate_common_hidden_inputs($_params);
 PMA_displayPrivTable(PMA_ifSetOr($dbname, '*', 'length'), PMA_ifSetOr($tablename, '*', 'length'));
 echo '</form>' . "\n";
 if (!isset($tablename) && empty($dbname_is_wildcard)) {
    /**
     * Function to check over array of indexes and look for common problems
     *
     * @uses    $GLOBALS['strIndexesSeemEqual']
     * @uses    is_string()
     * @uses    is_array()
     * @uses    count()
     * @uses    array_pop()
     * @uses    reset()
     * @uses    current()
     * @access  public
     * @param   string      name of table
     * @return  string      Output HTML
     */
    static public function findDuplicates($table, $schema)
    {
        $indexes = PMA_Index::getFromTable($table, $schema);

        $output  = '';

        // count($indexes) < 2:
        //   there is no need to check if there less than two indexes
        if (count($indexes) < 2) {
            return $output;
        }

        // remove last index from stack and ...
        while ($while_index = array_pop($indexes)) {
            // ... compare with every remaining index in stack
            foreach ($indexes as $each_index) {
                if ($each_index->getCompareData() !== $while_index->getCompareData()) {
                    continue;
                }

                // did not find any difference
                // so it makes no sense to have this two equal indexes

                $message = PMA_Message::warning('strIndexesSeemEqual');
                $message->addParam($each_index->getName());
                $message->addParam($while_index->getName());
                $output .= $message->getDisplay();

                // there is no need to check any further indexes if we have already
                // found that this one has a duplicate
                continue 2;
            }
        }
        return $output;
    }
예제 #8
0
         echo '  </form>';
         echo ' </div>';
     }
     echo ' <li><a href="#" id="slave_control_href">' . $GLOBALS['strReplicationControlSlave'] . '</a>';
     echo ' <div id="slave_control_gui" style="display: none">';
     echo '  <ul>';
     echo '   <li><a href="' . $slave_control_full_link . '">' . ($server_slave_replication[0]['Slave_IO_Running'] == 'No' || $server_slave_replication[0]['Slave_SQL_Running'] == 'No' ? $GLOBALS['strFullStart'] : $GLOBALS['strFullStop']) . ' </a></li>';
     echo '   <li><a href="' . $slave_control_reset_link . '">' . $GLOBALS['strReplicationSlaveReset'] . '</a></li>';
     echo '   <li><a href="' . $slave_control_sql_link . '">' . sprintf($GLOBALS['strReplicationSlaveSQLThread'], $server_slave_replication[0]['Slave_SQL_Running'] == 'No' ? $GLOBALS['strStart'] : $GLOBALS['strStop']) . '</a></li>';
     echo '   <li><a href="' . $slave_control_io_link . '">' . sprintf($GLOBALS['strReplicationSlaveIOThread'], $server_slave_replication[0]['Slave_IO_Running'] == 'No' ? $GLOBALS['strStart'] : $GLOBALS['strStop']) . '</a></li>';
     echo '  </ul>';
     echo ' </div>';
     echo ' </li>';
     echo ' <li><a href="#" id="slave_errormanagement_href">' . $GLOBALS['strReplicationSlaveErrorManagement'] . '</a>';
     echo ' <div id="slave_errormanagement_gui" style="display: none">';
     PMA_Message::warning($GLOBALS['strReplicationSkippingErrorWarn'])->display();
     echo '  <ul>';
     echo '   <li><a href="' . $slave_skip_error_link . '">' . $GLOBALS['strReplicationSlaveSkipCurrentError'] . '</a></li>';
     echo '   <li>' . $GLOBALS['strReplicationSlaveSkipNext'];
     echo '    <form method="post" action="server_replication.php">';
     echo PMA_generate_common_hidden_inputs('', '');
     echo '      <input type="text" name="sr_skip_errors_count" value="1" style="width: 30px" />' . $GLOBALS['strReplicationSlaveSkipNextErrors'];
     echo '              <input type="submit" name="sr_slave_skip_error" value="' . $GLOBALS['strGo'] . '" />';
     echo '      <input type="hidden" name="sr_take_action" value="1" />';
     echo '    </form></li>';
     echo '  </ul>';
     echo ' </div>';
     echo ' </li>';
     echo ' <li><a href="' . $reconfiguremaster_link . '">' . $GLOBALS['strReplicationSlaveChangeMaster'] . '</a></li>';
     echo '</ul>';
 } elseif (!isset($GLOBALS['sl_configure'])) {