protected function load() { switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: $result = array('error' => JFactory::getLanguage()->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $um->Params =& $this->Params; $result = $um->HandleUpload(JPATH_COMPONENT . '/uploads/'); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
protected function load() { switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: // Malformed / malicious request, or attachment exceeds server limits $result = array('error' => JFactory::getLanguage()->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $um->Params =& $this->Params; $result = $um->HandleUpload(JPATH_COMPONENT . '/uploads/'); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
@JFactory::getApplication('site'); // Needed to get the correct session with JFactory::getSession() below $config = JFactory::getConfig(); $default_lang = $config->get('language'); $lang_param = JComponentHelper::getParams('com_languages'); $frontend_lang = $lang_param->get('site', $default_lang); //$lang = JFactory::getLanguage(); // @ avoids Warning: ini_set() has been disabled for security reasons in /var/www/libraries/joomla/[...] $lang = @JLanguage::getInstance($frontend_lang); @$lang->load($GLOBALS["com_name"]); switch (true) { case isset($_GET['qqfile']): $um = new XhrUploadManager(); break; case isset($_FILES['qqfile']): $um = new FileFormUploadManager(); break; default: // Malformed / malicious request, or attachment exceeds server limits $result = array('error' => $lang->_($GLOBALS["COM_NAME"] . '_ERR_NO_FILE')); exit(htmlspecialchars(json_encode($result), ENT_NOQUOTES)); } $result = $um->HandleUpload('..' . DS . 'uploads' . DS, $lang); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); abstract class FUploadManager { protected $Params; protected $Session; protected $Log; protected $DebugLog;