3 ** options_identities.php
8 include('../src/validate.php');
9 include('../functions/page_header.php');
10 include('../functions/display_messages.php');
11 include('../src/load_prefs.php');
15 header('Location: options_personal.php');
19 displayPageHeader($color, 'None');
21 $Info = do_hook('options_identities_process', 0);
25 if (CheckAndDoDefault() ||
CheckAndDoPromote()) {
28 if (isset($update) ||
CheckForDelete())
31 LoadInfo($full_name, $email_address, $reply_to, '');
35 <table width
=95% align
=center border
=0 cellpadding
=2 cellspacing
=0>
36 <tr
><td bgcolor
="<?php echo $color[0] ?>" align
="center">
38 <b
><?php
echo _("Options") . ' - ' . _("Advanced Identities"); ?
></b
>
40 <table width
="100%" border
="0" cellpadding
="1" cellspacing
="1">
41 <tr
><td bgcolor
="<?php echo $color[4] ?>" align
="center">
43 <form name
=f action
="options_identities.php" method
=post
><br
>
45 <?PHP
do_hook('options_identities_top'); ?
>
47 <table width
=80% cellpadding
=2 cellspacing
=0 border
=0>
48 <tr bgcolor
="<?PHP echo $color[9] ?>">
49 <th colspan
=2 align
=center
><?PHP
echo _("Default Identity") ?
></th
>
53 ShowTableInfo($full_name, $email_address, $reply_to, '');
56 while (LoadInfo($full_name, $email_address, $reply_to, $num))
59 <tr bgcolor
="<?PHP echo $color[9] ?>">
60 <th colspan
=2 align
=center
><?PHP
printf (_("Alternate Identity %d"),
64 ShowTableInfo($full_name, $email_address, $reply_to, $num);
69 <tr bgcolor
="<?PHP echo $color[9] ?>">
70 <th colspan
=2 align
=center
><?PHP
echo _("Add a New Identity") ?
></th
>
74 ShowTableInfo('', '', '', $num);
88 function SaveUpdateFunction()
90 global $username, $data_dir, $full_name, $email_address, $reply_to;
94 $name = 'form_for_' . $i;
98 $name = 'delete_' . $i;
103 do_hook('options_identities_renumber', $i, $fakeI);
106 $name = 'full_name' . $i;
110 setPref($data_dir, $username, 'full_name' . $fakeI, $
$name);
112 $name = 'email_address' . $i;
116 setPref($data_dir, $username, 'email_address' . $fakeI, $
$name);
118 $name = 'reply_to' . $i;
122 setPref($data_dir, $username, 'reply_to' . $fakeI, $
$name);
130 $name = 'form_for_' . $i;
134 setPref($data_dir, $username, 'identities', $fakeI);
138 removePref($data_dir, $username, 'full_name' . $fakeI);
139 removePref($data_dir, $username, 'email_address' . $fakeI);
140 removePref($data_dir, $username, 'reply_to' . $fakeI);
144 setPref($data_dir, $username, 'full_name', $full_name);
145 setPref($data_dir, $username, 'email_address', $email_address);
146 setPref($data_dir, $username, 'reply_to', $reply_to);
149 function CheckAndDoDefault()
151 global $username, $data_dir, $full_name, $email_address, $reply_to;
154 $name = 'form_for_' . $i;
156 while (isset($
$name))
158 $name = 'make_default_' . $i;
161 do_hook('options_identities_renumber', $i, 'default');
162 global $full_name, $email_address, $reply_to;
164 $name = 'full_name' . $i;
170 $name = 'email_address' . $i;
172 $temp = $email_address;
173 $email_address = $
$name;
176 $name = 'reply_to' . $i;
186 $name = 'form_for_' . $i;
192 function CheckForDelete()
194 global $username, $data_dir, $full_name, $email_address, $reply_to;
197 $name = 'form_for_' . $i;
199 while (isset($
$name))
201 $name = 'delete_' . $i;
208 $name = 'form_for_' . $i;
214 function CheckAndDoPromote()
216 global $username, $data_dir, $full_name, $email_address, $reply_to;
219 $name = 'form_for_' . $i;
221 while (isset($
$name))
223 $name = 'promote_' . $i;
225 if (isset($
$name) && $i > 1) {
226 do_hook('options_identities_renumber', $i, $i - 1);
228 $nameA = 'full_name' . $i;
229 $nameB = 'full_name' . ($i - 1);
230 global $
$nameA, $
$nameB;
235 $nameA = 'email_address' . $i;
236 $nameB = 'email_address' . ($i - 1);
237 global $
$nameA, $
$nameB;
242 $nameA = 'reply_to' . $i;
243 $nameB = 'reply_to' . ($i - 1);
244 global $
$nameA, $
$nameB;
253 $name = 'form_for_' . $i;
259 function LoadInfo(&$n, &$e, &$r, $post)
261 global $username, $data_dir;
263 $n = getPref($data_dir, $username, 'full_name' . $post);
264 $e = getPref($data_dir, $username, 'email_address' . $post);
265 $r = getPref($data_dir, $username, 'reply_to' . $post);
267 if ($n != '' ||
$e != '' ||
$r != '')
271 function ShowTableInfo($full_name, $email_address, $reply_to, $post)
275 $OtherBG = ' bgcolor="' . $color[0] . '"';
276 if ($full_name == '' && $email_address == '' && $reply_to == '')
279 if ($full_name == '' && $email_address == '' && $reply_to == '')
280 $isEmptySection = true;
282 $isEmptySection = false;
285 <tr
<?PHP
echo $OtherBG ?
>>
286 <td align
=right nowrap
>
287 <?php
echo _("Full Name"); ?
>:
290 <input size
=50 type
=text value
="<?php echo htmlspecialchars($full_name)
291 ?>" name
="full_name<?PHP echo $post ?>">
294 <tr
<?PHP
echo $OtherBG ?
>>
295 <td align
=right nowrap
>
296 <?php
echo _("E-Mail Address"); ?
>:
299 <input size
=50 type
=text value
="<?php echo htmlspecialchars($email_address)
300 ?>" name
="email_address<?PHP echo $post ?>">
303 <tr
<?PHP
echo $OtherBG ?
>>
304 <td align
=right nowrap
>
305 <?php
echo _("Reply To"); ?
>:
308 <input size
=50 type
=text value
="<?php echo htmlspecialchars($reply_to)
309 ?>" name
="reply_to<?PHP echo $post ?>">
312 <?PHP
do_hook('options_identities_table', $OtherBG, $isEmptySection, $post); ?
>
313 <tr
<?PHP
echo $OtherBG ?
>>
315 <input type
=hidden name
="form_for_<?PHP echo $post ?>" value
="1">
316 <input type
=submit name
="update" value
="<?PHP echo _("Save
/ Update
") ?>">
318 if (! $isEmptySection && $post != '') {
320 <input type
=submit name
="make_default_<?PHP echo $post ?>" value
="<?PHP
321 echo _("Make
Default") ?>">
322 <input type
=submit name
="delete_<?PHP echo $post ?>" value
="<?PHP echo _("Delete
") ?>">
325 if (! $isEmptySection && $post != '' && $post > 1) {
327 <input type
=submit name
="promote_<?PHP echo $post ?>" value
="<?PHP
328 echo _("Move Up
") ?>">
331 do_hook('options_identities_buttons', $isEmptySection, $post);
336 <td colspan
="2"> 
;</td
>