* * Licensed under the GNU GPL. For full terms see the file COPYING that came * with the Squirrelmail distribution. * */ /** * This file contains functions that spit out HTML, mostly intended for use by * addrule.php and edit.php. */ /** * Start form. */ function avelsieve_printheader() { global $PHP_SELF; print '
'; } /** * Print bottom control and navigation buttons. */ function printaddbuttons() { global $part, $spamrule; print ''; if (isset($part) && $part != 1) { print ''; } print '
'; if (isset($spamrule) && $spamrule == true ) { print ''; return; } if (($part < 1) || ($part > 4)) { return; } /* if ($part!=1) { print ''; } */ $dummy = _("Move back to step"); if ($part=="4") { print ''; } else { print ''; } } /** * Print simple footer that closes tables, form and HTML. */ function printnakedfooter() { print '
'; } /** * Print mailbox select widget. * * @param string $selectname name for the select HTML variable * @param string $selectedmbox which mailbox to be selected in the form * @param boolean $sub */ function printmailboxlist($selectname, $selectedmbox, $sub = false) { global $boxes_append, $boxes_admin, $imap_server_type, $default_sub_of_inbox; if(isset($boxes_admin) && $sub) { $boxes = $boxes_admin; } elseif(isset($boxes_append)) { $boxes = $boxes_append; } else { global $boxes; } if (count($boxes)) { $mailboxlist = ' '; } else { print ' '; } print ''; } } function print_2_1_addressmatch() { print _("The rule will trigger if the following addresses appear anywhere in the message's headers:"); /* TODO */ } /* * Header match stuff functions. */ /** * Print listbox widget with available headers to choose from. * * @param $selected_header Selected header * @param $n option number */ function print_header_listbox($selected_header, $n) { global $headers; print ''; } function print_matchtype_listbox($selected_matchtype, $n, $varname = 'matchtype') { global $matchtypes, $comparators, $matchregex, $sieve_capabilities; reset($matchtypes); reset($comparators); reset($matchregex); print ''; } function print_condition_listbox($selected_condition) { $conditions = array( "and" => _("AND (Every item must match)"), "or" => _("OR (Either item will match)") ); print _("The condition for the following rules is:"); print ''; } function print_2_2_headermatch($items) { global $HTTP_POST_VARS, $maxitems, $edit, $matchtypes, $comparators; print ''; if(isset($edit)) { if(isset($_SESSION['rules'][$edit]['condition'])) { $condition = $_SESSION['rules'][$edit]['condition']; } else { $condition = "and"; /* FIXME */ } if(isset($_SESSION['rules'][$edit]['header'])) $header = $_SESSION['rules'][$edit]['header']; if(isset($_SESSION['rules'][$edit]['matchtype'])) $matchtype = $_SESSION['rules'][$edit]['matchtype']; if(isset($_SESSION['rules'][$edit]['headermatch'])) $headermatch = $_SESSION['rules'][$edit]['headermatch']; } else { if(isset($_POST['condition'])) { $condition = $_POST['condition']; } else { $condition = false; } if(isset($_POST['header'])) { $header = $_POST['header']; } else { $header = false; } if(isset($_POST['matchtype'])) { $matchtype = $_POST['matchtype']; } else { $matchtype = false; } if(isset($_POST['headermatch'])) { $headermatch = $_POST['headermatch']; } else { $headermatch = false; } } if($items > 1) { print_condition_listbox($condition); } print '

'; if($items > 1) { print ''; } if($items < $maxitems) { print ''; } } function print_2_3_sizematch() { global $edit; print '

'; print _("This rule will trigger if message is"); print ''; print _("than"); print '

'; } function print_2_4_allmessages() { print _("The following action will be applied to all incoming messages that do not match any of the previous rules."); } function print_2_5_bodymatch() { print '

'; print _("This rule will trigger upon the occurrence of one or more strings in the body of an e-mail message. "); } function print_3_action_checkedaction($num, $selectedaction) { print ' '; } function print_3_action() { /* Preferences from config.php */ global $useimages, $translate_return_msgs; /* Data taken from addrule.php */ global $boxes, $createnewfolder, $emailaddresses, $sieve_capabilities; /* If editing an existing rule */ global $edit, $selectedmailbox; if(isset($edit)) { $selectedaction = $_SESSION['rules'][$edit]['action']; } else { $selectedaction = 1; } //print '' print '

'; print _("Choose what to do when this rule triggers, from one of the following:"); /*-*-*-*/ print '

'; print_3_action_checkedaction(1, $selectedaction); print ''; print '
'; /*-*-*-*/ print_3_action_checkedaction(2, $selectedaction); print ''; print '
'; /*-*-*-*/ if(avelsieve_capability_exists('reject')) { print_3_action_checkedaction(3, $selectedaction); print ''; print '

'; } /*-*-*-*/ print_3_action_checkedaction(4, $selectedaction); print ''; print '
'; print '
'; print ''; print '

'; /*-*-*-*/ if(avelsieve_capability_exists('fileinto')) { print_3_action_checkedaction(5, $selectedaction); global $selectedmailbox; print ''; if(isset($edit)) { /* The section here will be slightly different for the edit * page. This part takes care of this. */ print ' '; print _("the existing folder"); print ' '; print printmailboxlist("folder", $selectedmailbox); } else { /* This is the section for the addrule part. Is it kludgy? Is * it? IS IT? :-p */ print '
'; print _("the existing folder"); print ' '; print printmailboxlist("folder", $selectedmailbox); if ($createnewfolder) { print '
'; print _("a new folder, named"); print ' '; print _("created as a subfolder of"); print printmailboxlist("subfolder", false, true); } } if(avelsieve_capability_exists('imapflags')) { if(isset($edit)) { print '
'; } print '
'; print ''; } print '
'; print '
'; } /*-*-*-*/ if(avelsieve_capability_exists('vacation')) { print_3_action_checkedaction(6, $selectedaction); global $emailaddresses; print '