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); }
$template = 'default'; } $entrydir = DISCUZ_ROOT . './source/plugin/sanree_brand/tpl/' . $template; if (file_exists($entrydir . '/copyright.xml')) { $importtxt = @implode('', file($entrydir . '/copyright.xml')); } require_once libfile('class/xml'); $xmldata = xml2array($importtxt); if (!is_array($xmldata)) { showmessage(srlang('error_template')); } define('sr_brand_IMG', sr_brand_TPL . '/' . $template . '/images'); define('sr_brand_JS', sr_brand_TPL . '/' . $template . '/js'); define('SANREE_BRAND_TEMPLATE', sr_brand_TPL . '/' . $template); $_G['template'] = $template; $allurl = gethomeurl(); $sanreeurl = 'http://dx.sanree.com/'; srhooks(); if (($config['isbird'] || $ishello == 1) && $mod == 'index') { $mod = 'hello'; } if ($is_rewrite == 1) { $_G['basefilename'] = $_G['basescript'] = trim($config['urlhomemode']); } else { $_GET['id'] = $plugin['identifier'] . ':' . $plugin['identifier']; } $item_detail = array('item', 'detail'); if (in_array($mod, $item_detail)) { $_G['item_detail'] = $mod; $mod = 'item'; }
function getmenu($brandresult, $active) { global $_G, $template, $bodycss, $ishideheader, $allurl; $group = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']); global $myhomeurl, $referer, $addgroup; $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('brandindex'), '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="active"'); $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 (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; $managemenulist = $this->array_sort($managemenulist, 'displayorder'); } } $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); } } else { $ishideheader = 0; } include templateEx($this->_identifier . ':' . $template . '/header'); $this->_brand_header = $brand_header; $this->_brand_header_one = $brand_header_one; }
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; }