Пример #1
0
function findItemToWork($userid, $allstatus = false)
{
    if (!($userid > 0)) {
        return false;
    }
    global $vbulletin, $kbank_active_items;
    if (!$vbulletin->kbank['itemEnabled']) {
        return false;
    }
    $didsomething = false;
    if (!isset($kbank_active_items[$userid]) or $allstatus) {
        $skip = false;
        if (in_array(THIS_SCRIPT, array('showthread'))) {
            $skip = true;
        }
        if (!$skip) {
            //sometime we will skip query database for items
            findItemsToWork(array($userid), false, $allstatus);
        }
    }
    if (is_array($kbank_active_items[$userid])) {
        foreach ($kbank_active_items[$userid] as $item) {
            if ($item->data['status'] > KBANK_ITEM_AVAILABLE and ($item->data['expire_time'] > TIMENOW or $item->data['expire_time'] < 0)) {
                $item->doAction('work');
                $didsomething = true;
            }
        }
    }
    return $didsomething;
}
Пример #2
0
<?php

/*======================================================================*\
|| #################################################################### ||
|| # kBank 2.4
|| # Coded by mrpaint
|| # Contact: mrpaint@gmail.com
|| # I'm a Vietnamese! Thank you for using this script
|| # Last Updated: 03:27 29-03-2009
|| #################################################################### ||
\*======================================================================*/
if (defined('VB_AREA') && $vbulletin->kbank['enabled']) {
    include_once DIR . '/kbank/functions.php';
    global $KBANK_HOOK_NAME, $kbank_userinfo_tmp;
    $KBANK_HOOK_NAME = KBANK_FETCH_MUSERNAME;
    $kbank_userinfo_tmp = $user;
    $kbank_userinfo_tmp['userdisplaygroupid'] = $displaygroupid;
    if (!isset($vbulletin->userinfo)) {
        //userinfo has not been initialized! We believe fetch_musername is being called for current user
        //cache ALL user items
        $userids = array($user['userid']);
        if ($user['kbank_granted_count']) {
            $userids = array_merge($userids, explode('|', $user['kbank_granted_userid']));
        }
        findItemsToWork($userids, false, true);
    }
    if (findItemToWork($user['userid'])) {
        $user = $kbank_userinfo_tmp;
    }
}
|| #################################################################### ||
|| # kBank 2.4
|| # Coded by mrpaint
|| # Contact: mrpaint@gmail.com
|| # I'm a Vietnamese! Thank you for using this script
|| # Last Updated: 03:25 29-03-2009
|| #################################################################### ||
\*======================================================================*/
global $vbulletin;
if (defined('VB_AREA') and $vbulletin->kbank['enabled']) {
    include_once DIR . '/kbank/functions.php';
    global $vbphrase, $kbank, $KBANK_HOOK_NAME, $ids, $kbank_done, $kbank_active_items;
    if (!$kbank_done) {
        if ($ids) {
            //Prepare with multi posts thread (ONE query for the whole page)
            findItemsToWork(explode(',', $ids), false, false, array('join' => "INNER JOIN `" . TABLE_PREFIX . "post` AS post ON (post.userid = items.userid)", 'idcheckfield' => 'post.postid'));
        }
        $kbank_done = true;
        //Tricky way to re-create musername if item found
        if (count($kbank_active_items[$post['userid']])) {
            $post['musername'] = null;
            $post['musername'] = fetch_musername($post);
        }
    }
    $KBANK_HOOK_NAME = KBANK_POSTBIT_COMPLETE;
    findItemToWork($this->post['userid'], false);
    if ($vbulletin->kbank['postbit_elements'] & $vbulletin->kbank['bitfield']['display_elements']['kbank_show_points']) {
        $showpoints = true;
        if ($post["{$vbulletin->kbank['field']}"]) {
            $post["{$vbulletin->kbank['field']}"] = $post['kbank'] = vb_number_format($post["{$vbulletin->kbank['field']}"], $vbulletin->kbank['roundup']);
        }
Пример #4
0
            foreach ($items2show as $items2show_tmp) {
                foreach ($items2show_tmp as $item2show) {
                    $useHead = false;
                    $fulllink = $item2show['fulllink'];
                    $link = $item2show['link'];
                    $text = $item2show['name'] . iif($item2show['status_str'], ' ' . $item2show['status_str']) . iif($item2show['count'] > 1, " x<strong style=\"color:red\">{$item2show['count']}</strong>");
                    eval('$kbank_navbar_popup_menu_more .= " ' . fetch_template('kbank_navbar_popup_menu_bit') . '";');
                }
            }
        }
        //Total Money
        $fulllink = true;
        $link = '#';
        $text = $vbulletin->kbank['name'] . ': ' . $vbulletin->userinfo['kbank'];
        eval('$kbank_navbar_popup_menu_more .= " ' . fetch_template('kbank_navbar_popup_menu_bit') . '";');
        ($hook = vBulletinHook::fetch_hook('kbank_navbar_popup_menu')) ? eval($hook) : false;
        //Add menu in a new way (from vBBlog) 31-12-2008
        //Old codes:
        /*eval('$template_hook["navbar_popup_menus"] .= "' . fetch_template('kbank_navbar_popup_menu') . '";');
        		$vbulletin->templatecache['navbar'] = str_replace(
        			'<!-- NAVBAR POPUP MENUS -->'
        			,'<!-- NAVBAR POPUP MENUS --> $template_hook[navbar_popup_menus]'
        			, $vbulletin->templatecache['navbar']);*/
        eval('$header .= "' . fetch_template('kbank_navbar_popup_menu') . '";');
        //navbar popup menu - complete!
    }
    //Prepare items?
    if (count($userids2cache)) {
        findItemsToWork($userids2cache);
    }
}