Exemplo n.º 1
0
 function getdata($style, $parameter)
 {
     global $_G;
     define('APPC', DISCUZ_ROOT . './source/plugin/sanree_brand/condition/');
     $modfile = APPC . 'index.php';
     @(require_once $modfile);
     @(require_once DISCUZ_ROOT . './source/plugin/sanree_brand/function/function_core.php');
     $parameter = $this->cookparameter($parameter);
     $config = $_G['cache']['plugin']['sanree_brand'];
     $is_rewrite = intval($config['is_rewrite']);
     $isselfdistrict = intval($config['isselfdistrict']);
     $ismultiple = intval($config['ismultiple']);
     $allicq = array('qq', 'msn', 'wangwang', 'baiduhi', 'skype');
     $icq = trim($config['icq']);
     $icq = !in_array($icq, $allicq) ? 'qq' : $icq;
     $qqcode = trim($config['qqcode']);
     $msncode = trim($config['msncode']);
     $wangwangcode = trim($config['wangwangcode']);
     $baiduhicode = trim($config['baiduhicode']);
     $skypecode = trim($config['skypecode']);
     $icqshow = $icq . 'code';
     $icqshow = ${$icqshow};
     $start = isset($parameter['start']) ? intval($parameter['start']) : 0;
     $bannedids = !empty($parameter['bannedids']) ? explode(',', $parameter['bannedids']) : array();
     $items = !empty($parameter['items']) ? intval($parameter['items']) : 10;
     $orderby = isset($parameter['orderby']) ? $parameter['orderby'] : '0';
     $ordersc = isset($parameter['ordersc']) ? $parameter['ordersc'] : '0';
     $cateid = isset($parameter['cateid']) ? intval($parameter['cateid']) : '0';
     $groupid = isset($parameter['groupid']) ? intval($parameter['groupid']) : '0';
     $showfilter = isset($parameter['showfilter']) ? intval($parameter['showfilter']) : '0';
     $spicwidth = isset($parameter['spicwidth']) ? intval($parameter['spicwidth']) : 0;
     $spicheight = isset($parameter['spicheight']) ? intval($parameter['spicheight']) : 0;
     $showfilter = in_array($showfilter, array(0, 1, 2)) ? $showfilter : 0;
     $sc = array('asc', 'desc');
     $by = array('t.bid', 't.displayorder', 't.dateline', 'tt.views');
     $orderby = $by[$orderby];
     $ordersc = $sc[$ordersc];
     $datalist = $wherearr = array();
     $wherearr[] = 't.status=1';
     $wherearr[] = 't.isshow=1';
     if ($cateid > 0) {
         $category_list = $subcategory_list = array();
         require_once libfile('class/sanree_brand_category', 'plugin/sanree_brand');
         $allurl = gethomeurl();
         $categoryclass = new sanree_brand_category('sanree_brand');
         $categoryclass->show($is_rewrite);
         $pid = $categoryclass->_pid;
         $category_list = $categoryclass->_category_list;
         $subcategory_list = $categoryclass->_subcategory_list;
         $cateids = array();
         $cateids[] = $cateid;
         if (is_array($subcategory_list)) {
             foreach ($subcategory_list as $key => $val) {
                 $cateids[] = $key;
             }
         }
         $ids = implode($cateids, ',');
         if ($pid == $cateid) {
             $wherearr[] = 't.cateid in (' . $ids . ')';
         } else {
             $wherearr[] = 't.cateid =' . $cateid;
         }
     }
     if (!empty($bannedids)) {
         $banids = explode(',', $bannedids);
         $wherearr[] = 't.bid NOT IN (' . implode("','", $banids) . "')";
     }
     if ($showfilter == 1) {
         $wherearr[] = 't.istop = 1';
     } elseif ($showfilter == 2) {
         $wherearr[] = 't.isrecommend = 1';
     }
     if ($groupid > 0) {
         $wherearr[] = 't.groupid = ' . $groupid;
     }
     $where = !empty($wherearr) ? 'WHERE ' . implode(' AND ', $wherearr) : '';
     $itemsnum = $items == 0 ? '' : " LIMIT {$start},{$items}";
     foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_forblock($where, $orderby, $ordersc, $itemsnum) as $value) {
         $value['icq'] = '';
         if ($ismultiple == 1 && $value['allowmultiple'] == 1) {
             $value['icq'] = getallicq($value[$icq]);
             $value['tel'] = getfirsticq($value['tel']);
             $value['qq'] = getfirsticq($value['qq']);
             $value['msn'] = getfirsticq($value['msn']);
             $value['wangwang'] = getfirsticq($value['wangwang']);
             $value['baiduhi'] = getfirsticq($value['baiduhi']);
             $value['skype'] = getfirsticq($value['skype']);
             $value[$icq] = empty($value[$icq]) ? '' : str_replace('{icqnumber}', getfirsticq($value[$icq]), $icqshow);
         } else {
             $value['qq'] = empty($value['qq']) ? srlang('zanwustr') : str_replace('{icqnumber}', getfirsticq($value['qq']), $icqshow);
             $value['tel'] = getfirsticq($value['tel']);
         }
         $datalist[] = array('id' => $value['bid'], 'idtype' => 'brandid', 'title' => $value['name'], 'url' => getburl_by_bid($value[bid]), 'pic' => 'category/' . $value['poster'], 'picflag' => 1, 'summary' => '', 'fields' => array('brandname' => $value['name'], 'bid' => $value['bid'], 'recommendimg' => $_G['siteurl'] . $value['recommendimg'], 'views' => $value['views'], 'qq' => $value['qq'], 'msn' => $value['msn'], 'wangwang' => $value['wangwang'], 'baiduhi' => $value['baiduhi'], 'skype' => $value['skype'], 'icq' => $value['icq'], 'address' => $value['address'], 'tel' => $value['tel'], 'weburl' => $value['weburl'], 'cateid' => $value['cateid'], 'catename' => $value['catename'], 'brandno' => $value['brandno'], 'region' => $isselfdistrict == 1 ? "{$value['birthcity']} - {$value['birthdist']}" : "{$value['srbirthprovince']} - {$value['srbirthcity']}", 'brandmf' => $value['brandmf'], 'brandtag' => $value['brandtag'], 'weixin' => $value['weixin'], 'weixinimg' => $value['weixinimg'], 'weixinpublic' => $value['weixinpublic'], 'weixinpublicpic' => $value['weixinpublicpic'], 'iscard' => $value['iscard'] ? '<img src="source/plugin/sanree_brand/tpl/good/images/cardico.jpg"/>' : ''));
     }
     return array('html' => '', 'data' => $datalist);
 }
