From 79e79377626799a77c11aa7849cb9c64305590c8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr <gohr@cosmocode.de> Date: Wed, 7 Jan 2015 10:47:45 +0100 Subject: [PATCH] Remove error supression for file_exists() In an older version of PHP a file_exists() call would issue a warning when the file did not exist. This was fixed in later PHP releases. Since we require PHP 5.3 now, there's no need to supress any error here anymore. This might even give a minor performance boost. --- _test/core/DokuWikiTest.php | 4 +-- feed.php | 2 +- inc/JpegMeta.php | 2 +- inc/Sitemapper.php | 2 +- inc/auth.php | 2 +- inc/cache.php | 2 +- inc/changelog.php | 8 +++--- inc/common.php | 24 ++++++++--------- inc/confutils.php | 2 +- inc/fetch.functions.php | 2 +- inc/html.php | 6 ++--- inc/indexer.php | 20 +++++++------- inc/infoutils.php | 12 ++++----- inc/init.php | 24 ++++++++--------- inc/io.php | 12 ++++----- inc/load.php | 2 +- inc/media.php | 28 ++++++++++---------- inc/pageutils.php | 14 +++++----- inc/parserutils.php | 10 +++---- inc/plugin.php | 12 ++++----- inc/plugincontroller.class.php | 8 +++--- inc/subscription.php | 2 +- inc/template.php | 12 ++++----- install.php | 8 +++--- lib/exe/css.php | 6 ++--- lib/exe/detail.php | 2 +- lib/exe/indexer.php | 4 +-- lib/exe/js.php | 12 ++++----- lib/plugins/authplain/auth.php | 2 +- lib/plugins/config/admin.php | 4 +-- lib/plugins/config/settings/config.class.php | 16 +++++------ lib/plugins/config/settings/extra.class.php | 2 +- lib/plugins/extension/helper/extension.php | 8 +++--- lib/plugins/popularity/admin.php | 2 +- lib/plugins/popularity/helper.php | 2 +- 35 files changed, 140 insertions(+), 140 deletions(-) diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index f4521256a..4e40d510a 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -54,7 +54,7 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { foreach (array('default','local','protected') as $config_group) { if (empty($config_cascade['main'][$config_group])) continue; foreach ($config_cascade['main'][$config_group] as $config_file) { - if (@file_exists($config_file)) { + if (file_exists($config_file)) { include($config_file); } } @@ -68,7 +68,7 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase { foreach (array('default','local') as $config_group) { if (empty($config_cascade['license'][$config_group])) continue; foreach ($config_cascade['license'][$config_group] as $config_file) { - if(@file_exists($config_file)){ + if(file_exists($config_file)){ include($config_file); } } diff --git a/feed.php b/feed.php index aa00063a1..7ea2e235e 100644 --- a/feed.php +++ b/feed.php @@ -218,7 +218,7 @@ function rss_buildItems(&$rss, &$data, $opt) { $date = $ditem['date']; } elseif ($ditem['media']) { $date = @filemtime(mediaFN($id)); - } elseif (@file_exists(wikiFN($id))) { + } elseif (file_exists(wikiFN($id))) { $date = @filemtime(wikiFN($id)); } elseif($meta['date']['modified']) { $date = $meta['date']['modified']; diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php index d50bad9b7..4cdebcc36 100644 --- a/inc/JpegMeta.php +++ b/inc/JpegMeta.php @@ -936,7 +936,7 @@ class JpegMeta { if ($fileName == "") { $tmpName = tempnam(dirname($this->_fileName),'_metatemp_'); $this->_writeJPEG($tmpName); - if (@file_exists($tmpName)) { + if (file_exists($tmpName)) { return io_rename($tmpName, $this->_fileName); } } else { diff --git a/inc/Sitemapper.php b/inc/Sitemapper.php index 0325f6d44..037990e96 100644 --- a/inc/Sitemapper.php +++ b/inc/Sitemapper.php @@ -33,7 +33,7 @@ class Sitemapper { $sitemap = Sitemapper::getFilePath(); - if(@file_exists($sitemap)){ + if(file_exists($sitemap)){ if(!is_writable($sitemap)) return false; }else{ if(!is_writable(dirname($sitemap))) return false; diff --git a/inc/auth.php b/inc/auth.php index d51534e67..17923ba2a 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -1189,7 +1189,7 @@ function act_resendpwd() { // we're in token phase - get user info from token $tfile = $conf['cachedir'].'/'.$token{0}.'/'.$token.'.pwauth'; - if(!@file_exists($tfile)) { + if(!file_exists($tfile)) { msg($lang['resendpwdbadauth'], -1); $INPUT->remove('pwauth'); return false; diff --git a/inc/cache.php b/inc/cache.php index edf394134..68f64eaa2 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -203,7 +203,7 @@ class cache_parser extends cache { */ public function _useCache() { - if (!@file_exists($this->file)) return false; // source exists? + if (!file_exists($this->file)) return false; // source exists? return parent::_useCache(); } diff --git a/inc/changelog.php b/inc/changelog.php index c2d3cb489..d1ef7973e 100644 --- a/inc/changelog.php +++ b/inc/changelog.php @@ -351,7 +351,7 @@ function _handleRecent($line,$ns,$flags,&$seen){ // check existance if($flags & RECENTS_SKIP_DELETED){ $fn = (($flags & RECENTS_MEDIA_CHANGES) ? mediaFN($recent['id']) : wikiFN($recent['id'])); - if(!@file_exists($fn)) return false; + if(!file_exists($fn)) return false; } return $recent; @@ -498,14 +498,14 @@ abstract class ChangeLog { if($first < 0) { $first = 0; - } else if(@file_exists($this->getFilename())) { + } else if(file_exists($this->getFilename())) { // skip current revision if the page exists $first = max($first + 1, 0); } $file = $this->getChangelogFilename(); - if(!@file_exists($file)) { + if(!file_exists($file)) { return $revs; } if(filesize($file) < $this->chunk_size || $this->chunk_size == 0) { @@ -735,7 +735,7 @@ abstract class ChangeLog { protected function readloglines($rev) { $file = $this->getChangelogFilename(); - if(!@file_exists($file)) { + if(!file_exists($file)) { return false; } diff --git a/inc/common.php b/inc/common.php index 2c9359a0c..9b330000b 100644 --- a/inc/common.php +++ b/inc/common.php @@ -188,7 +188,7 @@ function pageinfo() { $info['locked'] = checklock($ID); $info['filepath'] = fullpath(wikiFN($ID)); - $info['exists'] = @file_exists($info['filepath']); + $info['exists'] = file_exists($info['filepath']); $info['currentrev'] = @filemtime($info['filepath']); if($REV) { //check if current revision was meant @@ -202,7 +202,7 @@ function pageinfo() { } else { //really use old revision $info['filepath'] = fullpath(wikiFN($ID, $REV)); - $info['exists'] = @file_exists($info['filepath']); + $info['exists'] = file_exists($info['filepath']); } } $info['rev'] = $REV; @@ -256,7 +256,7 @@ function pageinfo() { // draft $draft = getCacheName($info['client'].$ID, '.draft'); - if(@file_exists($draft)) { + if(file_exists($draft)) { if(@filemtime($draft) < @filemtime(wikiFN($ID))) { // remove stale draft @unlink($draft); @@ -352,7 +352,7 @@ function breadcrumbs() { $crumbs = isset($_SESSION[DOKU_COOKIE]['bc']) ? $_SESSION[DOKU_COOKIE]['bc'] : array(); //we only save on show and existing wiki documents $file = wikiFN($ID); - if($ACT != 'show' || !@file_exists($file)) { + if($ACT != 'show' || !file_exists($file)) { $_SESSION[DOKU_COOKIE]['bc'] = $crumbs; return $crumbs; } @@ -853,7 +853,7 @@ function checklock($id) { $lock = wikiLockFN($id); //no lockfile - if(!@file_exists($lock)) return false; + if(!file_exists($lock)) return false; //lockfile expired if((time() - filemtime($lock)) > $conf['locktime']) { @@ -907,7 +907,7 @@ function unlock($id) { global $INPUT; $lock = wikiLockFN($id); - if(@file_exists($lock)) { + if(file_exists($lock)) { @list($ip, $session) = explode("\n", io_readFile($lock)); if($ip == $INPUT->server->str('REMOTE_USER') || $ip == clientIP() || $session == session_id()) { @unlink($lock); @@ -1010,13 +1010,13 @@ function pageTemplate($id) { // if the before event did not set a template file, try to find one if(empty($data['tplfile'])) { $path = dirname(wikiFN($id)); - if(@file_exists($path.'/_template.txt')) { + if(file_exists($path.'/_template.txt')) { $data['tplfile'] = $path.'/_template.txt'; } else { // search upper namespaces for templates $len = strlen(rtrim($conf['datadir'], '/')); while(strlen($path) >= $len) { - if(@file_exists($path.'/__template.txt')) { + if(file_exists($path.'/__template.txt')) { $data['tplfile'] = $path.'/__template.txt'; break; } @@ -1197,13 +1197,13 @@ function saveWikiText($id, $text, $summary, $minor = false) { $file = wikiFN($id); $old = @filemtime($file); // from page $wasRemoved = (trim($text) == ''); // check for empty or whitespace only - $wasCreated = !@file_exists($file); + $wasCreated = !file_exists($file); $wasReverted = ($REV == true); $pagelog = new PageChangeLog($id, 1024); $newRev = false; $oldRev = $pagelog->getRevisions(-1, 1); // from changelog $oldRev = (int) (empty($oldRev) ? 0 : $oldRev[0]); - if(!@file_exists(wikiFN($id, $old)) && @file_exists($file) && $old >= $oldRev) { + if(!file_exists(wikiFN($id, $old)) && file_exists($file) && $old >= $oldRev) { // add old revision to the attic if missing saveOldRevision($id); // add a changelog entry if this edit came from outside dokuwiki @@ -1285,7 +1285,7 @@ function saveWikiText($id, $text, $summary, $minor = false) { */ function saveOldRevision($id) { $oldf = wikiFN($id); - if(!@file_exists($oldf)) return ''; + if(!file_exists($oldf)) return ''; $date = filemtime($oldf); $newf = wikiFN($id, $date); io_writeWikiPage($newf, rawWiki($id), $id, $date); @@ -1743,7 +1743,7 @@ function license_img($type) { $try[] = 'lib/images/license/'.$type.'/cc.png'; } foreach($try as $src) { - if(@file_exists(DOKU_INC.$src)) return $src; + if(file_exists(DOKU_INC.$src)) return $src; } return ''; } diff --git a/inc/confutils.php b/inc/confutils.php index 85bf5128c..8643a056c 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -206,7 +206,7 @@ function retrieveConfig($type,$fn,$params=null) { foreach (array('default','local','protected') as $config_group) { if (empty($config_cascade[$type][$config_group])) continue; foreach ($config_cascade[$type][$config_group] as $file) { - if (@file_exists($file)) { + if (file_exists($file)) { $config = call_user_func_array($fn,array_merge(array($file),$params)); $combined = array_merge($combined, $config); } diff --git a/inc/fetch.functions.php b/inc/fetch.functions.php index 3c5bdfeee..c99fbf20a 100644 --- a/inc/fetch.functions.php +++ b/inc/fetch.functions.php @@ -163,7 +163,7 @@ function checkFileStatus(&$media, &$file, $rev = '', $width=0, $height=0) { } //check file existance - if(!@file_exists($file)) { + if(!file_exists($file)) { return array(404, 'Not Found'); } diff --git a/inc/html.php b/inc/html.php index 87affd47b..3a93a6604 100644 --- a/inc/html.php +++ b/inc/html.php @@ -501,7 +501,7 @@ function html_revisions($first=0, $media_id = false){ $form->addElement(form_makeOpenTag('ul')); if (!$media_id) $exists = $INFO['exists']; - else $exists = @file_exists(mediaFN($id)); + else $exists = file_exists(mediaFN($id)); $display_name = (!$media_id && useHeading('navigation')) ? hsc(p_get_first_heading($id)) : $id; if (!$display_name) $display_name = $id; @@ -568,7 +568,7 @@ function html_revisions($first=0, $media_id = false){ $date = dformat($rev); $info = $changelog->getRevisionInfo($rev); if($media_id) { - $exists = @file_exists(mediaFN($id, $rev)); + $exists = file_exists(mediaFN($id, $rev)); } else { $exists = page_exists($id, $rev); } @@ -765,7 +765,7 @@ function html_recent($first=0, $show_changes='both'){ $href = ''; if (!empty($recent['media'])) { - $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id']))); + $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && file_exists(mediaFN($recent['id']))); if ($diff) { $href = media_managerURL(array('tab_details' => 'history', 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&'); diff --git a/inc/indexer.php b/inc/indexer.php index 014c5c5eb..a86bfc656 100644 --- a/inc/indexer.php +++ b/inc/indexer.php @@ -1076,7 +1076,7 @@ class Doku_Indexer { protected function getIndex($idx, $suffix) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix.'.idx'; - if (!@file_exists($fn)) return array(); + if (!file_exists($fn)) return array(); return file($fn, FILE_IGNORE_NEW_LINES); } @@ -1118,7 +1118,7 @@ class Doku_Indexer { protected function getIndexKey($idx, $suffix, $id) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix.'.idx'; - if (!@file_exists($fn)) return ''; + if (!file_exists($fn)) return ''; $fh = @fopen($fn, 'r'); if (!$fh) return ''; $ln = -1; @@ -1228,7 +1228,7 @@ class Doku_Indexer { // testing if index files exist only $path = $conf['indexdir']."/i"; foreach ($filter as $key => $value) { - if (@file_exists($path.$key.'.idx')) + if (file_exists($path.$key.'.idx')) $idx[] = $key; } } else { @@ -1339,7 +1339,7 @@ function & idx_get_stopwords() { if (is_null($stopwords)) { global $conf; $swfile = DOKU_INC.'inc/lang/'.$conf['lang'].'/stopwords.txt'; - if(@file_exists($swfile)){ + if(file_exists($swfile)){ $stopwords = file($swfile, FILE_IGNORE_NEW_LINES); }else{ $stopwords = array(); @@ -1364,7 +1364,7 @@ function idx_addPage($page, $verbose=false, $force=false) { $idxtag = metaFN($page,'.indexed'); // check if page was deleted but is still in the index if (!page_exists($page)) { - if (!@file_exists($idxtag)) { + if (!file_exists($idxtag)) { if ($verbose) print("Indexer: $page does not exist, ignoring".DOKU_LF); return false; } @@ -1379,7 +1379,7 @@ function idx_addPage($page, $verbose=false, $force=false) { } // check if indexing needed - if(!$force && @file_exists($idxtag)){ + if(!$force && file_exists($idxtag)){ if(trim(io_readFile($idxtag)) == idx_get_version()){ $last = @filemtime($idxtag); if($last > @filemtime(wikiFN($page))){ @@ -1392,7 +1392,7 @@ function idx_addPage($page, $verbose=false, $force=false) { $indexenabled = p_get_metadata($page, 'internal index', METADATA_RENDER_UNLIMITED); if ($indexenabled === false) { $result = false; - if (@file_exists($idxtag)) { + if (file_exists($idxtag)) { $Indexer = idx_get_indexer(); $result = $Indexer->deletePage($page); if ($result === "locked") { @@ -1494,7 +1494,7 @@ function idx_tokenizer($string, $wc=false) { function idx_getIndex($idx, $suffix) { global $conf; $fn = $conf['indexdir'].'/'.$idx.$suffix.'.idx'; - if (!@file_exists($fn)) return array(); + if (!file_exists($fn)) return array(); return file($fn); } @@ -1515,7 +1515,7 @@ function idx_listIndexLengths() { $docache = false; } else { clearstatcache(); - if (@file_exists($conf['indexdir'].'/lengths.idx') + if (file_exists($conf['indexdir'].'/lengths.idx') && (time() < @filemtime($conf['indexdir'].'/lengths.idx') + $conf['readdircache'])) { if (($lengths = @file($conf['indexdir'].'/lengths.idx', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)) !== false) { $idx = array(); @@ -1572,7 +1572,7 @@ function idx_indexLengths($filter) { // testing if index files exist only $path = $conf['indexdir']."/i"; foreach ($filter as $key => $value) { - if (@file_exists($path.$key.'.idx')) + if (file_exists($path.$key.'.idx')) $idx[] = $key; } } else { diff --git a/inc/infoutils.php b/inc/infoutils.php index 399963176..fe312d13f 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -58,7 +58,7 @@ function checkUpdateMessages(){ function getVersionData(){ $version = array(); //import version string - if(@file_exists(DOKU_INC.'VERSION')){ + if(file_exists(DOKU_INC.'VERSION')){ //official release $version['date'] = trim(io_readfile(DOKU_INC.'VERSION')); $version['type'] = 'Release'; @@ -141,20 +141,20 @@ function check(){ if(is_writable($conf['changelog'])){ msg('Changelog is writable',1); }else{ - if (@file_exists($conf['changelog'])) { + if (file_exists($conf['changelog'])) { msg('Changelog is not writable',-1); } } - if (isset($conf['changelog_old']) && @file_exists($conf['changelog_old'])) { + if (isset($conf['changelog_old']) && file_exists($conf['changelog_old'])) { msg('Old changelog exists', 0); } - if (@file_exists($conf['changelog'].'_failed')) { + if (file_exists($conf['changelog'].'_failed')) { msg('Importing old changelog failed', -1); - } else if (@file_exists($conf['changelog'].'_importing')) { + } else if (file_exists($conf['changelog'].'_importing')) { msg('Importing old changelog now.', 0); - } else if (@file_exists($conf['changelog'].'_import_ok')) { + } else if (file_exists($conf['changelog'].'_import_ok')) { msg('Old changelog imported', 1); if (!plugin_isdisabled('importoldchangelog')) { msg('Importoldchangelog plugin not disabled after import', -1); diff --git a/inc/init.php b/inc/init.php index 12bb6f588..91bc77f98 100644 --- a/inc/init.php +++ b/inc/init.php @@ -16,7 +16,7 @@ $config_cascade = array(); // if available load a preload config file $preload = fullpath(dirname(__FILE__)).'/preload.php'; -if (@file_exists($preload)) include($preload); +if (file_exists($preload)) include($preload); // define the include path if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); @@ -28,7 +28,7 @@ if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); // check for error reporting override or set error reporting to sane values -if (!defined('DOKU_E_LEVEL') && @file_exists(DOKU_CONF.'report_e_all')) { +if (!defined('DOKU_E_LEVEL') && file_exists(DOKU_CONF.'report_e_all')) { define('DOKU_E_LEVEL', E_ALL); } if (!defined('DOKU_E_LEVEL')) { @@ -65,7 +65,7 @@ $conf = array(); foreach (array('default','local','protected') as $config_group) { if (empty($config_cascade['main'][$config_group])) continue; foreach ($config_cascade['main'][$config_group] as $config_file) { - if (@file_exists($config_file)) { + if (file_exists($config_file)) { include($config_file); } } @@ -79,7 +79,7 @@ $license = array(); foreach (array('default','local') as $config_group) { if (empty($config_cascade['license'][$config_group])) continue; foreach ($config_cascade['license'][$config_group] as $config_file) { - if(@file_exists($config_file)){ + if(file_exists($config_file)){ include($config_file); } } @@ -272,7 +272,7 @@ function init_lang($langCode) { //load the language files require(DOKU_INC.'inc/lang/en/lang.php'); foreach ($config_cascade['lang']['core'] as $config_file) { - if (@file_exists($config_file . 'en/lang.php')) { + if (file_exists($config_file . 'en/lang.php')) { include($config_file . 'en/lang.php'); } } @@ -282,7 +282,7 @@ function init_lang($langCode) { require(DOKU_INC."inc/lang/$langCode/lang.php"); } foreach ($config_cascade['lang']['core'] as $config_file) { - if (@file_exists($config_file . "$langCode/lang.php")) { + if (file_exists($config_file . "$langCode/lang.php")) { include($config_file . "$langCode/lang.php"); } } @@ -298,7 +298,7 @@ function init_files(){ $files = array($conf['indexdir'].'/page.idx'); foreach($files as $file){ - if(!@file_exists($file)){ + if(!file_exists($file)){ $fh = @fopen($file,'a'); if($fh){ fclose($fh); @@ -312,7 +312,7 @@ function init_files(){ # create title index (needs to have same length as page.idx) /* $file = $conf['indexdir'].'/title.idx'; - if(!@file_exists($file)){ + if(!file_exists($file)){ $pages = file($conf['indexdir'].'/page.idx'); $pages = count($pages); $fh = @fopen($file,'a'); @@ -339,9 +339,9 @@ function init_files(){ function init_path($path){ // check existence $p = fullpath($path); - if(!@file_exists($p)){ + if(!file_exists($p)){ $p = fullpath(DOKU_INC.$path); - if(!@file_exists($p)){ + if(!file_exists($p)){ return ''; } } @@ -352,7 +352,7 @@ function init_path($path){ } // check accessability (execute bit) for directories - if(@is_dir($p) && !@file_exists("$p/.")){ + if(@is_dir($p) && !file_exists("$p/.")){ return ''; } @@ -593,7 +593,7 @@ function fullpath($path,$exists=false){ $finalpath = $root.implode('/', $newpath); // check for existence when needed (except when unit testing) - if($exists && !defined('DOKU_UNITTEST') && !@file_exists($finalpath)) { + if($exists && !defined('DOKU_UNITTEST') && !file_exists($finalpath)) { return false; } return $finalpath; diff --git a/inc/io.php b/inc/io.php index bfa394a17..3ed227162 100644 --- a/inc/io.php +++ b/inc/io.php @@ -105,7 +105,7 @@ function _io_readWikiPage_action($data) { */ function io_readFile($file,$clean=true){ $ret = ''; - if(@file_exists($file)){ + if(file_exists($file)){ if(substr($file,-3) == '.gz'){ $ret = join('',gzfile($file)); }else if(substr($file,-4) == '.bz2'){ @@ -204,7 +204,7 @@ function io_saveFile($file,$content,$append=false){ global $conf; $mode = ($append) ? 'ab' : 'wb'; - $fileexists = @file_exists($file); + $fileexists = file_exists($file); io_makeFileDir($file); io_lock($file); if(substr($file,-3) == '.gz'){ @@ -258,7 +258,7 @@ function io_saveFile($file,$content,$append=false){ * @return bool true on success */ function io_deleteFromFile($file,$badline,$regex=false){ - if (!@file_exists($file)) return true; + if (!file_exists($file)) return true; io_lock($file); @@ -385,7 +385,7 @@ function io_createNamespace($id, $ns_type='pages') { $ns_stack = explode(':', $id); $ns = $id; $tmp = dirname( $file = call_user_func($types[$ns_type], $ns) ); - while (!@is_dir($tmp) && !(@file_exists($tmp) && !is_dir($tmp))) { + while (!@is_dir($tmp) && !(file_exists($tmp) && !is_dir($tmp))) { array_pop($ns_stack); $ns = implode(':', $ns_stack); if (strlen($ns)==0) { break; } @@ -429,7 +429,7 @@ function io_makeFileDir($file){ function io_mkdir_p($target){ global $conf; if (@is_dir($target)||empty($target)) return 1; // best case check first - if (@file_exists($target) && !is_dir($target)) return 0; + if (file_exists($target) && !is_dir($target)) return 0; //recursion if (io_mkdir_p(substr($target,0,strrpos($target,'/')))){ if($conf['safemodehack']){ @@ -606,7 +606,7 @@ function io_download($url,$file,$useAttachment=false,$defaultName='',$maxSize=20 $file = $file.$name; } - $fileexists = @file_exists($file); + $fileexists = file_exists($file); $fp = @fopen($file,"w"); if(!$fp) return false; fwrite($fp,$data); diff --git a/inc/load.php b/inc/load.php index ac2812a0b..18786dc79 100644 --- a/inc/load.php +++ b/inc/load.php @@ -119,7 +119,7 @@ function load_autoload($name){ // try to load the wanted plugin file $c = ((count($m) === 4) ? "/{$m[3]}" : ''); $plg = DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php"; - if(@file_exists($plg)){ + if(file_exists($plg)){ include_once DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php"; } return; diff --git a/inc/media.php b/inc/media.php index 09bfc99ac..81081d5dc 100644 --- a/inc/media.php +++ b/inc/media.php @@ -70,7 +70,7 @@ function media_metasave($id,$auth,$data){ } $old = @filemtime($src); - if(!@file_exists(mediaFN($id, $old)) && @file_exists($src)) { + if(!file_exists(mediaFN($id, $old)) && file_exists($src)) { // add old revision to the attic media_saveOldRevision($id); } @@ -141,7 +141,7 @@ function media_metaform($id,$auth){ if(is_null($fields)){ $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { - if(@file_exists($config_file)) include($config_file); + if(file_exists($config_file)) include($config_file); } } @@ -241,14 +241,14 @@ function media_delete($id,$auth){ $data['id'] = $id; $data['name'] = utf8_basename($file); $data['path'] = $file; - $data['size'] = (@file_exists($file)) ? filesize($file) : 0; + $data['size'] = (file_exists($file)) ? filesize($file) : 0; $data['unl'] = false; $data['del'] = false; $evt = new Doku_Event('MEDIA_DELETE_FILE',$data); if ($evt->advise_before()) { $old = @filemtime($file); - if(!@file_exists(mediaFN($id, $old)) && @file_exists($file)) { + if(!file_exists(mediaFN($id, $old)) && file_exists($file)) { // add old revision to the attic media_saveOldRevision($id); } @@ -431,7 +431,7 @@ function media_save($file, $id, $ow, $auth, $move) { } //check for overwrite - $overwrite = @file_exists($fn); + $overwrite = file_exists($fn); $auth_ow = (($conf['mediarevisions']) ? AUTH_UPLOAD : AUTH_DELETE); if($overwrite && (!$ow || $auth < $auth_ow)) { return array($lang['uploadexist'], 0); @@ -497,7 +497,7 @@ function media_upload_finish($fn_tmp, $fn, $id, $imime, $overwrite, $move = 'mov global $REV; $old = @filemtime($fn); - if(!@file_exists(mediaFN($id, $old)) && @file_exists($fn)) { + if(!file_exists(mediaFN($id, $old)) && file_exists($fn)) { // add old revision to the attic if missing media_saveOldRevision($id); } @@ -541,7 +541,7 @@ function media_saveOldRevision($id){ global $conf, $lang; $oldf = mediaFN($id); - if(!@file_exists($oldf)) return ''; + if(!file_exists($oldf)) return ''; $date = filemtime($oldf); if (!$conf['mediarevisions']) return $date; @@ -549,7 +549,7 @@ function media_saveOldRevision($id){ if (!$medialog->getRevisionInfo($date)) { // there was an external edit, // there is no log entry for current version of file - if (!@file_exists(mediaMetaFN($id,'.changes'))) { + if (!file_exists(mediaMetaFN($id,'.changes'))) { addMediaLogEntry($date, $id, DOKU_CHANGE_TYPE_CREATE, $lang['created']); } else { addMediaLogEntry($date, $id, DOKU_CHANGE_TYPE_EDIT); @@ -721,7 +721,7 @@ function media_tabs_details($image, $selected_tab = ''){ 'caption' => $lang['media_viewtab']); list(, $mime) = mimetype($image); - if ($mime == 'image/jpeg' && @file_exists(mediaFN($image))) { + if ($mime == 'image/jpeg' && file_exists(mediaFN($image))) { $tabs['edit'] = array('href' => media_managerURL(array('tab_details' => 'edit'), '&'), 'caption' => $lang['media_edittab']); } @@ -1008,7 +1008,7 @@ function media_preview_buttons($image, $auth, $rev='') { echo '<ul class="actions">'.NL; - if($auth >= AUTH_DELETE && !$rev && @file_exists(mediaFN($image))){ + if($auth >= AUTH_DELETE && !$rev && file_exists(mediaFN($image))){ // delete button $form = new Doku_Form(array('id' => 'mediamanager__btn_delete', @@ -1031,7 +1031,7 @@ function media_preview_buttons($image, $auth, $rev='') { echo '</li>'.NL; } - if($auth >= AUTH_UPLOAD && $rev && $conf['mediarevisions'] && @file_exists(mediaFN($image, $rev))){ + if($auth >= AUTH_UPLOAD && $rev && $conf['mediarevisions'] && file_exists(mediaFN($image, $rev))){ // restore button $form = new Doku_Form(array('id' => 'mediamanager__btn_restore', @@ -1103,7 +1103,7 @@ function media_file_tags($meta) { if(is_null($fields)){ $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { - if(@file_exists($config_file)) include($config_file); + if(file_exists($config_file)) include($config_file); } } @@ -1580,7 +1580,7 @@ function media_printfile($item,$auth,$jump,$display_namespace=false){ function media_printicon($filename, $size=''){ list($ext) = mimetype(mediaFN($filename),false); - if (@file_exists(DOKU_INC.'lib/images/fileicons/'.$size.'/'.$ext.'.png')) { + if (file_exists(DOKU_INC.'lib/images/fileicons/'.$size.'/'.$ext.'.png')) { $icon = DOKU_BASE.'lib/images/fileicons/'.$size.'/'.$ext.'.png'; } else { $icon = DOKU_BASE.'lib/images/fileicons/'.$size.'/file.png'; @@ -2165,7 +2165,7 @@ function media_image_download($url,$file){ $data = $http->get($url); if(!$data) return false; - $fileexists = @file_exists($file); + $fileexists = file_exists($file); $fp = @fopen($file,"w"); if(!$fp) return false; fwrite($fp,$data); diff --git a/inc/pageutils.php b/inc/pageutils.php index 2fbcbfd1f..375712661 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -263,7 +263,7 @@ function page_exists($id,$rev='',$clean=true, $date_at=false) { if($pagelog_rev !== false) $rev = $pagelog_rev; } - return @file_exists(wikiFN($id,$rev,$clean)); + return file_exists(wikiFN($id,$rev,$clean)); } /** @@ -299,9 +299,9 @@ function wikiFN($raw_id,$rev='',$clean=true){ $fn = $conf['olddir'].'/'.utf8_encodeFN($id).'.'.$rev.'.txt'; if($conf['compression']){ //test for extensions here, we want to read both compressions - if (@file_exists($fn . '.gz')){ + if (file_exists($fn . '.gz')){ $fn .= '.gz'; - }else if(@file_exists($fn . '.bz2')){ + }else if(file_exists($fn . '.bz2')){ $fn .= '.bz2'; }else{ //file doesnt exist yet, so we take the configured extension @@ -418,9 +418,9 @@ function mediaFN($id, $rev=''){ function localeFN($id,$ext='txt'){ global $conf; $file = DOKU_CONF.'lang/'.$conf['lang'].'/'.$id.'.'.$ext; - if(!@file_exists($file)){ + if(!file_exists($file)){ $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.'.$ext; - if(!@file_exists($file)){ + if(!file_exists($file)){ //fall back to english $file = DOKU_INC.'inc/lang/en/'.$id.'.'.$ext; } @@ -504,7 +504,7 @@ function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){ } $file = mediaFN($page,$rev); - $exists = @file_exists($file); + $exists = file_exists($file); } /** @@ -565,7 +565,7 @@ function resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){ } }else{ //check alternative plural/nonplural form - if(!@file_exists($file)){ + if(!file_exists($file)){ if( $conf['autoplural'] ){ if(substr($page,-1) == 's'){ $try = substr($page,0,-1); diff --git a/inc/parserutils.php b/inc/parserutils.php index 3ef8138a7..17c331ef5 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -71,13 +71,13 @@ function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){ $ID = $id; if($rev || $date_at){ - if(@file_exists($file)){ + if(file_exists($file)){ $ret = p_render('xhtml',p_get_instructions(io_readWikiPage($file,$id,$rev)),$info,$date_at); //no caching on old revisions }elseif($excuse){ $ret = p_locale_xhtml('norev'); } }else{ - if(@file_exists($file)){ + if(file_exists($file)){ $ret = p_cached_output($file,'xhtml',$id); }elseif($excuse){ $ret = p_locale_xhtml('newpage'); @@ -156,7 +156,7 @@ function p_cached_instructions($file,$cacheonly=false,$id='') { if ($cacheonly || $cache->useCache() || (isset($run[$file]) && !defined('DOKU_UNITTEST'))) { return $cache->retrieveCache(); - } else if (@file_exists($file)) { + } else if (file_exists($file)) { // no cache - do some work $ins = p_get_instructions(io_readWikiPage($file,$id)); if ($cache->storeCache($ins)) { @@ -248,7 +248,7 @@ function p_get_metadata($id, $key='', $render=METADATA_RENDER_USING_CACHE){ if ($render & METADATA_RENDER_USING_SIMPLE_CACHE) { $pagefn = wikiFN($id); $metafn = metaFN($id, '.meta'); - if (!@file_exists($metafn) || @filemtime($pagefn) > @filemtime($cachefile->cache)) { + if (!file_exists($metafn) || @filemtime($pagefn) > @filemtime($cachefile->cache)) { $do_render = true; } } elseif (!$cachefile->useCache()){ @@ -414,7 +414,7 @@ function p_read_metadata($id,$cache=false) { if (isset($cache_metadata[(string)$id])) return $cache_metadata[(string)$id]; $file = metaFN($id, '.meta'); - $meta = @file_exists($file) ? unserialize(io_readFile($file, false)) : array('current'=>array(),'persistent'=>array()); + $meta = file_exists($file) ? unserialize(io_readFile($file, false)) : array('current'=>array(),'persistent'=>array()); if ($cache) { $cache_metadata[(string)$id] = $meta; diff --git a/inc/plugin.php b/inc/plugin.php index 9d9b2044c..f2ad95e2e 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -33,7 +33,7 @@ class DokuWiki_Plugin { public function getInfo(){ $parts = explode('_', get_class($this)); $info = DOKU_PLUGIN . '/' . $parts[2] . '/plugin.info.txt'; - if(@file_exists($info)) return confToHash($info); + if(file_exists($info)) return confToHash($info); msg( 'getInfo() not implemented in ' . get_class($this) . ' and ' . $info . ' not found.<br />' . @@ -112,9 +112,9 @@ class DokuWiki_Plugin { global $conf; $plugin = $this->getPluginName(); $file = DOKU_CONF.'plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; - if (!@file_exists($file)){ + if (!file_exists($file)){ $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; - if(!@file_exists($file)){ + if(!file_exists($file)){ //fall back to english $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; } @@ -137,7 +137,7 @@ class DokuWiki_Plugin { // don't include once, in case several plugin components require the same language file @include($path . 'en/lang.php'); foreach($config_cascade['lang']['plugin'] as $config_file) { - if(@file_exists($config_file . $this->getPluginName() . '/en/lang.php')) { + if(file_exists($config_file . $this->getPluginName() . '/en/lang.php')) { include($config_file . $this->getPluginName() . '/en/lang.php'); } } @@ -145,7 +145,7 @@ class DokuWiki_Plugin { if($conf['lang'] != 'en') { @include($path . $conf['lang'] . '/lang.php'); foreach($config_cascade['lang']['plugin'] as $config_file) { - if(@file_exists($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php')) { + if(file_exists($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php')) { include($config_file . $this->getPluginName() . '/' . $conf['lang'] . '/lang.php'); } } @@ -207,7 +207,7 @@ class DokuWiki_Plugin { $path = DOKU_PLUGIN.$this->getPluginName().'/conf/'; $conf = array(); - if (@file_exists($path.'default.php')) { + if (file_exists($path.'default.php')) { include($path.'default.php'); } diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php index dfd4d0a29..ad73e1528 100644 --- a/inc/plugincontroller.class.php +++ b/inc/plugincontroller.class.php @@ -177,7 +177,7 @@ class Doku_Plugin_Controller { // disabling mechanism was changed back very soon again // to keep everything simple we just skip the plugin completely continue; - } elseif (@file_exists(DOKU_PLUGIN.$plugin.'/disabled')) { + } elseif (file_exists(DOKU_PLUGIN.$plugin.'/disabled')) { /** * treat this as a default disabled plugin(over-rideable by the plugin manager) * @deprecated 2011-09-10 (usage of disabled files) @@ -247,9 +247,9 @@ class Doku_Plugin_Controller { $out .= "\$plugins['$plugin'] = $value;\n"; } // backup current file (remove any existing backup) - if (@file_exists($file)) { + if (file_exists($file)) { $backup = $file.'.bak'; - if (@file_exists($backup)) @unlink($backup); + if (file_exists($backup)) @unlink($backup); if (!@copy($file,$backup)) return false; if (!empty($conf['fperm'])) chmod($backup, $conf['fperm']); } @@ -314,7 +314,7 @@ class Doku_Plugin_Controller { foreach ($master_list as $plugin) { $dir = $this->get_directory($plugin); - if (@file_exists(DOKU_PLUGIN."$dir/$type.php")){ + if (file_exists(DOKU_PLUGIN."$dir/$type.php")){ $plugins[] = $plugin; } else { if ($dp = @opendir(DOKU_PLUGIN."$dir/$type/")) { diff --git a/inc/subscription.php b/inc/subscription.php index 58376f2ec..8b6dcb27e 100644 --- a/inc/subscription.php +++ b/inc/subscription.php @@ -166,7 +166,7 @@ class Subscription { // Handle files. $result = array(); foreach($files as $target => $file) { - if(!@file_exists($file)) continue; + if(!file_exists($file)) continue; $lines = file($file); foreach($lines as $line) { diff --git a/inc/template.php b/inc/template.php index 3bccb0bd8..646f0873a 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1124,7 +1124,7 @@ function tpl_get_img_meta() { $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { - if(@file_exists($config_file)) { + if(file_exists($config_file)) { include($config_file); } } @@ -1297,7 +1297,7 @@ function tpl_loadConfig() { $file = tpl_incdir().'/conf/default.php'; $conf = array(); - if(!@file_exists($file)) return false; + if(!file_exists($file)) return false; // load default config file include($file); @@ -1327,7 +1327,7 @@ function tpl_getLang($id) { // don't include once @include($path . 'en/lang.php'); foreach($config_cascade['lang']['template'] as $config_file) { - if(@file_exists($config_file . $conf['template'] . '/en/lang.php')) { + if(file_exists($config_file . $conf['template'] . '/en/lang.php')) { include($config_file . $conf['template'] . '/en/lang.php'); } } @@ -1335,7 +1335,7 @@ function tpl_getLang($id) { if($conf['lang'] != 'en') { @include($path . $conf['lang'] . '/lang.php'); foreach($config_cascade['lang']['template'] as $config_file) { - if(@file_exists($config_file . $conf['template'] . '/' . $conf['lang'] . '/lang.php')) { + if(file_exists($config_file . $conf['template'] . '/' . $conf['lang'] . '/lang.php')) { include($config_file . $conf['template'] . '/' . $conf['lang'] . '/lang.php'); } } @@ -1365,9 +1365,9 @@ function tpl_localeFN($id) { $path = tpl_incdir().'lang/'; global $conf; $file = DOKU_CONF.'template_lang/'.$conf['template'].'/'.$conf['lang'].'/'.$id.'.txt'; - if (!@file_exists($file)){ + if (!file_exists($file)){ $file = $path.$conf['lang'].'/'.$id.'.txt'; - if(!@file_exists($file)){ + if(!file_exists($file)){ //fall back to english $file = $path.'en/'.$id.'.txt'; } diff --git a/install.php b/install.php index d031cb3d9..1a2d03dff 100644 --- a/install.php +++ b/install.php @@ -110,7 +110,7 @@ header('Content-Type: text/html; charset=utf-8'); <div style="float: right; width: 34%;"> <?php - if(@file_exists(DOKU_INC.'inc/lang/'.$LC.'/install.html')){ + if(file_exists(DOKU_INC.'inc/lang/'.$LC.'/install.html')){ include(DOKU_INC.'inc/lang/'.$LC.'/install.html'); }else{ print "<div lang=\"en\" dir=\"ltr\">\n"; @@ -497,7 +497,7 @@ function check_configs(){ // configs shouldn't exist foreach ($config_files as $file) { - if (@file_exists($file) && filesize($file)) { + if (file_exists($file) && filesize($file)) { $file = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}/', $file); $error[] = sprintf($lang['i_confexists'],$file); $ok = false; @@ -535,7 +535,7 @@ function check_permissions(){ $ok = true; foreach($dirs as $dir){ - if(!@file_exists("$dir/.") || !@is_writable($dir)){ + if(!file_exists("$dir/.") || !is_writable($dir)){ $dir = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', $dir); $error[] = sprintf($lang['i_permfail'],$dir); $ok = false; @@ -604,7 +604,7 @@ function langsel(){ $langs = array(); while (($file = readdir($dh)) !== false) { if(preg_match('/^[\._]/',$file)) continue; - if(is_dir($dir.'/'.$file) && @file_exists($dir.'/'.$file.'/lang.php')){ + if(is_dir($dir.'/'.$file) && file_exists($dir.'/'.$file.'/lang.php')){ $langs[] = $file; } } diff --git a/lib/exe/css.php b/lib/exe/css.php index b1065f518..e0bc68312 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -365,11 +365,11 @@ function css_interwiki(){ $iwlinks = getInterwiki(); foreach(array_keys($iwlinks) as $iw){ $class = preg_replace('/[^_\-a-z0-9]+/i','_',$iw); - if(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ + if(file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.png')){ echo "a.iw_$class {"; echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.png)'; echo '}'; - }elseif(@file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ + }elseif(file_exists(DOKU_INC.'lib/images/interwiki/'.$iw.'.gif')){ echo "a.iw_$class {"; echo ' background-image: url('.DOKU_BASE.'lib/images/interwiki/'.$iw.'.gif)'; echo '}'; @@ -451,7 +451,7 @@ class DokuCssFile { * @return string the CSS/Less contents of the file */ public function load($location='') { - if (!@file_exists($this->filepath)) return ''; + if (!file_exists($this->filepath)) return ''; $css = io_readFile($this->filepath); if (!$location) return $css; diff --git a/lib/exe/detail.php b/lib/exe/detail.php index cc29d5b87..ec1a9b874 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -37,7 +37,7 @@ $AUTH = auth_quickaclcheck($IMG); if($AUTH >= AUTH_READ){ // check if image exists $SRC = mediaFN($IMG,$REV); - if(!@file_exists($SRC)){ + if(!file_exists($SRC)){ //doesn't exist! http_status(404); $ERROR = 'File not found'; diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 89c4b7cd0..330b8498d 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -68,9 +68,9 @@ function runTrimRecentChanges($media_changes = false) { // Trims the recent changes cache to the last $conf['changes_days'] recent // changes or $conf['recent'] items, which ever is larger. // The trimming is only done once a day. - if (@file_exists($fn) && + if (file_exists($fn) && (@filemtime($fn.'.trimmed')+86400)<time() && - !@file_exists($fn.'_tmp')) { + !file_exists($fn.'_tmp')) { @touch($fn.'.trimmed'); io_lock($fn); $lines = file($fn); diff --git a/lib/exe/js.php b/lib/exe/js.php index 793104e81..3f9781e34 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -160,7 +160,7 @@ function js_out(){ * @param string $file filename path to file */ function js_load($file){ - if(!@file_exists($file)) return; + if(!file_exists($file)) return; static $loaded = array(); $data = io_readFile($file); @@ -179,7 +179,7 @@ function js_load($file){ if($ifile{0} != '/') $ifile = dirname($file).'/'.$ifile; - if(@file_exists($ifile)){ + if(file_exists($ifile)){ $idata = io_readFile($ifile); }else{ $idata = ''; @@ -221,10 +221,10 @@ function js_pluginstrings() { $plugins = plugin_list(); foreach ($plugins as $p){ if (isset($lang)) unset($lang); - if (@file_exists(DOKU_PLUGIN."$p/lang/en/lang.php")) { + if (file_exists(DOKU_PLUGIN."$p/lang/en/lang.php")) { include DOKU_PLUGIN."$p/lang/en/lang.php"; } - if (isset($conf['lang']) && $conf['lang']!='en' && @file_exists(DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php")) { + if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php")) { include DOKU_PLUGIN."$p/lang/".$conf['lang']."/lang.php"; } if (isset($lang['js'])) { @@ -245,10 +245,10 @@ function js_pluginstrings() { function js_templatestrings() { global $conf; $templatestrings = array(); - if (@file_exists(tpl_incdir()."lang/en/lang.php")) { + if (file_exists(tpl_incdir()."lang/en/lang.php")) { include tpl_incdir()."lang/en/lang.php"; } - if (isset($conf['lang']) && $conf['lang']!='en' && @file_exists(tpl_incdir()."lang/".$conf['lang']."/lang.php")) { + if (isset($conf['lang']) && $conf['lang']!='en' && file_exists(tpl_incdir()."lang/".$conf['lang']."/lang.php")) { include tpl_incdir()."lang/".$conf['lang']."/lang.php"; } if (isset($lang['js'])) { diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php index fd2d0b249..b31c02fc8 100644 --- a/lib/plugins/authplain/auth.php +++ b/lib/plugins/authplain/auth.php @@ -325,7 +325,7 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin { $this->users = array(); - if(!@file_exists($config_cascade['plainauth.users']['default'])) return; + if(!file_exists($config_cascade['plainauth.users']['default'])) return; $lines = file($config_cascade['plainauth.users']['default']); foreach($lines as $line) { diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 9202a221b..2ef570b68 100644 --- a/lib/plugins/config/admin.php +++ b/lib/plugins/config/admin.php @@ -282,7 +282,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { if ($plugin == '.' || $plugin == '..' || $plugin == 'tmp' || $plugin == 'config') continue; if (is_file(DOKU_PLUGIN.$plugin)) continue; - if (@file_exists(DOKU_PLUGIN.$plugin.$enlangfile)){ + if (file_exists(DOKU_PLUGIN.$plugin.$enlangfile)){ $lang = array(); @include(DOKU_PLUGIN.$plugin.$enlangfile); if ($conf['lang'] != 'en') @include(DOKU_PLUGIN.$plugin.$langfile); @@ -303,7 +303,7 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin { // the same for the active template $tpl = $conf['template']; - if (@file_exists(tpl_incdir().$enlangfile)){ + if (file_exists(tpl_incdir().$enlangfile)){ $lang = array(); @include(tpl_incdir().$enlangfile); if ($conf['lang'] != 'en') @include(tpl_incdir().$langfile); diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 590631dae..56b9a918d 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -40,7 +40,7 @@ if (!class_exists('configuration')) { public function configuration($datafile) { global $conf, $config_cascade; - if (!@file_exists($datafile)) { + if (!file_exists($datafile)) { msg('No configuration metadata found at - '.htmlspecialchars($datafile),-1); return; } @@ -125,8 +125,8 @@ if (!class_exists('configuration')) { $file = end($this->_local_files); // backup current file (remove any existing backup) - if (@file_exists($file) && $backup) { - if (@file_exists($file.'.bak')) @unlink($file.'.bak'); + if (@file_exists$file) && $backup) { + if (@ffile_existsfile.'.bak')) @unlink($file.'.bak'); if (!io_rename($file, $file.'.bak')) return false; } @@ -191,7 +191,7 @@ if (!class_exists('configuration')) { if ($this->_format == 'php') { - if(@file_exists($file)){ + if(@fifile_existsile)){ $contents = @php_strip_whitespace($file); }else{ $contents = ''; @@ -281,7 +281,7 @@ if (!class_exists('configuration')) { $local = $this->_local_files[0]; if (!is_writable(dirname($local))) return true; - if (@file_exists($local) && !is_writable($local)) return true; + if (@filfile_existscal) && !is_writable($local)) return true; return false; } @@ -345,7 +345,7 @@ if (!class_exists('configuration')) { foreach ($this->get_plugin_list() as $plugin) { $plugin_dir = plugin_directory($plugin); - if (@file_exists(DOKU_PLUGIN.$plugin_dir.$file)){ + if (@filefile_exists_PLUGIN.$plugin_dir.$file)){ $meta = array(); @include(DOKU_PLUGIN.$plugin_dir.$file); @include(DOKU_PLUGIN.$plugin_dir.$class); @@ -360,7 +360,7 @@ if (!class_exists('configuration')) { } // the same for the active template - if (@file_exists(tpl_incdir().$file)){ + if (@file_file_existsncdir().$file)){ $meta = array(); @include(tpl_incdir().$file); @include(tpl_incdir().$class); @@ -388,7 +388,7 @@ if (!class_exists('configuration')) { foreach ($this->get_plugin_list() as $plugin) { $plugin_dir = plugin_directory($plugin); - if (@file_exists(DOKU_PLUGIN.$plugin_dir.$file)){ + if (@file_efile_existsLUGIN.$plugin_dir.$file)){ $conf = $this->_read_config(DOKU_PLUGIN.$plugin_dir.$file); foreach ($conf as $key => $value){ $default['plugin'.CM_KEYMARKER.$plugin.CM_KEYMARKER.$key] = $value; diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 232a8177f..fd3a90e28 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -151,7 +151,7 @@ if (!class_exists('setting_im_convert')) { $value = is_null($this->_local) ? $this->_default : $this->_local; if ($value == $input) return false; - if ($input && !@file_exists($input)) { + if ($input && !file_exists($input)) { $this->_error = true; $this->_input = $input; return false; diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index dfa624907..6c0946b09 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -707,7 +707,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { $plugin = null; foreach($plugin_types as $type) { - if(@file_exists($path.$type.'.php')) { + if(file_exists($path.$type.'.php')) { $plugin = plugin_load($type, $this->base); if ($plugin) break; } @@ -907,12 +907,12 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { // check to make sure we aren't overwriting anything $target = $target_base_dir.$item['base']; - if(!$overwrite && @file_exists($target)) { + if(!$overwrite && file_exists($target)) { // TODO remember our settings, ask the user to confirm overwrite continue; } - $action = @file_exists($target) ? 'update' : 'install'; + $action = file_exists($target) ? 'update' : 'install'; // copy action if($this->dircopy($item['tmp'], $target)) { @@ -1117,7 +1117,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { return $ok; } else { - $exists = @file_exists($dst); + $exists = file_exists($dst); if(!@copy($src, $dst)) return false; if(!$exists && !empty($conf['fperm'])) chmod($dst, $conf['fperm']); diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php index bd2d090e1..ab569b8b4 100644 --- a/lib/plugins/popularity/admin.php +++ b/lib/plugins/popularity/admin.php @@ -87,7 +87,7 @@ class admin_plugin_popularity extends DokuWiki_Admin_Plugin { //If there was an error the last time we tried to autosubmit, warn the user if ( $this->helper->isAutoSubmitEnabled() ){ - if ( @file_exists($this->helper->autosubmitErrorFile) ){ + if ( file_exists($this->helper->autosubmitErrorFile) ){ echo $this->getLang('autosubmitError'); echo io_readFile( $this->helper->autosubmitErrorFile ); } diff --git a/lib/plugins/popularity/helper.php b/lib/plugins/popularity/helper.php index b4fb33b90..8673fb5af 100644 --- a/lib/plugins/popularity/helper.php +++ b/lib/plugins/popularity/helper.php @@ -78,7 +78,7 @@ class helper_plugin_popularity extends Dokuwiki_Plugin { * @return boolean TRUE if we should send data once a month, FALSE otherwise */ function isAutoSubmitEnabled(){ - return @file_exists($this->autosubmitFile); + return file_exists($this->autosubmitFile); } /** -- GitLab