Bei anderen Plugins gibt es den gleichen Fehler. Die URL ist abbas-physiotherapie.de.
meine file.php sieht sieht so aus (nur Auzug, da Beitrag sonst zu lang):
PHP-Code:
<?php
/**
* Read the contents of a file
*
* @param string $filename The full file path
* @param boolean $incpath Use include path
* @param int $amount Amount of file to read
* @param int $chunksize Size of chunks to read
* @param int $offset Offset of the file
* @return mixed Returns file contents or boolean False if failed
* @since 1.5
*/
function read($filename, $incpath = false, $amount = 0, $chunksize = 8192, $offset = 0)
{
// Initialize variables
$data = null;
if($amount && $chunksize > $amount) { $chunksize = $amount; }
if (false === $fh = fopen($filename, 'rb', $incpath)) {
JError::raiseWarning(21, 'JFile::read: '.JText::_('Unable to open file') . ": '$filename'");
return false;
}
clearstatcache();
if($offset) fseek($fh, $offset);
if ($fsize = @ filesize($filename)) {
if($amount && $fsize > $amount) {
$data = fread($fh, $amount);
} else {
$data = fread($fh, $fsize);
}
} else {
$data = '';
$x = 0;
// While its:
// 1: Not the end of the file AND
// 2a: No Max Amount set OR
// 2b: The length of the data is less than the max amount we want
while (!feof($fh) && (!$amount || strlen($data) < $amount)) {
$data .= fread($fh, $chunksize);
}
}
fclose($fh);
return $data;
}
/**
* Write contents to a file
*
* @param string $file The full file path
* @param string $buffer The buffer to write
* @return boolean True on success
* @since 1.5
*/
function write($file, $buffer)
{
// Initialize variables
jimport('joomla.client.helper');
$FTPOptions = JClientHelper::getCredentials('ftp');
// If the destination directory doesn't exist we need to create it
if (!file_exists(dirname($file))) {
jimport('joomla.filesystem.folder');
JFolder::create(dirname($file));
}
if ($FTPOptions['enabled'] == 1) {
// Connect the FTP client
jimport('joomla.client.ftp');
$ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
// Translate path for the FTP account and use FTP write buffer to file
$file = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $file), '/');
$ret = $ftp->write($file, $buffer);
} else {
$file = JPath::clean($file);
$ret = file_put_contents($file, $buffer);
}
return $ret;
}
/**
* Moves an uploaded file to a destination folder
*
* @param string $src The name of the php (temporary) uploaded file
* @param string $dest The path (including filename) to move the uploaded file to
* @return boolean True on success
* @since 1.5
*/
function upload($src, $dest)
{
// Initialize variables
jimport('joomla.client.helper');
$FTPOptions = JClientHelper::getCredentials('ftp');
$ret = false;
// Ensure that the path is valid and clean
$dest = JPath::clean($dest);
// Create the destination directory if it does not exist
$baseDir = dirname($dest);
if (!file_exists($baseDir)) {
jimport('joomla.filesystem.folder');
JFolder::create($baseDir);
}
if ($FTPOptions['enabled'] == 1) {
// Connect the FTP client
jimport('joomla.client.ftp');
$ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']);
//Translate path for the FTP account
$dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/');
// Copy the file to the destination directory
if ($ftp->store($src, $dest)) {
$ftp->chmod($dest, 0777);
$ret = true;
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
}
} else {
if (is_writeable($baseDir) && move_uploaded_file($src, $dest)) { // Short circuit to prevent file permission errors
if (JPath::setPermissions($dest)) {
$ret = true;
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR01'));
}
} else {
JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
}
}
return $ret;
}
/**
* Wrapper for the standard file_exists function
*
* @param string $file File path
* @return boolean True if path is a file
* @since 1.5
*/
function exists($file)
{
return is_file(JPath::clean($file));
}
/**
* Returns the name, sans any path
*
* param string $file File path
* @return string filename
* @since 1.5
*/
function getName($file) {
$slash = strrpos($file, DS) + 1;
return substr($file, $slash);
}
}
Lesezeichen