File: prefs.php3

package info (click to toggle)
imp 3%3A2.2.6-5.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,476 kB
  • ctags: 766
  • sloc: php: 4,253; sh: 831; makefile: 98; perl: 50; pascal: 15
file content (138 lines) | stat: -rw-r--r-- 4,444 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php

/*
 
 File: prefs.php3
 $Author: bjn $
 $Revision: 2.10.2.20 $
 $Date: 2001/07/05 21:32:48 $
 
 IMP: Copyright 1999, 2000 Charles J. Hagenbuch <chuck@horde.org>
 
 You should have received a copy of the GNU Public
 License along with this package; if not, write to the
 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.
 
 */

$need_horde_db = 1;
require '../lib/horde.lib';
require './lib/imp.lib';              /* IMPlib is the IMP function library  */
require './config/defaults.php3';     /* Defaults configuration file */
require './config/lang.php3';

/* Html styles configuration */
require '../config/html.php3';
require './config/html.php3';

$language = select_lang();
require './lib/postconf.php3';

require "./locale/$language/prefs.lang";
require './locale/local/prefs.lang';
require './config/lang.php3';

error_reporting($default->error_level);  /* set error level from imp.lib   */

/* Adjust the form element sizes for the appropriate screen size */
if ($_html['screen_size'] == 'small') {
  $_html['smresize'] = 0.7;
  $_html['bgresize'] = 0.5;
} else if ($_html['screen_size'] == 'large') {
  $_html['smresize'] = 1;
  $_html['bgresize'] = 1;
}
$_html['compose_headers_size'] = $_html['compose_headers_size'] * $_html['smresize'];
$_html['compose_attach_size'] = $_html['compose_attach_size'] * $_html['smresize'];
$_html['compose_body_cols'] = $_html['compose_body_cols'] * $_html['smresize'];
$_html['compose_body_rows'] = $_html['compose_body_rows'] * $_html['bgresize'];

/* retrieve authentication information from session */
page_open(array('sess' => 'HordeSession'));
page_close();
if (!isset($imp) || !is_object($imp)) { header('Location: ' . $sess->url('login.php3?reason=logout')); exit; }
$imp->unpickle();


$errormsg = '';
$include_refresh = false;
/* Run through the action handlers */
if (isset($actionID)) {
	switch($actionID) {
	case NO_ACTION:
		break;
    
	case UPDATE_PREFS:
		$updated = true;
		if (isset($signature) && ($signature != $old_signature)) {
			if (!(imp_set_signature(addslashes($signature), $imp->user, $imp->server))) {
				$errormsg .= $lang->signature_error;
				$updated = false;
			}
		}
    
		if (isset($new_lang) && ($new_lang != $old_lang) && valid_lang($new_lang, '')) {
			if (!(imp_set_lang($new_lang, $imp->user, $imp->server))) {
				$errormsg .= $lang->language_error;
			}
			$imp->setLang($new_lang);
			$language = $new_lang;
			include "./locale/$language/prefs.lang";
			include './config/lang.php3';
			$include_refresh = true;
		}
    
		if (isset($from) && ($from != $old_from)) {
			// email address cannot contain: <space> , ' "
			// email address must contain: exactly one @
			if (preg_match("/[\\s,'\"]/", $from) ||
					($from && !preg_match("/^[^@]+@[^@]+$/", $from))) {
				$errormsg .= $lang->from_error;
				$updated = false;
			} elseif (!(imp_set_from($from, $imp->user, $imp->server))) {
				$errormsg .= $lang->from_error;
				$updated = false;
			}
		}
    
		if (isset($fullname) && ($fullname != $old_fullname)) {
			// filter for existing quotes
			if (substr($fullname, 0, 1) == '"' && substr($fullname, -1) == '"') {
				$fullname = substr($fullname, 1, -1);
			}
			// filter for illegal characters
			$quoted = imap_rfc822_write_address('', '', $fullname);
			$quoted = substr($quoted, 0, strlen($quoted)-4);
			if (!(imp_set_fullname(addslashes($quoted), $imp->user, $imp->server))) {
				$errormsg .= $lang->fullname_error;
				$updated = false;
			}
		}
		break;
	}
}

$langs = '<select name="new_lang">';
while (list($key, $val) = each($lang->lang)) {
	if ($key == $language) $sel = ' SELECTED';
	else $sel = '';
	$langs .= "<option value=\"$key\"$sel>$val</option>\n";
}
$langs .= '</select>';

$title = $lang->prefs_title;
$sidebar = false;

require "$default->include_dir/doctype.inc";
if ($include_refresh) include "$default->include_dir/mailbox/refresh_toolbar-javascript.inc";
require "$default->include_dir/generic-header.inc";
require "$default->include_dir/prefs/begin.inc";
require "$default->include_dir/prefs/signature.inc";
if ($default->user_change_fullname) include "$default->include_dir/prefs/fullname.inc";
if ($default->user_change_from) include "$default->include_dir/prefs/from.inc";
if ($default->user_change_language) include "$default->include_dir/prefs/lang.inc";
require "$default->include_dir/prefs/end.inc";
require "$default->include_dir/generic-footer.inc";

?>