vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   AutoCopy Code and PHP to clipboard (https://vborg.vbsupport.ru/showthread.php?t=37117)

212rikanmofo 04-22-2002 12:54 AM

in the instructions in the txt file says:

| File: admin/functions.php (1 change) |
+-----------------------------------------------+
| 1. Find this code:
+--------------------------------------------------------------------------+
Code:

return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><blockquote><pre><smallfont>code:</smallfont><hr>" . str_replace("<br>", "", str_replace("<br />", "", $foundcode) ) . "<hr></pre></blockquote><normalfont>";
}

but in my admin/functions.php it says:

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

im running vb 2.2.5... btw... so how am i spose to modify this?

TECK 04-22-2002 01:31 AM

you have firefly's hack installed? he posted how to mod the code few posts above.

Entourage 04-22-2002 09:27 AM

very nice hack mate! tnx

212rikanmofo 04-22-2002 09:41 AM

Quote:

Originally posted by FireFly
[high]* 212rikanmofo beats the system. ;)
[/high]

Ok, I got it to work with my hack (PHP and stuff in boxes) that you can click the table and not just the text.

Instead of replacing <pre I replace this:
Code:

<td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE:
With the same code only with added JavaScript.

k, firefly im really confused here, i have installed your code,php quote box hack, and i want to install this hack to work with your hack, can you please be more specific on what to do. when i install this hack, the php and code boxes return to vbulletin's default, which is them lines.... :(

Felix 05-04-2002 08:16 PM

Just replace

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #EEEEFF; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #1D6AA0;\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #EEEEFF; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #1D6AA0;\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

with this:

Code:

  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td><td align=\"right\"><smallfont>(double-click to copy to clipboard)</smallfont></td></tr><tr><td colspan=\"2\" ondblclick='javascript:window.clipboardData.setData(\"Text\", this.innerText); alert(\"Code copied to the clipboard. You can paste it now.\");' style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td><td align=\"right\"><smallfont>(double-click to copy to clipboard)</smallfont></td></tr><tr><td colspan=\"2\" ondblclick='javascript:window.clipboardData.setData(\"Text\", this.innerText); alert(\"Code copied to the clipboard. You can paste it now.\");' style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: {codefontcolor}; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: {codebackground};\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";
}

Worked for me :)

Bald Bouncer 05-07-2002 03:56 PM

Quote:

Originally posted by FireFly
* FireFly beats the system. ;)

Ok, I got it to work with my hack (PHP and stuff in boxes) that you can click the table and not just the text.

Instead of replacing <pre I replace this:
Code:

<td colspan="2" style="BORDER: #000000 1px solid; FONT-SIZE:
With the same code only with added JavaScript.

what added javascript ... I just cant get this too work with your boxes :(

mersey 05-13-2002 08:42 AM

cheers very handy hack :)

Boofo 05-13-2002 09:26 AM

I already installed Firefly's code and php hack and I also installed this great hack (the part I needed with Firefly's hack), but how do I add the "double-click to copy to clipboard" text at the top of the box if I only need to use the final step 1 in this file? Also, I'm not 100 % clear on the instructions Firefly said about the <pre replacement. Can anyone help explain what it is exactly that I am supposed to do here?

Allstar DC 05-14-2002 02:17 PM

ok,i figured it out. do the following after you installed firefly's hack:


replace:
Code:

return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $buffer . "</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\" cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td></tr><tr><td style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $foundcode . "</pre></td></tr></table><normalfont>";

with:
Code:

return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\"

cellspacing=\"1\"><tr><td><smallfont><b>PHP:</b></smallfont></td><td align=\"right\"><smallfont>(double click the code to

copy it)</smallfont></td></tr><tr><td colspan=\"2\" style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR:

#000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $buffer .

"</pre></td></tr></table><normalfont>";
}

// ###################### Start stripbrsfromcode #######################
function stripbrsfromcode($foundcode) {
  $foundcode = str_replace("\\\"","\"",$foundcode);
  return "</normalfont><table border=\"0\" align=\"center\" width=\"90%\" cellpadding=\"3\"

cellspacing=\"1\"><tr><td><smallfont><b>code:</b></smallfont></td><td align=\"right\"><smallfont>(double click the code to

copy it)</smallfont></td></tr><tr><td colspan=\"2\" style=\"BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR:

#000000; FONT-FAMILY: Courier, Courier New, sans-serif; BACKGROUND-COLOR: #D7D7D7;\"><pre>" . $foundcode .

"</pre></td></tr></table><normalfont>";

forget about the lines in nakkids hack, just do this:
Code:

Create a new replacement variable. Go to your admin control panel:
|
|      Replacements > Add
|
| and enter the following information:
|
|      Code to find:  <td colspan="2"
|      Code to insert: <td colspan="2" ondblclick='javascript:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");'

that will fix the "php:" and "code:" part.

to make the box clickable with quote do the following:

+-------------------------------------------------------------------------------------------------+
| In the Admin CP, goto Modify under Custom vB Codes and click [edit] next to the [quote] code |
| |
+-------------------------------------------------------------------------------------------------+
replace this:
Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td></tr><tr><td style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table>
with this:
Code:

<table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"><tr><td><smallfont><b>quote:</b></smallfont></td><td align="right"><smallfont>(double click the code to copy it)</td></tr><tr><td colspan="2" ondblclick='javascript:window.clipboardData.setData("Text", this.innerText); alert("Code copied to the clipboard. You can paste it now.");' style="BORDER: #000000 1px solid; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana,Arial; BACKGROUND-COLOR: #D7D7D7;">{param}</td></tr></table>

that will fix it for you!

Boofo 05-14-2002 05:35 PM

It works here now, I just don't have the "double-click to copy to clipboard" showing up like it does here. That's the only part I need to make it look right.


All times are GMT. The time now is 01:46 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.01155 seconds
  • Memory Usage 1,782KB
  • 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
  • (11)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete