Example #1
0
            $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']));
    }
    $murl = $is_rewrite ? getcateurl(array('tid' => $cateid, 'listmode' => $listmode)) . '?t' . $extra : getcateurl(array('tid' => $cateid, 'listmode' => $listmode)) . $extra;
    $multi = sanree_brand_multi($count, $perpage, $page, $murl);
}
$recommendlist = sanreeloadcache('recommendlist');
$tabHead['goods'] = $tabHead['news'] = $tabHead['coupon'] = '';
$tabBody['goods'] = $tabBody['news'] = $tabBody['coupon'] = '';
$installmode = array();
$goods_config = $_G['cache']['plugin']['sanree_brand_goods'];
if ($goods_config['isopen']) {
    $modfile = DISCUZ_ROOT . './source/plugin/sanree_brand_goods/function/function_module.php';
    @(require_once $modfile);
    $modurl_goods = goods_getmodeurl();
    $selectpriceunit = $goods_config['selectpriceunit'];
    $marr = explode("\r\n", $selectpriceunit);
$extra .= '&bid=' . $bid;
$brandresult = C::t('#sanree_brand#sanree_brand_businesses')->getusername_by_bidanduid($_G['uid'], $bid);
if (!$brandresult) {
    showmessage(srlang('nobrand'));
}
if ($brandresult['status'] != 1) {
    showmessage(srlang('nostatus'));
}
if ($brandresult['allowalbum'] != 1) {
    showmessage(srlang('noallowalbum'));
}
$brandresult['group'] = getgroup($brandresult['groupid']);
$brandresult['group']['grouplogo'] = $brandresult['group']['grouplogo'] ? fiximage($brandresult['group']['grouplogo']) : 'source/plugin/sanree_brand/tpl/good/images/vip0.gif';
$brandresult['group']['maxalbumcategorytip'] = str_replace('{maxalbumcategory}', $brandresult['group']['maxalbumcategory'], srlang('maxalbumcategorytip'));
$brandresult['group']['maxalbumtip'] = str_replace('{maxalbum}', $brandresult['group']['maxalbum'], srlang('maxalbumtip'));
$brandresult['url'] = getburl($brandresult);
if ($st == 'album_category') {
    if (submitcheck('postsubmit')) {
        foreach ($_G['sr_album_displayorder'] as $id => $title) {
            $setarr = array('displayorder' => intval($_G['sr_album_displayorder'][$id]));
            C::t('#sanree_brand#sanree_brand_album_category')->update($id, $setarr);
        }
        $extra = array();
        $_G['inajax'] = 1;
        $url_forward = srreferer() ? getburl_by_bid($bid) : 'plugin.php?id=sanree_brand&mod=mybrand&view=myalbum&st=album_category&bid=' . $bid;
        if ($_G['inajax']) {
            $href = $url_forward;
            $href = str_replace("'", "\\'", $href);
            $url_forward = '';
            $extra = array('showdialog' => true, 'extrajs' => "<script type=\"text/javascript\" reload=\"1\">//hideWindow();\r\nsetTimeout(\"window.location.href ='" . $href . "';\", 3000);</script>");
        }
 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&amp;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&amp;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;
 }
Example #4
0
<?php

/**
 *      [Sanree] (C)2001-2099 Sanree Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: sanree_brand_branch.php sanree $
 */
if (!defined('IN_DISCUZ')) {
    exit('2014042523s4K4QUOUT9||5057||1411992002');
}
$bid = intval($_G['sr_tid']);
$brandresult = C::t('#sanree_brand#sanree_brand_businesses')->getbusinesses_by_bid($bid);
if (!$brandresult) {
    showmessage(srlang('nodengji'));
}
$pbidlist = array();
foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc(array('c.status=1', 't.pbid=' . $bid, 't.status=1'), 't.istop desc,t.displayorder, t.dateline desc', 0, 100) as $value) {
    $url = getburl($value);
    $pbidlist[] = array('name' => $value['name'], 'url' => $url);
}
$_G['style']['tplfile'] = $template = templateEx($plugin['identifier'] . ':' . $template . '/branch');
include $template;
            $searchfield = array('name', 'propaganda', 'introduction', 'contact', 'poster', 'brandno', 'memo', 'weburl', 'ip', 'reason', 'qq', 'address', 'tel', 'birthprovince', 'birthcity', 'birthdist', 'birthcommunity');
            $search = array();
            foreach ($searchfield as $v) {
                $search[] = "(" . $v . " LIKE '%" . $skeyword . "%')";
            }
            $searchtext .= " AND (" . implode(' OR ', $search) . ")";
            $extra = '&skeyword=' . urlencode($skeyword);
        }
        $count = C::t('#sanree_brand#sanree_brand_businesses')->count_by_where($searchtext);
        if ($cateid) {
            $extra .= "&cateid=" . $cateid;
        }
        $multipage = multi($count, $perpage, $page, ADMINSCRIPT . "?action=plugins&operation=config&act={$act}&identifier=sanree_brand&pmod=admincp{$extra}");
        foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_search($searchtext, $orderby, ($page - 1) * $perpage, $perpage) as $row) {
            $isrecommendstr = $row[isrecommend] == 1 ? ' checked="checked"' : '';
            $viewurl = getburl($row);
            $istopstr = $row[istop] == 1 ? ' checked="checked"' : '';
            $statusstr = $row[status] == 1 ? $langs['yes'] : $langs['no'];
            $isshowsstr = $row[isshow] == 1 ? ' checked="checked"' : '';
            $allowalbumstr = $row[allowalbum] == 1 ? ' checked="checked"' : '';
            $allowfastpoststr = $row[allowfastpost] == 1 ? ' checked="checked"' : '';
            showtablerow('', array('', 'class="td25"', '', 'class="td26"'), array("<input class=\"checkbox\" type=\"checkbox\" name=\"delete[{$row['bid']}]\" value=\"{$row['bid']}\">" . $row["bid"], "<input type=\"text\" class=\"txt\" size=\"12\" name=\"group_displayorder[{$row['bid']}]\" value=\"{$row['displayorder']}\">", $cates[$row[cateid]]["name"], '<a target="_blank" href="forum.php?mod=viewthread&amp;tid=' . $row["tid"] . '">' . $row["tid"] . '</a>', '<a target="_blank" href="forum.php?mod=group&fid=' . $row["syngrouptid"] . '">' . $row["syngrouptid"] . '</a>', '<a target="_blank" href="home.php?mod=space&amp;uid=' . $row["uid"] . '">' . C::t('#sanree_brand#xcommon_member')->fetch_all_username_by_uid($row[uid]) . '</a>', "<input type=\"text\" class=\"txt\" size=\"12\" name=\"group_name[{$row['bid']}]\" value=\"{$row['name']}\">", "<input type=\"checkbox\"  size=\"12\" name=\"group_istop[{$row['bid']}]\" value=\"1\" {$istopstr}>", "<input type=\"checkbox\"  size=\"12\" name=\"group_isrecommend[{$row['bid']}]\" value=\"1\" {$isrecommendstr}>", "<input type=\"checkbox\"  size=\"12\" name=\"group_isshow[{$row['bid']}]\" value=\"1\" {$isshowsstr}>", "<input type=\"checkbox\"  size=\"12\" name=\"group_allowalbum[{$row['bid']}]\" value=\"1\" {$allowalbumstr}>", "<input type=\"checkbox\"  size=\"12\" name=\"group_allowfastpost[{$row['bid']}]\" value=\"1\" {$allowfastpoststr}>", $statusstr, dgmdate($row[dateline]), '<a href="###" onclick="location.href=\'' . ADMINSCRIPT . '?action=plugins&operation=config&act=businesseslist&identifier=sanree_brand&pmod=admincp&do=upgrading&bid=' . $row['bid'] . "&page=" . $page . '\'">' . $langs['do_edit'] . '</a> | ' . '<a href="' . $viewurl . '" target="_blank">' . $langs['do_view'] . '</a>'));
        }
        showsubmit('submit', 'submit', 'del', "<input class=\"checkbox\" type=\"hidden\" name=\"cateid\" value=\"{$cateid}\">", $multipage, false);
        showtablefooter();
        showformfooter();
    }
}
function chkthis($listarr, $data)
{
    $setdata = array();
Example #6
0
    $category_list = array();
    $category = sanreeloadcache('usercate');
    foreach ($category as $value) {
        $category_list[] = $value;
    }
    $navtitle = srlang('dengjititle');
    $addteltitle = $config['djtitle'] ? $config['djtitle'] : srlang('teladd');
    if ($isselfdistrict == 1) {
        $districthtml = brand_setting('birthcity', $result);
    } else {
        include_once libfile('function/profile');
        $districthtml = profile_setting('birthcity', $result);
    }
    $discounthtml = brand_discountsetting($result['discount']);
    $pubtip_price = srlang('pubtip_price');
    $pubtip_price = str_replace(array('{regprice}', '{creditunitname}'), array($regprice, $creditunitname), $pubtip_price);
    $pubtip_shen = srlang('pubtip_shen');
    $pubtip_shen = str_replace(array('{admintel}'), array($admintel), $pubtip_shen);
    $pubtip_ok = srlang('pubtip_ok');
    $pubtip_ok = str_replace(array('{admintel}'), array($admintel), $pubtip_ok);
    if ($_G['inajax'] == 1) {
        include templateEx($plugin['identifier'] . ':' . $template . "/" . $mod . '_ajax');
    } else {
        $newlist = array();
        foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc(array('c.status=1', 't.status=1', 't.isshow=1'), 't.bid desc', 0, 8) as $value) {
            $value[url] = getburl($value);
            $newlist[] = $value;
        }
        include templateEx($plugin['identifier'] . ':' . $template . "/" . $mod);
    }
}
 $start = ($page - 1) * $perpage;
 $start = max(0, $start);
 $multi = '';
 $where = array();
 $where[] = 't.uid=' . $_G['uid'];
 $where[] = 'c.status=1';
 $in = array_search($st, $starray);
 $where[] = 't.status=' . $starrayv[$in];
 $count = C::t('#sanree_brand#sanree_brand_businesses')->count_by_wherec($where);
 if ($count > 0) {
     require_once libfile('function/discuzcode');
     $orderby = 't.istop desc,t.displayorder,t.dateline desc';
     $datalist = C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc($where, $orderby, ($page - 1) * $perpage, $perpage);
     $maxorder = C::t('#sanree_brand#sanree_brand_group')->get_by_maxorder();
     foreach ($datalist as $value) {
         $value['turl'] = getburl($value);
         $value['editurl'] = 'plugin.php?id=sanree_brand&mod=published&bid=' . $value['bid'];
         $value['brandconfigurl'] = 'plugin.php?id=sanree_brand&mod=brandconfig&bid=' . $value['bid'];
         $value['dateline'] = dgmdate($value['dateline']);
         $value['groupimg'] = getgroupimg($value['groupid']);
         if (intval($value['groupid'])) {
             $group = C::t('#sanree_brand#sanree_brand_group')->fetch_order_by_groupid(intval($value['groupid']));
             $value['order'] = $group['order'];
         } else {
             $value['order'] = -1;
         }
         if ($value['order'] == $maxorder['order']) {
             $value['maxorder'] = 1;
         }
         $classarr[$value[bid]] = $value;
     }
Example #8
0
function sanreeupdatecache($cachename)
{
    global $_G;
    $config = $_G['cache']['plugin']['sanree_brand'];
    $cachearray = array('category', 'menu', 'help', 'hotbrandlist', 'newbrandlist', 'recommendlist', 'slidelist');
    $cachename = in_array($cachename, $cachearray) ? $cachename : '';
    if ($cachename == 'slidelist') {
        $list = array();
        for ($t = 1; $t < 3; $t++) {
            $slidelist = array();
            $slide = DB::fetch_first("SELECT * FROM " . DB::table('sanree_brand_slide') . ' where id=' . $t);
            if ($slide) {
                for ($j = 1; $j < 6; $j++) {
                    if ($slide['pic' . $j]) {
                        $picurl = fiximage($slide['pic' . $j]);
                        $link = $slide['movie' . $j];
                        $slidelist[] = array('pic' => $picurl, 'url' => $link);
                    }
                }
            }
            $list[$t] = $slidelist;
        }
        save_syscache('sanree_brand_slidelist', $list);
    } elseif ($cachename == 'recommendlist') {
        $template = trim($config['template']);
        $template = empty($template) ? 'default' : $template;
        define('sr_brand_TPL', 'source/plugin/sanree_brand/tpl');
        define('sr_brand_IMG', sr_brand_TPL . '/' . $template . '/images');
        $adminadurl = $config['adminadurl'];
        $orderby = 't.istop desc,t.displayorder, t.dateline desc';
        $recommendlist = array();
        $ri = 0;
        for ($itc = 0; $itc < 5; $itc++) {
            $wanted = sr_brand_IMG . '/wanted.gif';
            $recommendlist[$itc] = array('name' => '', 'img' => $wanted, 'url' => $adminadurl);
        }
        foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc(array('c.status=1', 't.isrecommend=1', 't.status=1'), $orderby, 0, 5) as $value) {
            $value['recommendimg'] = newtheme($value['recommendimg'], 'common', '/none180x135.jpg');
            if ($reurlmode == 1) {
                $url = empty($value['weburl']) || $value['weburl'] == 'http://' ? getburl($value) : $value['weburl'];
            } else {
                $url = getburl($value);
            }
            $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid(intval($value['tid']));
            list($firsttel) = explode(',', $value['tel']);
            $recommendlist[$ri] = array('name' => $value['name'], 'img' => $value['recommendimg'], 'url' => $url, 'tel' => $firsttel, 'satisfaction' => $voter[3]);
            $ri++;
        }
        save_syscache('sanree_brand_recommendlist', $recommendlist);
    } elseif ($cachename == 'newbrandlist') {
        $orderby = 't.dateline desc';
        $newbrandlist = array();
        foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc(array('c.status=1', 't.isshow=1', 't.status=1'), $orderby, 0, 5) as $value) {
            $class = '';
            if (count($newbrandlist) < 2) {
                $class = ' class="top2"';
            }
            if ($reurlmode == 1) {
                $url = empty($value['weburl']) || $value['weburl'] == 'http://' ? getburl($value) : $value['weburl'];
            } else {
                $url = getburl($value);
            }
            $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid(intval($value['tid']));
            $newbrandlist[] = array('name' => $value['name'], 'url' => $url, 'class' => $class, 'satisfaction' => $voter[3], 'poster' => $issmallpic == 1 && !$config['isbird'] ? brand_getlogo($value['bid'], 0, 90, 60, 'fixnone') : newtheme($value['poster']));
        }
        save_syscache('sanree_brand_newbrandlist', $newbrandlist);
    } elseif ($cachename == 'hotbrandlist') {
        $orderby = 't.views desc';
        $hotbrandlist = array();
        $tel114version = $_G['setting']['plugins']['version']['sanree_tel114'] * 1000;
        foreach (C::t('#sanree_brand#sanree_brand_businesses')->fetch_all_by_searchc(array('c.status=1', 't.isshow=1', 't.status=1'), $orderby, 0, 8) as $value) {
            $class = '';
            if (count($hotbrandlist) < 2) {
                $class = ' class="top2"';
            }
            if ($reurlmode == 1) {
                $url = empty($value['weburl']) || $value['weburl'] == 'http://' ? getburl($value) : $value['weburl'];
            } else {
                $url = getburl($value);
            }
            $voter = C::t('#sanree_brand#sanree_brand_voter')->getvotetotal_by_tid(intval($value['tid']));
            $value['tel114url'] = '';
            $tel114id = intval($value['tel114id']);
            if ($tel114id > 0 && $tel114version >= 1121) {
                $tel114url = $tel114_is_rewrite ? 'tel114-view-' . $tel114id . '.html' : 'plugin.php?id=sanree_tel114&mod=view&tid=' . $tel114id;
                $value['tel114url'] = "<a href=\"" . $tel114url . "\" onclick=\"showWindow('showtelkey', this.href)\"><img height=18 width=18 src=\"source/plugin/sanree_brand/tpl/good/images/stel114.jpg\" /></a>";
            }
            $mcertificationplugin = C::t('#sanree_brand#common_plugin')->fetch_by_identifier('sanree_mcertification');
            $open = C::t('#sanree_brand#common_pluginvar')->fetch_all_by_pluginid($mcertificationplugin['pluginid']);
            if ($open[0]['variable'] == 'isopen') {
                $mcertification_config['isopen'] = $open[0]['value'];
            }
            if ($mcertification_config['isopen']) {
                $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';
                }
            }
            list($firsttel) = explode(',', $value['tel']);
            $hotbrandlist[] = array('name' => $value['name'], 'url' => $url, 'class' => $class, 'tel' => $firsttel, 'satisfaction' => $voter[0], 'poster' => $issmallpic == 1 && !$config['isbird'] ? brand_getlogo($value['bid'], 0, 210, 135, 'fixnone') : newtheme($value['poster']), 'groupsmallicons' => getgroupsmallicons($value['groupid']), 'tel114url' => $value['tel114url'], 'sdiscount' => $value['discount'], 'iscard' => intval($value['iscard']), 'pbid' => intval($value['pbid']), 'mcertification' => $mgif);
        }
        save_syscache('sanree_brand_hotbrandlist', $hotbrandlist);
    } elseif ($cachename == 'help') {
        $help_config = array();
        $brandplugin = C::t('#sanree_brand#common_plugin')->fetch_by_identifier('sanree_brand_help');
        if ($brandplugin) {
            $sanree_brand_help_pluginid = $brandplugin['pluginid'];
        }
        foreach (C::t('#sanree_brand#common_pluginvar')->fetch_all_by_pluginid($sanree_brand_help_pluginid) as $var) {
            if (strexists($var['type'], '_')) {
                continue;
            }
            $help_config[$var['variable']] = $var['value'];
        }
        if (intval($help_config['isopen']) == 1) {
            $helpsort = trim($help_config['helpsort']);
            $marr = explode("\r\n", $helpsort);
            $helpcatedata = array();
            foreach ($marr as $row) {
                list($key, $val) = explode("=", $row);
                $helpcatedata[$key] = array($key, $val);
            }
            $helpcate = array();
            $helpcate[1] = array(1, $helpcatedata[1][1]);
            $helpcate[1]['class'] = ' class="h_intro"';
            $helpcate[1][2] = C::t('#sanree_brand_help#sanree_brand_help')->fetch_all_by_searchc(' AND cateid=1 AND status=1', 'displayorder', 0, 3);
            $helpcate[2] = array(1, $helpcatedata[2][1]);
            $helpcate[2]['class'] = ' class="h_rank"';
            $helpcate[2][2] = C::t('#sanree_brand_help#sanree_brand_help')->fetch_all_by_searchc(' AND cateid=2 AND status=1', 'displayorder', 0, 3);
            $helpcate[3] = array(1, $helpcatedata[3][1]);
            $helpcate[3]['class'] = ' class="h_help"';
            $helpcate[3][2] = C::t('#sanree_brand_help#sanree_brand_help')->fetch_all_by_searchc(' AND cateid=3 AND status=1', 'displayorder', 0, 3);
            $helpcate[4] = array(1, $helpcatedata[4][1]);
            $helpcate[4]['class'] = ' class="h_recommend"';
            $helpcate[4][2] = C::t('#sanree_brand_help#sanree_brand_help')->fetch_all_by_searchc(' AND cateid=4 AND status=1', 'displayorder', 0, 3);
            $helpcate[5] = array(1, $helpcatedata[5][1]);
            $helpcate[5]['class'] = ' class="h_join"';
            $helpcate[5][2] = C::t('#sanree_brand_help#sanree_brand_help')->fetch_all_by_searchc(' AND cateid=5 AND status=1', 'displayorder', 0, 3);
            save_syscache('sanree_brand_help', $helpcate);
        } else {
            save_syscache('sanree_brand_help', '');
        }
    } elseif ($cachename == 'category') {
        $category = $admin_category = $user_category = $subcategory = array();
        $data = C::t('#sanree_brand#sanree_brand_category')->getcategory_by_pcateid(0);
        foreach ($data as $cate) {
            $cate['status'] == 1 && ($user_category[$cate['cateid']] = $cate);
            $cate['status'] == 1 && ($category[$cate['cateid']] = $cate);
            $admin_category[$cate['cateid']] = $cate;
            $subdata = C::t('#sanree_brand#sanree_brand_category')->getcategory_by_pcateid($cate['cateid']);
            $subcategories = array();
            foreach ($subdata as $sub) {
                $subcategories[$sub['cateid']] = $sub;
                $sub['status'] == 1 && ($category[$sub['cateid']] = $sub);
                $sub['name'] = "==>" . $sub['name'];
                $sub['status'] == 1 && ($user_category[$sub['cateid']] = $sub);
                $admin_category[$sub['cateid']] = $sub;
            }
            if ($cate['status'] == 1) {
                $subcategory[$cate['cateid']] = $cate;
                $subcategory[$cate['cateid']]['subcategories'] = $subcategories;
            }
        }
        save_syscache('sanree_brand_category', $category);
        save_syscache('sanree_brand_subcategory', $subcategory);
        save_syscache('sanree_brand_usercate', $user_category);
        save_syscache('sanree_brand_admincate', $admin_category);
    } elseif ($cachename == 'menu') {
        $topmenu = C::t('#sanree_brand#sanree_brand_cmenu')->getusermenu(1);
        $footmenu = C::t('#sanree_brand#sanree_brand_cmenu')->getusermenu();
        save_syscache('sanree_brand_topmenu', $topmenu);
        save_syscache('sanree_brand_footmenu', $footmenu);
    }
}
Example #9
0
 function group_nav_extra_output()
 {
     global $_G;
     $config = $_G['cache']['plugin']['sanree_brand'];
     if (intval($config['allowsyngroup']) != 1) {
         return '';
     }
     $brandresult = C::t('#sanree_brand#sanree_brand_businesses')->fetch_first_byfid(intval($_GET['fid']));
     if (!brandresult) {
         return '';
     }
     $group = C::t('#sanree_brand#sanree_brand_group')->get_by_groupid($brandresult['groupid']);
     if (intval($group['allowsyngroup']) != 1) {
         return '';
     }
     $modfile = DISCUZ_ROOT . './source/plugin/sanree_brand/function/function_core.php';
     @(require_once $modfile);
     $url = getburl($brandresult);
     return "<li ><a href=\"{$url}\" target=\"_blank\">" . srlang('group_nav_extra') . "</a></li>";
 }
 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&amp;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&amp;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;
 }