X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fidentity.php;h=322485e0589c9e599e81975a6bfc85d96c3ff552;hb=716cc530b6c5c50ffb64db64b804b40677458e1d;hp=62bcf3b5fb8f7cae0aebbd626f1c56fd1e6c8207;hpb=0392886daf87383f403266a0e01185fa69699a03;p=squirrelmail.git diff --git a/functions/identity.php b/functions/identity.php index 62bcf3b5..322485e0 100644 --- a/functions/identity.php +++ b/functions/identity.php @@ -3,24 +3,15 @@ /** * identity.php * - * Copyright (c) 1999-2005 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * This contains utility functions for dealing with multiple identities * + * @copyright © 1999-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail * @since 1.4.2 */ -/** @ignore - * Used to simplify includes */ -if (!defined('SM_PATH')) { - define('SM_PATH','../'); -} - -/** preference and signature functions */ -include_once(SM_PATH . 'include/load_prefs.php'); /** * Returns an array of all the identities. @@ -79,7 +70,7 @@ function save_identities($identities) { $num_cur = getPref($data_dir, $username, 'identities'); - + $cnt = count($identities); // Remove any additional identities in prefs // @@ -141,6 +132,10 @@ function sqfixidentities( $identities, $id, $action ) { if ($key == $id) { $fixed[0] = $ident; + + // inform plugins about renumbering of ids + do_hook('options_identities_renumber', $temp=array(&$id, 'default')); + continue 2; } else { $fixed[$i+1] = $ident; @@ -151,6 +146,10 @@ function sqfixidentities( $identities, $id, $action ) { if ($key == ($id - 1)) { $tmp_hold = $ident; + + // inform plugins about renumbering of ids + do_hook('options_identities_renumber', $temp=array(&$id , $id - 1)); + continue 2; } else { $fixed[$i] = $ident; @@ -165,14 +164,25 @@ function sqfixidentities( $identities, $id, $action ) { case 'delete': if ($key == $id) { + // inform plugins about deleted id + do_hook('options_identities_process', $temp=array(&$action, &$id)); + continue 2; } else { $fixed[$i] = $ident; } break; - // we should never hit this but just in case // + // Process actions from plugins and save/update action // default: + /** + * send action and id information. number of hook arguments + * differs from 1.4.4 or older and 1.5.0. count($args) can + * be used to detect modified hook. Older hook does not + * provide information that can be useful for plugins. + */ + do_hook('options_identities_process', $temp=array(&$action, &$id)); + $fixed[$i] = $ident; } @@ -200,5 +210,3 @@ function empty_identity($ident) { return false; } } - -?> \ No newline at end of file