X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Foptions_identities.php;h=22eee613e9db7f82560b88df94e973d2ff89f7d8;hp=bad3b3aff208019718482dd85854b0328c711d4e;hb=f2785d1147920588b40e8a34e3c980697e08748f;hpb=1d80c108a1d741b7dcb562ea1cf6d2214322b192 diff --git a/src/options_identities.php b/src/options_identities.php index bad3b3af..22eee613 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -3,353 +3,237 @@ /** * options_identities.php * - * Copyright (c) 1999-2003 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * Display Identities Options * - * $Id$ + * @copyright 1999-2016 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 */ -/** Path for SquirrelMail required files. */ -define('SM_PATH','../'); +/** This is the options_identities page */ +define('PAGE_NAME', 'options_identities'); + +/** + * Include the SquirrelMail initialization file. + */ +require('../include/init.php'); /* SquirrelMail required files. */ -require_once(SM_PATH . 'include/validate.php'); -require_once(SM_PATH . 'functions/global.php'); -require_once(SM_PATH . 'functions/display_messages.php'); -require_once(SM_PATH . 'functions/html.php'); - -/* POST data var names are dynamic because - of the possible multiple idents so lets get - them all - FIXME! This circumvents the benefits of rg=0 -*/ -if (!empty($_POST)) { - extract($_POST); +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(); } -/* got 'em all */ - if (isset($return)) { - SaveUpdateFunction(); - header('Location: '.get_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(); - } - - do_hook('options_identities_top'); - LoadInfo($full_name, $email_address, $reply_to, $signature, ''); - $td_str = ''; - $td_str .= '
\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. + */ + +/** + * Returns html formated identity form fields + * + * Contains options_identities_buttons and options_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 + * 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 + * 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 + * number + * @param string $title Name displayed in header row + * @param array $identity Identity information + * @param integer $id identity ID + * @return string html formatted table rows with form fields for identity management + * @since 1.5.1 and 1.4.5 (was called ShowTableInfo() in 1.1.3-1.4.4 and 1.5.0) + */ +function ShowIdentityInfo($title, $identity, $id ) { + global $color; + + if (empty($identity['full_name']) && empty($identity['email_address']) && empty($identity['reply_to']) && empty($identity['signature'])) { + $bg = ''; + $empty = true; + } else { + $bg = ' style="background-color:' . $color[0] . ';"'; + $empty = false; } - function LoadInfo(&$n, &$e, &$r, &$s, $post) { - global $username, $data_dir; + $name = 'newidentities[%d][%s]'; + - $n = getPref($data_dir, $username, 'full_name' . $post); - $e = getPref($data_dir, $username, 'email_address' . $post); - $r = getPref($data_dir, $username, 'reply_to' . $post); - if ($post == '') - $post = 'g'; - $s = getSig($data_dir,$username,$post); + $return_str = ''; + +//FIXME: NO HTML IN THE CORE + $return_str .= '