Exemplo n.º 2
0
$brandresult['satisfaction'] = intval($voter[3]);
$brandresult['satisfactionwidth'] = intval($brandresult['satisfaction'] / 100 * 91);
$brandresult['groupimg'] = getgroupimg($brandresult['groupid']);
$brandresult['propaganda'] = discuzcode($brandresult['propaganda'], 0, 0);
$brandresult['introduction'] = discuzcode($brandresult['introduction'], 0, 0);
$brandresult['contact'] = discuzcode($brandresult['contact'], 0, 0);
$brandresult['propaganda'] = str_replace('&amp;', '&', $brandresult['propaganda']);
$brandresult['introduction'] = str_replace('&amp;', '&', $brandresult['introduction']);
$brandresult['contact'] = str_replace('&amp;', '&', $brandresult['contact']);
$brandresult['albumurl'] = getalbumurl($brandresult['bid']);
$brandresult['abrandno'] = empty($brandresult['brandno']) ? '' : '<a href="' . getbrandnourl($brandresult['brandno']) . '">' . $brandresult['brandno'] . '</a>';
$brandresult['sqq'] = $brandresult['qq'];
$brandresult['stel'] = $brandresult['tel'];
if ($ismultiple == 1 && $brandresult['allowmultiple'] == 1) {
    $brandresult['sicq'] = $brandresult[$icq];
    $brandresult['icq'] = getallicq($brandresult[$icq]);
    if (!$config['isbird']) {
        $tellist = explode(',', $brandresult['tel']);
    }
    $brandresult['tel'] = getfirsticq($brandresult['tel']);
} else {
    $brandresult['qq'] = empty($brandresult['qq']) ? srlang('zanwustr') : str_replace('{icqnumber}', getfirsticq($brandresult['qq']), $icqshow);
    if (!$config['isbird']) {
        $brandresult['tel'] = getfirsticq($brandresult['tel']);
    }
}
$tel114id = intval($brandresult['tel114id']);
if ($tel114id > 0 && $tel114version >= 1121) {
    $url = $tel114_is_rewrite ? 'tel114-view-' . $tel114id . '.html' : 'plugin.php?id=sanree_tel114&mod=view&tid=' . $tel114id;
    $brandresult['tel114url'] = '<a href="' . $url . '" onclick="showWindow(\'showtelkey\', this.href)"><img height=18 width=18 align="absmiddle" src="' . sr_brand_IMG . '/tel114.png" /></a>';
}