Exemple #1
0
|| # Contact: mrpaint@gmail.com
|| # I'm a Vietnamese! Thank you for using this script
|| # Last Updated: 01:47 05-04-2009
|| #################################################################### ||
\*======================================================================*/
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'kbankadmin');
// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array('kbank');
$specialtemplates = array();
// ########################## REQUIRE BACK-END ############################
include_once './global.php';
include_once DIR . '/kbank/functions.php';
include_once DIR . '/includes/functions_misc.php';
// ###################### Check Permission ########################
if (!havePerm($vbulletin->userinfo, KBANK_PERM_ADMIN)) {
    print_stop_message('kbank_no_permission');
}
$processed = false;
// ########################################################################
// ######################### START HIDDEN SCRIPT ############################
// ########################################################################
// ###################### Forums Point Policy Manager ########################
if ($_GET['do'] == "policy_man") {
    $processed = true;
    print_cp_header("Forums Point Policy Manager");
    print_table_start();
    print_table_header('Forums Point Policy', 4);
    $heading = array('Forum', 'Per Thread', 'Per Reply', 'Per Char');
    print_cells_row($heading, 1);
    //Global Policy
 function work(&$user)
 {
     global $vbulletin, $vbphrase, $customize_userinfo_users;
     $do_username = !$customize_userinfo_users['disable_username'];
     $do_usertitle = !$customize_userinfo_users['disable_usertitle'];
     $myself = $vbulletin->userinfo['userid'] == $this->data['userid'];
     $tmp_user =& $customize_userinfo_users["{$this->data['userid']}"];
     $options = $this->data['options'];
     $itemtypeoptions = $this->itemtypedata['options'];
     $errors =& $vbulletin->kbank['errors'][$this->data['itemid']];
     if ($itemtypeoptions['username_smilies']) {
         $tmp_user['options']['smilies'][$this->data['itemid']] = $itemtypeoptions['username_smilies'];
     }
     if ($do_username || $myself) {
         if ($itemtypeoptions['username_max'] and $options['username']) {
             $tmp_user['username'] = fetch_censored_text(substr($options['username'], 0, $itemtypeoptions['username_max']));
         }
         if ($itemtypeoptions['username_colors'] and $options['username_color'] and in_array($options['username_color'], explode(',', $itemtypeoptions['username_colors']))) {
             $tmp_user['username_style']['color'] = "color: {$options['username_color']}";
         }
         if ($itemtypeoptions['username_strong']) {
             if ($options['username_strong']) {
                 $tmp_user['username_style']['strong'] = "font-weight: bold";
             } else {
                 $tmp_user['username_style']['strong'] = "font-weight: normal";
             }
         }
         if (count($tmp_user['username_style']) > 0) {
             $prefix = "<span style=\"" . implode('; ', $tmp_user['username_style']) . "\"" . iif(havePerm($vbulletin->userinfo, KBANK_PERM_ADMIN), " title=\"{$user['username']}\"") . ">";
             $suffix = "</span>";
         }
         $username = iif($tmp_user['username'], strip_tags($tmp_user['username']), $user['username']);
         if (!$this->bypassEnableForm() and count($tmp_user['options']['smilies']) > 0 and $vbulletin->kbankBBCodeParser) {
             //Parse smilies
             $username_new = $vbulletin->kbankBBCodeParser->parse_smilies($username);
             $smilies_count = substr_count(strtolower($username_new), strtolower('<img'));
             $max_smilies = 0;
             foreach ($tmp_user['options']['smilies'] as $limit) {
                 if ($max_smilies != -1) {
                     if ($limit != -1) {
                         $max_smilies += $limit;
                     } else {
                         $max_smilies = -1;
                     }
                 }
             }
             if ($max_smilies == -1 or $smilies_count <= $max_smilies) {
                 $username = $username_new;
             } else {
                 $errors[] = construct_phrase($vbphrase['kbank_itemtype_customize_userinfo_username_smilies_error'], $max_smilies, $smilies_count);
             }
         }
         if (!$user['userdisplaygroupid']) {
             $user['customize_userinfo_username'] = $prefix . $username . $suffix;
             $user['musername'] = '';
             $user['musername'] = fetch_musername($user, 'displaygroupid', 'customize_userinfo_username');
         } else {
             global $vbulletin;
             $displaygroupid = $user['userdisplaygroupid'];
             $user['musername'] = $vbulletin->usergroupcache["{$displaygroupid}"]['opentag'] . $prefix . $username . $suffix . $vbulletin->usergroupcache["{$displaygroupid}"]['closetag'];
         }
         //Update `username` entity
         //$user['real_username'] = $user['username'];
         //$user['username'] = $username;
         //skipped!
     }
     if ($do_usertitle || $myself) {
         /*if (isset($user['permissions']['genericpermissions'])
         			AND !($user['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusecustomtitle'])) {
         			$errors[] = $vbphrase['kbank_itemshow_customize_userinfo_usertitle_error'];
         		}*/
         if ($itemtypeoptions['usertitle_max'] and $options['usertitle']) {
             $tmp_user['usertitle'] = fetch_censored_text(substr(strip_tags($options['usertitle']), 0, $itemtypeoptions['usertitle_max']));
         }
         if ($itemtypeoptions['usertitle_colors'] and $options['usertitle_color'] and in_array($options['usertitle_color'], explode(',', $itemtypeoptions['usertitle_colors']))) {
             $tmp_user['usertitle_style']['color'] = "color: {$options['usertitle_color']}";
         }
         if (count($tmp_user['usertitle_style']) > 0) {
             $title_prefix = "<span style=\"" . implode('; ', $tmp_user['usertitle_style']) . "\">";
             $title_suffix = "</span>";
         }
         $user['usertitle'] = $title_prefix . iif($tmp_user['usertitle'], $tmp_user['usertitle'], $user['usertitle']) . $title_suffix;
     }
 }
Exemple #3
0
function findAnnounce()
{
    global $vbulletin, $vbphrase, $admincpdir, $kbank_system_announces;
    if ($vbulletin->kbank_announces) {
        foreach ($vbulletin->kbank_announces as $itemdata) {
            $item_obj =& newItem($itemdata['itemid'], $itemdata);
            if ($item_obj =& newItem($itemdata['itemid'], $itemdata) and $item_obj->data['status'] == KBANK_ITEM_ENABLED and ($item_obj->data['expire_time'] > TIMENOW or $item_obj->data['expire_time'] < 0)) {
                $item_obj->doAction('work_real');
            }
        }
    }
    if ($vbulletin->kbank_warningitems) {
        $need2warn = array();
        foreach ($vbulletin->kbank_warningitems as $itemdata) {
            if (!is_array($itemdata['options'])) {
                $itemdata['options'] = unserialize($itemdata['options']);
            }
            switch ($itemdata['status']) {
                case KBANK_ITEM_PENDING:
                    if (($itemdata['expire_time'] > TIMENOW or $itemdata['expire_time'] < 0) and havePerm($vbulletin->userinfo, KBANK_PERM_ADMIN)) {
                        //check pending item if user is kBank Admin
                        $found = false;
                        if (is_array($itemdata['options']['approved'])) {
                            foreach ($itemdata['options']['approved'] as $userid => $username) {
                                if ($userid == $vbulletin->userinfo['userid']) {
                                    $found = true;
                                }
                            }
                        }
                        if (!$found) {
                            $need2warn['pending']++;
                        }
                    }
                    break;
                case KBANK_ITEM_BIDDING:
                    if (havePerm($vbulletin->userinfo, KBANK_PERM_COMPANY)) {
                        //check bidding item if user has kBank Company permission
                        $bid = $highestBid = array();
                        if (is_array($itemdata['options']['bids'])) {
                            foreach ($itemdata['options']['bids'] as $record) {
                                if ($record['userid'] == $vbulletin->userinfo['userid'] or is_array($vbulletin->userinfo['kbank_granted']) and in_array($record['userid'], array_keys($vbulletin->userinfo['kbank_granted']))) {
                                    $bid = $record;
                                }
                                if (bid_cmp($record, $highestBid) > 0) {
                                    $highestBid = $record;
                                }
                            }
                        }
                        if ($itemdata['expire_time'] > TIMENOW) {
                            if (!count($bid)) {
                                $need2warn['bidding']++;
                            } else {
                                if (bid_cmp($bid, $highestBid) < 0) {
                                    $need2warn['bidding_higher']++;
                                }
                            }
                        } else {
                            if (count($bid) and bid_cmp($bid, $highestBid) == 0) {
                                $need2warn['bidding_win']++;
                            }
                        }
                    }
                    break;
            }
        }
        if ($need2warn['pending']) {
            $kbank_system_announces[] = array('url' => "{$admincpdir}/index.php?loc=kbankadmin.php%3Fdo%3Ditem_man", 'text' => construct_phrase($vbphrase['kbank_announce_item_pending'], $need2warn['pending']), 'css' => 'color: red; font-weight: bold');
        }
        if ($need2warn['bidding']) {
            $kbank_system_announces[] = array('url' => $vbulletin->kbank['phpfile'] . '?do=shop', 'text' => construct_phrase($vbphrase['kbank_announce_item_bidding'], $need2warn['bidding']), 'css' => 'color: green; font-weight: bold');
        }
        if ($need2warn['bidding_higher']) {
            $kbank_system_announces[] = array('url' => $vbulletin->kbank['phpfile'] . '?do=shop', 'text' => construct_phrase($vbphrase['kbank_announce_item_bidding_higher'], $need2warn['bidding_higher']), 'css' => 'color: red; font-weight: bold');
        }
        if ($need2warn['bidding_win']) {
            $kbank_system_announces[] = array('url' => $vbulletin->kbank['phpfile'] . '?do=shop', 'text' => construct_phrase($vbphrase['kbank_announce_item_bidding_win'], $need2warn['bidding_win']), 'css' => 'color: green; font-weight: bold');
        }
    }
}
Exemple #4
0
 //load granted permission
 $granted_list = '';
 $granteds = array($vbulletin->userinfo['userid'] => array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'] . ' (' . $vbphrase['kbank_yourself'] . '!)', 'usergroupid' => $vbulletin->userinfo['usergroupid'], 'membergroupids' => $vbulletin->userinfo['membergroupids'], $vbulletin->kbank['field'] => $vbulletin->userinfo[$vbulletin->kbank['field']]));
 if (is_array($vbulletin->userinfo['kbank_granted'])) {
     $granteds = array_merge($granteds, $vbulletin->userinfo['kbank_granted']);
 }
 //prepair output
 foreach ($granteds as $granted) {
     $permission_detail = array();
     if (!userBanned($granted['userid'], true)) {
         $permission_detail[] = $vbphrase['kbank_user'];
     }
     if (havePerm($granted, KBANK_PERM_ADMIN, true)) {
         $permission_detail[] = $vbphrase['kbank_admin_perm'];
     }
     if (havePerm($granted, KBANK_PERM_COMPANY, true)) {
         $permission_detail[] = $vbphrase['kbank_company'];
     }
     $permission_detail = implode('<br/>', $permission_detail);
     $granted_list .= "\n\t\t\t\t<tr class=\"alt1\" align=\"center\">\n\t\t\t\t\t<td>{$granted['userid']}</td>\n\t\t\t\t\t<td>{$granted['username']}</td>\n\t\t\t\t\t<td>{$permission_detail}</td>\n\t\t\t\t</tr>\n\t\t\t";
 }
 //load granted permission - completed!
 //load allowed permission
 $allowed_list = '';
 $alloweds = $vbulletin->db->query_read("\n\t\tSELECT \n\t\t\tallowed.grantid AS grantid\n\t\t\t,user.userid AS userid\n\t\t\t,user.username AS username\n\t\tFROM `" . TABLE_PREFIX . "kbank_granted_permission` as allowed\n\t\tINNER JOIN `" . TABLE_PREFIX . "user` AS `user` ON (user.userid = allowed.userid)\n\t\tWHERE allowed.allowid = {$vbulletin->userinfo['userid']}\n\t");
 if ($vbulletin->db->num_rows($alloweds)) {
     while ($allowed = $vbulletin->db->fetch_array($alloweds)) {
         $allowed_list .= "\n\t\t\t\t<tr class=\"alt1\" align=\"center\">\n\t\t\t\t\t<td>{$allowed['userid']}</td>\n\t\t\t\t\t<td>{$allowed['username']}</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=\"checkbox\" id=\"remove_{$allowed['grantid']}\" name=\"remove[{$allowed['grantid']}]\" title=\"{$vbphrase['remove']}\"/>\n\t\t\t\t\t\t<label for=\"remove_{$allowed['grantid']}\">{$vbphrase['remove']}</label>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t";
     }
 }
 $vbulletin->db->free_result($alloweds);
Exemple #5
0
     foreach ($tops as $top) {
         $top_message[] = construct_phrase($vbphrase['kbank_misc_topaward_bit'], GetUsername($top, 'search.php?do=findawardedby&userid='), vb_number_format($top['count']), vb_number_format($top['total'], $vbulletin->kbank['roundup']), $vbulletin->kbank['name']) . topChangeDisplay($top);
     }
 }
 //List all available top
 if (isset($_GET[$vbulletin->kbank['url_varname']]) and !$top_message or $_GET['do'] == $vbulletin->kbank['url_varname']) {
     $url_prefix = $vbulletin->kbank['phpfile'] . "?{$session['sessionurl']}top=";
     $top_message = "<strong>{$vbphrase['kbank_misc_top']}</strong>\n\t\t\t<ul>";
     foreach (array_keys($hour2update) as $type) {
         if (in_array($type, $kBankAdminOnly)) {
             //This type is only for kBank Admin, skip
             continue;
         }
         $top_message .= "<li><a href=\"{$url_prefix}{$type}\">" . $vbphrase["kbank_misc_{$type}"] . "</a></li>";
     }
     if (havePerm($vbulletin->userinfo, KBANK_PERM_ADMIN) and count($kBankAdminOnly)) {
         //Show kBank Admin Only Lists
         $top_message .= "</ul><strong style=\"color:red\">{$vbphrase['kbank_misc_top_admin']}</strong><ul>";
         foreach ($kBankAdminOnly as $type) {
             $top_message .= "<li><a href=\"{$url_prefix}{$type}\">" . $vbphrase["kbank_misc_{$type}"] . "</a></li>";
         }
         $top_message .= "</ul>";
     }
     $top_message .= "</ul>";
     $top_message_skip = true;
 }
 //Output
 if ($name) {
     if (is_array($top_message) and count($top_message) > 0) {
         $top_message = "<a href=\"{$vbulletin->kbank['phpfile']}?{$session['sessionurl']}do={$vbulletin->kbank['url_varname']}\"><strong>{$vbphrase['kbank_misc_top']}</strong></a> - " . '<strong>' . $vbphrase["kbank_misc_{$name}"] . '</strong><br/>' . iif($cache['datetime'] < TIMENOW, construct_phrase($vbphrase['kbank_misc_top_updatetime'], vbdate($vbulletin->options['timeformat'] . ' ' . $vbulletin->options['dateformat'], $cache['datetime']), vbdate($vbulletin->options['timeformat'] . ' ' . $vbulletin->options['dateformat'], $cache['datetime'] + $hour2update[$name] * 60 * 60)) . '<br/>') . '<ol><li>' . implode('</li><li>', $top_message) . '</li></ol>';
     } else {
        if ($vbulletin->db->num_rows($itemtypes)) {
            $userinfo['kbank_itemtypes'] = '';
            while ($itemtypedata = $vbulletin->db->fetch_array($itemtypes)) {
                $userinfo['kbank_itemtypes'] .= '<li>' . "<a href=\"{$vbulletin->kbank['phpfile']}?do=shop&username={$userinfo['username']}&itemtypeid={$itemtypedata['itemtypeid']}\" target=\"_blank\">{$itemtypedata['name']}</a>" . '</li>';
            }
            unset($itemtypedata);
        }
        $vbulletin->db->free_result($itemtypes);
        //search for user items
        if ($vbulletin->userinfo['userid'] != $userinfo['userid']) {
            //skip 1 query if user is viewing his/her profile. Everything has been loaded!
            findItemToWork($userinfo['userid'], true);
        }
        global $kbank_active_items;
        if (count($kbank_active_items[$userinfo['userid']])) {
            $userinfo['kbank_active_items'] = $userinfo['kbank_selling_items'] = '';
            $items2show = fetchItemFromCache($kbank_active_items[$userinfo['userid']]);
            foreach ($items2show as $itemtypeid => $items2show_tmp) {
                foreach ($items2show_tmp as $item) {
                    if ($item['status'] == KBANK_ITEM_SELLING) {
                        //Selling item
                        $userinfo['kbank_selling_items'] .= '<li>' . "<a href=\"{$vbulletin->kbank['phpfile']}?do=shop&username={$userinfo['username']}&itemtypeid={$itemtypeid}\" target=\"_blank\">{$item['name']}</a>" . iif($item['count'] > 1, " x<strong style=\"color:red\">{$item['count']}</strong>") . '</li>';
                    } else {
                        $userinfo['kbank_active_items'] .= '<li>' . "<a href=\"{$vbulletin->kbank['phpfile']}?do=shop&itemtypeid={$itemtypeid}\" target=\"_blank\">{$item['name']}</a>" . iif(havePerm($vbulletin->userinfo, KBANK_PERM_ADMIN), " <em>{$item['status_str']}</em>") . iif($item['count'] > 1, " x<strong style=\"color:red\">{$item['count']}</strong>") . '</li>';
                    }
                }
            }
        }
    }
    eval('$template_hook["profile_stats_pregeneral"] .= "' . fetch_template('kbank_profile_stats_pregeneral') . '";');
}
Exemple #7
0
 function ready2Disable()
 {
     global $vbulletin, $userinfo;
     if (!$userinfo) {
         $userinfo =& $vbulletin->userinfo;
     }
     return havePerm($userinfo, $this->data) and in_array($this->data['status'], array(KBANK_ITEM_ENABLED)) and ($this->data['expire_time'] > TIMENOW or $this->data['expire_time'] < 0);
 }