vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Wide image automatic resize for html and vB tags in posts - fixes template problems (https://vborg.vbsupport.ru/showthread.php?t=67743)

Steve St.Lauren 08-21-2005 04:38 PM

Quote:

Originally Posted by dansgts
it works for linked immages, but not attached ones, any way to fix that?

Attached images you can limit built right into vB - it's in your administrator control panel.

Steve St.Lauren 08-21-2005 04:39 PM

Quote:

Originally Posted by dai-kun
I installed this a couple of times, but everytime ALL my pictures within posts have the "Image link is broken" error, no matter what size it is. Even signature pics comes up like that. I've read all the replies but nothing really helps. Thanks.

Your firewall on the server is probably blocking that port.

J82980BA3E43 08-22-2005 10:02 AM

This hack is great but it works sometimes slowly.
Is there a way to make it faster ?

On some Pics i wait over 12/20 sec. an than open the thread.

Steve St.Lauren 08-22-2005 03:05 PM

Quote:

Originally Posted by J82980BA3E43
This hack is great but it works sometimes slowly.
Is there a way to make it faster ?

On some Pics i wait over 12/20 sec. an than open the thread.

The short answer is no. Look back through this thread and you'll see the discussions of how and why that is. The main thing that will slow it down is if a server is unavailable that is being called - there is a 5 second timeout if a server can't be reached (and that is for each picture so if you have 5 pictures in a thread linked to a server that doesn't exist any more that will take 25 seconds).

Dorign 08-23-2005 02:55 AM

Not trying to plug my own modification, but I had to use this because my forum is a bit larger. To my knowledge, this is the fastest and most accurate image resizer to date, but it uses Javascript instead of editing the img tagging. https://vborg.vbsupport.ru/showthrea...611#post758611

Allan 09-13-2005 07:55 PM

Thanks for this hack, good job Steve :)

Work on vB 3.0.7


Click Install

eljeffe 09-16-2005 04:36 PM

Images show fine without this hack. All I get are "Image link is broken". I've seen the responses about firewall ports and timeouts, but I don't see how if the images show up without the hack and they don't with the hack, how this could be the problem.

Any ideas?

Blindchild02 09-16-2005 05:05 PM

i couldnt get this to open in a new window :X

Blindchild02 09-16-2005 06:20 PM

nm, got it to work:
http://www.hulkforum.com/showthread.php?t=18

Steve St.Lauren 09-17-2005 12:25 AM

Quote:

Originally Posted by eljeffe
Images show fine without this hack. All I get are "Image link is broken". I've seen the responses about firewall ports and timeouts, but I don't see how if the images show up without the hack and they don't with the hack, how this could be the problem.

Any ideas?

The reason a firewall can cause a problem is because the hack does a file open from your file server to the server with the pictures to get the picture size. That's done on a seperate port. When you are normally looking at a page with a linked picture your PC that you are viewing it at is loading the picture from that server - the web server doesn't have anything to do with the picture at all.

MrGoodbyte 09-19-2005 03:59 AM

I get mad on it .. I'm quite sure I've made all changes (in VB 3.08) I have to do:
functions_showthread (strongly shortend):
Code:

                // showthread / showpost style Postbit
                default:
                        if (!empty($post['pagetext_html']))
                        {
                                $parsed_postcache['skip'] = true;
                                if ($post['hasimages'])
                                {
                                                                                // Image Size hack r1.2
                                        // Modified by SS
                                        // $post['message'] = handle_bbcode_img($post['pagetext_html'], $forum['allowimages']);
                                        $post['message'] = handle_bbcode_img($post['pagetext_html'], $forum['allowimages'], 0);
                                        //

                                }
                                else
                                {
                                        $post['message'] = &$post['pagetext_html'];
                                }
                        }
                        else
                        {
                                $parsed_postcache['skip'] = false;
                                $post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
                        }

functions_bbcodeparse (strongly shortend):
Code:

// ###################### Start bbcodeparse #######################
function parse_bbcode($bbcode, $forumid = 0, $allowsmilie = 1, $isimgcheck = 0, $parsedtext = '', $parsedhasimages = 0, $iswysiwyg = 0)
{
        // $parsedtext contains text that has already been turned into HTML and just needs images checking
        // $parsedhasimages specifies if the text has images in that need parsing

        global $vboptions, $parsed_postcache;

        $donl2br = 1;

        if (empty($forumid))
        {
                $forumid = 'nonforum';
        }

        switch($forumid)
        {
                // parse private message
                case 'privatemessage':
                        $dohtml = $vboptions['privallowhtml'];
                        $dobbcode = $vboptions['privallowbbcode'];
                        $dobbimagecode = $vboptions['privallowbbimagecode'];
                        $dosmilies = $vboptions['privallowsmilies'];
                        break;

                // parse user note
                case 'usernote':
                        $dohtml = $vboptions['unallowhtml'];
                        $dobbcode = $vboptions['unallowvbcode'];
                        $dobbimagecode = $vboptions['unallowimg'];
                        $dosmilies = $vboptions['unallowsmilies'];
                        break;

                // parse non-forum item
                case 'nonforum':
                        $dohtml = $vboptions['allowhtml'];
                        $dobbcode = $vboptions['allowbbcode'];
                        $dobbimagecode = $vboptions['allowbbimagecode'];
                        $dosmilies = $vboptions['allowsmilies'];
                        if ($allowsmilie != 1)
                        {
                                $dosmilies = $allowsmilie;
                        }
                        break;

                case 'announcement':
                        global $post;
                        $dohtml = $post['allowhtml'];
                        if ($dohtml)
                        {
                                $donl2br = 0;
                        }
                        $dobbcode = $post['allowbbcode'];
                        $dobbimagecode = $post['allowbbcode'];
                        $dosmilies = $allowsmilie;
                        break;

                // parse forum item
                default:
                        $forum = fetch_foruminfo($forumid);
                        $dohtml = $forum['allowhtml'];
                        $dobbimagecode = $forum['allowimages'];
                        $dosmilies = $forum['allowsmilies'];
                        if ($allowsmilie != 1)
                        {
                                $dosmilies = $allowsmilie;
                        }
                        $dobbcode = $forum['allowbbcode'];
                        break;
        }

        if (!empty($parsedtext))
        {
                if ($parsedhasimages)
                {
                       
                        // Image size hack R1.2
                        // Modified by SS
                        // return handle_bbcode_img($parsedtext, $dobbimagecode);
                        return handle_bbcode_img($parsedtext, $dobbimagecode, $iswysiwyg);
                        //

                }
                else
                {
                        return $parsedtext;
                }
        }
        else
        {
                if ($isimgcheck)
                { // do this since we're only checking for smilies and IMG code
                        $dobbcode = 0;
                }
                return parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg, $donl2br);
        }
}

// ###################### Start checkparam #######################
// called by the preg_replace for custom bbcodes - ensures that
// users can't get around censor text by adding empty bbcodes
// such as 'censoredword' into their messages
function handle_bbcode_parameter($param, $return)
{
        if (trim($param) != '')
        {
                return str_replace('\\"', '"', $return);
        }
}

// ###################### Start handle_custom_bbcode #######################
function handle_custom_bbcode($param, $option, $return)
{
        if (trim($param) == '')
        {
                return '';
        }

        $param = str_replace('\\"', '"', $param);
        $return = str_replace('\\"', '"', $return);
        $option = str_replace(array('\\"', '['), array('"', '['), $option);

        $return = preg_replace('#%(?!\d+\$s)#', '%%', $return);
        return sprintf($return, $param, $option);
}

// ###################### Start bbcodeparse2 #######################
function parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg = 0, $donl2br = 1)
{
// parses text for vB code, smilies and censoring

        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $smiliecache;
        global $html_allowed;
        global $threadid;

        if ($vboptions['wordwrap'] != 0 AND !$iswysiwyg)
        {
                $bbcode = fetch_word_wrapped_string($bbcode);
        }

        $html_allowed = true;
        // ********************* REMOVE HTML CODES ***************************
        if (!$dohtml)
        {
                /*static $html_find = array('&lt;', '&gt;', '<', '>');
                static $html_replace = array('&amp;lt;', '&amp;gt;', '&lt;','&gt;');

                $bbcode = str_replace($html_find, $html_replace, $bbcode);*/
                $bbcode = htmlspecialchars_uni($bbcode);
                $html_allowed = false;
        } // end html
        // Image Size hack r1.2
        // Added by SS to resize large pics and place link to full size pic

        // set max_imgsize to the max size you want pictures to be
        $max_imgsize=560;
       
        // check for img tag and see if html is enabled and if not using wysiwyg editor
        if (strstr(strtolower($bbcode),'<img') AND $dohtml AND !$iswysiwyg) {
                $tagstartcounter=0;
                do {
                        $bbcodelength=strlen($bbcode);
                        // pull tag from bbcode
                        $tagopen=(strpos(strtolower($bbcode),'<img',$tagstartcounter));
                        $tagclose=(strpos($bbcode,'>',$tagopen));
                        $bbtag=substr($bbcode,$tagopen,($tagclose-$tagopen+1));
                        $bbtag = str_replace('\'','"',$bbtag);

                        // get link from bbtag
                        $linkopen=(strpos(strtolower($bbtag),'<img'));
                        $linkopen2=(strpos(strtolower($bbtag),'"',$linkopen));
                        $linkclose=(strpos($bbtag,'"',$linkopen2+1));
                        $link=substr($bbtag,$linkopen2+1,($linkclose-$linkopen2-1));

                        // remove double spaces -- fixes issues with wordwrap
                        $link = str_replace('  ', '', $link);

                        // Check to see if image exists
                        $image= ($link);
                       
                        // Get host url name for fsockopen to see if server is reachable
                        $img_host=str_replace('http://','',$link);
                        $img_host=substr($img_host,0,strpos($img_host,'/'));

                        // set image found by default
                        $image_found=true;
                       
                        // Check is server is reachable and timeout in 5 seconds if not
                        if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
                                // Check if image is on server
                                if (@fclose(@fopen("$image", "r"))) {
                                        // Check image size and if oversize, change bbtag
                                        $img_width = getimagesize($link);
                                        if ($img_width[0] > $max_imgsize) {
                                                $bbtag = '<table><tr><td align="center"><a href="' . $link . '"><img src="'
                                                        . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbtag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>';
                                                }
                                        }
                                else {
                                        // Image not found
                                        $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
                                        $image_found=false;
                                        }
                                }
                        else {
                                // Server is down
                                $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
                                $image_found=false;
                                }

                               
                        // replace bbtag into bbcode
                        $bbcode=substr($bbcode,0,$tagopen).$bbtag.substr($bbcode,$tagclose+1,$bbcodelength-$tagclose);

                        // check if image was found to see what where to start the next search
                        if ($image_found) {
                                // move pointer back to img tag in case it moved
                                $tagopen=$tagopen+(strpos(strtolower($bbtag),'<img'));
                                }
                        else {
                                // move pointer back to img tag in case it moved
                                $tagopen=$tagopen+(strpos(strtolower($bbtag),'id="image_found"'));
                                }
                               

                        // start search from end of previous tag
                        $tagstartcounter=(strpos($bbcode,'>',$tagopen));
                        } while (strpos(strtolower($bbcode),'<img',$tagstartcounter));
                }

        // End Image Size hack r1.2
        // ********************* PARSE SMILIES ***************************
        if ($dosmilies)
        {
                static $smilie_find, $smilie_replace;

                if (empty($smilie_find) OR empty($smilie_replace))
                {
                        if (isset($smiliecache))
                        {
                                // we can get the smilies from the smiliecache php template
                                DEVDEBUG('returning smilies from the template cache');
                                if (is_array($smiliecache))
                                {
                                        foreach ($smiliecache AS $smilie)
                                        {
                                                if (trim($smilie['smilietext']) != '')
                                                {
                                                        if (!$dohtml)
                                                        {
                                                                $smilie_find[] = htmlspecialchars_uni(trim($smilie['smilietext']));
                                                        }
                                                        else
                                                        {
                                                                $smilie_find[] = trim($smilie['smilietext']);
                                                        }
                                                        // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
                                                        if ($iswysiwyg)
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />";
                                                        }
                                                        else
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />";
                                                        }
                                                }
                                        }
                                }
                        }
                        else
                        {
                                // we have to get the smilies from the database
                                DEVDEBUG('querying smilies for parse_bbcode2();');
                                $smilies = $DB_site->query("
                                        SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie
                                ");
                                while ($smilie = $DB_site->fetch_array($smilies))
                                {
                                        if(trim($smilie['smilietext']) != '')
                                        {
                                                if (!$dohtml)
                                                {
                                                        $smilie_find[] = htmlspecialchars_uni(trim($smilie['smilietext']));
                                                }
                                                else
                                                {
                                                        $smilie_find[] = trim($smilie['smilietext']);
                                                }
                                                // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
                                                if ($iswysiwyg)
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />";
                                                        }
                                                        else
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />";
                                                        }
                                        }
                                }
                        }
                }

                // str_replace the text using the smilie_find and smilie_replace arrays
                #$bbcode = str_replace($smilie_find, $smilie_replace, $bbcode);

                // alternative method to avoid parsing HTML entities as smilies:
                foreach($smilie_find AS $smiliekey => $smiliefind)
                {
                        $bbcode = preg_replace('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})' . preg_quote($smiliefind, '/') . '/s', $smilie_replace["$smiliekey"], $bbcode);
                }
        } // end smilies
$bbcode=wsmhack($bbcode);

        // do new lines
        $wysiwygtype = null;
        if ($iswysiwyg == 1)
        {
                $whitespacefind = array(
                        '#(\r\n|\n|\r)?( )*(\[\*\]|\[/list|\[list|\[indent)#si',
                        '#(/list\]|/indent\])( )*(\r\n|\n|\r)?#si'
                );
                $whitespacereplace = array(
                        '\3',
                        '\1'
                );
                $bbcode = preg_replace($whitespacefind, $whitespacereplace, $bbcode);

                if (is_browser('ie'))
                {
                        $wysiwygtype = 'ie';

                        // this fixes an issue caused by odd nesting of tags. This causes IE's
                        // WYSIWYG editor to display the output as vB will display it
                        $rematch_find = array(
                                '#\[b\](.*)\[/b\]#siUe',
                                '#\[i\](.*)\[/i\]#siUe',
                                '#\[u\](.*)\[/u\]#siUe',
                        );
                        $rematch_replace = array(
                                "bbcode_rematch_tags_wysiwyg('\\1', 'b')",
                                "bbcode_rematch_tags_wysiwyg('\\1', 'i')",
                                "bbcode_rematch_tags_wysiwyg('\\1', 'u')",
                        );
                        $bbcode = preg_replace($rematch_find, $rematch_replace, $bbcode);

                        $bbcode = '<p style="margin:0px">' . preg_replace('#(\r\n|\n|\r)#', "</p>\n<p style=\"margin:0px\">", trim($bbcode)) . '</p>';
                }
                else
                {
                        $bbcode = nl2br($bbcode);
                        $wysiwygtype = 'moz_css';
                }
                $bbcode = preg_replace('#(\[list(=(&quot;|"|\'|)(.*)\\3)?\])(((?>[^\[]*?|(?R))|(?>.))*)(\[/list(=\\3\\4\\3)?\])#siUe', "remove_wysiwyg_breaks('\\0', \$wysiwygtype)", $bbcode);

                //$bbcode = preg_replace('#\[list#i', '</p>[list', $bbcode);
                //$bbcode = preg_replace('#\[/list(=(&quot;|"|\'|)[a-z0-9+]\\2)?](?!\[\*\])#i', '[/list\\1]<p style="margin:0px">', $bbcode);

                $bbcode = preg_replace('#<p style="margin:0px">\s*</p>(?!\s*\[list|$)#i', '<p style="margin:0px">&nbsp;</p>', $bbcode);
                $bbcode = str_replace('<p style="margin:0px"></p>', '', $bbcode);

                // convert tabs to four &nbsp;
                $bbcode = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $bbcode);
        }
        // new lines to <br />
        else
        {
                $whitespacefind = array(
                        '#(\r\n|\n|\r)?( )*(\[\*\]|\[/list|\[list|\[indent)#si',
                        '#(/list\]|/indent\])( )*(\r\n|\n|\r)?#si'
                );
                $whitespacereplace = array(
                        '\3',
                        '\1'
                );
                $bbcode = preg_replace($whitespacefind, $whitespacereplace, $bbcode);

                if ($donl2br)
                {
                        $bbcode = nl2br($bbcode);
                }
        }

        // ********************* PARSE BBCODE TAGS ***************************
        if ($dobbcode AND strpos($bbcode, '[') !== false AND strpos($bbcode, ']') !== false)
        {
                switch($vboptions['usebbcodeparserecurse'])
                {
                        case 1:
                                $parsefunc = 'parse_bbcode_recurse';
                                break;

                        case 0:
                                $parsefunc = 'parse_bbcode_regex';
                                break;

                        default:
                                $parsefunc = 'parse_bbcode_regexrecurse';
                }
                $bbcode = $parsefunc($bbcode, $iswysiwyg);

                if ($wysiwygtype == 'ie')
                {
                        $bbcode = preg_replace('#<p style="margin:0px"><(p|div) align="([a-z]+)">(.*)</\\1></p>#siU', '<p style="margin:0px" align="\\2">\\3</p>', $bbcode);
                }
                if ($iswysiwyg)
                {
                        // need to display smilies in code/php/html tags as literals
                        $bbcode = preg_replace('#\[(code|php|html)\](.*)\[/\\1\]#siUe', "strip_smilies(str_replace('\\\"', '\"', '\\0'), true)", $bbcode);
                }
        }

        // parse out nasty active scripting codes
        static $global_find = array('/javascript:/si', '/about:/si', '/vbscript:/si', '/&(?![a-z0-9#]+;)/si');
        static $global_replace = array('javascript<b></b>:', 'about<b></b>:', 'vbscript<b></b>:', '&amp;');
        $bbcode = preg_replace($global_find, $global_replace, $bbcode);

        // run the censor
        $bbcode = fetch_censored_text($bbcode);
        $has_img_tag = contains_bbcode_img_tags($bbcode);

        // save the cached post
        global $stopsaveparsed, $parsed_postcache;
        if (!$stopsaveparsed AND $parsed_postcache['skip'] != true)
        {
                $parsed_postcache['text'] = $bbcode;
                $parsed_postcache['images'] = $has_img_tag;
        }

        // do [img] tags if the item contains images
        if(($dobbcode OR $dobbimagecode) AND $has_img_tag)
        {
                                // Image resize hack R1.2
                // Modified by SS
                // $bbcode = handle_bbcode_img($bbcode, $dobbimagecode);
                $bbcode = handle_bbcode_img($bbcode, $dobbimagecode, $iswysiwyg);
                //

        }
$myreplies = $DB_site->query_first("SELECT COUNT(postid) AS count FROM ". TABLE_PREFIX . "post WHERE userid='$bbuserinfo[userid]' and threadid='$threadid'");
      if ($myreplies[count] > 0 || $bbuserinfo['usergroupid'] == 5 || $bbuserinfo['usergroupid'] == 6 || $bbuserinfo['usergroupid'] == 7) {
        $bbcode = preg_replace('/\\[hide\\](.*)\\[\/hide\\]/si', 'Hidden Text: <br>\\1', $bbcode);
      } else {
        $bbcode = preg_replace('/\\[hide\\](.*)\\[\/hide\\]/si', '<b><center><img src="./hide.gif" alt=Du musst eine Antwort erstellen um den Inhalt zu sehen!></center></b><br>', $bbcode);
      }

        return $bbcode;
}

// ###################### Start remove_wysiwyg_breaks #######################
function bbcode_rematch_tags_wysiwyg($innertext, $tagname)
{
        // This function replaces line breaks with [/tag]\n[tag].
        // It is intended to be used on text inside [tag] to fix an IE WYSIWYG issue.

        $innertext = str_replace('\"', '"', $innertext);
        return "[$tagname]" . preg_replace('#(\r\n|\n|\r)#', "[/$tagname]\n[$tagname]", $innertext) . "[/$tagname]";
}

// ###################### Start remove_wysiwyg_breaks #######################
function remove_wysiwyg_breaks($fulltext, $wysiwygtype = 'ie')
{
        $fulltext = str_replace('\"', '"', $fulltext);
        preg_match('#^(\[list(=(&quot;|"|\'|)(.*)\\3)?\])(.*?)(\[/list(=\\3\\4\\3)?\])$#siU', $fulltext, $matches);
        $prepend = $matches[1];
        $innertext = $matches[5];

        $find = array("</p>\n<p style=\"margin:0px\">", '<br />', '<br>');
        $replace = array("\n", "\n", "\n");
        $innertext = str_replace($find, $replace, $innertext);

        if ($wysiwygtype == 'ie')
        {
                return '</p>' . $prepend . $innertext . '[/list]<p style="margin:0px">';
        }
        else
        {
                return $prepend . $innertext . '[/list]';
        }
}

// ###################### Start bbcodeparse2_regexrecurse #######################
function parse_bbcode_regexrecurse($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse, $session;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                $doubleRegex = '/(\[)(%s)(=)(&quot;|"|\'|)([^"]*)(\\4)\](.*)(\[\/%s\])/esiU';
                $singleRegex = '/(\[)(%s)(\])(.*)(\[\/%s\])/esiU';

                if (isset($datastore['bbcodecache'])) // get bbcodes from the datastore
                {
                        $bbcodecache = unserialize($datastore['bbcodecache']);

                        foreach ($bbcodecache AS $bbregex)
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace(array('\\7', '\\5'), array('%1$s', '%2$s'), $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]=";
                                        $checkparam = '\\7';
                                        $checkoption = '\\5';
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace('\\4', '%1$s', $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]]";
                                        $checkparam = '\\4';
                                        $checkoption = '';
                                }
                                $BBCODES['custom']['find']["$tagname"] = $regex;
                                $BBCODES['custom']['replace']["$tagname"] = "handle_custom_bbcode('$checkparam', '$checkoption', '" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                        }
                }
                else // query bbcodes out of the database
                {
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while ($bbregex = $DB_site->fetch_array($bbcodes))
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace(array('\\7', '\\5'), array('%1$s', '%2$s'), $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]=";
                                        $checkparam = '\\7';
                                        $checkoption = '\\5';
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace('\\4', '%1$s', $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]]";
                                        $checkparam = '\\4';
                                        $checkoption = '';
                                }
                                $BBCODES['custom']['find']["$tagname"] = $regex;
                                $BBCODES['custom']['replace']["$tagname"] = "handle_custom_bbcode('$checkparam', '$checkoption', '" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                        }
                }
        }

        if ($iswysiwyg) // text to show in the WYSIWYG editor box
        {
                $bbcode_find = $BBCODES['standard']['find'];
                $bbcode_replace = $BBCODES['standard']['replace'];
        }
        else // text to show everywhere else
        {
                //$bbcode_find = array_merge($BBCODES['standard']['find'], $BBCODES['custom']['find']);
                //$bbcode_replace = array_merge($BBCODES['standard']['replace'], $BBCODES['custom']['replace']);

                $bbcode_find = array_merge($BBCODES['custom']['find'], $BBCODES['standard']['find']);
                $bbcode_replace = array_merge($BBCODES['custom']['replace'], $BBCODES['standard']['replace']);
        }

        foreach($bbcode_find AS $tag => $findregex)
        {
                // if using option, $tag will be '[xxx='
                // if not using option, $tag will be '[xxx]'

                while (stristr($bbcode, $tag) !== false)
                {
                        // make a copy of the text pre-replacement for later comparison
                        $origtext = $bbcode;

                        $bbcode = preg_replace($findregex, $bbcode_replace["$tag"], $bbcode);

                        // check to see if the preg_replace actually did anything... if it didn't, break the loop
                        if ($origtext == $bbcode)
                        {
                                break;
                        }
                }
        }

        return $bbcode;
}

// ###################### Start bbcodeparse2_regex #######################
function parse_bbcode_regex($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse, $session;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                $doubleRegex = '/(\[)(%s)(=)(&quot;|"|\'|)(.*)(\\4)\](.*)(\[\/%s\])/esiU';
                $singleRegex = '/(\[)(%s)(\])(.*)(\[\/%s\])/esiU';

                if (isset($datastore['bbcodecache']))
                { // we can get the bbcode from the bbcodecache php template
                        DEVDEBUG("returning bbcodes from the template cache");
                        $bbcodecache = unserialize($datastore['bbcodecache']);
                        foreach($bbcodecache AS $bbregex)
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 7;
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 4;
                                }
                                for ($i = 0; $i < 3; $i++)
                                {
                                        $BBCODES['custom']['find'][] = $regex;
                                        $BBCODES['custom']['replace'][] = "handle_bbcode_parameter('\\$checkparam','" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                                }
                        }
                }
                else
                { // we have to get the bbcodes from the database
                        DEVDEBUG("querying bbcodes for parse_bbcode2();");
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while($bbregex = $DB_site->fetch_array($bbcodes))
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 7;
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 4;
                                }
                                for ($i = 0; $i < 3; $i++)
                                {
                                        $BBCODES['custom']['find'][] = $regex;
                                        $BBCODES['custom']['replace'][] = "handle_bbcode_parameter('\\$checkparam','" . str_replace("'","\'",$bbregex['bbcodereplacement']) . "')";
                                }
                        }
                }
        }

        if ($iswysiwyg) // text to show in the WYSIWYG editor box
        {
                $bbcode_find = $BBCODES['standard']['find'];
                $bbcode_replace = $BBCODES['standard']['replace'];
        }
        else // text to show everywhere else
        {
                $bbcode_find = array_merge($BBCODES['standard']['find'], $BBCODES['custom']['find']);
                $bbcode_replace = array_merge($BBCODES['standard']['replace'], $BBCODES['custom']['replace']);
        }

        // do the actual replacement
        $bbcode = preg_replace($bbcode_find, $bbcode_replace, $bbcode);

        return $bbcode;
}

