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 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"); }
if ($do == "import") { $tpl_file = "product.import"; template($tpl_file); exit; } if ($do == "edit") { if (!empty($id)) { $res = $product->getInfo($id); if (!empty($res['picture'])) { $res['image'] = pb_get_attachmenturl($res['picture'], '../', 'small'); } $tag->getTagsByIds($res['tag_ids'], true); $res['tag'] = $tag->tag; $r1 = $industry->disSubOptions($res['industry_id'], "industry_"); $r2 = $area->disSubOptions($res['area_id'], "area_"); $seo = $meta->getSEOById($id, 'product'); $res = am($res, $r1, $r2, $seo); setvar("item", $res); unset($res); } $tpl_file = "product.edit"; template($tpl_file); exit; } if ($do == 'search') { if (!empty($_GET['username'])) { $member_id = $pdb->GetOne("SELECT id from {$tb_prefix}members where username='******'username'] . "'"); if ($member_id) { $conditions[] = "Product.member_id='" . $member_id . "'"; } }
$res = $pdb->GetRow($sql); if (isset($res['picture'])) { $res['image'] = pb_get_attachmenturl($res['picture'], '../', 'small'); } $res['pubdate'] = df($res['submit_time']); $res['expdate'] = df($res['expire_time']); $highlight_style = parse_highlight($res['highlight'], true); setvar("hl", $highlight_style); if (empty($res)) { flash(); } else { $tag->getTagsByIds($res['tag_ids'], true); $res['tag'] = $tag->tag; $r1 = $industry->disSubOptions($res['industry_id'], "industry_"); $r2 = $area->disSubOptions($res['area_id'], "area_"); $seo = $meta->getSEOById($id, 'trade'); $res = am($res, $r1, $r2, $seo); setvar("item", $res); } } $tpl_file = "offer.edit"; template($tpl_file); exit; } if ($do == "search") { if (!empty($_GET['display_pg']) && in_array($_GET['display_pg'], $page->page_option)) { $page->displaypg = $_GET['display_pg']; } if ($_GET['type_id'] > 0) { $conditions[] = "Trade.type_id='" . $_GET['type_id'] . "'"; }
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"); }
setvar("NewstypeOptions", $_newstypes); if (!empty($id)) { $item_info = $news->read("*", $id); if ($item_info['picture']) { $item_info['image'] = pb_get_attachmenturl($item_info['picture'], "../", 'small'); } $tag->getTagsByIds($item_info['tag_ids'], true); $item_info['tag'] = $tag->tag; } if ($action == "convert") { if (!empty($_GET['companynewsid'])) { $item_info['title'] = $pdb->GetOne("SELECT title FROM {$tb_prefix}companynewses WHERE id=" . intval($_GET['companynewsid'])); } } if (!empty($item_info)) { $seo = $meta->getSEOById($id, 'news'); $item_info = am($item_info, $seo); setvar("item", $item_info); } $tpl_file = "news.edit"; template($tpl_file); exit; } } if (isset($_POST['update']) && !empty($_POST['if_focus'])) { $pdb->Execute("UPDATE " . $news->getTable() . " SET if_focus=0"); $pdb->Execute("UPDATE " . $news->getTable() . " SET if_focus=1 WHERE id=" . intval($_POST['if_focus'])); } if (isset($_POST['focus']) && !empty($_POST['id'])) { $ids = implode(",", $_POST['id']); if ($ids) {