Wrap file_exists calls with @
It can produce warnings in case open_basedir is enabled. Fixes #13467 Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
91d3d0953e
commit
bd2a0ec307
@ -453,7 +453,7 @@ class Config
|
||||
} elseif (function_exists('gzuncompress')) {
|
||||
$git_file_name = $git_folder . '/objects/'
|
||||
. substr($hash, 0, 2) . '/' . substr($hash, 2);
|
||||
if (file_exists($git_file_name) ) {
|
||||
if (@file_exists($git_file_name) ) {
|
||||
if (! $commit = @file_get_contents($git_file_name)) {
|
||||
return;
|
||||
}
|
||||
@ -464,7 +464,7 @@ class Config
|
||||
$pack_names = array();
|
||||
// work with packed data
|
||||
$packs_file = $git_folder . '/objects/info/packs';
|
||||
if (file_exists($packs_file)
|
||||
if (@file_exists($packs_file)
|
||||
&& $packs = @file_get_contents($packs_file)
|
||||
) {
|
||||
// File exists. Read it, parse the file to get the names of the
|
||||
@ -1714,7 +1714,7 @@ class Config
|
||||
private static function _renderCustom($filename, $id)
|
||||
{
|
||||
$retval = '';
|
||||
if (file_exists($filename)) {
|
||||
if (@file_exists($filename)) {
|
||||
$retval .= '<div id="' . $id . '">';
|
||||
ob_start();
|
||||
include $filename;
|
||||
|
||||
@ -3057,7 +3057,7 @@ class DisplayResults
|
||||
$file = $mime_map[$orgFullColName]['transformation'];
|
||||
$include_file = 'libraries/plugins/transformations/' . $file;
|
||||
|
||||
if (file_exists($include_file)) {
|
||||
if (@file_exists($include_file)) {
|
||||
|
||||
include_once $include_file;
|
||||
$class_name = PMA_getTransformationClassName($include_file);
|
||||
|
||||
@ -67,7 +67,7 @@ class Footer
|
||||
private function _getDemoMessage()
|
||||
{
|
||||
$message = '<a href="/">' . __('phpMyAdmin Demo Server') . '</a>: ';
|
||||
if (file_exists('./revision-info.php')) {
|
||||
if (@file_exists('./revision-info.php')) {
|
||||
include './revision-info.php';
|
||||
$message .= sprintf(
|
||||
__('Currently running Git revision %1$s from the %2$s branch.'),
|
||||
|
||||
@ -148,7 +148,7 @@ class Template
|
||||
);
|
||||
extract($this->data);
|
||||
ob_start();
|
||||
if (file_exists($template)) {
|
||||
if (@file_exists($template)) {
|
||||
include $template;
|
||||
} else {
|
||||
throw new \LogicException(
|
||||
|
||||
@ -88,7 +88,7 @@ class Theme
|
||||
*/
|
||||
function loadInfo()
|
||||
{
|
||||
if (! file_exists($this->getPath() . '/info.inc.php')) {
|
||||
if (! @file_exists($this->getPath() . '/info.inc.php')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ class ThemeManager
|
||||
/**
|
||||
* load layout file if exists
|
||||
*/
|
||||
if (file_exists($this->theme->getLayoutFile())) {
|
||||
if (@file_exists($this->theme->getLayoutFile())) {
|
||||
include $this->theme->getLayoutFile();
|
||||
}
|
||||
}
|
||||
|
||||
@ -633,7 +633,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
|
||||
* the required auth type plugin
|
||||
*/
|
||||
$auth_class = "Authentication" . ucfirst($cfg['Server']['auth_type']);
|
||||
if (! file_exists(
|
||||
if (! @file_exists(
|
||||
'./libraries/plugins/auth/'
|
||||
. $auth_class . '.php'
|
||||
)) {
|
||||
|
||||
@ -327,7 +327,7 @@ function PMA_openExportFile($filename, $quick_export)
|
||||
$save_filename = PMA\libraries\Util::userDir($GLOBALS['cfg']['SaveDir'])
|
||||
. preg_replace('@[/\\\\]@', '_', $filename);
|
||||
|
||||
if (file_exists($save_filename)
|
||||
if (@file_exists($save_filename)
|
||||
&& ((! $quick_export && empty($_REQUEST['onserver_overwrite']))
|
||||
|| ($quick_export
|
||||
&& $_REQUEST['quick_export_onserver_overwrite'] != 'saveitover'))
|
||||
|
||||
@ -82,7 +82,7 @@ class AuthenticationSignon extends AuthenticationPlugin
|
||||
|
||||
/* Handle script based auth */
|
||||
if (!empty($script_name)) {
|
||||
if (!file_exists($script_name)) {
|
||||
if (!@file_exists($script_name)) {
|
||||
PMA_fatalError(
|
||||
__('Can not find signon authentication script:')
|
||||
. ' ' . $script_name
|
||||
|
||||
@ -140,7 +140,7 @@ class ImportShp extends ImportPlugin
|
||||
// Delete the .dbf file extracted to 'TempDir'
|
||||
if ($temp_dbf_file
|
||||
&& isset($dbf_file_path)
|
||||
&& file_exists($dbf_file_path)
|
||||
&& @file_exists($dbf_file_path)
|
||||
) {
|
||||
unlink($dbf_file_path);
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ echo '</div>'
|
||||
, __('Go') . '" />'
|
||||
, '</form>'
|
||||
, '</div>';
|
||||
if (file_exists('setup/index.php') && ! file_exists(CONFIG_FILE)) {
|
||||
if (@file_exists('setup/index.php') && ! @file_exists(CONFIG_FILE)) {
|
||||
// show only if setup script is available, allows to disable this message
|
||||
// by simply removing setup directory
|
||||
// Also do not show in config exists (and setup would refuse to work)
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
require './lib/common.inc.php';
|
||||
|
||||
if (file_exists(CONFIG_FILE) && ! $cfg['DBG']['demo']) {
|
||||
if (@file_exists(CONFIG_FILE) && ! $cfg['DBG']['demo']) {
|
||||
PMA_fatalError(__('Configuration already exists, setup is disabled!'));
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ $page = preg_replace('/[^a-z]/', '', $page);
|
||||
if ($page === '') {
|
||||
$page = 'index';
|
||||
}
|
||||
if (!file_exists("./setup/frames/$page.inc.php")) {
|
||||
if (!@file_exists("./setup/frames/$page.inc.php")) {
|
||||
// it will happen only when entering URL by hand, we don't care for these cases
|
||||
PMA_fatalError(__('Wrong GET file attribute value'));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user