Auto Link and Auto Mail BBCode in Lavalair

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Auto Link and Auto Mail BBCode in Lavalair

    01.Insert this functions into core.php.

    PHP Code:
    function trimlink($text, $length) {
        
    $dec = array("&", "\"", "'", "\\", '\"', "\'", "<", ">");
        
    $enc = array("&amp;", "&quot;", "'", "\", "&quot;", "'", "&lt;", "&gt;");
        
    $text = str_replace($enc, $dec, $text);
        if (
    strlen($text) > $length) $text = substr($text, 0, ($length-3))."...";
        
    $text = str_replace($dec, $enc, $text);
        return 
    $text;
    }
    function 
    hide_email($email, $title = "", $subject = "") {
        if (
    strpos($email, "@")) {
            
    $parts = explode("@", $email);
            
    $MailLink = "<a href='mailto:".$parts[0]."@".$parts[1];
            if (
    $subject != "") { $MailLink .= "?subject=".urlencode($subject); }
            
    $MailLink .= "'>".($title?$title:$parts[0]."@".$parts[1])."</a>";
            
    $MailLetters = "";
            for (
    $i = 0; $i < strlen($MailLink); $i++) {
                
    $l = substr($MailLink, $i, 1);
                if (
    strpos($MailLetters, $l) === false) {
                    
    $p = rand(0, strlen($MailLetters));
                    
    $MailLetters = substr($MailLetters, 0, $p).$l.substr($MailLetters, $p, strlen($MailLetters));
                }
            }
            
    $MailLettersEnc = str_replace("\\", "\\\\", $MailLetters);
            
    $MailLettersEnc = str_replace("\"", "\\\"", $MailLettersEnc);
            
    $MailIndexes = "";
            for (
    $i = 0; $i < strlen($MailLink); $i ++) {
                
    $index = strpos($MailLetters, substr($MailLink, $i, 1));
                
    $index += 48;
                
    $MailIndexes .= chr($index);
            }
            
    $MailIndexes = str_replace("\\", "\\\\", $MailIndexes);
            
    $MailIndexes = str_replace("\"", "\\\"", $MailIndexes);
            
            
    $res = "<script type='text/javascript'>";
            
    $res .= "ML=\"".str_replace("<", "xxxx", $MailLettersEnc)."\";";
            
    $res .= "MI=\"".str_replace("<", "xxxx", $MailIndexes)."\";";
            
    $res .= "ML=ML.replace(/xxxx/g, '<');";
            
    $res .= "MI=MI.replace(/xxxx/g, '<');";    $res .= "OT=\"\";";
            
    $res .= "for(j=0;j < MI.length;j++){";
            
    $res .= "OT+=ML.charAt(MI.charCodeAt(j)-48);";
            
    $res .= "}document.write(OT);";
            
    $res .= "</script>";
        
            return 
    $res;
        } else {
            return 
    $email;
        }
    } 

    02.Insert below lines into "function getbbcode" in core.php

    PHP Code:
    $text = preg_replace('#(^|[\n ])((http|https|ftp|ftps)://[\w\#$%&~/.\-;:=,?@\[\]\(\)+]*)#sie', "'\\1<br/>External Link:<a href=\"'.trim('\\2').'\" target=\"_blank\" title=\"autolink\">'.trimlink('\\2', 20).(strlen('\\2')>30?substr('\\2', strlen('\\2')-10, strlen('\\2')):'').'</a>'", $text);
    $text = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]\(\)+]*)#sie", "'\\1<br/>External Link:<a href=\"http://'.trim('\\2').'\" target=\"_blank\" title=\"autolink\">'.trimlink('\\2', 20).(strlen('\\1')>30?substr('\\2', strlen('\\2')-10, strlen('\\2')):'').'</a>'", $text);
    $text = preg_replace("#([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#sie", "hide_email('\\1@\\2')", $text); 
    Last edited by Dj_ThimirA; 27.01.11, 12:43. Reason: forgot to post something

    #2
    This does not look safe lol ....
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      Last edited by Dj_ThimirA; 27.01.11, 12:46.

      Comment


        #4
        Originally posted by subzero View Post
        This does not look safe lol ....
        true.. but it's a good start
        It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt.
        ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ !
        ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.
        キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

        Comment

        Working...
        X