// ###################### Start bbcodeparse2_recurse #######################
function parse_bbcode_recurse($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        // just get rid of old closing list tags
        if (stristr($bbcode, '/list=') != false)
        {
                $bbcode = preg_replace('#/list=[a-z0-9]\]#siU', '/list]', $bbcode);
        }

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                if (isset($datastore['bbcodecache']))
                { // we can get the bbcode from the bbcodecache php template
                        DEVDEBUG("returning bbcodes from the template cache");
                        if (!isset($bbcodecache))
                        {
                                $bbcodecache = unserialize($datastore['bbcodecache']);
                        }
                        foreach($bbcodecache AS $thisbbcode)
                        {
                                $BBCODES['custom']['recurse']["$thisbbcode[bbcodetag]"]["$thisbbcode[twoparams]"] = array('replace_html' => $thisbbcode['bbcodereplacement']);
                        }
                }
                else
                { // we have to get the bbcodes from the database
                        DEVDEBUG("querying bbcodes for parse_bbcode2();");
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while($thisbbcode = $DB_site->fetch_array($bbcodes))
                        {
                                $BBCODES['custom']['recurse']["$thisbbcode[bbcodetag]"]["$thisbbcode[twoparams]"] = array('replace_html' => $thisbbcode['bbcodereplacement']);
                        }
                }
        }

        if ($iswysiwyg) // text to show in wysiwyg editor
        {
                $bbcode_search = &$BBCODES['standard']['recurse'];
        }
        else // text to show everywhere else
        {
                $bbcode_search = &array_merge($BBCODES['standard']['recurse'], $BBCODES['custom']['recurse']);
        }

        $startpos = 0;

        // process all the bbcode positions

        do
        {
                $tag = array('begin_open_pos' => strpos($bbcode, '[', $startpos));
                if ($tag['begin_open_pos'] === false)
                {
                        break;
                }
                if ($bbcode[ $tag['begin_open_pos'] + 1 ] == '/')
                { // this is a close tag -- ignore it
                        $startpos = $tag['begin_open_pos'] + 1;
                        continue;
                }

                $strlen = strlen($bbcode);

                $inquote = false;
                $hasoption = 0;
                $jumpto = 0;
                for ($i = $tag['begin_open_pos']; $i <= $strlen; $i++)
                {
                        $char = $bbcode{$i};

                        switch ($char)
                        {
                                case '[':
                                        if (!$inquote AND $i != $tag['begin_open_pos'])
                                        {
                                                $jumpto = $i;
                                        }
                                        break;
                                #case ' ':
                                #        $jumpto = $i;
                                #        break;
                                case ']':
                                        if (!$inquote)
                                        {
                                                $tag['begin_end_pos'] = $i + 1; // "+ 1" includes the ]
                                        }
                                        else
                                        {
                                                $jumpto = $i;
                                        }
                                        break;
                                case '=':
                                        if (!$inquote AND !$hasoption)
                                        {
                                                // only do this stuff on the *first* =
                                                $hasoption = 1;
                                                $tag['name_end_pos'] = $i;
                                                $tag['option_open_pos'] = $i + 1;
                                        }
                                        break;
                                case '\'': // break missing intentionally
                                case '"':
                                        if (!$hasoption)
                                        {
                                                $jumpto = $i;
                                        }
                                        else if (!$inquote)
                                        {
                                                $inquote = $char;
                                                $tag['option_open_pos'] = $i + 1;
                                        }
                                        else if ($char == $inquote)
                                        {
                                                $inquote = false;
                                                $tag['option_end_pos'] = $i;
                                        }
                                        break;
                        }

                        if ($jumpto OR $tag['begin_end_pos'])
                        {
                                break;
                        }
                }

                if (empty($startpos) AND $i == $strlen + 1) // added by JP. Was getting infinite loops on parsing

       
Quote:

       
       
               
       
       

                       

                       
                                l: [ : : integ
                       
                       

               

                {
                        break;
                }

                if ($jumpto)
                {
                        $startpos = $jumpto;
                        continue;
                }

                if (!$tag['name_end_pos'])
                {
                        $tag['name_end_pos'] = $tag['begin_end_pos'] - 1;
                }
                if ($hasoption AND !$tag['option_end_pos'])
                {
                        $tag['option_end_pos'] = $tag['begin_end_pos'] - 1;
                }

                $bbcode_lower = strtolower($bbcode);

                $tag['name'] = substr($bbcode_lower, $tag['begin_open_pos'] + 1, $tag['name_end_pos'] - ($tag['begin_open_pos'] + 1));
                if (!isset($bbcode_search["$tag[name]"]["$hasoption"]))
                {
                        // the tag is one that isn't going to be translated anyway, so don't waste time on it
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }

                if ($hasoption)
                {
                        $tag['option'] = substr($bbcode, $tag['option_open_pos'], $tag['option_end_pos'] - $tag['option_open_pos']);
                }
                else
                {
                        $tag['option'] = '';
                }

                $tag['close_open_pos'] = strpos($bbcode_lower, "[/$tag[name]]", $tag['begin_end_pos']);
                if ($tag['close_open_pos'] === false)
                {
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }

                $recursivetags = substr_count(substr($bbcode_lower, $tag['begin_end_pos'], $tag['close_open_pos'] - $tag['begin_end_pos']), "[/$tag[name]]");
                $bumped = 0;
                for ($i = 0; $i < $recursivetags; $i++)
                {
                        $tag['close_open_pos'] = strpos($bbcode_lower, "[/$tag[name]]", $tag['close_open_pos'] + 1);
                        if ($tag['close_open_pos'] === false)
                        { // no closing tag found, so stop parsing
                                $bumped = -1;
                                break;
                        }
                        $bumped++;
                }
                if ($bumped != $recursivetags)
                {
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }
                $tag['close_end_pos'] = strpos($bbcode_lower, ']', $tag['close_open_pos'] + 1) + 1;

                $data = substr($bbcode, $tag['begin_end_pos'], $tag['close_open_pos'] - $tag['begin_end_pos']);

                // standard replace
                if (isset($bbcode_search["$tag[name]"]["$hasoption"]['replace']))
                {
                        $htmltag = $bbcode_search["$tag[name]"]["$hasoption"]['replace'];
                        $parseddata = "<$htmltag>$data</$htmltag>";
                }
                // html replace
                else if (isset($bbcode_search["$tag[name]"]["$hasoption"]['replace_html']))
                {
                        $parseddata = str_replace(array('\5', '\7', '\4'), array($tag['option'], $data, $data), $bbcode_search["$tag[name]"]["$hasoption"]['replace_html']);
                }
                // special handler replace
                else if (isset($bbcode_search["$tag[name]"]["$hasoption"]['handler']))
                {
                        $function = $bbcode_search["$tag[name]"]["$hasoption"]['handler'];
                        $parseddata = $function($data, $tag['option']);
                }
                // nothing to do
                else
                {
                        continue;
                }
                $bbcode = substr_replace($bbcode, $parseddata, $tag['begin_open_pos'], $tag['close_end_pos'] - $tag['begin_open_pos']);

                $startpos = $tag['begin_end_pos'];
        }
        while (1);

        return $bbcode;
}

// ###################### Start hasimages #######################
function contains_bbcode_img_tags($bbcode)
{
        return iif(strpos(strtolower($bbcode), '[img') !== false, 1, 0);
}

// ###################### Start bbcodeparseimgcode #######################
// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img($bbcode, $dobbimagecode)
function handle_bbcode_img($bbcode, $dobbimagecode, $iswysiwyg)
//
{
        global $vboptions, $bbuserinfo;

        if($dobbimagecode AND ($bbuserinfo['userid'] == 0 OR $bbuserinfo['showimages']))
        {
                // do [img]xxx[/img]
                // Image size hack R1.2
                // Modified by SS
                // $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);
                $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1',$iswysiwyg)", $bbcode);
                //

        }
        $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_url('\\1', '', 'url')", $bbcode);

        return $bbcode;
}

// ###################### Start handle_bbcode_img_match #######################
// this is only called by handle_bbcode_img
// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img_match($link)
function handle_bbcode_img_match($link, $iswysiwyg)
//
{
        $link = strip_smilies(str_replace('\\"', '"', $link));

        // remove double spaces -- fixes issues with wordwrap
        $link = str_replace('  ', '', $link);

        // Image Size hack r1.2
        // Modified by SS to resize large pics and place link to full size pic
        // return '<img src="' .  $link . '" border="0" alt="" />';

        if ( !$iswysiwyg ) {
                $max_imgsize=560;
               
                $image= ($link);

                // Get host url name for fsockopen to see if server is reachable
                $img_host=str_replace('http://','',$link);
                $img_host=substr($img_host,0,strpos($img_host,'/'));

                // Check is server is reachable and timeout in 5 seconds if not
                if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
                        // Check if image is on server
                        if (@fclose(@fopen("$image", "r"))) {
                                // Check image size and if oversize, change link
                                $img_width = getimagesize($link);
                                if ($img_width[0] > $max_imgsize) {
                                        $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="'
                                                . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>';
                                        return $biglink;
                                        }
                                else {
                                        return '<img src="' .  $link . '" border="0" alt="" />';
                                        }
                                }
                        else {
                                // Image not found
                                return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
                                }
                        }
                else {
                        // Server is down
                        return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
                        }
                }
        else {
                return '<img src="' .  $link . '" border="0" alt="" />';
                }
               
       
        // End Image Size hack r1.2
}

// ###################### Start bbcodehandler_quote #######################
function handle_bbcode_quote($message, $username = '')
{
        global $vboptions, $vbphrase, $stylevar, $show;

        // remove empty codes
        if (trim($message) == '')
        {
                return '';
        }

        // remove unnecessary escaped quotes
        $message = str_replace('\\"', '"', $message);
        $username = str_replace('\\"', '"', $username);

        // remove smilies from username
        $username = strip_smilies($username);
        $show['username'] = iif($username != '', true, false);

        global $stopsaveparsed, $parsed_postcache;
        if ($stopsaveparsed OR $parsed_postcache['skip'] == true OR !$vboptions['cachemaxage'])
        {
                $show['iewidthfix'] = (is_browser('ie') AND !(is_browser('ie', 6)));
        }
        else
        {
                // this post may be cached, so we can't allow this "fix" to be included in that cache
                $show['iewidthfix'] = false;
        }

        eval('$html = "' . fetch_template('bbcode_quote') . '";');
        return $html;
}

// ###################### Start bbcodehandler_php #######################
function handle_bbcode_php($code)
{
        global $vboptions, $vbphrase, $stylevar, $highlight_errors;
        static $codefind1, $codereplace1, $codefind2, $codereplace2;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        //remove smilies
        $code = strip_smilies(str_replace('\\"', '"', $code));

        if (!is_array($codefind))
        {
                $codefind1 = array(
                        '<br>',                // <br> to nothing
                        '<br />'        // <br /> to nothing
                );
                $codereplace1 = array(
                        '',
                        ''
                );

                $codefind2 = array(
                        '&gt;',                // &gt; to >
                        '&lt;',                // &lt; to <
                        '&quot;',        // &quot; to ",
                        '&amp;',        // &amp; to &
                );
                $codereplace2 = array(
                        '>',
                        '<',
                        '"',
                        '&',
                );
        }

        // remove htmlspecialchars'd bits and excess spacing
        $code = trim(str_replace($codefind1, $codereplace1, $code));
        $blockheight = fetch_block_height($code); // fetch height of block element
        $code = str_replace($codefind2, $codereplace2, $code); // finish replacements

        // do we have an opening <? tag?
        if (!preg_match('#^\s*<\?#si', $code))
        {
                // if not, replace leading newlines and stuff in a <?php tag and a closing tag at the end
                $code = "<?php BEGIN__VBULLETIN__CODE__SNIPPET $code \r\nEND__VBULLETIN__CODE__SNIPPET ?>";
                $addedtags = true;
        }
        else
        {
                $addedtags = false;
        }


        // highlight the string
        $oldlevel = error_reporting(0);
        if (PHP_VERSION  >= '4.2.0')
        {
                $buffer = highlight_string($code, true);
        }
        else
        {
                @ob_start();
                highlight_string($code);
                $buffer = @ob_get_contents();
                @ob_end_clean();
        }
        error_reporting($oldlevel);

        // if we added tags above, now get rid of them from the resulting string
        if ($addedtags)
        {
                $search = array(
                        '#(<|&lt;)\?php( |&nbsp;)BEGIN__VBULLETIN__CODE__SNIPPET#siU',
                        '#(<(span|font).*>)(<|&lt;)\?(</\\2>(<\\2.*>))php( |&nbsp;)BEGIN__VBULLETIN__CODE__SNIPPET#siU',
                        '#END__VBULLETIN__CODE__SNIPPET( |&nbsp;)\?(>|&gt;)#siU'
                );
                $replace = array(
                        '',
                        '\\5',
                        ''
                );
                $buffer = preg_replace($search, $replace, $buffer);
        }

        $buffer = str_replace('[', '[', $buffer);
        $buffer = preg_replace('/&amp;#([0-9]+);/', '&#$1;', $buffer); // allow unicode entities back through
        $code = &$buffer;

        eval('$html = "' . fetch_template('bbcode_php') . '";');
        return $html;
}

// ###################### Start bbcodehandler_code #######################
function handle_bbcode_code($code)
{
        global $vboptions, $vbphrase, $stylevar;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        // remove unnecessary line breaks and escaped quotes
        $code = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $code);

        // remove smilies
        $code = strip_smilies($code);

        // fetch height of block element
        $blockheight = fetch_block_height($code);

        eval('$html = "' . fetch_template('bbcode_code') . '";');
        return $html;
}

// ###################### Start bbcodehandler_html #######################
function handle_bbcode_html($code)
{
        global $vboptions, $vbphrase, $stylevar, $html_allowed;
        static $regexfind, $regexreplace;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        //remove smilies
        $code = strip_smilies(str_replace('\\"', '"', $code));

        if (!is_array($regexfind))
        {
                $regexfind = array(
                        '#<br( /)?>#siU',                                // strip <br /> codes
                        '#(&amp;\w+;)#siU',                                // do html entities
                        '#&lt;!--(.*)--&gt;#siU',                // italicise comments
                        '#&lt;(.+)&gt;#esiU'                        // push code through the tag handler
                );
                $regexreplace = array(
                        '',                                                                // strip <br /> codes
                        '<b><i>\1</i></b>',                                // do html entities
                        '<i>&lt;!--\1--&gt;</i>',                // italicise comments
                        "handle_bbcode_html_tag('\\1')"        // push code through the tag handler
                );
        }

        if ($html_allowed)
        {
                $regexfind[] = '#\<(.+)\>#esiU';
                $regexreplace[] = "handle_bbcode_html_tag(htmlspecialchars_uni(stripslashes('\\1')))";
        }
        // parse the code
        $code = preg_replace($regexfind, $regexreplace, $code);

        // how lame but HTML might not be on in signatures
        if ($html_allowed)
        {
                $regexfind = array_pop($regexfind);
                $regexreplace = array_pop($regexreplace);
        }

        $code = str_replace('[', '[', $code);

        // fetch height of block element
        $blockheight = fetch_block_height($code);

        eval('$html = "' . fetch_template('bbcode_html') . '";');
        return $html;
}

//#####################multi-Wasserstandshack######################
function wsmhack ($text) {
$wsm_string = "#\[wsm\] ([a-zA-Z0-9 \.\-\_]{1,30}) \| (\d+\.\d+|\d+\.\d+\.\d+) \| (\d+:\d+) \| ([\d\.,]+) (von|of) ([\d\.,]+) MB \| (\d+) Quellen \| (\d+) volle Quellen \[\/wsm\]#si";
if(preg_match_all($wsm_string, $text, $wsm_match)) {
        $wsm_lock = false;
        for($i=0; $i<count($wsm_match[0]); $i++) {
                if($wsm_match[4][$i]>$wsm_match[6][$i]) {
                        $wsm_match[1][$i]="FEHLER!";
                        $wsm_match[4][$i]=$wsm_match[6][$i];
                }
                $wsm_dl_size = ceil(str_replace(',', '.', $wsm_match[4][$i]));
                $wsm_co_size = ceil(str_replace(',', '.', $wsm_match[6][$i]));
                if($wsm_co_size==0) {
                        $wsm_match[1][$i]="FEHLER!";
                        $wsm_co_size= 1;
                }
                $wsm_percentage_total = $wsm_co_size/100;
                $wsm_percentage = $wsm_dl_size/$wsm_percentage_total;
                $wsm_image_dl_length = 2*ceil($wsm_percentage);
                $wsm_image_mi_length = 200-$wsm_image_dl_length;
                if($wsm_image_dl_length==0) {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_mi.gif\" width=200 height=12><img src=\"images/ws_re.gif\">";
                }
                elseif($wsm_image_dl_length==200) {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_dl.gif\" width=".$wsm_image_dl_length." height=12><img src=\"images/ws_re.gif\">";
                }
                else {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_dl.gif\" width=".($wsm_image_dl_length-1)." height=12><img src=\"images/ws_sp.gif\"><img src=\"images/ws_mi.gif\" width=".$wsm_image_mi_length." height=12><img src=\"images/ws_re.gif\">";
                }
                if($i%2==0){
                        $wsm_replace ="<tr class=\"alt2\"><td style='font-size:8pt;' valign='top'>".$wsm_match[1][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[2][$i]." | ".$wsm_match[3][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_image."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[4][$i]." / ".$wsm_match[6][$i]." MB</td><td style='font-size:8pt;' align='right' valign='top'>(".round($wsm_percentage)." %)</td><td style='font-size:8pt;' valign='top'>".$wsm_match[7][$i]." / ".$wsm_match[8][$i]."</td></tr>";
                }
                else{
                        $wsm_replace ="<tr class=\"alt1\"><td style='font-size:8pt;' valing='top'>".$wsm_match[1][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[2][$i]." | ".$wsm_match[3][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_image."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[4][$i]." /  ".$wsm_match[6][$i]." MB</td><td style='font-size:8pt;' align='right' valign='top'>(".round($wsm_percentage)." %)</td><td style='font-size:8pt;' valign='top'>".$wsm_match[7][$i]." / ".$wsm_match[8][$i]."</td></tr>";
                }
                $text = str_replace($wsm_match[0][$i],$wsm_replace,$text);
        }
        $text = "<table cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#FFFFF0\"  align=\"center\"><tr><td class=\"tcat\" colspan=\"6\" align=\"center\"><b>Wasserstand</b></td></tr>".$text."</table>";
        return $text;
}
        else {
                return $text;
        }
}
//Ende multi-Wasserstandshack
// ###################### Start bbcodehandler_html_tag #######################
function handle_bbcode_html_tag($tag)
{
        global $bbcode_html_colors;

        if (empty($bbcode_html_colors))
        {
                fetch_bbcode_html_colors();
        }

        // change any embedded URLs so they don't cause any problems
        $tag = preg_replace('#\[(email|url)=&quot;(.*)&quot;\]#siU', '[$1="$2"]', $tag);

        // find if the tag has attributes
        $spacepos = strpos($tag, ' ');
        if ($spacepos != false)
        {
                // tag has attributes - get the tag name and parse the attributes
                $tagname = substr($tag, 0, $spacepos);
                $tag = preg_replace('# (\w+)=&quot;(.*)&quot;#siU', ' \1=<font color="' . $bbcode_html_colors['attribs'] . '">&quot;\2&quot;</font>', $tag);
        }
        else
        {
                // no attributes found
                $tagname = $tag;
        }
        // remove leading slash if there is one
        if ($tag{0} == '/')
        {
                $tagname = substr($tagname, 1);
        }
        // convert tag name to lower case
        $tagname = strtolower($tagname);

        // get highlight colour based on tag type
        switch($tagname)
        {
                // table tags
                case 'table':
                case 'tr':
                case 'td':
                case 'th':
                case 'tbody':
                case 'thead':
                        $tagcolor = $bbcode_html_colors['table'];
                        break;
                // form tags
                case 'form';
                case 'input':
                case 'select':
                case 'option':
                case 'textarea':
                case 'label':
                case 'fieldset':
                case 'legend':
                        $tagcolor = $bbcode_html_colors['form'];
                        break;
                // script tags
                case 'script':
                        $tagcolor = $bbcode_html_colors['script'];
                        break;
                // style tags
                case 'style':
                        $tagcolor = $bbcode_html_colors['style'];
                        break;
                // anchor tags
                case 'a':
                        $tagcolor = $bbcode_html_colors['a'];
                        break;
                // img tags
                case 'img':
                        $tagcolor = $bbcode_html_colors['img'];
                        break;
                // if (vB Conditional) tags
                case 'if':
                case 'else':
                case 'elseif':
                        $tagcolor = $bbcode_html_colors['if'];
                        break;
                // all other tags
                default:
                        $tagcolor = $bbcode_html_colors['default'];
                        break;
        }

        $tag = '<font color="' . $tagcolor . '">&lt;' . str_replace('\\"', '"', $tag) . '&gt;</font>';
        return $tag;
}

// ###################### Start bbcodehandler_list2 #######################
// replacement for bbcodehandler_list... experimental at this time
function handle_bbcode_list($string)
{
        #echo '<p><b>$string</b><br />' . nl2br(htmlspecialchars($string)) . '</p>';
        global $BBCODES, $wysiwygparse;
        // might need this in the future
        //$string = stripslashes($string);
        $string = str_replace('\"', '"', $string);
        $str = $string;

        // getList
        $slashlist = strpos($str, ']', stripos($str, '[/list')) + 1;
        $tmp = substr($str, 0, $slashlist);
        $openlist = strlen($tmp) - stripos(strrev($tmp), strrev('[list')) - strlen('[list');
        $getList = substr($str, $openlist, ($slashlist - $openlist));

        #echo '<p><b>$getList</b><br />' . htmlspecialchars($getList) . '</p>';

        // processList
        if (preg_match('#\s*(\[list(=(&quot;|"|\'|)([^\]]*)\\3)?\](.*)\[/list(=\\3\\4\\3)?\])\s*#si', $getList, $regs))
        {
                $getList = $regs[0];
                #echo '<p><b>Regex Match</b><br />' . htmlspecialchars($regs[0]) . '</p>';
                $str = preg_split('#\s*\[\*\]#s', $regs[5], -1, PREG_SPLIT_NO_EMPTY);

                if (empty($str))
                {
                        return preg_replace('#\s*' . preg_quote($getList, '#') . '\s*#s', nl2br("\n\n"), $string);
                }

                if ($regs[4])
                {
                        switch ($regs[4])
                        {
                                case 'A':
                                        $listtype = 'upper-alpha';
                                        break;
                                case 'a':
                                        $listtype = 'lower-alpha';
                                        break;
                                case 'I':
                                        $listtype = 'upper-roman';
                                        break;
                                case 'i':
                                        $listtype = 'lower-roman';
                                        break;
                                case '1': //break missing intentionally
                                default:
                                        $listtype = 'decimal';
                                        break;
                        }
                }
                else
                {
                        $listtype = '';
                }

                $processList = iif($listtype, '<ol style="list-style-type: ' . $listtype . '">', '<ul>');

                $bad_tag_list = '(br|p|li|ul|ol)';

                foreach ($str AS $key => $val)
                {
                        $firstbit = strtolower(substr($val, 0, 3));
                        if ($firstbit === '<ul' OR $firstbit === '<ol' OR $firstbit === '<li' OR $firstbit == '')
                        {
                                $processList .= $val;
                        }
                        else
                        {
                                if ($wysiwygparse)
                                {
                                        $exploded = preg_split("#(\r\n|\n|\r)#", $val);

                                        $val = '';
                                        foreach ($exploded AS $value)
                                        {
                                                if (!preg_match('#(</' . $bad_tag_list . '>|<' . $bad_tag_list . '\s*/>)$#iU', $value))
                                                {
                                                        if (trim($value) == '')
                                                        {
                                                                $value = '&nbsp;';
                                                        }
                                                        //$val .= '<p style="margin:0px">' . $value . "</p>";
                                                        $val .= $value . "<br />\n";
                                                }
                                                else
                                                {
                                                        $val .= "$value\n";
                                                }
                                        }
                                        $val = preg_replace('#<br />+\s*$#i', '', $val);

                                }
                                $processList .= '<li>' . $val . '</li>';
                        }
                }

                $processList .= iif($listtype, '</ol>', '</ul&gt;');

                #echo '<p><b>$processList</b><br />' . htmlspecialchars($processList) . '</p>';

                // replace found list characters with parsed list characters
                if ($wysiwygparse)
                {
                        $processList = str_replace('<p style="margin:0px"></p>', '', $processList);
                }

                //$out = preg_replace('#\s*' . preg_quote($getList, '#') . '\s*#s', str_replace(array('\\', '$'), array('\\\\', '\$'), $processList), $string);
                $out = str_replace($getList, $processList, $string);
                #echo '<p><b>Return Value</b><br />' . nl2br(htmlspecialchars($out)) . '</p><hr />';
                return $out;
        }
        else
        {
                return $string;
        }

}

// ###################### Start handle_bbcode_url #######################
function handle_bbcode_url($text, $link, $type = 'url')
{
        global $wysiwygparse;

        if (trim($text) == '')
        {
                return '';
        }

        $rightlink = trim($link);
        if (empty($rightlink))
        {
                // no option -- use param
                $rightlink = trim($text);
        }
        $rightlink = strip_smilies(str_replace('\\"', '"', $rightlink));
        $rightlink = str_replace(array('`', '"', "'", '['), array('`', '&quot;', ''', '['), $rightlink);

        if ($type == 'url' AND !preg_match('#^[a-z0-9]+://#si', $rightlink))
        {
                $rightlink = "http://$rightlink";
        }

        if ($type == 'ed2k' AND !preg_match('#^[a-z0-9]+://#si', $rightlink))
        {
                $rightlink = "ed2k://$rightlink";
        }

        if (!trim($link) OR $text == $rightlink)
        {
                $tmp = unhtmlspecialchars($rightlink);
                if (strlen($tmp) > 55 AND !$wysiwygparse)
                {
                        $text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));
                }
        }

        // remove double spaces -- fixes issues with wordwrap
        $rightlink = str_replace('  ', '', $rightlink);

        // strip extra quotes from hyperlink
        $text = str_replace('\"', '"', $text);

        if ($type == 'url' OR $type == 'ed2k')
        {
                // standard URL hyperlink
                if ($type == 'ed2k')
                        {
                        $teile = explode("|", $rightlink);
                        return "<a href=\"$rightlink\" target=\"_self\">$text</a> - <a href=\"http://stats.razorback2.com/ed2khistory?ed2k=$teile[4]\" target=\"_blank\">Verteilung</a>";
                        }
                else
                        {
                        return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
                        }
        }
        else
        {
                // email hyperlink (mailto:)
                if (is_valid_email($rightlink))
                {
                        return "<a href=\"mailto:$rightlink\">$text</a>";
                }
                else
                {
                        // not a valid email - don't link it
                        return "<span title=\"$rightlink\">$text</span>";
                }
        }
}

but the hack does .... nothing!

Does anybody find the mistake? :(

http://www.mr-goodbyte.de/greetz.png

Doc Great 09-19-2005 05:56 AM

Maybe you like to check this version http://www.vbulletin-germany.com/for...1578#post81578 (it definitely works) ;)

Greetz,
Sven

Steve St.Lauren 09-19-2005 06:44 PM

Quote:

Originally Posted by MrGoodbyte
I get mad on it .. I'm quite sure I've made all changes (in VB 3.08) I have to do:
functions_showthread (strongly shortend):
Code:

                // showthread / showpost style Postbit
                default:
                        if (!empty($post['pagetext_html']))
                        {
                                $parsed_postcache['skip'] = true;
                                if ($post['hasimages'])
                                {
                                                                                // Image Size hack r1.2
                                        // Modified by SS
                                        // $post['message'] = handle_bbcode_img($post['pagetext_html'], $forum['allowimages']);
                                        $post['message'] = handle_bbcode_img($post['pagetext_html'], $forum['allowimages'], 0);
                                        //

                                }
                                else
                                {
                                        $post['message'] = &$post['pagetext_html'];
                                }
                        }
                        else
                        {
                                $parsed_postcache['skip'] = false;
                                $post['message'] = parse_bbcode($post['pagetext'], $forum['forumid'], $post['allowsmilie']);
                        }

functions_bbcodeparse (strongly shortend):
Code:

// ###################### Start bbcodeparse #######################
function parse_bbcode($bbcode, $forumid = 0, $allowsmilie = 1, $isimgcheck = 0, $parsedtext = '', $parsedhasimages = 0, $iswysiwyg = 0)
{
        // $parsedtext contains text that has already been turned into HTML and just needs images checking
        // $parsedhasimages specifies if the text has images in that need parsing

        global $vboptions, $parsed_postcache;

        $donl2br = 1;

        if (empty($forumid))
        {
                $forumid = 'nonforum';
        }

        switch($forumid)
        {
                // parse private message
                case 'privatemessage':
                        $dohtml = $vboptions['privallowhtml'];
                        $dobbcode = $vboptions['privallowbbcode'];
                        $dobbimagecode = $vboptions['privallowbbimagecode'];
                        $dosmilies = $vboptions['privallowsmilies'];
                        break;

                // parse user note
                case 'usernote':
                        $dohtml = $vboptions['unallowhtml'];
                        $dobbcode = $vboptions['unallowvbcode'];
                        $dobbimagecode = $vboptions['unallowimg'];
                        $dosmilies = $vboptions['unallowsmilies'];
                        break;

                // parse non-forum item
                case 'nonforum':
                        $dohtml = $vboptions['allowhtml'];
                        $dobbcode = $vboptions['allowbbcode'];
                        $dobbimagecode = $vboptions['allowbbimagecode'];
                        $dosmilies = $vboptions['allowsmilies'];
                        if ($allowsmilie != 1)
                        {
                                $dosmilies = $allowsmilie;
                        }
                        break;

                case 'announcement':
                        global $post;
                        $dohtml = $post['allowhtml'];
                        if ($dohtml)
                        {
                                $donl2br = 0;
                        }
                        $dobbcode = $post['allowbbcode'];
                        $dobbimagecode = $post['allowbbcode'];
                        $dosmilies = $allowsmilie;
                        break;

                // parse forum item
                default:
                        $forum = fetch_foruminfo($forumid);
                        $dohtml = $forum['allowhtml'];
                        $dobbimagecode = $forum['allowimages'];
                        $dosmilies = $forum['allowsmilies'];
                        if ($allowsmilie != 1)
                        {
                                $dosmilies = $allowsmilie;
                        }
                        $dobbcode = $forum['allowbbcode'];
                        break;
        }

        if (!empty($parsedtext))
        {
                if ($parsedhasimages)
                {
                       
                        // Image size hack R1.2
                        // Modified by SS
                        // return handle_bbcode_img($parsedtext, $dobbimagecode);
                        return handle_bbcode_img($parsedtext, $dobbimagecode, $iswysiwyg);
                        //

                }
                else
                {
                        return $parsedtext;
                }
        }
        else
        {
                if ($isimgcheck)
                { // do this since we're only checking for smilies and IMG code
                        $dobbcode = 0;
                }
                return parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg, $donl2br);
        }
}

// ###################### Start checkparam #######################
// called by the preg_replace for custom bbcodes - ensures that
// users can't get around censor text by adding empty bbcodes
// such as 'censoredword' into their messages
function handle_bbcode_parameter($param, $return)
{
        if (trim($param) != '')
        {
                return str_replace('\\"', '"', $return);
        }
}

// ###################### Start handle_custom_bbcode #######################
function handle_custom_bbcode($param, $option, $return)
{
        if (trim($param) == '')
        {
                return '';
        }

        $param = str_replace('\\"', '"', $param);
        $return = str_replace('\\"', '"', $return);
        $option = str_replace(array('\\"', '['), array('"', '['), $option);

        $return = preg_replace('#%(?!\d+\$s)#', '%%', $return);
        return sprintf($return, $param, $option);
}

// ###################### Start bbcodeparse2 #######################
function parse_bbcode2($bbcode, $dohtml, $dobbimagecode, $dosmilies, $dobbcode, $iswysiwyg = 0, $donl2br = 1)
{
// parses text for vB code, smilies and censoring

        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $smiliecache;
        global $html_allowed;
        global $threadid;

        if ($vboptions['wordwrap'] != 0 AND !$iswysiwyg)
        {
                $bbcode = fetch_word_wrapped_string($bbcode);
        }

        $html_allowed = true;
        // ********************* REMOVE HTML CODES ***************************
        if (!$dohtml)
        {
                /*static $html_find = array('&lt;', '&gt;', '<', '>');
                static $html_replace = array('&amp;lt;', '&amp;gt;', '&lt;','&gt;');

                $bbcode = str_replace($html_find, $html_replace, $bbcode);*/
                $bbcode = htmlspecialchars_uni($bbcode);
                $html_allowed = false;
        } // end html
        // Image Size hack r1.2
        // Added by SS to resize large pics and place link to full size pic

        // set max_imgsize to the max size you want pictures to be
        $max_imgsize=560;
       
        // check for img tag and see if html is enabled and if not using wysiwyg editor
        if (strstr(strtolower($bbcode),'<img') AND $dohtml AND !$iswysiwyg) {
                $tagstartcounter=0;
                do {
                        $bbcodelength=strlen($bbcode);
                        // pull tag from bbcode
                        $tagopen=(strpos(strtolower($bbcode),'<img',$tagstartcounter));
                        $tagclose=(strpos($bbcode,'>',$tagopen));
                        $bbtag=substr($bbcode,$tagopen,($tagclose-$tagopen+1));
                        $bbtag = str_replace('\'','"',$bbtag);

                        // get link from bbtag
                        $linkopen=(strpos(strtolower($bbtag),'<img'));
                        $linkopen2=(strpos(strtolower($bbtag),'"',$linkopen));
                        $linkclose=(strpos($bbtag,'"',$linkopen2+1));
                        $link=substr($bbtag,$linkopen2+1,($linkclose-$linkopen2-1));

                        // remove double spaces -- fixes issues with wordwrap
                        $link = str_replace('  ', '', $link);

                        // Check to see if image exists
                        $image= ($link);
                       
                        // Get host url name for fsockopen to see if server is reachable
                        $img_host=str_replace('http://','',$link);
                        $img_host=substr($img_host,0,strpos($img_host,'/'));

                        // set image found by default
                        $image_found=true;
                       
                        // Check is server is reachable and timeout in 5 seconds if not
                        if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
                                // Check if image is on server
                                if (@fclose(@fopen("$image", "r"))) {
                                        // Check image size and if oversize, change bbtag
                                        $img_width = getimagesize($link);
                                        if ($img_width[0] > $max_imgsize) {
                                                $bbtag = '<table><tr><td align="center"><a href="' . $link . '"><img src="'
                                                        . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbtag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>';
                                                }
                                        }
                                else {
                                        // Image not found
                                        $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
                                        $image_found=false;
                                        }
                                }
                        else {
                                // Server is down
                                $bbtag='<table border="1" cellpadding="2" id="image_found"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
                                $image_found=false;
                                }

                               
                        // replace bbtag into bbcode
                        $bbcode=substr($bbcode,0,$tagopen).$bbtag.substr($bbcode,$tagclose+1,$bbcodelength-$tagclose);

                        // check if image was found to see what where to start the next search
                        if ($image_found) {
                                // move pointer back to img tag in case it moved
                                $tagopen=$tagopen+(strpos(strtolower($bbtag),'<img'));
                                }
                        else {
                                // move pointer back to img tag in case it moved
                                $tagopen=$tagopen+(strpos(strtolower($bbtag),'id="image_found"'));
                                }
                               

                        // start search from end of previous tag
                        $tagstartcounter=(strpos($bbcode,'>',$tagopen));
                        } while (strpos(strtolower($bbcode),'<img',$tagstartcounter));
                }

        // End Image Size hack r1.2
        // ********************* PARSE SMILIES ***************************
        if ($dosmilies)
        {
                static $smilie_find, $smilie_replace;

                if (empty($smilie_find) OR empty($smilie_replace))
                {
                        if (isset($smiliecache))
                        {
                                // we can get the smilies from the smiliecache php template
                                DEVDEBUG('returning smilies from the template cache');
                                if (is_array($smiliecache))
                                {
                                        foreach ($smiliecache AS $smilie)
                                        {
                                                if (trim($smilie['smilietext']) != '')
                                                {
                                                        if (!$dohtml)
                                                        {
                                                                $smilie_find[] = htmlspecialchars_uni(trim($smilie['smilietext']));
                                                        }
                                                        else
                                                        {
                                                                $smilie_find[] = trim($smilie['smilietext']);
                                                        }
                                                        // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
                                                        if ($iswysiwyg)
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />";
                                                        }
                                                        else
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />";
                                                        }
                                                }
                                        }
                                }
                        }
                        else
                        {
                                // we have to get the smilies from the database
                                DEVDEBUG('querying smilies for parse_bbcode2();');
                                $smilies = $DB_site->query("
                                        SELECT smilietext, smiliepath, smilieid FROM " . TABLE_PREFIX . "smilie
                                ");
                                while ($smilie = $DB_site->fetch_array($smilies))
                                {
                                        if(trim($smilie['smilietext']) != '')
                                        {
                                                if (!$dohtml)
                                                {
                                                        $smilie_find[] = htmlspecialchars_uni(trim($smilie['smilietext']));
                                                }
                                                else
                                                {
                                                        $smilie_find[] = trim($smilie['smilietext']);
                                                }
                                                // if you change this HTML tag, make sure you change the smilie remover in code/php/html tag handlers!
                                                if ($iswysiwyg)
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" smilieid=\"$smilie[smilieid]\" class=\"inlineimg\" />";
                                                        }
                                                        else
                                                        {
                                                                $smilie_replace[] = "<img src=\"$smilie[smiliepath]\" border=\"0\" alt=\"\" title=\"$smilie[title]\" class=\"inlineimg\" />";
                                                        }
                                        }
                                }
                        }
                }

                // str_replace the text using the smilie_find and smilie_replace arrays
                #$bbcode = str_replace($smilie_find, $smilie_replace, $bbcode);

                // alternative method to avoid parsing HTML entities as smilies:
                foreach($smilie_find AS $smiliekey => $smiliefind)
                {
                        $bbcode = preg_replace('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})' . preg_quote($smiliefind, '/') . '/s', $smilie_replace["$smiliekey"], $bbcode);
                }
        } // end smilies
$bbcode=wsmhack($bbcode);

        // do new lines
        $wysiwygtype = null;
        if ($iswysiwyg == 1)
        {
                $whitespacefind = array(
                        '#(\r\n|\n|\r)?( )*(\[\*\]|\[/list|\[list|\[indent)#si',
                        '#(/list\]|/indent\])( )*(\r\n|\n|\r)?#si'
                );
                $whitespacereplace = array(
                        '\3',
                        '\1'
                );
                $bbcode = preg_replace($whitespacefind, $whitespacereplace, $bbcode);

                if (is_browser('ie'))
                {
                        $wysiwygtype = 'ie';

                        // this fixes an issue caused by odd nesting of tags. This causes IE's
                        // WYSIWYG editor to display the output as vB will display it
                        $rematch_find = array(
                                '#\[b\](.*)\[/b\]#siUe',
                                '#\[i\](.*)\[/i\]#siUe',
                                '#\[u\](.*)\[/u\]#siUe',
                        );
                        $rematch_replace = array(
                                "bbcode_rematch_tags_wysiwyg('\\1', 'b')",
                                "bbcode_rematch_tags_wysiwyg('\\1', 'i')",
                                "bbcode_rematch_tags_wysiwyg('\\1', 'u')",
                        );
                        $bbcode = preg_replace($rematch_find, $rematch_replace, $bbcode);

                        $bbcode = '<p style="margin:0px">' . preg_replace('#(\r\n|\n|\r)#', "</p>\n<p style=\"margin:0px\">", trim($bbcode)) . '</p>';
                }
                else
                {
                        $bbcode = nl2br($bbcode);
                        $wysiwygtype = 'moz_css';
                }
                $bbcode = preg_replace('#(\[list(=(&quot;|"|\'|)(.*)\\3)?\])(((?>[^\[]*?|(?R))|(?>.))*)(\[/list(=\\3\\4\\3)?\])#siUe', "remove_wysiwyg_breaks('\\0', \$wysiwygtype)", $bbcode);

                //$bbcode = preg_replace('#\[list#i', '</p>[list', $bbcode);
                //$bbcode = preg_replace('#\[/list(=(&quot;|"|\'|)[a-z0-9+]\\2)?](?!\[\*\])#i', '[/list\\1]<p style="margin:0px">', $bbcode);

                $bbcode = preg_replace('#<p style="margin:0px">\s*</p>(?!\s*\[list|$)#i', '<p style="margin:0px">&nbsp;</p>', $bbcode);
                $bbcode = str_replace('<p style="margin:0px"></p>', '', $bbcode);

                // convert tabs to four &nbsp;
                $bbcode = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $bbcode);
        }
        // new lines to <br />
        else
        {
                $whitespacefind = array(
                        '#(\r\n|\n|\r)?( )*(\[\*\]|\[/list|\[list|\[indent)#si',
                        '#(/list\]|/indent\])( )*(\r\n|\n|\r)?#si'
                );
                $whitespacereplace = array(
                        '\3',
                        '\1'
                );
                $bbcode = preg_replace($whitespacefind, $whitespacereplace, $bbcode);

                if ($donl2br)
                {
                        $bbcode = nl2br($bbcode);
                }
        }

        // ********************* PARSE BBCODE TAGS ***************************
        if ($dobbcode AND strpos($bbcode, '[') !== false AND strpos($bbcode, ']') !== false)
        {
                switch($vboptions['usebbcodeparserecurse'])
                {
                        case 1:
                                $parsefunc = 'parse_bbcode_recurse';
                                break;

                        case 0:
                                $parsefunc = 'parse_bbcode_regex';
                                break;

                        default:
                                $parsefunc = 'parse_bbcode_regexrecurse';
                }
                $bbcode = $parsefunc($bbcode, $iswysiwyg);

                if ($wysiwygtype == 'ie')
                {
                        $bbcode = preg_replace('#<p style="margin:0px"><(p|div) align="([a-z]+)">(.*)</\\1></p>#siU', '<p style="margin:0px" align="\\2">\\3</p>', $bbcode);
                }
                if ($iswysiwyg)
                {
                        // need to display smilies in code/php/html tags as literals
                        $bbcode = preg_replace('#\[(code|php|html)\](.*)\[/\\1\]#siUe', "strip_smilies(str_replace('\\\"', '\"', '\\0'), true)", $bbcode);
                }
        }

        // parse out nasty active scripting codes
        static $global_find = array('/javascript:/si', '/about:/si', '/vbscript:/si', '/&(?![a-z0-9#]+;)/si');
        static $global_replace = array('javascript<b></b>:', 'about<b></b>:', 'vbscript<b></b>:', '&amp;');
        $bbcode = preg_replace($global_find, $global_replace, $bbcode);

        // run the censor
        $bbcode = fetch_censored_text($bbcode);
        $has_img_tag = contains_bbcode_img_tags($bbcode);

        // save the cached post
        global $stopsaveparsed, $parsed_postcache;
        if (!$stopsaveparsed AND $parsed_postcache['skip'] != true)
        {
                $parsed_postcache['text'] = $bbcode;
                $parsed_postcache['images'] = $has_img_tag;
        }

        // do [img] tags if the item contains images
        if(($dobbcode OR $dobbimagecode) AND $has_img_tag)
        {
                                // Image resize hack R1.2
                // Modified by SS
                // $bbcode = handle_bbcode_img($bbcode, $dobbimagecode);
                $bbcode = handle_bbcode_img($bbcode, $dobbimagecode, $iswysiwyg);
                //

        }
$myreplies = $DB_site->query_first("SELECT COUNT(postid) AS count FROM ". TABLE_PREFIX . "post WHERE userid='$bbuserinfo[userid]' and threadid='$threadid'");
      if ($myreplies[count] > 0 || $bbuserinfo['usergroupid'] == 5 || $bbuserinfo['usergroupid'] == 6 || $bbuserinfo['usergroupid'] == 7) {
        $bbcode = preg_replace('/\\[hide\\](.*)\\[\/hide\\]/si', 'Hidden Text: <br>\\1', $bbcode);
      } else {
        $bbcode = preg_replace('/\\[hide\\](.*)\\[\/hide\\]/si', '<b><center><img src="./hide.gif" alt=Du musst eine Antwort erstellen um den Inhalt zu sehen!></center></b><br>', $bbcode);
      }

        return $bbcode;
}

// ###################### Start remove_wysiwyg_breaks #######################
function bbcode_rematch_tags_wysiwyg($innertext, $tagname)
{
        // This function replaces line breaks with [/tag]\n[tag].
        // It is intended to be used on text inside [tag] to fix an IE WYSIWYG issue.

        $innertext = str_replace('\"', '"', $innertext);
        return "[$tagname]" . preg_replace('#(\r\n|\n|\r)#', "[/$tagname]\n[$tagname]", $innertext) . "[/$tagname]";
}

// ###################### Start remove_wysiwyg_breaks #######################
function remove_wysiwyg_breaks($fulltext, $wysiwygtype = 'ie')
{
        $fulltext = str_replace('\"', '"', $fulltext);
        preg_match('#^(\[list(=(&quot;|"|\'|)(.*)\\3)?\])(.*?)(\[/list(=\\3\\4\\3)?\])$#siU', $fulltext, $matches);
        $prepend = $matches[1];
        $innertext = $matches[5];

        $find = array("</p>\n<p style=\"margin:0px\">", '<br />', '<br>');
        $replace = array("\n", "\n", "\n");
        $innertext = str_replace($find, $replace, $innertext);

        if ($wysiwygtype == 'ie')
        {
                return '</p>' . $prepend . $innertext . '[/list]<p style="margin:0px">';
        }
        else
        {
                return $prepend . $innertext . '[/list]';
        }
}

// ###################### Start bbcodeparse2_regexrecurse #######################
function parse_bbcode_regexrecurse($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse, $session;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                $doubleRegex = '/(\[)(%s)(=)(&quot;|"|\'|)([^"]*)(\\4)\](.*)(\[\/%s\])/esiU';
                $singleRegex = '/(\[)(%s)(\])(.*)(\[\/%s\])/esiU';

                if (isset($datastore['bbcodecache'])) // get bbcodes from the datastore
                {
                        $bbcodecache = unserialize($datastore['bbcodecache']);

                        foreach ($bbcodecache AS $bbregex)
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace(array('\\7', '\\5'), array('%1$s', '%2$s'), $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]=";
                                        $checkparam = '\\7';
                                        $checkoption = '\\5';
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace('\\4', '%1$s', $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]]";
                                        $checkparam = '\\4';
                                        $checkoption = '';
                                }
                                $BBCODES['custom']['find']["$tagname"] = $regex;
                                $BBCODES['custom']['replace']["$tagname"] = "handle_custom_bbcode('$checkparam', '$checkoption', '" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                        }
                }
                else // query bbcodes out of the database
                {
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while ($bbregex = $DB_site->fetch_array($bbcodes))
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace(array('\\7', '\\5'), array('%1$s', '%2$s'), $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]=";
                                        $checkparam = '\\7';
                                        $checkoption = '\\5';
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $bbregex['bbcodereplacement'] = str_replace('\\4', '%1$s', $bbregex['bbcodereplacement']);
                                        $tagname = "[$bbregex[bbcodetag]]";
                                        $checkparam = '\\4';
                                        $checkoption = '';
                                }
                                $BBCODES['custom']['find']["$tagname"] = $regex;
                                $BBCODES['custom']['replace']["$tagname"] = "handle_custom_bbcode('$checkparam', '$checkoption', '" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                        }
                }
        }

        if ($iswysiwyg) // text to show in the WYSIWYG editor box
        {
                $bbcode_find = $BBCODES['standard']['find'];
                $bbcode_replace = $BBCODES['standard']['replace'];
        }
        else // text to show everywhere else
        {
                //$bbcode_find = array_merge($BBCODES['standard']['find'], $BBCODES['custom']['find']);
                //$bbcode_replace = array_merge($BBCODES['standard']['replace'], $BBCODES['custom']['replace']);

                $bbcode_find = array_merge($BBCODES['custom']['find'], $BBCODES['standard']['find']);
                $bbcode_replace = array_merge($BBCODES['custom']['replace'], $BBCODES['standard']['replace']);
        }

        foreach($bbcode_find AS $tag => $findregex)
        {
                // if using option, $tag will be '[xxx='
                // if not using option, $tag will be '[xxx]'

                while (stristr($bbcode, $tag) !== false)
                {
                        // make a copy of the text pre-replacement for later comparison
                        $origtext = $bbcode;

                        $bbcode = preg_replace($findregex, $bbcode_replace["$tag"], $bbcode);

                        // check to see if the preg_replace actually did anything... if it didn't, break the loop
                        if ($origtext == $bbcode)
                        {
                                break;
                        }
                }
        }

        return $bbcode;
}

// ###################### Start bbcodeparse2_regex #######################
function parse_bbcode_regex($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse, $session;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                $doubleRegex = '/(\[)(%s)(=)(&quot;|"|\'|)(.*)(\\4)\](.*)(\[\/%s\])/esiU';
                $singleRegex = '/(\[)(%s)(\])(.*)(\[\/%s\])/esiU';

                if (isset($datastore['bbcodecache']))
                { // we can get the bbcode from the bbcodecache php template
                        DEVDEBUG("returning bbcodes from the template cache");
                        $bbcodecache = unserialize($datastore['bbcodecache']);
                        foreach($bbcodecache AS $bbregex)
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 7;
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 4;
                                }
                                for ($i = 0; $i < 3; $i++)
                                {
                                        $BBCODES['custom']['find'][] = $regex;
                                        $BBCODES['custom']['replace'][] = "handle_bbcode_parameter('\\$checkparam','" . str_replace("'", "\'", $bbregex['bbcodereplacement']) . "')";
                                }
                        }
                }
                else
                { // we have to get the bbcodes from the database
                        DEVDEBUG("querying bbcodes for parse_bbcode2();");
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while($bbregex = $DB_site->fetch_array($bbcodes))
                        {
                                if ($bbregex['twoparams'])
                                {
                                        $regex = sprintf($doubleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 7;
                                }
                                else
                                {
                                        $regex = sprintf($singleRegex, $bbregex['bbcodetag'], $bbregex['bbcodetag']);
                                        $checkparam = 4;
                                }
                                for ($i = 0; $i < 3; $i++)
                                {
                                        $BBCODES['custom']['find'][] = $regex;
                                        $BBCODES['custom']['replace'][] = "handle_bbcode_parameter('\\$checkparam','" . str_replace("'","\'",$bbregex['bbcodereplacement']) . "')";
                                }
                        }
                }
        }

        if ($iswysiwyg) // text to show in the WYSIWYG editor box
        {
                $bbcode_find = $BBCODES['standard']['find'];
                $bbcode_replace = $BBCODES['standard']['replace'];
        }
        else // text to show everywhere else
        {
                $bbcode_find = array_merge($BBCODES['standard']['find'], $BBCODES['custom']['find']);
                $bbcode_replace = array_merge($BBCODES['standard']['replace'], $BBCODES['custom']['replace']);
        }

        // do the actual replacement
        $bbcode = preg_replace($bbcode_find, $bbcode_replace, $bbcode);

        return $bbcode;
}

// ###################### Start bbcodeparse2_recurse #######################
function parse_bbcode_recurse($bbcode, $iswysiwyg)
{
        global $DB_site, $vboptions, $bbuserinfo, $templatecache, $datastore, $wysiwygparse;
        static $BBCODES;

        $wysiwygparse = $iswysiwyg;

        // just get rid of old closing list tags
        if (stristr($bbcode, '/list=') != false)
        {
                $bbcode = preg_replace('#/list=[a-z0-9]\]#siU', '/list]', $bbcode);
        }

        if (empty($BBCODES['standard']))
        {
                $BBCODES = fetch_bbcode_definitions();

                if (isset($datastore['bbcodecache']))
                { // we can get the bbcode from the bbcodecache php template
                        DEVDEBUG("returning bbcodes from the template cache");
                        if (!isset($bbcodecache))
                        {
                                $bbcodecache = unserialize($datastore['bbcodecache']);
                        }
                        foreach($bbcodecache AS $thisbbcode)
                        {
                                $BBCODES['custom']['recurse']["$thisbbcode[bbcodetag]"]["$thisbbcode[twoparams]"] = array('replace_html' => $thisbbcode['bbcodereplacement']);
                        }
                }
                else
                { // we have to get the bbcodes from the database
                        DEVDEBUG("querying bbcodes for parse_bbcode2();");
                        $bbcodes = $DB_site->query("
                                SELECT bbcodetag, bbcodereplacement, twoparams
                                FROM " . TABLE_PREFIX . "bbcode
                        ");
                        while($thisbbcode = $DB_site->fetch_array($bbcodes))
                        {
                                $BBCODES['custom']['recurse']["$thisbbcode[bbcodetag]"]["$thisbbcode[twoparams]"] = array('replace_html' => $thisbbcode['bbcodereplacement']);
                        }
                }
        }

        if ($iswysiwyg) // text to show in wysiwyg editor
        {
                $bbcode_search = &$BBCODES['standard']['recurse'];
        }
        else // text to show everywhere else
        {
                $bbcode_search = &array_merge($BBCODES['standard']['recurse'], $BBCODES['custom']['recurse']);
        }

        $startpos = 0;

        // process all the bbcode positions

        do
        {
                $tag = array('begin_open_pos' => strpos($bbcode, '[', $startpos));
                if ($tag['begin_open_pos'] === false)
                {
                        break;
                }
                if ($bbcode[ $tag['begin_open_pos'] + 1 ] == '/')
                { // this is a close tag -- ignore it
                        $startpos = $tag['begin_open_pos'] + 1;
                        continue;
                }

                $strlen = strlen($bbcode);

                $inquote = false;
                $hasoption = 0;
                $jumpto = 0;
                for ($i = $tag['begin_open_pos']; $i <= $strlen; $i++)
                {
                        $char = $bbcode{$i};

                        switch ($char)
                        {
                                case '[':
                                        if (!$inquote AND $i != $tag['begin_open_pos'])
                                        {
                                                $jumpto = $i;
                                        }
                                        break;
                                #case ' ':
                                #        $jumpto = $i;
                                #        break;
                                case ']':
                                        if (!$inquote)
                                        {
                                                $tag['begin_end_pos'] = $i + 1; // "+ 1" includes the ]
                                        }
                                        else
                                        {
                                                $jumpto = $i;
                                        }
                                        break;
                                case '=':
                                        if (!$inquote AND !$hasoption)
                                        {
                                                // only do this stuff on the *first* =
                                                $hasoption = 1;
                                                $tag['name_end_pos'] = $i;
                                                $tag['option_open_pos'] = $i + 1;
                                        }
                                        break;
                                case '\'': // break missing intentionally
                                case '"':
                                        if (!$hasoption)
                                        {
                                                $jumpto = $i;
                                        }
                                        else if (!$inquote)
                                        {
                                                $inquote = $char;
                                                $tag['option_open_pos'] = $i + 1;
                                        }
                                        else if ($char == $inquote)
                                        {
                                                $inquote = false;
                                                $tag['option_end_pos'] = $i;
                                        }
                                        break;
                        }

                        if ($jumpto OR $tag['begin_end_pos'])
                        {
                                break;
                        }
                }

                if (empty($startpos) AND $i == $strlen + 1) // added by JP. Was getting infinite loops on parsing
                {
                        break;
                }

                if ($jumpto)
                {
                        $startpos = $jumpto;
                        continue;
                }

                if (!$tag['name_end_pos'])
                {
                        $tag['name_end_pos'] = $tag['begin_end_pos'] - 1;
                }
                if ($hasoption AND !$tag['option_end_pos'])
                {
                        $tag['option_end_pos'] = $tag['begin_end_pos'] - 1;
                }

                $bbcode_lower = strtolower($bbcode);

                $tag['name'] = substr($bbcode_lower, $tag['begin_open_pos'] + 1, $tag['name_end_pos'] - ($tag['begin_open_pos'] + 1));
                if (!isset($bbcode_search["$tag[name]"]["$hasoption"]))
                {
                        // the tag is one that isn't going to be translated anyway, so don't waste time on it
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }

                if ($hasoption)
                {
                        $tag['option'] = substr($bbcode, $tag['option_open_pos'], $tag['option_end_pos'] - $tag['option_open_pos']);
                }
                else
                {
                        $tag['option'] = '';
                }

                $tag['close_open_pos'] = strpos($bbcode_lower, "[/$tag[name]]", $tag['begin_end_pos']);
                if ($tag['close_open_pos'] === false)
                {
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }

                $recursivetags = substr_count(substr($bbcode_lower, $tag['begin_end_pos'], $tag['close_open_pos'] - $tag['begin_end_pos']), "[/$tag[name]]");
                $bumped = 0;
                for ($i = 0; $i < $recursivetags; $i++)
                {
                        $tag['close_open_pos'] = strpos($bbcode_lower, "[/$tag[name]]", $tag['close_open_pos'] + 1);
                        if ($tag['close_open_pos'] === false)
                        { // no closing tag found, so stop parsing
                                $bumped = -1;
                                break;
                        }
                        $bumped++;
                }
                if ($bumped != $recursivetags)
                {
                        $startpos = $tag['begin_end_pos'];
                        continue;
                }
                $tag['close_end_pos'] = strpos($bbcode_lower, ']', $tag['close_open_pos'] + 1) + 1;

                $data = substr($bbcode, $tag['begin_end_pos'], $tag['close_open_pos'] - $tag['begin_end_pos']);

                // standard replace
                if (isset($bbcode_search["$tag[name]"]["$hasoption"]['replace']))
                {
                        $htmltag = $bbcode_search["$tag[name]"]["$hasoption"]['replace'];
                        $parseddata = "<$htmltag>$data</$htmltag>";
                }
                // html replace
                else if (isset($bbcode_search["$tag[name]"]["$hasoption"]['replace_html']))
                {
                        $parseddata = str_replace(array('\5', '\7', '\4'), array($tag['option'], $data, $data), $bbcode_search["$tag[name]"]["$hasoption"]['replace_html']);
                }
                // special handler replace
                else if (isset($bbcode_search["$tag[name]"]["$hasoption"]['handler']))
                {
                        $function = $bbcode_search["$tag[name]"]["$hasoption"]['handler'];
                        $parseddata = $function($data, $tag['option']);
                }
                // nothing to do
                else
                {
                        continue;
                }
                $bbcode = substr_replace($bbcode, $parseddata, $tag['begin_open_pos'], $tag['close_end_pos'] - $tag['begin_open_pos']);

                $startpos = $tag['begin_end_pos'];
        }
        while (1);

        return $bbcode;
}

// ###################### Start hasimages #######################
function contains_bbcode_img_tags($bbcode)
{
        return iif(strpos(strtolower($bbcode), '[img') !== false, 1, 0);
}

// ###################### Start bbcodeparseimgcode #######################
// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img($bbcode, $dobbimagecode)
function handle_bbcode_img($bbcode, $dobbimagecode, $iswysiwyg)
//
{
        global $vboptions, $bbuserinfo;

        if($dobbimagecode AND ($bbuserinfo['userid'] == 0 OR $bbuserinfo['showimages']))
        {
                // do [img]xxx[/img]
                // Image size hack R1.2
                // Modified by SS
                // $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1')", $bbcode);
                $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"' . iif(!$vboptions['allowdynimg'], '?&') . ']+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_img_match('\\1',$iswysiwyg)", $bbcode);
                //

        }
        $bbcode = preg_replace('#\[img\]\s*(https?://([^<>*"]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', "handle_bbcode_url('\\1', '', 'url')", $bbcode);

        return $bbcode;
}

// ###################### Start handle_bbcode_img_match #######################
// this is only called by handle_bbcode_img
// Image size hack R1.2
// Modified by SS
// function handle_bbcode_img_match($link)
function handle_bbcode_img_match($link, $iswysiwyg)
//
{
        $link = strip_smilies(str_replace('\\"', '"', $link));

        // remove double spaces -- fixes issues with wordwrap
        $link = str_replace('  ', '', $link);

        // Image Size hack r1.2
        // Modified by SS to resize large pics and place link to full size pic
        // return '<img src="' .  $link . '" border="0" alt="" />';

        if ( !$iswysiwyg ) {
                $max_imgsize=560;
               
                $image= ($link);

                // Get host url name for fsockopen to see if server is reachable
                $img_host=str_replace('http://','',$link);
                $img_host=substr($img_host,0,strpos($img_host,'/'));

                // Check is server is reachable and timeout in 5 seconds if not
                if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) {
                        // Check if image is on server
                        if (@fclose(@fopen("$image", "r"))) {
                                // Check image size and if oversize, change link
                                $img_width = getimagesize($link);
                                if ($img_width[0] > $max_imgsize) {
                                        $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="'
                                                . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>';
                                        return $biglink;
                                        }
                                else {
                                        return '<img src="' .  $link . '" border="0" alt="" />';
                                        }
                                }
                        else {
                                // Image not found
                                return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>';
                                }
                        }
                else {
                        // Server is down
                        return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>';
                        }
                }
        else {
                return '<img src="' .  $link . '" border="0" alt="" />';
                }
               
       
        // End Image Size hack r1.2
}

// ###################### Start bbcodehandler_quote #######################
function handle_bbcode_quote($message, $username = '')
{
        global $vboptions, $vbphrase, $stylevar, $show;

        // remove empty codes
        if (trim($message) == '')
        {
                return '';
        }

        // remove unnecessary escaped quotes
        $message = str_replace('\\"', '"', $message);
        $username = str_replace('\\"', '"', $username);

        // remove smilies from username
        $username = strip_smilies($username);
        $show['username'] = iif($username != '', true, false);

        global $stopsaveparsed, $parsed_postcache;
        if ($stopsaveparsed OR $parsed_postcache['skip'] == true OR !$vboptions['cachemaxage'])
        {
                $show['iewidthfix'] = (is_browser('ie') AND !(is_browser('ie', 6)));
        }
        else
        {
                // this post may be cached, so we can't allow this "fix" to be included in that cache
                $show['iewidthfix'] = false;
        }

        eval('$html = "' . fetch_template('bbcode_quote') . '";');
        return $html;
}

// ###################### Start bbcodehandler_php #######################
function handle_bbcode_php($code)
{
        global $vboptions, $vbphrase, $stylevar, $highlight_errors;
        static $codefind1, $codereplace1, $codefind2, $codereplace2;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        //remove smilies
        $code = strip_smilies(str_replace('\\"', '"', $code));

        if (!is_array($codefind))
        {
                $codefind1 = array(
                        '<br>',                // <br> to nothing
                        '<br />'        // <br /> to nothing
                );
                $codereplace1 = array(
                        '',
                        ''
                );

                $codefind2 = array(
                        '&gt;',                // &gt; to >
                        '&lt;',                // &lt; to <
                        '&quot;',        // &quot; to ",
                        '&amp;',        // &amp; to &
                );
                $codereplace2 = array(
                        '>',
                        '<',
                        '"',
                        '&',
                );
        }

        // remove htmlspecialchars'd bits and excess spacing
        $code = trim(str_replace($codefind1, $codereplace1, $code));
        $blockheight = fetch_block_height($code); // fetch height of block element
        $code = str_replace($codefind2, $codereplace2, $code); // finish replacements

        // do we have an opening <? tag?
        if (!preg_match('#^\s*<\?#si', $code))
        {
                // if not, replace leading newlines and stuff in a <?php tag and a closing tag at the end
                $code = "<?php BEGIN__VBULLETIN__CODE__SNIPPET $code \r\nEND__VBULLETIN__CODE__SNIPPET ?>";
                $addedtags = true;
        }
        else
        {
                $addedtags = false;
        }


        // highlight the string
        $oldlevel = error_reporting(0);
        if (PHP_VERSION  >= '4.2.0')
        {
                $buffer = highlight_string($code, true);
        }
        else
        {
                @ob_start();
                highlight_string($code);
                $buffer = @ob_get_contents();
                @ob_end_clean();
        }
        error_reporting($oldlevel);

        // if we added tags above, now get rid of them from the resulting string
        if ($addedtags)
        {
                $search = array(
                        '#(<|&lt;)\?php( |&nbsp;)BEGIN__VBULLETIN__CODE__SNIPPET#siU',
                        '#(<(span|font).*>)(<|&lt;)\?(</\\2>(<\\2.*>))php( |&nbsp;)BEGIN__VBULLETIN__CODE__SNIPPET#siU',
                        '#END__VBULLETIN__CODE__SNIPPET( |&nbsp;)\?(>|&gt;)#siU'
                );
                $replace = array(
                        '',
                        '\\5',
                        ''
                );
                $buffer = preg_replace($search, $replace, $buffer);
        }

        $buffer = str_replace('[', '[', $buffer);
        $buffer = preg_replace('/&amp;#([0-9]+);/', '&#$1;', $buffer); // allow unicode entities back through
        $code = &$buffer;

        eval('$html = "' . fetch_template('bbcode_php') . '";');
        return $html;
}

// ###################### Start bbcodehandler_code #######################
function handle_bbcode_code($code)
{
        global $vboptions, $vbphrase, $stylevar;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        // remove unnecessary line breaks and escaped quotes
        $code = str_replace(array('<br>', '<br />', '\\"'), array('', '', '"'), $code);

        // remove smilies
        $code = strip_smilies($code);

        // fetch height of block element
        $blockheight = fetch_block_height($code);

        eval('$html = "' . fetch_template('bbcode_code') . '";');
        return $html;
}

// ###################### Start bbcodehandler_html #######################
function handle_bbcode_html($code)
{
        global $vboptions, $vbphrase, $stylevar, $html_allowed;
        static $regexfind, $regexreplace;

        // remove empty codes
        if (trim($code) == '')
        {
                return '';
        }

        //remove smilies
        $code = strip_smilies(str_replace('\\"', '"', $code));

        if (!is_array($regexfind))
        {
                $regexfind = array(
                        '#<br( /)?>#siU',                                // strip <br /> codes
                        '#(&amp;\w+;)#siU',                                // do html entities
                        '#&lt;!--(.*)--&gt;#siU',                // italicise comments
                        '#&lt;(.+)&gt;#esiU'                        // push code through the tag handler
                );
                $regexreplace = array(
                        '',                                                                // strip <br /> codes
                        '<b><i>\1</i></b>',                                // do html entities
                        '<i>&lt;!--\1--&gt;</i>',                // italicise comments
                        "handle_bbcode_html_tag('\\1')"        // push code through the tag handler
                );
        }

        if ($html_allowed)
        {
                $regexfind[] = '#\<(.+)\>#esiU';
                $regexreplace[] = "handle_bbcode_html_tag(htmlspecialchars_uni(stripslashes('\\1')))";
        }
        // parse the code
        $code = preg_replace($regexfind, $regexreplace, $code);

        // how lame but HTML might not be on in signatures
        if ($html_allowed)
        {
                $regexfind = array_pop($regexfind);
                $regexreplace = array_pop($regexreplace);
        }

        $code = str_replace('[', '[', $code);

        // fetch height of block element
        $blockheight = fetch_block_height($code);

        eval('$html = "' . fetch_template('bbcode_html') . '";');
        return $html;
}

//#####################multi-Wasserstandshack######################
function wsmhack ($text) {
$wsm_string = "#\[wsm\] ([a-zA-Z0-9 \.\-\_]{1,30}) \| (\d+\.\d+|\d+\.\d+\.\d+) \| (\d+:\d+) \| ([\d\.,]+) (von|of) ([\d\.,]+) MB \| (\d+) Quellen \| (\d+) volle Quellen \[\/wsm\]#si";
if(preg_match_all($wsm_string, $text, $wsm_match)) {
        $wsm_lock = false;
        for($i=0; $i<count($wsm_match[0]); $i++) {
                if($wsm_match[4][$i]>$wsm_match[6][$i]) {
                        $wsm_match[1][$i]="FEHLER!";
                        $wsm_match[4][$i]=$wsm_match[6][$i];
                }
                $wsm_dl_size = ceil(str_replace(',', '.', $wsm_match[4][$i]));
                $wsm_co_size = ceil(str_replace(',', '.', $wsm_match[6][$i]));
                if($wsm_co_size==0) {
                        $wsm_match[1][$i]="FEHLER!";
                        $wsm_co_size= 1;
                }
                $wsm_percentage_total = $wsm_co_size/100;
                $wsm_percentage = $wsm_dl_size/$wsm_percentage_total;
                $wsm_image_dl_length = 2*ceil($wsm_percentage);
                $wsm_image_mi_length = 200-$wsm_image_dl_length;
                if($wsm_image_dl_length==0) {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_mi.gif\" width=200 height=12><img src=\"images/ws_re.gif\">";
                }
                elseif($wsm_image_dl_length==200) {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_dl.gif\" width=".$wsm_image_dl_length." height=12><img src=\"images/ws_re.gif\">";
                }
                else {
                        $wsm_image = "<img src=\"images/ws_li.gif\"><img src=\"images/ws_dl.gif\" width=".($wsm_image_dl_length-1)." height=12><img src=\"images/ws_sp.gif\"><img src=\"images/ws_mi.gif\" width=".$wsm_image_mi_length." height=12><img src=\"images/ws_re.gif\">";
                }
                if($i%2==0){
                        $wsm_replace ="<tr class=\"alt2\"><td style='font-size:8pt;' valign='top'>".$wsm_match[1][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[2][$i]." | ".$wsm_match[3][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_image."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[4][$i]." / ".$wsm_match[6][$i]." MB</td><td style='font-size:8pt;' align='right' valign='top'>(".round($wsm_percentage)." %)</td><td style='font-size:8pt;' valign='top'>".$wsm_match[7][$i]." / ".$wsm_match[8][$i]."</td></tr>";
                }
                else{
                        $wsm_replace ="<tr class=\"alt1\"><td style='font-size:8pt;' valing='top'>".$wsm_match[1][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[2][$i]." | ".$wsm_match[3][$i]."</td><td style='font-size:8pt;' valign='top'>".$wsm_image."</td><td style='font-size:8pt;' valign='top'>".$wsm_match[4][$i]." /  ".$wsm_match[6][$i]." MB</td><td style='font-size:8pt;' align='right' valign='top'>(".round($wsm_percentage)." %)</td><td style='font-size:8pt;' valign='top'>".$wsm_match[7][$i]." / ".$wsm_match[8][$i]."</td></tr>";
                }
                $text = str_replace($wsm_match[0][$i],$wsm_replace,$text);
        }
        $text = "<table cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#FFFFF0\"  align=\"center\"><tr><td class=\"tcat\" colspan=\"6\" align=\"center\"><b>Wasserstand</b></td></tr>".$text."</table>";
        return $text;
}
        else {
                return $text;
        }
}
//Ende multi-Wasserstandshack
// ###################### Start bbcodehandler_html_tag #######################
function handle_bbcode_html_tag($tag)
{
        global $bbcode_html_colors;

        if (empty($bbcode_html_colors))
        {
                fetch_bbcode_html_colors();
        }

        // change any embedded URLs so they don't cause any problems
        $tag = preg_replace('#\[(email|url)=&quot;(.*)&quot;\]#siU', '[$1="$2"]', $tag);

        // find if the tag has attributes
        $spacepos = strpos($tag, ' ');
        if ($spacepos != false)
        {
                // tag has attributes - get the tag name and parse the attributes
                $tagname = substr($tag, 0, $spacepos);
                $tag = preg_replace('# (\w+)=&quot;(.*)&quot;#siU', ' \1=<font color="' . $bbcode_html_colors['attribs'] . '">&quot;\2&quot;</font>', $tag);
        }
        else
        {
                // no attributes found
                $tagname = $tag;
        }
        // remove leading slash if there is one
        if ($tag{0} == '/')
        {
                $tagname = substr($tagname, 1);
        }
        // convert tag name to lower case
        $tagname = strtolower($tagname);

        // get highlight colour based on tag type
        switch($tagname)
        {
                // table tags
                case 'table':
                case 'tr':
                case 'td':
                case 'th':
                case 'tbody':
                case 'thead':
                        $tagcolor = $bbcode_html_colors['table'];
                        break;
                // form tags
                case 'form';
                case 'input':
                case 'select':
                case 'option':
                case 'textarea':
                case 'label':
                case 'fieldset':
                case 'legend':
                        $tagcolor = $bbcode_html_colors['form'];
                        break;
                // script tags
                case 'script':
                        $tagcolor = $bbcode_html_colors['script'];
                        break;
                // style tags
                case 'style':
                        $tagcolor = $bbcode_html_colors['style'];
                        break;
                // anchor tags
                case 'a':
                        $tagcolor = $bbcode_html_colors['a'];
                        break;
                // img tags
                case 'img':
                        $tagcolor = $bbcode_html_colors['img'];
                        break;
                // if (vB Conditional) tags
                case 'if':
                case 'else':
                case 'elseif':
                        $tagcolor = $bbcode_html_colors['if'];
                        break;
                // all other tags
                default:
                        $tagcolor = $bbcode_html_colors['default'];
                        break;
        }

        $tag = '<font color="' . $tagcolor . '">&lt;' . str_replace('\\"', '"', $tag) . '&gt;</font>';
        return $tag;
}

// ###################### Start bbcodehandler_list2 #######################
// replacement for bbcodehandler_list... experimental at this time
function handle_bbcode_list($string)
{
        #echo '<p><b>$string</b><br />' . nl2br(htmlspecialchars($string)) . '</p>';
        global $BBCODES, $wysiwygparse;
        // might need this in the future
        //$string = stripslashes($string);
        $string = str_replace('\"', '"', $string);
        $str = $string;

        // getList
        $slashlist = strpos($str, ']', stripos($str, '[/list')) + 1;
        $tmp = substr($str, 0, $slashlist);
        $openlist = strlen($tmp) - stripos(strrev($tmp), strrev('[list')) - strlen('[list');
        $getList = substr($str, $openlist, ($slashlist - $openlist));

        #echo '<p><b>$getList</b><br />' . htmlspecialchars($getList) . '</p>';

        // processList
        if (preg_match('#\s*(\[list(=(&quot;|"|\'|)([^\]]*)\\3)?\](.*)\[/list(=\\3\\4\\3)?\])\s*#si', $getList, $regs))
        {
                $getList = $regs[0];
                #echo '<p><b>Regex Match</b><br />' . htmlspecialchars($regs[0]) . '</p>';
                $str = preg_split('#\s*\[\*\]#s', $regs[5], -1, PREG_SPLIT_NO_EMPTY);

                if (empty($str))
                {
                        return preg_replace('#\s*' . preg_quote($getList, '#') . '\s*#s', nl2br("\n\n"), $string);
                }

                if ($regs[4])
                {
                        switch ($regs[4])
                        {
                                case 'A':
                                        $listtype = 'upper-alpha';
                                        break;
                                case 'a':
                                        $listtype = 'lower-alpha';
                                        break;
                                case 'I':
                                        $listtype = 'upper-roman';
                                        break;
                                case 'i':
                                        $listtype = 'lower-roman';
                                        break;
                                case '1': //break missing intentionally
                                default:
                                        $listtype = 'decimal';
                                        break;
                        }
                }
                else
                {
                        $listtype = '';
                }

                $processList = iif($listtype, '<ol style="list-style-type: ' . $listtype . '">', '<ul>');

                $bad_tag_list = '(br|p|li|ul|ol)';

                foreach ($str AS $key => $val)
                {
                        $firstbit = strtolower(substr($val, 0, 3));
                        if ($firstbit === '<ul' OR $firstbit === '<ol' OR $firstbit === '<li' OR $firstbit == '')
                        {
                                $processList .= $val;
                        }
                        else
                        {
                                if ($wysiwygparse)
                                {
                                        $exploded = preg_split("#(\r\n|\n|\r)#", $val);

                                        $val = '';
                                        foreach ($exploded AS $value)
                                        {
                                                if (!preg_match('#(</' . $bad_tag_list . '>|<' . $bad_tag_list . '\s*/>)$#iU', $value))
                                                {
                                                        if (trim($value) == '')
                                                        {
                                                                $value = '&nbsp;';
                                                        }
                                                        //$val .= '<p style="margin:0px">' . $value . "</p>";
                                                        $val .= $value . "<br />\n";
                                                }
                                                else
                                                {
                                                        $val .= "$value\n";
                                                }
                                        }
                                        $val = preg_replace('#<br />+\s*$#i', '', $val);

                                }
                                $processList .= '<li>' . $val . '</li>';
                        }
                }

                $processList .= iif($listtype, '</ol>', '</ul&gt;');

                #echo '<p><b>$processList</b><br />' . htmlspecialchars($processList) . '</p>';

                // replace found list characters with parsed list characters
                if ($wysiwygparse)
                {
                        $processList = str_replace('<p style="margin:0px"></p>', '', $processList);
                }

                //$out = preg_replace('#\s*' . preg_quote($getList, '#') . '\s*#s', str_replace(array('\\', '$'), array('\\\\', '\$'), $processList), $string);
                $out = str_replace($getList, $processList, $string);
                #echo '<p><b>Return Value</b><br />' . nl2br(htmlspecialchars($out)) . '</p><hr />';
                return $out;
        }
        else
        {
                return $string;
        }

}

// ###################### Start handle_bbcode_url #######################
function handle_bbcode_url($text, $link, $type = 'url')
{
        global $wysiwygparse;

        if (trim($text) == '')
        {
                return '';
        }

        $rightlink = trim($link);
        if (empty($rightlink))
        {
                // no option -- use param
                $rightlink = trim($text);
        }
        $rightlink = strip_smilies(str_replace('\\"', '"', $rightlink));
        $rightlink = str_replace(array('`', '"', "'", '['), array('`', '&quot;', ''', '['), $rightlink);

        if ($type == 'url' AND !preg_match('#^[a-z0-9]+://#si', $rightlink))
        {
                $rightlink = "http://$rightlink";
        }

        if ($type == 'ed2k' AND !preg_match('#^[a-z0-9]+://#si', $rightlink))
        {
                $rightlink = "ed2k://$rightlink";
        }

        if (!trim($link) OR $text == $rightlink)
        {
                $tmp = unhtmlspecialchars($rightlink);
                if (strlen($tmp) > 55 AND !$wysiwygparse)
                {
                        $text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));
                }
        }

        // remove double spaces -- fixes issues with wordwrap
        $rightlink = str_replace('  ', '', $rightlink);

        // strip extra quotes from hyperlink
        $text = str_replace('\"', '"', $text);

        if ($type == 'url' OR $type == 'ed2k')
        {
                // standard URL hyperlink
                if ($type == 'ed2k')
                        {
                        $teile = explode("|", $rightlink);
                        return "<a href=\"$rightlink\" target=\"_self\">$text</a> - <a href=\"http://stats.razorback2.com/ed2khistory?ed2k=$teile[4]\" target=\"_blank\">Verteilung</a>";
                        }
                else
                        {
                        return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
                        }
        }
        else
        {
                // email hyperlink (mailto:)
                if (is_valid_email($rightlink))
                {
                        return "<a href=\"mailto:$rightlink\">$text</a>";
                }
                else
                {
                        // not a valid email - don't link it
                        return "<span title=\"$rightlink\">$text</span>";
                }
        }
}

but the hack does .... nothing!

Does anybody find the mistake? :(

http://www.mr-goodbyte.de/greetz.png

It all looks right to me. Are you sure that you uploaded the files into the appropriate places? Keep in mind it will only do something if an image is wider than 560 pixels - any image smaller than that will appear as it always has.

Allan 09-28-2005 11:34 PM

work under vB 3.5 ?

Steve St.Lauren 09-30-2005 05:54 AM

Quote:

Originally Posted by Allan
work under vB 3.5 ?

I haven't worked with 3.5 yet. I don't have enough time to play around with rc or beta versions of products. I'll wait until it's a gold release and then has been out for a couple of months and then I'll start working with it. Sorry. If someone wants to port it before then feel free - I just ask that you give credit for the original code.

ggiersdorf 10-07-2005 05:49 PM

3.5 is here PLEASE take a look now :) We need you coders now more than ever!!

Thanks

LambHyjoo 12-10-2005 11:19 PM

It would be nice to release an addon which would save the image on disk. Why ?
- Because after a couple of weeks, images often become unreachable (because they are deleted, moved...)
- Because it is not HotLinking anymore.
- It would cut this "delay" : if the image has already been downloaded on the server, you don't need to check it aain. It's a local file and you hust need to replace the IMG location.

I would be very insterested by such an addon ;)

apfparadise 12-19-2005 12:58 AM

I would also love to see it ported to 3.5. I miss it like crazy on my photography site.

Steve St.Lauren 12-20-2005 02:09 AM

Quote:

Originally Posted by apfparadise
I would also love to see it ported to 3.5. I miss it like crazy on my photography site.

I'm working on it. I'm moving the forums I run over to 3.5.1 and am working on converting all my hacks over right now. Hope to have it finished by early in January.

AllenMead 02-15-2006 06:39 PM

Steve, is there any update on this yet?

Steve St.Lauren 02-15-2006 11:20 PM

I should have it done some time next week. I'm working on an improvement at the same time where it will save the resolution of the pic to a database so that it doesn't have to recheck that every time - that will remove the slowdown problem.

AllenMead 02-19-2006 07:58 AM

That's great stuff!

The_Rayman 02-21-2006 05:24 PM

Heya Steve,

Looks good, i installed This Hack but the site becomes extremely slow when it needs to resize...

Will be happy to test your version!

Please keep me updated, i will subscribe to this thread anyway ;)

ubblite 02-26-2006 07:04 PM

Yup, if Steve is able to get this hack released for vb 3.5.3/4 soon, it would be awesome. I'll be keeping a close eye on this thread for sure.

AllenMead 03-16-2006 06:11 PM

Any news yet fella?

AllenMead 04-27-2006 07:56 PM

up ^^

AllenMead 05-18-2006 07:33 PM

Is a shame this hack appears to not going to be updated for 3.5.3. Was one of the better image re-sizing hacks :(

The_Rayman 03-10-2008 10:16 AM

I've got the following running on my site, it works GREAT!

Code:

find in class_bbcode.php (/forum/includes)
return '<img src="' .  $link . '" border="0" alt="" />'; 

replace red with:

/* Start Image RESIZE */ 

 $navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : ''; 
if (stristr($navigator_user_agent, "msie")) { 
    return '<a href="' .  $link . '?phpMyAdmin=7jrhMYVjuPF%2CpNIFLQVSGEcLssf" target="_blank"><img src="' .  $link . '" border="0" alt="" style="width: expression(this.width > 800 ? 600 : true);" /></a>'; 
} else { 
    return '<a href="' .  $link . '?phpMyAdmin=7jrhMYVjuPF%2CpNIFLQVSGEcLssf" target="_blank"><img src="' .  $link . '" border="0" alt="" style="max-width: 800px;" /></a>'; 
}   

/* End Image RESIZE */

Voila! Change the style="max-width: 800px part to any size you want.


All times are GMT. The time now is 04:29 PM.

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.02656 seconds
  • Memory Usage 2,669KB
  • 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
  • (5)bbcode_code_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (28)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