X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Foptions_identities.php;h=bb9dcaeb194d972a6eaa3e1a0a7b6dd9f5f18c85;hp=5072dee6fa62d8f4e67a666042d920758d8a4068;hb=0bbf8622773554348ff9dc200e7e01411a81be0b;hpb=0f01b5d726463d32e9e521aa4fb03ba27890abc8 diff --git a/src/options_identities.php b/src/options_identities.php index 5072dee6..bb9dcaeb 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -3,29 +3,33 @@ /** * 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-2007 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'); + +/* 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(); @@ -44,8 +48,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; @@ -60,67 +64,67 @@ if (!empty($return)) { exit; } -displayPageHeader($color, 'None'); +displayPageHeader($color); /* since 1.1.3 */ -do_hook('options_identities_top'); +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; +} -$td_str = ''; -$td_str .= '

' . "\n"; -$td_str .= '' . "\n"; -$cnt = count($identities); -foreach( $identities as $key=>$ident ) { +$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; - if ($key == 0) { - $hdr_str = _("Default Identity"); - } else { - $hdr_str = sprintf( _("Alternate Identity %d"), $key); - } +//FIXME: NO HTML IN THE CORE +echo '' . "\n"; - $td_str .= ShowIdentityInfo( $hdr_str, $ident, $key ); +$oTemplate->assign('identities', $i); +$oTemplate->display('options_advidentity_list.tpl'); -} +//FIXME: NO HTML IN THE CORE +echo "\n"; + +$oTemplate->display('footer.tpl'); + +/** + * The functions below should not be needed with the additions of templates, + * however they will remain in case plugins use them. + */ -$td_str .= ShowIdentityInfo( _("Add a New Identity"), array('full_name'=>'','email_address'=>'','reply_to'=>'','signature'=>''), $cnt); -$td_str .= '
' . "\n"; -$td_str .= ''; - -echo '
' . "\n" . - html_tag('table', "\n" . - html_tag('tr', "\n" . - html_tag('td' , "\n" . - '' . _("Options") . ' - ' . _("Advanced Identities") . '
' . - html_tag('table', "\n" . - html_tag('tr', "\n" . - html_tag('td', "\n" . - html_tag('table' , "\n" . - html_tag('tr' , "\n" . - html_tag('td', "\n" . $td_str ,'','', 'style="text-align:center;"') - ), - '', '', 'width="80%" cellpadding="2" cellspacing="0" border="0"' ) , - 'center', $color[4]) - ), - '', '', 'width="100%" border="0" cellpadding="1" cellspacing="1"' )) , - 'center', $color[0]), - 'center', '', 'width="95%" border="0" cellpadding="2" cellspacing="0"' ) . ''; - /** * Returns html formated identity form fields - * + * * Contains options_identities_buttons and option_identities_table hooks. - * Before 1.4.5/1.5.1 hooks were placed in ShowTableInfo() function. - * In 1.1.3-1.4.1 they were called in do_hook function with two or + * Before 1.4.5/1.5.1 hooks were placed in ShowTableInfo() function. + * In 1.1.3-1.4.1 they were called in do_hook function with two or * three arguments. Since 1.4.1 hooks are called in concat_hook_function. * Arguments are moved to array. * * options_identities_buttons hook uses array with two keys. First array key is - * boolean variable used to indicate empty identity field. Second array key + * boolean variable used to indicate empty identity field. Second array key * is integer variable used to indicate identity number * * options_identities_table hook uses array with three keys. First array key is - * a string containing background color style CSS (1.4.1-1.4.4/1.5.0 uses only - * html color code). Second array key is boolean variable used to indicate empty - * identity field. Third array key is integer variable used to indicate identity + * a string containing background color style CSS (1.4.1-1.4.4/1.5.0 uses only + * html color code). Second array key is boolean variable used to indicate empty + * identity field. Third array key is integer variable used to indicate identity * number * @param string $title Name displayed in header row * @param array $identity Identity information @@ -144,6 +148,7 @@ function ShowIdentityInfo($title, $identity, $id ) { $return_str = ''; +//FIXME: NO HTML IN THE CORE $return_str .= '' . "\n"; $return_str .= ' ' . $title . ' '. "\n"; $return_str .= '' . "\n"; @@ -151,7 +156,8 @@ function ShowIdentityInfo($title, $identity, $id ) { $return_str .= sti_input( _("E-Mail Address") , sprintf($name, $id, 'email_address'), $identity['email_address'], $bg); $return_str .= sti_input( _("Reply To"), sprintf($name, $id, 'reply_to'), $identity['reply_to'], $bg); $return_str .= sti_textarea( _("Signature"), sprintf($name, $id, 'signature'), $identity['signature'], $bg); - $return_str .= concat_hook_function('options_identities_table', array($bg, $empty, $id)); + $temp = array(&$bg, &$empty, &$id); + $return_str .= concat_hook_function('options_identities_table', $temp); $return_str .= ' ' . "\n"; $return_str .= '   ' . "\n"; $return_str .= ' ' . "\n"; @@ -167,7 +173,8 @@ function ShowIdentityInfo($title, $identity, $id ) { } - $return_str .= concat_hook_function('options_identities_buttons', array($empty, $id)); + $temp = array(&$empty, &$id); + $return_str .= concat_hook_function('options_identities_buttons', $temp); $return_str .= ' ' . "\n"; $return_str .= '' . "\n"; $return_str .= '' . "\n"; @@ -190,12 +197,13 @@ function ShowIdentityInfo($title, $identity, $id ) { * @access private */ function sti_input( $title, $name, $data, $bgcolor ) { +//FIXME: NO HTML IN THE CORE $str = ''; $str .= '\n"; $str .= ' ' . $title . ' ' . "\n"; - $str .= ' ' . "\n"; + $str .= ' ' . "\n"; $str .= ''; - + return $str; } @@ -212,14 +220,14 @@ function sti_input( $title, $name, $data, $bgcolor ) { * @access private */ function sti_textarea( $title, $name, $data, $bgcolor ) { +//FIXME: NO HTML IN THE CORE $str = ''; $str .= '\n"; $str .= ' ' . $title . ' ' . "\n"; $str .= ' ' . "\n"; $str .= ''; - + return $str; } -?> \ No newline at end of file