Advertisement
Kinu-chan

Fixes for Kusaba X URL Upload

Jan 19th, 2013
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. [----- Fixes for Kusaba X URL Upload -----]
  2.  
  3. -This was a paste detailing a bug with Jmyeom's URL upload mod (http://pastebin.com/BL2fcf9M) and newer versions of Kusaba X I'm re-uploading on request, I think the fix is tested on a few sites and works okay.-
  4.  
  5. Originally I was making a fix for the mod insisting it has a message with an image uploaded from URL, the fix for that:
  6. In board.php,
  7.  
  8. if ($post_isreply) {
  9. if ($imagefile_name == '' && !$is_oekaki && $post_message == '') {
  10. exitWithErrorPage(_gettext('An image, or message, is required for a reply.'));
  11.  
  12. Becomes:
  13.  
  14. if ($post_isreply) {
  15. if ($imagefile_name == '' && !$is_oekaki && $post_message == '' && empty($_POST['fileurl'])) {
  16. exitWithErrorPage(_gettext('An image, or message, is required for a reply.'));
  17.  
  18. While playing about with that I noticed I was able to post with no file or message, threads and replies, wether or not my new fix was included.
  19. The "A file is required for a new thread. If embedding is allowed, either a file or embed ID is required." error wasn't chucking right, either was the relevant error in threads.
  20. My fix for that:
  21. In board.php,
  22.  
  23. if ($imagefile_name == '' && !$is_oekaki && ((!isset($_POST['nofile'])&&$board_class->board['enablenofile']==1) || $board_class->board['enablenofile']==0) && ($board_class->board['type'] == 0 || $board_class->board['type'] == 2 || $board_class->board['type'] == 3) && !isset($_POST['fileurl']) && !empty($_POST['fileurl'])) {
  24. if (!isset($_POST['embed']) && $board_class->board['uploadtype'] != 1) {
  25. exitWithErrorPage(_gettext('A file is required for a new thread. If embedding is allowed, either a file or embed ID is required.'));
  26. }
  27.  
  28. Must have
  29.  
  30. && !isset($_POST['fileurl'])
  31.  
  32. Removed to make it
  33.  
  34. if ($imagefile_name == '' && !$is_oekaki && ((!isset($_POST['nofile'])&&$board_class->board['enablenofile']==1) || $board_class->board['enablenofile']==0) && ($board_class->board['type'] == 0 || $board_class->board['type'] == 2 || $board_class->board['type'] == 3) && empty($_POST['fileurl']) ) {
  35. if (!isset($_POST['embed']) && $board_class->board['uploadtype'] != 1) {
  36. exitWithErrorPage(_gettext('A file is required for a new thread. If embedding is allowed, either a file or embed ID is required.'));
  37. }
  38.  
  39. My initial fix was removing
  40.  
  41. && !isset($_POST['fileurl']) && !empty($_POST['fileurl'])
  42.  
  43. Though that prevented new threads with a URL image, so i returned
  44.  
  45. !empty($_POST['fileurl'])
  46.  
  47. And that seems to be it.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement