Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 05-13-2002, 08:04 PM
cobradude cobradude is offline
 
Join Date: Nov 2001
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Anyone have this working....

...I run one of my vb licenses on a corporate network and people will post links to docs and tools on other machines within the network. So they will post in the message something to the affect of \\mycomputer\docs\mydoc.doc which vbulletin doesn't recognize as a hyperlink.

How can I set up the software to do this? It appears that this code in functions.php (around line 686) is what makes http:// turn into a hyperlink in the posts (could be wrong about this being the code that does it--I'm not a coder). How can I modify this to also recognize \\ as a link too?

$replacearray = array(
"<ol type=\"\\5\">\\7</ol>",
"<ul>\\4</ul>",
"<li>",
"<a href=\"http://www.\\6\" target=\"_blank\">\\8</a>",
"<a href=\"\\5\" target=\"_blank\">\\7</a>",
"<a href=\"http://www.\\5\" target=\"_blank\">\\5</a>",
"<a href=\"\\4\" target=\"_blank\">\\4</a>",
"</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>\\5<hr></pre></blockquote><normalfont>",
"</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>\\5<hr></pre></blockquote><normalfont>",
"java script:",
"about :",
"vbscript :"
);
} else {
$searcharray = array(
"/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/esiU",
"/(\[)(list)(])(.*)(\[\/list\])/esiU",
"/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/esiU",
"/(\[)(url)(])([^\"]*)(\[\/url\])/esiU",
"/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/esiU",
"/(\[)(php)(])(\r\n)*(.*)(\[\/php\])/esiU",
"/javascript:/si",
"/about:/si",
"/vbscript:/si"
);

$replacearray = array(
"createlists('\\7', '\\5')",
"createlists('\\4')",
"checkurl('\\5', '\\7')",
"checkurl('\\4')",
"stripbrsfromcode('\\5')",
"phphighlite('\\5')",
"java script:",
"about :",
"vbscript :"
);
} // end version check
Reply With Quote
  #2  
Old 05-13-2002, 11:48 PM
cobradude cobradude is offline
 
Join Date: Nov 2001
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, so I added a custom vbcode "share"
[quote]<a href="file://{param}">{param}</a>[quote]

So now I just need to make this a no hassel thing just like typing in your favorite url. vBulletin automatically parses the text and puts the "url" tags around it for the person who posted (no extra work or knowlege of the vbcodes necessary).

I still think it has to do with the stuff in the functions.php, but correct me if I'm wrong.
Reply With Quote
  #3  
Old 05-14-2002, 08:49 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The parseurl() function does that, IIRC.
Reply With Quote
  #4  
Old 05-14-2002, 05:02 PM
cobradude cobradude is offline
 
Join Date: Nov 2001
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks firefly! Here is probably a quick question for you then.

So I think I am supposed to add another function see code below (copy of parseurl just changed to reflect different bbcode)....

Quote:
// ###################### Start parseSHARE #######################
unset($shareSearchArray);
unset($shareReplaceArray);

function parseshare($messagetext)
{ // the auto parser - adds [share] tags around neccessary things

global $shareSearchArray, $shareReplaceArray;

if (!isset($shareSearchArray)) {
$shareSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|\\)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"
);

$shareReplaceArray = array(
"\\1[share]\\2\\4[/share]",
"[share]\\1\\3[/share]"
);

$text = preg_replace($shareSearchArray, $shareReplaceArray, $messagetext);

}


return $text;

}
If I want to add my share tags around any string starting with "\\", how would I do it? It looks like the lines with www\. in them is where I need to make this modification, but there's a bunch of \/\ stuff that seems like it would get all hosed up if I throw a \\ in the mix...This is all pretty foreign to me, but at least I am trying.

Any help is appreciated!
Reply With Quote
  #5  
Old 05-14-2002, 06:19 PM
cobradude cobradude is offline
 
Join Date: Nov 2001
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I guess I wouldn't need to have a separate function.

Here's what I have so far, and there's no errors, but it's not adding the [ share] [ /share] brackets around \\blah\blah either. :cheeky:

Quote:
// ###################### Start parseurl #######################
unset($urlSearchArray);
unset($urlReplaceArray);
unset($emailSearchArray);
unset($emailReplaceArray);
unset($shareSearchArray);
unset($shareReplaceArray);
function parseurl($messagetext)
{ // the auto parser - adds [url] tags around neccessary things

global $urlSearchArray, $urlReplaceArray, $emailSearchArray, $emailReplaceArray, $shareSearchArray, $shareReplaceArray;

if (!isset($urlSearchArray)) {
$urlSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"
);

$urlReplaceArray = array(
"\\1\\2\\4",
"\\1\\3"
);

$emailSearchArray = array(
"/([ \n\r\t])([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4}))/si",
"/^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4}))/si"
);

$emailReplaceArray = array(
"\\1\\2",
"\\0"
);
$shareSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|\\)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|\\)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"
);

$shareReplaceArray = array(
"\\1[share]\\2\\4[/share]",
"[share]\\1\\3[/share]"
);
}

$text = preg_replace($urlSearchArray, $urlReplaceArray, $messagetext);
if (strpos($text, "@"))
$text = preg_replace($emailSearchArray, $emailReplaceArray, $text);
if (strpos($text, "\\")) {
$text = preg_replace($shareSearchArray, $shareReplaceArray, $text);
}

return $text;

}
Reply With Quote
  #6  
Old 05-14-2002, 08:23 PM
cobradude cobradude is offline
 
Join Date: Nov 2001
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

With a bit of help from a friend, here's what we came up with that seems to work fine...

Quote:
// ###################### Start parseurl #######################
unset($urlSearchArray);
unset($urlReplaceArray);
unset($emailSearchArray);
unset($emailReplaceArray);
unset($shareSearchArray);
unset($shareReplaceArray);
function parseurl($messagetext)
{ // the auto parser - adds [url] tags around neccessary things

global $urlSearchArray, $urlReplaceArray, $emailSearchArray, $emailReplaceArray, $shareSearchArray, $shareReplaceArray;

if (!isset($urlSearchArray)) {
$urlSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|www\.)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"
);

$urlReplaceArray = array(
"\\1\\2\\4",
"\\1\\3"
);

$emailSearchArray = array(
"/([ \n\r\t])([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4}))/si",
"/^([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4}))/si"
);

$emailReplaceArray = array(
"\\1\\2",
"\\0"
);
$shareSearchArray = array(
"/([^]_a-z0-9-=\"'\/])((https?|ftp|gopher|news|telnet):\/\/|\\\\)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si",
"/^((https?|ftp|gopher|news|telnet):\/\/|\\\\)([^ \r\n\(\)\^\$!`\"'\|\[\]\{\}<>]*)/si"
);

$shareReplaceArray = array(
"[share]\\2\\2\\4[/share]"
);
}

$text = preg_replace($urlSearchArray, $urlReplaceArray, $messagetext);
if (strpos($text, "@"))
$text = preg_replace($emailSearchArray, $emailReplaceArray, $text);
if (strncmp($text, "\\",1) == 0) {
$text = preg_replace($shareSearchArray, $shareReplaceArray, $text);
}

return $text;

}
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:05 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03903 seconds
  • Memory Usage 2,221KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete