Remove error control operator '@' on line 245. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Remove error control operator '@' on line 244. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
The parameter $ParameterString is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 240 and the first side effect is on line 13. Open
<?php
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
//$PHPTHUMB_CONFIG['cache_default_only_suffix'] = '*_thumb'; // cache 'pic.jpg' becomes 'pic_thumb.jpg' (or 'pic_thumb.png' if PNG output is selected, etc)
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
$PHPTHUMB_CONFIG['max_source_pixels'] = round(max((int)ini_get('memory_limit'), (int)get_cfg_var('memory_limit')) * 1048576 / 6);
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
//$PHPTHUMB_CONFIG['max_source_pixels'] = 1920000; // allow 1600x1200 images (2Mpx), no larger (about 12MB memory required)
- Exclude checks
Line exceeds 120 characters; contains 367 characters Open
$PHPTHUMB_CONFIG['nohotlink_valid_domains'] = array(@$_SERVER['HTTP_HOST']); // This is the list of domains for which thumbnails are allowed to be created. Note: domain only, do not include port numbers. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format "www.example.com"
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$PHPTHUMB_CONFIG['cache_directory'] = XOOPS_CACHE_PATH; // set the cache directory relative to the phpThumb() installation
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
//$PHPTHUMB_CONFIG['cache_maxsize'] = null; // never delete cached thumbnails based on byte size of cache directory
- Exclude checks
Line exceeds 120 characters; contains 193 characters Open
* 1024; // delete least-recently-accessed cached thumbnails when more than [10MB] of cached files are present (value is maximum bytesize of all cached files)
- Exclude checks
Line exceeds 120 characters; contains 210 characters Open
$PHPTHUMB_CONFIG['output_maxwidth'] = 0; // default maximum thumbnail width. If this is zero then default width is the width of the source image. This is always overridden by ?w=___ GETstring parameter
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
$PHPTHUMB_CONFIG['error_die_on_error'] = true; // die with error message on any fatal error (recommended with standalone phpThumb.php)
- Exclude checks
Line exceeds 120 characters; contains 239 characters Open
$PHPTHUMB_CONFIG['nohotlink_erase_image'] = true; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
//$PHPTHUMB_CONFIG['cache_default_only_suffix'] = 'small-*'; // cache 'pic.jpg' becomes 'small-pic.jpg' (or 'small-pic.png' if PNG output is selected, etc)
- Exclude checks
Line exceeds 120 characters; contains 259 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_require_refer'] = false; // If false will allow standalone calls to phpThumb(). If true then only requests with a $_SERVER['HTTP_REFERER'] value in 'nooffsitelink_valid_domains' are allowed.
- Exclude checks
Line exceeds 120 characters; contains 167 characters Open
//$PHPTHUMB_CONFIG['cache_directory'] = $PHPTHUMB_CONFIG['document_root'].'/phpthumb/cache/'; // set the cache directory to an absolute directory for all source images
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
// If cache_default_only_suffix is non-empty, GETstring parameters (except 'src') are ignored and only $PHPTHUMB_DEFAULTS
- Exclude checks
Line exceeds 120 characters; contains 224 characters Open
$PHPTHUMB_CONFIG['prefer_imagemagick'] = true; // If true, use ImageMagick to resize thumbnails if possible, since it is usually faster than GD functions; if false only use ImageMagick if PHP memory limit is too low.
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
// *nix: set absolute pathname to "convert", or leave as null if "convert" is in the path (location detected with `which`)
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
// $PHPTHUMB_CONFIG['cache_directory'] = __DIR__.'/cache/'; // set the cache directory to an absolute directory for all source images
- Exclude checks
Line exceeds 120 characters; contains 226 characters Open
$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_local'] = false; // if true, local source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
// Instead of creating unique cache filenames for all parameter combinations, create "simple" cache files (eg: "pic_thumb.jpg")
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$PHPTHUMB_CONFIG['cache_force_passthru'] = true; // if true, cached image data will always be passed to browser; if false, HTTP redirect will be used instead
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
$PHPTHUMB_CONFIG['output_interlace'] = true; // if true: interlaced output for GIF/PNG, progressive output for JPEG; if false: non-interlaced for GIF/PNG, baseline for JPEG.
- Exclude checks
Line exceeds 120 characters; contains 306 characters Open
$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true; // die with error message if source image cannot be processed by phpThumb() (usually because source image is corrupt in some way). If false the source image will be passed through unprocessed, if true (default) an error message will be displayed.
- Exclude checks
Line exceeds 120 characters; contains 289 characters Open
$PHPTHUMB_CONFIG['cache_disable_warning'] = false; // If [cache_directory] is non-existant or not writable, and [cache_disable_warning] is false, an error image will be generated warning to either set the cache directory or disable the warning (to avoid people not knowing about the cache)
- Exclude checks
Line exceeds 120 characters; contains 210 characters Open
$PHPTHUMB_CONFIG['output_maxheight'] = 0; // default maximum thumbnail height. If this is zero then default height is the height of the source image. This is always overridden by ?h=___ GETstring parameter
- Exclude checks
Line exceeds 120 characters; contains 293 characters Open
$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_remote'] = true; // if true, remote source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed. WARNING: cached performance MUCH slower if this is set to false.
- Exclude checks
Line exceeds 120 characters; contains 262 characters Open
//$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache'; // allow phpThumb to share 1 set of cached files even if accessed under different servername/domains on same server
- Exclude checks
Line exceeds 120 characters; contains 283 characters Open
$PHPTHUMB_CONFIG['error_message_image_default'] = ''; // Set this to the name of a generic error image (e.g. '/images/error.png') that you want displayed in place of any error message that may occur. This setting is overridden by the 'err' parameter, which does the same thing.
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
die('failed to include_once(phpthumb.functions.php) - realpath="' . realpath(__DIR__ . '/phpthumb.functions.php') . '"');
- Exclude checks
Line exceeds 120 characters; contains 196 characters Open
* 30; // delete cached thumbnails that haven't been accessed in more than [30 days] (value is maximum time since last access in seconds to avoid deletion)
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
$PHPTHUMB_CONFIG['cache_maxfiles'] = 200; // delete least-recently-accessed cached thumbnails when more than [200] cached files are present (value is maximum number of cached files to keep)
- Exclude checks
Line exceeds 120 characters; contains 267 characters Open
//$PHPTHUMB_CONFIG['cache_directory'] = './cache/'; // set the cache directory relative to the source image - must start with '.' (will not work to cache URL- or database-sourced images, please use an absolute directory name)
- Exclude checks
Line exceeds 120 characters; contains 245 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_enabled'] = false; // If false will allow thumbnails to be linked to from any domain, if true only domains listed below in 'nooffsitelink_valid_domains' will be allowed.
- Exclude checks
Line exceeds 120 characters; contains 325 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_valid_domains'] = array(@$_SERVER['HTTP_HOST']); // This is the list of domains for which thumbnails are allowed to be created. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format 'www.example.com'
- Exclude checks
Line exceeds 120 characters; contains 284 characters Open
$PHPTHUMB_CONFIG['cache_directory_depth'] = 4; // If this larger than zero, cache structure will be broken into a broad directory structure based on cache filename. For example "cache_src012345..." will be stored in "/0/01/012/0123/cache_src012345..." when (cache_directory_depth = 4)
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
// memory_get_usage() will only be defined if your PHP is compiled with the --enable-memory-limit configuration option.
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
$PHPTHUMB_CONFIG['error_silent_die_on_error'] = false; // simply die with no output of any kind on fatal errors (not recommended)
- Exclude checks
Line exceeds 120 characters; contains 273 characters Open
//$PHPTHUMB_CONFIG['document_root'] = realpath((@$_SERVER['DOCUMENT_ROOT'] && file_exists(@$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])) ? $_SERVER['DOCUMENT_ROOT'] : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', realpath('.'))));
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
//$PHPTHUMB_CONFIG['max_source_pixels'] = 3871488; // allow 2272x1704 images (4Mpx), no larger (about 24MB memory required)
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$PHPTHUMB_CONFIG['nohotlink_enabled'] = false; // If false will allow thumbnailing from any source domain
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
//$PHPTHUMB_CONFIG['cache_directory'] = null; // disable thumbnail caching (not recommended)
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$PHPTHUMB_CONFIG['error_fontsize'] = 1; // size of text in error messages, from 1 (smallest) to 5 (largest)
- Exclude checks
Line exceeds 120 characters; contains 290 characters Open
$PHPTHUMB_CONFIG['imagemagick_use_thumbnail'] = true; // If true, use ImageMagick's "-thumbnail" resizing parameter (if available) which removes extra non-image metadata (profiles, EXIF info, etc) resulting in much smaller filesize; if false, use "-resize" paramter which retains this info
- Exclude checks
Line exceeds 120 characters; contains 305 characters Open
$PHPTHUMB_CONFIG['output_format'] = 'png'; // default output format ('jpeg', 'png' or 'gif') - thumbnail will be output in this format (if available in your version of GD or ImageMagick). This is only used if the "f" parameter is not specified, and if the thumbnail can't be output in the input format.
- Exclude checks
Line exceeds 120 characters; contains 195 characters Open
. @$PHPTHUMB_CONFIG['high_security_password']);
- Exclude checks
Line exceeds 120 characters; contains 384 characters Open
$PHPTHUMB_CONFIG['high_security_password'] = ''; // required if 'high_security_enabled' is true, and must be at complex (uppercase, lowercase, numbers, punctuation, etc -- punctuation is strongest, lowercase is weakest; see PasswordStrength() in phpThumb.php). You can use a password generator like http://silisoftware.com/tools/password-random.php to generate a strong password
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
//$PHPTHUMB_CONFIG['http_user_agent'] = ''; // PHP default: none
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
$PHPTHUMB_CONFIG['disable_pathinfo_parsing'] = false; // if true, $_SERVER[PATH_INFO] is not parsed. May be needed on some server configurations to allow normal behavior.
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
$PHPTHUMB_CONFIG['disable_imagecopyresampled'] = false; // if true, ImageCopyResampled is replaced with ImageCopyResampleBicubic. May be needed for buggy versions of PHP-GD.
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$PHPTHUMB_CONFIG['http_follow_redirect'] = true; // if true (default), follow "302 Found" redirects to new URL; if false, return error message
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = true; // if true, any parameters in the URL will override the defaults set here; if false, any parameters set here cannot be overridden in the URL
- Exclude checks
Line exceeds 120 characters; contains 181 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_text_message'] = 'Image taken from ' . @$_SERVER['HTTP_HOST']; // text of error message (used if [nooffsitelink_watermark_src] is not a valid image)
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$PHPTHUMB_CONFIG['allow_parameter_file'] = false; // if true, allow use of 'file' parameter; if false (default) the 'file' parameter is disabled/ignored
- Exclude checks
Line exceeds 120 characters; contains 248 characters Open
$PHPTHUMB_CONFIG['disable_onlycreateable_passthru'] = true; // if true, any image that can be parsed by getimagesize() can be passed through; if false, only images that can be converted to GD by ImageCreateFrom(JPEG|GIF|PNG) functions are allowed
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
//$PHPTHUMB_CONFIG['mysql_query'] = 'SELECT `picture` FROM `products` WHERE (`id` = \''.$GLOBALS['xoopsDB']->escape(@$_GET['id']).'\')';
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_watermark_src'] = '/demo/images/watermark.png'; // webroot-relative image to overlay on hotlinked images
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$PHPTHUMB_CONFIG['allow_parameter_goto'] = false; // if true, allow use of 'goto' parameter; if false (default) the 'goto' parameter is disabled/ignored
- Exclude checks
Line exceeds 120 characters; contains 184 characters Open
$PHPTHUMB_CONFIG['disable_debug'] = true; // prevent phpThumb from displaying any information about your system. If true, phpThumbDebug and error messages will be disabled
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
$PHPTHUMB_CONFIG['border_hexcolor'] = '000000'; // Default border color - usual HTML-style hex color notation (overridden with 'bc' parameter)
- Exclude checks
Line exceeds 120 characters; contains 147 characters Open
// These 4 values must be modified if $PHPTHUMB_CONFIG['mysql_query'] is not empty, but may be ignored if $PHPTHUMB_CONFIG['mysql_query'] is blank.
- Exclude checks
Line exceeds 120 characters; contains 245 characters Open
$PHPTHUMB_CONFIG['nooffsitelink_erase_image'] = false; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail
- Exclude checks
Line exceeds 120 characters; contains 213 characters Open
$PHPTHUMB_CONFIG['background_hexcolor'] = 'FFFFFF'; // Default background color when thumbnail aspect ratio does not match fixed-dimension box - usual HTML-style hex color notation (overridden with 'bg' parameter)
- Exclude checks
Line exceeds 120 characters; contains 255 characters Open
$PHPTHUMB_CONFIG['allow_local_http_src'] = true; // If true, 'src' parameter can be "http://<thishostname>/path/image.ext" instead of just "/path/image.ext"; if false then display warning message to encourage more efficient local-filename calling.
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$PHPTHUMB_CONFIG['allow_src_above_docroot'] = true; // if true, allow src to be anywhere in filesystem; if false (default) only allow src within document_root
- Exclude checks
Line exceeds 120 characters; contains 227 characters Open
$PHPTHUMB_CONFIG['high_security_enabled'] = false; // if enabled, requires 'high_security_password' set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs
- Exclude checks
Line exceeds 120 characters; contains 186 characters Open
$PHPTHUMB_CONFIG['allow_src_above_phpthumb'] = true; // if true (default), allow src to be anywhere in filesystem; if false only allow src within sub-directory of phpThumb installation
- Exclude checks
Line exceeds 120 characters; contains 283 characters Open
$PHPTHUMB_CONFIG['use_exif_thumbnail_for_speed'] = true; // If true, and EXIF thumbnail is available, and is larger or equal to output image dimensions, use EXIF thumbnail rather than actual source image for generating thumbnail. Benefit is only speed, avoiding resizing large image.
- Exclude checks
Line exceeds 120 characters; contains 354 characters Open
$PHPTHUMB_DEFAULTS_DISABLEGETPARAMS = false; // if true, GETstring parameters will be ignored (except for 'src') and only below default parameters will be used; if false, both default and GETstring parameters will be used (depending on $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE). Will be auto-set true if !empty($PHPTHUMB_CONFIG['cache_default_only_suffix'])
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
//$PHPTHUMB_CONFIG['http_user_agent'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; // Windows XP, Internet Explorer
- Exclude checks
The variable $PHPTHUMB_CONFIG is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $PHPTHUMB_CONFIG is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ParameterString is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $PHPTHUMB_CONFIG is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $ParameterString is not named in camelCase. Open
function phpThumbURL($ParameterString)
{
global $PHPTHUMB_CONFIG;
return str_replace(@$PHPTHUMB_CONFIG['document_root'], '', __DIR__) . DIRECTORY_SEPARATOR . 'phpThumb.php?' . $ParameterString . '&hash=' . md5($ParameterString
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}