Skip to content

Commit

Permalink
initial fixes; make compatible with Debian/Ubuntu php5 settings (<? t…
Browse files Browse the repository at this point in the history
…o <?php); fix library includes, missing relative paths; fix handling of mail_id; check for existence of object members before trying to use them; fixed pagenation query;
  • Loading branch information
bgodette committed Oct 17, 2014
1 parent 108b4e3 commit 79d3cb2
Show file tree
Hide file tree
Showing 22 changed files with 213 additions and 208 deletions.
2 changes: 1 addition & 1 deletion config/constants.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?
<?php
define('INTERNAL_DATE_SEPERATOR', '/');
define('RES_TYPE_ADD', 'r');
define('RES_TYPE_MODIFY', 'm');
Expand Down
9 changes: 6 additions & 3 deletions css.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ Alternating row colors
Got rid of the contextual selector '.cellColor0 td'
*/
.cellColor0, td.cellColor0 {
font-family: monospace;
padding: 2px;
background-color: #FFFFFF;
font-size: 11px;
font-size: 10px;
}
td.cellColor1, .cellColor1 {
.cellColor1, td.cellColor1 {
font-family: monospace;
padding: 2px;
background-color: #F8FAEA;
font-size: 11px;
font-size: 10px;
}
/*
Special Alternating row colors for viruses
Expand Down Expand Up @@ -461,6 +463,7 @@ div.mycal_div {
}

.stdFont {
/* font-family: monospace;*/
font-size: 11px;
}

Expand Down
8 changes: 4 additions & 4 deletions help.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$languages[$lang][2]?>" lang="<?=$languages[$lang][2]?>">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $languages[$lang][2]?>" lang="<?=$languages[$lang][2]?>">
<head>
<title>MailZu <?=translate('Help')?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>" />
<title>MailZu <?php echo translate('Help')?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset?>" />
<style type="text/css">
<!--
li {
Expand Down Expand Up @@ -60,7 +60,7 @@
</style>
</head>
<body>
<?
<?php
$help_file = 'lang/' . $languages[$lang][2] . '.help.php';
if (file_exists($help_file)) {
include_once($help_file);
Expand Down
2 changes: 1 addition & 1 deletion lib/AmavisdEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');

/**
* PEAR::Net_Socket Library
Expand Down
54 changes: 27 additions & 27 deletions lib/CmnFns.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function print_language_pulldown() {
global $conf;
?>
<select name="language" class="textbox" onchange="changeLanguage(this);">
<?
<?php
$languages = get_language_list();
foreach ($languages as $lang => $settings) {
echo '<option value="' . $lang . '"'
Expand All @@ -365,7 +365,7 @@ function print_language_pulldown() {
}
?>
</select>
<?
<?php
}

/**
Expand Down Expand Up @@ -452,10 +452,10 @@ function genMultiPagesLinks( $page, $sizeLimit, $count) {
$query_string = CmnFns::array_to_query_string( $_GET, array( 'page' ) );
$query_string_first = $query_string . '&page=0';
$query_string_previous = $query_string . '&page=' . ($page-1);
$pager_html .= $link->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 .= '&nbsp;&nbsp;';
Expand All @@ -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 .= '...&nbsp;&nbsp;';
$elipsis_printed = true;
Expand All @@ -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 {
Expand All @@ -514,11 +514,11 @@ function searchEngine($content_type, $submit_page, $full_search = false) {

?>
<table border=0 width="100%">
<form action="<? echo $submit_page ?>" method="get" name="quarantine">
<form action="<?php echo $submit_page ?>" method="get" name="quarantine">

<tr><td colspan=2 align="center"><? echo translate('Search for messages whose:'); ?>&nbsp;</td></tr>
<tr><td colspan=2 align="center"><?php echo translate('Search for messages whose:'); ?>&nbsp;</td></tr>
<tr><td align="right">&nbsp;
<?
<?php
$i = 1;
$array_size = count($fields_array);
foreach ($fields_array as $k => $name) {
Expand All @@ -543,34 +543,34 @@ function searchEngine($content_type, $submit_page, $full_search = false) {
$i ++;
}
?>
<? echo translate('Content Type'); ?>:
<?php echo translate('Content Type'); ?>:
<select name="ctype" class="button">
<option value="A" <? echo ($content_type == 'A' ? ' selected="true"':''); ?>>
<? echo translate('All'); ?></option>
<option value="S" <? echo ($content_type == 'S' ? ' selected="true"':''); ?>>
<? echo translate('Spam'); ?></option>
<option value="B" <? echo ($content_type == 'B' ? ' selected="true"':''); ?>>
<? echo translate('Banned'); ?></option>
<? if (Auth::isMailAdmin() || $conf['app']['allowViruses']) { ?>
<option value="V" <? echo ($content_type == 'V' ? ' selected="true"':''); ?>>
<? echo translate('Virus'); ?></option>
<? }
<option value="A" <?php echo ($content_type == 'A' ? ' selected="true"':''); ?>>
<?php echo translate('All'); ?></option>
<option value="S" <?php echo ($content_type == 'S' ? ' selected="true"':''); ?>>
<?php echo translate('Spam'); ?></option>
<option value="B" <?php echo ($content_type == 'B' ? ' selected="true"':''); ?>>
<?php echo translate('Banned'); ?></option>
<?php if (Auth::isMailAdmin() || $conf['app']['allowViruses']) { ?>
<option value="V" <?php echo ($content_type == 'V' ? ' selected="true"':''); ?>>
<?php echo translate('Virus'); ?></option>
<?php }
if (Auth::isMailAdmin() || $conf['app']['allowBadHeaders']) { ?>
<option value="H" <? echo ($content_type == 'H' ? ' selected="true"':''); ?>>
<? echo translate('Bad Header'); ?></option>
<? }
<option value="H" <?php echo ($content_type == 'H' ? ' selected="true"':''); ?>>
<?php echo translate('Bad Header'); ?></option>
<?php }
echo "</select>";
$i ++;
echo ($i % 2) ? "&nbsp;</td></tr>\n\t\t\t<tr><td colspan='2' align='center'>&nbsp\n" : "&nbsp;</td><td align='left'>&nbsp";
?>
<input type="submit" class="button" name="search_action" value="<? echo translate('Search'); ?>" />
<? if (CmnFns::didSearch())
<input type="submit" class="button" name="search_action" value="<?php echo translate('Search'); ?>" />
<?php if (CmnFns::didSearch())
echo "<input type=\"submit\" class=\"button\" name=\"search_action\" value=\"" . translate('Clear search results') . "\" />";
?>
&nbsp;</td></tr>
</form>
</table>
<?
<?php

}

Expand Down
2 changes: 1 addition & 1 deletion lib/DBAuth.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');
/**
* Pear::DB
*/
Expand Down
5 changes: 3 additions & 2 deletions lib/DBEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');
/**
* Auth class
*/
Expand Down Expand Up @@ -497,7 +497,7 @@ function get_message($emailaddress, $mail_id) {
$join_type = ' INNER JOIN';
}

$recipEmailClause = $this->convertEmailaddresses2SQL($emailaddresses);
$recipEmailClause = $this->convertEmailaddresses2SQL($emailaddress);

$return = array();

Expand Down Expand Up @@ -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'];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ExchAuth.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/IMAPAuth.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/LDAPEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');


class LDAPEngine {
Expand Down
2 changes: 1 addition & 1 deletion lib/MailEngine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');
/**
* Pear::DB
*/
Expand Down
8 changes: 4 additions & 4 deletions lib/MailMime.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');
/**
* Pear::DB
*/
Expand Down Expand Up @@ -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":
Expand Down
16 changes: 7 additions & 9 deletions lib/Quarantine.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* CmnFns class
*/
include_once('CmnFns.class.php');
include_once('lib/CmnFns.class.php');
/**
* Include AmavisdEngine class
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) ) {
Expand Down
Loading

0 comments on commit 79d3cb2

Please sign in to comment.