Ejemplo n.º 1
0
                $message = $strFileCouldNotBeRead;
            }
        }
        // Convert the file's charset if necessary
        if ($cfg['AllowAnywhereRecoding'] && $allow_recoding && isset($charset_of_file) && $charset_of_file != $charset) {
            $sql_query = PMA_convert_string($charset_of_file, $charset, $sql_query);
        }
    }
    // end uploaded file stuff
}
// Kanji convert SQL textfile 2002/1/4 by Y.Kawada
if (@function_exists('PMA_kanji_str_conv')) {
    $sql_tmp = trim($sql_query);
    PMA_change_enc_order();
    $sql_query = PMA_kanji_str_conv($sql_tmp, $knjenc, isset($xkana) ? $xkana : '');
    PMA_change_enc_order();
} else {
    $sql_query = trim($sql_query);
}
// $sql_query come from the query textarea, if it's a reposted query gets its
// 'true' value
if (!empty($prev_sql_query)) {
    $prev_sql_query = urldecode($prev_sql_query);
    if ($sql_query == trim(htmlspecialchars($prev_sql_query))) {
        $sql_query = $prev_sql_query;
    }
}
// Drop database is not allowed -> ensure the query can be run
if (!$cfg['AllowUserDropDatabase'] && preg_match('@DROP[[:space:]]+(IF EXISTS[[:space:]]+)?DATABASE @i', $sql_query)) {
    // Checks if the user is a Superuser
    // TODO: set a global variable with this information
Ejemplo n.º 2
0
/**
 * Kanji file encoding convert
 * 2002/1/4 by Y.Kawada
 *
 * @param   string   the name of the file to convert
 * @param   string   the destinasion encoding code
 * @param   string   set 'kana' convert to JIS-X208-kana
 *
 * @return  string   the name of the converted file
 */
function PMA_kanji_file_conv($file, $enc, $kana)
{
    if ($enc == '' && $kana == '') {
        return $file;
    }
    $tmpfname = tempnam('', $enc);
    $fpd = fopen($tmpfname, 'wb');
    $fps = fopen($file, 'r');
    PMA_change_enc_order();
    while (!feof($fps)) {
        $line = fgets($fps, 4096);
        $dist = PMA_kanji_str_conv($line, $enc, $kana);
        fputs($fpd, $dist);
    }
    // end while
    PMA_change_enc_order();
    fclose($fps);
    fclose($fpd);
    unlink($file);
    return $tmpfname;
}