function detail() { global $viewhelper; using("tag", "meta"); $tag = new Tags(); $meta = new Metas(); $conditions = array(); $viewhelper->setTitle(L("info", "tpl")); $viewhelper->setPosition(L("info", "tpl"), "index.php?do=news"); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $this->news->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $_PB_CACHE['newstype'] = cache_read("type", "newstype"); $this->news->clicked($id); $info = $this->news->read("*", $id); if (empty($info) or !$info) { flash("data_not_exists", '', 0); } if (!empty($info['tag_ids'])) { $the_tags = $tag->getTagsByIds($info['tag_ids'], true); $tmp = null; $info['tag'] = $tag->tag; foreach ($the_tags as $key => $val) { $tmp .= "<a href='" . $this->url(array("module" => "search", "do" => "news", "q" => urlencode($val))) . "'>" . $val . "</a> "; } $info['tag_link'] = $tmp; } if (!empty($info['picture'])) { $info['image'] = pb_get_attachmenturl($info['picture'], '', 'small'); } $info['pubdate'] = df($info['created']); $info['typename'] = $_PB_CACHE['newstype'][$info['type_id']]; $viewhelper->setTitle($info['typename']); $viewhelper->setPosition($info['typename'], $this->url(array("module" => "search", "do" => "news", "typeid" => $info['type_id']))); //seo info $meta_info = $meta->getSEOById($id, 'news', false); empty($meta_info['title']) ? $viewhelper->setTitle($info['title']) : $viewhelper->setTitle($meta_info['title']); empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']); if (isset($meta_info['keyword'])) { $viewhelper->setMetaKeyword($meta_info['keyword']); } $viewhelper->setPosition($info['title']); if (!empty($info['require_membertype'])) { $require_ids = explode(",", $info['require_membertype']); if (!empty($pb_userinfo['pb_userid'])) { $membertype_id = $this->news->dbstuff->GetOne("SELECT membertype_id FROM {$tb_prefix}members WHERE id='" . $pb_user['pb_userid'] . "'"); if (!in_array($membertype_id, $require_ids)) { $info['content'] = L("news_membertype_not_allowed", "tpl"); } } else { $info['content'] = L("news_membertype_not_allowed", "tpl"); } } if ($info['type'] == 1) { $info['source'] = L("company_news", "tpl"); $info['content'] = "<a href='" . $info['content'] . "'>" . $info['content'] . "</a>"; } if (!empty($info['picture'])) { $info['image_url'] = pb_get_attachmenturl($info['picture']); } $neighbour_info = $this->news->getNeighbour($id, "id,title"); if (!empty($neighbour_info['prev'])) { $title = pb_lang_split($neighbour_info['prev']['title']); $info['prev_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['prev']['id'])) . "'>" . $title . "</a>"; $info['prev_title'] = $title; } else { $info['prev_link'] = L("nothing", "tpl"); } if (!empty($neighbour_info['next'])) { $title = pb_lang_split($neighbour_info['next']['title']); $info['next_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['next']['id'])) . "'>" . $title . "</a>"; $info['next_title'] = $title; } else { $info['next_link'] = L("nothing", "tpl"); } setvar("item", pb_lang_split_recursive($info)); } else { flash(); } setvar("Newstypes", $_PB_CACHE['newstype']); render("detail.default"); }
function ViewList($page, $cate, $auth, $date, $tags, $isrewrite = false) { global $zbp; foreach ($GLOBALS['Filter_Plugin_ViewList_Begin'] as $fpname => &$fpsignal) { $fpreturn = $fpname($page, $cate, $auth, $date, $tags); if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) { return $fpreturn; } } //if($cate=='index.php'|$auth=='index.php'|$date=='index.php'|$tags=='index.php'){ // $cate=$auth=$date=$tags=null; //} $type = 'index'; if ($cate !== null) { $type = 'category'; } if ($auth !== null) { $type = 'author'; } if ($date !== null) { $type = 'date'; } if ($tags !== null) { $type = 'tag'; } $category = null; $author = null; $datetime = null; $tag = null; $w = array(); $w[] = array('=', 'log_Istop', 0); $w[] = array('=', 'log_Status', 0); $page = (int) $page == 0 ? 1 : (int) $page; $articles_top = array(); $articles = array(); if ($type == 'index' && $page == 1) { $articles_top = $zbp->GetArticleList(array('*'), array(array('=', 'log_Istop', 1), array('=', 'log_Status', 0)), array('log_PostTime' => 'DESC'), null, null); } switch ($type) { ######################################################################################################## case 'index': $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']); $pagebar->Count = $zbp->cache->normal_article_nums; $category = new Metas(); $author = new Metas(); $datetime = new Metas(); $tag = new Metas(); $template = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE']; if ($page == 1) { $zbp->title = $zbp->subname; } else { $zbp->title = str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } break; ######################################################################################################## ######################################################################################################## case 'category': $pagebar = new Pagebar($zbp->option['ZC_CATEGORY_REGEX']); $author = new Metas(); $datetime = new Metas(); $tag = new Metas(); $category = new Category(); if (strpos($zbp->option['ZC_CATEGORY_REGEX'], '{%id%}') !== false) { $category = $zbp->GetCategoryByID($cate); } if (strpos($zbp->option['ZC_CATEGORY_REGEX'], '{%alias%}') !== false) { $category = $zbp->GetCategoryByAliasOrName($cate); } if ($category->ID == 0) { if ($isrewrite == true) { return ZC_REWRITE_GO_ON; } $zbp->ShowError(2); } if ($page == 1) { $zbp->title = $category->Name; } else { $zbp->title = $category->Name . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $category->Template; if (!$zbp->option['ZC_DISPLAY_SUBCATEGORYS']) { $w[] = array('=', 'log_CateID', $category->ID); $pagebar->Count = $category->Count; } else { $arysubcate = array(); $arysubcate[] = array('log_CateID', $category->ID); foreach ($zbp->categorys[$category->ID]->SubCategorys as $subcate) { $arysubcate[] = array('log_CateID', $subcate->ID); } $w[] = array('array', $arysubcate); } $pagebar->UrlRule->Rules['{%id%}'] = $category->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $category->Alias == '' ? urlencode($category->Name) : $category->Alias; break; ######################################################################################################## ######################################################################################################## case 'author': $pagebar = new Pagebar($zbp->option['ZC_AUTHOR_REGEX']); $category = new Metas(); $datetime = new Metas(); $tag = new Metas(); $author = new Member(); if (strpos($zbp->option['ZC_AUTHOR_REGEX'], '{%id%}') !== false) { $author = $zbp->GetMemberByID($auth); } if (strpos($zbp->option['ZC_AUTHOR_REGEX'], '{%alias%}') !== false) { $author = $zbp->GetMemberByAliasOrName($auth); } if ($author->ID == 0) { if ($isrewrite == true) { return ZC_REWRITE_GO_ON; } $zbp->ShowError(2); } if ($page == 1) { $zbp->title = $author->Name; } else { $zbp->title = $author->Name . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $author->Template; $w[] = array('=', 'log_AuthorID', $author->ID); $pagebar->Count = $author->Articles; $pagebar->UrlRule->Rules['{%id%}'] = $author->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $author->Alias == '' ? urlencode($author->Name) : $author->Alias; break; ######################################################################################################## ######################################################################################################## case 'date': $pagebar = new Pagebar($zbp->option['ZC_DATE_REGEX']); $category = new Metas(); $author = new Metas(); $tag = new Metas(); $datetime = strtotime($date); $datetitle = str_replace(array('%y%', '%m%'), array(date('Y', $datetime), date('n', $datetime)), $zbp->lang['msg']['year_month']); if ($page == 1) { $zbp->title = $datetitle; } else { $zbp->title = $datetitle . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $zbp->modulesbyfilename['calendar']->Content = BuildModule_calendar(date('Y', $datetime) . '-' . date('n', $datetime)); $template = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE']; $w[] = array('BETWEEN', 'log_PostTime', $datetime, strtotime('+1 month', $datetime)); $pagebar->UrlRule->Rules['{%date%}'] = $date; $datetime = Metas::ConvertArray(getdate($datetime)); break; ######################################################################################################## ######################################################################################################## case 'tag': $pagebar = new Pagebar($zbp->option['ZC_TAGS_REGEX']); $category = new Metas(); $author = new Metas(); $datetime = new Metas(); $tag = new Tag(); if (strpos($zbp->option['ZC_TAGS_REGEX'], '{%id%}') !== false) { $tag = $zbp->GetTagByID($tags); } if (strpos($zbp->option['ZC_TAGS_REGEX'], '{%alias%}') !== false) { $tag = $zbp->GetTagByAliasOrName($tags); } if ($tag->ID == 0) { if ($isrewrite == true) { return ZC_REWRITE_GO_ON; } $zbp->ShowError(2); } if ($page == 1) { $zbp->title = $tag->Name; } else { $zbp->title = $tag->Name . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $tag->Template; $w[] = array('LIKE', 'log_Tag', '%{' . $tag->ID . '}%'); $pagebar->UrlRule->Rules['{%id%}'] = $tag->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $tag->Alias == '' ? urlencode($tag->Name) : $tag->Alias; break; } $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; $pagebar->UrlRule->Rules['{%page%}'] = $page; $articles = $zbp->GetArticleList(array('*'), $w, array('log_PostTime' => 'DESC'), array(($pagebar->PageNow - 1) * $pagebar->PageCount, $pagebar->PageCount), array('pagebar' => $pagebar)); $zbp->template->SetTags('title', $zbp->title); $zbp->template->SetTags('articles', array_merge($articles_top, $articles)); if ($pagebar->PageAll == 0) { $pagebar = null; } $zbp->template->SetTags('pagebar', $pagebar); $zbp->template->SetTags('type', $type); $zbp->template->SetTags('page', $page); $zbp->template->SetTags('date', $datetime); $zbp->template->SetTags('tag', $tag); $zbp->template->SetTags('author', $author); $zbp->template->SetTags('category', $category); if (isset($zbp->templates[$template])) { $zbp->template->SetTemplate($template); } else { $zbp->template->SetTemplate('index'); } foreach ($GLOBALS['Filter_Plugin_ViewList_Template'] as $fpname => &$fpsignal) { $fpreturn = $fpname($zbp->template); } $zbp->template->Display(); }
public function LoadConfigs() { $sql = $this->db->sql->Select($this->table['Config'], array('*'), '', '', '', ''); $array = $this->db->Query($sql); foreach ($array as $c) { $m = new Metas(); $m->Unserialize($c['conf_Value']); $this->configs[$c['conf_Name']] = $m; } }
function detail() { global $viewhelper, $G, $pb_user; $positions = $titles = array(); uses("trade", "member", "company", "tradefield", "form", "industry", "area", "meta"); $offer = new Tradefields(); $area = new Areas(); $meta = new Metas(); $industry = new Industries(); $company = new Companies(); $trade = new Trade(); $trade_model = new Trades(); $member = new Members(); //$typeoption = new Typeoption(); $form = new Forms(); setvar("Genders", cache_read("typeoption", 'gender')); setvar("PhoneTypes", cache_read("typeoption", 'phone_type')); $viewhelper->setTitle(L("offer", "tpl")); $viewhelper->setPosition(L("offer", "tpl"), "index.php?do=offer"); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $trade_model->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $trade->setInfoById($id); $info = $trade->info; if (empty($info['id'])) { flash("data_not_exists", '', 0); } $info['title_clear'] = $info['title']; $info['title'] .= ($G['setting']['offer_expire_method'] == 1 || $G['setting']['offer_expire_method'] == 3) && $info['expdate'] < $offer->timestamp ? "[" . L("has_expired", "tpl") . "]" : ''; $info['title'] .= !empty($info['if_urgent']) ? "[" . L("urgent_buy", "tpl") . "]" : ''; if ($info['expdate'] < $offer->timestamp && $G['setting']['offer_expire_method'] == 2) { flash("has_been_expired", URL, 0, $info['title_clear'] . " "); } } else { flash("data_not_exists", '', 0); } if ($info['status'] != 1) { flash("under_checking", null, 0, $info['title_clear'] . " "); } $trade_types = $trade->getTradeTypes(); $viewhelper->setTitle($trade_types[$info['type_id']]); $viewhelper->setPosition($trade_types[$info['type_id']], "index.php?do=offer&action=lists&typeid=" . $info['type_id']); $trade_model->clicked($id); if ($info['require_point'] > 0) { //check member points if (empty($pb_user)) { flash("please_login_first", URL . "logging.php"); } $point = $member->field("points", "id='" . $pb_user['pb_userid'] . "'"); if ($point < $info['require_point']) { flash("not_enough_points", URL, 0, $info['require_point']); } } $form_vars = array(); if (isset($info['formattribute_ids'])) { $form_vars = $form->getAttributes(explode(",", $info['formattribute_ids'])); } setvar("ObjectParams", $form_vars); $info['pubdate'] = df($info['pubdate']); $info['expdate'] = df($info['expdate']); $info['image'] = pb_get_attachmenturl($info['picture']); $login_check = 1; if ($info['type_id'] == 1) { $login_check = $G['setting']['buy_logincheck']; } elseif ($info['type_id'] == 2) { $login_check = $G['setting']['sell_logincheck']; } if (!empty($info['member_id'])) { $member_info = $member->getInfoById($info['member_id']); $info['link_people'] = $member_info['last_name']; $info['space_name'] = $member_info['space_name']; $info['tel'] = $member_info['tel']; $info['address'] = $member_info['address']; $info['zipcode'] = $member_info['zipcode']; $info['fax'] = $member_info['fax']; $info['site_url'] = $member_info['site_url']; setvar("MEMBER", $member_info); } if (!empty($info['company_id'])) { $company_info = $company->getInfoById($info['company_id']); if (!empty($company_info)) { $info['companyname'] = $company_info['name']; $info['link_people'] = $company_info['link_man']; $info['address'] = $company_info['address']; $info['zipcode'] = $company_info['zipcode']; $info['site_url'] = pb_hidestr($company_info['site_url']); $info['tel'] = pb_hidestr($company_info['tel']); $info['fax'] = pb_hidestr($company_info['fax']); } setvar("COMPANY", $company_info); } setvar("LoginCheck", $login_check); $info['title'] = strip_tags($info['title']); $info['industry_names'] = $industry->disSubNames($info['industry_id'], null, true, "offer"); $info['area_names'] = $area->disSubNames($info['area_id'], null, true, "offer"); //delete the pre num.2011.9.1 // $info['tel'] = preg_replace('/\((.+?)\)/i', '', pb_hidestr($info['tel'])); // $info['fax'] = preg_replace('/\((.+?)\)/i', '', pb_hidestr($info['fax'])); $info = pb_lang_split_recursive($info); setvar("item", $info); $meta_info = $meta->getSEOById($id, 'trade', false); empty($meta_info['title']) ? $viewhelper->setTitle($info['title'], $info['picture']) : $viewhelper->setTitle($meta_info['title']); empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']); $viewhelper->setPosition($info['title_clear']); if (isset($meta_info['keyword'])) { $viewhelper->setMetaKeyword($meta_info['keyword']); } setvar("forward", $this->url(array("module" => "offer", "id" => $id))); render("offer/detail"); }
/** * 导出用户列表模块数据 * @param int $level 要导出的用户最低等级,默认为4(即协作者) * @return string 模块内容 */ public static function Authors($level = 4) { global $zbp; $template = $zbp->template; $tags = array(); $authors = array(); $w = array(); $w[] = array('<=', 'mem_Level', $level); $array = $zbp->GetMemberList('*', $w, array('mem_ID' => 'ASC'), null, null); foreach ($array as $member) { $m = Metas::ConvertArray($member->GetData()); unset($m->Guid); unset($m->Password); $authors[] = $m; } $tags['authors'] = $authors; $template->SetTagsAll($tags); $ret = $template->Output('module-authors'); return $ret; }
/** * 显示列表页面 * @api Filter_Plugin_ViewList_Begin * @api Filter_Plugin_ViewList_Template * @param int $page * @param int|string $cate * @param int|string $auth * @param string $date * @param string $tags tags列表 * @param bool $isrewrite 是否启用urlrewrite * @return string */ function ViewList($page, $cate, $auth, $date, $tags, $isrewrite = false) { global $zbp; foreach ($GLOBALS['hooks']['Filter_Plugin_ViewList_Begin'] as $fpname => &$fpsignal) { $fpreturn = $fpname($page, $cate, $auth, $date, $tags); if ($fpsignal == PLUGIN_EXITSIGNAL_RETURN) { $fpsignal = PLUGIN_EXITSIGNAL_NONE; return $fpreturn; } } $type = 'index'; if ($cate !== null) { $type = 'category'; } if ($auth !== null) { $type = 'author'; } if ($date !== null) { $type = 'date'; } if ($tags !== null) { $type = 'tag'; } $category = null; $author = null; $datetime = null; $tag = null; $w = array(); $w[] = array('=', 'log_IsTop', 0); $w[] = array('=', 'log_Status', 0); $page = (int) $page == 0 ? 1 : (int) $page; $articles = array(); $articles_top = array(); switch ($type) { ######################################################################################################## case 'index': $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']); $pagebar->Count = $zbp->cache->normal_article_nums; $template = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE']; if ($page == 1) { $zbp->title = $zbp->subname; } else { $zbp->title = str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } break; ######################################################################################################## ######################################################################################################## case 'category': $pagebar = new Pagebar($zbp->option['ZC_CATEGORY_REGEX']); $category = new Category(); if (!is_array($cate)) { $cateId = $cate; $cate = array(); if (strpos($zbp->option['ZC_CATEGORY_REGEX'], '{%id%}') !== false) { $cate['id'] = $cateId; } if (strpos($zbp->option['ZC_CATEGORY_REGEX'], '{%alias%}') !== false) { $cate['alias'] = $cateId; } } if (isset($cate['id'])) { $category = $zbp->GetCategoryByID($cate['id']); } else { $category = $zbp->GetCategoryByAlias($cate['alias']); } if ($category->ID == 0) { if ($isrewrite == true) { return false; } $zbp->ShowError(2, __FILE__, __LINE__); } if ($page == 1) { $zbp->title = $category->Name; } else { $zbp->title = $category->Name . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $category->Template; if (!$zbp->option['ZC_DISPLAY_SUBCATEGORYS']) { $w[] = array('=', 'log_CateID', $category->ID); $pagebar->Count = $category->Count; } else { $arysubcate = array(); $arysubcate[] = array('log_CateID', $category->ID); foreach ($zbp->categories[$category->ID]->ChildrenCategories as $subcate) { $arysubcate[] = array('log_CateID', $subcate->ID); } $w[] = array('array', $arysubcate); } $pagebar->UrlRule->Rules['{%id%}'] = $category->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $category->Alias == '' ? rawurlencode($category->Name) : $category->Alias; break; ######################################################################################################## ######################################################################################################## case 'author': $pagebar = new Pagebar($zbp->option['ZC_AUTHOR_REGEX']); $author = new Member(); if (!is_array($auth)) { $authId = $auth; $auth = array(); if (strpos($zbp->option['ZC_AUTHOR_REGEX'], '{%id%}') !== false) { $auth['id'] = $authId; } if (strpos($zbp->option['ZC_AUTHOR_REGEX'], '{%alias%}') !== false) { $auth['alias'] = $authId; } } if (isset($auth['id'])) { $author = $zbp->GetMemberByID($auth['id']); } else { $author = $zbp->GetMemberByAliasOrName($auth['alias']); } if ($author->ID == 0) { if ($isrewrite == true) { return false; } $zbp->ShowError(2, __FILE__, __LINE__); } if ($page == 1) { $zbp->title = $author->StaticName; } else { $zbp->title = $author->StaticName . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $author->Template; $w[] = array('=', 'log_AuthorID', $author->ID); $pagebar->Count = $author->Articles; $pagebar->UrlRule->Rules['{%id%}'] = $author->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $author->Alias == '' ? rawurlencode($author->Name) : $author->Alias; break; ######################################################################################################## ######################################################################################################## case 'date': $pagebar = new Pagebar($zbp->option['ZC_DATE_REGEX']); if (!is_array($date)) { $datetime = $date; } else { $datetime = $date['date']; } $dateregex_ymd = '/[0-9]{1,4}-[0-9]{1,2}-[0-9]{1,2}/i'; $dateregex_ym = '/[0-9]{1,4}-[0-9]{1,2}/i'; if (preg_match($dateregex_ymd, $datetime) == 0 && preg_match($dateregex_ym, $datetime) == 0) { return false; } $datetime_txt = $datetime; $datetime = strtotime($datetime); if ($datetime == false) { return false; } if (preg_match($dateregex_ymd, $datetime_txt) != 0 && isset($zbp->lang['msg']['year_month_day'])) { $datetitle = str_replace(array('%y%', '%m%', '%d%'), array(date('Y', $datetime), date('n', $datetime), date('j', $datetime)), $zbp->lang['msg']['year_month_day']); } else { $datetitle = str_replace(array('%y%', '%m%'), array(date('Y', $datetime), date('n', $datetime)), $zbp->lang['msg']['year_month']); } if ($page == 1) { $zbp->title = $datetitle; } else { $zbp->title = $datetitle . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $zbp->modulesbyfilename['calendar']->Content = ModuleBuilder::Calendar(date('Y', $datetime) . '-' . date('n', $datetime)); $template = $zbp->option['ZC_INDEX_DEFAULT_TEMPLATE']; if (preg_match($dateregex_ymd, $datetime_txt) != 0) { $w[] = array('BETWEEN', 'log_PostTime', $datetime, strtotime('+1 day', $datetime)); $pagebar->UrlRule->Rules['{%date%}'] = date('Y-n-j', $datetime); } else { $w[] = array('BETWEEN', 'log_PostTime', $datetime, strtotime('+1 month', $datetime)); $pagebar->UrlRule->Rules['{%date%}'] = date('Y-n', $datetime); } $datetime = Metas::ConvertArray(getdate($datetime)); break; ######################################################################################################## ######################################################################################################## case 'tag': $pagebar = new Pagebar($zbp->option['ZC_TAGS_REGEX']); $tag = new Tag(); if (!is_array($tags)) { $tagId = $tags; $tags = array(); if (strpos($zbp->option['ZC_TAGS_REGEX'], '{%id%}') !== false) { $tags['id'] = $tagId; } if (strpos($zbp->option['ZC_TAGS_REGEX'], '{%alias%}') !== false) { $tags['alias'] = $tagId; } } if (isset($tags['id'])) { $tag = $zbp->GetTagByID($tags['id']); } else { $tag = $zbp->GetTagByAliasOrName($tags['alias']); } if ($tag->ID == 0) { if ($isrewrite == true) { return false; } $zbp->ShowError(2, __FILE__, __LINE__); } if ($page == 1) { $zbp->title = $tag->Name; } else { $zbp->title = $tag->Name . ' ' . str_replace('%num%', $page, $zbp->lang['msg']['number_page']); } $template = $tag->Template; $w[] = array('LIKE', 'log_Tag', '%{' . $tag->ID . '}%'); $pagebar->UrlRule->Rules['{%id%}'] = $tag->ID; $pagebar->UrlRule->Rules['{%alias%}'] = $tag->Alias == '' ? rawurlencode($tag->Name) : $tag->Alias; break; } $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; $pagebar->UrlRule->Rules['{%page%}'] = $page; foreach ($GLOBALS['hooks']['Filter_Plugin_ViewList_Core'] as $fpname => &$fpsignal) { $fpname($type, $page, $category, $author, $datetime, $tag, $w, $pagebar); } if ($zbp->option['ZC_LISTONTOP_TURNOFF'] == false) { $articles_top_notorder = $zbp->GetTopArticle(); foreach ($articles_top_notorder as $articles_top_notorder_post) { if ($articles_top_notorder_post->TopType == 'global') { $articles_top[] = $articles_top_notorder_post; } } if ($type == 'index' && $page == 1) { foreach ($articles_top_notorder as $articles_top_notorder_post) { if ($articles_top_notorder_post->TopType == 'index') { $articles_top[] = $articles_top_notorder_post; } } } if ($type == 'category') { foreach ($articles_top_notorder as $articles_top_notorder_post) { if ($articles_top_notorder_post->TopType == 'category' && $articles_top_notorder_post->CateID == $category->ID) { $articles_top[] = $articles_top_notorder_post; } } } } $select = '*'; $order = array('log_PostTime' => 'DESC'); $limit = array(($pagebar->PageNow - 1) * $pagebar->PageCount, $pagebar->PageCount); $option = array('pagebar' => $pagebar); foreach ($GLOBALS['hooks']['Filter_Plugin_LargeData_Article'] as $fpname => &$fpsignal) { $fpreturn = $fpname($select, $w, $order, $limit, $option); } $articles = $zbp->GetArticleList($select, $w, $order, $limit, $option, true); $zbp->template->SetTags('title', $zbp->title); $zbp->template->SetTags('articles', array_merge($articles_top, $articles)); if ($pagebar->PageAll == 0) { $pagebar = null; } $zbp->template->SetTags('pagebar', $pagebar); $zbp->template->SetTags('type', $type); $zbp->template->SetTags('page', $page); $zbp->template->SetTags('date', $datetime); $zbp->template->SetTags('tag', $tag); $zbp->template->SetTags('author', $author); $zbp->template->SetTags('category', $category); if ($zbp->template->hasTemplate($template)) { $zbp->template->SetTemplate($template); } else { $zbp->template->SetTemplate('index'); } foreach ($GLOBALS['hooks']['Filter_Plugin_ViewList_Template'] as $fpname => &$fpsignal) { $fpreturn = $fpname($zbp->template); } $zbp->template->Display(); return true; }
/** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2258 $ */ require "../libraries/common.inc.php"; require PHPB2B_ROOT . './libraries/page.class.php'; require "session_cp.inc.php"; require LIB_PATH . 'time.class.php'; require CACHE_COMMON_PATH . "cache_type.php"; uses("product", "attachment", "tag", "typeoption", "area", "industry", "meta"); $typeoption = new Typeoption(); $area = new Areas(); $meta = new Metas(); $industry = new Industries(); $attachment = new Attachment('pic'); $tag = new Tags(); $product = new Products(); $page = new Pages(); $conditions = array(); $tpl_file = "product"; setvar("CheckStatus", $typeoption->get_cache_type("common_status")); setvar("BooleanVars", $typeoption->get_cache_type("common_option")); setvar("ProductSorts", $_PB_CACHE['productsort']); if (isset($_POST['save']) && !empty($_POST['data']['product']['name'])) { $result = false; $vals = array(); $vals = $_POST['data']['product']; if (isset($_POST['data']['company_name'])) {
<?php /** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2258 $ */ require "../libraries/common.inc.php"; require LIB_PATH . 'time.class.php'; uses("trade", "tag", "tradefield", "attachment", "keyword", "membertype", "setting", "typeoption", "area", "industry", "meta"); require PHPB2B_ROOT . 'libraries/page.class.php'; require "session_cp.inc.php"; $attachment = new Attachment('pic'); $area = new Areas(); $meta = new Metas(); $industry = new Industries(); $setting = new Settings(); $membertype = new Membertypes(); $offer = new Tradefields(); $tag = new Tags(); $keyword = new Keywords(); $typeoption = new Typeoption(); $trade = new Trades(); $trade_controller = new Trade(); $tpl_file = "offer"; $conditions = array(); $page = new Pages(); $trade_names = $trade_controller->getTradeTypes(); setvar("TradeTypes", $trade_names); setvar("CheckStatus", $check_status = explode(",", L('product_status', 'tpl')));
function detail() { global $viewhelper; $this->loadModel("industry"); using("company", "member", "form", "tag", "area", "meta"); $company = new Companies(); $area = new Areas(); $meta = new Metas(); $tag = new Tags(); $member = new Members(); $form = new Forms(); $tmp_status = explode(",", L('product_status', 'tpl')); $viewhelper->setPosition(L("product_center", 'tpl'), 'index.php?do=product'); $viewhelper->setTitle(L("product_center", 'tpl')); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $this->product->findByName($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } $info = $this->product->getProductById($id); if (empty($info) || !$info) { flash("data_not_exists", '', 0); } $form_vars = array(); if (isset($info['formattribute_ids'])) { $form_vars = $form->getAttributes(explode(",", $info['formattribute_ids']), 2); } setvar("ObjectParams", $form_vars); $info['tag'] = ''; //Initialize tag value if (!empty($info['tag_ids'])) { $tag_res = $tag->getTagsByIds($info['tag_ids']); if (!empty($tag_res)) { $tags = null; foreach ($tag_res as $key => $val) { $tags .= '<a href="' . $this->url(array("module" => "tag", "do" => "product", "q" => $val)) . '" target="_blank">' . $val . '</a> '; } $info['tag'] = $tags; unset($tags, $tag_res, $tag); } } if ($info['state'] != 1) { flash("unvalid_product", '', 0); } if ($info['status'] != 1) { $tmp_key = intval($info['status']); flash("wait_apply", '', 0); } if (!empty($info['member_id'])) { $member_info = $member->getInfoById($info['member_id']); $info['space_name'] = $member_info['space_name']; setvar("MEMBER", $member_info); } if (!empty($info['company_id'])) { $company_info = $company->getInfoById($info['company_id']); if (!empty($company_info)) { $info['companyname'] = $company_info['name']; $info['link_people'] = $company_info['link_man']; $info['address'] = $company_info['address']; $info['zipcode'] = $company_info['zipcode']; $info['site_url'] = $company_info['site_url']; $info['tel'] = pb_hidestr($company_info['tel']); $info['fax'] = pb_hidestr($company_info['fax']); $company_info = pb_lang_split_recursive($company_info); setvar("COMPANY", $company_info); } } $meta_info = $meta->getSEOById($id, 'product', false); empty($meta_info['title']) ? $viewhelper->setTitle($info['name'], $info['picture']) : $viewhelper->setTitle($meta_info['title']); empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']); if (isset($meta_info['keyword'])) { $viewhelper->setMetaKeyword($meta_info['keyword']); } $viewhelper->setPosition($info['name']); $info['industry_names'] = $this->industry->disSubNames($info['industry_id'], null, true, "product"); $info['area_names'] = $area->disSubNames($info['area_id'], null, true, "product"); $info['title'] = strip_tags($info['name']); //delete the pre num.2011.9.1 $info['tel'] = preg_replace('/\\((.+?)\\)/i', '', $info['tel']); $info['fax'] = preg_replace('/\\((.+?)\\)/i', '', $info['fax']); $info = pb_lang_split_recursive($info); setvar("item", $info); $this->product->clicked($id); render("product/detail"); }
<?php /** * [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2258 $ */ require "../libraries/common.inc.php"; uses("news", "newstype", "membertype", "attachment", "tag", "typeoption", "meta"); require LIB_PATH . 'time.class.php'; require PHPB2B_ROOT . 'libraries/page.class.php'; require "session_cp.inc.php"; $tag = new Tags(); $page = new Pages(); $meta = new Metas(); $attachment = new Attachment('pic'); $typeoption = new Typeoption(); $membertype = new Membertypes(); $news = new Newses(); $newstype = new Newstypes(); $conditions = array(); $fields = null; $tpl_file = "news"; setvar("AskAction", $typeoption->get_cache_type("common_option")); if (isset($_GET['do'])) { $do = trim($_GET['do']); if (isset($_GET['action'])) { $action = trim($_GET['action']); } if (!empty($_GET['id'])) {