Пример #1
0
 function index()
 {
     global $smarty, $viewhelper, $tpl_dir;
     $this->loadModel("userpage");
     $smarty->setTemplateDir(PHPB2B_ROOT . $tpl_dir . DS, 'pages');
     $conditions = array();
     $tpl_file = "pages/default";
     !empty($_GET) && ($_GET = clear_html($_GET));
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $conditions[] = "id=" . $id;
     } elseif (!empty($_GET['name'])) {
         $conditions[] = "name='" . trim($_GET['name']) . "' OR title='" . trim($_GET['name']) . "'";
     } elseif (!empty($_GET['title'])) {
         $conditions[] = "title='" . trim($_GET['title']) . "' OR name='" . trim($_GET['title']) . "'";
     }
     $this->userpage->setCondition($conditions);
     $result = $this->userpage->dbstuff->GetRow("SELECT * FROM {$this->userpage->table_prefix}userpages " . $this->userpage->getCondition());
     if (!empty($result)) {
         $title = $result['title'];
         $viewhelper->setTitle($title);
         $viewhelper->setPosition($title);
         if (!empty($result['templet_name'])) {
             $tpl_file = "pages/" . $result['templet_name'];
         } elseif ($viewhelper->tpl_exists($smarty->template_dir . "pages/" . $result['name'] . $smarty->tpl_ext)) {
             $tpl_file = "pages/" . $result['name'];
         }
         setvar("item", pb_lang_split_recursive($result));
     } else {
         setvar("item", array());
     }
     $smarty->assign('position', $viewhelper->getPosition());
     $smarty->assign('page_title', $viewhelper->getTitle());
     $smarty->display($tpl_file . $smarty->tpl_ext);
 }
Пример #2
0
 function index()
 {
     global $viewhelper, $pos;
     $conditions = array();
     $viewhelper->setPosition(L("dictionary", "tpl"), "index.php?do=dict");
     $viewhelper->setTitle(L("dictionary", "tpl"));
     if (isset($_GET['action'])) {
         $action = trim($_GET['action']);
         if ($action == "search") {
             if (!empty($_GET['q'])) {
                 $conditions[] = "word like '%" . $_GET['q'] . "%'";
             }
             if (isset($_GET['typeid'])) {
                 $type_id = intval($_GET['typeid']);
                 $conditions[] = "dicttype_id='" . $type_id . "'";
             }
             $amount = $this->dict->findCount(null, $conditions);
             $result = $this->dict->findAll("Dict.*,dp.name AS typename", array("LEFT JOIN {$this->dict->table_prefix}dicttypes dp ON dp.id=Dict.dicttype_id"), $conditions, "Dict.id DESC", $pos, $this->displaypg);
             if (!empty($result)) {
                 setvar("items", $result);
                 setvar("paging", array('total' => $amount));
             }
             render("dict/list", true);
         }
     }
     //get dictionary types.
     $dict_types = $this->dicttype->getAllTypes();
     $dict_types = pb_lang_split_recursive($dict_types);
     setvar("Dictypes", $dict_types);
     render("dict/index", true);
 }
Пример #3
0
 function lists()
 {
     global $viewhelper;
     $conditions = array();
     $tpl_file = "help/index";
     $viewhelper->setPosition(L("help_center", "tpl"), "index.php?do=help");
     $viewhelper->setTitle(L("help_center", "tpl"));
     if (isset($_GET['typeid'])) {
         $type_id = intval($_GET['typeid']);
         $conditions[] = "helptype_id=" . $type_id;
         $type_name = $this->help->dbstuff->GetOne("SELECT title FROM {$this->help->table_prefix}helptypes WHERE id='" . $type_id . "'");
         $viewhelper->setTitle($type_name);
         $viewhelper->setPosition($type_name, "index.php?do=help&action=lists&typeid=" . $type_id);
     }
     if (!empty($_GET['q'])) {
         $conditions[] = "title like '%" . trim($_GET['q']) . "%'";
     }
     $result = $this->help->findAll("id,title", null, $conditions, "id DESC");
     setvar("Items", pb_lang_split_recursive($result));
     render($tpl_file);
 }
Пример #4
0
 function post()
 {
     global $G, $viewhelper;
     require CLASS_PATH . "validation.class.php";
     $validate = new Validation();
     if (session_id() == '') {
         require_once LIB_PATH . "session_php.class.php";
         $session = new PbSessions();
     }
     uses("trade", "member", "tradefield", "tag");
     $tag = new Tags();
     $offer = new Tradefields();
     $member = new Members();
     $trade = new Trades();
     $expires = cache_read("typeoption", "offer_expire");
     setvar("Genders", cache_read("typeoption", "gender", 1, array("0", "-1")));
     setvar("PhoneTypes", cache_read("typeoption", "phone_type"));
     setvar("ImTypes", cache_read("typeoption", "im_type"));
     $if_visit_post = $G['setting']['vis_post'];
     if (!$if_visit_post) {
         $this->view->flash('visitor_forbid', URL, 0);
     }
     //for temp upgrade.
     if (!file_exists(CACHE_LANG_PATH . "locale.js")) {
         require LIB_PATH . "cache.class.php";
         $cache = new Caches();
         $cache->updateLanguages();
         $cache->writeCache("javascript", "javascript");
     }
     $trade_types = $trade->GetArray("SELECT * FROM " . $trade->table_prefix . "tradetypes");
     foreach ($trade_types as $key => $val) {
         if ($val['parent_id'] == 0) {
             $set_types[$val['id']] = pb_lang_split_recursive($val);
             foreach ($trade_types as $key1 => $val1) {
                 if ($val1['parent_id'] == $val['id']) {
                     $set_types[$val['id']]['child'][$val1['id']] = pb_lang_split_recursive($val1);
                 }
             }
         }
     }
     if (isset($_GET['typeid'])) {
         setvar("type_id", intval($_GET['typeid']));
     }
     if (isset($_GET['industryid'])) {
         setvar("industry_id", intval($_GET['industryid']));
     }
     if (isset($_GET['areaid'])) {
         setvar("area_id", intval($_GET['areaid']));
     }
     setvar("select_tradetypes", $set_types);
     $viewhelper->setPosition(L("free_release_offer", "tpl"));
     setvar("OfferExpires", $expires);
     setvar("sid", md5(uniqid($offer->timestamp)));
     capt_check("capt_post_free");
     render("offer/post");
 }
Пример #5
0
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (isset($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $pdb->Execute("DELETE FROM {$tb_prefix}typeoptions WHERE id={$id}");
    }
    if ($do == "refresh") {
        $cache->updateTypevars();
        flash("success", 'type.php');
    }
    if ($do == "edit") {
        $tmp_models = $pdb->GetArray("SELECT * FROM {$tb_prefix}typemodels");
        setvar("TypeModels", pb_lang_split_recursive($tmp_models));
        if (!empty($id)) {
            $tmp_item = $pdb->GetRow("SELECT tp.*,tm.title AS modelname FROM {$tb_prefix}typeoptions tp LEFT JOIN {$tb_prefix}typemodels tm ON tp.typemodel_id=tm.id WHERE tp.id={$id}");
            if (!empty($tmp_item)) {
                setvar("item", $tmp_item);
            }
        }
        $tpl_file = "type.edit";
        template($tpl_file);
        exit;
    }
    if ($do == "search") {
        if (!empty($_GET['q'])) {
            $conditions['q'] = " option_label LIKE '%" . $_GET['q'] . "%'";
        }
    }
Пример #6
0
 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);
     }
 }
