PCP and the new Shop MOd w/ effects


  -----  
Author Message

Pogue Moran
Member

Sat Aug 26, 2006 11:39 pm   Post subject: PCP and the new Shop MOd w/ effects
I want to be able to use the new shop mod and effects shop but I need it to be compatible with PCP here is the old code:

Code:

##############################################################
## MOD Title: Shop Mod for PCP 2.0.x
## MOD PCP Integration Author: MrDSL < naug@thehottub.net > (MrDSL) http://www.thehottub.net
## MOD Shop Mod Author: Zarath <zarath@knightsofchaos.com> - http://forums.knightsofchaos.com
## MOD PCP Author: Ptirhiik < admin@rpgnet-fr.com > (Ptirhiik) http://rpgnet.clanmckeen.com/demo/
## MOD Decription:
## This hack for phpBB allows you to add a shop to spend currency from a point/cash system (such as the Cash Hack).
## It has many options, displays items in inventory or a link and you can limit the displayed items in the inventory.
## This is all configuarable in the admin control panel (ACP). It adds items/links to items in your profile.
## The link goes to an "inventory" of what a person owns which can be adjusted or summed up in the ACP.
## It can hold multiple shops, as many as you like, all configurable in the ACP.
## Restocking of items is an option in the ACP and the resale value is also  configurable in the ACP.
##
## On top of that, it has a special effects store, which allows users to buy avatar/title (rank)/signature privleges, username/rank title
## color/glow/shadow in viewtopic.php, title(rank) color/glow/shadow in viewtopic.php.
##
## All of these options can be activated/deactivated via the ACP. The main "Shop" link is added to the header.
##
##
## MOD Version: 1.0.0
## MOD Shop Version: 2.6.1
## MOD PCP Version: 2.0.x
## MOD phpBB Version: 2.1.11
##
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit:
##              includes/auth.php
##              forums.html
##              includes/page_header.php
##              language/lang_english/lang_extend_pcp_addons.php
##      profilcp/def/def_usermaps.php
##              profilcp/def/def_userfuncs_std.php
##              templates/*/overall_header.tpl
##              viewtopic.php
##
## Included Files:
##             
##
## PCP Author Notes: Big thanks to spin for fixing and updating alot of things with the original shop mod and for
##                   help with some of the PCP functions. This is a full integration so all ACP functions should take effect.
##
##     
## MOD History:
##
## 25/09/04: Shop Mod Version 2.6.1 (spin)
## Fixes:
## - Proper use of $lang, $db and $template.
## - Shop selection when editing an item is now a selection box, not a text input field.
##
##############################################################
## Installation:
##               1. Upload all files
##               2. Run shop_install.php then delete it.
##               3. Create a folder /shop/ under your forum root and then make a /images/ folder under that. So it
##                  will be shop/images/
##               4. Perform below file edits
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------------
#
copy admin/*.* to admin/*.*
copy language/lang_english/*.* to language/lang_english/*.*
copy profilcp/def/*.* to profilcp/def/*.*
copy shop/*.* to shop/*.*
copy templates/subSilver/*.* to templates/subSilver/*.*
copy shop.php to shop.php
copy shop_actions.php to shop_actions.php
copy shop_bs.php to shop_bs.php
copy shop_effects.php to shop_effects.php
copy shop_install.php to shop_install.php
copy shop_inventory.php to shop_inventory.php
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
   //
   // Note! The order used for parsing the message _is_ important, moving things around could break any
   // output
   //
#
#-----[ BEFORE, ADD ]------------------------------------------
#
   $usernameurl = append_sid("shop.".$phpEx."?action=inventory&searchid=".$postrow[$i]['user_id']);

   $usereffects = explode("ß", $postrow[$i]['user_effects']);
   $userprivs = explode("ß", $postrow[$i]['user_privs']);
   $usercustitle = explode("ß", $postrow[$i]['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]; }
   $shoparray = explode("ß", $board_config['specialshop']);
   $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 = ""; }
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
define('SHOPS_TABLE','phpbb_shops');
define('SHOPITEMS_TABLE', 'phpbb_shopitems');

#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#
   'PAGE_TITLE' => $page_title,

#
#-----[ AFTER, ADD ]------------------------------------------
#
   'SHOP' => '<img src="shop/images/icon_store_rpg.gif" border="0"> Shop',

#
#-----[ FIND ]------------------------------------------
#
   'U_FAQ' => append_sid('faq.'.$phpEx),

#
#-----[ AFTER, ADD ]------------------------------------------
#
   'U_SHOP' => append_sid('shop.'.$phpEx),

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
<td height="25" align="center" valign="top" nowrap="nowrap"><span class="mainmenu">&nbsp;<a href="{U_PROFILE}"
#
#-----[ IN-LINE FIND ]----------------------------------------
#
alt="{L_LOGIN_LOGOUT}" hspace="3" />{L_LOGIN_LOGOUT}</a>&nbsp;
#
#-----[ IN-LINE AFTER, ADD ]----------------------------------
#
<a href="{U_SHOP}" class="mainmenu">{SHOP}</a>&nbsp;&nbsp;
#
#-----[ OPEN ]------------------------------------------
#
includes/auth.php

#
#-----[ FIND ]------------------------------------------
#
   global $db, $lang;

#
#-----[ AFTER, ADD ]------------------------------------------
#
   //start item auths
   $itemarray = explode('ß', str_replace("Þ", "", $userdata['user_items']));

   $sql = "select name, accessforum from phpbb_shopitems where accessforum != '0'";
   if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, "Database Connection Error!<br>".mysql_error()); }
   $num_rows = mysql_num_rows($result);

   $itemformaccess = array();
   for ($x = 0; $x < $num_rows; $x++)
   {
      $row = mysql_fetch_array($result);
      if (in_array($row['name'], $itemarray))
      {
         $itemformaccess[] = $row['accessforum'];
      }
   }

#
#-----[ FIND ]------------------------------------------
#
      if ( $forum_id != AUTH_LIST_ALL )
      {
         $value = $f_access[$key];

#
#-----[ AFTER, ADD ]------------------------------------------
#
         if (in_array($forum_id, $itemformaccess) && (!in_array("auth_sticky",$auth_fields) && !in_array("auth_announce",$auth_fields) && !in_array("auth_delete",$auth_fields) && ($userdata['user_level'] == 0)))
         {
            $value = 1;
         }

#
#-----[ FIND ]------------------------------------------
#
         for($k = 0; $k < count($f_access); $k++)
         {
            $value = $f_access[$k][$key];
            $f_forum_id = $f_access[$k]['forum_id'];

#
#-----[ AFTER, ADD ]------------------------------------------
#
            if (in_array($forum_id, $itemformaccess) && (!in_array("auth_sticky",$auth_fields) && !in_array("auth_announce",$auth_fields) && !in_array("auth_delete",$auth_fields) && ($userdata['user_level'] == 0)))
            {
               $value = 1;
            }

#
#-----[ OPEN ]------------------------------------------
#
forums.html

#
#-----[ FIND ]------------------------------------------
#
   $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);

#
#-----[ AFTER, ADD ]------------------------------------------
#
   $itemarray = explode('ß', str_replace("Þ", "", $userdata['user_items']));

   $sql = "select name, accessforum from phpbb_shopitems where accessforum != '0' and accessforum > '0'";
   if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, "Database Connection Error!".mysql_error()); }
   $num_rows = mysql_num_rows($result);

   $itemformaccess = array();
   $itemcataccess = array();
   for ($x = 0; $x < $num_rows; $x++)
   {
      $row = mysql_fetch_array($result);
      if (in_array($row['name'], $itemarray))
      {
         $itemformaccess[] = $row['accessforum'];

         $sql = "select cat_id from " . FORUMS_TABLE . " where forum_id = '{$row['accessforum']}'";
         if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, "Database Connection Error: ".mysql_error()); }
         $row2 = mysql_fetch_array($result);

         $itemcataccess[] = $row2['cat_id'];
      }
   }

#
#-----[ FIND ]------------------------------------------
#
      //
      // Yes, we should, so first dump out the category

#
#-----[ BEFORE, ADD ]------------------------------------------
#
      if (in_array($cat_id, $itemcataccess)) {
         $display_forums = true;
      }

#
#-----[ FIND ]------------------------------------------
#
                  if ( $is_auth_ary[$forum_id]['auth_view'] )

#
#-----[ REPLACE WITH ]------------------------------------------
#
                  if ( $is_auth_ary[$forum_id]['auth_view'] || in_array($forum_id, $itemformaccess))

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_extend_pcp_addons.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['user_inventory_link'] = 'Items';
$lang['Shop'] = 'Shop';
$lang['profil_shopitems'] = 'Shop Inventory';
$lang['NonMember'] = 'Non-Member';

#
#-----[ OPEN ]------------------------------------------
#
profilcp/def/def_usermaps.php

#
#-----[ FIND ]------------------------------------------
# I set this up so the Shop Inventory replaces the section with the map cause I personally think its useless but if
# you want to keep it then don't replace just put it after instead of replace
#
   'PCP.viewprofile.base.international' => array(
      'order'      => 20,
      'title'      => 'Profile_control_panel_i18n',
      'fields'   => array(
         'user_timezone' => array(
            'img'          => true,
         ),
         'user_lang' => array(
            'txt'          => true,
            'style'        => '<b>%s</b>',
         ),
      ),
   ),

#
#-----[ REPLACE WITH ]------------------------------------------
#
   'PCP.viewprofile.base.shop items' => array(
      'order'      => 20,
      'title'      => 'profil_shopitems',
      'fields'   => array(
         'user_inventory_profile' => array(
            'class'        => 'generic',
            'type'         => 'VARCHAR',
            'dsp_func'     => 'pcp_output_inventory_profile',
            'img'          => true,
         ),
      ),
   ),

#
#-----[ FIND ]------------------------------------------
#
   'PHPBB.viewtopic.left' => array(
      'order'      => 10,
      'title'      => '',
      'fields'   => array(
         'username' => array(
            'txt'          => true,
            'style'        => '<div align="center" class="name">%s</div>',
         ),
#
#-----[ REPLACE WITH ]------------------------------------------
#
   'PHPBB.viewtopic.left' => array(
      'order'      => 10,
      'title'      => '',
      'fields'   => array(
         'username_effects' => array(
            'class'        => 'generic',
            'type'         => 'VARCHAR',
            'dsp_func'     => 'pcp_output_username_effects',
            'txt'          => true,
            'style'        => '<div align="center" class="name">%s</div>',
         ),
#
#-----[ FIND ]------------------------------------------
#   You can actually put this above anywhere really if you want.
#
      ),
   ),

   'PHPBB.viewtopic.left.ignore' => array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#

         'user_inventory_topics' => array(
            'class'        => 'generic',
            'type'         => 'VARCHAR',
            'dsp_func'     => 'pcp_output_inventory_topics',
            'img'          => true,
            'style'        => '<div align="center" class="gensmall">%s</div>',
         ),

#
#-----[ OPEN ]------------------------------------------
#
profilcp/def/def_userfuncs_std.php

#
#-----[ FIND ]------------------------------------------
#
//-----------------------------------
//
// username output function
//
//-----------------------------------
function pcp_output_username($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $username = ($view_userdata['user_id'] != ANONYMOUS) ? $view_userdata[$field_name] : ( (isset($view_userdata['post_username']) && ($view_userdata['post_username'] !='') ) ? $view_userdata['post_username'] : $lang['Guest'] );

   // txt
   $txt = '<span class="' . get_user_level_class($view_userdata['user_level'], 'gen', $view_userdata) . '">' . $username . '</span>';

   // img
   if ( $view_userdata['user_id'] != ANONYMOUS )
   {
      $temp_url = append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $view_userdata['user_id']);
      $img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" border="0" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>';
   }

   // result
   $res = pcp_output_format($field_name, $txt, $img, $map_name);
   return $res;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
//-----------------------------------
//
// username output function
//
//-----------------------------------
function pcp_output_username($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $res = '';
    $poster = ($view_userdata['user_id'] != "-1") ? $view_userdata['username'] : ( (isset($view_userdata['post_username']) && ($view_userdata['post_username'] !='') ) ? $view_userdata['post_username'].' <br /><div class="gensmall">'.$lang['NonMember'].'</center></div>' : $lang['Guest'].' <br /><div class="gensmall">'.$lang['NonMember'].'</div>' );
   $usereffects = explode("ß", $view_userdata['user_effects']);
   $userprivs = explode("ß", $view_userdata['user_privs']);
   $usercustitle = explode("ß", $view_userdata['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]; }
   $shoparray = explode("ß", $board_config['specialshop']);
   $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;
   }
   $username = ($view_userdata['user_id'] != ANONYMOUS) ? $view_userdata[$field_name] : ( (isset($view_userdata['post_username']) && ($view_userdata['post_username'] !='') ) ? $view_userdata['post_username'] : $lang['Guest'] );
    $temp_url = append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $view_userdata['user_id']);
   // txt
    $txt = '<span class="' . get_user_level_class($view_userdata['user_level'], 'gen', $view_userdata) . '">' . $poster . '</span>';

   // img
   if ( $view_userdata['user_id'] != ANONYMOUS )
   {
      $temp_url = append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $view_userdata['user_id']);
      $img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" border="0" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>';
   }

   // result
   $res = pcp_output_format($field_name, $txt, $img, $map_name);
   return $res;
}
#
#-----[ FIND ]------------------------------------------
#
//-----------------------------------
//
// user_rank_title output function
//
//-----------------------------------
function pcp_output_rank_title($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   if ( $view_userdata['user_id'] != ANONYMOUS )
   {
      $rank = get_user_rank($view_userdata);
      $txt = $rank['rank_title'];
      $img = $rank['rank_image'];

      // result
      $res = pcp_output_format($field_name, $txt, $img, $map_name);
   }
   return $res;
}

//-----------------------------------
//
// user_avatar output function
//
//-----------------------------------
function pcp_output_avatar($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $res = '';
   if ( !empty($view_userdata[$field_name]) && $userdata['user_viewavatar'] && $view_userdata['user_allowavatar'] && ($view_userdata['user_id'] != ANONYMOUS) )
   {
      switch ($view_userdata[$field_name . '_type'] )
      {
         case USER_AVATAR_UPLOAD:
            $img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
         case USER_AVATAR_REMOTE:
            $img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
         case USER_AVATAR_GALLERY:
            $img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
      }

      // result
      $res = pcp_output_format($field_name, $txt, $img, $map_name);
   }
   return $res;
}

//-----------------------------------
//
// user_sig output function
//
//-----------------------------------
function pcp_output_sig($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $res = '';
   if ( !empty($view_userdata[$field_name]) && ($view_userdata['user_id'] != ANONYMOUS) && $view_userdata['user_allow_sig'] && $userdata['user_viewsig'] )
   {
      $user_sig = $view_userdata[$field_name];
      $user_sig_bbcode_uid = $view_userdata[$field_name . '_bbcode_uid'];         
      if ( !$board_config['allow_html'] && $userdata['user_allowhtml'])
      {
         $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
      }
      if ($board_config['allow_bbcode'] && ($user_sig_bbcode_uid != ''))
      {
         $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
      }
      $user_sig = make_clickable($user_sig);
      if ( $board_config['allow_smilies'] && $view_userdata['user_allowsmile'])
      {
         $user_sig = smilies_pass($user_sig);
      }
      if (count($orig_word) > 0)
      {
         $user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
      }
      $txt = str_replace("\n", "\n<br />\n", $user_sig);

      // result
      $res = pcp_output_format($field_name, $txt, $img, $map_name);
   }
   return $res;
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
//-----------------------------------
//
// user_rank_title output function
//
//-----------------------------------
function pcp_output_rank_title($field_name, $view_userdata, $map_name='')
{
        global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
        global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields, $shopstatarray;
 
        if ( $view_userdata['user_id'] != ANONYMOUS )
        {
                $rank = get_user_rank($view_userdata);
 
                $shoparray = explode("ß", $board_config['specialshop']);
                $shoparraycount = count ($shoparray);
                for ($x = 0; $x < $shoparraycount; $x++)
                {
                        $temparray = explode("Þ", $shoparray[$x]);
                        $shopstatarray[] = $temparray[0];
                        $shopstatarray[] = $temparray[1];
                }
                $userprivs = array();
                $usereffects = array();
                $usercustitle = array();
                $userbs = array();
                $userprivs = explode("ß", $view_userdata['user_privs']);
                $usercount = count($userprivs);
                for ($x = 0; $x < $usercount; $x++)
                {
                        $temppriv = explode("Þ", $userprivs[$x]);
                        $userbs[] = $temppriv[0];
                        $userbs[] = $temppriv[1];
                }
                $usereffects = explode("ß", $view_userdata['user_effects']);
                $usercount = count($usereffects);
                for ($x = 0; $x < $usercount; $x++)
                {
                        $temppriv = explode("Þ", $usereffects[$x]);
                        $userbs[] = $temppriv[0];
                        $userbs[] = $temppriv[1];
                }
                $usercustitle = explode("ß", $view_userdata['user_custitle']);
                $usercount = count($usercustitle);
                for ($x = 0; $x < $usercount; $x++)
                {
                        $temppriv = explode("Þ", $usercustitle[$x]);
                        $userbs[] = $temppriv[0];
                        $userbs[] = $temppriv[1];
                }
                if ((($userbs[24] == on) && ($shopstatarray[24] == on)) ||
                    (($userbs[20] == on) && ($shopstatarray[22] == on)) ||
                    (($userbs[22] == on) && ($shopstatarray[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))
                        {
                                $rank['rank_title'] = $userbs[25];
                        }
                        if (($userbs[18] == on) && ($shopstatarray[18] == on))
                        {
                                $rank['rank_title'] = '<font color="'.$userbs[19].'">'.$rank['rank_title'].'</font>';
                        }
                        $titleeffects .= '">'.$rank['rank_title'].'</span>';
                        $rank['rank_title'] = $titleeffects;
                } 
                if (($shopstatarray[10] == on) && ($userbs[6] != on) && ($rank['rank_title'] != "Site Admin"))
                {
                        $rank['rank_title'] = "None";
                        $rank['rank_image'] = "";
                } 
                $txt = $rank['rank_title'];
                $img = $rank['rank_image'];                                                                                                     
                // result
                $res = pcp_output_format($field_name, $txt, $img, $map_name);
        }
        return $res;
}

//-----------------------------------
//
// user_avatar output function
//
//-----------------------------------
function pcp_output_avatar($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $res = '';
   if ( !empty($view_userdata[$field_name]) && $userdata['user_viewavatar'] && $view_userdata['user_allowavatar'] && ($view_userdata['user_id'] != ANONYMOUS) )
   {
      switch ($view_userdata[$field_name . '_type'] )
      {
         case USER_AVATAR_UPLOAD:
            $img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
         case USER_AVATAR_REMOTE:
            $img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
         case USER_AVATAR_GALLERY:
            $img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $view_userdata[$field_name] . '" alt="' . $lang['Avatar'] . '" border="0" />' : '';
            break;
      }
                  if ( ($img) && ($map_name == 'PHPBB.viewtopic.left') )
                {
                        $tmp = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $view_userdata['user_id']);
                        $img = '<a href="'. $tmp .'">'. $img .'</a>';
                }
                $shoparray = explode("ß", $board_config['specialshop']);
                $shoparraycount = count ($shoparray);
                for ($x = 0; $x < $shoparraycount; $x++)
                {
                        $temparray = explode("Þ", $shoparray[$x]);
                        $shopstatarray[] = $temparray[0];
                        $shopstatarray[] = $temparray[1];
                }
                $userprivs = array();
                $usereffects = array();
                $usercustitle = array();
                $userbs = array();
                $userprivs = explode("ß", $view_userdata['user_privs']);
                $usercount = count($userprivs);
                for ($x = 0; $x < $usercount; $x++)
                {
                        $temppriv = explode("Þ", $userprivs[$x]);
                        $userbs[] = $temppriv[0];
                        $userbs[] = $temppriv[1];
                } 
                if (($shopstatarray[6] == on) && ($userbs[2] != on))
                {
                        $img = "";
                }
                // result
                $res = pcp_output_format($field_name, $txt, $img, $map_name);
        }
        return $res;
}
//-----------------------------------
//
// user_sig output function
//
//-----------------------------------
function pcp_output_sig($field_name, $view_userdata, $map_name='')
{
        global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
        global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;
 
        $txt = '';
        $img = '';
        $res = '';
        if ( !empty($view_userdata[$field_name]) && ($view_userdata['user_id'] != ANONYMOUS) && $view_userdata['user_allow_sig'] && $userdata['user_viewsig'] )
        {
                $user_sig = $view_userdata[$field_name];
                $user_sig_bbcode_uid = $view_userdata[$field_name . '_bbcode_uid'];
                if ( !$board_config['allow_html'] && $userdata['user_allowhtml'])
                {
                        $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $user_sig);
                }
                if ($board_config['allow_bbcode'] && ($user_sig_bbcode_uid != ''))
                {
                        $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig);
                }
                $user_sig = make_clickable($user_sig);
                if ( $board_config['allow_smilies'] && $view_userdata['user_allowsmile'])
                {
                        $user_sig = smilies_pass($user_sig, true);
                }
                if (count($orig_word) > 0)
                {
                        $user_sig = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
                }
                $txt = str_replace("\n", "\n<br />\n", $user_sig);
 
                $shoparray = explode("ß", $board_config['specialshop']);
                $shoparraycount = count ($shoparray);
                for ($x = 0; $x < $shoparraycount; $x++)
                {
                        $temparray = explode("Þ", $shoparray[$x]);
                        $shopstatarray[] = $temparray[0];
                        $shopstatarray[] = $temparray[1];
                }
                $userprivs = array();
                $usereffects = array();
                $usercustitle = array();
                $userbs = array();
                $userprivs = explode("ß", $view_userdata['user_privs']);
                $usercount = count($userprivs);
                for ($x = 0; $x < $usercount; $x++)
                {
                        $temppriv = explode("Þ", $userprivs[$x]);
                        $userbs[] = $temppriv[0];
                        $userbs[] = $temppriv[1];
                } 
                if (($shopstatarray[8] == on) && ($userbs[4] != on))
                {
                        $txt = "";
                }
                // result
                $res = pcp_output_format($field_name, $txt, $img, $map_name);
        }
        return $res;
}
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM


Along with the code in the def_userfuncs_shop.php

Code:

<?php

/***************************************************************************
 *                     def_userfuncs_shop.php
 *                     ------------------------
 *   begin            : 20/10/2003
 *   copyright        : Ptirhiik
 *   email            : Ptirhiik@rpgnet.clanmckeen.com
 *
 *   New function file created and designed by psyper@bhere.net.
 *   For cash intergration tutorial at http://bhere.net/forum/pcp01.php
 *
 *   version            : 1.0.0 - 28/05/2004
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 *
 ***************************************************************************/

if ( !defined('IN_PHPBB') )
{
   die('Hacking attempt');
   exit;
}



//-----------------------------------
//
// username_effects output function
//
//-----------------------------------
function pcp_output_username_effects($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $img = '';
   $res = '';

   $poster = ($view_userdata['user_id'] != "-1") ? $view_userdata['username'] : ( (isset($view_userdata['post_username']) && ($view_userdata['post_username'] !='') ) ? $view_userdata['post_username'].' <br /><div class="gensmall">'.$lang['NonMember'].'</center></div>' : $lang['Guest'].' <br /><div class="gensmall">'.$lang['NonMember'].'</div>' );


   $usereffects = explode("ß", $view_userdata['user_effects']);
   $userprivs = explode("ß", $view_userdata['user_privs']);
   $usercustitle = explode("ß", $view_userdata['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]; }
   $shoparray = explode("ß", $board_config['specialshop']);
   $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; height:18";
      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;
   }

    $temp_url = append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $view_userdata['user_id']);
   // txt
    $class = get_user_level_class($view_userdata['user_level'], 'gen', $view_userdata);
    $txt = '<span class="' . get_user_level_class($view_userdata['user_level'], 'gen', $view_userdata) . '">' . $poster . '</span>';
   // img
   if ( $view_userdata['user_id'] != ANONYMOUS )
   {
      $temp_url = append_sid("./profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . '=' . $view_userdata['user_id']);
      $img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" border="0" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" /></a>';
   }

   // result
   $res = pcp_output_format($field_name, $txt, $img, $map_name);
   return $res;
}
//-----------------------------------
//
// user_inventory_topics output function
//
//-----------------------------------
function pcp_output_inventory_topics($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $res = '';
   $img = '';
   if  ( $view_userdata['user_id'] != ANONYMOUS )
   {
   if ($board_config['viewtopic'] == "images")
   {
      $itempurge = str_replace("Þ", "", $view_userdata['user_items']);
      $itemarray = explode('ß',$itempurge);
      $itemcount = count ($itemarray);
      $user_items = "<br>";
           for ($xe = 0;$xe < $itemcount;$xe++)
      {
         if ($itemarray[$xe] != NULL)
         {
            if ($board_config['viewtopiclimit'] < $xe) { $user_items .= ' <a href="'.append_sid("shop.".$phpEx."?action=inventory&searchid=".$view_userdata['user_id']).'" title="'.$view_userdata['username'].'\'sInventory"><br />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].'">';
            }
         }
      }
   }
   $img = $user_items;
    if ($board_config['viewtopic'] == "link")
   {
    $temp_url = append_sid("./shop.php?action=inventory&searchid=" . $view_userdata['user_id']);
    $usernameurl = '<a href="' . $temp_url . '">' . $lang['user_inventory_link'] .'</a>';
    $img = $lang['Shop'] . ':&nbsp;'. $usernameurl;
   }
      $res = pcp_output_format($field_name, $txt, $img, $map_name);
   }
   return $res;
}
//-----------------------------------
//
// user_inventory_profile output function
//
//-----------------------------------
function pcp_output_inventory_profile($field_name, $view_userdata, $map_name='')
{
   global $board_config, $phpbb_root_path, $phpEx, $lang, $images, $userdata;
   global $values_list, $tables_linked, $classes_fields, $user_maps, $user_fields;

   $txt = '';
   $res = '';
   $img = '';
   if ($board_config['viewprofile'] == "images")
   {
      $itempurge = str_replace("Þ", "", $view_userdata['user_items']);
      $itemarray = explode('ß',$itempurge);
      $itemcount = count ($itemarray);
      $user_items = "<br>";
           for ($xe = 0;$xe < $itemcount;$xe++)
      {
         if ($itemarray[$xe] != NULL)
         {
            if ($board_config['viewtopiclimit'] < $xe) { $user_items .= ' <a href="'.append_sid("shop.".$phpEx."?action=inventory&searchid=".$view_userdata['user_id']).'" title="'.$view_userdata['username'].'\'sInventory"><br />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].'">';
            }
         }
      }
   }
   $img = $user_items;
    if ($board_config['viewprofile'] == "link")
   {
    $temp_url = append_sid("./shop.php?action=inventory&searchid=" . $view_userdata['user_id']);
    $usernameurl = '<a href="' . $temp_url . '">' . $lang['user_inventory_link'] .'</a>';
    $img = $usernameurl;
   }
      $res = pcp_output_format($field_name, $txt, $img, $map_name);
   return $res;
}
?>


What do you think I need to change?
 

Thoul
Administrator

Sun Aug 27, 2006 10:39 am   Post subject: re: PCP and the new Shop MOd w/ effects
A lot of stuff will need to be changed for the Effects Store, and from what I can see a fair bit for Shop 3 also. With such extensive changes, I want to test the code before I give you any. I'll download PCP today and try to do a test install and see what I can work out on that.
 

Pogue Moran
Member

Sun Aug 27, 2006 3:25 pm   Post subject: re: PCP and the new Shop MOd w/ effects
Thanks Thoul. I would use your effects shop for the old shop mod I just cant figure out how to make it save the changes with PCP
 

Thoul
Administrator

Sun Aug 27, 2006 3:36 pm   Post subject: re: PCP and the new Shop MOd w/ effects
My Effects Shop won't work with the old Shop mod anyway. The admin panel parts don't play together very well. Laughing
 

Pogue Moran
Member

Sun Aug 27, 2006 4:02 pm   Post subject:
Maybe you should tell them to play nice smith. They need to learn to get along
 

Thoul
Administrator

Mon Aug 28, 2006 11:13 am   Post subject: re: PCP and the new Shop MOd w/ effects
Laughing Yeah, I'll see if I can get the two of them to behave. Very Happy
 

Pogue Moran
Member

Thu Aug 31, 2006 10:44 am   Post subject:
Awesome Smile let me know if you make progress with PHP I would really like to readd this to my board I had to go back to 2 until things are figured out
 

Thoul
Administrator

Thu Aug 31, 2006 11:10 am   Post subject: re: PCP and the new Shop MOd w/ effects
Hopefully I can get something out next week. This week has turned out to be busier at work than I expected. I have this planned out, so it's just a matter of getting it together and making sure it works.
 

Thoul
Administrator

Thu Sep 07, 2006 1:41 pm   Post subject: re: PCP and the new Shop MOd w/ effects
Ok, the Shop 3 for PCP instructions are done. You can find them at http://www.phpbbsmith.com/hacks/shop_pcp.php.
 

Pogue Moran
Member

Thu Sep 07, 2006 9:54 pm   Post subject: Re: re: PCP and the new Shop MOd w/ effects

Thoul wrote:

Ok, the Shop 3 for PCP instructions are done. You can find them at http://www.phpbbsmith.com/hacks/shop_pcp.php.


You are awesome. One problem that I had even with the old effects shop is that I could never change my rank color even though I bought the option. Is there something I need to do to fix this? I have the rank categories mod installed but that shouldn't effect the rank title. Let me know what you think. Users can't create custom titles even when they pay for them. I would like the options in the effects shops of what can be allowed to be done say for instance if I want the default as avatars have to be bought or not, whether custom ranks are allowed.

Second how about along with the custom rank the ability to pay to upload a custom rank image to go with it?
 

Page 1 of 5
Go to page 1, 2, 3, 4, 5  Next
Display posts from previous: