%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11585/root/var/www/html/old/libraries/kunena/upload/ |
Upload File : |
<?php /** * Kunena Component * @package Kunena.Framework * @subpackage Upload * * @copyright (C) 2008 - 2014 Kunena Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @link http://www.kunena.org **/ defined ( '_JEXEC' ) or die (); /** * Kunena Upload Backend Helper Class */ class KunenaUploadHelper { protected static $_instances = array (); private function __construct() {} public static function upload($file, $uploadfolder, $format) { jimport( 'joomla.filesystem.folder' ); require_once( JPATH_ADMINISTRATOR.'/components/com_media/helpers/media.php' ); $err = null; // Set FTP credentials, if given jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); // Make the filename safe jimport('joomla.filesystem.file'); $file['name'] = JFile::makeSafe($file['name']); if (empty($file['tmp_name']) || !is_uploaded_file($file['tmp_name']) || !empty($file['error'])) return false; if (!JFolder::exists($uploadfolder)) return false; if (isset($file['name'])) { $filepath = JPath::clean($uploadfolder.'/'.strtolower($file['name'])); if (!MediaHelper::canUpload( $file, $err )) { if ($format == 'json') { //jimport('joomla.error.log'); //$log = JLog::getInstance('upload.error.php'); //$log->addEntry(array('comment' => 'Invalid: '.$filepath.': '.$err)); header('HTTP/1.0 415 Unsupported Media Type'); jexit('Error. Unsupported Media Type!'); } else { return false; } } if (JFile::exists($filepath)) { if ($format == 'json') { //jimport('joomla.error.log'); //$log = JLog::getInstance('upload.error.php'); //$log->addEntry(array('comment' => 'File already exists: '.$filepath)); header('HTTP/1.0 409 Conflict'); jexit('Error. File already exists'); } else { return false; } } if (!JFile::upload($file['tmp_name'], $filepath)) { if ($format == 'json') { //jimport('joomla.error.log'); //$log = JLog::getInstance('upload.error.php'); //$log->addEntry(array('comment' => 'Cannot upload: '.$filepath)); header('HTTP/1.0 400 Bad Request'); jexit('Error. Unable to upload file'); } else { return false; } } else { if ($format == 'json') { //jimport('joomla.error.log'); //$log = JLog::getInstance(); //$log->addEntry(array('comment' => $uploadfolder)); jexit('Upload complete'); } else { return true; } } } else { return false; } } }