From a9618e2cff58cc68f992199b39ed187988fde7e1 Mon Sep 17 00:00:00 2001 From: Edward Date: Fri, 1 Mar 2019 15:25:37 +0800 Subject: [PATCH] Fix #5784 - COVERAGE BY REGION: Others --- Images.php | 19 ++++++++++--------- Mailer.php | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Images.php b/Images.php index 3a4b741b..4d2fd145 100644 --- a/Images.php +++ b/Images.php @@ -44,8 +44,6 @@ class Pman_Core_Images extends Pman // tables that do not need authentication checks before serving. var $public_image_tables = array(); - var $is_email = false; - var $sizes = array( '100', '100x100', @@ -77,6 +75,7 @@ class Pman_Core_Images extends Pman var $as_mimetype = false; var $method = 'inline'; var $page = false; + var $is_local = false; function get($s, $opts=array()) // determin what to serve!!!! { @@ -85,9 +84,7 @@ class Pman_Core_Images extends Pman // return $this->post(); //} - if(!empty($_REQUEST['is_email'])) { - $this->is_email = true; - } + $this->is_local = (!empty($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'localhost') ? true : false; $this->as_mimetype = empty($_REQUEST['as']) ? '' : $_REQUEST['as']; @@ -188,11 +185,11 @@ class Pman_Core_Images extends Pman $this->imgErr("image has been removed or deleted.",$s); } + if($this->is_local) { + return $this->serve($img); + } + if (!$this->authUser && !in_array($img->ontable,$this->public_image_tables)) { - - if($this->is_email) { - return $this->serve($img); - } if ($img->ontable != 'core_company') { $this->imgErr("not-authenticated {$img->ontable}",$s); @@ -337,6 +334,10 @@ class Pman_Core_Images extends Pman } function validateSize() { + if($this->is_local) { + return true; + } + if (($this->authUser && !empty($this->authUser->company_id) && $this->authUser->company()->comptype=='OWNER') || $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) { return true; diff --git a/Mailer.php b/Mailer.php index 1211e4ee..7da09a83 100644 --- a/Mailer.php +++ b/Mailer.php @@ -588,7 +588,6 @@ class Pman_Core_Mailer { $real_url = str_replace(' ', '%20', $this->mapurl($url)); $a = new HTTP_Request($real_url); - $a->addQueryString('is_email', 1); $a->sendRequest(); $data = $a->getResponseBody(); -- 2.39.2