isSupported() публичный статический Метод

Checks whether there is any charset conversion supported
public static isSupported ( ) : boolean
Результат boolean
Пример #1
0
/**
 * Prints Html For Export Options
 *
 * @param String $export_type Selected Export Type
 *
 * @return string
 */
function PMA_getHtmlForExportOptionsOutput($export_type)
{
    global $cfg;
    $html = '<div class="exportoptions" id="output">';
    $html .= '<h3>' . __('Output:') . '</h3>';
    $html .= '<ul id="ul_output">';
    $html .= '<li><input type="checkbox" id="btn_alias_config" ';
    if (isset($_SESSION['tmpval']['aliases']) && !PMA_emptyRecursive($_SESSION['tmpval']['aliases'])) {
        $html .= 'checked="checked"';
    }
    unset($_SESSION['tmpval']['aliases']);
    $html .= '/>';
    $html .= '<label for="btn_alias_config">';
    $html .= __('Rename exported databases/tables/columns');
    $html .= '</label></li>';
    if ($export_type != 'server') {
        $html .= '<li>';
        $html .= '<input type="checkbox" name="lock_tables"';
        $html .= ' value="something" id="checkbox_lock_tables"';
        if (!isset($_GET['repopulate'])) {
            $html .= PMA_exportCheckboxCheck('lock_tables') . '/>';
        } elseif (isset($_GET['lock_tables'])) {
            $html .= ' checked="checked"';
        }
        $html .= '<label for="checkbox_lock_tables">';
        $html .= sprintf(__('Use %s statement'), '<code>LOCK TABLES</code>');
        $html .= '</label></li>';
    }
    $html .= '<li>';
    $html .= '<input type="radio" name="output_format" value="sendit" ';
    $html .= 'id="radio_dump_asfile" ';
    if (!isset($_GET['repopulate'])) {
        $html .= PMA_exportCheckboxCheck('asfile');
    }
    $html .= '/>';
    $html .= '<label for="radio_dump_asfile">' . __('Save output to a file') . '</label>';
    $html .= '<ul id="ul_save_asfile">';
    if (isset($cfg['SaveDir']) && !empty($cfg['SaveDir'])) {
        $html .= PMA_getHtmlForExportOptionsOutputSaveDir();
    }
    $html .= PMA_getHtmlForExportOptionsOutputFormat($export_type);
    // charset of file
    if (Encoding::isSupported()) {
        $html .= PMA_getHtmlForExportOptionsOutputCharset();
    }
    // end if
    $html .= PMA_getHtmlForExportOptionsOutputCompression();
    if ($export_type == 'server' || $export_type == 'database') {
        $html .= PMA_getHtmlForExportOptionsOutputSeparateFiles($export_type);
    }
    $html .= '</ul>';
    $html .= '</li>';
    $html .= PMA_getHtmlForExportOptionsOutputRadio();
    $html .= '</ul>';
    /*
     * @todo use sprintf() for better translatability, while keeping the
     *       <label></label> principle (for screen readers)
     */
    $html .= '<label for="maxsize">' . __('Skip tables larger than') . '</label>';
    $html .= '<input type="text" id="maxsize" name="maxsize" size="4">' . __('MiB');
    $html .= '</div>';
    return $html;
}
Пример #2
0
    }
    // use isset() because zip compression type does not use a handle
    if (!$error && isset($import_handle) && $import_handle === false) {
        $message = PMA\libraries\Message::error(__('File could not be read!'));
        PMA_stopImport($message);
    }
} elseif (!$error) {
    if (!isset($import_text) || empty($import_text)) {
        $message = PMA\libraries\Message::error(__('No data was received to import. Either no file name was ' . 'submitted, or the file size exceeded the maximum size permitted ' . 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].'));
        PMA_stopImport($message);
    }
}
// so we can obtain the message
//$_SESSION['Import_message'] = $message->getDisplay();
// Convert the file's charset if necessary
if (Encoding::isSupported() && isset($charset_of_file)) {
    if ($charset_of_file != 'utf-8') {
        $charset_conversion = true;
    }
} elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
    $GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
    // We can not show query in this case, it is in different charset
    $sql_query_disabled = true;
    $reset_charset = true;
}
// Something to skip? (because timeout has passed)
if (!$error && isset($_POST['skip'])) {
    $original_skip = $skip = $_POST['skip'];
    while ($skip > 0) {
        PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit);
        // Disable read progressivity, otherwise we eat all memory!
Пример #3
0
 $dump_buffer = '';
 $dump_buffer_len = 0;
 // Array of dump_buffers - used in separate file exports
 $dump_buffer_objects = array();
 // We send fake headers to avoid browser timeout when buffering
 $time_start = time();
 // Defines the default <CR><LF> format.
 // For SQL always use \n as MySQL wants this on all platforms.
 if ($what == 'sql') {
     $crlf = "\n";
 } else {
     $crlf = PMA\libraries\Util::whichCrlf();
 }
 $output_kanji_conversion = Encoding::canConvertKanji() && $type != 'xls';
 // Do we need to convert charset?
 $output_charset_conversion = $asfile && Encoding::isSupported() && isset($charset) && $charset != 'utf-8' && $type != 'xls';
 // Use on the fly compression?
 $GLOBALS['onfly_compression'] = $GLOBALS['cfg']['CompressOnFly'] && $compression == 'gzip';
 if ($GLOBALS['onfly_compression']) {
     $GLOBALS['memory_limit'] = PMA_getMemoryLimitForExport();
 }
 // Generate filename and mime type if needed
 if ($asfile) {
     if (empty($remember_template)) {
         $remember_template = '';
     }
     list($filename, $mime_type) = PMA_getExportFilenameAndMimetype($export_type, $remember_template, $export_plugin, $compression, $filename_template);
 } else {
     $mime_type = '';
 }
 // Open file on server if needed
Пример #4
0
/**
 * Prints Html For Display Import charset
 *
 * @return string
 */
function PMA_getHtmlForImportCharset()
{
    global $cfg;
    $html = '       <div class="formelementrow" id="charaset_of_file">';
    // charset of file
    if (Encoding::isSupported()) {
        $html .= '<label for="charset_of_file">' . __('Character set of the file:') . '</label>';
        $html .= '<select id="charset_of_file" name="charset_of_file" size="1">';
        foreach ($cfg['AvailableCharsets'] as $temp_charset) {
            $html .= '<option value="' . htmlentities($temp_charset) . '"';
            if (empty($cfg['Import']['charset']) && $temp_charset == 'utf-8' || $temp_charset == $cfg['Import']['charset']) {
                $html .= ' selected="selected"';
            }
            $html .= '>' . htmlentities($temp_charset) . '</option>';
        }
        $html .= ' </select><br />';
    } else {
        $html .= '<label for="charset_of_file">' . __('Character set of the file:') . '</label>' . "\n";
        $html .= Charsets::getCharsetDropdownBox('charset_of_file', 'charset_of_file', 'utf8', false);
    }
    // end if (recoding)
    $html .= '        </div>';
    return $html;
}