mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-03 22:57:43 +02:00
Improved codestyle and added to start using phpcs to check code style, fix #95.
This commit is contained in:
10
CImage.php
10
CImage.php
@@ -976,7 +976,7 @@ class CImage
|
|||||||
$this->cropHeight = round($height / $ratio);
|
$this->cropHeight = round($height / $ratio);
|
||||||
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Use newWidth and newHeigh as defined width/height,
|
// Use newWidth and newHeigh as defined width/height,
|
||||||
// image should fit the area.
|
// image should fit the area.
|
||||||
@@ -1509,7 +1509,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Resize by fill to fit
|
// Resize by fill to fit
|
||||||
$this->log("Resizing using strategy - Fill to fit");
|
$this->log("Resizing using strategy - Fill to fit");
|
||||||
@@ -1548,7 +1548,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
} elseif (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
||||||
|
|
||||||
// Resize it
|
// Resize it
|
||||||
$this->log("Resizing, new height and/or width");
|
$this->log("Resizing, new height and/or width");
|
||||||
@@ -1569,10 +1569,10 @@ class CImage
|
|||||||
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
} else if ($this->newWidth > $this->width) {
|
} elseif ($this->newWidth > $this->width) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$cropY = round(($this->height - $this->newHeight) / 2);
|
$cropY = round(($this->height - $this->newHeight) / 2);
|
||||||
} else if ($this->newHeight > $this->height) {
|
} elseif ($this->newHeight > $this->height) {
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
$cropX = round(($this->width - $this->newWidth) / 2);
|
$cropX = round(($this->width - $this->newWidth) / 2);
|
||||||
}
|
}
|
||||||
|
@@ -145,7 +145,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
function setHeaderFields() {
|
public function setHeaderFields()
|
||||||
|
{
|
||||||
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
||||||
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
||||||
|
|
||||||
@@ -164,8 +165,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to saved file or false if not saved.
|
* @return string as path to saved file or false if not saved.
|
||||||
*/
|
*/
|
||||||
function save() {
|
public function save()
|
||||||
|
{
|
||||||
$this->cache = array();
|
$this->cache = array();
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
@@ -201,8 +202,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to cached file.
|
* @return string as path to cached file.
|
||||||
*/
|
*/
|
||||||
function updateCacheDetails() {
|
public function updateCacheDetails()
|
||||||
|
{
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
$lastModified = $this->http->getLastModified();
|
$lastModified = $this->http->getLastModified();
|
||||||
@@ -227,8 +228,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to downloaded file or false if failed.
|
* @return string as path to downloaded file or false if failed.
|
||||||
*/
|
*/
|
||||||
function download($url) {
|
public function download($url)
|
||||||
|
{
|
||||||
$this->http = new CHttpGet();
|
$this->http = new CHttpGet();
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
@@ -252,7 +253,7 @@ class CRemoteImage
|
|||||||
if ($this->status === 200) {
|
if ($this->status === 200) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->save();
|
return $this->save();
|
||||||
} else if ($this->status === 304) {
|
} elseif ($this->status === 304) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->updateCacheDetails();
|
return $this->updateCacheDetails();
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ Revision history
|
|||||||
v0.7.0.x (latest)
|
v0.7.0.x (latest)
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
|
* Improved codestyle and added `phpcs.xml` to start using phpcs to check code style, fix #95.
|
||||||
* Adding `composer.json` for publishing on packagist.
|
* Adding `composer.json` for publishing on packagist.
|
||||||
* Add permalink to setup for comparing images with `webroot/compare/compare.php`, fix #92.
|
* Add permalink to setup for comparing images with `webroot/compare/compare.php`, fix #92.
|
||||||
* Allow space in filename by using `urlencode()` and allow space as valid filenam character. fix #91.
|
* Allow space in filename by using `urlencode()` and allow space as valid filenam character. fix #91.
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
spl_autoload_register(function ($class) {
|
spl_autoload_register(function ($class) {
|
||||||
//$path = CIMAGE_SOURCE_PATH . "/{$class}.php";
|
//$path = CIMAGE_SOURCE_PATH . "/{$class}.php";
|
||||||
$path = __DIR__ . "/{$class}.php";
|
$path = __DIR__ . "/{$class}.php";
|
||||||
if(is_file($path)) {
|
if (is_file($path)) {
|
||||||
require($path);
|
require($path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
32
phpcs.xml
Normal file
32
phpcs.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="PHPCS rule set">
|
||||||
|
<description>Custom rule set.</description>
|
||||||
|
|
||||||
|
<file>.</file>
|
||||||
|
<file>test</file>
|
||||||
|
<file>autoload.php</file>
|
||||||
|
|
||||||
|
<exclude-pattern>docs/*</exclude-pattern>
|
||||||
|
<exclude-pattern>coverage/*</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/imgs.php</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/imgp.php</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/imgd.php</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/test/*</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/js/*</exclude-pattern>
|
||||||
|
<exclude-pattern>webroot/compare/*</exclude-pattern>
|
||||||
|
|
||||||
|
<arg name="encoding" value="utf-8"/>
|
||||||
|
<!--<arg name="extensions" value=".php"/>-->
|
||||||
|
<!--<arg name="colors" value="1"/>-->
|
||||||
|
<!--<arg name="warning-severity" value="5"/>-->
|
||||||
|
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" /> <exclude name="Squiz.Commenting.FileComment" />
|
||||||
|
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
||||||
|
-->
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</ruleset>
|
@@ -3,7 +3,7 @@
|
|||||||
* A testclass
|
* A testclass
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class CImage_RemoteDownloadTest extends \PHPUnit_Framework_TestCase
|
class CImageRemoteDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* remote_whitelist
|
* remote_whitelist
|
@@ -114,7 +114,7 @@ if (isset($_GET['input1'])) {
|
|||||||
"stack": <?=$_GET['stack']?>
|
"stack": <?=$_GET['stack']?>
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
} else if (isset($script)) {
|
} elseif (isset($script)) {
|
||||||
// Use default setup from js configuration
|
// Use default setup from js configuration
|
||||||
echo $script;
|
echo $script;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -135,7 +135,7 @@ $configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php';
|
|||||||
|
|
||||||
if (is_file($configFile)) {
|
if (is_file($configFile)) {
|
||||||
$config = require $configFile;
|
$config = require $configFile;
|
||||||
} else if (!isset($config)) {
|
} elseif (!isset($config)) {
|
||||||
$config = array();
|
$config = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,14 +171,14 @@ if ($mode == 'strict') {
|
|||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'production') {
|
} elseif ($mode == 'production') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'development') {
|
} elseif ($mode == 'development') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@@ -200,7 +200,7 @@ $defaultTimezone = getConfig('default_timezone', null);
|
|||||||
|
|
||||||
if ($defaultTimezone) {
|
if ($defaultTimezone) {
|
||||||
date_default_timezone_set($defaultTimezone);
|
date_default_timezone_set($defaultTimezone);
|
||||||
} else if (!ini_get('default_timezone')) {
|
} elseif (!ini_get('default_timezone')) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,13 +247,13 @@ $refererHost = parse_url($referer, PHP_URL_HOST);
|
|||||||
if (!$allowHotlinking) {
|
if (!$allowHotlinking) {
|
||||||
if ($passwordMatch) {
|
if ($passwordMatch) {
|
||||||
; // Always allow when password match
|
; // Always allow when password match
|
||||||
} else if ($passwordMatch === false) {
|
} elseif ($passwordMatch === false) {
|
||||||
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
||||||
} else if (!$referer) {
|
} elseif (!$referer) {
|
||||||
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
||||||
} else if (strcmp($serverName, $refererHost) == 0) {
|
} elseif (strcmp($serverName, $refererHost) == 0) {
|
||||||
; // Allow when serverName matches refererHost
|
; // Allow when serverName matches refererHost
|
||||||
} else if (!empty($hotlinkingWhitelist)) {
|
} elseif (!empty($hotlinkingWhitelist)) {
|
||||||
|
|
||||||
$allowedByWhitelist = false;
|
$allowedByWhitelist = false;
|
||||||
foreach ($hotlinkingWhitelist as $val) {
|
foreach ($hotlinkingWhitelist as $val) {
|
||||||
@@ -285,7 +285,7 @@ $cimageClass = getConfig('cimage_class', false);
|
|||||||
|
|
||||||
if ($autoloader) {
|
if ($autoloader) {
|
||||||
require $autoloader;
|
require $autoloader;
|
||||||
} else if ($cimageClass) {
|
} elseif ($cimageClass) {
|
||||||
require $cimageClass;
|
require $cimageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +355,7 @@ if ($allowRemote && $img->isRemoteSource($srcImage)) {
|
|||||||
|
|
||||||
// If source is a remote file, ignore local file checks.
|
// If source is a remote file, ignore local file checks.
|
||||||
|
|
||||||
} else if ($imagePathConstraint) {
|
} elseif ($imagePathConstraint) {
|
||||||
|
|
||||||
// Check that the image is a file below the directory 'image_path'.
|
// Check that the image is a file below the directory 'image_path'.
|
||||||
$pathToImage = realpath($imagePath . $srcImage);
|
$pathToImage = realpath($imagePath . $srcImage);
|
||||||
@@ -807,7 +807,7 @@ if ($alias && $aliasPath && $passwordMatch) {
|
|||||||
preg_match($validAliasname, $alias)
|
preg_match($validAliasname, $alias)
|
||||||
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
||||||
|
|
||||||
} else if ($alias) {
|
} elseif ($alias) {
|
||||||
errorPage('Alias is not enabled in the config file or password not matching.');
|
errorPage('Alias is not enabled in the config file or password not matching.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -433,7 +433,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
function setHeaderFields() {
|
public function setHeaderFields()
|
||||||
|
{
|
||||||
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
||||||
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
||||||
|
|
||||||
@@ -452,8 +453,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to saved file or false if not saved.
|
* @return string as path to saved file or false if not saved.
|
||||||
*/
|
*/
|
||||||
function save() {
|
public function save()
|
||||||
|
{
|
||||||
$this->cache = array();
|
$this->cache = array();
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
@@ -489,8 +490,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to cached file.
|
* @return string as path to cached file.
|
||||||
*/
|
*/
|
||||||
function updateCacheDetails() {
|
public function updateCacheDetails()
|
||||||
|
{
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
$lastModified = $this->http->getLastModified();
|
$lastModified = $this->http->getLastModified();
|
||||||
@@ -515,8 +516,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to downloaded file or false if failed.
|
* @return string as path to downloaded file or false if failed.
|
||||||
*/
|
*/
|
||||||
function download($url) {
|
public function download($url)
|
||||||
|
{
|
||||||
$this->http = new CHttpGet();
|
$this->http = new CHttpGet();
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
@@ -540,7 +541,7 @@ class CRemoteImage
|
|||||||
if ($this->status === 200) {
|
if ($this->status === 200) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->save();
|
return $this->save();
|
||||||
} else if ($this->status === 304) {
|
} elseif ($this->status === 304) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->updateCacheDetails();
|
return $this->updateCacheDetails();
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1574,7 @@ class CImage
|
|||||||
$this->cropHeight = round($height / $ratio);
|
$this->cropHeight = round($height / $ratio);
|
||||||
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Use newWidth and newHeigh as defined width/height,
|
// Use newWidth and newHeigh as defined width/height,
|
||||||
// image should fit the area.
|
// image should fit the area.
|
||||||
@@ -2106,7 +2107,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Resize by fill to fit
|
// Resize by fill to fit
|
||||||
$this->log("Resizing using strategy - Fill to fit");
|
$this->log("Resizing using strategy - Fill to fit");
|
||||||
@@ -2145,7 +2146,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
} elseif (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
||||||
|
|
||||||
// Resize it
|
// Resize it
|
||||||
$this->log("Resizing, new height and/or width");
|
$this->log("Resizing, new height and/or width");
|
||||||
@@ -2166,10 +2167,10 @@ class CImage
|
|||||||
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
} else if ($this->newWidth > $this->width) {
|
} elseif ($this->newWidth > $this->width) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$cropY = round(($this->height - $this->newHeight) / 2);
|
$cropY = round(($this->height - $this->newHeight) / 2);
|
||||||
} else if ($this->newHeight > $this->height) {
|
} elseif ($this->newHeight > $this->height) {
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
$cropX = round(($this->width - $this->newWidth) / 2);
|
$cropX = round(($this->width - $this->newWidth) / 2);
|
||||||
}
|
}
|
||||||
@@ -3177,7 +3178,7 @@ $configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php';
|
|||||||
|
|
||||||
if (is_file($configFile)) {
|
if (is_file($configFile)) {
|
||||||
$config = require $configFile;
|
$config = require $configFile;
|
||||||
} else if (!isset($config)) {
|
} elseif (!isset($config)) {
|
||||||
$config = array();
|
$config = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3213,14 +3214,14 @@ if ($mode == 'strict') {
|
|||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'production') {
|
} elseif ($mode == 'production') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'development') {
|
} elseif ($mode == 'development') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@@ -3242,7 +3243,7 @@ $defaultTimezone = getConfig('default_timezone', null);
|
|||||||
|
|
||||||
if ($defaultTimezone) {
|
if ($defaultTimezone) {
|
||||||
date_default_timezone_set($defaultTimezone);
|
date_default_timezone_set($defaultTimezone);
|
||||||
} else if (!ini_get('default_timezone')) {
|
} elseif (!ini_get('default_timezone')) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3289,13 +3290,13 @@ $refererHost = parse_url($referer, PHP_URL_HOST);
|
|||||||
if (!$allowHotlinking) {
|
if (!$allowHotlinking) {
|
||||||
if ($passwordMatch) {
|
if ($passwordMatch) {
|
||||||
; // Always allow when password match
|
; // Always allow when password match
|
||||||
} else if ($passwordMatch === false) {
|
} elseif ($passwordMatch === false) {
|
||||||
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
||||||
} else if (!$referer) {
|
} elseif (!$referer) {
|
||||||
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
||||||
} else if (strcmp($serverName, $refererHost) == 0) {
|
} elseif (strcmp($serverName, $refererHost) == 0) {
|
||||||
; // Allow when serverName matches refererHost
|
; // Allow when serverName matches refererHost
|
||||||
} else if (!empty($hotlinkingWhitelist)) {
|
} elseif (!empty($hotlinkingWhitelist)) {
|
||||||
|
|
||||||
$allowedByWhitelist = false;
|
$allowedByWhitelist = false;
|
||||||
foreach ($hotlinkingWhitelist as $val) {
|
foreach ($hotlinkingWhitelist as $val) {
|
||||||
@@ -3327,7 +3328,7 @@ $cimageClass = getConfig('cimage_class', false);
|
|||||||
|
|
||||||
if ($autoloader) {
|
if ($autoloader) {
|
||||||
require $autoloader;
|
require $autoloader;
|
||||||
} else if ($cimageClass) {
|
} elseif ($cimageClass) {
|
||||||
require $cimageClass;
|
require $cimageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3397,7 +3398,7 @@ if ($allowRemote && $img->isRemoteSource($srcImage)) {
|
|||||||
|
|
||||||
// If source is a remote file, ignore local file checks.
|
// If source is a remote file, ignore local file checks.
|
||||||
|
|
||||||
} else if ($imagePathConstraint) {
|
} elseif ($imagePathConstraint) {
|
||||||
|
|
||||||
// Check that the image is a file below the directory 'image_path'.
|
// Check that the image is a file below the directory 'image_path'.
|
||||||
$pathToImage = realpath($imagePath . $srcImage);
|
$pathToImage = realpath($imagePath . $srcImage);
|
||||||
@@ -3849,7 +3850,7 @@ if ($alias && $aliasPath && $passwordMatch) {
|
|||||||
preg_match($validAliasname, $alias)
|
preg_match($validAliasname, $alias)
|
||||||
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
||||||
|
|
||||||
} else if ($alias) {
|
} elseif ($alias) {
|
||||||
errorPage('Alias is not enabled in the config file or password not matching.');
|
errorPage('Alias is not enabled in the config file or password not matching.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -433,7 +433,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
function setHeaderFields() {
|
public function setHeaderFields()
|
||||||
|
{
|
||||||
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
||||||
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
||||||
|
|
||||||
@@ -452,8 +453,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to saved file or false if not saved.
|
* @return string as path to saved file or false if not saved.
|
||||||
*/
|
*/
|
||||||
function save() {
|
public function save()
|
||||||
|
{
|
||||||
$this->cache = array();
|
$this->cache = array();
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
@@ -489,8 +490,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to cached file.
|
* @return string as path to cached file.
|
||||||
*/
|
*/
|
||||||
function updateCacheDetails() {
|
public function updateCacheDetails()
|
||||||
|
{
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
$lastModified = $this->http->getLastModified();
|
$lastModified = $this->http->getLastModified();
|
||||||
@@ -515,8 +516,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to downloaded file or false if failed.
|
* @return string as path to downloaded file or false if failed.
|
||||||
*/
|
*/
|
||||||
function download($url) {
|
public function download($url)
|
||||||
|
{
|
||||||
$this->http = new CHttpGet();
|
$this->http = new CHttpGet();
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
@@ -540,7 +541,7 @@ class CRemoteImage
|
|||||||
if ($this->status === 200) {
|
if ($this->status === 200) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->save();
|
return $this->save();
|
||||||
} else if ($this->status === 304) {
|
} elseif ($this->status === 304) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->updateCacheDetails();
|
return $this->updateCacheDetails();
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1574,7 @@ class CImage
|
|||||||
$this->cropHeight = round($height / $ratio);
|
$this->cropHeight = round($height / $ratio);
|
||||||
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Use newWidth and newHeigh as defined width/height,
|
// Use newWidth and newHeigh as defined width/height,
|
||||||
// image should fit the area.
|
// image should fit the area.
|
||||||
@@ -2106,7 +2107,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Resize by fill to fit
|
// Resize by fill to fit
|
||||||
$this->log("Resizing using strategy - Fill to fit");
|
$this->log("Resizing using strategy - Fill to fit");
|
||||||
@@ -2145,7 +2146,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
} elseif (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
||||||
|
|
||||||
// Resize it
|
// Resize it
|
||||||
$this->log("Resizing, new height and/or width");
|
$this->log("Resizing, new height and/or width");
|
||||||
@@ -2166,10 +2167,10 @@ class CImage
|
|||||||
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
} else if ($this->newWidth > $this->width) {
|
} elseif ($this->newWidth > $this->width) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$cropY = round(($this->height - $this->newHeight) / 2);
|
$cropY = round(($this->height - $this->newHeight) / 2);
|
||||||
} else if ($this->newHeight > $this->height) {
|
} elseif ($this->newHeight > $this->height) {
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
$cropX = round(($this->width - $this->newWidth) / 2);
|
$cropX = round(($this->width - $this->newWidth) / 2);
|
||||||
}
|
}
|
||||||
@@ -3177,7 +3178,7 @@ $configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php';
|
|||||||
|
|
||||||
if (is_file($configFile)) {
|
if (is_file($configFile)) {
|
||||||
$config = require $configFile;
|
$config = require $configFile;
|
||||||
} else if (!isset($config)) {
|
} elseif (!isset($config)) {
|
||||||
$config = array();
|
$config = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3213,14 +3214,14 @@ if ($mode == 'strict') {
|
|||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'production') {
|
} elseif ($mode == 'production') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'development') {
|
} elseif ($mode == 'development') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@@ -3242,7 +3243,7 @@ $defaultTimezone = getConfig('default_timezone', null);
|
|||||||
|
|
||||||
if ($defaultTimezone) {
|
if ($defaultTimezone) {
|
||||||
date_default_timezone_set($defaultTimezone);
|
date_default_timezone_set($defaultTimezone);
|
||||||
} else if (!ini_get('default_timezone')) {
|
} elseif (!ini_get('default_timezone')) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3289,13 +3290,13 @@ $refererHost = parse_url($referer, PHP_URL_HOST);
|
|||||||
if (!$allowHotlinking) {
|
if (!$allowHotlinking) {
|
||||||
if ($passwordMatch) {
|
if ($passwordMatch) {
|
||||||
; // Always allow when password match
|
; // Always allow when password match
|
||||||
} else if ($passwordMatch === false) {
|
} elseif ($passwordMatch === false) {
|
||||||
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
||||||
} else if (!$referer) {
|
} elseif (!$referer) {
|
||||||
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
||||||
} else if (strcmp($serverName, $refererHost) == 0) {
|
} elseif (strcmp($serverName, $refererHost) == 0) {
|
||||||
; // Allow when serverName matches refererHost
|
; // Allow when serverName matches refererHost
|
||||||
} else if (!empty($hotlinkingWhitelist)) {
|
} elseif (!empty($hotlinkingWhitelist)) {
|
||||||
|
|
||||||
$allowedByWhitelist = false;
|
$allowedByWhitelist = false;
|
||||||
foreach ($hotlinkingWhitelist as $val) {
|
foreach ($hotlinkingWhitelist as $val) {
|
||||||
@@ -3327,7 +3328,7 @@ $cimageClass = getConfig('cimage_class', false);
|
|||||||
|
|
||||||
if ($autoloader) {
|
if ($autoloader) {
|
||||||
require $autoloader;
|
require $autoloader;
|
||||||
} else if ($cimageClass) {
|
} elseif ($cimageClass) {
|
||||||
require $cimageClass;
|
require $cimageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3397,7 +3398,7 @@ if ($allowRemote && $img->isRemoteSource($srcImage)) {
|
|||||||
|
|
||||||
// If source is a remote file, ignore local file checks.
|
// If source is a remote file, ignore local file checks.
|
||||||
|
|
||||||
} else if ($imagePathConstraint) {
|
} elseif ($imagePathConstraint) {
|
||||||
|
|
||||||
// Check that the image is a file below the directory 'image_path'.
|
// Check that the image is a file below the directory 'image_path'.
|
||||||
$pathToImage = realpath($imagePath . $srcImage);
|
$pathToImage = realpath($imagePath . $srcImage);
|
||||||
@@ -3849,7 +3850,7 @@ if ($alias && $aliasPath && $passwordMatch) {
|
|||||||
preg_match($validAliasname, $alias)
|
preg_match($validAliasname, $alias)
|
||||||
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
||||||
|
|
||||||
} else if ($alias) {
|
} elseif ($alias) {
|
||||||
errorPage('Alias is not enabled in the config file or password not matching.');
|
errorPage('Alias is not enabled in the config file or password not matching.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -433,7 +433,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
function setHeaderFields() {
|
public function setHeaderFields()
|
||||||
|
{
|
||||||
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
$this->http->setHeader("User-Agent", "CImage/0.7.0 (PHP/". phpversion() . " cURL)");
|
||||||
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
$this->http->setHeader("Accept", "image/jpeg,image/png,image/gif");
|
||||||
|
|
||||||
@@ -452,8 +453,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to saved file or false if not saved.
|
* @return string as path to saved file or false if not saved.
|
||||||
*/
|
*/
|
||||||
function save() {
|
public function save()
|
||||||
|
{
|
||||||
$this->cache = array();
|
$this->cache = array();
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
@@ -489,8 +490,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to cached file.
|
* @return string as path to cached file.
|
||||||
*/
|
*/
|
||||||
function updateCacheDetails() {
|
public function updateCacheDetails()
|
||||||
|
{
|
||||||
$date = $this->http->getDate(time());
|
$date = $this->http->getDate(time());
|
||||||
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
$maxAge = $this->http->getMaxAge($this->defaultMaxAge);
|
||||||
$lastModified = $this->http->getLastModified();
|
$lastModified = $this->http->getLastModified();
|
||||||
@@ -515,8 +516,8 @@ class CRemoteImage
|
|||||||
*
|
*
|
||||||
* @return string as path to downloaded file or false if failed.
|
* @return string as path to downloaded file or false if failed.
|
||||||
*/
|
*/
|
||||||
function download($url) {
|
public function download($url)
|
||||||
|
{
|
||||||
$this->http = new CHttpGet();
|
$this->http = new CHttpGet();
|
||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
|
|
||||||
@@ -540,7 +541,7 @@ class CRemoteImage
|
|||||||
if ($this->status === 200) {
|
if ($this->status === 200) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->save();
|
return $this->save();
|
||||||
} else if ($this->status === 304) {
|
} elseif ($this->status === 304) {
|
||||||
$this->isCacheWritable();
|
$this->isCacheWritable();
|
||||||
return $this->updateCacheDetails();
|
return $this->updateCacheDetails();
|
||||||
}
|
}
|
||||||
@@ -1573,7 +1574,7 @@ class CImage
|
|||||||
$this->cropHeight = round($height / $ratio);
|
$this->cropHeight = round($height / $ratio);
|
||||||
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
$this->log("Crop width, height, ratio: $this->cropWidth x $this->cropHeight ($ratio).");
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Use newWidth and newHeigh as defined width/height,
|
// Use newWidth and newHeigh as defined width/height,
|
||||||
// image should fit the area.
|
// image should fit the area.
|
||||||
@@ -2106,7 +2107,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if ($this->fillToFit) {
|
} elseif ($this->fillToFit) {
|
||||||
|
|
||||||
// Resize by fill to fit
|
// Resize by fill to fit
|
||||||
$this->log("Resizing using strategy - Fill to fit");
|
$this->log("Resizing using strategy - Fill to fit");
|
||||||
@@ -2145,7 +2146,7 @@ class CImage
|
|||||||
$this->width = $this->newWidth;
|
$this->width = $this->newWidth;
|
||||||
$this->height = $this->newHeight;
|
$this->height = $this->newHeight;
|
||||||
|
|
||||||
} else if (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
} elseif (!($this->newWidth == $this->width && $this->newHeight == $this->height)) {
|
||||||
|
|
||||||
// Resize it
|
// Resize it
|
||||||
$this->log("Resizing, new height and/or width");
|
$this->log("Resizing, new height and/or width");
|
||||||
@@ -2166,10 +2167,10 @@ class CImage
|
|||||||
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
if ($this->newWidth > $this->width && $this->newHeight > $this->height) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
} else if ($this->newWidth > $this->width) {
|
} elseif ($this->newWidth > $this->width) {
|
||||||
$posX = round(($this->newWidth - $this->width) / 2);
|
$posX = round(($this->newWidth - $this->width) / 2);
|
||||||
$cropY = round(($this->height - $this->newHeight) / 2);
|
$cropY = round(($this->height - $this->newHeight) / 2);
|
||||||
} else if ($this->newHeight > $this->height) {
|
} elseif ($this->newHeight > $this->height) {
|
||||||
$posY = round(($this->newHeight - $this->height) / 2);
|
$posY = round(($this->newHeight - $this->height) / 2);
|
||||||
$cropX = round(($this->width - $this->newWidth) / 2);
|
$cropX = round(($this->width - $this->newWidth) / 2);
|
||||||
}
|
}
|
||||||
@@ -3177,7 +3178,7 @@ $configFile = __DIR__.'/'.basename(__FILE__, '.php').'_config.php';
|
|||||||
|
|
||||||
if (is_file($configFile)) {
|
if (is_file($configFile)) {
|
||||||
$config = require $configFile;
|
$config = require $configFile;
|
||||||
} else if (!isset($config)) {
|
} elseif (!isset($config)) {
|
||||||
$config = array();
|
$config = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3213,14 +3214,14 @@ if ($mode == 'strict') {
|
|||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'production') {
|
} elseif ($mode == 'production') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 0);
|
ini_set('display_errors', 0);
|
||||||
ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
$verbose = false;
|
$verbose = false;
|
||||||
|
|
||||||
} else if ($mode == 'development') {
|
} elseif ($mode == 'development') {
|
||||||
|
|
||||||
error_reporting(-1);
|
error_reporting(-1);
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
@@ -3242,7 +3243,7 @@ $defaultTimezone = getConfig('default_timezone', null);
|
|||||||
|
|
||||||
if ($defaultTimezone) {
|
if ($defaultTimezone) {
|
||||||
date_default_timezone_set($defaultTimezone);
|
date_default_timezone_set($defaultTimezone);
|
||||||
} else if (!ini_get('default_timezone')) {
|
} elseif (!ini_get('default_timezone')) {
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3289,13 +3290,13 @@ $refererHost = parse_url($referer, PHP_URL_HOST);
|
|||||||
if (!$allowHotlinking) {
|
if (!$allowHotlinking) {
|
||||||
if ($passwordMatch) {
|
if ($passwordMatch) {
|
||||||
; // Always allow when password match
|
; // Always allow when password match
|
||||||
} else if ($passwordMatch === false) {
|
} elseif ($passwordMatch === false) {
|
||||||
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
errorPage("Hotlinking/leeching not allowed when password missmatch.");
|
||||||
} else if (!$referer) {
|
} elseif (!$referer) {
|
||||||
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
errorPage("Hotlinking/leeching not allowed and referer is missing.");
|
||||||
} else if (strcmp($serverName, $refererHost) == 0) {
|
} elseif (strcmp($serverName, $refererHost) == 0) {
|
||||||
; // Allow when serverName matches refererHost
|
; // Allow when serverName matches refererHost
|
||||||
} else if (!empty($hotlinkingWhitelist)) {
|
} elseif (!empty($hotlinkingWhitelist)) {
|
||||||
|
|
||||||
$allowedByWhitelist = false;
|
$allowedByWhitelist = false;
|
||||||
foreach ($hotlinkingWhitelist as $val) {
|
foreach ($hotlinkingWhitelist as $val) {
|
||||||
@@ -3327,7 +3328,7 @@ $cimageClass = getConfig('cimage_class', false);
|
|||||||
|
|
||||||
if ($autoloader) {
|
if ($autoloader) {
|
||||||
require $autoloader;
|
require $autoloader;
|
||||||
} else if ($cimageClass) {
|
} elseif ($cimageClass) {
|
||||||
require $cimageClass;
|
require $cimageClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3397,7 +3398,7 @@ if ($allowRemote && $img->isRemoteSource($srcImage)) {
|
|||||||
|
|
||||||
// If source is a remote file, ignore local file checks.
|
// If source is a remote file, ignore local file checks.
|
||||||
|
|
||||||
} else if ($imagePathConstraint) {
|
} elseif ($imagePathConstraint) {
|
||||||
|
|
||||||
// Check that the image is a file below the directory 'image_path'.
|
// Check that the image is a file below the directory 'image_path'.
|
||||||
$pathToImage = realpath($imagePath . $srcImage);
|
$pathToImage = realpath($imagePath . $srcImage);
|
||||||
@@ -3849,7 +3850,7 @@ if ($alias && $aliasPath && $passwordMatch) {
|
|||||||
preg_match($validAliasname, $alias)
|
preg_match($validAliasname, $alias)
|
||||||
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
or errorPage('Filename for alias contains invalid characters. Do not add extension.');
|
||||||
|
|
||||||
} else if ($alias) {
|
} elseif ($alias) {
|
||||||
errorPage('Alias is not enabled in the config file or password not matching.');
|
errorPage('Alias is not enabled in the config file or password not matching.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user