##################################################################################
#  - EXTBOARD - (sep. 2007)
# Instruction Manual for updating standard Fusion (v6.01.11)
# Based on GPL2, (c) 2007 by ZOC
#
# This package is a cooperation from:
# alcazar, silvermoon, weedorbeat, wibix, silvermoon and (go)ZOC
# Thanks goes to beta-testers and emblinux and firemike for graphical assistance.
#
# THE ExtBoard IS FOR ADVANCED USERS AND USERS WITH PHP-KNOWLEDGE ONLY !!
# Any normal update is not possible, due to the changes in code and database. 
#
##################################################################################
#
#-----[ IMPORTANT NOTE ]------------------------------------------
#
First thing to do is making a full backup (files and db)

#
#-----[ REQUIREMENTS ]------------------------------------------
#
Make sure you have installed the aw_forum_panel from wibix! (www.wibix.de)
If not, download and infuse it, it has many special functions.

#
#-----[ COPY ]------------------------------------------
#
Copy the folders and files from the archive to your webspace overwriting existing files.
(Even the files from the previously installed aw_forum_panel)

#
#-----[ DIY ]------------------------------------------
#
Go to ACP and infuse the Forum Poll Infusion
After install you should configure the various Poll Options.

Forum Poll v1.23 is based on the infusion from "xandra" (http://beta.phpfusion-mods.com)

# FILE-EDIT
#
#-----[ OPEN ]------------------------------------------
#
maincore.php

#
#-----[ FIND ]------------------------------------------
#
define("THEMES", BASEDIR."themes/");

#
#-----[ AFTER, ADD ]------------------------------------------
#
define("IMAGES_R", IMAGES."ranks/");

#
#-----[ FIND ]------------------------------------------
#
function parsesmileys($message) {
        $smiley = array(
                "#\:\)#si" => "<img src='".IMAGES."smiley/smile.gif' alt='smiley'>",
                "#\;\)#si" => "<img src='".IMAGES."smiley/wink.gif' alt='smiley'>",
                "#\:\(#si" => "<img src='".IMAGES."smiley/sad.gif' alt='smiley'>",
                "#\:\|#si" => "<img src='".IMAGES."smiley/frown.gif' alt='smiley'>",
                "#\:o#si" => "<img src='".IMAGES."smiley/shock.gif' alt='smiley'>",
                "#\:p#si" => "<img src='".IMAGES."smiley/pfft.gif' alt='smiley'>",
                "#b\)#si" => "<img src='".IMAGES."smiley/cool.gif' alt='smiley'>",
                "#\:d#si" => "<img src='".IMAGES."smiley/grin.gif' alt='smiley'>",
                "#\:@#si" => "<img src='".IMAGES."smiley/angry.gif' alt='smiley'>"
        );
        foreach($smiley as $key=>$smiley_img) $message = preg_replace($key, $smiley_img, $message);
        return $message;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
function parsesmileys($message) {
    $query = mysql_query("select * from ".DB_PREFIX."smilies") or die(mysql_error());
        while($row = mysql_fetch_object($query))
	{
        $img="<img src=".IMAGES."smiley/".$row->smile_url.">";
        $message =str_replace($row->code,$img,$message);
        }
    return $message;
}

#
#-----[ FIND ]------------------------------------------
#
function displaysmileys($textarea) {
        $smiles = "";
        $smileys = array (
                ":)" => "smile.gif",
                ";)" => "wink.gif",
                ":|" => "frown.gif",
                ":(" => "sad.gif",
                ":o" => "shock.gif",
                ":p" => "pfft.gif",
                "B)" => "cool.gif",
                ":D" => "grin.gif",
                ":@" => "angry.gif"
        );
        foreach($smileys as $key=>$smiley) $smiles .= "<img src='".IMAGES."smiley/$smiley' alt='smiley' onClick=\"insertText('$textarea', '$key');\">\n";
        return $smiles;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
function displaysmileys($textarea) {
    $querya = mysql_query("select * from ".DB_PREFIX."smilies WHERE view='1' LIMIT 0,10") or die(mysql_error());
        while($rowa = mysql_fetch_object($querya)){
        $smiles="$smiles <img src='".IMAGES."smiley/$rowa->smile_url' onClick=\"insertText('$textarea', '$rowa->code ');\">\n";
        }
    return $smiles;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Show more smiley icons
function displaysmileys_more($textarea) {
    $querya = mysql_query("select * from ".DB_PREFIX."smilies WHERE view='1' LIMIT 10,99") or die(mysql_error());
        while($rowa = mysql_fetch_object($querya)){
        $smiles="$smiles <img src='".IMAGES."smiley/$rowa->smile_url' onClick=\"insertText('$textarea', '$rowa->code ');\">\n";
        }
    return $smiles;
}

#
#-----[ FIND ]------------------------------------------
#
// Parse bbcode into HTML code
function parseubb($text) {

#
#-----[ FIND ]------------------------------------------
#
$text = preg_replace('#\[flash width=([0-9]*?) height=([0-9]*?)\]([^\s\'\";:\+]*?)(\.swf)\[/flash\]#si', '<object classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' codebase=\'http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\' id=\'\3\4\' width=\'\1\' height=\'\2\'><param name=movie value=\'\3\4\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#ffffff\'><embed src=\'\3\4\' quality=\'high\' bgcolor=\'#ffffff\' width=\'\1\' height=\'\2\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object>', $text);

#
#-----[ AFTER, ADD ]------------------------------------------
#
// googlevideo
$text = preg_replace('#\[googlevideo\](.*?)videoplay(.*?)\[/googlevideo\]#si', '[googlevideo]\1googleplayer.swf\2[/googlevideo]', $text);
$text = preg_replace('#\[googlevideo\](.*?)\[/googlevideo\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'380\' data=\'\\1\'><param name=movie value=\'\\1\'><param name=\'wmode\' value=\'transparent\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#ffffff\'></object>', $text);

// clipfish
$text = preg_replace('#\[clipfish\](.*?)player.php\?(.*?)\[/clipfish\]#si', '[clipfish]\1videoplayer.swf?as=0&\2[/clipfish]', $text);
$text = preg_replace('#\[clipfish\](.*?)\[/clipfish\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'388\' data=\'\\1\'><param name=movie value=\'\\1\'><param name=\'wmode\' value=\'transparent\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#999999\'></object>', $text);

// myvideo.de
$text = preg_replace('#\[myvideo\](.*?)watch(.*?)\[/myvideo\]#si', '[myvideo]\1movie\2[/myvideo]', $text);
$text = preg_replace('#\[myvideo\](.*?)\[/myvideo\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'380\' data=\'\\1\'><param name=movie value=\'\\1\'></object>', $text);

// youtube	
$text = preg_replace('#\[youtube\](.*?)watch\?(.*?)\[/youtube\]#si', '[youtube]\1\2[/youtube]', $text);
$text = preg_replace('#\[youtube\](.*?)=(.*?)\[/youtube\]#si', '[youtube]\1/\2[/youtube]', $text);
$text = preg_replace('#\[youtube\](.*?)\[/youtube\]#si', '<object width="464" height="380"><param name="movie" value="\1"></param><embed src="\1" type="application/x-shockwave-flash" width="464" height="380"></embed></object>', $text);

// font size
$text =  preg_replace('#\[size=(4|6|8|10|12|14|16|18|20|22|24|26|28|30|32|34|36|38|40|42)\](.*?)\[/size\]#si', '<span style=\'font-size:\1\'>\2</span>', $text);

#
#-----[ FIND ]------------------------------------------
#
$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)(.*?)(\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG))\[/img\]#sie","'<img src=\'\\1'.str_replace(array('.php','?','&','='),'','\\3').'\\4\' style=\'border:0px\'>'",$text);

#
#-----[ REPLACE WITH ]------------------------------------------
#
// Image work begin
    $maxwidth = 400; // change if you want
    $pattern = "#\[img\](.*?)\[/img\]#si";
    $images = array();
    $count = preg_match_all($pattern, $text, $images);
    if($count) {
        for($i=0; $i<$count; ++$i) {
                $url = $images[1][$i];
                $data = @getimagesize($url);
                if($data!==false) {
                        $width = $data[0];
                        if($width < $maxwidth) {
                                $text = str_replace($images[0][$i], "<img src='".$url."' style='border:0px'>", $text);
                        } else {
                                $text = str_replace($images[0][$i], "<a href='".$url."' target='_blank'  title='Click for fullsize'><img src='".$url."' style='border:0px; max-width:".$maxwidth."px'></a>", $text);
                        }
                } else {
                        $text = str_replace($images[0][$i], "<a xhref='".$url."' target='_blank'><img src='../images/image_not_found.png' width='50' border='0' title='Bild nicht verfgbar / Pic not available'></a>",$text);
                    }
                }
    }
// Image work end

#
#-----[ FIND ]------------------------------------------
#
        for ($i=0;$i < $qcount;$i++) $text = preg_replace('#\[quote\](.*?)\[/quote\]#si', '<div class=\'quote\'>\1</div>', $text);
        for ($i=0;$i < $ccount;$i++) $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<div class=\'quote\' style=\'width:400px;white-space:nowrap;overflow:auto\'><code style=\'white-space:nowrap\'>\1<br><br><br></code></div>', $text);

#
#-----[ REPLACE WITH ]----------------------------------------
#
        for ($i=0;$i < $qcount;$i++) $text = preg_replace('#\[quote\](.*?)\[/quote\]#si', '<table class=\'quote\' border=\'0\' width=\'500\'><tr><th class=\'button\' align=\'left\'><b>Quote:</b></th></tr><td><div class=\'small\' style=\'max-width:500px;overflow:auto\'>\1<br></div></td></tr></table>', $text);
        for ($i=0;$i < $ccount;$i++) $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<table class=\'quote\' border=\'0\' width=\'500\'><tr><th class=\'button\' align=\'left\'><b>Code:</b></th></tr><td><div class=\'quote\' style=\'max-width:500px;max-height:500px;overflow:auto\'>\1<br></div></td></tr></table>', $text);

#
#-----[ AFTER, ADD ]------------------------------------------
#
include INCLUDES.'geshi_bbcode_include.php';

Note: All changes in the parseubb() function have to be done before:
        $text = descript($text,false);
        return $text;

#
#-----[ CLOSE FILE ]------------------------------------------
#

#
#-----[ db-update SQL ]---------------------------------------
#
Execute update.php on your webspace.
If all OK, delete the file and proceed.
If not, retry or report to support forum.


##################################################################################
# NOTES
##################################################################################

* Some other important functions for the forum area are in the file "forum_functions_include.php"

* For quickreply in viewthread.php opensidex is used.
  If you want you can use the better opentablex by copying it from the theme.php (Area 69 Theme) to your theme.
  To activate it:
#
#-----[ OPEN ]------------------------------------------
#
viewthread.php

#
#-----[ FIND ]------------------------------------------
#
// opentablex("<center><b>".$locale['512']."</b></center>","off");
opensidex("<center><b>".$locale['512']."</b></center>","off");

#
#-----[ REPLACE WITH ]------------------------------------------
#
opentablex("<center><b>".$locale['512']."</b></center>","off");
// opensidex("<center><b>".$locale['512']."</b></center>","off");

#
#-----[ CLOSE FILE ]------------------------------------------
#
* Themes and graphics:
  ExtBoard comes with 3 themes, some grahpics used are in these only.
  If you want to use it in your theme copy the files delete.gif, left.gif, right.gif to your theme.

* Displaying Global Moderators in profile
#
#-----[ OPEN ]------------------------------------------
#
profile.php

#
#-----[ FIND ]------------------------------------------
#
<td align='right' class='tbl2'>".getuserlevel($data['user_level'])."</td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
<td align='right' class='tbl2'>".getuserlevel($data['user_level']);
if($data['user_global_mod'] == '1') echo " (Global Moderator)";
echo "</td>

#
#-----[ CLOSE FILE ]------------------------------------------
#

#
# D O C ########################################################################
#
You change some variables in the /include/forum_functions_include.php file.
These are self-explaining or commented, so please check and/or adjust them.

$threads_per_page = 10;
$posts_per_page=15;
$rowstart2=0;
$showadminmods=false; // Show Admins as Mods in the Forum and Forenadmin
$rule_pageid = "0";  // The Page ID for viewpage.php (example: viewpage.php?page_id=$link_to_rights)
$picview = 0; // show picattaches as thumb, "1" show thumbs

----------------------------------------------------------------
FORENADMINISTRATION:
You can only assign users as Forummoderators if they have access to the forum and can either post or reply
else there are no settings.
Forumadministration has been extended and has partly its own logic and "intelligence".
Please take your time to get used to it.
In the Forumoverview you can see who is moderator and the rights for the forum.

Groups:
If you set the forumrights to "Group", then only the specified groups (and Superadmins) are granted these rights.
Group rights are set via the "Group Rights" menu (execept "Moderator" you can set only those rights that are set to "group")

Foren Settings (System-Admin):
Here you can enable and set the color groups for the user_levels Moderator, Global Moderator, Admin, Superadmin.
There're predefined colors, you can change them to your need.

GlobalMods:
Global Moderators are set via the memberadmin (editing the user).

-----------------------------------------------------------------
The new image-function in maincore.php should work in most cases.
If you experience problems or broken-links your host doesn't allow "allow_url_fopen".
You should then use the old function, though it may not work perfectly due to the changes.

The video-links (new function in maincore.php) should work with the usual URLs.
Especially at Clipfish the're are links again that are not correct. Please check.
Example for working links:

Youtube: http://www.youtube.com/watch?v=FClmtowd6XE
GoogleVideo: http://video.google.com/videoplay?docid=-3389980029353435416
MyVideo: http://www.myvideo.de/watch/1244115
Clipfish: http://www.clipfish.de/player.php?videoid=MjYxMnwyMg%3D%3D&cat=1


Have fun with ExtBoard
ZOC