X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Ftranslate%2Fsetup.php;h=60ca8e1559b26551b13802cb0c72c6ad38b5c766;hb=b4df37a525c34a317d5f6ff10baa518f75448703;hp=0a79c35160c871cd5a5ad454a9f2ad678e35f189;hpb=cbe5423b30fd1c50b7dd9546778cbebf48804953;p=squirrelmail.git diff --git a/plugins/translate/setup.php b/plugins/translate/setup.php index 0a79c351..60ca8e15 100644 --- a/plugins/translate/setup.php +++ b/plugins/translate/setup.php @@ -1,525 +1,89 @@ 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 - ); + include_once(SM_PATH . 'plugins/translate/functions.php'); + translate_optpage_function(); } -function translate_sav() { - global $username,$data_dir; - global $submit_translate, $translate_translate_server; - global $translate_translate_location; - global $translate_translate_show_read; - global $translate_translate_show_send; - global $translate_translate_same_window; - - if ($submit_translate) { - if (isset($translate_translate_server)) { - setPref($data_dir, $username, 'translate_server', $translate_translate_server); - } else { - setPref($data_dir, $username, 'translate_server', 'babelfish'); - } - - if (isset($translate_translate_location)) { - setPref($data_dir, $username, 'translate_location', $translate_translate_location); - } else { - setPref($data_dir, $username, 'translate_location', 'center'); - } - - if (isset($translate_translate_show_read)) { - setPref($data_dir, $username, 'translate_show_read', '1'); - } else { - setPref($data_dir, $username, 'translate_show_read', ''); - } - - if (isset($translate_translate_show_send)) { - setPref($data_dir, $username, 'translate_show_send', '1'); - } else { - setPref($data_dir, $username, 'translate_show_send', ''); - } - - if (isset($translate_translate_same_window)) { - setPref($data_dir, $username, 'translate_same_window', '1'); - } else { - setPref($data_dir, $username, 'translate_same_window', ''); - } - - echo '
Translation options saved.
'; - } -} - - -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. + * Calls user's translation preferences function + * @access private */ -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_pref() { + include_once(SM_PATH . 'plugins/translate/functions.php'); + translate_pref_function(); } - -function translate_lang_opt($from, $to, $value, $text) { - global $translate_dir; - - $ret = '