Skip to content
Snippets Groups Projects
Commit 35ce6531 authored by Jared Hancock's avatar Jared Hancock
Browse files

Merge remote branch 'upstream/develop' into develop

parents 34fa4b99 1d75aeb2
No related branches found
No related tags found
No related merge requests found
......@@ -200,10 +200,10 @@ class Email {
function getIdByEmail($email) {
$sql='SELECT email_id FROM '.EMAIL_TABLE.' WHERE email='.db_input($email);
if(($res=db_query($sql)) && db_num_rows($res))
list($id)=db_fetch_row($res);
if(!($res=db_query($sql)) || !db_num_rows($res))
return false;
return $id;
return db_result($res);
}
function lookup($var) {
......
......@@ -94,19 +94,21 @@ class Mail_Parse {
}
// Look for application/tnef attachment and process it
foreach ($this->struct->parts as $i=>$part) {
if (!$part->parts && $part->ctype_primary == 'application'
&& $part->ctype_secondary == 'ms-tnef') {
try {
$tnef = new TnefStreamParser($part->body);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($this->struct->parts[$i]);
}
catch (TnefException $ex) {
// TNEF will remain an attachment
$this->notes[] = 'TNEF parsing exception: '
.$ex->getMessage();
if ($this->struct && $this->struct->parts) {
foreach ($this->struct->parts as $i=>$part) {
if (!@$part->parts && $part->ctype_primary == 'application'
&& $part->ctype_secondary == 'ms-tnef') {
try {
$tnef = new TnefStreamParser($part->body);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($this->struct->parts[$i]);
}
catch (TnefException $ex) {
// TNEF will remain an attachment
$this->notes[] = 'TNEF parsing exception: '
.$ex->getMessage();
}
}
}
}
......@@ -489,6 +491,12 @@ class EmailDataParser {
return $this->err('Email parse failed ['.$parser->getError().']');
$data =array();
$data['emailId'] = 0;
$data['subject'] = $parser->getSubject();
$data['header'] = $parser->getHeader();
$data['mid'] = $parser->getMessageId();
$data['priorityId'] = $parser->getPriority();
//FROM address: who sent the email.
if(($fromlist = $parser->getFromAddressList())) {
$from=$fromlist[0]; //Default.
......@@ -542,10 +550,6 @@ class EmailDataParser {
$data['flags']['bounce'] = TicketFilter::isBounce($data['header']);
}
$data['subject'] = $parser->getSubject();
$data['header'] = $parser->getHeader();
$data['mid'] = $parser->getMessageId();
$data['priorityId'] = $parser->getPriority();
$data['emailId'] = $emailId;
if (($replyto = $parser->getReplyTo())) {
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -16,6 +16,9 @@ if (!function_exists('get_osticket_root_path')) {
}
}
$root = get_osticket_root_path();
define('INCLUDE_DIR', "$root/include/");
define('PEAR_DIR', INCLUDE_DIR."pear/");
ini_set('include_path', './'.PATH_SEPARATOR.INCLUDE_DIR.PATH_SEPARATOR.PEAR_DIR);
if (!function_exists('glob_recursive')) {
# Check PHP syntax across all php files
......
<?php
require_once "class.test.php";
define('INCLUDE_DIR', realpath(dirname(__file__).'/../../../include').'/');
define('PEAR_DIR', INCLUDE_DIR.'/pear/');
require_once INCLUDE_DIR."class.crypto.php";
class TestCrypto extends Test {
......
......@@ -22,4 +22,3 @@ class JsSyntaxTest extends Test {
return 'JsSyntaxTest';
?>
......@@ -33,11 +33,12 @@ class TestValidation extends Test {
$this->assert(Validator::is_email('jared_12@domain.tld'));
$this->assert(Validator::is_email('jared-12@domain.tld'));
// Very likely illegal
// Illegal or unsupported
$this->assert(!Validator::is_email('jared r@domain.tld'));
$this->assert(Validator::is_email('jared@host'));
$this->assert(!Validator::is_email('jared'));
// Odd cases, but legal
$this->assert(Validator::is_email('jared@host'));
$this->assert(Validator::is_email('jared@[127.0.0.1]'));
$this->assert(Validator::is_email('jared@[ipv6:::1]'));
$this->assert(Validator::is_email('*@domain.tld'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment