/** * Will be kept for legacy compatibility * * @param bool $bitJsonResponse * * @return string */ private function doUpload($bitJsonResponse = false) { $strReturn = ""; //prepare the folder to be used as a target-folder for the upload $objFilemanagerRepo = new class_module_mediamanager_repo($this->arrElementData["char2"]); $objDownloadfolder = null; //add a special subfolder? $strPath = $objFilemanagerRepo->getStrPath(); if ($this->getParam("portaluploadDlfolder") != "") { /** @var $objDownloadfolder class_module_mediamanager_file */ $objDownloadfolder = class_objectfactory::getInstance()->getObject($this->getParam("portaluploadDlfolder")); //check if the folder is within the current repo /** @var $objTemp class_module_mediamanager_file */ $objTemp = $objDownloadfolder; while (validateSystemid($objTemp->getSystemid()) && ($objTemp instanceof class_module_mediamanager_file || $objTemp instanceof class_module_mediamanager_repo)) { if ($objTemp->getSystemid() == $this->arrElementData["char2"]) { $strPath = $objDownloadfolder->getStrFilename(); break; } $objTemp = class_objectfactory::getInstance()->getObject($objTemp->getPrevId()); } } //upload the file... if ($objFilemanagerRepo->rightRight1()) { //Handle the fileupload $arrSource = $this->getParam("portaluploadFile"); $strTarget = $strPath . "/" . createFilename($arrSource["name"]); $objFilesystem = new class_filesystem(); if ($objFilesystem->isWritable($strPath)) { //Check file for correct filters $arrAllowed = explode(",", $objFilemanagerRepo->getStrUploadFilter()); $strSuffix = uniStrtolower(uniSubstr($arrSource["name"], uniStrrpos($arrSource["name"], "."))); if ($objFilemanagerRepo->getStrUploadFilter() == "" || in_array($strSuffix, $arrAllowed)) { if ($objFilesystem->copyUpload($strTarget, $arrSource["tmp_name"])) { //upload was successfull. try to sync the downloads-archive. if ($objDownloadfolder != null && $objDownloadfolder instanceof class_module_mediamanager_file) { class_module_mediamanager_file::syncRecursive($objDownloadfolder->getSystemid(), $objDownloadfolder->getStrFilename()); } else { $objFilemanagerRepo->syncRepo(); } $this->flushCompletePagesCache(); if ($bitJsonResponse) { return true; } //reload the site to display the new file if (validateSystemid($this->getParam("portaluploadDlfolder"))) { $this->portalReload(class_link::getLinkPortalHref($this->getPagename(), "", "mediaFolder", "uploadSuccess=1", $this->getParam("portaluploadDlfolder"))); } else { $this->portalReload(class_link::getLinkPortalHref($this->getPagename(), "", "", $this->getAction(), "uploadSuccess=1", $this->getSystemid())); } } else { $strReturn .= $this->uploadForm($this->getLang("portaluploadCopyUploadError")); } } else { @unlink($arrSource["tmp_name"]); $strReturn .= $this->uploadForm($this->getLang("portaluploadFilterError")); } } else { $strReturn .= $this->uploadForm($this->getLang("portaluploadNotWritableError")); } } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }