Aktives Mitglied
Hallo
Mein Forum ist auf phpbb3 . Hab den Shop Mod eingebaut :
Shop Mod v.1.0.b3
Wenn man sich ein Item kauft wird das ja in den user Profilen angezeigt , wegen dem script :
Jetzt will ich aber das die Items (Bilder) in den User Profilen klein angezeigt werden. Ich könnte die ganzen Bilder jetzt verkleinern ... aber dann wären sie ja auch im shop so klein ... . Ich will nur das sie in den user profilen klein angezeigt werden (damit es übersichtlicher ist).Was muss ich dazu machen ?
Hier mal die anleitung :
Hier mal die shop_actions.php datei :
und hier shop_inventory.php :
wenn eine andere datei gebraucht wird , bitte bescheid sagen.
Wer würde das hinbekommen und kann mir weiterhelfen ?
MFG
Mein Forum ist auf phpbb3 . Hab den Shop Mod eingebaut :
Shop Mod v.1.0.b3
Wenn man sich ein Item kauft wird das ja in den user Profilen angezeigt , wegen dem script :
Code:
[B]Open: styles/prosilver/template/memberlist_view.html[/B]
[B]Find[/B]
[B]Tip:[/B] This may be a partial find and not the whole line.
Code:Select All
<!-- IF USE_BANK -->
<dt>Bank:</dt>
<dd><!-- IF U_BLOCKED --><b>{L_LOCKED}</b><!-- ELSE --> {BANK_GOLD} {P_NAME} <a href="{U_BANK_MODIFY}">{L_MOD_USER_BANK}</a><!-- ENDIF --></dd>
<!-- ENDIF -->
[B]Add after[/B]
[B]Tip:[/B] Add these lines on a new blank line after the preceding line(s) to find.
Code:Select All
<!-- IF USE_SHOP --><dd><strong><a href="./shop.php?action=inventory&searchid={USER_ID}">Shop Item</a>:</strong>{ITEMS}</dd><!-- ENDIF -->
Hier mal die anleitung :
Code:
[B]Files to Edit[/B]
[LIST]
[*]includes/constants.php,
[*]includes/acp/acp_main.php,
[*]includes/functions.php,
[*]includes/acp/acp_users.php,
[*]adm/style/acp_users_profile.html,
[*]viewtopic.php,
[*]memberlist.php,
[*]language/en/common.php,
[*]language/en/acp/permissions_phpbb.php,
[*]styles/prosilver/template/viewtopic_body.html,
[*]styles/prosilver/template/memberlist_view.html,
[*]styles/prosilver/template/overall_header.html,
[*]styles/prosilver/theme/bidi.css,
[*]styles/prosilver/theme/buttons.css,
[*]styles/prosilver/theme/colours.css
[/LIST]
[B]Included Files[/B]
[LIST]
[*]root/adm/style/acp_shop.html,
[*]root/adm/style/acp_shop_edit.html,
[*]root/adm/style/acp_shop_item.html,
[*]root/adm/style/acp_shop_manage.html,
[*]root/adm/style/acp_special_shop.html,
[*]root/includes/acp/info/acp_shop.php,
[*]root/includes/acp/acp_shop.php,
[*]root/includes/functions_shop.php,
[*]root/language/en/mods/shop_special.php,
[*]root/language/en/lang_shop.php,
[*]root/shop/images/buy.jpg,
[*]root/shop/images/no_icon.jpeg,
[*]root/shop/images/sell.jpg,
[*]root/shop/shop_special.php,
[*]root/styles/prosilver/template/shop_action_discard.html,
[*]root/styles/prosilver/template/shop_action_give.html,
[*]root/styles/prosilver/template/shop_action_trade.html,
[*]root/styles/prosilver/template/shop_buy.html,
[*]root/styles/prosilver/template/shop_districts.html,
[*]root/styles/prosilver/template/shop_inventory_body.html,
[*]root/styles/prosilver/template/shop_item_body.html,
[*]root/styles/prosilver/template/shop_list.html,
[*]root/styles/prosilver/template/shop_list_body.html,
[*]root/styles/prosilver/template/shop_sell.html,
[*]root/styles/prosilver/theme/images/icon_shop.gif,
[*]root/shop.php,
[*]root/shop_actions.php,
[*]root/shop_bs.php,
[*]root/shop_install.php,
[*]root/shop_install.php
[/LIST]
Code:
<?php
/**
*
* @package shop
* @version $Id: shop_actions.php,v 0.1.3 2009/02/23 23:51:58 doktorx Exp $
* @copyright (c) 2008 doktorx
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . '/includes/mods/functions_points.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('lang_shop');
//Get data about points
$sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
$result = $db->sql_query($sql);
$Points = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//Check if you have acces to points
if (!$auth->acl_get('u_use_points'))
{
trigger_error('NOT_AUTHORISED');
}
//Check if you have acces to the shop
if (!$auth->acl_get('u_use_shop'))
{
trigger_error('NOT_AUTHORISED');
}
//Check if shop is enabled
if (!$config['shop_enabled'])
{
trigger_error('SHOP_DISABLED');
}
// Start functions
function userhasitem($checkusername, $checkitemname)
{
global $user, $item_names, $item_true_ids, $db;
if ( $user->data['username'] == $checkusername )
{
if ( !in_array($checkitemname, $item_true_ids) ) { return false; }
}
else
{
$user_info = get_userdata($checkusername);
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user_info['user_id']}
AND id = " . intval($checkitemname);
$result = $db->sql_query($sql);
if ( !($db->sql_affectedrows($result)) ) { return false; }
}
return true;
}
function checkgold($checkusername, $checkgold)
{
$checkinguser = get_userdata($checkusername);
if ($checkinguser['points'] < $checkgold) { return false; }
else { return true; }
}
function checkitemarray($checkusername, $checkitems)
{
$arrayitems = explode('::', $checkitems);
$arraycount = count($arrayitems);
$checkinguser = get_userdata($checkusername);
for ($x = 0; $x < $arraycount; $x++)
{
if ( !empty($arrayitems[$x]) )
{
if ( !(userhasitem($checkusername, $arrayitems[$x])) ) { return false; }
}
}
return true;
}
function cleartrade($user_id)
{
global $db;
$sql = "UPDATE " . USERS_TABLE . "
SET user_trade = ''
WHERE user_id = " . intval($user_id);
$db->sql_query($sql);
}
// End functions
// Begin register variables
$action = ( isset($_POST['action']) ) ? $_POST['action'] : $_GET['action'];
$itemname = utf8_normalize_nfc(request_var('itemname', '', true));
$tradeitems = request_var('tradeitems', '');
$otheritems = request_var('otheritems', '');
$errormessage = request_var('errormessage', '');
// Pull user items into an ARRAY to use later
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND worn = 0";
$result = $db->sql_query($sql);
$item_names = array();
$item_ids = array();
$item_true_ids = array();
$user_items = '';
while ( $row = $db->sql_fetchrow($result) )
{
$item_names[] = $row['item_name'];
$item_ids[] = $row['item_id'];
$item_true_ids[] = $row['id'];
$user_items .= '<option value="' . $row['id'] . '">' . $row['item_name'] . '</option>';
}
if ( empty($user_items) ) { $user_items = '<option>' . $user->lang['NOTHING'] . '</option>'; }
if (empty($action))
{
redirect(append_sid("shop.$phpEx"));
}
//
// Begin give checks!
//
elseif ( $action == 'give' )
{
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$template->set_filenames(array(
'body' => 'shop_action_give.html')
);
$template->assign_block_vars('switch_select_items', array(
'USER_ITEMS' => $user_items,
'U_GIVE' => append_sid("shop_actions.$phpEx?action=confirmgive")
));
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid=' . $user->data['user_id'] . '" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_GIVE_ITEMS'] . '</a>';
$title = $user->lang['SHOP_GIVE_ITEMS'];
page_header($user->lang['SHOP_GIVE_ITEMS']);
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_SHOP_TITLE' => $title,
'L_POINTS_NAME' => $Points['points_name']
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'confirmgive' )
{
$username = utf8_normalize_nfc(request_var('username', '', true));
if ( isset($_GET['itemname']) || isset($_POST['itemname']) ) { $itemname = ( isset($_POST['itemname']) ) ? $_POST['itemname'] : $_GET['itemname']; }
else { $itemname = ''; }
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$message = ( isset($_POST['message']) ) ? htmlspecialchars($_POST['message']) : htmlspecialchars($_GET['message']);
$template->set_filenames(array(
'body' => 'shop_action_give.html')
);
//check if trying to give item to self
if ( strtolower($user->data['username']) == strtolower($username)) { trigger_error($user->lang['SHOP_GIVING_SELF']); }
//make sure the user exists
$otheruser = get_userdata(stripslashes($username));
if( !($otheruser['user_id']) ) { trigger_error($user->lang['SHOP_NO_USER']); }
$item_list = implode(", ", $itemname);
if ($item_name = 'Nothing')
{
trigger_error('SELECT_AN_ITEM');
}
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND id IN (" . str_replace("\'", "''", $item_list) . ")";
$result = $db->sql_query($sql);
$count = $db->sql_affectedrows($result);
if ( !($count) ) { trigger_error($user->lang['SHOP_INVALID_ITEM']); }
$itemname = array();
$item_names = '';
for ( $i = 0; $i < $count; $i++ )
{
$row = $db->sql_fetchrow($result);
$item_names .= ( ( empty($item_names) ) ? '' : ', ' ) . $row['item_name'];
$itemname[] = $row['id'];
}
if ( !empty($message) ) { $msg = ' ' . $user->lang['SHOP_WITH_MSG'] . ': <b>' . $message . '</b>'; }
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_GIVE_ITEMS'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_CONFIRM_GIVE'] . '</a>';
$title = $user->lang['SHOP_GIVE_ITEMS'];
page_header($user->lang['SHOP_GIVE_ITEMS']);
$template->assign_block_vars('switch_confirm_give', array(
'ITEM_LIST' => base64_encode(******ize($itemname)),
'ITEM_NAMES' => $item_names,
'USERNAME' => stripslashes(htmlspecialchars($username)),
'MESSAGE' => stripslashes($message),
'U_GIVE' => append_sid("shop_actions.$phpEx?action=giveitem")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => sprintf($user->lang['SHOP_GIVE_EXPLAIN2'], $item_names, $username),
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ($action == 'giveitem')
{
$username = utf8_normalize_nfc(request_var('username', '', true));
$itemlist = request_var('itemlist', '');
$item_name = utf8_normalize_nfc(request_var('item_name', '', true));
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$message = ( isset($_POST['message']) ) ? stripslashes(htmlspecialchars($_POST['message'])) : stripslashes(htmlspecialchars($_GET['message']));
//begin secondary checks
//check if trying to give item to self
//make sure the user exists
$otheruser = get_userdata(stripslashes($username));
if( !($otheruser['user_id']) ) { trigger_error($user->lang['SHOP_NO_USER']); }
if (strtolower($user->data['username']) == strtolower($username)) { trigger_error($user->lang['SHOP_GIVING_SELF']); }
//end secondary checks
$title = $user->lang['SHOP_ITEM_GIVEN'];
page_header($user->lang['SHOP_ITEM_GIVEN']);
$item_array = un******ize(base64_decode($itemlist));
$itemlist = implode(", ", $item_array);
$count = (substr_count($itemlist, ',') + 1);
//take the item away from the user and give it to recipient
$sql = "UPDATE " . USER_ITEMS_TABLE . "
SET user_id = {$otheruser['user_id']}
WHERE user_id = {$user->data['user_id']}
AND id IN (" . str_replace("\'", "''", $itemlist) . ")
AND worn = 0
LIMIT " . $count;
$db->sql_query($sql);
// Send a message when you receive a item.
$pm_subject = utf8_normalize_nfc(sprintf($user->lang['SHOP_GIVE_PM']));
$pm_text = utf8_normalize_nfc(sprintf($user->lang['SHOP_GIVE_PM_TEXT'], $user->data['username']));
$poll = $uid = $bitfield = $options = '';
generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
$pm_data = array(
'address_list' => array ('u' => array($otheruser['user_id'] => 'to')),
'from_user_id' => $user->data['user_id'],
'from_username' => 'Shop Robot',
'icon_id' => 0,
'from_user_ip' => '',
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $pm_text,
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
);
submit_pm('post', $pm_subject, $pm_data, false);
$msg = ( !empty($message) ) ? "\r\n\r\n" . $user->data['username'] . $user->lang['SHOP_MSG_INCLUDED'] . ": \r\n" . $message . "." : '';
// Transaction Code!
$sql = "INSERT
INTO " . TRANS_TABLE . "
(user_id, target_id, target_name, type, action, value, timestamp, ip, misc)
values({$user->data['user_id']}, {$otheruser['user_id']}, '" . str_replace("'", "''", $otheruser['username']) . "', 'shop', 'give', '" . str_replace("\'", "''", $item_name) . " :: " . $item_name . "', " . time() . ", '{$user->data['user_ip']}', '')";
$db->sql_query($sql);
trigger_error(sprintf($user->lang['SHOP_GIVE_EXIT'], $username, $item_name));
}
//
// End give checks
elseif ( ($action == 'discard') || ($action == 'confirmdiscard') || ($action == 'discarditem') )
{
if (!$auth->acl_get('u_use_shop_discard'))
{
trigger_error($user->lang['SHOP_DISCARD_DISABLED']);
}
if (!$config['shop_discard'])
{
trigger_error($user->lang['SHOP_DISCARD_DISABLED']);
}
$item_id = request_var('item_id', '');
if ( $action == 'discard' )
{
$template->set_filenames(array(
'body' => 'shop_action_discard.html')
);
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['DISCARD'] . '</a>';
$title = $user->lang['SHOP_DISCARD_ITEM'];
page_header($user->lang['SHOP_DISCARD_ITEM']);
$template->assign_block_vars('switch_select_discard', array(
'USER_ITEMS' => $user_items,
'U_DISCARD' => append_sid("shop_actions.$phpEx?action=confirmdiscard")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => $user->lang['SHOP_DISCARD_EXPLAIN1'],
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'confirmdiscard' )
{
$template->set_filenames(array(
'body' => 'shop_action_discard.html')
);
//make sure user has item, prevents exploit
if (!(userhasitem($user->data['username'], $item_id))) { trigger_error($user->lang['shop_donthave_item']); }
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['inventory'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['discard'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['shop_discard_confirm'] . '</a>';
$title = $user->lang['SHOP_DISCARD_CONFIRM'];
page_header($user->lang['SHOP_DISCARD_CONFIRM']);
$template->assign_block_vars('switch_confirm_discard', array(
'ITEM_ID' => $item_id,
'U_DISCARD' => append_sid("shop_actions.$phpEx?action=discarditem")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => sprintf($user->lang['SHOP_DISCARD_EXPLAIN2'], $row['item_name']),
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'discarditem' )
{
//make sure user has item, prevents exploit
if (!(userhasitem($user->data['username'], $item_id))) { trigger_error($user->lang['SHOP_DONTHAVE_ITEM']); }
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sql = "DELETE FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}
LIMIT 1";
$db->sql_query($sql);
trigger_error(sprintf($user->lang['SHOP_DISCARD_EXIT'], $row['item_name']) . '<br /><br />' . sprintf($user->lang['U_INDEX'], '<a href="' . append_sid('index.' . $phpEx) . '" class="gen">', '</a>'));
}
}
// End discard checks, create final else.
else { trigger_error($user->lang['INVALID_COMMAND']); }
page_footer();
?>
Code:
<?php
/**
*
* @package shop
* @version $Id: shop_actions.php,v 0.1.3 2009/02/23 23:51:58 doktorx Exp $
* @copyright (c) 2008 doktorx
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include_once($phpbb_root_path . '/includes/mods/functions_points.' . $phpEx);
include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('lang_shop');
//Get data about points
$sql = 'SELECT * FROM ' . POINTS_CONFIG_TABLE;
$result = $db->sql_query($sql);
$Points = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//Check if you have acces to points
if (!$auth->acl_get('u_use_points'))
{
trigger_error('NOT_AUTHORISED');
}
//Check if you have acces to the shop
if (!$auth->acl_get('u_use_shop'))
{
trigger_error('NOT_AUTHORISED');
}
//Check if shop is enabled
if (!$config['shop_enabled'])
{
trigger_error('SHOP_DISABLED');
}
// Start functions
function userhasitem($checkusername, $checkitemname)
{
global $user, $item_names, $item_true_ids, $db;
if ( $user->data['username'] == $checkusername )
{
if ( !in_array($checkitemname, $item_true_ids) ) { return false; }
}
else
{
$user_info = get_userdata($checkusername);
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user_info['user_id']}
AND id = " . intval($checkitemname);
$result = $db->sql_query($sql);
if ( !($db->sql_affectedrows($result)) ) { return false; }
}
return true;
}
function checkgold($checkusername, $checkgold)
{
$checkinguser = get_userdata($checkusername);
if ($checkinguser['points'] < $checkgold) { return false; }
else { return true; }
}
function checkitemarray($checkusername, $checkitems)
{
$arrayitems = explode('::', $checkitems);
$arraycount = count($arrayitems);
$checkinguser = get_userdata($checkusername);
for ($x = 0; $x < $arraycount; $x++)
{
if ( !empty($arrayitems[$x]) )
{
if ( !(userhasitem($checkusername, $arrayitems[$x])) ) { return false; }
}
}
return true;
}
function cleartrade($user_id)
{
global $db;
$sql = "UPDATE " . USERS_TABLE . "
SET user_trade = ''
WHERE user_id = " . intval($user_id);
$db->sql_query($sql);
}
// End functions
// Begin register variables
$action = ( isset($_POST['action']) ) ? $_POST['action'] : $_GET['action'];
$itemname = utf8_normalize_nfc(request_var('itemname', '', true));
$tradeitems = request_var('tradeitems', '');
$otheritems = request_var('otheritems', '');
$errormessage = request_var('errormessage', '');
// Pull user items into an ARRAY to use later
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND worn = 0";
$result = $db->sql_query($sql);
$item_names = array();
$item_ids = array();
$item_true_ids = array();
$user_items = '';
while ( $row = $db->sql_fetchrow($result) )
{
$item_names[] = $row['item_name'];
$item_ids[] = $row['item_id'];
$item_true_ids[] = $row['id'];
$user_items .= '<option value="' . $row['id'] . '">' . $row['item_name'] . '</option>';
}
if ( empty($user_items) ) { $user_items = '<option>' . $user->lang['NOTHING'] . '</option>'; }
if (empty($action))
{
redirect(append_sid("shop.$phpEx"));
}
//
// Begin give checks!
//
elseif ( $action == 'give' )
{
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$template->set_filenames(array(
'body' => 'shop_action_give.html')
);
$template->assign_block_vars('switch_select_items', array(
'USER_ITEMS' => $user_items,
'U_GIVE' => append_sid("shop_actions.$phpEx?action=confirmgive")
));
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid=' . $user->data['user_id'] . '" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_GIVE_ITEMS'] . '</a>';
$title = $user->lang['SHOP_GIVE_ITEMS'];
page_header($user->lang['SHOP_GIVE_ITEMS']);
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_SHOP_TITLE' => $title,
'L_POINTS_NAME' => $Points['points_name']
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'confirmgive' )
{
$username = utf8_normalize_nfc(request_var('username', '', true));
if ( isset($_GET['itemname']) || isset($_POST['itemname']) ) { $itemname = ( isset($_POST['itemname']) ) ? $_POST['itemname'] : $_GET['itemname']; }
else { $itemname = ''; }
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$message = ( isset($_POST['message']) ) ? htmlspecialchars($_POST['message']) : htmlspecialchars($_GET['message']);
$template->set_filenames(array(
'body' => 'shop_action_give.html')
);
//check if trying to give item to self
if ( strtolower($user->data['username']) == strtolower($username)) { trigger_error($user->lang['SHOP_GIVING_SELF']); }
//make sure the user exists
$otheruser = get_userdata(stripslashes($username));
if( !($otheruser['user_id']) ) { trigger_error($user->lang['SHOP_NO_USER']); }
$item_list = implode(", ", $itemname);
if ($item_name = 'Nothing')
{
trigger_error('SELECT_AN_ITEM');
}
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE user_id = {$user->data['user_id']}
AND id IN (" . str_replace("\'", "''", $item_list) . ")";
$result = $db->sql_query($sql);
$count = $db->sql_affectedrows($result);
if ( !($count) ) { trigger_error($user->lang['SHOP_INVALID_ITEM']); }
$itemname = array();
$item_names = '';
for ( $i = 0; $i < $count; $i++ )
{
$row = $db->sql_fetchrow($result);
$item_names .= ( ( empty($item_names) ) ? '' : ', ' ) . $row['item_name'];
$itemname[] = $row['id'];
}
if ( !empty($message) ) { $msg = ' ' . $user->lang['SHOP_WITH_MSG'] . ': <b>' . $message . '</b>'; }
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_GIVE_ITEMS'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=give" class="nav">' . $user->lang['SHOP_CONFIRM_GIVE'] . '</a>';
$title = $user->lang['SHOP_GIVE_ITEMS'];
page_header($user->lang['SHOP_GIVE_ITEMS']);
$template->assign_block_vars('switch_confirm_give', array(
'ITEM_LIST' => base64_encode(******ize($itemname)),
'ITEM_NAMES' => $item_names,
'USERNAME' => stripslashes(htmlspecialchars($username)),
'MESSAGE' => stripslashes($message),
'U_GIVE' => append_sid("shop_actions.$phpEx?action=giveitem")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => sprintf($user->lang['SHOP_GIVE_EXPLAIN2'], $item_names, $username),
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ($action == 'giveitem')
{
$username = utf8_normalize_nfc(request_var('username', '', true));
$itemlist = request_var('itemlist', '');
$item_name = utf8_normalize_nfc(request_var('item_name', '', true));
if (!$auth->acl_get('u_use_shop_give'))
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
if (!$config['shop_give'])
{
trigger_error($user->lang['SHOP_GIVE_DISABLED']);
}
$message = ( isset($_POST['message']) ) ? stripslashes(htmlspecialchars($_POST['message'])) : stripslashes(htmlspecialchars($_GET['message']));
//begin secondary checks
//check if trying to give item to self
//make sure the user exists
$otheruser = get_userdata(stripslashes($username));
if( !($otheruser['user_id']) ) { trigger_error($user->lang['SHOP_NO_USER']); }
if (strtolower($user->data['username']) == strtolower($username)) { trigger_error($user->lang['SHOP_GIVING_SELF']); }
//end secondary checks
$title = $user->lang['SHOP_ITEM_GIVEN'];
page_header($user->lang['SHOP_ITEM_GIVEN']);
$item_array = un******ize(base64_decode($itemlist));
$itemlist = implode(", ", $item_array);
$count = (substr_count($itemlist, ',') + 1);
//take the item away from the user and give it to recipient
$sql = "UPDATE " . USER_ITEMS_TABLE . "
SET user_id = {$otheruser['user_id']}
WHERE user_id = {$user->data['user_id']}
AND id IN (" . str_replace("\'", "''", $itemlist) . ")
AND worn = 0
LIMIT " . $count;
$db->sql_query($sql);
// Send a message when you receive a item.
$pm_subject = utf8_normalize_nfc(sprintf($user->lang['SHOP_GIVE_PM']));
$pm_text = utf8_normalize_nfc(sprintf($user->lang['SHOP_GIVE_PM_TEXT'], $user->data['username']));
$poll = $uid = $bitfield = $options = '';
generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
$pm_data = array(
'address_list' => array ('u' => array($otheruser['user_id'] => 'to')),
'from_user_id' => $user->data['user_id'],
'from_username' => 'Shop Robot',
'icon_id' => 0,
'from_user_ip' => '',
'enable_bbcode' => true,
'enable_smilies' => true,
'enable_urls' => true,
'enable_sig' => true,
'message' => $pm_text,
'bbcode_bitfield' => $bitfield,
'bbcode_uid' => $uid,
);
submit_pm('post', $pm_subject, $pm_data, false);
$msg = ( !empty($message) ) ? "\r\n\r\n" . $user->data['username'] . $user->lang['SHOP_MSG_INCLUDED'] . ": \r\n" . $message . "." : '';
// Transaction Code!
$sql = "INSERT
INTO " . TRANS_TABLE . "
(user_id, target_id, target_name, type, action, value, timestamp, ip, misc)
values({$user->data['user_id']}, {$otheruser['user_id']}, '" . str_replace("'", "''", $otheruser['username']) . "', 'shop', 'give', '" . str_replace("\'", "''", $item_name) . " :: " . $item_name . "', " . time() . ", '{$user->data['user_ip']}', '')";
$db->sql_query($sql);
trigger_error(sprintf($user->lang['SHOP_GIVE_EXIT'], $username, $item_name));
}
//
// End give checks
elseif ( ($action == 'discard') || ($action == 'confirmdiscard') || ($action == 'discarditem') )
{
if (!$auth->acl_get('u_use_shop_discard'))
{
trigger_error($user->lang['SHOP_DISCARD_DISABLED']);
}
if (!$config['shop_discard'])
{
trigger_error($user->lang['SHOP_DISCARD_DISABLED']);
}
$item_id = request_var('item_id', '');
if ( $action == 'discard' )
{
$template->set_filenames(array(
'body' => 'shop_action_discard.html')
);
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['INVENTORY'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['DISCARD'] . '</a>';
$title = $user->lang['SHOP_DISCARD_ITEM'];
page_header($user->lang['SHOP_DISCARD_ITEM']);
$template->assign_block_vars('switch_select_discard', array(
'USER_ITEMS' => $user_items,
'U_DISCARD' => append_sid("shop_actions.$phpEx?action=confirmdiscard")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => $user->lang['SHOP_DISCARD_EXPLAIN1'],
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'confirmdiscard' )
{
$template->set_filenames(array(
'body' => 'shop_action_discard.html')
);
//make sure user has item, prevents exploit
if (!(userhasitem($user->data['username'], $item_id))) { trigger_error($user->lang['shop_donthave_item']); }
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$shoplocation = ' -> <a href="shop.' . $phpEx . '?action=inventory&searchid='.$user->data['user_id'].'" class="nav">' . $user->lang['inventory'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['discard'] . '</a> -> <a href="shop_actions.' . $phpEx . '?action=discard" class="nav">' . $user->lang['shop_discard_confirm'] . '</a>';
$title = $user->lang['SHOP_DISCARD_CONFIRM'];
page_header($user->lang['SHOP_DISCARD_CONFIRM']);
$template->assign_block_vars('switch_confirm_discard', array(
'ITEM_ID' => $item_id,
'U_DISCARD' => append_sid("shop_actions.$phpEx?action=discarditem")
));
$template->assign_vars(array(
'USER_POINTS' => $user->data['points'],
'U_INVENTORY' => append_sid("shop.$phpEx?action=inventory&searchid=".$user->data['user_id']),
'L_POINTS_NAME' => $Points['points_name'],
'L_EXPLAIN' => sprintf($user->lang['SHOP_DISCARD_EXPLAIN2'], $row['item_name']),
'L_SHOP_TITLE' => $title
));
$template->assign_block_vars('', array());
}
elseif ( $action == 'discarditem' )
{
//make sure user has item, prevents exploit
if (!(userhasitem($user->data['username'], $item_id))) { trigger_error($user->lang['SHOP_DONTHAVE_ITEM']); }
$sql = "SELECT *
FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$sql = "DELETE FROM " . USER_ITEMS_TABLE . "
WHERE id = $item_id
AND user_id = {$user->data['user_id']}
LIMIT 1";
$db->sql_query($sql);
trigger_error(sprintf($user->lang['SHOP_DISCARD_EXIT'], $row['item_name']) . '<br /><br />' . sprintf($user->lang['U_INDEX'], '<a href="' . append_sid('index.' . $phpEx) . '" class="gen">', '</a>'));
}
}
// End discard checks, create final else.
else { trigger_error($user->lang['INVALID_COMMAND']); }
page_footer();
?>
Wer würde das hinbekommen und kann mir weiterhelfen ?
MFG