diff --git a/addons/captcha/captcha.addon.php b/addons/captcha/captcha.addon.php index f570247041..c863d36ade 100644 --- a/addons/captcha/captcha.addon.php +++ b/addons/captcha/captcha.addon.php @@ -190,7 +190,7 @@ function createCaptchaImage($string) // Create an image for each letter foreach($arr as $i => $str) { - $im[$i + 1] = @imagecreate($w, $h); + $im[$i + 1] = imagecreate($w, $h); $background_color = imagecolorallocate($im[$i + 1], 255, 255, 255); $text_color = imagecolorallocate($im[$i + 1], 0, 0, 0); diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 25a7cdb102..35603265bc 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -344,7 +344,7 @@ function _getSupportedList() } // sort - @usort($get_supported_list, array($this, '_sortDBMS')); + usort($get_supported_list, array($this, '_sortDBMS')); $this->supported_list = $get_supported_list; return $this->supported_list; diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 35a0d1ec1e..3124e6b793 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -73,7 +73,7 @@ function __connect($connection) } // Attempt to connect - $result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]); + $result = mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]); if(!$result) { exit('XE cannot connect to DB.'); @@ -91,7 +91,11 @@ function __connect($connection) return; } // select db - @mysql_select_db($connection["db_database"], $result); + $output = mysql_select_db($connection["db_database"], $result); + if(!$output) + { + exit('XE cannot select database.'); + } if(mysql_error()) { $this->setError(mysql_errno(), mysql_error()); @@ -121,7 +125,7 @@ function _afterConnect($connection) */ function _close($connection) { - @mysql_close($connection); + mysql_close($connection); } /** diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 809c74d130..ca788e29a0 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -287,7 +287,7 @@ function _preserveValue($match) case 'radio': case 'checkbox': $str = preg_replace('@\schecked(="[^"]*?")?@', ' ', $str); - if(@preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) + if(preg_match('@\s(?i:value)="' . $INPUT_ERROR[$match[3]] . '"@', $str)) { $str .= ' checked="checked"'; } diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index 29d94eb7f0..6901d830dc 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -79,13 +79,13 @@ function copyDir($source_dir, $target_dir, $filter = null, $type = null) { if($type == 'force') { - @unlink($target_dir . $file); + unlink($target_dir . $file); } else { if(!file_exists($target_dir . $file)) { - @copy($source_dir . $file, $target_dir . $file); + copy($source_dir . $file, $target_dir . $file); } } } @@ -112,10 +112,10 @@ function copyFile($source, $target, $force = 'Y') if($force == 'Y') { - @unlink($target_dir . DIRECTORY_SEPARATOR . $target); + unlink($target_dir . DIRECTORY_SEPARATOR . $target); } - @copy($source, $target_dir . DIRECTORY_SEPARATOR . $target); + copy($source, $target_dir . DIRECTORY_SEPARATOR . $target); } /** @@ -126,12 +126,12 @@ function copyFile($source, $target, $force = 'Y') */ function readFile($filename) { - if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1) + if(!is_readable($filename) || filesize($filename) < 1) { return; } - return @file_get_contents($filename); + return file_get_contents($filename); } /** @@ -154,8 +154,8 @@ function writeFile($filename, $buff, $mode = "w") $flags = FILE_APPEND; } - @file_put_contents($filename, $buff, $flags|LOCK_EX); - @chmod($filename, 0644); + file_put_contents($filename, $buff, $flags|LOCK_EX); + chmod($filename, 0644); } /** @@ -180,7 +180,7 @@ function removeFile($filename) */ function rename($source, $target) { - return @rename(self::getRealPath($source), self::getRealPath($target)); + return rename(self::getRealPath($source), self::getRealPath($target)); } /** @@ -286,8 +286,8 @@ function makeDir($path_string) if(!ini_get('safe_mode')) { - @mkdir($path_string, 0755, TRUE); - @chmod($path_string, 0755); + mkdir($path_string, 0755, TRUE); + chmod($path_string, 0755); } // if safe_mode is on, use FTP else @@ -775,27 +775,27 @@ function createImageFile($source_file, $target_file, $resize_width = 0, $resize_ case 'gif' : if(function_exists('imagecreatefromgif')) { - $source = @imagecreatefromgif($source_file); + $source = imagecreatefromgif($source_file); } break; case 'jpeg' : case 'jpg' : if(function_exists('imagecreatefromjpeg')) { - $source = @imagecreatefromjpeg($source_file); + $source = imagecreatefromjpeg($source_file); } break; case 'png' : if(function_exists('imagecreatefrompng')) { - $source = @imagecreatefrompng($source_file); + $source = imagecreatefrompng($source_file); } break; case 'wbmp' : case 'bmp' : if(function_exists('imagecreatefromwbmp')) { - $source = @imagecreatefromwbmp($source_file); + $source = imagecreatefromwbmp($source_file); } break; } @@ -869,7 +869,7 @@ function createImageFile($source_file, $target_file, $resize_width = 0, $resize_ { return FALSE; } - @chmod($target_file, 0644); + chmod($target_file, 0644); return TRUE; } diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 569997d253..047bb5a9e0 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -908,7 +908,7 @@ function displayContent($oModule = NULL) $oMenuAdminController = getAdminController('menu'); $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); - if(FileHandler::exists($homeMenuCacheFile)) + if(is_readable($homeMenuCacheFile)) { include($homeMenuCacheFile); } @@ -1069,7 +1069,7 @@ function &getModuleInstance($module, $type = 'view', $kind = '') if(!isset($GLOBALS['_called_constructor'][$instance_name])) { $GLOBALS['_called_constructor'][$instance_name] = TRUE; - if(@method_exists($oModule, $instance_name)) + if(method_exists($oModule, $instance_name)) { $oModule->{$instance_name}(); } diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 73bef5c4bd..fe8b6d79ff 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -401,7 +401,7 @@ function proc() $called_position = 'before_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); - if(FileHandler::exists($addon_file)) include($addon_file); + if(is_readable($addon_file)) include($addon_file); if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { @@ -460,7 +460,7 @@ function proc() $called_position = 'after_module_proc'; $oAddonController = getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); - if(FileHandler::exists($addon_file)) include($addon_file); + if(is_readable($addon_file)) include($addon_file); if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) { diff --git a/modules/addon/addon.controller.php b/modules/addon/addon.controller.php index 1405b3ad95..8a8bb2d54f 100644 --- a/modules/addon/addon.controller.php +++ b/modules/addon/addon.controller.php @@ -117,7 +117,7 @@ function makeCacheFile($site_srl = 0, $type = "pc", $gtype = 'site') unset($extra_vars); $extra_vars = base64_encode($val->extra_vars); } - $addon_include = sprintf('unset($addon_info); $addon_info = unserialize(base64_decode(\'%s\')); @include($addon_file);', $extra_vars); + $addon_include = sprintf('unset($addon_info); $addon_info = unserialize(base64_decode(\'%s\')); include($addon_file);', $extra_vars); $buff[] = 'if(file_exists($addon_file)){'; $buff[] = 'if($rm === \'no_run_selected\'){'; diff --git a/modules/admin/admin.admin.controller.php b/modules/admin/admin.admin.controller.php index 6e1d09f3b6..d050fe76d8 100644 --- a/modules/admin/admin.admin.controller.php +++ b/modules/admin/admin.admin.controller.php @@ -471,7 +471,7 @@ function procAdminRemoveIcons() $file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $iconname); if($file_exist) { - @FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $iconname); + FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $iconname); } else { diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 80506acf4a..2265050392 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -259,12 +259,12 @@ function procMenuAdminDelete() return new Object(-1, 'msg_adminmenu_cannot_delete'); // get menu properies with child menu - $phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl); + $phpFile = FileHandler::getRealPath(sprintf("./files/cache/menu/%s.php", $menu_srl)); $originMenu = NULL; - if(is_readable(FileHandler::getRealPath($phpFile))) + if(is_readable($phpFile)) { - include(FileHandler::getRealPath($phpFile)); + include($phpFile); } // check home menu in originMenu @@ -860,12 +860,12 @@ public function deleteItem($args) if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl; // get menu properies with child menu - $phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl); + $phpFile = FileHandler::getRealPath(sprintf("./files/cache/menu/%s.php", $args->menu_srl)); $originMenu = NULL; - if(is_readable(FileHandler::getRealPath($phpFile))) + if(is_readable($phpFile)) { - include(FileHandler::getRealPath($phpFile)); + include($phpFile); if(is_array($menu->list)) { @@ -1012,12 +1012,12 @@ function procMenuAdminMoveItem() } // get menu properies with child menu - $phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl); + $phpFile = FileHandler::getRealPath(sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl)); $originMenu = NULL; - if(is_readable(FileHandler::getRealPath($phpFile))) + if(is_readable($phpFile)) { - include(FileHandler::getRealPath($phpFile)); + include($phpFile); if(is_array($menu->list)) { diff --git a/modules/menu/menu.mobile.php b/modules/menu/menu.mobile.php index c57832185d..6a64a6a681 100644 --- a/modules/menu/menu.mobile.php +++ b/modules/menu/menu.mobile.php @@ -50,14 +50,14 @@ function dispMenuMenu() $oMenuAdminController = getAdminController('menu'); $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); - if(file_exists($homeMenuCacheFile)) + if(is_readable($homeMenuCacheFile)) { - @include($homeMenuCacheFile); + include($homeMenuCacheFile); } $menu_info->php_file = './files/cache/menu/'.$homeMenuSrl.'.php'; } - if(file_exists($menu_info->php_file)) @include($menu_info->php_file); + if(is_readable($menu_info->php_file)) include($menu_info->php_file); if(is_array($menu->list)) { foreach($menu->list as $menu_item) diff --git a/modules/page/page.view.php b/modules/page/page.view.php index c07a501244..27cd76e6bb 100644 --- a/modules/page/page.view.php +++ b/modules/page/page.view.php @@ -171,7 +171,8 @@ function getHtmlPage($path, $caching_interval, $cache_file) function executeFile($target_file, $caching_interval, $cache_file) { // Cancel if the file doesn't exist - if(!file_exists(FileHandler::getRealPath($target_file))) return; + $target_file = FileHandler::getRealPath($target_file); + if(!is_readable($target_file)) return; // Get a path and filename $tmp_path = explode('/',$cache_file); @@ -186,7 +187,7 @@ function executeFile($target_file, $caching_interval, $cache_file) // Read a target file and get content ob_start(); - include(FileHandler::getRealPath($target_file)); + include($target_file); $content = ob_get_clean(); // Replace relative path to the absolute path $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/'; diff --git a/modules/widget/widget.model.php b/modules/widget/widget.model.php index 667fe0300b..066b598a26 100644 --- a/modules/widget/widget.model.php +++ b/modules/widget/widget.model.php @@ -131,9 +131,9 @@ function getWidgetInfo($widget) // If the problem by comparing the cache file and include the return variable $widget_info $cache_file = sprintf(_XE_PATH_ . 'files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType()); - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) + if(is_readable($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) { - @include($cache_file); + include($cache_file); return $widget_info; } // If no cache file exists, parse the xml and then return the variable. @@ -247,7 +247,7 @@ function getWidgetInfo($widget) $buff = ''; FileHandler::writeFile($cache_file, $buff); - if(file_exists($cache_file)) @include($cache_file); + if(is_readable($cache_file)) include($cache_file); return $widget_info; } @@ -264,9 +264,9 @@ function getWidgetStyleInfo($widgetStyle) // If the problem by comparing the cache file and include the return variable $widgetStyle_info $cache_file = sprintf(_XE_PATH_ . 'files/cache/widgetstyles/%s.%s.cache.php', $widgetStyle, Context::getLangType()); - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) + if(is_readable($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) { - @include($cache_file); + include($cache_file); return $widgetStyle_info; } // If no cache file exists, parse the xml and then return the variable. @@ -352,7 +352,7 @@ function getWidgetStyleInfo($widgetStyle) $buff = ''; FileHandler::writeFile($cache_file, $buff); - if(file_exists($cache_file)) @include($cache_file); + if(is_readable($cache_file)) include($cache_file); return $widgetStyle_info; } }