issue 2119. supporting php 5.4. mail and mobile classes.

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12690 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2013-02-05 01:49:13 +00:00
parent 7305cebf38
commit 9aa87c343f
2 changed files with 70 additions and 60 deletions

View file

@ -1,4 +1,5 @@
<?php
if(version_compare(PHP_VERSION, '5.0.0', '>='))
{
require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php";
@ -15,6 +16,7 @@ else
*/
class Mail extends PHPMailer
{
/**
* Sender name
* @var string
@ -136,6 +138,7 @@ class Mail extends PHPMailer
*/
function Mail()
{
}
/**
@ -483,12 +486,7 @@ class Mail extends PHPMailer
"Content-Description: %s" . $this->eol .
"Content-Disposition: attachment;" . $this->eol .
"\tfilename=\"%s\"" . $this->eol . $this->eol .
"%s" . $this->eol . $this->eol,
$type,
$filename,
$filename,
$filename,
$chunks);
"%s" . $this->eol . $this->eol, $type, $filename, $filename, $filename, $chunks);
$res[] = $tempBody;
}
$this->body = implode("", $res);
@ -536,13 +534,7 @@ class Mail extends PHPMailer
"Content-ID: <%s>" . $this->eol .
"Content-Description: %s" . $this->eol .
"Content-Location: %s" . $this->eol . $this->eol .
"%s" . $this->eol . $this->eol,
$type,
$filename,
$cid,
$filename,
$filename,
$chunks);
"%s" . $this->eol . $this->eol, $type, $filename, $cid, $filename, $filename, $chunks);
$res[] = $tempBody;
}
$this->body = implode("", $res);
@ -574,12 +566,7 @@ class Mail extends PHPMailer
"Content-Disposition: inline" . $this->eol . $this->eol .
"%s" .
"--%s--" .
"",
$boundary,
$this->getPlainContent(),
$boundary,
$this->getHTMLContent(),
$boundary
"", $boundary, $this->getPlainContent(), $boundary, $this->getHTMLContent(), $boundary
);
$this->procCidAttachments();
$this->procAttachments();
@ -589,12 +576,7 @@ class Mail extends PHPMailer
"%s" .
"%s" .
"%s" .
"MIME-Version: 1.0" . $this->eol . "",
$this->getSender(),
$this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol):"",
$this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol):"",
$this->bcc ? ("Bcc: " . $this->bcc . $this->eol):"",
$this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol):""
"MIME-Version: 1.0" . $this->eol . "", $this->getSender(), $this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol) : "", $this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol) : "", $this->bcc ? ("Bcc: " . $this->bcc . $this->eol) : "", $this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol) : ""
);
$headers .= $this->header;
if($this->additional_params)
@ -739,6 +721,7 @@ class Mail extends PHPMailer
return "unknown/" . trim($fileSuffix[0], ".");
}
}
}
/* End of file Mail.class.php */
/* Location: ./classes/mail/Mail.class.php */

View file

@ -5,21 +5,27 @@
*
* @author NHN (developers@xpressengine.com)
*/
class Mobile {
class Mobile
{
/**
* Whether mobile or not mobile mode
* @var bool
*/
var $ismobile = null;
var $ismobile = NULL;
/**
* Get instance of Mobile class(for singleton)
*
* @return Mobile
*/
function &getInstance() {
function &getInstance()
{
static $theInstance;
if(!isset($theInstance)) $theInstance = new Mobile();
if(!isset($theInstance))
{
$theInstance = new Mobile();
}
return $theInstance;
}
@ -28,7 +34,8 @@ class Mobile {
*
* @return bool If mobile mode returns true or false
*/
function isFromMobilePhone() {
function isFromMobilePhone()
{
$oMobile = & Mobile::getInstance();
return $oMobile->_isFromMobilePhone();
}
@ -38,11 +45,16 @@ class Mobile {
*
* @return bool
*/
function _isFromMobilePhone() {
if($this->ismobile !== null) return $this->ismobile;
function _isFromMobilePhone()
{
if($this->ismobile !== NULL)
{
return $this->ismobile;
}
$db_info = Context::getDBInfo();
if($db_info->use_mobile_view != "Y" || Context::get('full_browse') || $_COOKIE["FullBrowse"]) {
if($db_info->use_mobile_view != "Y" || Context::get('full_browse') || $_COOKIE["FullBrowse"])
{
return ($this->ismobile = false);
}
@ -52,19 +64,28 @@ class Mobile {
$this->ismobile = FALSE;
$m = Context::get('m');
if(strlen($m)==1) {
if($m == "1") {
$this->ismobile = true;
} elseif($m == "0") {
$this->ismobile = false;
if(strlen($m) == 1)
{
if($m == "1")
{
$this->ismobile = TRUE;
}
} elseif(isset($_COOKIE['mobile'])) {
elseif($m == "0")
{
$this->ismobile = FALSE;
}
}
elseif(isset($_COOKIE['mobile']))
{
if($_COOKIE['user-agent'] == md5($_SERVER['HTTP_USER_AGENT']))
{
if($_COOKIE['mobile'] == 'true') {
$this->ismobile = true;
} else {
$this->ismobile = false;
if($_COOKIE['mobile'] == 'true')
{
$this->ismobile = TRUE;
}
else
{
$this->ismobile = FALSE;
}
}
else
@ -126,9 +147,12 @@ class Mobile {
function isMobileCheckByAgent()
{
static $UACheck;
if(isset($UACheck)) return $UACheck;
if(isset($UACheck))
{
return $UACheck;
}
$oMobile =& Mobile::getInstance();
$oMobile = Mobile::getInstance();
$mobileAgent = array('iPod', 'iPhone', 'Android', 'BlackBerry', 'SymbianOS', 'Bada', 'Tizen', 'Kindle', 'Wii', 'SCH-', 'SPH-', 'CANU-', 'Windows Phone', 'Windows CE', 'POLARIS', 'Palm', 'Dorothy Browser', 'Mobile', 'Opera Mobi', 'Opera Mini', 'Minimo', 'AvantGo', 'NetFront', 'Nokia', 'LGPlayer', 'SonyEricsson', 'HTC');
if($oMobile->isMobilePadCheckByAgent())
@ -157,7 +181,10 @@ class Mobile {
function isMobilePadCheckByAgent()
{
static $UACheck;
if(isset($UACheck)) return $UACheck;
if(isset($UACheck))
{
return $UACheck;
}
$padAgent = array('iPad', 'Android', 'webOS', 'hp-tablet', 'PlayBook');
// Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device.
@ -202,9 +229,9 @@ class Mobile {
*/
function setMobile($ismobile)
{
$oMobile =& Mobile::getInstance();
$oMobile = Mobile::getInstance();
$oMobile->ismobile = $ismobile;
}
}
}
?>