/***************************************************************************
 *                               upgrade2.txt
 *                            -------------------
 *   Version              : 1.2.0
 *   began                : Friday, December 20th, 2002
 *   released             : Sunday, December 15th, 2002
 *   forums               : http://www.auzdev.com/chaos/forums
 *   email                : ice_rain_@hotmail.com
 *
 *   requires             : 2.0.0+ phpbb
 *                          points mod
 *                          first version of the shop mod
 *                          first update of the shop mod
 *   files to edit        : /viewtopic.php
 *   difficulty           : medium
 *   time                 : 5-10minutes
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   copyright (C) 2002/2003  IcE-RaiN/Zarath
 *
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version 2
 *   of the License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   http://www.gnu.org/copyleft/gpl.html
 *
 ***************************************************************************/

/***************************************************************************
 * Installation
 *
 * 1. Reupload files
 *		/admin/admin_shop.php
 *		/shop_iteminfo.php
 *		/shop_inventory.php
 *		/shop_effects.php
 *		/shop_bs.php
 *		/shop_upgrade2.php
 *		/shop.php
 *		/templates/*/shop_body.tpl
 *
 * 2. Run shop_upgrade2.php then delete it.
 *
 * 3. Backup viewtopic.php
 *
 * 4. Execute Steps Below
 *
 ***************************************************************************/

 ------[OPEN]------
viewtopic.php

 ------[REPLACE ALL BETWEEN]------
	{
		$user_points = '';
		$donate_points = '';
	}

 ------[AND]------
	//
	// Note! The order used for parsing the message _is_ important, moving things around could break any 
	// output
	//

 ------[WITH]------
	//display items
	if ($vtstopper != on) {
		$gsql = "select * from " . CONFIG_TABLE . " where config_name='viewtopic'";
		if ( !($gresult = $db->sql_query($gsql)) ) { message_die(CRITICAL_ERROR, 'ERROR: Getting Global Variables!'); }
		$grow = mysql_fetch_array($gresult);
		$gsql = "select * from " . CONFIG_TABLE . " where config_name='viewtopiclimit'";
		if ( !($gresult = $db->sql_query($gsql)) ) { message_die(CRITICAL_ERROR, 'ERROR: Getting Global Variables!'); }
		$grow1 = mysql_fetch_array($gresult);
		$vtstopper = "on";
	}
	if ($grow['config_value'] == images)
	{
		$itempurge = str_replace("", "", $postrow[$i]['user_items']);
		$itemarray = explode('',$itempurge);
		$itemcount = count ($itemarray);
		$user_items = "<br>";
     		for ($xe = 0;$xe < $itemcount;$xe++)
		{
			if ($itemarray[$xe] != NULL)
			{
				if ($grow1[config_value] < $xe) { $user_items .= ' <a href="'.append_sid("shop.".$phpEx."?action=inventory&searchname=".$postrow[$i][username]).'" title="'.$postrow[$i][username].'\'sInventory">more...</a>'; break; }
				if (file_exists("shop/images/".$itemarray[$xe].".jpg"))
				{
					$user_items .= ' <img src="shop/images/'.$itemarray[$xe].'.jpg" title="'.$itemarray[$xe].'" alt="'.$itemaray[$xe].'">';
				}
				elseif (file_exists("shop/images/".$itemarray[$xe].".gif"))
				{
					$user_items .= ' <img src="shop/images/'.$itemarray[$xe].'.gif" title="'.$itemarray[$xe].'" alt="'.$itemaray[$xe].'">';
				}
			}
		}
	}
	$ususername = $postrow[$i]['username'];
	$usernameurl = append_sid("shop.".$phpEx."?action=inventory&searchname=".$ususername);

	$usql = "select user_privs, user_effects, user_custitle from " . USERS_TABLE . " where username='$ususername'";
	if ( !($uresult = $db->sql_query($usql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting User Info!'); }
	$urow = mysql_fetch_array($uresult);
	$usereffects = explode("", $urow['user_effects']);
	$userprivs = explode("", $urow['user_privs']);
	$usercustitle = explode("", $urow['user_custitle']);
	$userbs = array();
	$usercount = count($userprivs);
	for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("", $userprivs[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
	$usercount = count($usereffects);
	for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("", $usereffects[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
	$usercount = count($usercustitle);
	for ($x = 0; $x < $usercount; $x++) { $temppriv = explode("", $usercustitle[$x]); $userbs[] = $temppriv[0]; $userbs[] = $temppriv[1]; }
	if ($specialstopper != on) { 
		$sql = "select config_value from " . CONFIG_TABLE . " where config_name='specialshop'";
		if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, 'Fatal Error Getting Item Info!'); }
		$row = mysql_fetch_array($result);
		$specialstopper = "on";
	}
	$shoparray = explode("", $row['config_value']);
	$shoparraycount = count ($shoparray);
	$shopstatarray = array();
	for ($x = 0; $x < $shoparraycount; $x++)
	{
		$temparray = explode("", $shoparray[$x]);
		$shopstatarray[] = $temparray[0];
		$shopstatarray[] = $temparray[1];
	}
	if (($userbs[10] == on) && ($shopstatarray[12] == on)) { $poster = '<font color="'.$userbs[11].'">'.$poster.'</font>'; }
	if ((($userbs[12] == on) && ($shopstatarray[14] == on)) || (($userbs[14] == on) && ($shopstataray[16] = on))) {
		$nameeffects = "<span style=\"width:100";
		if (($userbs[12] == on) && ($shopstatarray[14] == on)) { $nameeffects .= "; filter:shadow(color=#".$userbs[13].", strength=5)"; }
		if (($userbs[14] == on) && ($shopstatarray[16] == on)) { $nameeffects .= "; filter:glow(color=#".$userbs[15].", strength=5)"; }
		$nameeffects .= '">'.$poster.'</span>';
		$poster = $nameeffects;
	}
	if ((($userbs[24] == on) && ($shopstatarray[24] == on)) || (($userbs[20] == on) && ($shopstatarray[22] == on)) || (($userbs[22] == on) && ($shopstataray[20] = on)) || (($userbs[18] == on) && ($shopstatarray[18] == on))) {
		$titleeffects = '<span style="height:10';
		if (($userbs[22] == on) && ($shopstatarray[20] == on)) { $titleeffects .= "; filter:shadow(color=#".$userbs[23].", strength=5)"; }
		if (($userbs[20] == on) && ($shopstatarray[22] == on)) { $titleeffects .= "; filter:glow(color=#".$userbs[21].", strength=5)"; }
		if (($userbs[24] == on) && ($shopstatarray[24] == on)) { $poster_rank = $userbs[25]; }
		if (($userbs[18] == on) && ($shopstatarray[18] == on)) { $poster_rank = '<font color="'.$userbs[19].'">'.$poster_rank.'</font>'; }
		$titleeffects .= '">'.$poster_rank.'</span>';
		$poster_rank = $titleeffects;
	}
	if (($shopstatarray[6] == on) && ($userbs[2] != on) && ($poster_rank != "Site Admin")) { $poster_avatar = ""; }
	if (($shopstatarray[8] == on) && ($userbs[4] != on) && ($poster_rank != "Site Admin")) { $user_sig = ""; }
	if (($shopstatarray[10] == on) && ($userbs[6] != on) && ($poster_rank != "Site Admin")) { $poster_rank = "None"; $rank_image = ""; }
	//end item display

 ------[SAVE AND UPLOAD FILES]------
