apply code-formating-cleanup-convert-DOS-to-UNIX-text-form from https://github.com/zedzedtop/mailzu
This commit is contained in:
parent
180aa514e9
commit
05196e9fb7
@ -37,7 +37,6 @@ else {
|
||||
*/
|
||||
|
||||
class AmavisdEngine {
|
||||
|
||||
var $socket; // Reference to socket
|
||||
var $port; // Amavisd spam release port
|
||||
var $connected; // Connection status
|
||||
@ -49,7 +48,6 @@ class AmavisdEngine {
|
||||
* $return object Amavisd object
|
||||
*/
|
||||
function AmavisdEngine($host) {
|
||||
|
||||
$this->socket = new Net_Socket();
|
||||
$this->port = $GLOBALS['conf']['amavisd']['spam_release_port'];
|
||||
$this->connected = false;
|
||||
@ -82,7 +80,6 @@ class AmavisdEngine {
|
||||
*/
|
||||
|
||||
function release_message($mail_id, $secret_id, $recipient, $quar_type, $quar_loc) {
|
||||
|
||||
if (! $this->connected) {
|
||||
return $this->last_error;
|
||||
}
|
||||
@ -120,8 +117,6 @@ class AmavisdEngine {
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -149,7 +149,6 @@ class Auth {
|
||||
|
||||
case "ad":
|
||||
case "ldap":
|
||||
|
||||
// Added this check for LDAP servers that switch to anonymous bind whenever
|
||||
// provided password is left blank
|
||||
if ($pass == '') return (translate ('Invalid User Name/Password.'));
|
||||
@ -160,7 +159,6 @@ class Auth {
|
||||
$ldap = new LDAPEngine();
|
||||
|
||||
if( $ldap->connect() ) {
|
||||
|
||||
// Get user DN
|
||||
// For AD it could be of the form of 'user@domain' or standard LDAP dn
|
||||
$dn = $ldap->getUserDN($login);
|
||||
@ -184,7 +182,6 @@ class Auth {
|
||||
break;
|
||||
|
||||
case "sql":
|
||||
|
||||
// Include DBAuth class
|
||||
include_once('DBAuth.class.php');
|
||||
|
||||
@ -222,7 +219,6 @@ class Auth {
|
||||
break;
|
||||
|
||||
case "imap":
|
||||
|
||||
// Include IMAPAuth class
|
||||
include_once('IMAPAuth.class.php');
|
||||
|
||||
@ -242,6 +238,7 @@ class Auth {
|
||||
|
||||
default:
|
||||
CmnFns::do_error_box(translate('Unknown server type'), '', false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,7 +247,6 @@ class Auth {
|
||||
CmnFns::write_log('Authentication failed' . ', ' . $msg, $login);
|
||||
return translate($msg);
|
||||
} else {
|
||||
|
||||
$this->is_loggedin = true;
|
||||
CmnFns::write_log('Authentication successful', $login);
|
||||
|
||||
@ -303,7 +299,6 @@ class Auth {
|
||||
}
|
||||
|
||||
function isAllowedToLogin( $username ) {
|
||||
|
||||
global $conf;
|
||||
|
||||
// If not defined or set to false, $username is allowed to log in
|
||||
@ -317,7 +312,6 @@ class Auth {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Log the user out of the system
|
||||
* @param none
|
||||
|
@ -47,7 +47,6 @@ include_once('Pager.class.php');
|
||||
* Provides functions common to most pages
|
||||
*/
|
||||
class CmnFns {
|
||||
|
||||
/**
|
||||
* Convert minutes to hours
|
||||
* @param double $time time to convert in minutes
|
||||
@ -83,7 +82,6 @@ class CmnFns {
|
||||
* @return int timestamp
|
||||
*/
|
||||
function formatDateISO($date) {
|
||||
|
||||
$time = strtotime($date);
|
||||
return $time;
|
||||
}
|
||||
@ -101,7 +99,6 @@ class CmnFns {
|
||||
return strftime($format, $date);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert UNIX timestamp to datetime format
|
||||
* @param string $ts MySQL timestamp
|
||||
@ -117,7 +114,6 @@ class CmnFns {
|
||||
return strftime($format, $ts);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert minutes to hours/minutes
|
||||
* @param int $minutes minutes to convert
|
||||
@ -143,7 +139,6 @@ class CmnFns {
|
||||
return (strrpos($uri, '/') === false) ? $uri : substr($uri, 0, strlen($uri));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prints an error message box and kills the app
|
||||
* @param string $msg error message to print
|
||||
@ -201,12 +196,12 @@ class CmnFns {
|
||||
* @return array of cleaned up POST values
|
||||
*/
|
||||
function cleanPostVals() {
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
foreach ($_POST as $key => $val)
|
||||
$return[$key] = stripslashes(trim($val));
|
||||
$rval[$key] = stripslashes(trim($val));
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -215,12 +210,12 @@ class CmnFns {
|
||||
* @return array of cleaned up data
|
||||
*/
|
||||
function cleanVals($data) {
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
foreach ($data as $key => $val)
|
||||
$return[$key] = stripslashes($val);
|
||||
$rval[$key] = stripslashes($val);
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -267,7 +262,6 @@ class CmnFns {
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opposite of php's nl2br function.
|
||||
* Subs in a newline for all brs
|
||||
@ -382,7 +376,6 @@ class CmnFns {
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verifies current page number and returns value
|
||||
* @param integer $page value of current page number
|
||||
@ -515,7 +508,6 @@ class CmnFns {
|
||||
?>
|
||||
<table border=0 width="100%">
|
||||
<form action="<?php echo $submit_page ?>" method="get" name="quarantine">
|
||||
|
||||
<tr><td colspan=2 align="center"><?php echo translate('Search for messages whose:'); ?> </td></tr>
|
||||
<tr><td align="right">
|
||||
<?php
|
||||
@ -645,7 +637,6 @@ class CmnFns {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Search for the var $name in $_SESSION, $_POST, $_GET,
|
||||
* $_SERVER and set it in provided var.
|
||||
@ -668,36 +659,30 @@ class CmnFns {
|
||||
* @return value of var
|
||||
*/
|
||||
function getGlobalVar($name, $search = INORDER) {
|
||||
|
||||
switch ($search) {
|
||||
|
||||
/* we want the default case to be first here,
|
||||
so that if a valid value isn't specified,
|
||||
all four arrays will be searched. */
|
||||
default:
|
||||
|
||||
case INORDER: // check session, post, get
|
||||
|
||||
case SESSION:
|
||||
if( isset($_SESSION[$name]) )
|
||||
return $_SESSION[$name];
|
||||
elseif ( $search == SESSION )
|
||||
break;
|
||||
|
||||
// fall through
|
||||
case FORM: // check post, get
|
||||
|
||||
case POST:
|
||||
if( isset($_POST[$name]) )
|
||||
return $_POST[$name];
|
||||
elseif ( $search == POST )
|
||||
break;
|
||||
|
||||
// fall through
|
||||
case GET:
|
||||
if( isset($_GET[$name]) )
|
||||
return $_GET[$name];
|
||||
/* For INORDER case, exit after GET */
|
||||
break;
|
||||
|
||||
case SERVER:
|
||||
if( isset($_SERVER[$name]) )
|
||||
return $_SERVER[$name];
|
||||
@ -729,11 +714,11 @@ class CmnFns {
|
||||
|
||||
?>
|
||||
<table border=0 width="100%">
|
||||
<form action="<? echo $submit_page ?>" method="get" name="wblist">
|
||||
<form action="<?php echo $submit_page ?>" method="get" name="wblist">
|
||||
|
||||
<tr><td colspan=2 align="center"><? echo translate('Search for rules whose:'); ?> </td></tr>
|
||||
<tr><td colspan=2 align="center"><?php echo translate('Search for rules whose:'); ?> </td></tr>
|
||||
<tr><td align="right">
|
||||
<?
|
||||
<?php
|
||||
$i = 1;
|
||||
$array_size = count($fields_array);
|
||||
foreach ($fields_array as $k => $name) {
|
||||
@ -761,14 +746,14 @@ class CmnFns {
|
||||
$i ++;
|
||||
echo ($i % 2) ? " </td></tr>\n\t\t\t<tr><td colspan='2' align='center'> \n" : " </td><td align='left'> ";
|
||||
?>
|
||||
<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') . "\" />";
|
||||
?>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<?
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ else {
|
||||
* Provide all database access/manipulation functionality for SQL Auth
|
||||
*/
|
||||
class DBAuth {
|
||||
|
||||
// Reference to the database object
|
||||
var $db;
|
||||
|
||||
@ -107,7 +106,6 @@ class DBAuth {
|
||||
* @param none
|
||||
*/
|
||||
function db_connect() {
|
||||
|
||||
/***********************************************************
|
||||
/ This uses PEAR::DB
|
||||
/ See http://www.pear.php.net/manual/en/package.database.php#package.database.db
|
||||
@ -145,7 +143,6 @@ class DBAuth {
|
||||
* @return boolean
|
||||
*/
|
||||
function authUser($username, $password) {
|
||||
|
||||
if ( $this->isMd5 )
|
||||
$password = md5( $password );
|
||||
|
||||
@ -171,7 +168,6 @@ class DBAuth {
|
||||
$this->err_msg = translate('There are no records in the table.');
|
||||
return false;
|
||||
} else {
|
||||
|
||||
// Fetch the first row of data
|
||||
$rs = $this->cleanRow($result->fetchRow());
|
||||
|
||||
@ -198,7 +194,6 @@ class DBAuth {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Strips out slashes for all data in the return row
|
||||
* - THIS MUST ONLY BE ONE ROW OF DATA -
|
||||
@ -206,11 +201,11 @@ class DBAuth {
|
||||
* @return array with same key => value pairs (except slashes)
|
||||
*/
|
||||
function cleanRow($data) {
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
foreach ($data as $key => $val)
|
||||
$return[$key] = stripslashes($val);
|
||||
return $return;
|
||||
$rval[$key] = stripslashes($val);
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -229,12 +224,12 @@ class DBAuth {
|
||||
* @return array containing user information
|
||||
*/
|
||||
function getUserData() {
|
||||
$return = array(
|
||||
$rval = array(
|
||||
'logonName' => $this->logonName,
|
||||
'firstName' => $this->firstName,
|
||||
'emailAddress' => $this->emailAddress
|
||||
);
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
//mysql_crypt - shamelessly stolen from php.net docs
|
||||
|
||||
|
@ -43,7 +43,6 @@ else {
|
||||
* Provide all database access/manipulation functionality
|
||||
*/
|
||||
class DBEngine {
|
||||
|
||||
// Reference to the database object
|
||||
var $db;
|
||||
|
||||
@ -85,7 +84,6 @@ class DBEngine {
|
||||
* @global $conf
|
||||
*/
|
||||
function db_connect() {
|
||||
|
||||
/***********************************************************
|
||||
/ This uses PEAR::DB
|
||||
/ See http://www.pear.php.net/manual/en/package.database.php#package.database.db
|
||||
@ -121,7 +119,7 @@ class DBEngine {
|
||||
|
||||
global $conf;
|
||||
|
||||
$return = array();
|
||||
$rval = array();
|
||||
$total = array( 'spam' => 0, 'banned' => 0, 'virus' => 0, 'header' => 0, 'pending' => 0, 'total' => 0);
|
||||
|
||||
$query = "SELECT date,
|
||||
@ -199,7 +197,7 @@ class DBEngine {
|
||||
$timestamp = CmnFns::formatDateISO($rs['date']);
|
||||
$date = CmnFns::formatDate($timestamp);
|
||||
$totalthisdate = $rs['spam'] + $rs['banned'] + $rs['viruses'] + $rs['badheaders'] + $rs['pending'];
|
||||
$return[$date] = array('spam' => $rs['spam'],
|
||||
$rval[$date] = array('spam' => $rs['spam'],
|
||||
'banned' => $rs['banned'],
|
||||
'virus' => $rs['viruses'],
|
||||
'header' => $rs['badheaders'],
|
||||
@ -208,16 +206,16 @@ class DBEngine {
|
||||
}
|
||||
|
||||
// Total the data
|
||||
foreach ($return as $date => $typearray) {
|
||||
foreach ($rval as $date => $typearray) {
|
||||
foreach ($typearray as $type => $count) {
|
||||
$total[$type] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
$return['Total'] = $total;
|
||||
$rval['Total'] = $total;
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
// User methods -------------------------------------------
|
||||
@ -231,7 +229,7 @@ class DBEngine {
|
||||
|
||||
global $conf;
|
||||
|
||||
$return = array();
|
||||
$rval = array();
|
||||
$total = array('spam' => 0, 'banned' => 0, 'virus' => 0, 'header' => 0, 'pending' => 0, 'total' => 0);
|
||||
|
||||
// Get where clause for recipient email address(es)
|
||||
@ -325,7 +323,7 @@ class DBEngine {
|
||||
$timestamp = CmnFns::formatDateISO($rs['date']);
|
||||
$date = CmnFns::formatDate($timestamp);
|
||||
$totalthisdate = $rs['spam'] + $rs['banned'] + $rs['viruses'] + $rs['badheaders'] + $rs['pending'];
|
||||
$return[$date] = array('spam' => $rs['spam'],
|
||||
$rval[$date] = array('spam' => $rs['spam'],
|
||||
'banned' => $rs['banned'],
|
||||
'virus' => $rs['viruses'],
|
||||
'header' => $rs['badheaders'],
|
||||
@ -334,16 +332,16 @@ class DBEngine {
|
||||
}
|
||||
|
||||
// Total the data
|
||||
foreach ($return as $date => $typearray) {
|
||||
foreach ($rval as $date => $typearray) {
|
||||
foreach ($typearray as $type => $count) {
|
||||
$total[$type] += $count;
|
||||
}
|
||||
}
|
||||
|
||||
$return['Total'] = $total;
|
||||
$rval['Total'] = $total;
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
|
||||
@ -375,7 +373,7 @@ class DBEngine {
|
||||
$sizeLimit = isset ( $conf['app']['displaySizeLimit'] ) && is_numeric( $conf['app']['displaySizeLimit'] ) ?
|
||||
$conf['app']['displaySizeLimit'] : 50;
|
||||
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
if (is_array($search_array)) {
|
||||
$search_clause = "";
|
||||
@ -418,9 +416,16 @@ class DBEngine {
|
||||
}
|
||||
}
|
||||
|
||||
$query = "SELECT msgs.time_num, msgs.from_addr,
|
||||
msgs.mail_id, msgs.subject, msgs.spam_level, msgs.content,
|
||||
msgrcpt.rs, msgs.quar_type, recip.email
|
||||
$query = "SELECT
|
||||
msgs.time_num,
|
||||
msgs.from_addr,
|
||||
msgs.mail_id,
|
||||
msgs.subject,
|
||||
msgs.spam_level,
|
||||
msgs.content,
|
||||
msgrcpt.rs,
|
||||
msgs.quar_type,
|
||||
recip.email
|
||||
FROM msgs
|
||||
INNER JOIN msgrcpt ON msgs.mail_id = msgrcpt.mail_id
|
||||
$join_type maddr AS sender ON msgs.sid = sender.id
|
||||
@ -456,7 +461,7 @@ class DBEngine {
|
||||
|
||||
if ( $get_all ) {
|
||||
while ($rs = $result->fetchRow()) {
|
||||
$return[] = $this->cleanRow($rs);
|
||||
$rval[] = $this->cleanRow($rs);
|
||||
}
|
||||
} else {
|
||||
// the row to start fetching
|
||||
@ -469,13 +474,13 @@ class DBEngine {
|
||||
if (!$row = $result->fetchrow(DB_FETCHMODE_ASSOC, $rownum)) {
|
||||
break;
|
||||
}
|
||||
$return[] = $this->cleanRow($row);
|
||||
$rval[] = $this->cleanRow($row);
|
||||
}
|
||||
}
|
||||
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -486,7 +491,6 @@ class DBEngine {
|
||||
* @return array of message(s)
|
||||
*/
|
||||
function get_message($emailaddress, $mail_id) {
|
||||
|
||||
global $conf;
|
||||
|
||||
# MySQL seems to run faster with a LEFT JOIN
|
||||
@ -498,7 +502,7 @@ class DBEngine {
|
||||
|
||||
$recipEmailClause = $this->convertEmailaddresses2SQL($emailaddress);
|
||||
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
$query = 'SELECT msgs.time_num, msgs.secret_id, msgs.subject, msgs.from_addr, msgs.spam_level,'
|
||||
. ' msgrcpt.rs, recip.email, msgs.host, msgs.content, msgs.quar_type, msgs.quar_loc'
|
||||
@ -522,12 +526,12 @@ class DBEngine {
|
||||
return NULL;
|
||||
}
|
||||
while ($rs = $result->fetchRow()) {
|
||||
$return[] = $this->cleanRow($rs);
|
||||
$rval[] = $this->cleanRow($rs);
|
||||
}
|
||||
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -539,7 +543,6 @@ class DBEngine {
|
||||
* @return array of message(s)
|
||||
*/
|
||||
function update_msgrcpt_rs($mail_id, $mail_rcpt, $flag) {
|
||||
|
||||
// If its a pending message, do not set the rs flag to 'v'
|
||||
$cur_msg_array = $this->get_message($mail_rcpt, $mail_id);
|
||||
$msg_status = $cur_msg_array[0];
|
||||
@ -561,7 +564,6 @@ class DBEngine {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function that returns number of entries for logged in user
|
||||
* where RS flag is equal to $flag
|
||||
@ -570,7 +572,6 @@ class DBEngine {
|
||||
* @return number of message(s)
|
||||
*/
|
||||
function get_count_rs($emailaddresses, $flag) {
|
||||
|
||||
// Get where clause for recipient email address(es)
|
||||
$emailaddr_clause = $this->convertEmailaddresses2SQL($emailaddresses);
|
||||
if ( $emailaddr_clause != '' )
|
||||
@ -617,7 +618,6 @@ class DBEngine {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Auth::isMailAdmin()) {
|
||||
$values = array($mail_id);
|
||||
$query = 'SELECT' . $mail_text_column . ' FROM quarantine ' .
|
||||
@ -640,14 +640,14 @@ class DBEngine {
|
||||
if ($result->numRows() <= 0){
|
||||
return false;
|
||||
}
|
||||
$return = "";
|
||||
$rval = "";
|
||||
while ($rs = $result->fetchRow()) {
|
||||
$return .= $rs['mail_text'];
|
||||
$rval .= $rs['mail_text'];
|
||||
}
|
||||
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -681,11 +681,11 @@ class DBEngine {
|
||||
* @return array with same key => value pairs (except slashes)
|
||||
*/
|
||||
function cleanRow($data) {
|
||||
$return = array();
|
||||
$rval = array();
|
||||
|
||||
foreach ($data as $key => $val)
|
||||
$return[$key] = stripslashes($val);
|
||||
return $return;
|
||||
$rval[$key] = stripslashes($val);
|
||||
return $rval;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -705,11 +705,9 @@ class DBEngine {
|
||||
* @return array containing SQL code
|
||||
*/
|
||||
function convertSearch2SQL($field, $criterion, $string) {
|
||||
|
||||
$result = array();
|
||||
|
||||
if ( $string != '' ) {
|
||||
|
||||
switch ($criterion) {
|
||||
case "contains":
|
||||
$search_clause = "(" . $field . " LIKE '%" . $string . "%')" ;
|
||||
@ -728,7 +726,6 @@ class DBEngine {
|
||||
}
|
||||
array_push($result, $search_clause);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -796,8 +793,8 @@ class DBEngine {
|
||||
$this->check_for_error($result, $query);
|
||||
|
||||
if ($result->numRows() == 1) {
|
||||
$return = $result->fetchRow();
|
||||
return $return['id'];
|
||||
$rval = $result->fetchRow();
|
||||
return $rval['id'];
|
||||
} else if ($result->numRows() == 0
|
||||
&& strpos($recip_email,"@")) {
|
||||
|
||||
@ -927,7 +924,7 @@ class DBEngine {
|
||||
|
||||
function get_user_control_list( $emailaddresses, $order = 'sender', $vert = 'ASC', $search_array, $page, $all = false) {
|
||||
global $conf;
|
||||
$return = Array();
|
||||
$rval = Array();
|
||||
|
||||
// grab the display size limit set in config.php
|
||||
$sizeLimit = (isset ( $conf['app']['displaySizeLimit'] ) && is_numeric( $conf['app']['displaySizeLimit'] ) ?
|
||||
@ -980,13 +977,13 @@ class DBEngine {
|
||||
if (!$row = $result->fetchrow(DB_FETCHMODE_ASSOC, $rownum)) {
|
||||
break;
|
||||
}
|
||||
$return[] = $this->cleanRow($row);
|
||||
$rval[] = $this->cleanRow($row);
|
||||
}
|
||||
|
||||
|
||||
$result->free();
|
||||
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ include_once('lib/CmnFns.class.php');
|
||||
* Provide all database access/manipulation functionality for Exchange Auth
|
||||
*/
|
||||
class ExchAuth {
|
||||
|
||||
// The exchange hostname with port (hostname[:port])
|
||||
var $exchHost;
|
||||
// The exchange LDAP URI (ldap://hostname[:port])
|
||||
@ -56,7 +55,6 @@ class ExchAuth {
|
||||
* @return boolean
|
||||
*/
|
||||
function authUser($username, $password, $domain) {
|
||||
|
||||
$fulluser = $domain.'/'.$username;
|
||||
$mbox = imap_open('{'.$this->exchHost.'/imap}Inbox', $fulluser, $password);
|
||||
if ($mbox === false) {
|
||||
@ -121,6 +119,5 @@ class ExchAuth {
|
||||
);
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -21,7 +21,6 @@ include_once('lib/CmnFns.class.php');
|
||||
* Provide all database access/manipulation functionality for IMAP Auth
|
||||
*/
|
||||
class IMAPAuth {
|
||||
|
||||
// The IMAP hosts with port (hostname[:port])
|
||||
var $imapHosts;
|
||||
// IMAP authentication type
|
||||
@ -60,7 +59,6 @@ class IMAPAuth {
|
||||
$this->imapUsername = $username;
|
||||
|
||||
foreach ($this->imapHosts as $host) { // Try each host in turn
|
||||
|
||||
$host = trim($host);
|
||||
|
||||
switch ($this->imapType) {
|
||||
@ -109,16 +107,12 @@ class IMAPAuth {
|
||||
* @return array containing user information
|
||||
*/
|
||||
function getUserData() {
|
||||
$return = array(
|
||||
$rval = array(
|
||||
'logonName' => $this->imapUsername,
|
||||
'firstName' => $this->imapUsername,
|
||||
'emailAddress' => array( $this->imapUsername.
|
||||
( empty($this->imapDomainName) ? '' :
|
||||
'@'. $this->imapDomainName )
|
||||
)
|
||||
'emailAddress' => array($this->imapUsername.(empty($this->imapDomainName) ? '' : '@'. $this->imapDomainName))
|
||||
);
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -17,9 +17,7 @@
|
||||
*/
|
||||
include_once('lib/CmnFns.class.php');
|
||||
|
||||
|
||||
class LDAPEngine {
|
||||
|
||||
// The directory server, tested with OpenLDAP and Active Directory
|
||||
var $serverType;
|
||||
|
||||
@ -89,7 +87,6 @@ class LDAPEngine {
|
||||
// The user's mail address ($mailAttr value)
|
||||
var $emailAddress;
|
||||
|
||||
|
||||
/**
|
||||
* LDAPEngine constructor to initialize object
|
||||
*/
|
||||
@ -140,7 +137,6 @@ class LDAPEngine {
|
||||
* @param none
|
||||
*/
|
||||
function connect() {
|
||||
|
||||
foreach ($this->hosts as $host) {
|
||||
$ldap_url = ( $this->ssl ? "ldaps://".$host : $host );
|
||||
$this->connection = ldap_connect($ldap_url);
|
||||
@ -218,7 +214,6 @@ class LDAPEngine {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// User methods -------------------------------------------
|
||||
|
||||
/**
|
||||
@ -282,7 +277,6 @@ class LDAPEngine {
|
||||
* @return array
|
||||
*/
|
||||
function searchUserDN($searchFilter) {
|
||||
|
||||
switch ($this->serverType) {
|
||||
case "ldap":
|
||||
if ( $this->searchUser != '' ) {
|
||||
@ -318,14 +312,12 @@ class LDAPEngine {
|
||||
return $dn;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Queries LDAP for user information
|
||||
* @param string $dn
|
||||
* @return boolean indicating success or failure
|
||||
*/
|
||||
function loadUserData($dn) {
|
||||
|
||||
$this->emailAddress = array();
|
||||
|
||||
// We are instered in getting just the user's first name and his/her mail attribute(s)
|
||||
@ -385,12 +377,12 @@ class LDAPEngine {
|
||||
* @return array containing user information
|
||||
*/
|
||||
function getUserData() {
|
||||
$return = array(
|
||||
$rval = array(
|
||||
'logonName' => $this->logonName,
|
||||
'firstName' => $this->firstName,
|
||||
'emailAddress' => $this->emailAddress
|
||||
);
|
||||
return $return;
|
||||
return $rval;
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +98,6 @@ class Link {
|
||||
|
||||
//=============================================
|
||||
|
||||
|
||||
//---------------------------------------------
|
||||
// Getter functions
|
||||
//---------------------------------------------
|
||||
@ -160,7 +159,6 @@ class Link {
|
||||
|
||||
//=============================================
|
||||
|
||||
|
||||
/**
|
||||
* Print out a link without creating a new Link object
|
||||
* @param string $url url to link to
|
||||
|
@ -23,9 +23,8 @@ if ($GLOBALS['conf']['app']['safeMode']) {
|
||||
ini_set('include_path', ( dirname(__FILE__) . '/pear/' . PATH_SEPARATOR . ini_get('include_path') ));
|
||||
include_once('pear/PEAR.php');
|
||||
include_once('pear/Mail/mimeDecode.php');
|
||||
}
|
||||
else {
|
||||
include_once 'PEAR.php';
|
||||
} else {
|
||||
include_once('PEAR.php');
|
||||
include_once('Mail/mimeDecode.php');
|
||||
}
|
||||
|
||||
@ -34,7 +33,6 @@ else {
|
||||
*/
|
||||
|
||||
class MailEngine {
|
||||
|
||||
var $raw; // Raw mail contents
|
||||
var $struct; // The top-level MIME structure
|
||||
var $recipient; // The recipient of the email
|
||||
@ -88,10 +86,11 @@ class MailEngine {
|
||||
function getRawContent($mail_id) {
|
||||
$db = new DBEngine();
|
||||
$this->raw = $db->get_raw_mail($mail_id, $this->recipient);
|
||||
// Mark read
|
||||
|
||||
// Mark read
|
||||
if (in_array($this->recipient, $_SESSION['sessionMail']) && $this->raw) {
|
||||
$db->update_msgrcpt_rs($mail_id,$this->recipient,'v');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -22,8 +22,7 @@ include_once('lib/CmnFns.class.php');
|
||||
if ($GLOBALS['conf']['app']['safeMode']) {
|
||||
ini_set('include_path', ( dirname(__FILE__) . '/pear/' . PATH_SEPARATOR . ini_get('include_path') ));
|
||||
include_once('pear/Mail/mimeDecode.php');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
include_once('Mail/mimeDecode.php');
|
||||
}
|
||||
|
||||
@ -56,7 +55,6 @@ $filelist = array ();
|
||||
$errors = array ();
|
||||
|
||||
function MsgParseBody($struct) {
|
||||
|
||||
global $filelist;
|
||||
global $errors;
|
||||
$ctype_p = strtolower(trim($struct->ctype_primary));
|
||||
@ -113,13 +111,11 @@ function MsgParseBody($struct) {
|
||||
$errors['Portions of text could not be displayed'] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Save the listed filename or notify the
|
||||
// reader that this mail is not displayed completely
|
||||
$attachment = $struct->d_parameters['filename'];
|
||||
$attachment ? array_push($filelist, $attachment) : $errors['Unsupported MIME objects present'] = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,8 +178,7 @@ function FindMultiRel($struct) {
|
||||
// Wrapper script for htmlfilter. Settings taken
|
||||
// from SquirrelMail
|
||||
function sanitizeHTML($body) {
|
||||
if (isset($_COOKIE['lang']) &&
|
||||
file_exists("img/".substr($_COOKIE['lang'],0,2).".blocked_img.png")) {
|
||||
if (isset($_COOKIE['lang']) && file_exists("img/".substr($_COOKIE['lang'],0,2).".blocked_img.png")) {
|
||||
$secremoveimg = "img/".substr($_COOKIE['lang'],0,2).".blocked_img.png";
|
||||
} else {
|
||||
$secremoveimg = "img/blocked_img.png";
|
||||
@ -296,11 +291,7 @@ function sanitizeHTML($body) {
|
||||
)
|
||||
);
|
||||
|
||||
$add_attr_to_tag = Array(
|
||||
"/^a$/i" =>
|
||||
Array('target'=>'"_new"'
|
||||
)
|
||||
);
|
||||
$add_attr_to_tag = Array("/^a$/i" => Array('target'=>'"_new"'));
|
||||
|
||||
$trusted_html = sanitize($body,
|
||||
$tag_list,
|
||||
@ -314,3 +305,4 @@ function sanitizeHTML($body) {
|
||||
|
||||
return $trusted_html;
|
||||
}
|
||||
?>
|
||||
|
@ -468,8 +468,7 @@ class PHPMailer
|
||||
$old_from = ini_get("sendmail_from");
|
||||
ini_set("sendmail_from", $this->Sender);
|
||||
$params = sprintf("-oi -f %s", $this->Sender);
|
||||
$rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
|
||||
$header, $params);
|
||||
$rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header, $params);
|
||||
}
|
||||
else
|
||||
$rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
|
||||
@ -588,8 +587,7 @@ class PHPMailer
|
||||
|
||||
if($this->SMTPAuth)
|
||||
{
|
||||
if(!$this->smtp->Authenticate($this->Username,
|
||||
$this->Password))
|
||||
if(!$this->smtp->Authenticate($this->Username, $this->Password))
|
||||
{
|
||||
$this->SetError($this->Lang("authenticate"));
|
||||
$this->smtp->Reset();
|
||||
@ -685,8 +683,7 @@ class PHPMailer
|
||||
$formatted = $addr[0];
|
||||
else
|
||||
{
|
||||
$formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .
|
||||
$addr[0] . ">";
|
||||
$formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . $addr[0] . ">";
|
||||
}
|
||||
|
||||
return $formatted;
|
||||
@ -1537,5 +1534,4 @@ class PHPMailer
|
||||
$this->CustomHeader[] = explode(":", $custom_header, 2);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -73,7 +73,6 @@ class Pager {
|
||||
var $text_class;
|
||||
var $text_style;
|
||||
|
||||
|
||||
/**
|
||||
* Pager Constructor
|
||||
* Sets up Pager variables and initializes values
|
||||
@ -102,7 +101,6 @@ class Pager {
|
||||
$this->initQueryString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print out the pages as links
|
||||
* Prints out a table of all the pages as links
|
||||
@ -219,8 +217,7 @@ class Pager {
|
||||
// Insert limit into querystring, if it's not there
|
||||
if ( !strstr($this->query_string, "$this->limit_var=") )
|
||||
$this->query_string .= "&$this->limit_var=" . $this->limit;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->query_string = '';
|
||||
}
|
||||
|
||||
@ -249,8 +246,7 @@ class Pager {
|
||||
function printPage($p) {
|
||||
if ($p == $this->cur_page) {
|
||||
echo " <b>[$p]</b> ";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->printLink($p, $p);
|
||||
}
|
||||
}
|
||||
@ -292,8 +288,7 @@ class Pager {
|
||||
'',
|
||||
'Page ' . $page
|
||||
);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo ' <a href="' . $_SERVER['PHP_SELF'] . "?$this->page_var=$page&" . $this->query_string . '"'
|
||||
. ' class="$this->class"'
|
||||
. '>'
|
||||
|
@ -1034,6 +1034,4 @@ class SMTP
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -74,7 +74,6 @@ class Template {
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print welcome header message
|
||||
* This function prints out a table welcoming
|
||||
@ -123,7 +122,6 @@ class Template {
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start main HTML table
|
||||
* @param none
|
||||
@ -137,7 +135,6 @@ class Template {
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* End main HTML table
|
||||
* @param none
|
||||
@ -150,7 +147,6 @@ class Template {
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print HTML footer
|
||||
* This function prints out a tech email
|
||||
|
@ -559,7 +559,8 @@ function defang(&$attvalue){
|
||||
*/
|
||||
spew("$me: Checking '$attvalue' for suspicious content\n");
|
||||
if (strpos($attvalue, '&') === false
|
||||
&& strpos($attvalue, '\\') === false){
|
||||
&& strpos($attvalue, '\\') === false)
|
||||
{
|
||||
spew("$me: no suspicious content found, returning.\n");
|
||||
return;
|
||||
}
|
||||
@ -603,12 +604,7 @@ function unspace(&$attvalue){
|
||||
* @param $add_attr_to_tag See description for sanitize
|
||||
* @return Array with modified attributes.
|
||||
*/
|
||||
function fixatts($tagname,
|
||||
$attary,
|
||||
$rm_attnames,
|
||||
$bad_attvals,
|
||||
$add_attr_to_tag
|
||||
){
|
||||
function fixatts($tagname, $attary, $rm_attnames, $bad_attvals, $add_attr_to_tag) {
|
||||
$me = 'fixatts';
|
||||
spew("$me: Fixing attributes\n");
|
||||
while (list($attname, $attvalue) = each($attary)) {
|
||||
@ -871,15 +867,7 @@ function fixatts($tagname,
|
||||
* @param $add_attr_to_tag see description above
|
||||
* @return sanitized html safe to show on your pages.
|
||||
*/
|
||||
function sanitize($body,
|
||||
$tag_list,
|
||||
$rm_tags_with_content,
|
||||
$self_closing_tags,
|
||||
$force_tag_closing,
|
||||
$rm_attnames,
|
||||
$bad_attvals,
|
||||
$add_attr_to_tag
|
||||
){
|
||||
function sanitize($body, $tag_list, $rm_tags_with_content, $self_closing_tags, $force_tag_closing, $rm_attnames, $bad_attvals, $add_attr_to_tag) {
|
||||
$me = 'sanitize';
|
||||
/**
|
||||
* Normalize rm_tags and rm_tags_with_content.
|
||||
@ -927,8 +915,7 @@ function sanitize($body,
|
||||
$skip_content = false;
|
||||
} else {
|
||||
if ($skip_content == false) {
|
||||
if (isset($open_tags{$tagname}) &&
|
||||
$open_tags{$tagname} > 0){
|
||||
if (isset($open_tags{$tagname}) && $open_tags{$tagname} > 0) {
|
||||
spew("$me: popping '$tagname' from open_tags\n");
|
||||
$open_tags{$tagname}--;
|
||||
} else {
|
||||
@ -949,8 +936,7 @@ function sanitize($body,
|
||||
* See if this is a self-closing type and change
|
||||
* tagtype appropriately.
|
||||
*/
|
||||
if ($tagtype == 1
|
||||
&& in_array($tagname, $self_closing_tags)){
|
||||
if ($tagtype == 1 && in_array($tagname, $self_closing_tags)) {
|
||||
spew("$me: Self-closing tag. Changing tagtype.\n");
|
||||
$tagtype = 3;
|
||||
}
|
||||
@ -958,15 +944,13 @@ function sanitize($body,
|
||||
* See if we should skip this tag and any content
|
||||
* inside it.
|
||||
*/
|
||||
if ($tagtype == 1
|
||||
&& in_array($tagname, $rm_tags_with_content)){
|
||||
if ($tagtype == 1 && in_array($tagname, $rm_tags_with_content)) {
|
||||
spew("$me: removing this tag with content\n");
|
||||
$skip_content = $tagname;
|
||||
} else {
|
||||
if (($rm_tags == false
|
||||
&& in_array($tagname, $tag_list)) ||
|
||||
($rm_tags == true
|
||||
&& !in_array($tagname, $tag_list))){
|
||||
if (($rm_tags == false && in_array($tagname, $tag_list)) ||
|
||||
($rm_tags == true && !in_array($tagname, $tag_list)))
|
||||
{
|
||||
spew("$me: Removing this tag.\n");
|
||||
$tagname = false;
|
||||
} else {
|
||||
@ -982,11 +966,7 @@ function sanitize($body,
|
||||
* This is where we run other checks.
|
||||
*/
|
||||
if (is_array($attary) && sizeof($attary) > 0) {
|
||||
$attary = fixatts($tagname,
|
||||
$attary,
|
||||
$rm_attnames,
|
||||
$bad_attvals,
|
||||
$add_attr_to_tag);
|
||||
$attary = fixatts($tagname, $attary, $rm_attnames, $bad_attvals, $add_attr_to_tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user