open($zipFile) === true) { $returnValue = ($zip->getFromName($archiveFile) !== false); $zip->close(); return $returnValue; } else { return false; } } else { // Regular file_exists return file_exists($pFilename); } } /** * Returns canonicalized absolute pathname, also for ZIP archives * * @param string $pFilename * @return string */ public static function realpath($pFilename) { // Returnvalue $returnValue = ''; // Try using realpath() $returnValue = realpath($pFilename); // Found something? if ($returnValue == '' || is_null($returnValue)) { $pathArray = split('/' , $pFilename); while(in_array('..', $pathArray) && $pathArray[0] != '..') { for ($i = 0; $i < count($pathArray); ++$i) { if ($pathArray[$i] == '..' && $i > 0) { unset($pathArray[$i]); unset($pathArray[$i - 1]); break; } } } $returnValue = implode('/', $pathArray); } // Return return $returnValue; } }