示例#1
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');
        }
    }
}
示例#2
0
文件: classes.php 项目: 0hyeah/yurivn
 function highestBid()
 {
     //get the highest bid has been place
     if (!$this->highestBid) {
         if (is_array($this->data['options']['bids'])) {
             foreach ($this->data['options']['bids'] as $record) {
                 if (bid_cmp($record, $this->highestBid) > 0) {
                     $this->highestBid = $record;
                 }
             }
         }
     }
     return $this->highestBid;
     //return (from cached)
 }