The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Auto Parse Onsite URL's Details »» | |||||||||||||||||||||||||
This post is basically the same as lone text file in the zip.
Download is merely available for convenience. Here goes....... If anyone can improve upon this and/or find a way to make this a plugin, SPEAK UP!! Personally I think something like this should be standard, but hey, can't have it all. By default, vbulletin autoparses all links so most won't need a hack like this. However, I don't like offsite links so I made a plugin to clear the checkbox. https://vborg.vbsupport.ru/showthread.php?t=91390 But I love onsite links like to other threads and files which reside on my subdomain, so I put together a few file edits that will automatically call the url parser if the subdomain name is found anywhere in the text message. It's no surprise your just adding a bit more code to any/all lines which check if the parse url's box is checked, because the line that follows these is what calls the parser. The only quirk that people find odd is that it's an "all or nothing" type thing. If the message has a mixture of onsite AND offsite url's, all links will parse. Meaning it checks the message in "one lump". Please note you can pick and choose from these file modifications!! Each one works independantly and the file names should clue you as to what's what. This is by no means complete!! It merely works.... Call it a "works in progress", LOL. In /editpost.php find this: Code:
$checked['parseurl'] = 'checked="checked"'; Code:
$checked['parseurl'] = ($postinfo['parseurl']) ? 'checked="checked"' : ''; In /private.php find this: Code:
if ($vbulletin->GPC['parseurl']) Code:
if ($vbulletin->GPC['parseurl'] OR stristr($vbulletin->GPC['message'], $_SERVER['HTTP_HOST'])) ALSO In /private.php find this: Code:
'parseurl' => true, Code:
'parseurl' => false, In /profile.php find this: Code:
$signature = convert_url_to_bbcode($signature); Code:
if (stristr($signature, $_SERVER['HTTP_HOST'])) { $signature = convert_url_to_bbcode($signature); } In /usernote.php find this: Code:
if ($vbulletin->GPC['parseurl']) Code:
if ($vbulletin->GPC['parseurl'] OR stristr($vbulletin->GPC['message'], $_SERVER['HTTP_HOST'])) In /includes/class_dm.php find this: Code:
if ($this->info['parseurl']) Code:
if ($this->info['parseurl'] OR stristr($pagetext, $_SERVER['HTTP_HOST'])) Show Your Support
|
Comments |
#12
|
|||
|
|||
OK, how bad is this going to screw up other things??
This works for me so far, but I haven't tested very much. Here's the old vbulletin tag wrapper for wysiwyg url's PHP Code:
PHP Code:
Naturally, editing instructions would be much shorter if the code looks good. And funny thing about this edit is I didn't need to define the stripos so either it's using the one I defined in functions_newpost.php or else for some reason it's able to use class_bbcode.php WHEN THE TOP OF THE SCRIPT CLEARLY REQUIRES class_bbcode_alt.php (notice the _alt and that file doesn't define stripos) because obviously I'm not using php5. :scratcheshead: Edited to say .... ... this whole post pertains to functions_wysiwyg.php |
#13
|
||||
|
||||
Hmm, for me WYSIWYG works without the additional modifications.
I just typed (in WYSIWYG, autoaprse was checked) Code:
http://www.foobar.com Did you paste a URL? AFAIK there is no way to stop this from "parsing" (at least not at server-side), as this already generates <a> Tags in the Text submitted by the User, eg. the Server does not even have to detect the Links. |
#14
|
|||
|
|||
Most people cut n paste links sooooo yes, that's what I was doing for many of my tests (not all, no).
My proposed modification removes the tags even if the link was C&P'ed, I believe. The link will "appear to be" a link in the edit window, but will unparse when you finally post the message .... and I also remove any text which a link might be trying to hide behind (that's why I return the $href without $text). |
#15
|
||||
|
||||
I applied your modification, but that completely stops me from being able to post URLs in WYSIWYG - at least using the Icons.
If I manually wrap it in [url] it does parse - but only one time. If I preview or edit it, it won't work until I wrap it again. |
#16
|
|||
|
|||
The steps I have been told for the "insert link" icon are:
Type text in message window which you will want displayed. Highlight text. Click Icon. Copy your link to the box including the http:// Click OK When I do this .... if the link was onsite .... the text will display and link will be hidden inside of it. If the link is not onsite ... then only the unparsed link is returned to the browser and the original highlighted text is gone forever. hmmmm ...... LOL ..... so if the href was the only text ..... would the whole thing be nullified ... hence why you got nothing?? But if so, why did my test work?? Edited to say I tried the insert a link icon again and didn't highlight any text .... the link parsed and displayed again .... so I'll bet you didn't have http on the front because without that (or without a normal www.) vbulletin has no idea it's even a link. |
#17
|
||||
|
||||
Well I just clicked the Icon and entered the URL.
If I do it your way, I just get the URL as Text, not as a link. But this has nothing to do with autoparsing, as I explicitly specified that this should be a Link. If this is what you want (don't parse any URLs that are not onsite), then it does work. But if you only want to turn off autoparsing, it does not work. |
#18
|
|||
|
|||
Well yes this is the desired effect I'm MAINLY looking for.
But once it "works" then it can be backed off a bit here or there with things like custom usergroup permissions for ability to override links or something. :banana: |
#19
|
||||
|
||||
I C.
I thought you wanted to disable autoparsing. Well, then you could also use a totally different approach: Create a Plugin that overwrites handle_bbcode_url and checks if the URL is onsite or not. If it is, preceed normally, if not just return the URL as Text. |
#20
|
|||
|
|||
The main purpose for this hack is so cookies don't get passed arround with clicks.
We ask our members to open a new browser and cut n paste their links to new window. But naturally there are many things we still DO want to link to such as forum threads, files, images, smilies, etc.... as long as they reside on our site already somewhere. But once this works .... then I forsee things like making a whitelist of safe sites and ability to override if qualified ... like by giving control back to the checkbox for admins/mods/whoever. Ultimately I expect this to turn into a product, but I'll have to design it before I'll know where I need hooks. |
#21
|
||||
|
||||
Erm ... Cookies will be send to the destination Server (if the Users Cookie Configuration allows that), no matter if there is a link or the User opens a new Window/Tab?
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|