- /**
- ** options_identities.php
- **
- ** $Id$
- **/
-
- require_once('../src/validate.php');
- require_once('../functions/display_messages.php');
-
- if (isset($return)) {
- SaveUpdateFunction();
- header('Location: options_personal.php');
- exit();
- }
-
- displayPageHeader($color, 'None');
-
- $Info = do_hook('options_identities_process', 0);
- if ($Info[1])
- SaveUpdateFunction();
-
- if (CheckAndDoDefault() || CheckAndDoPromote()) {
- SaveUpdateFunction();
- }
- if (isset($update) || CheckForDelete())
- SaveUpdateFunction();
-
- LoadInfo($full_name, $email_address, $reply_to, '');
-
-?>
-<br>
-<table width=95% align=center border=0 cellpadding=2 cellspacing=0>
-<tr><td bgcolor="<?php echo $color[0] ?>" align="center">
-
- <b><?php echo _("Options") . ' - ' . _("Advanced Identities"); ?></b>
-
- <table width="100%" border="0" cellpadding="1" cellspacing="1">
- <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
-
-<form name=f action="options_identities.php" method=post><br>
-
-<?PHP do_hook('options_identities_top'); ?>
-
-<table width=80% cellpadding=2 cellspacing=0 border=0>
- <tr bgcolor="<?PHP echo $color[9] ?>">
- <th colspan=2 align=center><?PHP echo _("Default Identity") ?></th>
- </tr>
-<?PHP
-
- ShowTableInfo($full_name, $email_address, $reply_to, '');
-
- $num = 1;
- while (LoadInfo($full_name, $email_address, $reply_to, $num))
- {
-?>
- <tr bgcolor="<?PHP echo $color[9] ?>">
- <th colspan=2 align=center><?PHP printf (_("Alternate Identity %d"),
- $num) ?></th>
- </tr>
-<?PHP
- ShowTableInfo($full_name, $email_address, $reply_to, $num);
- $num ++;
- }
-
-?>
- <tr bgcolor="<?PHP echo $color[9] ?>">
- <th colspan=2 align=center><?PHP echo _("Add a New Identity") ?></th>
- </tr>
-<?
-
- ShowTableInfo('', '', '', $num);
-?>
-</table>
-</form>
-
- </td></tr>
- </table>
-
-</td></tr>
-</table>
-</body></html>
-
-<?PHP
-
-function SaveUpdateFunction()
-{
- global $username, $data_dir, $full_name, $email_address, $reply_to;
-
- $i = 1;
- $fakeI = 1;
- $name = 'form_for_' . $i;
- global $$name;
- while (isset($$name))
- {
- $name = 'delete_' . $i;
- global $$name;
- if (isset($$name)) {
- $fakeI --;
- } else {
- do_hook('options_identities_renumber', $i, $fakeI);
- $filled = 0;
-
- $name = 'full_name' . $i;
- global $$name;
- if ($$name != '')
- $filled ++;
- setPref($data_dir, $username, 'full_name' . $fakeI, $$name);
-
- $name = 'email_address' . $i;
- global $$name;
- if ($$name != '')
- $filled ++;
- setPref($data_dir, $username, 'email_address' . $fakeI, $$name);
-
- $name = 'reply_to' . $i;
- global $$name;
- if ($$name != '')
- $filled ++;
- setPref($data_dir, $username, 'reply_to' . $fakeI, $$name);
-
- if ($filled == 0)
- $fakeI --;
- }
-
- $fakeI ++;
- $i ++;
- $name = 'form_for_' . $i;
- global $$name;
- }
-
- setPref($data_dir, $username, 'identities', $fakeI);
-
- while ($fakeI != $i)
- {
- removePref($data_dir, $username, 'full_name' . $fakeI);
- removePref($data_dir, $username, 'email_address' . $fakeI);
- removePref($data_dir, $username, 'reply_to' . $fakeI);
- $fakeI ++;
- }
-
- setPref($data_dir, $username, 'full_name', $full_name);
- setPref($data_dir, $username, 'email_address', $email_address);
- setPref($data_dir, $username, 'reply_to', $reply_to);
+
+/**
+ * options_identities.php
+ *
+ * Display Identities Options
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage prefs
+ * @since 1.1.3
+ */
+
+/**
+ * Include the SquirrelMail initialization file.
+ */
+require('../include/init.php');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'functions/identity.php');
+
+/* make sure that page is not available when $edit_identity is false */
+if (!$edit_identity) {
+ error_box(_("Editing identities is disabled."));
+ $oTemplate->display('footer.tpl');
+ die();
+}
+
+if (!sqgetGlobalVar('identities', $identities, SQ_SESSION)) {
+ $identities = get_identities();