mybb / merge-system

The MyBB Merge System allows for easy merging of an existing forum (be it MyBB or another forum software) into a MyBB 1.8.x forum.
Other
34 stars 33 forks source link

[IPB4] Attachment BBCode/HTML #173

Open JN-Jones opened 9 years ago

JN-Jones commented 9 years ago

IPB 4 doesn't have a proper Attachment code, instead it inserts them as a link:

Non-images:

<a class="ipsAttachLink" href="http://merge.dev/ipb4/applications/core/interface/file/attachment.php?id=1">testattach.txt</a>

Images:

<a href="//merge.dev/ipb4/uploads/monthly_2015_05/jones.png.6ea784542bd86fe10671fef0a566f728.png" class="ipsAttachLink ipsAttachLink_image"><img data-fileid="3" src="//merge.dev/ipb4/uploads/monthly_2015_05/jones.thumb.png.9eb00a81c86629cad317d4b56f7e0289.png" class="ipsImage ipsImage_thumbnailed" alt="jones.png"></a>

Inline Images:

<a href="//merge.dev/ipb4/uploads/monthly_2015_05/mybbslogoneu.png.a582486d209b1f2d4105b4254b0fcca0.png" class="ipsAttachLink ipsAttachLink_image" rel="external nofollow"><img data-fileid="4" src="//merge.dev/ipb4/uploads/monthly_2015_05/mybbslogoneu.thumb.png.b05b9ee1733435d848303eebd337dacb.png" class="ipsImage ipsImage_thumbnailed" alt="mybbslogoneu.thumb.png.b05b9ee1733435d84"></a>

And I'd bet that the old IPB 3 code isn't updated so we also need to check [attachment={id}:{name}].

The first two codes should be removed as we show attachments anyways, the third one needs to be updated. Also the regex for this needs to be added as one of the first things, otherwise the parser would try to generate a link with an image.