Replace calls to htmlspecialchars() with sm_encode_html_special_chars().
[squirrelmail.git] / plugins / squirrelspell / modules / lang_change.mod
1 <?php
2
3 /**
4 * lang_change.mod
5 *
6 * Squirrelspell module
7 *
8 * This module changes the international dictionaries selection
9 * for the user. Called after LANG_SETUP module.
10 *
11 * @author Konstantin Riabitsev <icon at duke.edu>
12 * @copyright 1999-2012 The SquirrelMail Project Team
13 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 * @version $Id$
15 * @package plugins
16 * @subpackage squirrelspell
17 */
18
19 sqgetGlobalVar('smtoken', $submitted_token, SQ_POST, '');
20 sm_validate_security_token($submitted_token, 3600, TRUE);
21
22 global $SQSPELL_APP_DEFAULT;
23
24 if (! sqgetGlobalVar('use_langs',$use_langs,SQ_POST)) {
25 $use_langs = array($SQSPELL_APP_DEFAULT);
26 }
27
28 if (! sqgetGlobalVar('lang_default',$lang_default,SQ_POST)) {
29 $lang_default = $SQSPELL_APP_DEFAULT;
30 }
31
32 /**
33 * Rebuild languages. Default language is first one.
34 */
35 $new_langs = array($lang_default);
36 foreach ($use_langs as $lang) {
37 if (! in_array($lang,$new_langs)) {
38 $new_langs[]=$lang;
39 }
40 }
41
42 if (sizeof($new_langs)>1) {
43 $dsp_string = '';
44 foreach( $new_langs as $a) {
45 $dsp_string .= _(sm_encode_html_special_chars(trim($a))) . _(", ");
46 }
47 // remove last comma and space
48 $dsp_string = substr( $dsp_string, 0, -2 );
49
50 // i18n: first %s is comma separated list of languages, second %s - default language.
51 // Language names are translated, if they are present in squirrelmail.po file.
52 // make sure that you don't use html codes in language name translations
53 $msg = '<p>'
54 . sprintf(_("Settings adjusted to: %s with %s as default dictionary."),
55 '<strong>'.sm_encode_html_special_chars($dsp_string).'</strong>',
56 '<strong>'.sm_encode_html_special_chars(_($lang_default)).'</strong>')
57 . '</p>';
58 } else {
59 /**
60 * Only one dictionary is selected.
61 */
62 $msg = '<p>'
63 . sprintf(_("Using %s dictionary for spellcheck." ), '<strong>'.sm_encode_html_special_chars(_($new_langs[0])).'</strong>')
64 . '</p>';
65 }
66
67 /** save settings */
68 sqspell_saveSettings($new_langs);
69
70 sqspell_makePage(_("International Dictionaries Preferences Updated"),
71 null, $msg);
72
73 /**
74 * For Emacs weenies:
75 * Local variables:
76 * mode: php
77 * End:
78 * vim: syntax=php
79 */