Download this as a file ');
if (is_int($pos)) {
$new_body = substr($new_body, 0, $pos);
}
$trans = get_html_translation_table('HTMLENTITIES');
$trans[' '] = ' ';
$trans = array_flip($trans);
$new_body = strtr($new_body, $trans);
$new_body = urldecode($new_body);
$new_body = strip_tags($new_body);
/* I really don't like this next part ... */
$new_body = str_replace('"', "''", $new_body);
$new_body = strtr($new_body, "\n", ' ');
$function = 'translate_form_' . $translate_server;
$function($new_body);
}
function translate_table_end() {
?>
_("Translation Options"),
'url' => '../plugins/translate/options.php',
'desc' => _("Which translator should be used when you get messages in a different language?"),
'js' => false
);
}
function translate_pref() {
global $username, $data_dir;
global $translate_server, $translate_location;
global $translate_show_send, $translate_show_read;
global $translate_same_window;
$translate_server = getPref($data_dir, $username, 'translate_server');
if ($translate_server == '') {
$translate_server = 'babelfish';
}
$translate_location = getPref($data_dir, $username, 'translate_location');
if ($translate_location == '') {
$translate_location = 'center';
}
$translate_show_send = getPref($data_dir, $username, 'translate_show_send');
$translate_show_read = getPref($data_dir, $username, 'translate_show_read');
$translate_same_window = getPref($data_dir, $username, 'translate_same_window');
}
/**
* This function could be sped up.
* It basically negates the process if a ! is found in the beginning and
* matches a * at the end with 0 or more characters.
*/
function translate_does_it_match_language($test) {
global $squirrelmail_language;
$true = 1;
$false = 0;
$index = 0;
$smindex = 0;
if (! $test || ! $squirrelmail_language) {
return $false;
}
if ($test[$index] == '!') {
$index ++;
$true = 0;
$false = 1;
}
if (($index == 0) && ($test == $squirrelmail_language)) {
return $true;
}
while ($test[$index]) {
if ($test[$index] == '*') {
return $true;
}
if ($test[$index] != $squirrelmail_language[$smindex]) {
return $false;
}
$index ++;
$smindex ++;
}
return $false;
}
function translate_lang_opt($from, $to, $value, $text) {
global $translate_dir;
$ret = '