X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Foptions_identities.php;h=51eebb73c1400a4d4b5ba1435d38be124bbfff0c;hp=92152a29ff22f7e4811e2d5e78922c0a1be5fe3e;hb=e38807da7cc331846514027ebc62b9c0456b1ada;hpb=e7db48afbf9565737173583af6962520d2491acc diff --git a/src/options_identities.php b/src/options_identities.php index 92152a29..51eebb73 100644 --- a/src/options_identities.php +++ b/src/options_identities.php @@ -1,14 +1,34 @@ - + @@ -85,255 +105,226 @@ 1) { - do_hook('options_identities_renumber', $i, $i - 1); - - $nameA = 'full_name' . $i; - $nameB = 'full_name' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; - - $nameA = 'email_address' . $i; - $nameB = 'email_address' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; - - $nameA = 'reply_to' . $i; - $nameB = 'reply_to' . ($i - 1); - global $$nameA, $$nameB; - $temp = $$nameA; - $$nameA = $$nameB; - $$nameB = $temp; - - return true; - } - - $i ++; - $name = 'form_for_' . $i; - global $$name; - } - return false; -} + $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; + } + + setPref($data_dir, $username, 'identities', $fakeI); + + while ($fakeI != $i) + { + removePref($data_dir, $username, 'full_name' . $fakeI); + removePref($data_dir, $username, 'email_address' . $fakeI); + removePref($data_dir, $username, 'reply_to' . $fakeI); + $fakeI ++; + } + + setPref($data_dir, $username, 'full_name', $full_name); + setPref($data_dir, $username, 'email_address', $email_address); + setPref($data_dir, $username, 'reply_to', $reply_to); + } + + function CheckAndDoDefault() { + global $username, $data_dir, $full_name, $email_address, $reply_to; + + $i = 1; + $name = 'form_for_' . $i; + global $$name; + while (isset($$name)) + { + $name = 'make_default_' . $i; + global $$name; + if (isset($$name)) { + do_hook('options_identities_renumber', $i, 'default'); + global $full_name, $email_address, $reply_to; + + $name = 'full_name' . $i; + global $$name; + $temp = $full_name; + $full_name = $$name; + $$name = $temp; + + $name = 'email_address' . $i; + global $$name; + $temp = $email_address; + $email_address = $$name; + $$name = $temp; + + $name = 'reply_to' . $i; + global $$name; + $temp = $reply_to; + $reply_to = $$name; + $$name = $temp; + + return true; + } + + $i ++; + $name = 'form_for_' . $i; + global $$name; + } + return FALSE; + } -function LoadInfo(&$n, &$e, &$r, $post) -{ - global $username, $data_dir; + function CheckForDelete() { + global $username, $data_dir, $full_name, $email_address, $reply_to; - $n = getPref($data_dir, $username, 'full_name' . $post); - $e = getPref($data_dir, $username, 'email_address' . $post); - $r = getPref($data_dir, $username, 'reply_to' . $post); + $i = 1; + $name = 'form_for_' . $i; + global $$name; + while (isset($$name)) + { + $name = 'delete_' . $i; + global $$name; + if (isset($$name)) { + return true; + } + + $i ++; + $name = 'form_for_' . $i; + global $$name; + } + return false; + } + + function CheckAndDoPromote() { + global $username, $data_dir, $full_name, $email_address, $reply_to; + + $i = 1; + $name = 'form_for_' . $i; + global $$name; + while (isset($$name)) { + $name = 'promote_' . $i; + global $$name; + if (isset($$name) && $i > 1) { + do_hook('options_identities_renumber', $i, $i - 1); + + $nameA = 'full_name' . $i; + $nameB = 'full_name' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; + + $nameA = 'email_address' . $i; + $nameB = 'email_address' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; + + $nameA = 'reply_to' . $i; + $nameB = 'reply_to' . ($i - 1); + global $$nameA, $$nameB; + $temp = $$nameA; + $$nameA = $$nameB; + $$nameB = $temp; + + return true; + } + + $i ++; + $name = 'form_for_' . $i; + global $$name; + } + return false; + } + + function LoadInfo(&$n, &$e, &$r, $post) { + global $username, $data_dir; + + $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 ($n != '' || $e != '' || $r != '') + return true; + } + +function sti_input( $title, $hd, $data, $post, $bg ) { + + echo "$title:". + ''. + '"; - if ($n != '' || $e != '' || $r != '') - return true; } -function ShowTableInfo($full_name, $email_address, $reply_to, $post) -{ - global $color; - - $OtherBG = ' bgcolor="' . $color[0] . '"'; - if ($full_name == '' && $email_address == '' && $reply_to == '') - $OtherBG = ''; +function ShowTableInfo($full_name, $email_address, $reply_to, $post) { + global $color; - if ($full_name == '' && $email_address == '' && $reply_to == '') - $isEmptySection = true; - else - $isEmptySection = false; + $OtherBG = ' bgcolor="' . $color[0] . '"'; + if ($full_name == '' && $email_address == '' && $reply_to == '') + $OtherBG = ''; -?> - > - - : - - - - - - > - - : - - - - - - > - - : - - - - - - - > -   - - "> - - "> - "> - 1) { -?> - "> - - - - -   - -". + ' '. + "". + ''; + if (! $isEmptySection && $post != '') { + echo "'. + "'; + } + if (! $isEmptySection && $post != '' && $post > 1) { + echo ''; + } + do_hook('options_identities_buttons', $isEmptySection, $post); + echo ''. + ' '; } +?>