vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Anyone have this working.... (https://vborg.vbsupport.ru/showthread.php?t=38597)

cobradude 05-13-2002 08:04 PM

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

cobradude 05-13-2002 11:48 PM

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. :)

Admin 05-14-2002 08:49 AM

The parseurl() function does that, IIRC.

cobradude 05-14-2002 05:02 PM

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! :)

cobradude 05-14-2002 06:19 PM

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;

}

cobradude 05-14-2002 08:23 PM

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;

}


All times are GMT. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01116 seconds
  • Memory Usage 1,744KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete