3 ** options_identities.php
8 require_once('../src/validate.php');
9 require_once('../functions/display_messages.php');
13 header('Location: options_personal.php');
17 displayPageHeader($color, 'None');
19 $Info = do_hook('options_identities_process', 0);
23 if (CheckAndDoDefault() ||
CheckAndDoPromote()) {
26 if (isset($update) ||
CheckForDelete())
29 LoadInfo($full_name, $email_address, $reply_to, '');
33 <table width
=95% align
=center border
=0 cellpadding
=2 cellspacing
=0>
34 <tr
><td bgcolor
="<?php echo $color[0] ?>" align
="center">
36 <b
><?php
echo _("Options") . ' - ' . _("Advanced Identities"); ?
></b
>
38 <table width
="100%" border
="0" cellpadding
="1" cellspacing
="1">
39 <tr
><td bgcolor
="<?php echo $color[4] ?>" align
="center">
41 <form name
=f action
="options_identities.php" method
=post
><br
>
43 <?PHP
do_hook('options_identities_top'); ?
>
45 <table width
=80% cellpadding
=2 cellspacing
=0 border
=0>
46 <tr bgcolor
="<?PHP echo $color[9] ?>">
47 <th colspan
=2 align
=center
><?PHP
echo _("Default Identity") ?
></th
>
51 ShowTableInfo($full_name, $email_address, $reply_to, '');
54 while (LoadInfo($full_name, $email_address, $reply_to, $num))
57 <tr bgcolor
="<?PHP echo $color[9] ?>">
58 <th colspan
=2 align
=center
><?PHP
printf (_("Alternate Identity %d"),
62 ShowTableInfo($full_name, $email_address, $reply_to, $num);
67 <tr bgcolor
="<?PHP echo $color[9] ?>">
68 <th colspan
=2 align
=center
><?PHP
echo _("Add a New Identity") ?
></th
>
72 ShowTableInfo('', '', '', $num);
86 function SaveUpdateFunction()
88 global $username, $data_dir, $full_name, $email_address, $reply_to;
92 $name = 'form_for_' . $i;
96 $name = 'delete_' . $i;
101 do_hook('options_identities_renumber', $i, $fakeI);
104 $name = 'full_name' . $i;
108 setPref($data_dir, $username, 'full_name' . $fakeI, $
$name);
110 $name = 'email_address' . $i;
114 setPref($data_dir, $username, 'email_address' . $fakeI, $
$name);
116 $name = 'reply_to' . $i;
120 setPref($data_dir, $username, 'reply_to' . $fakeI, $
$name);
128 $name = 'form_for_' . $i;
132 setPref($data_dir, $username, 'identities', $fakeI);
136 removePref($data_dir, $username, 'full_name' . $fakeI);
137 removePref($data_dir, $username, 'email_address' . $fakeI);
138 removePref($data_dir, $username, 'reply_to' . $fakeI);
142 setPref($data_dir, $username, 'full_name', $full_name);
143 setPref($data_dir, $username, 'email_address', $email_address);
144 setPref($data_dir, $username, 'reply_to', $reply_to);
147 function CheckAndDoDefault()
149 global $username, $data_dir, $full_name, $email_address, $reply_to;
152 $name = 'form_for_' . $i;
154 while (isset($
$name))
156 $name = 'make_default_' . $i;
159 do_hook('options_identities_renumber', $i, 'default');
160 global $full_name, $email_address, $reply_to;
162 $name = 'full_name' . $i;
168 $name = 'email_address' . $i;
170 $temp = $email_address;
171 $email_address = $
$name;
174 $name = 'reply_to' . $i;
184 $name = 'form_for_' . $i;
190 function CheckForDelete()
192 global $username, $data_dir, $full_name, $email_address, $reply_to;
195 $name = 'form_for_' . $i;
197 while (isset($
$name))
199 $name = 'delete_' . $i;
206 $name = 'form_for_' . $i;
212 function CheckAndDoPromote()
214 global $username, $data_dir, $full_name, $email_address, $reply_to;
217 $name = 'form_for_' . $i;
219 while (isset($
$name))
221 $name = 'promote_' . $i;
223 if (isset($
$name) && $i > 1) {
224 do_hook('options_identities_renumber', $i, $i - 1);
226 $nameA = 'full_name' . $i;
227 $nameB = 'full_name' . ($i - 1);
228 global $
$nameA, $
$nameB;
233 $nameA = 'email_address' . $i;
234 $nameB = 'email_address' . ($i - 1);
235 global $
$nameA, $
$nameB;
240 $nameA = 'reply_to' . $i;
241 $nameB = 'reply_to' . ($i - 1);
242 global $
$nameA, $
$nameB;
251 $name = 'form_for_' . $i;
257 function LoadInfo(&$n, &$e, &$r, $post)
259 global $username, $data_dir;
261 $n = getPref($data_dir, $username, 'full_name' . $post);
262 $e = getPref($data_dir, $username, 'email_address' . $post);
263 $r = getPref($data_dir, $username, 'reply_to' . $post);
265 if ($n != '' ||
$e != '' ||
$r != '')
269 function ShowTableInfo($full_name, $email_address, $reply_to, $post)
273 $OtherBG = ' bgcolor="' . $color[0] . '"';
274 if ($full_name == '' && $email_address == '' && $reply_to == '')
277 if ($full_name == '' && $email_address == '' && $reply_to == '')
278 $isEmptySection = true;
280 $isEmptySection = false;
283 <tr
<?PHP
echo $OtherBG ?
>>
284 <td align
=right nowrap
>
285 <?php
echo _("Full Name"); ?
>:
288 <input size
=50 type
=text value
="<?php echo htmlspecialchars($full_name)
289 ?>" name
="full_name<?PHP echo $post ?>">
292 <tr
<?PHP
echo $OtherBG ?
>>
293 <td align
=right nowrap
>
294 <?php
echo _("E-Mail Address"); ?
>:
297 <input size
=50 type
=text value
="<?php echo htmlspecialchars($email_address)
298 ?>" name
="email_address<?PHP echo $post ?>">
301 <tr
<?PHP
echo $OtherBG ?
>>
302 <td align
=right nowrap
>
303 <?php
echo _("Reply To"); ?
>:
306 <input size
=50 type
=text value
="<?php echo htmlspecialchars($reply_to)
307 ?>" name
="reply_to<?PHP echo $post ?>">
310 <?PHP
do_hook('options_identities_table', $OtherBG, $isEmptySection, $post); ?
>
311 <tr
<?PHP
echo $OtherBG ?
>>
313 <input type
=hidden name
="form_for_<?PHP echo $post ?>" value
="1">
314 <input type
=submit name
="update" value
="<?PHP echo _("Save
/ Update
") ?>">
316 if (! $isEmptySection && $post != '') {
318 <input type
=submit name
="make_default_<?PHP echo $post ?>" value
="<?PHP
319 echo _("Make
Default") ?>">
320 <input type
=submit name
="delete_<?PHP echo $post ?>" value
="<?PHP echo _("Delete
") ?>">
323 if (! $isEmptySection && $post != '' && $post > 1) {
325 <input type
=submit name
="promote_<?PHP echo $post ?>" value
="<?PHP
326 echo _("Move Up
") ?>">
329 do_hook('options_identities_buttons', $isEmptySection, $post);
334 <td colspan
="2"> 
;</td
>