Hướng dẫn Install uCash & uShop cho vbb forum Bước 1 - Upload Upload tất cả các file uCash & uShop lên root của bạn theo thứ tự. Bước 2 - Install file Quá trình install sẽ thêm các templates, phrases, database fields/tables. Chạy install theo link sau: http://yoursite.com/forum/admincp/ushop_install.php. Bước 3 - File Thay đổi 1. Mở file /forum/admincp/forum.php: (2 Changes) Tìm: Mã: 'warnall' => 0 Thay thế bằng đoạn code sau: Mã: // ## <ucs> 'warnall' => 0, 'uttpoints_perthread' => 1, 'uttpoints_perreply' => 1, 'uttpoints_perview' => 1 // ## </ucs> Tìm tiếp: Mã: print_yes_no_row($vbphrase['show_forum_on_forum_jump'], 'options[showonforumjump]', $forum['showonforumjump']); Thêm vào bên dưới: Mã: // ## <ucs> $vbphrase['uttpoints_forumoptions_title'] = "uTT Points System Options"; $vbphrase['uttpoints_forumoptions_perthread'] = "Points Per Thread?<dfn>This setting is multiplied by the default value defined in the 'vBulletin Options' page of the Admin CP. A value of 1 uses the default, 2 doubles it, etc.</dfn>"; $vbphrase['uttpoints_forumoptions_perreply'] = "Points Per Reply?<dfn>This setting is multiplied by the default value defined in the 'vBulletin Options' page of the Admin CP. A value of 1 uses the default, 2 doubles it, etc.</dfn>"; $vbphrase['uttpoints_forumoptions_perview'] = "Points Per View?<dfn>This setting is multiplied by the default value defined in the 'vBulletin Options' page of the Admin CP. A value of 1 uses the default, 2 doubles it, etc.</dfn>"; print_table_header($vbphrase['uttpoints_forumoptions_title']); print_input_row($vbphrase['uttpoints_forumoptions_perthread'], 'forum[uttpoints_perthread]', $forum['uttpoints_perthread']); print_input_row($vbphrase['uttpoints_forumoptions_perreply'], 'forum[uttpoints_perreply]', $forum['uttpoints_perreply']); print_input_row($vbphrase['uttpoints_forumoptions_perview'], 'forum[uttpoints_perview]', $forum['uttpoints_perview']); // ## </ucs> 2. Mở file /forum/admincp/index.php: (1 Change) Tìm: Mã: $printhr = false; if (can_administer('canadminstyles')) Thêm và trên nó: Mã: // ## <ucs> construct_nav_option("uTT Point System Settings", 'options.php?dogroup=uttpoints', '<br />'); construct_nav_option("uTT Store Settings", 'options.php?dogroup=uttstore', '<br />'); construct_nav_option("Action Manager", 'uttstoreadmin.php?do=modify', '<br />'); construct_nav_option("Add Action", 'uttstoreadmin.php?do=add', '<br />'); construct_nav_group("uTT Store Hack", '<hr />'); // ## </ucs> 3. Mở filer /forum/admincp/user.php : (1 Change) Tìm: Mã: print_input_row($vbphrase['post_count'], 'user[posts]', $user['posts']); Thêm vào bên dưới: Mã: // ## <ucs> // uTT Points System if ($vboptions['uttpoints_pointtable'] == "user") { print_input_row("Points:", "user[$vboptions[uttpoints_pointsfield]]", $user[$vboptions[uttpoints_pointsfield]]); } // ## </ucs> 4. Mở fle /forum/admincp/usergroup.php : (2 Changes) Tìm: Mã: 'profilepicmaxwidth' => 100, 'profilepicmaxheight' => 100, 'profilepicmaxsize' => 25000 Thay thế bằng: Mã: // ## <ucs> 'profilepicmaxwidth' => 100, 'profilepicmaxheight' => 100, 'profilepicmaxsize' => 25000, 'uttstore_discount' => 0 // ## </ucs> Tìm: Mã: print_yes_no_row($vbphrase['other_users_can_be_posted'], 'usergroup[canbeusernoted]', $ug_bitfield['canbeusernoted']); print_table_break(); Thêm vào bên dưới: Mã: // ## <ucs> $vbphrase['uttstore_cpusergroup_title'] = "uTT Store Settings"; $vbphrase['uttstore_cpusergroup_discount'] = "Usergroup Discount?<dfn>Set this to the percent that is taken off the normal cost for this usergroup (negative adds cost). Set to '0' to have no effect.</dfn>"; print_table_header($vbphrase['uttstore_cpusergroup_title']); print_input_row($vbphrase['uttstore_cpusergroup_discount'], 'usergroup[uttstore_discount]', $usergroup['uttstore_discount']); print_table_break(); // ## </ucs> 5. Mở file /forum/includes/functions.php file: (1 Change) Tìm: Mã: $user['musername'] = $usergroupcache["$displaygroupid"]['opentag'] . $username . $usergroupcache["$displaygroupid"]['closetag']; Thay thế bằng: Mã: // ## <ucs> $user['musername'] = $username; ($user['uttstore_italicsusername'] != '0' && $user['uttstore_italicsusername'] != '' ? $user['musername'] = "<i>" . $user['musername'] . "</i>" : ""); ($user['uttstore_boldusername'] != '0' && $user['uttstore_boldusername'] != '' ? $user['musername'] = "<b>" . $user['musername'] . "</b>" : ""); ($user['uttstore_usernamecolor'] != '0' && $user['uttstore_usernamecolor'] != '' ? $user['musername'] = "<font color=\"$user[uttstore_usernamecolor]\">" . $user['musername'] . "</font>" : ""); $user['musername'] = $usergroupcache["$displaygroupid"]['opentag'] . $user['musername'] . $usergroupcache["$displaygroupid"]['closetag']; // ## </ucs> 5. Mở file /forum/includes/functions_newpost.php : (1 Change) Tìm: Mã: $DB_site->query(" UPDATE " . TABLE_PREFIX . "user SET $doposts $dotitle lastpost = " . TIMENOW . " WHERE userid = $bbuserinfo[userid] "); Thêm vào bên dưới: Mã: // ## <ucs> // ### START UTT POINTS SYSTEM ### if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! if ($type == 'thread') { // We're doing a thread, not a reply. if ($vboptions['uttpoints_perthread'] != '0' && $foruminfo['uttpoints_perthread'] != '0') { // Both needed values are not 0... good. $givethempoints = ($vboptions['uttpoints_perthread'] * $foruminfo['uttpoints_perthread']); } } else { // This time we're replying. if ($vboptions['uttpoints_perreply'] != '0' && $foruminfo['uttpoints_perreply'] != '0') { // Both needed values are not 0... good. $givethempoints = ($vboptions['uttpoints_perreply'] * $foruminfo['uttpoints_perreply']); } } if (isset($givethempoints)) { // If they get money.... // Send the query and we're done. $DB_site->query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='$bbuserinfo[userid]'"); } } // ## </ucs> 6. Mở file /forum/includes/functions_showthread.php : (1 Change) Tìm: Mã: // do posts from ignored users Thêm vào trên nó: [code]// ## <ucs> // uTT Points System // Make it appear more like money. // Thanks g-force2k2 and Xenon! if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! $points = $post[$vboptions[uttpoints_pointsfield]]; $points = round($points, $vboptions['uttpoints_rounddecimal']); $points = number_format($points, $vboptions['uttpoints_rounddecimal'], '.', ''); } // uTT Store Hack // Note sure if I even need this, but a safety percausion anyways... $post['uttstore_glow'] = htmlspecialchars($post['uttstore_glow']); $post['uttstore_usernamecolor'] = htmlspecialchars($post['uttstore_usernamecolor']); // ## </ucs> 7. Mở file /forum/includes/init.php : (1 Change) Tìm: Mã: 'stylecache' Thay thế: [code]// ## <ucs> 'stylecache', 'utt_store_act' // ## </ucs> 8. Mở file /forum/member.php: (1 Change) Tìm: Mã: $show['profilelinks'] = iif($show['member'] OR $userinfo['showvcard'], true, false); Thêm vào bên dưới: Mã: // ## <ucs> // uTT Points System // Make it appear more like money. // Thanks g-force2k2 and Xenon! if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! $points = $userinfo[$vboptions[uttpoints_pointsfield]]; $points = round($points, $vboptions['uttpoints_rounddecimal']); $points = number_format($points, $vboptions['uttpoints_rounddecimal'], '.', ''); } // ## </ucs> 9. Mở file /forum/register.php : (1 Change) Tìm: Mã: $userid = $DB_site->insert_id(); Thêm vào bên dưới: Mã: // ## <ucs> if (intval($testreferrerid['userid']) != '0') { if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! if ($vboptions['uttpoints_pointsperreferral'] != '0') { // Needed value is not 0... good. $givethempoints = $vboptions['uttpoints_pointsperreferral']; } if (isset($givethempoints)) { // If they get money.... // Send the query and we're done. $DB_site->query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='".intval($testreferrerid['userid'])."'"); } } } // ## </ucs> 10. Mở file /forum/reputation.php : (1 Change) Tìm: Mã: $DB_site->query(" INSERT INTO " . TABLE_PREFIX . "reputation (postid, reputation, userid, whoadded, reason, dateline) VALUES ($postid, $score, $userid, $bbuserinfo[userid], '" . addslashes(fetch_censored_text($reason)) . "','" . TIMENOW . "') "); Thêm vào bên dưới: Mã: // ## <ucs> if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! if ($score > '0') { // If the amount of reputation is positive... if ($vboptions['uttpoints_pointsforgreputation'] != '0') { // Needed value is not 0... good. $givethempoints = ($vboptions['uttpoints_pointsforgreputation'] * $score); } } else { // If the amount of reputation is negative... if ($vboptions['uttpoints_pointsforbreputation'] != '0') { // Needed value is not 0... good. $givethempoints = ($vboptions['uttpoints_pointsforbreputation'] * $score); } } if (isset($givethempoints)) { // If they get money.... // Send the query and we're done. $DB_site->query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='$userinfo[userid]'"); } } // ## </ucs> 11. Mở file /forum/showthread.php : (1 Change) Tìm: Mã: // or doing it once an hour $DB_site->shutdown_query(" INSERT INTO " . TABLE_PREFIX . "threadviews (threadid) VALUES (" . intval($threadinfo['threadid']) . ')' ); } Thêm vào bên dưới: Mã: // ## <ucs> if ($vboptions['uttpoints_enablesystem'] == '1') { // It's enabled! Yay! if ($thread['postuserid'] != $bbuserinfo['userid']) { // Don't give points if the user viewing the thread is the one who created it. if ($vboptions['uttpoints_perview'] != '0' && $forum['uttpoints_perview'] != '0') { // Both needed values are not 0... good. $givethempoints = ($vboptions['uttpoints_perview'] * $forum['uttpoints_perview']); } } if (isset($givethempoints)) { // If they get money.... // Send the query and we're done. $DB_site->shutdown_query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='$thread[postuserid]'"); } } // ## </ucs> 12. Mở file /forum/global.php: (2 Changes) Tìm: Mã: // navbar construction 'navbar', 'navbar_link', Thêm vào bên dưới: Mã: 'navbar_uttstore_actions', Tìm: Mã: if (DB_QUERIES) { $pageendtime = microtime(); $starttime = explode(' ', $pagestarttime); $endtime = explode(' ', $pageendtime); $aftertime = $endtime[0] - $starttime[0] + $endtime[1] - $starttime[1]; echo "End call of global.php: $aftertime\n"; echo "\n<hr />\n\n"; } Thêm vào bên trên: Mã: // ## <ucs> // Unserialize uShop Actions. $storeactions = unserialize($datastore['utt_store_act']); // Make a list of the all the actions... foreach ($storeactions as $actionid => $theaction) { if ($theaction['active'] == "1") { $allowed = explode(",", $theaction['allowedgroups']); foreach ($allowed as $allow) { if (is_member_of(array('userid'=>$bbuserinfo['userid'], 'usergroupid'=>$bbuserinfo['usergroupid'], 'membergroupids'=>$bbuserinfo['membergroupids']), $allow)) { $canenter = "1"; } } $denied = explode(",", $theaction['deniedgroups']); foreach ($denied as $deny) { if (is_member_of(array('userid'=>$bbuserinfo['userid'], 'usergroupid'=>$bbuserinfo['usergroupid'], 'membergroupids'=>$bbuserinfo['membergroupids']), $deny)) { unset($canenter); } } if (!isset($canenter)) { $canenter = "0"; } if (THIS_SCRIPT == 'ushop') { if ($canenter == 1) { $action1[$actionid] = $theaction; } if ($theaction['showinstore'] == 1) { (isset($actioncount) ? $actioncount++ : $actioncount = "1"); } } if ($canenter == 1 && $theaction['showinstore'] == 1) { eval('$ushop_navbar .= "' . fetch_template('navbar_uttstore_actions') . '";'); } } } // The end all solution. unset($theaction); unset($storeactions); if (THIS_SCRIPT == 'ushop') { $storeactions = $action1; } unset($action1); // ## </ucs>
Bước 4 - Sửa Template Vào AdminCP 1. Trong template MEMBERINFO: (1 Change) Tìm: Mã: $vbphrase[referrals]: <strong>$referrals</strong> Thay thế: Mã: $vbphrase[referrals]: <strong>$referrals</strong><br /> <if condition="$bbuserinfo['usergroupid'] == '6'"><a href="ushop.php?do=a&shortname=admindonate&userid=$post[userid]" target="_blank">Points</a><else />Points</if>: <strong>$points</strong> (<a href="ushop.php?do=a&shortname=donate&userid=$post[userid]" target="_blank">Donate</a>) </div> </div> <else /> <div class="fieldset"> <div style="padding:$stylevar[formspacer]px"> <if condition="$bbuserinfo['usergroupid'] == '6'"><a href="ushop.php?do=a&shortname=admindonate&userid=$post[userid]" target="_blank">Points</a><else />Points</if>: <strong>$points</strong> (<a href="ushop.php?do=a&shortname=donate&userid=$post[userid]" target="_blank">Donate</a>) 2. Trong template postbit và postbit_legacy : (2 Changes) Tìm: Mã: <div id="postmenu_$post[postid]"> Thay thế: Mã: <if condition="$post['uttstore_glow']"><div id="postmenu_$post[postid]" style="width:100%; filter:Glow(color=$post[uttstore_glow], strength=5);"><else /><div id="postmenu_$post[postid]"></if> Tìm: Mã: $vbphrase[posts]: $post[posts] Thay thế: Mã: $vbphrase[posts]: $post[posts] | <if condition="$bbuserinfo['usergroupid'] == '6'"><a href="ushop.php?do=a&shortname=admindonate&userid=$post[userid]" target="_blank">Points</a><else />Points</if>: $points (<a href="ushop.php?do=a&shortname=donate&userid=$post[userid]" target="_blank">Donate</a>) 3. Trong template navbar : (2 Changes) Tìm: Mã: <td class="vbmenu_control"><a href="calendar.php?$session[sessionurl]">$vbphrase[calendar]</a></td> Thêm vào sau nó: Mã: <td id="shop" class="vbmenu_control"><a href="#shop">Store</a><script type="text/javascript"> vbmenu_register("shop");</script></td> Tìm: Mã: </div> <!-- / user cp tools menu --> </if> Thêm vào bên dưới: Mã: <!-- shop menu --> <div class="vbmenu_popup" id="shop_menu" style="display:none"> <table cellpadding="4" cellspacing="1" border="0"> <tr><td class="thead"><a href="ushop.php$session[sessionurl]">uShop Menu</a></td></tr> <tr><td class="vbmenu_option"><a href="ushop.php?do=a&shortname=bank">Bank</a></td></tr> <tr><td class="vbmenu_option"><a href="ushop.php?do=richestusers">Richest Members</a></td></tr> <tr><td class="vbmenu_option"><a href="ushop.php?do=mostsold">Most Sold</a></td></tr> <tr><td class="vbmenu_option"><a href="ushop.php?do=userhistory">History</a></td></tr> <tr><td class="thead"><a href="ushop.php$session[sessionurl]">Actions</a></td></tr> $ushop_navbar </table> </div> <!-- / shop menu --> Chúc thành công