function _uploadImage() { global $_TABLES, $_DLM_CONF; $newimage_name = COM_applyFilter($_FILES['imgurl']['name']); if (!empty($newimage_name)) { $name = $this->_createFilename($newimage_name); if (DLM_uploadNewFile($_FILES['imgurl'], $_DLM_CONF['path_snapcat'], $name)) { $this->_imgurl = $name; } } else { if ($this->_deleteimg) { $this->_imgurl = ''; } } }
function submitNewDownload(&$A) { global $_CONF, $_TABLES, $_DLM_CONF; $this->_initVars(); $this->_loadFromArgs($A); $this->_secret_id = $this->_createSecretID(); $this->_url = $_FILES['newfile']['name']; // $this->_logourl = $_FILES['newfileshot']['name']; if (empty($this->_lid)) { $this->_lid = $this->_old_lid; } // Validate the input values -----------------------> if (empty($this->_title)) { $this->_errno[] = '1101'; } if (empty($this->_url)) { $this->_errno[] = '1102'; } else { if ($this->_lid != $this->_old_lid) { $count = DB_count($_TABLES['downloads'], 'lid', addslashes($this->_lid)); if ($count > 0) { $this->_errno[] = '1202'; } } } if (empty($this->_description)) { $this->_errno[] = '1103'; } if (!empty($this->_errno)) { $this->_retry = true; $this->_reedit('showEditor', array($this->_editor_mode)); } // Validate the input values -----------------------< if (empty($this->_cid)) { $this->_cid = ROOTID; } $success = false; if (!SEC_hasRights('downloads.submit')) { // Upload New file if (!empty($this->_url)) { $tmpfilename = 'tmp' . date('YmdHis', $this->_date) . DLM_createSafeFileName($this->_url); $success = DLM_uploadNewFile($_FILES['newfile'], $_DLM_CONF['path_filestore'], $tmpfilename); if ($success) { $this->_size = filesize($_DLM_CONF['path_filestore'] . $tmpfilename); $this->_md5 = md5_file($_DLM_CONF['path_filestore'] . $tmpfilename); } } // Upload New file snapshot image if ($success && !empty($_FILES['newfileshot']['name'])) { $this->_logourl = $_FILES['newfileshot']['name']; $tmpshotname = 'tmp' . date('YmdHis', $this->_date) . DLM_createSafeFileName($this->_logourl); $success = DLM_uploadNewFile($_FILES['newfileshot'], $_DLM_CONF['path_snapstore'], $tmpshotname); } $mode = 'submission'; } else { // Upload New file if (!empty($this->_url)) { $safename = DLM_createSafeFileName($this->_url, $this->_secret_id); $success = DLM_uploadNewFile($_FILES['newfile'], $_DLM_CONF['path_filestore'], $safename); if ($success) { $this->_size = filesize($_DLM_CONF['path_filestore'] . $safename); $this->_md5 = md5_file($_DLM_CONF['path_filestore'] . $safename); } } // Upload New file snapshot image if ($success) { $this->_uploadSnapImage(); DLM_makeThumbnail(DLM_createSafeFileName($this->_logourl)); } $mode = ''; } if ($success) { $this->_addToDatabase($mode); $msg = $_DLM_CONF['download_emailoption'] ? 109 : 115; echo PLG_afterSaveSwitch('home', '', 'downloads', $msg); } else { echo PLG_afterSaveSwitch('home', '', 'downloads', 108); } exit; }