Project

General

Profile

Bug #19284 ยป remove_at-file_exists.diff

Administrator Admin, 2008-09-03 22:39

View differences:

t3lib/class.t3lib_basicfilefunc.php (working copy)
// Check if the file exists and if not - return the filename...
$fileInfo = $origFileInfo;
$theDestFile = $theDest.'/'.$fileInfo['file']; // The destinations file
if (!@file_exists($theDestFile) || $dontCheckForUnique) { // If the file does NOT exist we return this filename
if (!file_exists($theDestFile) || $dontCheckForUnique) { // If the file does NOT exist we return this filename
return $theDestFile;
}
......
}
$theTestFile = $theTempFileBody.$insert.$theOrigExt;
$theDestFile = $theDest.'/'.$theTestFile; // The destinations file
if (!@file_exists($theDestFile)) { // If the file does NOT exist we return this filename
if (!file_exists($theDestFile)) { // If the file does NOT exist we return this filename
return $theDestFile;
}
}
t3lib/class.t3lib_formmail.php (working copy)
$theFile = t3lib_div::upload_to_tempfile($_FILES[$varname]['tmp_name']);
$theName = $_FILES[$varname]['name'];
if ($theFile && @file_exists($theFile)) {
if ($theFile && file_exists($theFile)) {
if (filesize($theFile) < $GLOBALS['TYPO3_CONF_VARS']['FE']['formmailMaxAttachmentSize']) {
$this->addAttachment($theFile, $theName);
}
t3lib/class.t3lib_iconworks.php (working copy)
$path = PATH_site.'typo3temp/'.$iconFileName;
if (@file_exists(PATH_typo3.'icons/'.$iconFileName)) { // Returns if found in typo3/icons/
if (file_exists(PATH_typo3.'icons/'.$iconFileName)) { // Returns if found in typo3/icons/
return 'icons/'.$iconFileName;
} elseif (@file_exists($path)) { // Returns if found in ../typo3temp/icons/
} elseif (file_exists($path)) { // Returns if found in ../typo3temp/icons/
return $mainpath;
} else { // Makes icon:
if (@file_exists($absFile)) {
if (file_exists($absFile)) {
if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']) {
// Create image pointer, if possible
t3lib/class.t3lib_extfilefunc.php (working copy)
} else {
$theDestFile = $theDest.'/'.$fI['file'];
}
if ($theDestFile && !@file_exists($theDestFile)) {
if ($theDestFile && !file_exists($theDestFile)) {
if ($this->checkIfAllowed($fI['fileext'], $theDest, $fI['file'])) {
if ($this->checkPathAgainstMounts($theDestFile) && $this->checkPathAgainstMounts($theFile)) {
if ($this->PHPFileFunctions) {
......
} else {
$theDestFile = $theDest.'/'.$fI['file'];
}
if ($theDestFile && !@file_exists($theDestFile)) {
if ($theDestFile && !file_exists($theDestFile)) {
if (!t3lib_div::isFirstPartOfStr($theDestFile.'/',$theFile.'/')) { // Check if the one folder is inside the other or on the same level... to target/dest is the same?
if ($this->checkIfFullAccess($theDest) || $this->is_webPath($theDestFile)==$this->is_webPath($theFile)) { // no copy of folders between spaces
if ($this->checkPathAgainstMounts($theDestFile) && $this->checkPathAgainstMounts($theFile)) {
......
} else {
$theDestFile = $theDest.'/'.$fI['file'];
}
if ($theDestFile && !@file_exists($theDestFile)) {
if ($theDestFile && !file_exists($theDestFile)) {
if ($this->checkIfAllowed($fI['fileext'], $theDest, $fI['file'])) {
if ($this->checkPathAgainstMounts($theDestFile) && $this->checkPathAgainstMounts($theFile)) {
if ($this->PHPFileFunctions) {
......
} else {
$theDestFile = $theDest.'/'.$fI['file'];
}
if ($theDestFile && !@file_exists($theDestFile)) {
if ($theDestFile && !file_exists($theDestFile)) {
if (!t3lib_div::isFirstPartOfStr($theDestFile.'/',$theFile.'/')) { // Check if the one folder is inside the other or on the same level... to target/dest is the same?
if ($this->checkIfFullAccess($theDest) || $this->is_webPath($theDestFile)==$this->is_webPath($theFile)) { // // no moving of folders between spaces
if ($this->checkPathAgainstMounts($theDestFile) && $this->checkPathAgainstMounts($theFile)) {
......
if ($fileInfo['file']!=$theNewName) { // The name should be different from the current. And the filetype must be allowed
$theRenameName = $fileInfo['path'].$theNewName;
if ($this->checkPathAgainstMounts($fileInfo['path'])) {
if (!@file_exists($theRenameName)) {
if (!file_exists($theRenameName)) {
if ($type=='file') {
if ($this->actionPerms['renameFile']) {
$fI = t3lib_div::split_fileref($theRenameName);
......
if ($this->actionPerms['newFolder']) {
$theNewFolder = $theTarget.'/'.$theFolder;
if ($this->checkPathAgainstMounts($theNewFolder)) {
if (!@file_exists($theNewFolder)) {
if (!file_exists($theNewFolder)) {
if (t3lib_div::mkdir($theNewFolder)){
$this->writelog(6,0,1,'Directory "%s" created in "%s"',Array($theFolder,$theTarget.'/'));
return $theNewFolder;
......
if ($this->actionPerms['newFile']) {
$theNewFile = $theTarget.'/'.$newName;
if ($this->checkPathAgainstMounts($theNewFile)) {
if (!@file_exists($theNewFile)) {
if (!file_exists($theNewFile)) {
$fI = t3lib_div::split_fileref($theNewFile);
if ($this->checkIfAllowed($fI['fileext'], $fileInfo['path'], $fI['file'])) {
if (t3lib_div::inList($extList, $fI['fileext'])) {
t3lib/thumbs.php (working copy)
global $TYPO3_CONF_VARS;
// If file exists, we make a thumbsnail of the file.
if ($this->input && @file_exists($this->input)) {
if ($this->input && file_exists($this->input)) {
// Check file extension:
$reg = array();
......
if ($TYPO3_CONF_VARS['GFX']['im']) {
// If thumbnail does not exist, we generate it
if (!@file_exists($this->output)) {
if (!file_exists($this->output)) {
/* if (strstr($this->input,' ') || strstr($this->output,' ')) {
$this->errorGif('Spaces in','filepath',basename($this->input));
}
......
$parameters = '-sample '.$this->size.' '.$colors.' '.$this->wrapFileName($this->input.'[0]').' '.$this->wrapFileName($this->output);
$cmd = t3lib_div::imageMagickCommand('convert', $parameters);
exec($cmd);
if (!@file_exists($this->output)) {
if (!file_exists($this->output)) {
$this->errorGif('No thumb','generated!',basename($this->input));
}
}
t3lib/class.t3lib_loadmodules.php (working copy)
function checkMod($name, $fullpath) {
$modconf=Array();
$path = ereg_replace ('/[^/.]+/\.\./', '/', $fullpath); // because 'path/../path' does not work
if (@is_dir($path) && @file_exists($path.'/conf.php')) {
if (@is_dir($path) && file_exists($path.'/conf.php')) {
$MCONF = array();
$MLANG = array();
include($path.'/conf.php'); // The conf-file is included. This must be valid PHP.
......
// Default script setup
if ($MCONF['script']==='_DISPATCH') {
$modconf['script'] = 'mod.php?M='.rawurlencode($name);
} elseif ($MCONF['script'] && @file_exists($path.'/'.$MCONF['script'])) {
} elseif ($MCONF['script'] && file_exists($path.'/'.$MCONF['script'])) {
$modconf['script'] = $this->getRelativePath(PATH_typo3,$fullpath.'/'.$MCONF['script']);
} else {
$modconf['script'] = 'dummy.php';
......
if ($MCONF['navFrameScript']) {
$navFrameScript = explode('?', $MCONF['navFrameScript']);
$navFrameScript = $navFrameScript[0];
if (@file_exists($path.'/'.$navFrameScript)) {
if (file_exists($path.'/'.$navFrameScript)) {
$modconf['navFrameScript'] = $this->getRelativePath(PATH_typo3,$fullpath.'/'.$MCONF['navFrameScript']);
}
}
t3lib/class.t3lib_softrefproc.php (working copy)
$finalTagParts['url'] = $link_param;
} elseif ($containsSlash || $isLocalFile) { // file (internal)
$splitLinkParam = explode('?', $link_param);
if (@file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
if (file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
$finalTagParts['LINK_TYPE'] = 'file';
$finalTagParts['filepath'] = rawurldecode($splitLinkParam[0]);
$finalTagParts['query'] = $splitLinkParam[1];
t3lib/class.t3lib_stdgraphic.php (working copy)
if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output, $imagefile)) {
$this->imageMagickExec($imagefile.$frame, $output, $command);
}
if (@file_exists($output)) {
if (file_exists($output)) {
$info[3] = $output;
$info[2] = $newExt;
if ($params) { // params could realisticly change some imagedata!
......
*/
function getImageDimensions($imageFile) {
ereg('([^\.]*)$',$imageFile,$reg);
if (@file_exists($imageFile) && t3lib_div::inList($this->imageFileExt,strtolower($reg[0]))) {
if (file_exists($imageFile) && t3lib_div::inList($this->imageFileExt,strtolower($reg[0]))) {
if ($returnArr = $this->getCachedImageDimensions($imageFile)) {
return $returnArr;
} else {
......
*/
function file_exists_typo3temp_file($output,$orig='') {
if ($this->enable_typo3temp_db_tracking) {
if (@file_exists($output)) { // If file exists, then we return immediately
if (file_exists($output)) { // If file exists, then we return immediately
return 1;
} else { // If not, we look up in the cache_typo3temp_log table to see if there is a image being rendered right now.
$md5Hash=md5($output);
......
}
}
} else {
return @file_exists($output);
return file_exists($output);
}
}
t3lib/class.t3lib_clipboard.php (working copy)
$bgColClass = ($table=='_FILE'&&$this->fileMode)||($table!='_FILE'&&!$this->fileMode) ? 'bgColor4-20' : 'bgColor4';
if ($table=='_FILE') { // Rendering files/directories on the clipboard:
if (@file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
$fI = pathinfo($v);
$icon = is_dir($v) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
$size = ' ('.t3lib_div::formatSize(filesize($v)).'bytes)';
......
} else {
$str='<a href="'.htmlspecialchars($this->backPath.'db_list.php?id='.$rec['pid']).'">'.$str.'</a>';
}
} elseif (@file_exists($rec)) {
} elseif (file_exists($rec)) {
if (!$this->fileMode) {
$str=$GLOBALS['TBE_TEMPLATE']->dfw($str);
} else {
......
list($table,$uid) = explode('|',$k);
if ($table=='_FILE') { // Rendering files/directories on the clipboard:
if (@file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) {
$params[] = 'tx_impexp['.(is_dir($v) ? 'dir' : 'file').'][]='.rawurlencode($v);
}
} else { // Rendering records:
......
$this->changed=1;
}
} else {
if (!$v || !@file_exists($v)) {
if (!$v || !file_exists($v)) {
unset($this->clipData[$this->current]['el'][$k]);
$this->changed=1;
}
t3lib/class.t3lib_tsparser_ext.php (working copy)
$A_B = '';
$A_E = '';
}
$HTML .= ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" />') .
$HTML .= ($first ? '' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/ol/' . $PM . $BTM . '.gif" width="18" height="16" align="top" border="0" />') .
'<img ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $icon) . ' align="top" title="' . $alttext.'" /> ' .
$A_B . t3lib_div::fixed_lgd_cs($row['title'], $GLOBALS['BE_USER']->uc['titleLen']) . $A_E . '&nbsp;&nbsp;';
$RL = $this->ext_getRootlineNumber($row['pid']);
......
while($entry=$d->read()) {
if ($entry!='.' && $entry!='..') {
$wholePath = $path.'/'.$entry; // Because of odd PHP-error where <BR>-tag is sometimes placed after a filename!!
if (@file_exists($wholePath) && (!$type || filetype($wholePath)==$type)) {
if (file_exists($wholePath) && (!$type || filetype($wholePath)==$type)) {
$fI = t3lib_div::split_fileref($wholePath);
$this->dirResources[]=substr($wholePath,strlen(PATH_site));
}
typo3/sysext/tsconfig_help/mod1/index.php (working copy)
* @return string contents
*/
function getZIPFileContents($ZIPfile, $filename) {
if (@file_exists($ZIPfile)) {
if (file_exists($ZIPfile)) {
// Unzipping SXW file, getting filelist:
$tempPath = PATH_site.'typo3temp/tx_tsconfighelp_ziptemp/';
t3lib_div::mkdir($tempPath);
typo3/sysext/impexp/class.tx_impexp.php (working copy)
// Check if file exists:
if (@file_exists(PATH_site.$fI['relFileName'])) {
if (file_exists(PATH_site.$fI['relFileName'])) {
if ($this->update) {
$pInfo['updatePath'].= 'File exists.';
} else {
typo3/sysext/install/mod/class.tx_install.php (working copy)
* Returns true if submitted password is ok. Else displays a form in which to enter password.
*
* @param [type] $uKey: ...
* @return bool whether the submitted password is ok
* @return bool whether the submitted password is ok
*/
function checkPassword($uKey) {
$p = t3lib_div::_GP('password');
......
reset($programs);
if (!ereg('[\\\/]$',$v)) $v.='/';
while(list(,$filename)=each($programs)) {
if (ini_get('open_basedir') || (@file_exists($v)&&@is_file($v.$filename.$isExt))) {
if (ini_get('open_basedir') || (file_exists($v)&&@is_file($v.$filename.$isExt))) {
$version = $this->_checkImageMagick_getVersion($filename,$v);
if($version > 0) {
if($filename=='gm') { // Assume GraphicsMagick
......
$this->isBasicComplete($headCode);
if ($result) {
if ($result) {
$this->message($headCode,'User created','
Username: <strong>'.htmlspecialchars($username).'</strong><br />
Password: <strong>'.htmlspecialchars($pass).'</strong><br />',
typo3/sysext/cms/tslib/class.tslib_gifbuilder.php (working copy)
function gifBuild() {
if ($this->setup) {
$gifFileName = $this->fileName('GB/'); // Relative to PATH_site
if (!@file_exists($gifFileName)) { // File exists
if (!file_exists($gifFileName)) { // File exists
// Create temporary directory if not done:
$this->createTempSubDir('GB/');
typo3/sysext/cms/tslib/class.tslib_menu.php (working copy)
$this->result[$resKey][$key] = $conf[$key];
// Generation of image file:
if (@file_exists($gifFileName)) { // File exists
if (file_exists($gifFileName)) { // File exists
$info = @getimagesize($gifFileName);
$this->result[$resKey][$key]['output_w']=intval($info[0]);
$this->result[$resKey][$key]['output_h']=intval($info[1]);
......
$imgHash = md5($gifFileName);
$imgMap = $this->sys_page->getHash($imgHash, 0);
if ($imgMap && @file_exists($gifFileName)) { // File exists
if ($imgMap && file_exists($gifFileName)) { // File exists
$info = @getimagesize($gifFileName);
$w=$info[0];
$h=$info[1];
typo3/sysext/cms/tslib/class.tslib_content.php (working copy)
$a1='<a href="'.htmlspecialchars($url).'"'.$target.$GLOBALS['TSFE']->ATagParams.'>';
$a2='</a>';
}
$string = $this->stdWrap($string,$conf['stdWrap.']);
$string = $this->stdWrap($string,$conf['stdWrap.']);
$content=$a1.$string.$a2;
}
}
......
while($entry=$d->read()) {
if ($entry!='.' && $entry!='..') {
$wholePath = $path.'/'.$entry; // Because of odd PHP-error where <br />-tag is sometimes placed after a filename!!
if (@file_exists($wholePath) && filetype($wholePath)=='file') {
if (file_exists($wholePath) && filetype($wholePath)=='file') {
$info = t3lib_div::split_fileref($wholePath);
if (!$ext_list || t3lib_div::inList($ext_list,$info['fileext'])) {
$items['files'][] = $info['file'];
......
$fI = t3lib_div::split_fileref($theImage);
$imgExt = (strtolower($fI['fileext'])==$gifCreator->gifExtension ? $gifCreator->gifExtension : 'jpg');
$dest = $gifCreator->tempPath.$hash.'.'.$imgExt;
if (!@file_exists($dest)) { // Generate!
if (!file_exists($dest)) { // Generate!
$m_mask= $maskImages['m_mask'];
$m_bgImg = $maskImages['m_bgImg'];
if ($m_mask && $m_bgImg) {
......
$finalTagParts['TYPE']='url';
} elseif ($containsSlash || $isLocalFile) { // file (internal)
$splitLinkParam = explode('?', $link_param);
if (@file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
if (file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
if ($linktxt=='') $linktxt = rawurldecode($link_param);
if ($GLOBALS['TSFE']->config['config']['jumpurl_enable']) {
$this->lastTypoLinkUrl = $GLOBALS['TSFE']->absRefPrefix.$GLOBALS['TSFE']->config['mainScript'].$initP.'&jumpurl='.rawurlencode($link_param).$GLOBALS['TSFE']->getMethodUrlIdToken;
......
// static_* tables are allowed to be fetched from root page
if (substr($table,0,7)=='static_') {
$pid_uid_flag++;
}
}
if (trim($conf['pidInList'])) {
$listArr = t3lib_div::intExplode(',',str_replace('this',$GLOBALS['TSFE']->contentPid,$conf['pidInList'])); // str_replace instead of ereg_replace 020800
// removes all pages which are not visible for the user!
typo3/file_edit.php (working copy)
$this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
if (@file_exists($this->target)) {
if (file_exists($this->target)) {
$this->target=$this->basicff->cleanDirectoryName($this->target); // Cleaning and checking target (file or dir)
} else {
$this->target='';
typo3/class.browse_links.php (working copy)
'class' => $currentLinkParts[2],
'title' => $currentLinkParts[3],
);
$this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
$this->curUrlArray = (is_array(t3lib_div::_GP('curUrl'))) ?
array_merge($initialCurUrlArray, t3lib_div::_GP('curUrl')) :
$initialCurUrlArray;
$this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
if ($this->curUrlInfo['pageid'] == 0 && $this->curUrlArray['href']) { // pageid == 0 means that this is not an internal (page) link
if (@file_exists(PATH_site.rawurldecode($this->curUrlArray['href']))) { // check if this is a link to a file
if (file_exists(PATH_site.rawurldecode($this->curUrlArray['href']))) { // check if this is a link to a file
if (t3lib_div::isFirstPartOfStr($this->curUrlArray['href'], PATH_site)) {
$currentLinkParts[0] = substr($this->curUrlArray['href'], strlen(PATH_site));
}
......
$this->act = 'page';
} else {
$this->curUrlInfo = $this->parseCurUrl($this->siteURL.'?id='.$this->curUrlArray['href'], $this->siteURL);
}
}
} else {
$this->curUrlArray = t3lib_div::_GP('curUrl');
if ($this->curUrlArray['all']) {
......
$info['act']='spec';
} elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
$rel = substr($href,strlen($siteUrl));
if (@file_exists(PATH_site.rawurldecode($rel))) { // URL is a file, which exists:
if (file_exists(PATH_site.rawurldecode($rel))) { // URL is a file, which exists:
$info['value']=rawurldecode($rel);
if (@is_dir(PATH_site . $info['value'])) {
$info['act'] = 'folder';
typo3/file_rename.php (working copy)
$this->basicff->init($GLOBALS['FILEMOUNTS'],$TYPO3_CONF_VARS['BE']['fileExtensions']);
// Cleaning and checking target
if (@file_exists($this->target)) {
if (file_exists($this->target)) {
$this->target=$this->basicff->cleanDirectoryName($this->target); // Cleaning and checking target (file or dir)
} else {
$this->target='';
typo3/alt_clickmenu.php (working copy)
function printFileClickMenu($path) {
$menuItems=array();
if (@file_exists($path) && t3lib_div::isAllowedAbsPath($path)) {
if (file_exists($path) && t3lib_div::isAllowedAbsPath($path)) {
$fI = pathinfo($path);
$icon = is_dir($path) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
$size=' ('.t3lib_div::formatSize(filesize($path)).'bytes)';
    (1-1/1)