Пример #7
0
 public function init()
 {
     global $subdomain_support, $rewrite_able, $pdb, $time_stamp, $tb_prefix, $absolute_uri, $attachment_url, $G, $viewhelper;
     //espcial done for multi arrTemplate
     $this->loadModel("space");
     $sections = 'space';
     $this->view->configLoad('default.conf', $sections);
     if (isset($_GET['userid'])) {
         $this->userid = trim(htmlspecialchars($_GET['userid']));
     }
     if ($subdomain_support && $rewrite_able) {
         $hosts = explode($subdomain_support, pb_getenv('HTTP_HOST'));
         if ($hosts[0] != "www") {
             //				$this->userid = trim($hosts[0]);
         }
     }
     $G['membergroup'] = cache_read("membergroup");
     using("member", "company");
     $member = new Members();
     $company = new Companies();
     $space_name = '';
     if (empty($theme_name)) {
         $theme_name = "default";
         $style_name = isset($G['setting']['theme']) && !empty($G['setting']['theme']) ? $G['setting']['theme'] : "default";
         $ADODB_CACHE_DIR = DATA_PATH . 'dbcache';
     }
     $this->view->assign("theme_img_path", "templates/" . $theme_name . "/");
     $this->view->assign('ThemeName', $theme_name);
     $cache_data = $push_data = array();
     if (!empty($this->userid)) {
         $userid = $this->userid;
         $member->setInfoBySpaceName($this->userid);
         if (!empty($member->info['id'])) {
             $this->member_id = $member->info['id'];
             $company->setInfoByMemberId($member->info['id']);
         } else {
             $company->setInfoBySpaceName($this->userid);
         }
         $push_data['company'] = $company->info;
         $this->company_id = $company->info['id'];
         $push_data['member'] = $member->info;
     } elseif (!empty($_GET['id'])) {
         $id = intval($_GET['id']);
         $company->id = $this->company_id = $id;
         $company->setInfoById($id);
         if (!empty($company->info['member_id'])) {
             $member->id = $this->member_id = $company->info['member_id'];
         }
         $push_data['company'] = $company->info;
         $push_data['member'] = $member->info;
     }
     if (isset($company->info['status']) && $company->info['status'] === 0) {
         header_sent(L('company_checking'));
         exit;
     } elseif (empty($company->info) || !$company->info) {
         header_sent(L('data_not_exists'));
         exit;
     }
     $cache_data = $pdb->GetRow("SELECT data2 AS style FROM {$tb_prefix}spacecaches WHERE company_id='" . $company->info['id'] . "'");
     if (isset($cache_data['style'])) {
         $skin_extra_style = $cache_data['style'];
     }
     if (!empty($company->info['created'])) {
         $time_tmp = $time_stamp - $company->info['created'];
         $company->info['year_sep'] = $time_tmp = ceil($time_tmp / (3600 * 24 * 365));
     }
     if (empty($company->info['email'])) {
         $company->info['email'] = $G['setting']['service_email'];
     }
     if (empty($company->info['picture'])) {
         $company->info['logo'] = $absolute_uri . pb_get_attachmenturl('', '', 'big');
     } else {
         $company->info['logo'] = $absolute_uri . $attachment_url . $company->info['picture'];
     }
     $company->info = pb_lang_split_recursive($company->info);
     $company->info['description'] = nl2br(strip_tags($company->info['description']));
     $is_set_default_skins = false;
     $member_templet_id = $member->info['templet_id'];
     if (isset($_GET['force_templet_id'])) {
         $member_templet_id = intval($_GET['force_templet_id']);
     }
     if (!empty($member_templet_id)) {
         $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND status='1' AND id='" . $member_templet_id . "'");
     }
     if (empty($skin_path_info)) {
         $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND is_default='1'");
         if (empty($skin_path_info)) {
             $is_set_default_skins = true;
         }
     } elseif (!is_dir(PHPB2B_ROOT . $skin_path_info)) {
         $is_set_default_skins = true;
     }
     if ($is_set_default_skins) {
         $skin_path_info = array();
         $skin_path_info[] = "default";
         $skin_path_info[] = "templates/skins/default/";
     }
     list($skin_path, $skin_dir) = $skin_path_info;
     if (strpos($skin_dir, "templates") === false) {
         $skin_dir = "templates/" . $skin_dir;
         //for 4.3 upgrade from 4.3 below,begin 2012.10
     }
     $this->skin_path = $skin_path;
     $this->skin_dir = $skin_dir;
     uaAssign(array("SkinName" => $skin_path, "ThemeName" => $skin_path, "SkinPath" => $skin_dir, "COMPANY" => $company->info, "MEMBER" => $member->info));
     $this->view->setTemplateDir(PHPB2B_ROOT . "templates" . DS . "skins" . DS);
     $this->view->setCompileDir(DATA_PATH . "templates_c" . DS . $this->lang . DS . "skin" . DS . $skin_path . DS);
     if (isset($member->info['id'])) {
         $this->setLinks($member->info['id']);
     }
     $this->setMenu($company->info['cache_spacename'], $this->spaceModules);
     $product_types = $pdb->GetArray("SELECT *,id as typeid,name as typename FROM {$tb_prefix}producttypes WHERE company_id=" . $company->info['id']);
     //set and get db cache
     setvar("ProductTypes", $product_types);
     $group_info = array();
     $group_info['year'] = $time_tmp;
     if (!empty($member->info['membergroup_id']['name'])) {
         $group_info['name'] = $G['membergroup'][$member->info['membergroup_id']]['name'];
     } else {
         $group_info['name'] = L("undefined_image", "tpl");
     }
     if (!empty($member->info['membergroup_id']['avatar'])) {
         $group_info['image'] = $absolute_uri . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar'];
     } else {
         $group_info['image'] = $absolute_uri . STATICURL . "images/group/formal.gif";
     }
     setvar("GROUP", $group_info);
     //for old version
     if (isset($member->info['membergroup_id']['name'])) {
         setvar("GroupName", $G['membergroup'][$member->info['membergroup_id']]['name']);
     }
     if (isset($member->info['membergroup_id']['avatar'])) {
         setvar("GroupImage", $absolute_uri . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar']);
     }
     setvar("Menus", $this->getMenu());
     setvar("Links", $this->getLinks());
     $space_url = $this->rewrite($company->info['cache_spacename'], $company->info['id']);
     setvar("space_url", $space_url);
     setvar("SpaceUrl", $absolute_uri . $skin_dir);
     $space_extra_style = '';
     setvar("SpaceExtraStyle", $space_extra_style);
     if (!empty($skin_extra_style)) {
         $space_extra_style = $absolute_uri . $skin_dir . "styles/" . $skin_extra_style . "/";
         setvar("SpaceExtraStyle", $space_extra_style);
     }
     setvar("BASEMAP", $absolute_uri . $skin_dir);
     $pdb->Execute("UPDATE {$tb_prefix}companies SET clicked=clicked+1 WHERE id='" . $company->info['id'] . "'");
     if (!empty($arrTemplate)) {
         $this->view->assign($arrTemplate);
     }
     if (!empty($_GET['module'])) {
         $this->module = trim($_GET['module']);
     }
     $this->view->assign("cur", "space_" . $this->module);
 }
Пример #8
0
 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");
 }
Пример #9
0
<?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");
Пример #10
0
 function chart()
 {
     global $viewhelper;
     $this->loadModel("quote");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (empty($id)) {
         flash("pls_input_product_name", "index.php?do=market&action=quote");
     }
     $info = $this->quote->dbstuff->GetRow("SELECT * FROM " . $this->quote->table_prefix . "quotes WHERE id=" . $id);
     $this->quote->dbstuff->Execute("UPDATE " . $this->quote->table_prefix . "quotes SET hits=hits+1 WHERE id=" . $id);
     $info['pubdate'] = df($info['created']);
     $info['clicked'] = $info['hits'];
     $neighbour_info = $this->quote->getNeighbour($id, "id,title");
     if (!empty($neighbour_info['prev'])) {
         $title = $neighbour_info['prev']['title'];
         $info['prev_link'] = "<a href='index.php?do=market&action=chart&id=" . $neighbour_info['prev']['id'] . "'>" . $title . "</a>";
         $info['prev_title'] = $title;
     } else {
         $info['prev_link'] = L("nothing", "tpl");
     }
     if (!empty($neighbour_info['next'])) {
         $title = $neighbour_info['next']['title'];
         $info['next_link'] = "<a href='index.php?do=market&action=chart&id=" . $neighbour_info['next']['id'] . "'>" . $title . "</a>";
         $info['next_title'] = $title;
     } else {
         $info['next_link'] = L("nothing", "tpl");
     }
     $viewhelper->setTitle($info['title']);
     $viewhelper->setPosition($info['title']);
     setvar("item", pb_lang_split_recursive($info));
     $tpl_file = "detail.default";
     render($tpl_file, true);
 }
Пример #11
0
 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;
 }
Пример #12
0
 function load_file($file_name, $prepend_path = true)
 {
     global $G;
     if (function_exists("pb_lang_split")) {
         $_tmp = pb_lang_split_recursive($G['setting']);
     } else {
         $_tmp = $G['setting'];
     }
     if ($prepend_path && $this->_config_path != "") {
         $config_file = $this->_config_path . $file_name;
     } else {
         $config_file = $file_name;
     }
     ini_set('track_errors', true);
     $fp = @fopen($config_file, "r");
     if (!is_resource($fp)) {
         $this->_trigger_error_msg("Could not open config file '{$config_file}'");
         return false;
     }
     $contents = ($size = filesize($config_file)) ? fread($fp, $size) : '';
     fclose($fp);
     $search = array('%site_name%', '%site_url%', '%company_name%', '%service_email%');
     $replace = array($_tmp['site_name'], $_tmp['site_url'], $_tmp['company_name'], $_tmp['service_email']);
     $contents = str_replace($search, $replace, $contents);
     $this->_config_data[$config_file] = $this->parse_contents($contents);
     return true;
 }
