0, "download_user" => $callback_data['submit_user'], "download_title" => form_sanitizer($_POST['download_title'], '', 'download_title'), "download_description" => form_sanitizer($_POST['download_description'], '', 'download_description'), "download_description_short" => form_sanitizer($_POST['download_description_short'], '', 'download_description_short'), "download_cat" => form_sanitizer($_POST['download_cat'], 0, 'download_cat'), "download_homepage" => form_sanitizer($_POST['download_homepage'], '', 'download_homepage'), "download_license" => form_sanitizer($_POST['download_license'], '', 'download_license'), "download_copyright" => form_sanitizer($_POST['download_copyright'], '', 'download_copyright'), "download_os" => form_sanitizer($_POST['download_os'], '', 'download_os'), "download_version" => form_sanitizer($_POST['download_version'], '', 'download_version'), "download_file" => form_sanitizer($_POST['download_file'], '', 'download_file'), "download_url" => form_sanitizer($_POST['download_url'], '', 'download_url'), "download_filesize" => form_sanitizer($_POST['download_filesize'], '', 'download_filesize'), "download_image" => form_sanitizer($_POST['download_image'], '', 'download_image'), "download_image_thumb" => form_sanitizer($_POST['download_image_thumb'], '', 'download_image_thumb'), "download_allow_comments" => isset($_POST['download_allow_comments']) ? TRUE : FALSE, "download_allow_ratings" => isset($_POST['download_allow_ratings']) ? TRUE : FALSE, "download_visibility" => form_sanitizer($_POST['download_visibility'], '', 'download_visibility'), "download_keywords" => form_sanitizer($_POST['download_keywords'], '', 'download_keywords'), "download_datestamp" => $callback_data['submit_datestamp'], ]; if (defender::safe()) { // move files if (!empty($callback_data['download_file']) && file_exists(DOWNLOADS."submissions/".$callback_data['download_file'])) { $dest = DOWNLOADS."files/"; $temp_file = $callback_data['download_file']; $callback_data['download_file'] = filename_exists($dest, $callback_data['download_file']); copy(DOWNLOADS."submissions/".$temp_file, $dest.$callback_data['download_file']); chmod($dest.$callback_data['download_file'], 0644); unlink(DOWNLOADS."submissions/".$temp_file); } // move images if (!empty($callback_data['download_image']) && file_exists(DOWNLOADS."submissions/images/".$callback_data['download_image'])) { $dest = DOWNLOADS."images/"; $temp_file = $callback_data['download_image']; $callback_data['download_image'] = filename_exists($dest, $callback_data['download_image']); copy(DOWNLOADS."submissions/images/".$temp_file, $dest.$callback_data['download_image']); chmod($dest.$callback_data['download_image'], 0644); unlink(DOWNLOADS."submissions/images/".$temp_file); } // move thumbnail if (!empty($callback_data['download_image_thumb']) && file_exists(DOWNLOADS."submissions/images/".$callback_data['download_image_thumb'])) { $dest = DOWNLOADS."images/"; $temp_file = $callback_data['download_image_thumb']; $callback_data['download_image_thumb'] = filename_exists($dest, $callback_data['download_image_thumb']); copy(DOWNLOADS."submissions/images/".$temp_file, $dest.$callback_data['download_image_thumb']); chmod($dest.$callback_data['download_image_thumb'], 0644); unlink(DOWNLOADS."submissions/images/".$temp_file); } dbquery_insert(DB_DOWNLOADS, $callback_data, "save"); dbquery("DELETE FROM ".DB_SUBMISSIONS." WHERE submit_id='".intval($_GET['submit_id'])."'"); addNotice("success", $locale['download_0063']); redirect(clean_request("", ["submit_id"], FALSE)); } } else { redirect(clean_request("", ["submit_id"], FALSE)); } } else { if (isset($_POST['delete']) && (isset($_GET['submit_id']) && isnum($_GET['submit_id']))) { $result = dbquery(" SELECT ts.submit_id, ts.submit_datestamp, ts.submit_criteria FROM ".DB_SUBMISSIONS." ts WHERE submit_type='d' and submit_id='".intval($_GET['submit_id'])."' "); if (dbrows($result) > 0) { $callback_data = dbarray($result); // delete all the relevant files $delCriteria = unserialize($callback_data['submit_criteria']); if (!empty($delCriteria['download_image']) && file_exists(INFUSIONS."downloads/submisisons/images/".$delCriteria['download_image'])) { unlink(INFUSIONS."downloads/submisisons/images/".$delCriteria['download_image']); } if (!empty($delCriteria['download_image_thumb']) && file_exists(INFUSIONS."downloads/submisisons/images/".$delCriteria['download_image_thumb'])) { unlink(INFUSIONS."downloads/submisisons/images/".$delCriteria['download_image_thumb']); } if (!empty($delCriteria['download_file']) && file_exists(INFUSIONS."downloads/submisisons/".$delCriteria['download_file'])) { unlink(INFUSIONS."downloads/submisisons/".$delCriteria['download_file']); } $result = dbquery("DELETE FROM ".DB_SUBMISSIONS." WHERE submit_id='".intval($callback_data['submit_id'])."'"); addNotice("success", $locale['download_0062']); } redirect(clean_request("", ["submit_id"], FALSE)); } else { $result = dbquery("SELECT ts.submit_id, ts.submit_datestamp, ts.submit_criteria, tu.user_id, tu.user_name, tu.user_avatar, tu.user_status FROM ".DB_SUBMISSIONS." ts LEFT JOIN ".DB_USERS." tu ON ts.submit_user=tu.user_id WHERE submit_type='d' AND submit_id='".$_GET['submit_id']."' "); if (dbrows($result) > 0) { $data = dbarray($result); $submit_criteria = unserialize($data['submit_criteria']); $callback_data = [ "download_title" => $submit_criteria['download_title'], "download_keywords" => $submit_criteria['download_keywords'], "download_description" => $submit_criteria['download_description'], "download_description_short" => $submit_criteria['download_description_short'], "download_cat" => $submit_criteria['download_cat'], "download_homepage" => $submit_criteria['download_homepage'], "download_license" => $submit_criteria['download_license'], "download_copyright" => $submit_criteria['download_copyright'], "download_os" => $submit_criteria['download_os'], "download_version" => $submit_criteria['download_version'], "download_file" => $submit_criteria['download_file'], "download_url" => $submit_criteria['download_url'], "download_filesize" => ($submit_criteria['download_file']) ? $submit_criteria['download_filesize'] : 0, "download_image" => $submit_criteria['download_image'], "download_image_thumb" => $submit_criteria['download_image_thumb'], // default to none "download_id" => 0, "download_allow_comments" => TRUE, "download_allow_ratings" => TRUE, "download_visibility" => iGUEST, "download_datestamp" => $data['submit_datestamp'], ]; add_to_title($locale['global_200'].$locale['global_201'].$callback_data['download_title']."?"); echo openform("publish_download", "post", FUSION_REQUEST); echo "
".$locale['download_0214']."
\n"; echo " ".$locale['download_0226']."\n"; echo form_hidden('download_file', '', $callback_data['download_file']); echo form_hidden("download_url", "", ""); } else { echo "".$locale['download_0215']."
\n"; echo form_text('download_url', '', $callback_data['download_url']); echo form_hidden("download_file", "", ""); } echo "".$locale['download_0055']." | \n"; echo "".$locale['download_0053']." | \n"; echo "".$locale['download_0054']." | \n"; echo "".$locale['download_0052']." | \n"; echo "
---|---|---|---|
".$callback_data['submit_id']." | \n"; echo "".display_avatar($callback_data, '20px', '', TRUE, 'img-rounded m-r-5').profile_link($callback_data['user_id'], $callback_data['user_name'], $callback_data['user_status'])." | \n"; echo "".timer($callback_data['submit_datestamp'])." | \n"; echo "".$submit_criteria['download_title']." | \n"; echo "