X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Foptions_identities.php;h=013ec3602cee077dd5e2e6e4aa5952e88fa04111;hp=55bda3aca98b17728129022643bbf32aa735b36c;hb=55e346263751f3100c780b2d3aee268b6fa3232d;hpb=f963297696e534d98fdba65bc46c805040bbc198 diff --git a/src/options_identities.php b/src/options_identities.php index 55bda3ac..013ec360 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -3,28 +3,34 @@ /** * options_identities.php * - * Copyright (c) 1999-2005 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Display Identities Options * + * @copyright 1999-2011 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 */ +/** This is the options_identities page */ +define('PAGE_NAME', 'options_identities'); + /** - * Path for SquirrelMail required files. - * @ignore + * Include the SquirrelMail initialization file. */ -define('SM_PATH','../'); +require('../include/init.php'); /* 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'); +require_once(SM_PATH . 'functions/identity.php'); +require_once(SM_PATH . 'functions/forms.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(); @@ -32,10 +38,14 @@ if (!sqgetGlobalVar('identities', $identities, SQ_SESSION)) { sqgetGlobalVar('newidentities', $newidentities, SQ_POST); sqgetGlobalVar('smaction', $smaction, SQ_POST); sqgetGlobalVar('return', $return, SQ_POST); +sqgetGlobalVar('smtoken', $submitted_token, SQ_POST, ''); // First lets see if there are any actions to perform // if (!empty($smaction) && is_array($smaction)) { + // first do a security check + sm_validate_security_token($submitted_token, 3600, TRUE); + $doaction = ''; $identid = 0; @@ -43,8 +53,8 @@ if (!empty($smaction) && is_array($smaction)) { // we only need to extract the action and the identity we are // altering - foreach($row as $key=>$data) { - $identid = $key; + foreach($row as $iKey=>$data) { + $identid = $iKey; } $doaction = $action; @@ -59,50 +69,75 @@ if (!empty($return)) { exit; } -displayPageHeader($color, 'None'); +displayPageHeader($color); + +/* since 1.1.3 */ +do_hook('options_identities_top', $null); + +$i = array(); +foreach ($identities as $key=>$ident) { + $a = array(); + $a['Title'] = $key==0 ? _("Default Identity") : sprintf(_("Alternate Identity %d"), $key); + $a['New'] = false; + $a['Default'] = $key==0; + $a['FullName'] = htmlspecialchars($ident['full_name']); + $a['Email'] = htmlspecialchars($ident['email_address']); + $a['ReplyTo'] = htmlspecialchars($ident['reply_to']); + $a['Signature'] = htmlspecialchars($ident['signature']); + $i[$key] = $a; +} -do_hook('options_identities_top'); +$a = array(); +$a['Title'] = _("Add New Identity"); +$a['New'] = true; +$a['Default'] = false; +$a['FullName'] = ''; +$a['Email'] = ''; +$a['ReplyTo'] = ''; +$a['Signature'] = ''; +$i[count($i)] = $a; -$td_str = ''; -$td_str .= '
'; - -echo '