function detail() { global $viewhelper; $id = $wd = ''; $viewhelper->setPosition(L("dictionary", "tpl"), "index.php?do=dict"); $viewhelper->setTitle(L("dictionary", "tpl")); if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (isset($_GET['wd'])) { $wd = trim($_GET['wd']); } $result = $this->dict->getInfo($id, $wd); if (!empty($result)) { $viewhelper->setPosition($result['typename'], "index.php?do=dict&action=search&typeid=" . $result['dicttype_id']); $viewhelper->setTitle($result['word']); $viewhelper->setPosition($result['word']); $result['typename'] = pb_lang_split($result['typename']); setvar("item", $result); $this->dict->dbstuff->Execute("UPDATE {$this->dict->table_prefix}dicts SET hits=hits+1 WHERE id=" . $id . ""); render("dict/detail", true); } else { flash("data_not_exists"); } }
function index() { global $viewhelper; $conditions = array(); $viewhelper->setTitle(L("announce", "tpl")); $types = cache_read("type"); $viewhelper->setPosition(L("announce", "tpl"), "index.php?do=announce"); if (!empty($_GET['typeid'])) { $conditions[] = "announcetype_id=" . intval($_GET['typeid']); } $result = $this->announcement->findAll("*", null, $conditions, "display_order ASC,id DESC"); if (!empty($result)) { for ($i = 0; $i < count($result); $i++) { if (!empty($result[$i]['created'])) { $result[$i]['pubdate'] = date("Y-m-d", $result[$i]['created']); $result[$i]['title'] = pb_lang_split($result[$i]['subject']); $result[$i]['typename'] = $types['announcementtype'][$result[$i]['announcetype_id']]; $result[$i]['type_id'] = $result[$i]['announcetype_id']; } } setvar("module", "announce"); setvar("items", $result); } render("list.default", true); }
function downloadtxt($info) { $title = pb_lang_split($info['title']); header("Content-type: application/octet-stream"); header("Accept-Ranges: bytes"); Header("Accept-Length: " . filesize($file_name)); header("Content-Disposition: attachment; filename=" . rawurlencode($title) . ".txt"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); echo $title . "\r\n" . pb_lang_split($info['content']); exit; }
function disSubOptions($parent_id, $level) { $data = $this->findAll("*", null, "parent_id='" . $parent_id . "'", "id ASC"); if (!empty($data)) { $this->hasChildren = true; foreach ($data as $key => $val) { $this->typeOptions .= '<option value="' . $val['id'] . '">'; $this->typeOptions .= str_repeat(' ', $level) . pb_lang_split($val['name']); $this->typeOptions .= '</option>' . "\n"; $this->disSubOptions($val['id'], $level + 1); } } else { $this->hasChildren = false; } }
function lists() { global $viewhelper, $pos; $condition = null; $conditions = array(); $viewhelper->setTitle(L("brands", "tpl")); $viewhelper->setPosition(L("brands", "tpl"), "index.php?do=brand"); if (isset($_GET['catid'])) { $typeid = intval($_GET['catid']); //$conditions[] = "type_id='".$typeid."'";//after 4.0.1 $type_info = $this->brand->dbstuff->GetRow("SELECT * FROM {$this->brand->table_prefix}brandtypes WHERE id='" . $typeid . "'"); if (!empty($type_info)) { $type_ids = $this->brand->dbstuff->GetArray("SELECT id FROM {$this->brand->table_prefix}brandtypes WHERE parent_id='" . $typeid . "' OR id='" . $typeid . "'"); foreach ($type_ids as $key => $val) { $tmp[] = $val['id']; } if (!empty($tmp)) { $conditions[] = "type_id IN (" . implode(",", $tmp) . ")"; } } $type_name = pb_lang_split($type_info['name']); $viewhelper->setTitle($type_name); $viewhelper->setPosition($type_name, "index.php?do=brand&action=lists&catid=" . $typeid); $rs = $this->brand->dbstuff->GetArray("SELECT id,name FROM {$this->brand->table_prefix}brandtypes WHERE parent_id='" . $typeid . "'"); } if (empty($rs)) { $rs = $this->brand->dbstuff->GetArray("SELECT id,name FROM {$this->brand->table_prefix}brandtypes WHERE parent_id=0"); } if (isset($_GET['q'])) { $searchkeywords = $_GET['q']; $conditions[] = "name like '%" . $searchkeywords . "%'"; } if (isset($_GET['letter'])) { $viewhelper->setTitle(L("brands_with_letter", "tpl", $_GET['letter'])); $viewhelper->setPosition(L("brands_with_letter", "tpl", $_GET['letter'])); $conditions[] = "letter='" . trim($_GET['letter']) . "'"; } $this->brand->setCondition($conditions); $amount = $this->brand->findCount(null, $conditions); $sql = "SELECT * FROM {$this->brand->table_prefix}brands" . $this->brand->getCondition() . " LIMIT " . $pos . "," . $this->displaypg; $result = $this->brand->dbstuff->GetArray($sql); $result = $this->brand->formatResult($result); setvar('items', $result); setvar('Types', pb_lang_split_recursive($rs)); setvar("paging", array('total' => $amount)); render("brand/list"); }
function detail() { global $viewhelper; $tpl_file = "help/detail"; $viewhelper->setTitle(L("help_center", "tpl")); $viewhelper->setPosition(L("help_center", "tpl"), "index.php?do=help"); if (isset($_GET['id'])) { $id = intval($_GET['id']); $help_result = $this->help->dbstuff->GetRow("SELECT * FROM {$this->help->table_prefix}helps WHERE id=" . $id); if (!empty($help_result)) { $title = pb_lang_split($help_result['title']); $viewhelper->setTitle($title); $viewhelper->setPosition($title); setvar("item", $help_result); } } render($tpl_file); }
function formatResult($result) { $trusttypes = cache_read("trusttype"); $countries = cache_read("country"); $membergroups = cache_read("membergroup"); if (class_exists("Trade")) { $trade_controller = new Trade(); } else { uses("trade"); $trade_controller = new Trade(); } if (class_exists("Form")) { $form = new Forms(); } else { uses("trade"); $form = new Forms(); } if (!empty($result)) { if (empty($trusttypes)) { $trusttypes = cache_read("trusttype"); } $result_count = count($result); for ($i = 0; $i < $result_count; $i++) { if (empty($result[$i]['userid'])) { $result[$i]['userid'] = $result[$i]['username']; } if (!empty($result[$i]['formattribute_ids'])) { $tmp_arr = $form->getAttribute(explode(",", $result[$i]['formattribute_ids'])); if (!empty($tmp_arr)) { foreach ($tmp_arr as $key => $val) { $result[$i][$key] = $val; } } } if (!empty($result[$i]['country_id'])) { $result[$i]['country'] = pb_get_attachmenturl($countries[$result[$i]['country_id']]['picture'], '', 'country'); } $result[$i]['im'] = $this->formatIM($result[$i]['cache_contacts']); $result[$i]['pubdate'] = df($result[$i]['submit_time']); $result[$i]['content'] = strip_tags(pb_lang_split($result[$i]['content'])); $result[$i]['title'] = pb_lang_split($result[$i]['title']); if (!empty($result[$i]['membergroup_id'])) { $result[$i]['gradeimg'] = pb_get_attachmenturl($membergroups[$result[$i]['membergroup_id']]['avatar'], '', 'group'); $result[$i]['gradename'] = $membergroups[$result[$i]['membergroup_id']]['name']; } $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small'); $trusttype_images = null; if (!empty($result[$i]['trusttype_ids'])) { $tmp_trusttype = explode(",", $result[$i]['trusttype_ids']); foreach ($tmp_trusttype as $val) { $trusttype_images .= '<img src="' . $trusttypes[$val]['avatar'] . '" alt="' . $trusttypes[$val]['name'] . '" />'; } } $result[$i]['trusttype'] = $trusttype_images; } return $result; } else { return null; } }
function setPosition($title, $url = null, $displayorder = 0, $additonalParams = array()) { $this->position[] = array('displayorder' => $displayorder, 'title' => pb_lang_split($title), 'url' => $url, 'params' => $additonalParams); }
function detail() { global $viewhelper; require CACHE_COMMON_PATH . "cache_type.php"; $tpl_file = "detail.default"; $viewhelper->setTitle(L("standards", "tpl")); $viewhelper->setPosition(L("standards", "tpl"), "index.php?do=standard"); if (isset($_GET['title'])) { $title = trim($_GET['title']); $res = $this->standard->findByTitle($title); $id = $res['id']; } if (isset($_GET['id'])) { $id = intval($_GET['id']); } if (!empty($id)) { $info = $this->standard->read("*", $id); if (empty($info) or !$info) { flash("data_not_exists", '', 0); } $info['pubdate'] = df($info['created']); $info['typename'] = $_PB_CACHE['standardtype'][$info['type_id']]; $viewhelper->setTitle($info['typename']); $viewhelper->setPosition($info['typename'], "index.php?do=standard&action=lists&typeid=" . $info['type_id']); $viewhelper->setTitle($info['title']); $viewhelper->setPosition($info['title']); if (!empty($info['attachment_id'])) { $info['attach_hashid'] = $info['attachment_id']; } $info['download_article'] = 1; //neighbour $neighbour_info = $this->standard->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" => "standard", "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" => "standard", "id" => $neighbour_info['next']['id'])) . "'>" . $title . "</a>"; $info['next_title'] = $title; } else { $info['next_link'] = L("nothing", "tpl"); } $info = pb_lang_split_recursive($info); setvar("item", $info); $this->standard->clicked($id); render($tpl_file, true); } }
/** * Smarty lower modifier plugin * * Type: modifier<br> * Name: lower<br> * Purpose: convert string to lowercase * @link http://smarty.php.net/manual/en/language.modifier.lower.php * lower (Smarty online manual) * @author Monte Ohrt <monte at ohrt dot com> * @param string * @return string */ function smarty_modifier_pl($string) { return pb_lang_split($string); }
/** * [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: 2075 $ */ function smarty_block_getdata($params, $content, Smarty_Internal_Template $sTemplate, &$repeat) { $conditions = $orderbys = array(); $mysql_limit = $mysql_orderby = $image_col = $_seperate = ''; $target = "_blank"; extract($params); if (!isset($params['assign'])) { $assign = 'row'; } if (!empty($params['name'])) { $assign = trim($params['name']); } $C = new PbController(); $M = new PbModel(); $M->condition = ''; //Initial any last conditions $_table = $params['module']; switch ($params['module']) { case "offer": case "trade": $_table = "trade"; break; case "fair": case "expo": $_table = "expo"; break; case "announce": $_table = "announcement"; break; case "ads": $_table = "adses"; break; case "adword": $_table = "spread"; break; case "price": $_table = "productprice"; break; case "adses": break; default: break; } if (method_exists($sTemplate, 'get_template_vars')) { $_bindex = $sTemplate->getTemplateVars('_bindex'); } else { $_bindex = $sTemplate->getVariable('_bindex')->value; } if (!$_bindex) { $_bindex = array(); } if (isset($params['name'])) { if (!isset($_bindex[$params['name']])) { $_bindex[$params['name']] = 1; } else { $_bindex[$params['name']]++; } } $sTemplate->assign('_bindex', $_bindex); if (!isset($sTemplate->block_data)) { $sTemplate->block_data = array(); } $iTags = count($sTemplate->_tag_stack); /** * set condition */ $limit = $offset = 0; if (isset($params['row'])) { $limit = $params['row']; } if (isset($params['start'])) { $offset = $params['start']; } if (isset($_GET['pos'])) { $_pos = intval($_GET['pos']); $offset = ceil($_pos / $limit) * $row; } if (!empty($params['flag'])) { $conditions[] = "flag='" . $params['flag'] . "'"; } if ($_table == "industry" or $_table == "area") { if (isset($params['parentid'])) { if (!empty($params['parentid'])) { $conditions['parentid'] = "parent_id='" . intval($params['parentid']) . "' OR id=" . intval($params['parentid']); } else { $conditions['parentid'] = "parent_id=0"; } } else { $conditions['parentid'] = "parent_id=0"; } } if (!empty($params['level'])) { if ($_table == "newstype") { $conditions[] = "level_id='" . $params['level'] . "'"; } else { $conditions[] = "level='" . $params['level'] . "'"; } } if (isset($params['type'])) { $type = explode(",", $params['type']); $type = array_unique($type); foreach ($type as $val) { switch ($val) { case 'image': if ($module == "friendlink") { $image_col = "logo"; } else { $image_col = "picture"; } $conditions[] = "{$image_col}!=''"; break; case 'hot': $orderbys[] = "hits DESC"; break; case 'commend': $conditions[] = "if_commend='1'"; break; default: break; } } } if (isset($params['exclude'])) { $conditions[] = $M->getExcludeIds($params['exclude']); } if (isset($params['include'])) { $conditions[] = $M->getIncludeIds($params['include']); } if (isset($params['orderby'])) { $orderbys[] = trim($params['orderby']); } if (!empty($row) && $row != 'all' && $row != -1) { $M->setLimitOffset($offset, $limit); $mysql_limit = $M->getLimitOffset(); } if (!empty($params['limit'])) { $mysql_limit = " " . trim($params['limit']); } if (!empty($_GET['producttypeid'])) { $conditions[] = "type_id=" . intval($_GET['producttypeid']); } if (!empty($params['companyid'])) { $conditions[] = "company_id=" . intval($params['companyid']); } if (!empty($params['industryid'])) { $conditions[] = "industry_id=" . intval($params['industryid']); } if (!empty($params['typeid'])) { if ($_table == 'adses') { $conditions[] = "adzone_id=" . intval($params['typeid']); } else { $conditions[] = "type_id=" . intval($params['typeid']); } } if (empty($sTemplate->block_data[$iTags])) { # ************************************************************************ # Main content $M->setCondition($conditions); $M->setOrderby($orderbys); $sql = sprintf("SELECT * FROM %s%s %s %s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition(), $M->getOrderby(), $mysql_limit); $sTemplate->block_data[$iTags] = $M->GetArray($sql); //如果没有数据,那就不用再执行了(repeat) if (!$sTemplate->block_data[$iTags]) { return $repeat = false; } if (isset($stat)) { $_total_count = $M->dbstuff->GetOne(sprintf("SELECT count(*) FROM %s%s %s", $M->table_prefix, $C->pluralize($_table), $M->getCondition())); $sTemplate->assign('total_count', $_total_count); $sTemplate->assign("paging", array('total' => $_total_count)); } # End main content # ************************************************************************ } if (!$sTemplate->block_data[$iTags]) { $repeat = false; return ''; } if (!function_exists("smarty_function_the_url")) { require "function.the_url.php"; } $counts = count($sTemplate->block_data[$iTags]); if (list($key, $item) = each($sTemplate->block_data[$iTags])) { $_title = $_title_full = $_content = $_content_full = ''; $item['rownum'] = $key; $item['iteration'] = ++$key; if (!empty($item['url'])) { $url = $item['url']; } else { $url = smarty_function_the_url(array("do" => $module, "id" => $item['id'], "action" => 'detail')); } if ($module == "company") { $url = smarty_function_the_url(array("id" => $item['id'], "do" => "company", "userid" => $item['cache_spacename'])); } elseif ($module == "tag") { $url = smarty_function_the_url(array("do" => "product", "action" => 'lists', "q" => $item['name'])); } $item['url'] = $url; if (isset($item['title'])) { $_title = $item['name'] = $item['title']; } elseif (isset($item['name'])) { $_title = $item['title'] = $item['name']; } elseif (isset($item['subject'])) { $_title = $item['title'] = $item['subject']; } elseif (isset($item['word'])) { $_title = $item['title'] = $item['word']; } $_title_full = $_title; $item['title'] = $_title = strip_tags(pb_lang_split($_title)); $_title_full = strip_tags(pb_lang_split($_title_full)); if (!empty($titlelen)) { $_title = mb_substr($_title, 0, $titlelen); } if (isset($item['description'])) { $_content = $item['description']; } elseif (isset($item['content'])) { $_content = $item['content']; } if (isset($item['clicked'])) { $item['hits'] = $item['clicked']; } $_content_full = $_content; if (!empty($_content) && isset($infolen)) { $_content = mb_substr($_content, 0, $infolen); } if (isset($item['created'])) { $item['pubdate'] = df($item['created'], "m-d"); } elseif (isset($item['submit_time'])) { $item['pubdate'] = df($item['submit_time']); } if (!empty($params['sep'])) { $_seperate = $params['sep']; } $item['content'] = $_content = strip_tags(pb_lang_split($_content)); // if($seperate) $_title = ($key==$counts-1)?$_title:$_title.$seperate; $item['link'] = '<a title="' . $_title_full . '" href="' . $url . '" target="' . $target . '">' . $_title . '</a>' . $_seperate; $media_url = ''; if (!empty($item['picture'])) { $media_url = $item['picture']; if (!empty($media_url)) { $item['thumb'] = $item['src'] = pb_get_attachmenturl($media_url, '', 'small'); } } if (!empty($item['source_url'])) { $media_url = $item['source_url']; if (!empty($media_url)) { $item['thumb'] = $item['src'] = $media_url; } } if (isset($item['highlight'])) { $item['style'] = parse_highlight($item['highlight']); } $sTemplate->assign($assign, $item); $repeat = true; } else { $repeat = false; reset($sTemplate->block_data[$iTags]); if (isset($params['name'])) { unset($_bindex[$params['name']]); $sTemplate->assign('_bindex', $_bindex); } } if (!is_null($content)) { print $content; } if (!$repeat) { $sTemplate->block_data[$iTags] = array(); } }
function lists() { global $pos; require CACHE_COMMON_PATH . "cache_type.php"; $_PB_CACHE['area'] = cache_read("area"); $_PB_CACHE['industry'] = cache_read("industry"); using("area"); $area = new Areas(); $conditions = array(); $this->view_helper->setTitle(L("fair", "tpl")); $this->view_helper->setPosition(L("fair", "tpl"), "index.php?do=fair"); if (!empty($_GET['q'])) { $conditions[] = "name like '%" . $_GET['q'] . "%'"; } if (!empty($_GET['type'])) { if ($_GET['type'] == "commend") { $conditions[] = "if_commend=1"; } } if (!empty($_GET['typeid'])) { $type_id = intval($_GET['typeid']); $conditions[] = "expotype_id=" . $type_id; $type_name = $_PB_CACHE['expotype'][$type_id]; $this->view_helper->setTitle($type_name); $this->view_helper->setPosition($type_name, "index.php?do=fair&action=lists&typeid=" . $type_id); } if (isset($_GET['areaid'])) { $area_id = intval($_GET['areaid']); $tmp_info = $area->setInfo($area_id); if (!empty($tmp_info)) { $conditions[] = "area_id" . $tmp_info['level'] . "=" . $tmp_info['id']; $this->view_helper->setTitle($tmp_info['name']); $this->view_helper->setPosition($tmp_info['name'], "index.php?do=fair&action=lists&areaid=" . $tmp_info['id']); } } $amount = $this->expo->findCount(null, $conditions); $result = $this->expo->findAll("*", null, $conditions, "id desc", $pos, $this->displaypg); if (!empty($result)) { for ($i = 0; $i < count($result); $i++) { if ($result[$i]['begin_time']) { $result[$i]['begin_date'] = df($result[$i]['begin_time']); } if ($result[$i]['end_time']) { $result[$i]['end_date'] = df($result[$i]['end_time']); } $result[$i]['description'] = mb_substr(strip_tags(trim(pb_lang_split($result[$i]['description']))), 0, 100); $result[$i]['typename'] = $_PB_CACHE['expotype'][$result[$i]['expotype_id']]; $result[$i]['title'] = pb_lang_split($result[$i]['name']); if (isset($result[$i]['picture'])) { $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small'); } if (!empty($result[$i]['area_id'])) { $result[$i]['area'] = "(" . $_PB_CACHE['area'][1][$result[$i]['area_id']] . ")"; } } setvar("items", $result); } setvar("Areas", $_PB_CACHE['area']); setvar("Type", $_PB_CACHE['expotype']); $this->view_helper->setTitle(L("search", "tpl")); $this->view_helper->setPosition(L("search", "tpl")); setvar("paging", array('total' => $amount)); render("fair/list"); }
<?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: 2075 $ */ define('CURSCRIPT', 'index'); require "libraries/common.inc.php"; require "share.inc.php"; uses("membertype"); $membertype = new Membertypes(); setvar("MemberTypes", pb_lang_split_recursive($membertype->getTypes())); setvar("SiteDescription", pb_lang_split($G['setting']['site_description'])); render("member");
function getChartData() { global $smarty; $this->loadModel("quote"); if (!empty($_GET['type'])) { $type = trim($_GET['type']); if ($type == "price") { $info = $this->quote->dbstuff->GetRow("SELECT * FROM " . $this->quote->table_prefix . "productprices WHERE id=" . $id); $time_limit = strtotime("-1 month"); if (!empty($info)) { $result = $this->quote->dbstuff->GetArray("SELECT FROM_UNIXTIME(created, '%m-%d') AS pubdate,price from " . $this->quote->table_prefix . "productprices WHERE product_id=" . intval($info['product_id']) . " AND created>=" . $time_limit); foreach ($result as $key => $val) { $xy_data['x'][] = $val['pubdate']; $xy_data['y'][] = $val['price']; } setvar("title", pb_lang_split($info['title'])); setvar("trend_x", $xy_data['x']); setvar("trend_y", $xy_data['y']); setvar("x_label", pb_lang_split($info['title'])); } } } else { $info = $this->quote->dbstuff->GetRow("SELECT * FROM " . $this->quote->table_prefix . "quotes WHERE id=" . $id); if (!empty($info['trend_data'])) { $xy_data = unserialize($info['trend_data']); setvar("title", pb_lang_split($info['title'])); setvar("trend_x", $xy_data['x']); setvar("trend_y", $xy_data['y']); } } header('Content-type: text/xml'); echo pack("C3", 0xef, 0xbb, 0xbf); $op = $smarty->fetch("charts/line.html", null, null, true); exit; }
function getCacheArray($cachename = '', $script = '') { $conditions = $curdata = ''; $data = array(); if (empty($cachename) && !empty($this->cache_name)) { $cachename = $this->cache_name; } switch ($cachename) { case 'nav': $this->lang_dirname = ''; $navs = $this->dbstuff->GetArray("SELECT id,name,description,url,target,display_order,highlight FROM {$this->table_prefix}navs WHERE status=1 ORDER BY display_order ASC"); $navmns = $_nlink = array(); if (!empty($navs)) { foreach ($navs as $nav => $nav_val) { $lang_title = $nav_val['name']; $_tmp = pb_lang_split($lang_title, true); foreach ($_tmp as $_nk => $_nv) { $_nlink[$_nk] = '<a href="' . $nav_val['url'] . '" title="' . $_nv . '" ' . parse_highlight($nav_val['highlight']) . '><span>' . $_nv . '</span></a>'; } $navmns[$nav_val['id']]['link'] = pb_lang_merge($_nlink); $navmns[$nav_val['id']]['id'] = $nav_val['id']; $navmns[$nav_val['id']]['name'] = $lang_title; $navmns[$nav_val['id']]['url'] = $nav_val['url']; $navmns[$nav_val['id']]['level'] = $nav_val['display_order']; } $data['navs'] = $navmns; } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; break; case 'trusttype': $this->lang_dirname = ''; $this->dbstuff->setFetchMode(ADODB_FETCH_ASSOC); $conditions = ""; $sql = "SELECT * FROM {$this->table_prefix}trusttypes ORDER BY display_order ASC,id DESC"; $result = $this->dbstuff->GetArray($sql); foreach ($result as $key => $val) { $result[$key]['avatar'] = $val['image']; unset($result[$key]['description'], $result[$key]['display_order'], $result[$key]['status'], $result[$key]['image']); $data[$val['id']] = $result[$key]; } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; break; case 'country': $this->lang_dirname = ''; $this->dbstuff->setFetchMode(ADODB_FETCH_ASSOC); $conditions = ""; $sql = "SELECT * FROM {$this->table_prefix}countries ORDER BY display_order ASC,id ASC"; $result = $this->dbstuff->GetArray($sql); foreach ($result as $key => $val) { $result[$key]['image'] = $val['picture']; unset($result[$key]['display_order']); $data[$val['id']] = $result[$key]; } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray(pb_lang_split_recursive($data)) . ";\n\n"; break; case 'setting': $this->lang_dirname = ''; $tmp_mail = array(); $table = 'setting'; $conditions = ""; $sql = "SELECT * FROM {$this->table_prefix}settings WHERE type_id IN (0,1)"; $setting = $this->dbstuff->GetArray($sql); foreach ($setting as $key => $val) { //For multi $s_title = $val['valued']; $data[$val['variable']] = $s_title; } //set sendmail $tmp_mail['send_mail'] = $data['send_mail']; $tmp_mail['auth_protocol'] = $data['auth_protocol']; $tmp_mail['smtp_server'] = $data['smtp_server']; $tmp_mail['smtp_port'] = $data['smtp_port']; $tmp_mail['smtp_auth'] = $data['smtp_auth']; $tmp_mail['mail_from'] = $data['mail_from']; $tmp_mail['mail_fromwho'] = $data['mail_fromwho']; $tmp_mail['auth_username'] = $data['auth_username']; $tmp_mail['auth_password'] = $data['auth_password']; $tmp_mail['mail_delimiter'] = $data['mail_delimiter']; $tmp_mail['sendmail_silent'] = $data['sendmail_silent']; $data['mail'] = serialize($tmp_mail); unset($tmp_mail, $data['send_mail'], $data['smtp_server'], $data['smtp_port'], $data['smtp_auth'], $data['mail_from'], $data['mail_fromwho'], $data['auth_username'], $data['auth_password'], $data['mail_delimiter'], $data['sendmail_silent']); $data['capt_auth'] = bindec($data['capt_logging'] . $data['capt_register'] . $data['capt_post_free'] . $data['capt_add_market'] . $data['capt_login_admin'] . $data['capt_apply_friendlink'] . $data['capt_service']); unset($data['capt_logging'], $data['capt_register'], $data['capt_post_free'], $data['capt_add_market'], $data['capt_login_admin'], $data['capt_apply_friendlink'], $data['capt_service']); $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; break; case 'area': $this->lang_dirname = ''; $sql = "select * from {$this->table_prefix}areas a where a.parent_id=0 ORDER by display_order asc"; $top_areas = $sec_areas = $third_areas = $areas = $total_areas = array(); $area1 = $this->dbstuff->GetArray($sql); $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n"; $op .= "var data_area = { \n"; foreach ($area1 as $key => $val) { //For multi $i_title = $val['name']; // $tmp = unserialize($val['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $top_areas[$val['id']] = $total_areas[1][$val['id']] = $i_title; $sql = "select * from {$this->table_prefix}areas a where level=2 AND parent_id=" . $val['id'] . " ORDER by display_order asc"; $sec_areas = $this->dbstuff->GetArray($sql); foreach ($sec_areas as $key2 => $val2) { //For multi $i_title = $val2['name']; // $tmp = unserialize($val2['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $third_areas = $this->dbstuff->GetArray("select id,name,parent_id,top_parentid from {$this->table_prefix}areas a where level=3 AND parent_id=" . $val2['id'] . " ORDER by display_order asc"); $areas[$val['id']]['sub'][$val2['id']] = $i_title; $total_areas[2][$val2['id']] = $i_title; foreach ($third_areas as $key3 => $val3) { //For multi $i_title = $val3['name']; // $tmp = unserialize($val3['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $areas[$val2['id']]['sub'][$val3['id']] = $total_areas[3][$val3['id']] = $i_title; } } } $top_areas = pb_lang_split_recursive($this->convert2utf8($top_areas)); $areas = pb_lang_split_recursive($this->convert2utf8($areas)); $op .= "'0':" . json_encode($top_areas); $tmp_op = array(); foreach ($top_areas as $js_key => $js_val) { if (isset($areas[$js_key])) { foreach ($areas[$js_key] as $js_key1 => $js_val1) { $tmp_op[] = "'0,{$js_key}':" . json_encode($areas[$js_key]['sub']); foreach ($areas[$js_key]['sub'] as $js_key2 => $js_val2) { if (!empty($areas[$js_key2]['sub'])) { $tmp_op[] = "'0,{$js_key},{$js_key2}':" . json_encode($areas[$js_key2]['sub']); } } } } } if (!empty($tmp_op)) { $op .= ",\n"; $tmp_op = implode(",\n", $tmp_op); $op .= $tmp_op . "\n}"; } else { $op .= "\n}"; } $fp = file_put_contents($this->cache_path . "area.js", $op); ksort($total_areas); $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($total_areas) . ";\n\n"; //db cache. $data = array(); $op = "<?php\n"; $op .= "return "; $tmp_level_top = $this->dbstuff->GetArray("SELECT id,name,parent_id,level,url FROM " . $this->table_prefix . "areas WHERE available=1 ORDER BY display_order ASC"); $data = pb_format_tree($tmp_level_top, 0); $op .= $this->evalArray($data); unset($data); $op .= "\n"; $op .= "?>"; $fp = file_put_contents(CACHE_COMMON_PATH . "area.php", $op); break; case 'industry': $this->lang_dirname = ''; if (!function_exists("smarty_function_the_url")) { require SLUGIN_PATH . "function.the_url.php"; } $sql = "SELECT name,id,name AS title,description FROM {$this->table_prefix}industries i WHERE i.parent_id=0 and available=1 ORDER BY display_order ASC"; $top_levels = $sec_levels = $third_levels = $datas = $total_datas = array(); $level1 = $this->dbstuff->GetArray($sql); $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n"; $op .= "var data_industry = { \n"; foreach ($level1 as $key => $val) { //For multi $i_title = $val['name']; // $tmp = unserialize($val['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $top_levels[$val['id']] = $total_datas[1][$val['id']] = $i_title; $sql = "SELECT id,name,parent_id,top_parentid,name AS title,description FROM {$this->table_prefix}industries t WHERE available=1 AND level=2 AND parent_id=" . $val['id'] . " ORDER BY display_order ASC"; $sec_levels = $this->dbstuff->GetArray($sql); foreach ($sec_levels as $key2 => $val2) { //For multi $i_title = $val2['name']; // $tmp = unserialize($val2['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $third_levels = $this->dbstuff->GetArray("SELECT id,name,parent_id,top_parentid,name AS title,description FROM {$this->table_prefix}industries t WHERE available=1 AND level=3 AND parent_id=" . $val2['id'] . " ORDER BY display_order ASC"); $datas[$val['id']]['sub'][$val2['id']] = $i_title; $total_datas[2][$val2['id']] = $i_title; foreach ($third_levels as $key3 => $val3) { //For multi $i_title = $val3['name']; // $tmp = unserialize($val3['description']); // if(!empty($tmp[$this->lang_dirname])) $i_title = $tmp[$this->lang_dirname]; $datas[$val2['id']]['sub'][$val3['id']] = $total_datas[3][$val3['id']] = $i_title; } } } $top_levels = pb_lang_split_recursive($this->convert2utf8($top_levels)); $datas = pb_lang_split_recursive($this->convert2utf8($datas)); $op .= "'0':" . json_encode($top_levels); $tmp_op = array(); foreach ($top_levels as $js_key => $js_val) { if (isset($datas[$js_key])) { foreach ($datas[$js_key] as $js_key1 => $js_val1) { $tmp_op[] = "'0,{$js_key}':" . json_encode($datas[$js_key]['sub']); foreach ($datas[$js_key]['sub'] as $js_key2 => $js_val2) { if (!empty($datas[$js_key2]['sub'])) { $tmp_op[] = "'0,{$js_key},{$js_key2}':" . json_encode($datas[$js_key2]['sub']); } } } } } if (!empty($tmp_op)) { $op .= ",\n"; $tmp_op = implode(",\n", $tmp_op); $op .= $tmp_op . "\n}"; } else { $op .= "\n}"; } $fp = file_put_contents($this->cache_path . "industry.js", $op); unset($op); ksort($total_datas); $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($total_datas) . ";\n\n"; unset($top_levels, $sec_levels, $third_levels, $datas, $total_datas, $op); //db cache. $data = array(); $op = "<?php\n"; $op .= "return "; $tmp_level_top = $this->dbstuff->GetArray("SELECT id,name,parent_id,level,url FROM " . $this->table_prefix . "industries WHERE available=1 ORDER BY display_order ASC"); $data = pb_format_tree($tmp_level_top, 0); $op .= $this->evalArray($data); unset($data); $op .= "\n"; $op .= "?>"; $fp = file_put_contents(CACHE_COMMON_PATH . "industry.php", $op); break; case 'userpage': $this->lang_dirname = ''; $sql = "SELECT id,name,title,url,digest FROM {$this->table_prefix}userpages ORDER BY display_order ASC,id ASC"; $result = $this->dbstuff->GetArray($sql); if (!empty($result)) { $i = 0; foreach ($result as $key => $val) { $data[$i]['id'] = $val['id']; $data[$i]['title'] = $val['title']; $data[$i]['name'] = $val['name']; $data[$i]['digest'] = $val['digest']; if (!empty($val['url'])) { $data[$i]['url'] = $val['url']; } else { $data[$i]['url'] = ""; } $i++; } } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; break; case 'form': $this->lang_dirname = ''; $form_result = $this->dbstuff->GetArray("SELECT * FROM {$this->table_prefix}forms ORDER BY id ASC"); if (!empty($form_result)) { foreach ($form_result as $val) { $item_result = $this->dbstuff->GetArray("SELECT * FROM {$this->table_prefix}formitems WHERE id IN (" . $val['items'] . ") ORDER BY id ASC"); if (!empty($item_result)) { foreach ($item_result as $val1) { $data[$val['id']][$val1['id']]['id'] = $val1['identifier']; $data[$val['id']][$val1['id']]['label'] = $val1['title']; } } } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; } break; case 'membergroup': $this->lang_dirname = ''; $sql = "SELECT * FROM {$this->table_prefix}membergroups mg ORDER BY mg.id DESC"; $membergroup_result = $this->dbstuff->GetArray($sql); if (!empty($membergroup_result)) { foreach ($membergroup_result as $key => $val) { $data[$val['id']]['name'] = $val['name']; $data[$val['id']]['max_offer'] = $val['max_offer']; $data[$val['id']]['type_id'] = $val['membertype_id']; $data[$val['id']]['max_product'] = $val['max_product']; $data[$val['id']]['max_job'] = $val['max_job']; $data[$val['id']]['max_companynews'] = $val['max_companynews']; $data[$val['id']]['max_market'] = $val['max_companynews']; $data[$val['id']]['max_album'] = $val['max_companynews']; $data[$val['id']]['max_producttype'] = $val['max_producttype']; $data[$val['id']]['max_attach_size'] = $val['max_attach_size']; $data[$val['id']]['max_size_perday'] = $val['max_size_perday']; $data[$val['id']]['max_favorite'] = $val['max_favorite']; $data[$val['id']]['type'] = $val['type']; $data[$val['id']]['avatar'] = $val['picture']; $data[$val['id']]['allow_space'] = $val['allow_space']; $tmp_allow = sprintf("%02b", $val['allow_offer']); $data[$val['id']]['offer_allow'] = intval($tmp_allow[0]); $data[$val['id']]['offer_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_market']); $data[$val['id']]['market_allow'] = intval($tmp_allow[0]); $data[$val['id']]['market_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_company']); $data[$val['id']]['company_allow'] = intval($tmp_allow[0]); $data[$val['id']]['company_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_product']); $data[$val['id']]['product_allow'] = intval($tmp_allow[0]); $data[$val['id']]['product_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_job']); $data[$val['id']]['job_allow'] = intval($tmp_allow[0]); $data[$val['id']]['job_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_companynews']); $data[$val['id']]['companynews_allow'] = intval($tmp_allow[0]); $data[$val['id']]['companynews_check'] = intval($tmp_allow[1]); $tmp_allow = sprintf("%02b", $val['allow_album']); $data[$val['id']]['album_allow'] = intval($tmp_allow[0]); $data[$val['id']]['album_check'] = intval($tmp_allow[1]); $data[$val['id']]['auth_level'] = intval($val['exempt']); } } $curdata = "\$_PB_CACHE['{$cachename}'] = " . $this->evalArray($data) . ";\n\n"; break; case "javascript": $this->view->clearConfig(); $this->view->configLoad("default.conf", "javascript"); $js_vars = $this->view->getConfigVars(); //arrTemplate is the language pack $op = "<!--// Created " . date("M j, Y, G:i") . " -->\n"; $op .= "var pb_lang = { \n"; if (!empty($js_vars)) { foreach ($js_vars as $key => $val) { $val = str_replace("\"", "", $val); $op .= "\t" . strtoupper(trim($key, '_')) . ' : "' . $val . '",'; $op .= "\n"; } } $op .= "\tEND : ''\n};"; $fp = file_put_contents($this->cache_path . "locale.js", $op); unset($op); break; default: break; } return $curdata; }
/** * [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: 2193 $ */ function smarty_block_area($params, $content, &$smarty, &$repeat) { $conditions = array(); $param_count = count($smarty->_tag_stack); if (empty($params['name'])) { $params['name'] = "area"; } if (class_exists("Areas")) { $area = new Areas(); $area_controller = new Area(); } else { uses("area"); $area = new Areas(); $area_controller = new Area(); } $conditions[] = "available=1"; if (isset($params['typeid'])) { $conditions[] = "areatype_id=" . $params['typeid']; } if (isset($params['depth'])) { //depth if ($params['depth'] == -1) { if (!empty($_GET['level'])) { if (isset($_GET['areaid'])) { $next_level = $area->dbstuff->GetOne("SELECT level FROM " . $area->table_prefix . "areas WHERE id=" . intval($_GET['areaid'])); $next_level += 1; $conditions['level'] = "level=" . $next_level; $conditions['parentid'] = "parent_id=" . intval($_GET['areaid']) . " OR id=" . intval($_GET['areaid']); } elseif (!isset($_GET['industryid'])) { $conditions['level'] = "level=" . intval($_GET['level']); } else { $conditions['level'] = "level=1"; } } else { $conditions['level'] = "level=1"; } } } if (!empty($params['typeid'])) { $conditions[] = "areatype_id=" . $params['typeid']; } if (!empty($params['id'])) { $conditions[] = "id=" . $params['id']; } if (!empty($params['topid'])) { $conditions[] = "top_parentid='" . $params['topid'] . "'"; } if (!empty($params['level'])) { $conditions['level'] = "level=" . $params['level']; } if (isset($params['parentid'])) { if (!empty($params['parentid'])) { $conditions['parentid'] = "parent_id='" . $params['parentid'] . "' OR id=" . $params['parentid']; } else { $conditions['parentid'] = "parent_id=0"; } } if (!empty($params['exclude'])) { $conditions[] = "id NOT IN (" . $params['exclude'] . ")"; } if (!empty($params['include'])) { $conditions[] = "id IN (" . $params['include'] . ")"; } $area->setCondition($conditions); $orderby = null; if (isset($params['orderby'])) { $orderby = " ORDER BY " . trim($params['orderby']) . " "; } else { $orderby = " ORDER BY display_order ASC,id DESC"; } $limit = $offset = 0; if (isset($params['row'])) { $limit = $params['row']; } if (isset($params['start'])) { $offset = $params['start']; } if (!empty($limit)) { $area->setLimitOffset($offset, $limit); } else { $area->limit_offset = 0; } $sql = "SELECT id,name,level,name as title,alias_name,highlight,url,parent_id FROM {$area->table_prefix}areas a " . $area->getCondition() . "{$orderby}" . $area->getLimitOffset() . ";"; $area->dbstuff->setFetchMode(ADODB_FETCH_ASSOC); if (empty($smarty->blockvars[$param_count])) { $smarty->blockvars[$param_count] = $area->GetArray($sql); if (!$smarty->blockvars[$param_count]) { return $repeat = false; } } if (!function_exists("smarty_function_the_url")) { require "function.the_url.php"; } if (list($key, $item) = each($smarty->blockvars[$param_count])) { $repeat = true; $item['rownum'] = $key; $item['iteration'] = ++$key; if (!empty($item['url'])) { $url = $item['url']; } else { $url = smarty_function_the_url(array("module" => "special", "type" => "area", "id" => $item['id'], "do" => $smarty->_tpl_vars['do'])); } $item['url'] = $url; $item['style'] = parse_highlight($item['highlight']); $item['title'] = pb_lang_split($item['title']); $item['name'] = pb_lang_split($item['name']); if (isset($params['titlelen'])) { $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']); } $item['link'] = '<a title="' . $item['name'] . '" href="' . $url . '">' . $item['title'] . '</a>'; if (isset($_GET['areaid'])) { $id = intval($_GET['areaid']); if ($id > 0 && $id == $item['id']) { $item['child'] = $area->GetArray("SELECT *,name AS title FROM {$area->table_prefix}areas WHERE parent_id=" . $id . " AND available=1 ORDER BY display_order ASC;"); } } $smarty->assign($params['name'], $item); } else { $repeat = false; reset($smarty->blockvars[$param_count]); } if (!is_null($content)) { print $content; } if (!$repeat) { $smarty->blockvars[$param_count] = array(); } }
/** * [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: 2075 $ */ function smarty_function_pl($params) { global $G, $app_lang; $_languages = unserialize($G['setting']['languages']); extract($params); if (!empty($var)) { return pb_lang_split($var); } $output = ''; $language_nums = count($_languages); //make input form switch ($frm) { case "input": if (isset($values)) { $_values = pb_lang_split($values, true); } if ($language_nums > 1) { $output .= '<ul>'; foreach ($_languages as $key => $val) { $output .= '<li><a href="#tabs-' . $key . '">' . $val['title'] . '</a></li>'; } $output .= '</ul>'; } foreach ($_languages as $key => $val) { $output .= '<div id="tabs-' . $key . '">'; $output .= '<input type="text"'; if (isset($_values[$key])) { $output .= ' value="' . $_values[$key] . '"'; } if (isset($name)) { $output .= ' name="' . $name . '[' . $key . ']"'; } else { $output .= ' name="data[multi][' . $key . ']"'; } $output .= ' id="dataMulti' . $key . '"'; if (isset($required)) { $output .= ' class="required"'; } if (isset($size)) { $output .= ' size="' . $size . '"'; } if (isset($maxlength)) { $output .= ' maxlength="' . $maxlength . '"'; } $output .= ' />'; if (isset($title)) { $output .= "(" . $val['title'] . ")"; } if (isset($sep)) { $output .= $sep; } else { $output .= "<br />"; } $output .= '</div>'; } break; case "textarea": if (isset($values)) { $_values = pb_lang_split($values, true); } $output .= '<ul>'; foreach ($_languages as $key => $val) { $output .= '<li><a href="#tabs-ta-' . $key . '">' . $val['title'] . '</a></li>'; } $output .= '</ul>'; foreach ($_languages as $key => $val) { $output .= '<div id="tabs-ta-' . $key . '">'; $output .= '<textarea'; if (isset($name)) { $output .= ' name="' . $name . '[' . $key . ']"'; } else { $output .= ' name="data[multita][' . $key . ']"'; } $output .= ' id="dataMultiTA' . $key . '"'; if (isset($required)) { $output .= ' class="required"'; } if (isset($rows)) { $output .= ' rows="' . $rows . '"'; } if (isset($cols)) { $output .= ' cols="' . $cols . '"'; } if (isset($wrap)) { $output .= ' wrap="' . $wrap . '"'; } if (isset($style)) { $output .= ' style="' . $style . '"'; } $output .= ' >' . $_values[$key] . '</textarea>'; if (isset($title)) { $output .= "(" . $val['title'] . ")"; } // if(isset($sep)) $output.=$sep;else $output.="<br />"; $output .= '</div>'; } break; default: break; } return $output; }
ajax_exit($return); break; default: break; } } if (isset($_GET['action'])) { $action = trim($_GET['action']); switch ($action) { case "selection": $result = array(); if (in_array($_GET['module'], array("industry", "area"))) { $sql = "SELECT id AS region_id,name AS region_name FROM " . $tb_prefix . PbController::pluralize($_GET['module']) . " WHERE parent_id='" . intval($_GET['parent_id']) . "' AND available=1"; $result = $pdb->GetArray($sql); for ($i = 0; $i < count($result); $i++) { $result[$i]['region_name'] = pb_lang_split($result[$i]['region_name']); } } ajax_exit($result); break; case "checkusername": if (isset($_GET['username'])) { $result = call_user_func_array($action, array($_GET['username'])); if ($result == true) { $return["isError"] = 1; } else { $return["isError"] = 0; } } ajax_exit($return); break;
/** * [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: 2214 $ */ function smarty_function_get($params, &$smarty) { $op = null; extract($params); global $tb_prefix, $pdb; if (empty($var)) { $var = "item"; } if (!empty($from)) { switch ($from) { case "market": $num = 4; if (isset($params['row'])) { $num = intval($params['row']); } $latest_commend_markets = $industry->GetArray("SELECT * FROM " . $tb_prefix . "markets WHERE if_commend='1' AND status='1' AND picture!='' ORDER BY id DESC LIMIT " . $num); $urls = $infos = $images = array(); if (!empty($latest_commend_markets)) { while (list($key, $val) = each($latest_commend_markets)) { $urls[] = $industry->getPermaLink($val['id'], null, 'market'); $infos[] = pb_lang_split($val['name']); $images[] = pb_get_attachmenturl($val['picture'], '', $size); } $items['url'] = implode("|", $urls); $items['info'] = implode("|", $infos); $items['image'] = implode("|", $images); $return = $items; } break; case "area": if (class_exists("Areas")) { $area = new Areas(); } else { uses("area"); $area = new Areas(); } $return = $area->getLevelAreas(); break; case "industry": //depth if (class_exists("Industries")) { $industry = new Industries(); $obj_controller = new Industry(); } else { uses("industry"); $industry = new Industries(); $obj_controller = new Industry(); } $return = $industry->getCacheIndustry(); break; case "type": if (!empty($name)) { //depth if (class_exists("Industries")) { $industry = new Industries(); $obj_controller = new PbController(); } else { uses("industry"); $industry = new Industries(); $obj_controller = new PbController(); } $name = $obj_controller->pluralize($name); $industry->findIt($name); $return = $industry->params['data'][1]; if (isset($multi)) { $return = $obj_controller->flatten_array($return); } if (empty($var)) { $var = "Items"; } } break; default: $return = cache_read($name, $key); break; } } if (!empty($sql)) { //replace table prefix $pdb->setFetchMode(ADODB_FETCH_ASSOC); $sql = str_replace("pb_", $tb_prefix, $sql); //for secure if (eregi('insert|update|delete|union|into|load_file|outfile|replace', $sql)) { trigger_error('no supported sql.'); } //mysql_escape_string() $return = $industry->GetArray($sql); } if (isset($name)) { switch ($name) { case "language": global $G; $languages = unserialize($G['setting']['languages']); if (!empty($languages)) { if (!isset($echo)) { $smarty->assign($var, $languages); } else { foreach ($languages as $lang_key => $lang_val) { $tmp = "<a href='" . URL . 'redirect.php?url=' . pb_getenv("REQUEST_URI") . "&app_lang=" . $lang_key . "' title='" . $lang_val['title'] . "'>"; if ($image && !empty($lang_val['img'])) { $tmp .= "<img src='" . $lang_val['img'] . "' alt='" . $lang_val['title'] . "' />"; } else { $tmp .= $lang_val['title']; } $tmp .= "</a>"; if ($sep) { $tmp .= $sep; } if (isset($title_li) && $title_li == "list") { $op .= "<li>" . $tmp . "</li>"; } else { $op .= $tmp; } } } } break; case "nav": $_nav = cache_read("nav"); $navs = $_nav['navs']; if (!empty($exclude)) { $_exclude_navs = explode(",", $exclude); foreach ($_exclude_navs as $_exkey => $_exval) { unset($navs[$_exval]); } } if (empty($echo)) { $smarty->assign($var, $navs); } else { foreach ($navs as $nav) { $op .= '<li id="mn_' . $nav['id'] . '" class="nav_item nav-item-' . $nav['id']; $file_name = pb_getenv('REQUEST_URI'); if (strpos($file_name, $nav['url']) !== false && $nav['url'] != 'index.php') { $op .= ' current_nav_item'; } $op .= '"><a href="' . $nav['url'] . '" target="_self"><span>' . pb_lang_split($nav['name']) . '</span></a></li>'; } } break; default: if (is_file(CACHE_COMMON_PATH . "cache_" . $name . ".php")) { require CACHE_COMMON_PATH . "cache_" . $name . ".php"; } if (isset($_PB_CACHE)) { $smarty->assign($var, $_PB_CACHE); } break; } } if (!empty($return)) { $smarty->assign($var, $return); } return $op; }
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 findIt($table_name, $parent_id = 0) { $this->dbstuff->setFetchMode(ADODB_FETCH_ASSOC); $this->params['result'] = $this->dbstuff->GetArray("SELECT * FROM " . $this->table_prefix . "{$table_name} ORDER BY level ASC,id ASC"); foreach ($this->params['result'] as $key => $val) { $row = $this->getChild($val['id']); $_name = pb_lang_split($val['name']); $this->params['data'][$val['level']][$val['id']]['id'] = $val['id']; $this->params['data'][$val['level']][$val['id']]['title'] = $_name; $this->params['data'][$val['level']][$val['id']]['name'] = $_name; $this->params['data'][$val['level']][$val['id']]['child'] = $row; $this->params['data'][$val['level']][$val['id']]['sub'] = $row; if (!empty($row)) { $this->params['data'][$val['level']][$val['id']]['child'] = $row; $this->params['data'][$val['level']][$val['id']]['sub'] = $row; } } }
/** * Image Switch.swf * * @param unknown_type $adzone_params * @return unknown */ function getImagePlay($adzone_params) { $titles = $imgs = $urls = array(); $id = "ID-" . $adzone_params['created'] . "-" . $adzone_params['id']; $name = !empty($adzone_params['name']) ? $adzone_params['name'] : L("ads_no"); $return = "<div id='" . $id . "'>" . $adzone_params['name'] . "</div>"; if (!empty($adzone_params['id'])) { $ad_result = $this->dbstuff->GetArray($sql = "SELECT * FROM " . $this->table_prefix . "adses WHERE adzone_id=" . $adzone_params['id'] . " ORDER BY priority ASC,id DESC"); if (!empty($ad_result)) { foreach ($ad_result as $key => $val) { $_ltitle = pb_lang_split($val['title']); $titles[] = empty($_ltitle) ? "No Title" : $_ltitle; $imgs[] = empty($val['source_url']) ? "No Picture" : $val['source_url']; $urls[] = empty($val['target_url']) ? URL : $val['target_url']; } $width = !empty($adzone_params['width']) ? $adzone_params['width'] : 474; $height = !empty($adzone_params['height']) ? $adzone_params['height'] : 170; $return .= "\t\t\n \t\t<script language='javascript' type='text/javascript'>\n\t\t\tvar titles = '" . implode("|", $titles) . "';\n\t\t\tvar imgs='" . implode("|", $imgs) . "';\n\t\t\tvar urls='" . implode("|", $urls) . "';\n\t\t\tvar pw = {$width};\n\t\t\tvar ph = {$height};\n\t\t\tvar sizes = 14;\n\t\t\tvar Times = 4000;\n\t\t\tvar umcolor = 0xFFFFFF;\n\t\t\tvar btnbg =0xFF7E00;\n\t\t\tvar txtcolor =0xFFFFFF;\n\t\t\tvar txtoutcolor = 0x000000;\n\t\t\tvar flash = new SWFObject('" . STATICURL . "images/switch.swf', 'latestTargetId', pw, ph, '8', '');\n\t\t\tflash.addParam('allowFullScreen', 'true');\n\t\t\tflash.addParam('allowScriptAccess', 'always');\n\t\t\tflash.addParam('quality', 'high');\n\t\t\tflash.addParam('wmode', 'Transparent');\n\t\t\tflash.addVariable('pw', pw);\n\t\t\tflash.addVariable('ph', ph);\n\t\t\tflash.addVariable('sizes', sizes);\n\t\t\tflash.addVariable('umcolor', umcolor);\n\t\t\tflash.addVariable('btnbg', btnbg);\n\t\t\tflash.addVariable('txtcolor', txtcolor);\n\t\t\tflash.addVariable('txtoutcolor', txtoutcolor);\n\t\t\tflash.addVariable('urls', urls);\n\t\t\tflash.addVariable('Times', Times);\n\t\t\tflash.addVariable('titles', titles);\n\t\t\tflash.addVariable('imgs', imgs);\n\t\t\tflash.write('" . $id . "');\n\t\t</script>\n"; } } return $return; }
function L($key, $type = "", $extra = null) { $return = $GLOBALS['smarty']->getConfigVars($key); if (empty($return)) { $GLOBALS['smarty']->configLoad('default.conf', 'message'); $return = $GLOBALS['smarty']->getConfigVars($key); } if (is_array($extra)) { $return = vsprintf($return, $extra); } else { $return = sprintf($return, $extra); } return !empty($return) ? pb_lang_split($return) : $key; }