mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-24 12:52:19 +09:00
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:
parent
7305cebf38
commit
9aa87c343f
2 changed files with 70 additions and 60 deletions
|
|
@ -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
|
||||
|
|
@ -85,7 +87,7 @@ class Mail extends PHPMailer
|
|||
* Content attachements
|
||||
* @var array
|
||||
*/
|
||||
var $cidAttachments = array();
|
||||
var $cidAttachments = array();
|
||||
|
||||
/**
|
||||
* ???
|
||||
|
|
@ -136,6 +138,7 @@ class Mail extends PHPMailer
|
|||
*/
|
||||
function Mail()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -178,10 +181,10 @@ class Mail extends PHPMailer
|
|||
function useSMTP($auth = NULL, $host = NULL, $user = NULL, $pass = NULL, $secure = NULL, $port = 25)
|
||||
{
|
||||
$this->SMTPAuth = $auth;
|
||||
$this->Host = $host;
|
||||
$this->Host = $host;
|
||||
$this->Username = $user;
|
||||
$this->Password = $pass;
|
||||
$this->Port = $port;
|
||||
$this->Port = $port;
|
||||
|
||||
if($secure == 'ssl' || $secure == 'tls')
|
||||
{
|
||||
|
|
@ -438,7 +441,7 @@ class Mail extends PHPMailer
|
|||
*/
|
||||
function getHTMLContent()
|
||||
{
|
||||
return chunk_split(base64_encode($this->content_type != 'html' ? nl2br($this->content):$this->content));
|
||||
return chunk_split(base64_encode($this->content_type != 'html' ? nl2br($this->content) : $this->content));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -449,7 +452,7 @@ class Mail extends PHPMailer
|
|||
*/
|
||||
function setContentType($mode = 'html')
|
||||
{
|
||||
$this->content_type = $mode == 'html' ? 'html':'';
|
||||
$this->content_type = $mode == 'html' ? 'html' : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -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,13 +566,8 @@ 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();
|
||||
$headers = sprintf(
|
||||
|
|
@ -589,13 +576,8 @@ 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 */
|
||||
|
|
|
|||
|
|
@ -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,8 +34,9 @@ class Mobile {
|
|||
*
|
||||
* @return bool If mobile mode returns true or false
|
||||
*/
|
||||
function isFromMobilePhone() {
|
||||
$oMobile =& Mobile::getInstance();
|
||||
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
|
||||
|
|
@ -111,7 +132,7 @@ class Mobile {
|
|||
|
||||
if($_COOKIE['user-agent'] != md5($_SERVER['HTTP_USER_AGENT']))
|
||||
{
|
||||
setcookie("user-agent",md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path);
|
||||
setcookie("user-agent", md5($_SERVER['HTTP_USER_AGENT']), 0, $xe_web_path);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,10 +147,13 @@ class Mobile {
|
|||
function isMobileCheckByAgent()
|
||||
{
|
||||
static $UACheck;
|
||||
if(isset($UACheck)) return $UACheck;
|
||||
if(isset($UACheck))
|
||||
{
|
||||
return $UACheck;
|
||||
}
|
||||
|
||||
$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');
|
||||
$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,12 +181,15 @@ class Mobile {
|
|||
function isMobilePadCheckByAgent()
|
||||
{
|
||||
static $UACheck;
|
||||
if(isset($UACheck)) return $UACheck;
|
||||
$padAgent = array('iPad','Android','webOS','hp-tablet','PlayBook');
|
||||
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.
|
||||
// $exceptionAgent[0] contains exception agents for all exceptions.
|
||||
$exceptionAgent = array(0 => array('Opera Mini','Opera Mobi'),'Android' => 'Mobile');
|
||||
$exceptionAgent = array(0 => array('Opera Mini', 'Opera Mobi'), 'Android' => 'Mobile');
|
||||
|
||||
foreach($padAgent as $agent)
|
||||
{
|
||||
|
|
@ -202,9 +229,9 @@ class Mobile {
|
|||
*/
|
||||
function setMobile($ismobile)
|
||||
{
|
||||
$oMobile =& Mobile::getInstance();
|
||||
$oMobile = Mobile::getInstance();
|
||||
$oMobile->ismobile = $ismobile;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue