From 79d3cb24519bedb06de4cebd753a62f064e8e297 Mon Sep 17 00:00:00 2001 From: Brian Godette Date: Fri, 17 Oct 2014 10:39:21 -0600 Subject: [PATCH] initial fixes; make compatible with Debian/Ubuntu php5 settings ( - + -MailZu <?=translate('Help')?> - +MailZu <?php echo translate('Help')?> + - - getLink($php_self . '?' . $query_string_first, translate('first'), '', '', translate('Go to first page')) . " | "; + $pager_html = $link->getLink($php_self . '?' . $query_string_first, translate('first'), '', '', translate('Go to first page')) . " | "; $pager_html .= $link->getLink($php_self . '?' . $query_string_previous, translate('previous'), '', '', translate('Go to previous page')) . " | "; } else { - $pager_html .= translate('first') . " | " . translate('previous') ." | "; + $pager_html = translate('first') . " | " . translate('previous') ." | "; } $pager_html .= '  '; @@ -466,7 +466,7 @@ function genMultiPagesLinks( $page, $sizeLimit, $count) { for( $i=0; $i<$count; $i+=$sizeLimit ) { $page_num = $i/$sizeLimit; - if( $count > $size_limit * 20 && abs( $page_num - $page ) > 10 ) { + if( $count > $sizeLimit * 20 && abs( $page_num - $page ) > 10 ) { if( ! $elipsis_printed ) { $pager_html .= '...  '; $elipsis_printed = true; @@ -486,8 +486,8 @@ function genMultiPagesLinks( $page, $sizeLimit, $count) { if( $page+1 < $total_pages ) { $query_string = CmnFns::array_to_query_string( $_GET, array( 'page' ) ); - $query_string_next .= $query_string . '&page=' . ($page+1); - $query_string_last .= $query_string . '&page=' . (ceil($total_pages)-1); + $query_string_next = $query_string . '&page=' . ($page+1); + $query_string_last = $query_string . '&page=' . (ceil($total_pages)-1); $pager_html .= ' | ' . $link->getLink($php_self . '?' . $query_string_next, strtolower(translate('Next')), '', '', translate('Go to next page')); $pager_html .= ' | ' . $link->getLink($php_self . '?' . $query_string_last, translate('last'), '', '', translate('Go to last page')); } else { @@ -514,11 +514,11 @@ function searchEngine($content_type, $submit_page, $full_search = false) { ?> - + - + \n\t\t\t
 
 
  - $name) { @@ -543,34 +543,34 @@ function searchEngine($content_type, $submit_page, $full_search = false) { $i ++; } ?> - : + :
 \n" : "  "; ?> - - " /> + "; ?>  
- convertEmailaddresses2SQL($emailaddresses); + $recipEmailClause = $this->convertEmailaddresses2SQL($emailaddress); $return = array(); @@ -641,6 +641,7 @@ function get_raw_mail($mail_id, $email_recip) { if ($result->numRows() <= 0){ return false; } + $return = ""; while ($rs = $result->fetchRow()) { $return .= $rs['mail_text']; } diff --git a/lib/ExchAuth.class.php b/lib/ExchAuth.class.php index 3053669..41fe4a5 100644 --- a/lib/ExchAuth.class.php +++ b/lib/ExchAuth.class.php @@ -15,7 +15,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); /** * Provide all database access/manipulation functionality for Exchange Auth diff --git a/lib/IMAPAuth.class.php b/lib/IMAPAuth.class.php index 41aeda4..ff10c7c 100644 --- a/lib/IMAPAuth.class.php +++ b/lib/IMAPAuth.class.php @@ -15,7 +15,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); /** * Provide all database access/manipulation functionality for IMAP Auth diff --git a/lib/LDAPEngine.class.php b/lib/LDAPEngine.class.php index 795ed5f..0ee6ce3 100644 --- a/lib/LDAPEngine.class.php +++ b/lib/LDAPEngine.class.php @@ -15,7 +15,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); class LDAPEngine { diff --git a/lib/MailEngine.class.php b/lib/MailEngine.class.php index ef326e0..ce04e30 100644 --- a/lib/MailEngine.class.php +++ b/lib/MailEngine.class.php @@ -15,7 +15,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); /** * Pear::DB */ diff --git a/lib/MailMime.class.php b/lib/MailMime.class.php index 3a981e1..6fc154d 100644 --- a/lib/MailMime.class.php +++ b/lib/MailMime.class.php @@ -15,7 +15,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); /** * Pear::DB */ @@ -91,14 +91,14 @@ function MsgParseBody($struct) { break; } break; - case "text": // Do not display attached text types - if ($attachment = $struct->d_parameters['filename'] or - $attachment = $struct->d_parameters['name']) { + if (property_exists($struct, "d_parameters")) { + if ($attachment = $struct->d_parameters['filename'] or $attachment = $struct->d_parameters['name']) { array_push($filelist, $attachment); break; } + } switch ($ctype_s) { // Plain text case "plain": diff --git a/lib/Quarantine.lib.php b/lib/Quarantine.lib.php index 022a627..9258a07 100644 --- a/lib/Quarantine.lib.php +++ b/lib/Quarantine.lib.php @@ -16,7 +16,7 @@ /** * CmnFns class */ -include_once('CmnFns.class.php'); +include_once('lib/CmnFns.class.php'); /** * Include AmavisdEngine class */ @@ -123,8 +123,7 @@ function releaseMessages($emailaddresses, $mail_id_array) { global $conf; // If release request needs to be sent to Admins - if ( is_array($release_req_messages) && !empty($release_req_messages) - && $conf['app']['notifyAdmin'] ) + if ( is_array($release_req_messages) && !empty($release_req_messages) && $conf['app']['notifyAdmin'] ) sendMailToAdmin(translate('Request release'), $release_req_messages); // If release needs to be done @@ -252,15 +251,14 @@ function updateMessages($flag, $content_type, $emailaddresses, $mail_id_array, $ } } else { - $i = 0; - foreach ($mail_id_array as $mail_id_recip) { - // Get mail_id and recipient email address - $temp = preg_split('/_/', $mail_id_recip, 2); - $mail_id = $temp[0]; - $recip_email = $temp[1]; + //$temp = preg_split('/_/', $mail_id_recip, 2); + //$mail_id = $temp[0]; + //$recip_email = $temp[1]; + $mail_id = substr($mail_id_recip, 0, 12); + $recip_email = substr($mail_id_recip, 13); // Check if logged in user is admin or logged in user is trying to delete his own messages if ( Auth::isMailAdmin() || in_array($recip_email, $emailaddresses) ) { diff --git a/lib/Template.class.php b/lib/Template.class.php index a59d433..7b814de 100644 --- a/lib/Template.class.php +++ b/lib/Template.class.php @@ -57,21 +57,21 @@ function printHTMLHeader() { ?> - + - <?=$this->title?> + <?php echo $this->title?> - + - - + + -

-

- +

- - - -

v

+

v

- '; @@ -72,7 +72,7 @@ $order = array('msgs.time_num', 'from_addr', 'msgs.subject', 'spam_level', 'recip.email', 'msgs.content', 'mail_id'); // Arbitrary type for Admin - $content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A'); + //$content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A'); //echo "Before query: " . date("l dS of F Y h:i:s A") . "

"; diff --git a/messagesPendingAdmin.php b/messagesPendingAdmin.php index f66fdb4..9a6fde8 100644 --- a/messagesPendingAdmin.php +++ b/messagesPendingAdmin.php @@ -51,8 +51,9 @@ if (! Auth::isMailAdmin()) { CmnFns::do_error_box(translate('Access Denied')); - } else { + // Arbitrary type for Admin + $content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A'); // Draw search engine printSearchEngine($content_type, $_SERVER['PHP_SELF'], 1); echo '
'; @@ -67,8 +68,6 @@ $search_array = array_merge( $search_array1, $search_array2, $search_array3, $search_array4 ); $order = array('msgs.time_num', 'from_addr', 'msgs.subject', 'spam_level', 'recip.email', 'msgs.content', 'mail_id'); - // Arbitrary type for Admin - $content_type = (CmnFns::get_ctype() ? CmnFns::get_ctype() : 'A'); // Print a loading message until database returns... printMessage(translate('Retrieving Messages...')); diff --git a/templates/auth.template.php b/templates/auth.template.php index 173efd9..de619af 100644 --- a/templates/auth.template.php +++ b/templates/auth.template.php @@ -27,19 +27,19 @@ function printLoginForm($msg = '', $resume = '') { if (!empty($msg)) CmnFns::do_error_box($msg, '', false); ?> -
+
@@ -94,9 +94,9 @@ function printLoginForm($msg = '', $resume = '') {
-
+
-

+

@@ -47,7 +47,7 @@ function printLoginForm($msg = '', $resume = '') {
-

+

@@ -56,26 +56,26 @@ function printLoginForm($msg = '', $resume = '') {
-

+

- +
-

+

- +
-

+

@@ -84,8 +84,8 @@ function printLoginForm($msg = '', $resume = '') {

- - + +

-doLink('javascript: help();', translate('Help'), '', '', translate('Get online help')) ?> +doLink('javascript: help();', translate('Help'), '', '', translate('Get online help')) ?>

- diff --git a/templates/common.template.php b/templates/common.template.php index 20d7abd..6af2d4d 100644 --- a/templates/common.template.php +++ b/templates/common.template.php @@ -47,10 +47,10 @@ function showQuickLinks() { @@ -58,12 +58,12 @@ function showQuickLinks() {
- +
- doLink("javascript: help('quick_links');", '?', '', 'color: #FFFFFF', translate('Help') . ' - ' . translate('My Quick Links')) ?> + doLink("javascript: help('quick_links');", '?', '', 'color: #FFFFFF', translate('Help') . ' - ' . translate('My Quick Links')) ?>
@@ -120,7 +120,7 @@ function showQuickLinks() {
- »': "

\t"; $link->doLink('summary.php', translate('Quarantine Summary')) ?>

- »': "

\t"; $link->doLink('messagesIndex.php?ctype=A', translate('My Quarantine')); @@ -78,7 +78,7 @@ function showQuickLinks() { ?>


- »': @@ -108,11 +108,11 @@ function showQuickLinks() { } ?>

- doLink('javascript: help();', translate('Help')) ?> + doLink('javascript: help();', translate('Help')) ?>


- doLink('index.php?logout=true', translate('Log Out')) ?> + doLink('index.php?logout=true', translate('Log Out')) ?>

-
- -
- - +"; + } +?> + +"; ?> -
-"; -?> -
- - - - + + +
-   - +   +
- -
-

+
+

- - - + + - - +
- doLink('javascript: help(\'msg_index\');', '?', '', 'color: #FFFFFF;', - translate('Help') . ' - ' . translate('My Quarantine')) ?> + doLink('javascript: help(\'msg_index\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Quarantine')) ?>
@@ -89,47 +87,46 @@ function showMessagesTable($content_type, $res, $page, $order, $vert, $numRows = - - - 1) || ((Auth::isMailAdmin()) && + + 1) || ((Auth::isMailAdmin()) && ("Site Quarantine" == $_SESSION['sessionNav'] || "Site Pending Requests" == $_SESSION['sessionNav']))) { ?> - - - - - - - - - - + -
  > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=recip.email&vert=' . $new_vert, translate('To'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=from_addr&vert=' . $new_vert, translate('From'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=msgs.subject&vert=' . $new_vert, translate('Subject'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=msgs.time_num&vert=' . $new_vert, translate('Date'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=spam_level&vert=' . $new_vert, translate('Score'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=msgs.content&vert=' . $new_vert, translate('Content Type'), '', '', $mouseover_text) ?> > - doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) + > + doLink($_SERVER['PHP_SELF'] . '?' . CmnFns::querystring_exclude_vars( array('order','vert')) . '&order=mail_id&vert=' . $new_vert, translate('Mail ID'), '', '', $mouseover_text) ?>
- - - - '; echo '' . translate('There are no matching records.') . ''; echo ''; @@ -221,25 +215,25 @@ function printSearchEngine($content_type, $submit_page, $full_search = false) {
- +
- doLink('javascript: help(\'search\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Re + doLink('javascript: help(\'search\');', '?', '', 'color: #FFFFFF;', translate('Help') . ' - ' . translate('My Re servations')) ?>
-