-/*****************************************************************/
-/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
-/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
-/*** + Base level indent should begin at left margin, as ***/
-/*** the require_once below looks. ***/
-/*** + All identation should consist of four space blocks ***/
-/*** + Tab characters are evil. ***/
-/*** + all comments should use "slash-star ... star-slash" ***/
-/*** style -- no pound characters, no slash-slash style ***/
-/*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
-/*** ALWAYS USE { AND } CHARACTERS!!! ***/
-/*** + Please use ' instead of ", when possible. Note " ***/
-/*** should always be used in _( ) function calls. ***/
-/*** Thank you for your help making the SM code more readable. ***/
-/*****************************************************************/
-
-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;
- }
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
+define('SM_PATH','../');
+
+/* SquirrelMail required files. */
+require_once(SM_PATH . 'include/validate.php');
+include_once(SM_PATH . 'functions/global.php');
+include_once(SM_PATH . 'functions/display_messages.php');
+include_once(SM_PATH . 'functions/html.php');
+include_once(SM_PATH . 'functions/identity.php');
+
+if (!sqgetGlobalVar('identities', $identities, SQ_SESSION)) {
+ $identities = get_identities();
+}
+sqgetGlobalVar('newidentities', $newidentities, SQ_POST);
+sqgetGlobalVar('smaction', $smaction, SQ_POST);
+sqgetGlobalVar('return', $return, SQ_POST);
+
+// First lets see if there are any actions to perform //
+if (!empty($smaction) && is_array($smaction)) {
+
+ $doaction = '';
+ $identid = 0;