Comsenz Inc.'; var $magic = array(); var $parameters = array(); function getsetting(&$magic) { $settings = array( 'num' => array( 'title' => 'detector_num', 'type' => 'select', 'value' => array( array('5', '5'), array('10', '10'), array('20', '20'), ), 'default' => '10' ), ); return $settings; } function setsetting(&$magicnew, &$parameters) { $magicnew['num'] = in_array($parameters['num'], array(5,10,20,50)) ? intval($parameters['num']) : '10'; } function usesubmit() { global $_G; $list = $uids = array(); $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10; $limit = $num + 20; $giftMagicID = C::t('common_magic')->fetch_by_identifier('gift'); $mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0; if($mid) { foreach(C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) { $uids[] = intval($value['uid']); } } if($uids) { $counter = 0; $members = C::t('common_member')->fetch_all($uids); foreach(C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) { $value = array_merge($members[$uid], $value); $info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array(); if(!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) { $value['avatar'] = addcslashes(avatar($uid, 'small'), "'"); $list[$uid] = $value; $counter++; if($counter>=$num) { break; } } } } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); $op = 'show'; include template('home/magic_detector'); } function show() { global $_G; $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10; magicshowtips(lang('magic/detector', 'detector_info', array('num'=>$num))); } } ?>