3 * Display pending requests for logged in users.
6 * @author Jeremy Fowler <jfowler06@users.sourceforge.net>
10 * Copyright (C) 2005 - 2007 MailZu
11 * License: GPL, see LICENSE
14 * Include Template class
16 include_once('lib/Template.class.php');
18 * Include common output functions
20 include_once('templates/common.template.php');
22 * Include quarantine-specific output functions
24 include_once('templates/quarantine.template.php');
26 if (!Auth
::is_logged_in()) {
27 Auth
::print_login_msg(); // Check if user is logged in
30 // grab the display size limit set in config.php
31 $sizeLimit = isset ( $conf['app']['displaySizeLimit'] ) && is_numeric( $conf['app']['displaySizeLimit'] ) ?
32 $conf['app']['displaySizeLimit'] : 50;
35 $content_type = (CmnFns
::get_ctype() ? CmnFns
::get_ctype() : 'A');
37 $order = array('msgs.time_num', 'from_addr', 'msgs.subject', 'spam_level', 'recip.email', 'msgs.content', 'mail_id');
38 // Get current page number
39 $requestedPage = CmnFns
::getGlobalVar('page', GET
);
41 $_SESSION['sessionNav'] = "My Pending Requests";
42 $t = new Template(translate('My Pending Requests'));
46 $t->printHTMLHeader();
50 // Break table into 2 columns, put quick links on left side and all other tables on the right
52 showQuickLinks(); // Print out My Quick Links
53 startDataDisplayCol();
56 printSearchEngine($content_type, $_SERVER['PHP_SELF'], (count($_SESSION['sessionMail']) > 1));
59 if ( CmnFns
::getGlobalVar('search_action', GET
) == translate('Clear search results') ) CmnFns
::redirect_js($_SERVER['PHP_SELF']);
61 $search_array1 = $db->convertSearch2SQL( 'msgs.from_addr', CmnFns
::getGlobalVar('f_criterion', GET
), CmnFns
::getGlobalVar('f_string', GET
) );
62 $search_array2 = $db->convertSearch2SQL( 'msgs.subject', CmnFns
::getGlobalVar('s_criterion', GET
), CmnFns
::getGlobalVar('s_string', GET
) );
63 $search_array3 = $db->convertSearch2SQL( 'recip.email', CmnFns
::getGlobalVar('t_criterion', GET
), CmnFns
::getGlobalVar('t_string', GET
) );
64 $search_array4 = $db->convertSearch2SQL( 'msgs.mail_id', CmnFns
::getGlobalVar('m_criterion', GET
), CmnFns
::getGlobalVar('m_string', GET
) );
65 $search_array = array_merge( $search_array1, $search_array2, $search_array3, $search_array4 );
67 // Print a loading message until database returns...
68 printMessage(translate('Retrieving Messages...'));
70 $messages = $db->get_user_messages($content_type, $_SESSION['sessionMail'], CmnFns
::get_value_order($order), CmnFns
::get_vert_order(), $search_array, false, 1, $requestedPage);
72 // Compute maximum number of pages
73 $maxPage = (ceil($db->numRows
/$sizeLimit)-1);
75 // If $requestedPage > $maxPage, then redirect to $maxPage instead of $requestedPage
76 if ( $requestedPage > $maxPage ) {
77 $query_string = CmnFns
::array_to_query_string( $_GET, array( 'page' ) );
78 $query_string = str_replace ( '&', '&', $query_string );
79 CmnFns
::redirect_js($_SERVER['PHP_SELF'].'?'.$query_string.'&page='.$maxPage);
82 showMessagesTable( $content_type, $messages, $requestedPage, CmnFns
::get_value_order($order), CmnFns
::get_vert_order() );
84 // Hide the message after the table loads.
85 hideMessage(translate('Retrieving Messages...'));
89 $t->printHTMLFooter();