/**
  * @dataProvider dataProvider
  * @return void
  */
 function test_generateHiddenMaxFileSize($size)
 {
     $this->assertEquals(
         PMA_Util::generateHiddenMaxFileSize($size),
         '<input type="hidden" name="MAX_FILE_SIZE" value="' . $size . '" />'
     );
 }
/**
 * return HTML for Sql Query Form Upload
 *
 * @return string
 *
 * @usedby  PMA_getHtmlForSqlQueryForm()
 */
function PMA_getHtmlForSqlQueryFormUpload()
{
    global $timeout_passed, $local_import_file;
    $errors = array();
    // we allow only SQL here
    $matcher = '@\\.sql(\\.(' . PMA_supportedDecompressions() . '))?$@';
    if (!empty($GLOBALS['cfg']['UploadDir'])) {
        $files = PMA_getFileSelectOptions(PMA_Util::userDir($GLOBALS['cfg']['UploadDir']), $matcher, isset($timeout_passed) && $timeout_passed && isset($local_import_file) ? $local_import_file : '');
    } else {
        $files = '';
    }
    // start output
    $html = '<fieldset id="">';
    $html .= '<legend>';
    $html .= __('Browse your computer:') . '</legend>';
    $html .= '<div class="formelement">';
    $html .= '<input type="file" name="sql_file" class="textfield" /> ';
    $html .= PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']);
    // some browsers should respect this :)
    $html .= PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
    $html .= '</div>';
    if ($files === false) {
        $errors[] = PMA_Message::error(__('The directory you set for upload work cannot be reached.'));
    } elseif (!empty($files)) {
        $html .= '<div class="formelement">';
        $html .= '<strong>' . __('web server upload directory:') . '</strong>';
        $html .= '<select size="1" name="sql_localfile">' . "\n";
        $html .= '<option value="" selected="selected"></option>' . "\n";
        $html .= $files;
        $html .= '</select>' . "\n";
        $html .= '</div>';
    }
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>';
    $html .= '<fieldset id="" class="tblFooters">';
    $html .= __('Character set of the file:') . "\n";
    $html .= PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false);
    $html .= '<input type="submit" name="SQL" value="' . __('Go') . '" />' . "\n";
    $html .= '<div class="clearfloat"></div>' . "\n";
    $html .= '</fieldset>';
    foreach ($errors as $error) {
        $html .= $error->getDisplay();
    }
    return $html;
}
 /**
  * Test for PMA_getHtmlForSqlQueryFormUpload
  *
  * @return void
  */
 public function testPMAGetHtmlForSqlQueryFormUpload()
 {
     //Call the test function
     $html = PMA_getHtmlForSqlQueryFormUpload();
     //validate 1: Browse your computer
     $this->assertContains(__('Browse your computer:'), $html);
     //validate 2: $GLOBALS['max_upload_size']
     $this->assertContains(PMA_Util::getFormattedMaximumUploadSize($GLOBALS['max_upload_size']), $html);
     $this->assertContains(PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']), $html);
     //validate 3: Dropdown Box
     $this->assertContains(PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false), $html);
 }
Beispiel #4
0
?>
<script type="text/javascript">
<?php 
PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@'));
?>
</script>
<div id="maincontainer">
    <div id="main_pane_left">
        <div class="group">
            <h2><?php 
echo __('Import');
?>
</h2>
            <form class="group-cnt prefs-form disableAjax" name="prefs_import" action="prefs_manage.php" method="post" enctype="multipart/form-data">
                <?php 
echo PMA_Util::generateHiddenMaxFileSize($max_upload_size) . "\n";
echo PMA_generate_common_hidden_inputs() . "\n";
?>
                <input type="hidden" name="json" value="" />
                <input type="radio" id="import_text_file" name="import_type" value="text_file" checked="checked" />
                <label for="import_text_file"><?php 
echo __('Import from file');
?>
</label>
                <div id="opts_import_text_file" class="prefsmanage_opts">
                    <label for="input_import_file"><?php 
echo __('Browse your computer:');
?>
</label>
                    <input type="file" name="import_file" id="input_import_file" />
                </div>
    if (!$error instanceof PMA_Message) {
        $error = PMA_Message::error($error);
    }
    $error->display();
}
?>
<script type="text/javascript">
<?php 
PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@'));
?>
</script>
<div id="maincontainer">
    <div id="main_pane_left">
        <div class="group">