Пример #13
0
if ($pb_userinfo) {
    $pb_user = $pb_userinfo;
    $pb_user = pb_addslashes($pb_user);
    uaAssign($pb_userinfo);
}
$js_language = $app_lang;
if ($show_ajax) {
    $show_ajax = 1;
}
$_G = array('SiteUrl' => URL, 'show_ajax' => $show_ajax, 'charset' => $charset, 'AppLanguage' => $app_lang, 'WebRootUrl' => $absolute_uri, 'TemplateDir' => 'templates', 'JsLanguage' => $js_language, 'cookiepre' => $cookiepre, 'cookiedomain' => $cookiedomain, 'cookiepath' => $cookiepath);
uaAssign($_G);
if (!empty($_PB_CACHE['setting']['site_theme_styles'])) {
    $_PB_CACHE['setting']['site_theme_styles'] = unserialize($_PB_CACHE['setting']['site_theme_styles']);
}
//at c, use $G;v, $_G.
$G['setting'] = pb_lang_split_recursive($_PB_CACHE['setting']);
$G['setting']['nav_id'] = '';
//Todo:
setvar("_G", $G['setting']);
uaAssign($G['setting']);
if (!MAGIC_QUOTES_GPC) {
    $_GET = pb_addslashes($_GET);
    $_POST = pb_addslashes($_POST);
    $_COOKIE = pb_addslashes($_COOKIE);
    $_SERVER = pb_addslashes($_SERVER);
}
$G = am($G, $_GET, $_POST);
$viewhelper = new PbView();
$pre_refer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
if ($gzipcompress && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
Пример #14
0
 function inquery()
 {
     global $viewhelper, $pb_userinfo;
     using("member", "message", "typeoption");
     $typeoption = new Typeoptions();
     $member = new Members();
     $pms = new Messages();
     if (isset($_POST['id']) && !empty($_POST['do']) && !empty($_POST['title'])) {
         pb_submit_check('inquery');
         $vals['type'] = 'inquery';
         $vals['title'] = $_POST['title'];
         $vals['content'] = implode("<br />", $_POST['inquery']);
         $result = $pms->SendToUser($pb_userinfo['pb_username'], $this->product->dbstuff->GetOne("SELECT username FROM {$this->product->table_prefix}members WHERE id=" . intval($_POST['to_member_id'])), $vals);
         if (!$result) {
             flash("failed", '', 0);
         } else {
             flash("success", '', 0);
         }
     }
     $pid = intval($_GET['id']);
     $sql = "SELECT * FROM {$this->product->table_prefix}products WHERE id=" . $pid;
     $res = $this->product->dbstuff->GetRow($sql);
     if (empty($res) || !$res) {
         flash('data_not_exists', 'product/', 0);
     } else {
         if (!empty($res['picture'])) {
             $res['imgsmall'] = "attachment/" . $res['picture'] . ".small.jpg";
             $res['imgbig'] = "attachment/" . $res['picture'];
             $res['image'] = "attachment/" . $res['picture'] . ".small.jpg";
         } else {
             $res['image'] = pb_get_attachmenturl('', '', 'small');
         }
         setvar("ImTypes", cache_read("typeoption", "im_type"));
         setvar("TelTypes", cache_read("typeoption", "phone_type"));
         setvar("item", pb_lang_split_recursive($res));
     }
     $viewhelper->setTitle($res['name']);
     $member_info = $this->product->dbstuff->GetRow("SELECT mf.first_name,mf.last_name,m.email as MemberEmail FROM {$this->product->table_prefix}members m LEFT JOIN {$this->product->table_prefix}memberfields mf ON mf.member_id=m.id WHERE m.id=" . $res['member_id']);
     setvar("CompanyUser", $member_info['first_name'] . $member_info['last_name']);
     render("product/inquery");
 }
Пример #15
0
/**
 *      [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_category($params, &$smarty)
{
    $conditions[] = 'available=1';
    $result = array();
    if (class_exists("Productcategories")) {
        $cat = new Productcategories();
        $cat_controller = new Productcategory();
    } else {
        uses("productcategory");
        $cat = new Productcategories();
        $cat_controller = new Productcategory();
    }
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $cat->setCondition($conditions);
    $table_name = $cat->table_prefix . $cat_controller->pluralize($params['name']);
    $cat->dbstuff->setFetchMode(ADODB_FETCH_ASSOC);
    if (isset($params['depth'])) {
        //depth
        if ($params['depth'] == -1) {
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition());
            return $result;
        }
    }
    $level = intval($params['depth']);
    $return = array();
    switch ($level) {
        case 1:
            $conditions[] = "level IN (" . $level . ")";
            $cat->setCondition($conditions);
            $return = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            break;
        case 2:
            $conditions[] = "level IN (1,2)";
            $cat->setCondition($conditions);
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            foreach ($result as $val) {
                if ($val['level'] == 1) {
                    $result_1[$val['id']] = $val;
                } elseif ($val['level'] == 2) {
                    $result_2[] = $val;
                }
            }
            unset($result);
            foreach ($result_2 as $val2) {
                if ($val2['parent_id'] == $result_1[$val2['parent_id']]['id']) {
                    $result_1[$val2['parent_id']]['child'][] = $val2;
                }
            }
            $return = $result_1;
            unset($result, $result_1, $result_2);
            break;
        case 3:
            $conditions[] = "level IN (1,2,3)";
            $cat->setCondition($conditions);
            $result = $cat->dbstuff->GetArray("SELECT * FROM " . $table_name . $cat->getCondition() . " ORDER BY display_order ASC");
            foreach ($result as $val) {
                if ($val['level'] == 1) {
                    $return[$val['id']] = $val;
                } elseif ($val['level'] == 2) {
                    $return[$val['parent_id']]['child'][$val['id']] = $val;
                } elseif ($val['level'] == 3) {
                    $return[$val['top_parentid']]['child'][$val['parent_id']]['child'][] = $val;
                }
            }
            unset($result);
            break;
        default:
            break;
    }
    //$cat->setLimitOffset($offset, $limit);
    if (isset($params['output'])) {
        return $return;
    } else {
        if (empty($params['var'])) {
            $params['var'] = "category";
        }
        $smarty->assign($params['var'], pb_lang_split_recursive($return));
        unset($return);
    }
}
Пример #16
0
 function detail()
 {
     require CACHE_COMMON_PATH . "cache_type.php";
     $_PB_CACHE['area'] = cache_read("area");
     $_PB_CACHE['industry'] = cache_read("industry");
     if (isset($_GET['title'])) {
         $title = trim($_GET['title']);
         $res = $this->expo->findByName($title);
         $id = $res['id'];
     }
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (!$this->expo->checkExist($id, true)) {
         flash("data_not_exists");
     }
     $info = $this->expo->info;
     $this->view_helper->setPosition(L("fair", "tpl"));
     if (!empty($info)) {
         $info['typename'] = $_PB_CACHE['expotype'][$info['expotype_id']];
         $this->view_helper->setTitle($info['typename']);
         $this->view_helper->setPosition($info['typename'], 'index.php?do=fair&action=lists&typeid=' . $info['expotype_id']);
         $this->view_helper->setTitle($info['name']);
         $this->view_helper->setPosition($info['name']);
         $result = $this->expo->dbstuff->GetArray("SELECT c.name,c.id,c.cache_spacename AS userid FROM {$this->expo->table_prefix}expomembers em LEFT JOIN {$this->expo->table_prefix}companies c ON c.id=em.company_id WHERE c.status=1");
         $result = pb_lang_split_recursive($result);
         $info = pb_lang_split_recursive($info);
         if (!empty($result)) {
             setvar("Items", $result);
         }
         setvar("item", $info);
     }
     render("fair/detail");
 }
Пример #17
0
 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");
 }
Пример #18
0
     $attach_filename = $pdb->GetOne($sql);
     $news->del($id);
     $attachment->deleteBySource($attach_filename);
 }
 if ($do == "edit") {
     $news_info = null;
     $_PB_CACHE['area'] = cache_read("area");
     $_PB_CACHE['industry'] = cache_read("industry");
     setvar("CacheAreas", $_PB_CACHE['area']);
     setvar("CacheIndustries", $_PB_CACHE['industry']);
     $result = $membertype->findAll("id,name", null, $conditions, " id desc");
     $user_types = array();
     foreach ($result as $key => $val) {
         $user_types[$val['id']] = $val['name'];
     }
     setvar("Membertypes", pb_lang_split_recursive($user_types));
     $_newstypes = $newstype->getTypeOptions();
     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']));
         }
     }