$value['recommendationindex'] = empty($value['recommendationindex']) ? '99.9' : $value['recommendationindex']; $value['class'] = $value['istop'] ? 'dtop' : ''; $value['class'] = empty($value['class']) && $value['isrecommend'] ? 'drec' : $value['class']; $value['discount'] = intval($value['discount']); $value['tel114url'] = ''; $tel114id = intval($value['tel114id']); if ($tel114id > 0 && $tel114version >= 1121) { $url = $tel114_is_rewrite ? 'tel114-view-' . $tel114id . '.html' : 'plugin.php?id=sanree_tel114&mod=view&tid=' . $tel114id; $value['tel114url'] = "<a href=\"" . $url . "\" onclick=\"showWindow('showtelkey', this.href)\"><img height=18 width=18 align=\"absmiddle\" src=\"" . sr_brand_IMG . "/stel114.jpg\" /></a>"; } if ($ismultiple == 1 && $value['allowmultiple'] == 1) { $icqline = getfirsticq($value[$icq]); $value['icq'] = empty($icqline) ? srlang('zanwustr') : str_replace('{icqnumber}', $icqline, $icqshow); $value['tel'] = getfirsticq($value['tel']); } else { $value['qq'] = empty($value['qq']) ? srlang('zanwustr') : str_replace('{icqnumber}', getfirsticq($value['qq']), $icqshow); } $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid(intval($value['tid'])); $voter[2] = $voter[2] == 0 ? 1 : $voter[2]; $v1 = round($voter[1] / $voter[2], 1); list($vn1, $vn2) = explode('.', $v1); $value['cateurl'] = getcateurl(array('tid' => $value['cateid']), TRUE); $mtf = $_G['cache']['plugin']['sanree_mcertification']['isopen']; if ($mtf) { $mcertification = C::t('#sanree_mcertification#sanree_mcertification')->gettype_by_bid(intval($value['bid'])); $mgif = 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/none.png'; if ($mcertification) { $mgif = $mcertification['type'] ? 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/personal.png' : 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/company.png'; } } $fbusinesses_list[] = array('weixin' => $value['weixin'], 'wximg' => $value['weixinimg'], 'wxplublic' => $value['weixinpublic'], 'wxppic' => $value['weixinpublicpic'], 'bid' => $value['bid'], 'mtype' => $mcertification, 'isrecommend' => $value['isrecommend'], 'istop' => $value['istop'], 'mcertification' => $mgif, 'catename' => $value['catename'], 'cateurl' => $value['cateurl'], 'name' => $value['name'], 'poster' => $issmallpic == 1 && !$config['isbird'] ? brand_getlogo($value['bid'], 0, $logow, $logoh, 'fixnone') : newtheme($value['poster']), 'addtime' => dgmdate($value['addtime']), 'tel114url' => $value['tel114url'], 'turl' => getburl($value), 'qq' => $value['qq'], 'msn' => $value['msn'], 'wangwang' => $value['wangwang'], 'icq' => $value['icq'], 'address' => empty($value['address']) ? srlang('zanwustr') : $value['address'], 'groupsmallicons' => getgroupsmallicons($value['groupid']), 'tel' => $value['tel'], 'sdiscount' => $value['discount'], 'pbid' => intval($value['pbid']), 'iscard' => intval($value['iscard']), 'discount' => $config['selectdiscountshow'][$value['discount']], 'recommendarr' => explode('.', $value['recommendationindex']), 'voter' => intval($vn1), 'voter2' => intval($vn2), 'satisfaction' => $voter[3], 'recommendationindex' => $value['recommendationindex'], 'class' => ' class="' . $value['class'] . '" ', 'forum_thread' => array('views' => $value['tviews']));
} if ($brandresult['status'] != 1) { showmessage(srlang('nostatus')); } chkbrandend($brandresult); if ($brandresult[allowalbum] != 1) { showmessage(srlang('noallowalbum')); } $cateurl = getalbumurl($brandresult[bid]); if ($ismultiple == 1 && $brandresult['allowmultiple'] == 1) { $icqline = getfirsticq($brandresult[$icq]); $brandresult['icq'] = empty($icqline) ? srlang('zanwustr') : str_replace('{icqnumber}', $icqline, $icqshow); $brandresult['tel'] = getfirsticq($brandresult['tel']); } else { $brandresult['qq'] = empty($brandresult['qq']) ? srlang('zanwustr') : str_replace('{icqnumber}', getfirsticq($brandresult['qq']), $icqshow); $brandresult['tel'] = getfirsticq($brandresult['tel']); } $brandresult['groupimg'] = getgroupimg($brandresult['groupid']); $brandresult['discount'] = $config['selectdiscountshow'][$brandresult['discount']]; $forum_thread = C::t('#sanree_brand#forum_thread')->fetch($brandresult['tid']); $brandresult['favtimes'] = $forum_thread['favtimes']; $brandresult['url'] = getburl($brandresult); $brandresult['poster'] = newtheme($brandresult['poster'], 'category', '/none.gif'); if (empty($brandresult[banner])) { $brandresult[banner] = sr_brand_IMG . '/banner.jpg'; } else { $valueparse = parse_url($brandresult['banner']); if (!isset($valueparse['host'])) { $brandresult['banner'] = $_G['setting']['attachurl'] . 'common/' . $brandresult['banner']; } }
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); }
function get_menu_head($brandresult, $active) { global $_G, $template, $bodycss, $ishideheader, $allurl, $myhomeurl, $referer, $addgroup, $ismultiple; $bid = $brandresult['bid']; $tid = $brandresult['tid']; $group = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']); $tmpconfig = $_G['cache']['plugin']['sanree_brand']; $allowsyngroup = intval($tmpconfig['allowsyngroup']); $isshowordinary = intval($tmpconfig['isshowordinary']); !defined('sr_brand_JS') && define('sr_brand_JS', sr_brand_TPL . '/' . $tmpconfig['template'] . '/js'); !defined('SANREE_BRAND_TEMPLATE') && define('SANREE_BRAND_TEMPLATE', sr_brand_TPL . '/' . $tmpconfig['template']); $allurl = gethomeurl(); $myhomeurl = !empty($brandresult['brandno']) ? getbrandnourl($brandresult['brandno']) : getmyburl_by_bid($brandresult['bid']); $referer = urlencode($myhomeurl); if (!isset($_G['cache']['sanree_brand_topmenu']) || !is_array($_G['cache']['sanree_brand_topmenu'])) { sanreeupdatecache('menu'); } $menu = sanreeloadcache('topmenu'); $headermenulist = array(); $headermenulist['index'] = array('url' => getburl($brandresult), 'title' => srlang('frontpage'), 'class' => ' class="normal"'); $headermenulist['detail'] = array('url' => getdetailurl($brandresult), 'title' => srlang('bird_item_detail'), 'class' => ' class="normal"'); $brandresult['allowalbum'] == 1 && ($headermenulist['myalbum'] = array('url' => getalbumurl($brandresult['bid']), 'title' => srlang('myalbum'), 'class' => ' class="normal"')); $allowsyngroup == 1 && intval($group['allowsyngroup']) == 1 && $brandresult['syngrouptid'] && ($headermenulist['dzgroup'] = array('url' => 'forum.php?mod=group&fid=' . $brandresult['syngrouptid'], 'title' => srlang('dzgroup'), 'class' => ' class="normal"')); hookscript('sanreebrandusermenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandusermenu'); if ($_G['sanree_brand_menus']) { foreach ($_G['sanree_brand_menus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist[$row['name']] = $row; } } $isshowordinary == 1 && ($headermenulist['ordinary'] = array('url' => 'forum.php?mod=viewthread&tid=' . $brandresult['tid'], 'title' => srlang('ordinary'), 'class' => ' class="normal"')); foreach ($menu as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $headermenulist['menu' . $row[id]] = $row; } $headermenulist[$active] && ($headermenulist[$active]['class'] = ' class="current"'); $headermenulists = $headermenulist; $headermenulist = array(); $menuorder = C::t('#sanree_brand#sanree_brand_menu_order')->fetch_all(); asort($menuorder); foreach ($menuorder as $key => $row) { if ($headermenulists[$key]) { $headermenulist[$key] = $headermenulists[$key]; } if (!$row) { $headermenulist['detail'] = $headermenulists['detail']; } } if (intval($_G['uid']) === intval($brandresult['uid'])) { define('IN_BRAND_USER', TRUE); hookscript('sanreebrandmanagemenu', 'global', 'funcs', array('bid' => $brandresult['bid']), 'sanreebrandmanagemenu'); $managemenulist = array(); $_G['sanree_brand_managemenus'][] = array('displayorder' => 9999, 'window' => 0, 'name' => '', 'title' => '', 'url' => '', 'class' => '', 'image' => 'source/plugin/sanree_brand/tpl/good/images/add.png'); if ($_G['sanree_brand_managemenus']) { foreach ($_G['sanree_brand_managemenus'] as $row) { $row['url'] = str_replace('{tid}', $brandresult['tid'], $row['url']); $row['url'] = str_replace('{bid}', $brandresult['bid'], $row['url']); $row['url'] = str_replace('{pid}', $brandresult['pid'], $row['url']); $managemenulist[] = $row; } $ncount = count($managemenulist); $mod = $ncount % 10; $mt = intval($ncount / 10); $oneh = 100; if ($mt == 0) { $ih = $oneh; } else { if ($mod == 0) { $ih = $mt * $oneh; } else { $ih = ($mt + 1) * $oneh; } } $ih += 10; } } $allowtemplate = intval($group['allowtemplate']); if ($allowtemplate == 1) { $templateconfig = unserialize($brandresult['templateconfig']); $bodystyle = $templateconfig['bodystyle']; $bodycss = ''; if ($bodystyle) { if (intval($bodystyle['isuse']) == 1) { $bodycss = "body {\r\n"; if ($bodystyle['notbackimg'] == 1) { if (!empty($bodystyle['backgroundimage'])) { $bodycss .= "background-image:url('" . $_G['setting']['attachurl'] . 'category/' . "{$bodystyle['backgroundimage']}');\r\n"; } } else { $bodycss .= "background:none;\r\n"; } if (!empty($bodystyle['backgroundrepeat'])) { $bodycss .= "background-repeat:{$bodystyle['backgroundrepeat']};\r\n"; } if (!empty($bodystyle['backgroundcolor'])) { $bodycss .= "background-color:{$bodystyle['backgroundcolor']};\r\n"; } if (!empty($bodystyle['backgroundattachment'])) { $bodycss .= "background-attachment:{$bodystyle['backgroundattachment']};\r\n"; } if (!empty($bodystyle['backgroundpositionx']) && !empty($bodystyle['backgroundpositiony'])) { $bodycss .= "background-position:{$bodystyle['backgroundpositionx']} {$bodystyle['backgroundpositiony']};\r\n"; } $bodycss .= "}"; $ishideheader = intval($bodystyle['ishideheader']); } } if ($ishideheader == 1) { $appVer = $_G['setting']['version']; include templateEx($this->_identifier . ':' . $template . '/header_one_' . $appVer); $GLOBALS['brand_header_one'] = $brand_header_one; } } else { $ishideheader = 0; } $slideid = 3; $slidelistarr = sanreeloadcache('slidelist'); if (!$brandresult['newbanner']) { $slidelistarr[3] = array(array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_01.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_02.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_05.jpg', 'url' => 'http://dx.sanree.com/'), array('pic' => 'source/plugin/sanree_brand/tpl/bird/images/c_banner_06.jpg', 'url' => 'http://dx.sanree.com/')); } else { $brandresult['newbanner'] = explode(',', $brandresult['newbanner']); $slidelistarr[3] = $brandresult['newbanner']; } $slidelist = $slidelistarr[$slideid]; $slide_prefix = $_G['setting']['attachurl'] . 'category/'; $mtfopen = $_G['cache']['plugin']['sanree_mcertification']['isopen']; if ($mtfopen) { $mcertification = C::t('#sanree_mcertification#sanree_mcertification')->gettype_by_bid(intval($bid)); $mtf = 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bignone.png'; if ($mcertification) { $mtf = $mcertification['type'] ? 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bigpersonal.png' : 'source/plugin/sanree_mcertification/tpl/default/mcertification/brandimg/bigcompany.png'; } } $attention = $_G['cache']['plugin']['sanree_attention']['isopen']; if ($attention) { $addbtn = 'source/plugin/sanree_attention/tpl/default/img/addbtn.png'; $delbtn = 'source/plugin/sanree_attention/tpl/default/img/delbtn.png'; $uids = C::t('#sanree_attention#sanree_attention')->getuid_by_bid(intval($bid)); $atnbtn = $addbtn; $flag = 0; $atnurl = 'plugin.php?id=sanree_attention&mod=addattention&bid=' . intval($bid); if ($uids) { foreach ($uids as $uid) { if ($uid['uid'] == $_G['uid']) { $atnbtn = $delbtn; $flag = 1; $atnurl = 'plugin.php?id=sanree_attention&mod=delattention&bid=' . intval($bid); $deltip = attention_modlang('confirmationdel'); break; } } } } $assistcount = C::t('#sanree_brand#sanree_brand_assist')->count_by_where(' && bid =' . intval($bid)); $assistuids = C::t('#sanree_brand#sanree_brand_assist')->getuid_by_bid(intval($bid)); if ($assistuids) { foreach ($assistuids as $uid) { if ($uid['uid'] == $_G['uid']) { $assistflag = 1; break; } } } if (!$brandresult['satisfaction']) { $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid($tid); $brandresult['satisfaction'] = intval($voter[3]); } if ($ismultiple == 1 && $brandresult['allowmultiple'] == 1) { $tempresult = C::t('#sanree_brand#sanree_brand_businesses')->getbusinesses_by_bid($bid); $tellist = explode(',', $tempresult['tel']); } else { $brandresult['tel'] = getfirsticq($brandresult['tel']); } include templateEx($this->_identifier . ':' . $this->_template . '/srhead'); $GLOBALS['srhead'] = $srhead; }