<?php 
echo '<h2>' . __('Import') . '</h2>' . '<form class="group-cnt prefs-form disableAjax" name="prefs_import"' . ' action="prefs_manage.php" method="post" enctype="multipart/form-data">' . PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . PMA_URL_getHiddenInputs() . '<input type="hidden" name="json" value="" />' . '<input type="radio" id="import_text_file" name="import_type"' . ' value="text_file" checked="checked" />' . '<label for="import_text_file">' . __('Import from file') . '</label>' . '<div id="opts_import_text_file" class="prefsmanage_opts">' . '<label for="input_import_file">' . __('Browse your computer:') . '</label>' . '<input type="file" name="import_file" id="input_import_file" />' . '</div>' . '<input type="radio" id="import_local_storage" name="import_type"' . ' value="local_storage" disabled="disabled" />' . '<label for="import_local_storage">' . __('Import from browser\'s storage') . '</label>' . '<div id="opts_import_local_storage" class="prefsmanage_opts disabled">' . '<div class="localStorage-supported">' . __('Settings will be imported from your browser\'s local storage.') . '<br />' . '<div class="localStorage-exists">' . __('Saved on: @DATE@') . '</div>' . '<div class="localStorage-empty">';
PMA_Message::notice(__('You have no saved settings!'))->display();
echo '</div>' . '</div>' . '<div class="localStorage-unsupported">';
PMA_Message::notice(__('This feature is not supported by your web browser'))->display();
echo '</div>' . '</div>' . '<input type="checkbox" id="import_merge" name="import_merge" />' . '<label for="import_merge">' . __('Merge with current configuration') . '</label>' . '<br /><br />' . '<input type="submit" name="submit_import" value="' . __('Go') . '" />' . '</form>' . '</div>';
if (file_exists('setup/index.php')) {
    // show only if setup script is available, allows to disable this message
    // by simply removing setup directory
    ?>
            <div class="group">
            <h2><?php 
    echo __('More settings');
    ?>
</h2>
            <div class="group-cnt">
                <?php 
    $current_result = isset($result) && is_array($result) && isset($result[$row_id]) ? $result[$row_id] : $result;
    $repopulate = array();
    $checked = true;
    if (isset($unsaved_values[$row_id])) {
        $repopulate = $unsaved_values[$row_id];
        $checked = false;
    }
    if ($insert_mode && $row_id > 0) {
        $html_output .= PMA_getHtmlForIgnoreOption($row_id, $checked);
    }
    $html_output .= PMA_getHtmlForInsertEditRow($url_params, $table_columns, $column, $comments_map, $timestamp_seen, $current_result, $chg_evt_handler, $jsvkey, $vkey, $insert_mode, $current_row, $o_rows, $tabindex, $columns_cnt, $is_upload, $tabindex_for_function, $foreigners, $tabindex_for_null, $tabindex_for_value, $table, $db, $row_id, $titles, $biggest_max_file_size, $text_dir, $repopulate, $where_clause_array);
}
// end foreach on multi-edit
$scripts->addFiles($GLOBALS['plugin_scripts']);
unset($unsaved_values, $checked, $repopulate, $GLOBALS['plugin_scripts']);
$html_output .= PMA_getHtmlForGisEditor();
if (!isset($after_insert)) {
    $after_insert = 'back';
}
//action panel
$html_output .= PMA_getActionsPanel($where_clause, $after_insert, $tabindex, $tabindex_for_value, $found_unique_key);
if ($biggest_max_file_size > 0) {
    $html_output .= '        ' . PMA_Util::generateHiddenMaxFileSize($biggest_max_file_size) . "\n";
}
$html_output .= '</form>';
// end Insert/Edit form
if ($insert_mode) {
    //Continue insertion form
    $html_output .= PMA_getContinueInsertionForm($table, $db, $where_clause_array, $err_url);
}
$response->addHTML($html_output);
Beispiel #7
0
?>
<script type="text/javascript">
<?php 
PMA_printJsValue("PMA_messages['strSavedOn']", __('Saved on: @DATE@'));
?>
</script>
<div id="maincontainer">
    <div id="main_pane_left">
        <div class="group">
            <h2><?php 
echo __('Import');
?>
</h2>
            <form class="group-cnt prefs-form disableAjax" name="prefs_import" action="prefs_manage.php" method="post" enctype="multipart/form-data">
                <?php 
echo PMA_Util::generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n";
echo PMA_URL_getHiddenInputs() . "\n";
?>
                <input type="hidden" name="json" value="" />
                <input type="radio" id="import_text_file" name="import_type" value="text_file" checked="checked" />
                <label for="import_text_file"><?php 
echo __('Import from file');
?>
</label>
                <div id="opts_import_text_file" class="prefsmanage_opts">
                    <label for="input_import_file"><?php 
echo __('Browse your computer:');
?>
</label>
                    <input type="file" name="import_file" id="input_import_file" />
                </div>
Beispiel #8
0
    . '<br />';

if (! isset($after_insert)) {
    $after_insert = 'back';
}

//action panel
$html_output .= PMA_getActionsPanel(
    $where_clause, $after_insert, $tabindex,
    $tabindex_for_value, $found_unique_key
);

if ($biggest_max_file_size > 0) {
    $html_output .= '        '
        . PMA_Util::generateHiddenMaxFileSize(
            $biggest_max_file_size
        ) . "\n";
}
$html_output .= '</form>';
// end Insert/Edit form

if ($insert_mode) {
    //Continue insertion form
    $html_output .= PMA_getContinueInsertionForm(
        $table, $db, $where_clause_array, $err_url
    );
}
$response->addHTML($html_output);

?>