configured
[bMailZu.git] / messagesProcessing.php
blob2e29ef83ee6ac6fd3e2fcbfbc3b7dd575dc6b366
1 <?php
2 /**
3 * This file processes the messages that were selected
4 * in messagesIndex.php for logged in users.
5 * @author Samuel Tran <stran2005@users.sourceforge.net>
6 * @author Nicolas Peyrussie <peyrouz@users.sourceforge.net>
7 * @version 04-03-07
8 * @package MailZu
10 * Copyright (C) 2005 - 2007 MailZu
11 * License: GPL, see LICENSE
13 /**
14 * Include Template class
16 include_once('lib/Template.class.php');
17 /**
18 * Include Quarantine functions
20 include_once('lib/Quarantine.lib.php');
21 /**
22 * Include common output functions
24 include_once('templates/common.template.php');
25 /**
26 * Include quarantine-specific output functions
28 include_once('templates/quarantine.template.php');
30 if (!Auth::is_logged_in()) {
31 Auth::print_login_msg(); // Check if user is logged in
34 //Turn off all error reporting, useless for users
35 error_reporting(0);
37 $db = new DBEngine();
39 $t = new Template(translate('Message Processing'));
41 $t->printHTMLHeader();
42 $t->printWelcome();
43 $t->startMain();
45 // Break table into 2 columns, put quick links on left side and all other tables on the right
46 startQuickLinksCol();
47 showQuickLinks(); // Print out My Quick Links
48 startDataDisplayCol();
50 $action = CmnFns::get_action();
51 $content_type = CmnFns::get_ctype();
52 $query_string = CmnFns::get_query_string();
53 $mail_id_array = CmnFns::getGlobalVar('mail_id_array', POST);
55 switch ( $_SESSION['sessionNav'] ) {
56 case 'My Quarantine':
57 $referral = 'messagesIndex.php';
58 break;
59 case 'Site Quarantine':
60 $referral = 'messagesAdmin.php';
61 break;
62 case 'My Pending Requests':
63 $referral = 'messagesPending.php';
64 break;
65 case 'Site Pending Requests':
66 $referral = 'messagesPending.php';
67 break;
70 // If no message was selected and the action is not "Delete All"
71 if ( ! isset($mail_id_array) && $action != translate('Delete All') )
73 printNoMesgWarning();
75 elseif ( isset( $action ) ) {
77 switch ( $action ) {
78 case translate('Release'):
79 case translate('Release/Request release'):
80 $failed_array = releaseMessages($_SESSION['sessionMail'], $mail_id_array);
81 if ( is_array($failed_array) && !empty($failed_array) ) {
82 showFailedMessagesTable($action, $content_type, $failed_array);
83 printCpanelBr();
84 printReportButtons($query_string, $failed_array, $action);
85 } else {
86 CmnFns::redirect_js($referral . '?' . $query_string);
88 break;
89 case translate('Cancel Request'):
90 $failed_array = updateMessages('', $content_type, $_SESSION['sessionMail'], $mail_id_array);
91 if ( is_array($failed_array) && !empty($failed_array) ) {
92 showFailedMessagesTable($action, $content_type, $failed_array);
93 printCpanelBr();
94 printReportButtons($query_string, $failed_array, $action);
95 } else {
96 CmnFns::redirect_js($referral . '?' . $query_string);
98 break;
99 case translate('Delete'):
100 $failed_array = updateMessages('D', $content_type, $_SESSION['sessionMail'], $mail_id_array);
101 if ( is_array($failed_array) && !empty($failed_array) ) {
102 showFailedMessagesTable($action, $content_type, $failed_array);
103 printCpanelBr();
104 printReportButtons($query_string, $failed_array, $action);
105 } else {
106 CmnFns::redirect_js($referral . '?' . $query_string);
108 break;
109 case translate('Delete All'):
110 $failed_array = updateMessages('D', $content_type, $_SESSION['sessionMail'], '', true);
111 if ( is_array($failed_array) && !empty($failed_array) ) {
112 showFailedMessagesTable($action, $content_type, $failed_array);
113 printCpanelBr();
114 printReportButtons($query_string, $failed_array, $action);
115 } else {
116 CmnFns::redirect_js($referral . '?' . $query_string);
118 break;
119 default:
120 CmnFns::do_error_box(translate('Unknown action type'), '', false);
125 endDataDisplayCol();
126 $t->endMain();
127 $t->printHTMLFooter();