LegendCS - With grace, in your face!
PLUGINS MyDownloads plugin - Manage Previews fix - Printable Version

+- LegendCS - With grace, in your face! (https://legendcs.ro)
+-- Forum: Web Resources (https://legendcs.ro/forumdisplay.php?fid=127)
+--- Forum: Forum Software (https://legendcs.ro/forumdisplay.php?fid=128)
+---- Forum: Mybb (https://legendcs.ro/forumdisplay.php?fid=129)
+---- Thread: PLUGINS MyDownloads plugin - Manage Previews fix (/showthread.php?tid=672)



MyDownloads plugin - Manage Previews fix - Berserk - 09-30-2024

When uploading a file inside the Mydownloads polugin you might forgot to upload a preview image of the resource you uploaded.

The plugin gives you an option to fix this directly by clicking on Manage previews button , however you might get 500 HTTP ERROR or something like this.

To fix this keep in mind that we need to work with mydownloads.php that can be found the root of your board ( NOT the one in the inc/plugins )

In mydownloads.php 

Find :

Code: 
if($mybb->get_input('legacy', INPUT_INT) == 1)

Replace with :

Code: 
if($mybb->get_input('legacy', MyBB::INPUT_INT) == 1)

Before:

Code: 
mydownloads_json_error($lang->mydownloads_preview_empty, $preview_file, $mybb->get_input('legacy', INPUT_INT));

After:

Code: 
mydownloads_json_error($lang->mydownloads_preview_empty, $preview_file, $mybb->get_input('legacy', MyBB::INPUT_INT));

Other Occurrences:
  1. Replace:

Code: 
mydownloads_json_error($lang->mydownloads_invalid_extension, $preview_file, $mybb->get_input('legacy', INPUT_INT));

With:

Code: 
mydownloads_json_error($lang->mydownloads_invalid_extension, $preview_file, $mybb->get_input('legacy', MyBB::INPUT_INT));
  1. Replace:

Code: 
mydownloads_json_error($lang->mydownloads_upload_problem_pr_already_exists, $preview_file, $mybb->get_input('legacy', INPUT_INT));

With:

Code: 
mydownloads_json_error($lang->mydownloads_upload_problem_pr_already_exists, $preview_file, $mybb->get_input('legacy', MyBB::INPUT_INT));
  1. Replace:

Code: 
mydownloads_json_error($lang->mydownloads_upload_problem_previewfile.$preview_file['error'], $preview_file, $mybb->get_input('legacy', INPUT_INT));

With:

Code: 
mydownloads_json_error($lang->mydownloads_upload_problem_previewfile.$preview_file['error'], $preview_file, $mybb->get_input('legacy', MyBB::INPUT_INT));
  1. Replace:

Code: 
mydownloads_json_error($lang->sprintf($lang->mydownloads_max_width, $maxsize[0]), $preview_file, $mybb->get_input('legacy', INPUT_INT));

With:

Code: 
mydownloads_json_error($lang->sprintf($lang->mydownloads_max_width, $maxsize[0]), $preview_file, $mybb->get_input('legacy', MyBB::INPUT_INT));
  1. Replace:

Code: 
mydownloads_json_error($lang->sprintf($lang->mydownloads_max_height, $maxsize[1]), $preview_file, $mybb->get_input('legacy', INPUT_INT));

With:

Code: 
mydownloads_json_error($lang->sprintf($lang->mydownloads_max_height, $maxsize[1]), $preview_file, $mybb

Find :

Code: 
$filename = "preview_".$mybb->user['uid']."_".TIME_NOW."_".md5(uniqid(rand(), true)).".".get_extension($preview);

Replace with :

Code: 
$filename = "preview_".$mybb->user['uid']."_".TIME_NOW."_".md5(uniqid(rand(), true)).".".get_extension($preview);

find :

Code: 
// Legacy?
        if($mybb->get_input('legacy', INPUT_INT) == 1)
            redirect($mybb->settings['bburl']."/mydownloads.php?action=managepreviews&did=".$did, $lang->mydownloads_preview_submitted);

Replace with : 

Code: 
// Legacy?
if($mybb->get_input('legacy', MyBB::INPUT_INT) == 1) {
    redirect($mybb->settings['bburl']."/mydownloads.php?action=managepreviews&did=".$did, $lang->mydownloads_preview_submitted);
}

This should fix the manage previews problem.