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
  #12  
Old 08-09-2002, 05:20 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wow I m not aware there is hack like this! :thumbup:

John or Firefly

I d like to get some of your hints or tips for this. Since John stated that I can modify this hack to change to C/C++ codes so what and which do you suggest me to change this hack to C/C++? You dont have to do all of that but just tell me which codes that I should change and input C/C++ codes?

thanks
Reply With Quote
  #13  
Old 08-09-2002, 07:36 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for double post but I didnt see how.. perhaps 2.2.6 have different lines, I try everything to get it work but no luck. Can anyone give me excat codes to look for to put it above codes to get it work.
Reply With Quote
  #14  
Old 08-09-2002, 07:49 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Never mind, I got it but still have double line space problem =\

double space problem:
Code:
Option Explicit

Dim angle, pi As Integer


Private Sub form_load()

pi = 3.14159

End Sub


Private Sub tmr1_Timer()

'pic1.Cls

If angle <= 359 Then

pic1.Line (278.5, 186.5)-(278.5 + 100 * Math.Sin(angle * (pi / 180)), 186.5 + 100 * Math.Cos(angle * (pi / 180))), vbBlack

angle = angle + 1

End If

'If angle >= 360 Then angle = 0

lbl1.Caption = "Angle = " & angle

End Sub
instead it should be like this:

Code:
Option Explicit
Dim angle, pi As Integer

Private Sub form_load()
pi = 3.14159
End Sub

Private Sub tmr1_Timer()
'pic1.Cls
If angle <= 359 Then
pic1.Line (278.5, 186.5)-(278.5 + 100 * Math.Sin(angle * (pi / 180)), 186.5 + 100 * Math.Cos(angle * (pi / 180))), vbBlack
angle = angle + 1
End If
'If angle >= 360 Then angle = 0
lbl1.Caption = "Angle = " & angle
End Sub
So how? I only wish that there is a instruction to help me and anyone to look for excat codes to put after or before instead of based on lucky guess as I did but still getting double space problem. I m going to be king of the bump on this thread until solution come up =P
Reply With Quote
  #15  
Old 08-09-2002, 08:34 PM
cybrcyfr cybrcyfr is offline
 
Join Date: Aug 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have actualy noted some highlighting issues...

Even with changing the:
PHP Code:
$codebit=ereg_replace("([\r\n\\(\\)>, .])$keyword([\r\n <,.$\\(\\)])","\\1<font color=\"#FF0000\">$keyword</font>\\2",$codebit); 
to

PHP Code:
$codebit=eregi_replace("([\r\n\\(\\)>, .])$keyword([\r\n <,.$\\(\\)])","\\1<font color=\"#FF0000\">$keyword</font>\\2",$codebit); 
See the attached screenshot. I am going t go through and make it case insensative, and allow you to specify CSS colors (and then we can extend it for other languages...)
Reply With Quote
  #16  
Old 08-09-2002, 08:38 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cybrcyfr

how do you do that without having double space? can you provide which codes to look for to put after or before John's codes? Pls?

thanks
Reply With Quote
  #17  
Old 08-09-2002, 08:51 PM
cybrcyfr cybrcyfr is offline
 
Join Date: Aug 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used the code that he posted above. Where are you pulling the code from? I pulled my from the Klient Script Editor. You might have issues with the chr(10) and chr(13) from your source application.

Are you on unix/mac/pc? Unix line breaks are different, I dont think they would carry over though...

Copy your code to notepad, how does it look? Then copy it from notepad into your forums, and see how it looks.

What ver of vB are you using? If you still have issues, pase the code from visbas.php here....
Reply With Quote
  #18  
Old 08-09-2002, 08:52 PM
cybrcyfr cybrcyfr is offline
 
Join Date: Aug 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used the code that he posted above. Where are you pulling the code from? I pulled my from the Klient Script Editor. You might have issues with the chr(10) and chr(13) from your source application.

Are you on unix/mac/pc? Unix line breaks are different, I dont think they would carry over though...

Copy your code to notepad, how does it look? Then copy it from notepad into your forums, and see how it looks.

What ver of vB are you using? If you still have issues, pase the code from visbas.php here....
Reply With Quote
  #19  
Old 08-09-2002, 09:17 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Edit: never mind, I got it work! It is for only UNIX, not PC that s what it does to me so far =P
Reply With Quote
  #20  
Old 08-09-2002, 09:54 PM
cybrcyfr cybrcyfr is offline
 
Join Date: Aug 2002
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It looks right to me.... I don't know man.
Reply With Quote
  #21  
Old 08-09-2002, 10:04 PM
DestyNova DestyNova is offline
 
Join Date: Jun 2002
Posts: 244
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cybrcyfr

I got it work, it seem work only for UNIX, I use that hack on my local server on my laptop (PC)

Anyway thanks for offer your help =)
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 08:17 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.04580 seconds
  • Memory Usage 2,379KB
  • Queries Executed 25 (?)
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_code
  • (4)bbcode_php
  • (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
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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