Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by John Percival John Percival is offline
Developer Last Online: Jan 2007 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 06-01-2001 Last Update: Never Installs: 9
 
No support by the author.

My first hack for vB

In functions.php, add this in at line 425, just after several lines of code about $replacearray

PHP Code:
// START VISUAL BASIC PARSING HACK
if (!function_exists("visbasparse")) {
  global 
$kw;
  if (
$incp) {
    include(
"./visbas.php");
  } else {
    include(
"./admin/visbas.php");
  }
}
$searcharray[] = "/(\[)(vbcode)(])(\r\n)*(.*)(\[\/vbcode\])/esiU";
$replacearray[] = "visbasparse('\\5')";
// END VISUAL BASIC PARSING HACK 
And then upload visbas.php to the admin directory:
PHP Code:
<?php
error_reporting
(7);
$kw=array("#Const","#If","Abs","Add","Alias","And","Any","AppActivate","Array","As","Asc","Atn","Base","Beep",
"Boolean","Byte","ByVal","CBool","CByte","CCur","CDBl","CDate","CDec","CInt","CLng","CSng","CStr","CVErr","CVar",
"Call","Case","ChDir","ChDrive","Chr","Clear","Close","Collection","Command","Compare","Const","Cos","CreateObject",
"CurDir","Currency","DDB","Date","DateAdd","DateDiff","DatePart","DateSerial","DateValue","Day","Debug","Declare",
"DefBool","DefByte","DefCur","DefDate","DefDbl","DefDec","DefInt","DefLng","DefObj","DefSng","DefStr","DefVar",
"DeleteSetting","Dim","Dir","Do","DoEvents","Double","EOF","Each","Else","ElseIf","End","Endif","Environ","Eqv",
"Erase","Err","Error","Exit","Exp","Explicit","FV","FileAttr","FileCopy","FileDateTime","FileLen","Filelen","Fix",
"For","Format","Function","Get","GetAllSettings","GetAttr","GetObject","GetSetting","Global","GoSub","GoTo","Hex",
"Hour","IIR","IPmt","If","Imp","In","InStr","Input #","Int","Integer","Is","IsArray","IsDate","IsEmpty","IsError",
"IsMissing","IsNull","IsNumeric","IsObject","Item","Kill","LBound","LCase","LOF","LSet","LTrim","Left","Len","Let",
"Lib","Like","Line Input #","Loc","Lock","Log","Long","Loop","MIRR","Me","Mid","Minute","MkDir","Mod","Module",
"Month","MsgBox","NPV","NPer","Name","New","Next","Not","Now","Object","Oct","On","Open","Option","Or","PPmt","PV",
"Pmt","Print","Print #","Private","Property","Public","Put","QBColor","RGB","RSet","RTrim","Raise","Randomize",
"Rate","ReDim","Remove","Reset","Resume","Return","Right","RmDir","Rnd","SLN","SYD","SaveSetting","Second","Seek",
"Select","SendKeys","Set","SetAttr","Sgn","Shell","Sin","Single","Space","Spc","Sqr","Static","Step","Stop","Str",
"StrComp","StrConv","String","Sub","Switch","Tab","Tan","Then","Time","TimeSerial","TimeValue","Timer","To","Trim",
"Type","TypeName","UBound","UCase","Unlock","Until","Val","VarType","Variant","Weekday","Wend","While","Width #",
"With","Write #","Xor","Year",
"Optional","InStrRev","Replace","Split","Join");

function 
visbasparse($text) {
  global 
$kw;

  
$text=str_replace("\\'""'"$text);

    
$lines=explode("\n",$text);
    
$val="";
    while (list(
$brr,$line)=each($lines)) {

        if (
substr(trim($line),0,1)=="'" or strtolower(substr(trim($line),0,4))=="rem ") {
            
$line="<font color=\"#007F00\">$line</font>";
        } else {
            
$quoteplace=strrpos($line,"'");
            if (
$quoteplace>0) {
                
$beforequote=substr($line,0,$quoteplace);
                if (
countchar($beforequote,"\"")%2==0) {
                    
$afterquote="<font color=\"#007F00\">".substr($line,$quoteplace)."</font>";
                    
$codebit=$beforequote;
                } else {
                    
$afterquote="";
                    
$codebit=$line;
                }
            } else {
                
$afterquote="";
                
$codebit=$line;
            }

            
reset ($kw);

            
$codebit=$codebit";
            while (list(
$key,$keyword)=each($kw)) {

                
$codebit=ereg_replace("([\r\n\\(\\)>, .])$keyword([\r\n <,.$\\(\\)])","\\1<font color=\"#00007F\">$keyword</font>\\2",$codebit);

            }
            
$codebit=substr($codebit,1);

            if (
$afterquote!="") {
                
$line=$codebit.$afterquote;
            } else {
                
$line=$codebit;
            }
        }
        
$val.=$line;
    }

  
$val=str_replace("'""\'"$val);
  
$val str_replace("\\\"","\"",$val);
  if (
substr($val,0,1)=="\n" or substr($val,0,1)=="\r") {
    
$val=substr($val,1);
  }
  return 
"</normalfont><blockquote><pre><smallfont>visual basic code:</smallfont><hr>" str_replace("<br>"""$val) . "<hr></pre><normalfont></blockquote>";

}

?>
Users can then use [vbcode] tags to access this.

I know that this is not very useful for many people, but it could be easily modified for other programming languages.

John

[edit - there's something funny going on with the slashes in the PHP code. Quote this message, and use the code straight from the reply window to get it accurately within any escaping problems.]

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 06-02-2001, 12:50 PM
ThomasP
Guest
 
Posts: n/a
Default

Wow, this is amazing!!!

Together with the big amount of "wordfiles" at http://www.ultraedit.com/downloads/additional.html this is very helpful,

Thanks & cheers,
-Tom
Reply With Quote
  #3  
Old 03-27-2002, 12:20 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anybody know how to install this on vB 2.2.4? I don't see anything about $replacearray on 425, so would somebody please quote a few lines of code I can search for?
Reply With Quote
  #4  
Old 03-27-2002, 07:53 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Um...please?
Reply With Quote
  #5  
Old 03-28-2002, 08:31 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add the code John posted right BEFORE this:
Code:
      }  // end version check
Nice hack John! Jelsoft should really hire you to work with them!
Reply With Quote
  #6  
Old 04-09-2002, 01:54 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cheers, Chen, it worked Like John said though, I still had to quote his message and then copy the text. Weird. *shrug*
Reply With Quote
  #7  
Old 04-09-2002, 10:11 AM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

please post screenshot of this hack.
Reply With Quote
  #8  
Old 06-12-2002, 06:46 PM
eiSecure's Avatar
eiSecure eiSecure is offline
 
Join Date: Dec 2001
Posts: 145
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by inetd
please post screenshot of this hack.
You can see it in action at: http://www.vbforums.com
Reply With Quote
  #9  
Old 08-09-2002, 04:01 PM
cybrcyfr cybrcyfr is offline
 
Join Date: Aug 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not so good at reg exp... Here you are only replacing if the keyword is found in the exact case it is in the $kw array. How can you change that? We have a ton of developers and they never follow standards.

What would be really nice is if it could find them in ANY case, and format them to the right case (and add color colding).

codebit=ereg_replace("([\r\n\\(\\)>, .])$keyword([\r\n <,.$\\(\\)])","\\1<font color=\"#FF0000\">$keyword</font>\\2",$codebit);
Reply With Quote
  #10  
Old 08-09-2002, 04:06 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I haven't looked at the code, but from what you posted I think you will need to replace all calls to "ereg_replace" with calls to "eregi_replace".
Reply With Quote
Reply


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 02:01 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.08245 seconds
  • Memory Usage 2,353KB
  • Queries Executed 23 (?)
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)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete