Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

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
  #22  
Old 08-09-2002, 10:36 PM
Neo's Avatar
Neo Neo is offline
 
Join Date: Oct 2001
Location: Anywhere
Posts: 1,817
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by John
My first hack for vB
Dont worry John, one day you will be a professional hack just like me!!! :knockedout:
Reply With Quote
  #23  
Old 10-30-2002, 02:55 PM
Dev-United Dev-United is offline
 
Join Date: Oct 2002
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Love your hack John
Reply With Quote
Reply

Thread Tools

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 12:29 PM.


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.03738 seconds
  • Memory Usage 2,275KB
  • Queries Executed 17 (?)
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
  • (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
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)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