Ejemplo n.º 1
0
 function detail()
 {
     global $viewhelper;
     $condition = null;
     $conditions = array();
     $viewhelper->setPosition(L("brands", "tpl"), "index.php?do=brand");
     if (isset($_GET['name'])) {
         $brand_name = trim($_GET['name']);
         $id = $this->brand->dbstuff->GetOne("SELECT id FROM {$brand->table_prefix}brands WHERE name='" . $brand_name . "'");
     }
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (!empty($id)) {
         $result = $this->brand->dbstuff->GetRow("SELECT * FROM {$this->brand->table_prefix}brands WHERE id='" . $id . "'");
         if (!empty($result)) {
             $title = pb_lang_split($result['name']);
             $result['img'] = pb_get_attachmenturl($result['picture']);
             $result['title'] = $title;
             $viewhelper->setPosition($this->brand->dbstuff->GetOne("SELECT name FROM " . $this->brand->table_prefix . "brandtypes WHERE id=" . $result['type_id']), "index.php?do=brand&action=lists&catid=" . $result['type_id']);
             $viewhelper->setTitle($title);
             $viewhelper->setPosition($title);
         }
     } else {
         L("data_not_exists");
     }
     setvar("item", $result);
     render("brand/detail");
 }
Ejemplo n.º 2
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: 2053 $
 */
function smarty_function_the_attachment($params)
{
    extract($params);
    if (!empty($name)) {
        $return = pb_get_attachmenturl($name, '', $type);
        $return = '<img src="' . $return . '" alt=""/>';
    }
    if (!empty($url)) {
        $return = $url;
    }
    return $return;
}
Ejemplo n.º 3
0
 function Search($firstcount, $displaypg)
 {
     global $cache_types;
     $result = $this->findAll("*,Market.name AS title", null, null, $this->orderby, $firstcount, $displaypg);
     while (list($keys, $values) = each($result)) {
         $result[$keys]['digest'] = $values['content'];
         $result[$keys]['pubdate'] = df($values['created']);
         $result[$keys]['typename'] = $cache_types['markettype'][$values['markettype_id']];
         $result[$keys]['url'] = $this->getPermaLink($values['id']);
         $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture']);
     }
     return $result;
 }
Ejemplo n.º 4
0
 function formatResult($result)
 {
     if (!empty($result)) {
         $count = count($result);
         for ($i = 0; $i < $count; $i++) {
             $result[$i]['pubdate'] = @date("Y-m-d", $result[$i]['submit_time']);
             $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'middle');
         }
         return $result;
     } else {
         return null;
     }
 }
Ejemplo n.º 5
0
 function Search($firstcount, $displaypg)
 {
     global $cache_types;
     $result = $this->findAll("*,name AS title,description AS digest", null, null, $this->orderby, $firstcount, $displaypg);
     while (list($keys, $values) = each($result)) {
         $result[$keys]['pubdate'] = df($values['created']);
         $result[$keys]['begin_date'] = df($values['begin_time']);
         $result[$keys]['end_date'] = df($values['end_time']);
         $result[$keys]['typename'] = $cache_types['expotype'][$values['expotype_id']];
         $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
         $result[$keys]['url'] = $this->getPermaLink($values['id'], "fair/detail");
     }
     return $result;
 }
Ejemplo n.º 6
0
 function formatResult($result)
 {
     if (!empty($result)) {
         $count = count($result);
         for ($i = 0; $i < $count; $i++) {
             $result[$i]['pubdate'] = '';
             if (isset($result[$i]['submit_time'])) {
                 $result[$i]['pubdate'] = df($result[$i]['submit_time']);
             }
             $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small');
         }
         return $result;
     } else {
         return null;
     }
 }
Ejemplo n.º 7
0
 function formatResultWap($result)
 {
     global $rewrite_able;
     require CACHE_PATH . 'cache_membergroup.php';
     if (!empty($result)) {
         $count = count($result);
         for ($i = 0; $i < $count; $i++) {
             $result[$i]['transection_time'] = @date("Y-m-d h:m:s", $result[$i]['transection_time']);
             $result[$i]['content'] = strip_tags($result[$i]['content']);
             $result[$i]['image'] = "../" . pb_get_attachmenturl($result[$i]['picture']);
             if ($result[$i]['status'] == 1) {
                 $result[$i]['status_des'] = "Đã mua thành công";
             } else {
                 $result[$i]['status_des'] = "Chưa mua thành công";
             }
         }
         return $result;
     } else {
         return null;
     }
 }
Ejemplo n.º 8
0
 function Search($firstcount, $displaypg)
 {
     global $cache_types;
     if (empty($_GET['page'])) {
         //array_unshift($this->condition,"id between 1000 and 2000");
     }
     $orderby = "id DESC";
     if (isset($_GET['type'])) {
         $type = trim($_GET['type']);
         if ($type == "hot") {
             $orderby = "News.clicked DESC";
         }
     }
     $result = $this->findAll("*,content AS digest", null, null, $orderby, $firstcount, $displaypg);
     while (list($keys, $values) = each($result)) {
         $result[$keys]['pubdate'] = df($values['created']);
         $result[$keys]['typename'] = $cache_types['newstype'][$values['type_id']];
         $result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
         $result[$keys]['url'] = $this->url(array("do" => "news", "id" => $values['id']));
     }
     return $result;
 }
Ejemplo n.º 9
0
define('CURSCRIPT', 'index');
require "../libraries/common.inc.php";
require "../share.inc.php";
require CACHE_PATH . "cache_industry.php";
require CACHE_PATH . 'cache_type.php';
$index_latest_industry_ids = 10;
$data = array();
uses("product", "industry");
$product = new Products();
$industry = new Industries();
$ProductSorts = $_PB_CACHE['productsort'];
$result = $product->GetArray($sql = "SELECT distinct industry_id AS iid FROM {$tb_prefix}products WHERE status=1 ORDER BY id DESC LIMIT 0,{$index_latest_industry_ids}");
if (!empty($result)) {
    foreach ($result as $key => $val) {
        $data[$val['iid']]['id'] = $val['iid'];
        if (isset($_PB_CACHE['industry'][1][$val['iid']])) {
            $data[$val['iid']]['name'] = $_PB_CACHE['industry'][1][$val['iid']];
        }
        $tmp_result = $pdb->GetArray("SELECT id,name,picture,sort_id,industry_id FROM {$tb_prefix}products WHERE status=1 AND industry_id=" . $val['iid'] . " ORDER BY id DESC LIMIT 0,5");
        if (!empty($tmp_result)) {
            foreach ($tmp_result as $key1 => $val1) {
                $data[$val['iid']]['sub'][$val1['id']]['id'] = $val1['id'];
                $data[$val['iid']]['sub'][$val1['id']]['name'] = $val1['name'];
                $data[$val['iid']]['sub'][$val1['id']]['sort'] = $ProductSorts[$val1['sort_id']];
                $data[$val['iid']]['sub'][$val1['id']]['image'] = pb_get_attachmenturl($val1['picture'], '', 'small');
            }
        }
    }
    setvar("IndustryProducts", $data);
}
render("product/index");
Ejemplo n.º 10
0
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $result = $album->del(intval($id), "member_id=" . $_SESSION['MemberID']);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $album_info = $pdb->GetRow("SELECT a.title,a.description,ab.id,a.attachment,ab.type_id FROM {$tb_prefix}albums ab LEFT JOIN {$tb_prefix}attachments a ON a.id=ab.attachment_id WHERE ab.member_id=" . $_SESSION['MemberID'] . " AND ab.id={$id}");
            if (!empty($album_info['attachment'])) {
                $album_info['image'] = pb_get_attachmenturl($album_info['attachment'], "../");
            }
            setvar("item", $album_info);
        }
        $tpl_file = "album_edit";
        template($tpl_file);
        exit;
    }
}
$joins[] = "LEFT JOIN {$tb_prefix}albums a ON a.attachment_id=Attachment.id";
$conditions[] = "Attachment.member_id=" . $_SESSION['MemberID'] . " AND Attachment.attachmenttype_id=1";
$amount = $attachment->findCount($joins, $conditions, "Attachment.id");
$page->setPagenav($amount);
$result = $attachment->findAll("Attachment.title,Attachment.description,Attachment.attachment,a.id", $joins, $conditions, "a.id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['image'] = pb_get_attachmenturl($result[$i]['attachment'], '../', "small");
    }
    setvar("Items", $result);
    setvar("ByPages", $page->pagenav);
}
template($tpl_file);
Ejemplo n.º 11
0
 $news_info = null;
 include CACHE_PATH . "cache_area.php";
 include CACHE_PATH . "cache_industry.php";
 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", $user_types);
 setvar("NewstypeOptions", $newstype->getTypeOptions());
 if (!empty($id)) {
     $item_info = $news->read("*", $id);
     if ($item_info['picture']) {
         $item_info['image'] = pb_get_attachmenturl($item_info['picture'], "../", 'small');
     }
     $tag->getTagsByIds($item_info['tag_ids'], true);
     $item_info['tag'] = $tag->tag;
 }
 if ($action == "convert") {
     if (!empty($_GET['companynewsid'])) {
         $item_info['title'] = $pdb->GetOne("SELECT title FROM {$tb_prefix}companynewses WHERE id=" . intval($_GET['companynewsid']));
     }
 }
 if (!empty($item_info)) {
     setvar("item", $item_info);
 }
 $tpl_file = "news.edit";
 template($tpl_file);
 exit;
Ejemplo n.º 12
0
    uaAssign(array("LastLogin" => date("Y-m-d H:i", $memberinfo['last_login'])));
    $offer_count = $pdb->GetArray("SELECT count(id) AS amount,type_id AS typeid FROM {$tb_prefix}trades WHERE member_id=" . $the_memberid . " GROUP BY type_id");
    $offer_stat = array();
    $types = $trade->getTradeTypes();
    if (!empty($offer_count)) {
        foreach ($offer_count as $offer_key => $offer_val) {
            $offer_stat[$types[$offer_val['typeid']]] = $offer_val['amount'];
        }
        setvar("items_offer", $offer_stat);
    }
    $pm_count = $pdb->GetArray("SELECT count(id) AS amount,type AS typename FROM {$tb_prefix}messages WHERE to_member_id=" . $the_memberid . " GROUP BY type");
    if (!empty($pm_count)) {
        $pm_result = array();
        foreach ($pm_count as $pm_val) {
            $pm_result[$pm_val['typename']] = intval($pm_val['amount']);
        }
        setvar("pm", $pm_result);
    }
    setvar("ServiceInfo", $service_info);
    $memberinfo['start_date'] = df($memberinfo['service_start_date']);
    $memberinfo['end_date'] = df($memberinfo['service_end_date']);
    $memberinfo['gender_name'] = $_PB_CACHE['calls'][$memberinfo['gender']];
    $memberinfo['avatar'] = !empty($memberinfo['photo']) ? pb_get_attachmenturl($memberinfo['photo'], "../", "small") : ($memberinfo['gender'] == 2 ? "images/female.png" : "images/male.png");
    setvar("MemberInfo", $memberinfo);
    $group['name'] = $g['name'];
    $group['image'] = $g['avatar'];
    setvar("group", $group);
    template("index");
} else {
    flash('invalid_user');
}
Ejemplo n.º 13
0
 function formatResult($result)
 {
     global $_PB_CACHE;
     if (!class_exists('Space')) {
         uses("space");
     }
     $space_controller = new Space();
     if (!$result || empty($result)) {
         return null;
     }
     if (!isset($_PB_CACHE['membergroup'])) {
         require CACHE_PATH . "cache_membergroup.php";
     }
     if (!isset($_PB_CACHE['manage_type'])) {
         require CACHE_PATH . "cache_typeoption.php";
     }
     $count = count($result);
     for ($i = 0; $i < $count; $i++) {
         $result[$i]['gradeimg'] = 'images/group/' . $_PB_CACHE['membergroup'][$result[$i]['cache_membergroupid']]['avatar'];
         if (!empty($result[$i]['manage_type'])) {
             $result[$i]['managetype'] = $_PB_CACHE['manage_type'][$result[$i]['manage_type']];
         }
         if (!empty($result[$i]['membergroup_id'])) {
             $result[$i]['gradename'] = $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['name'];
         }
         if (isset($result[$i]['space_name'])) {
             $result[$i]['url'] = $space_controller->rewrite($result[$i]['space_name'], $result[$i]['id']);
         } else {
             $result[$i]['url'] = "javascript:;";
         }
         if (isset($result[$i]['picture'])) {
             $result[$i]['logo'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small');
             $result[$i]['logosrc'] = '<img alt="' . $result[$i]['name'] . '" src="' . pb_get_attachmenturl($result[$i]['picture'], '', 'small') . '" />';
         }
     }
     return $result;
 }
Ejemplo n.º 14
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_block_topic($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "topic";
    }
    if (class_exists("Topics")) {
        $topic = new Topics();
        $topic_controller = new Topic();
    } else {
        uses("topic");
        $topic = new Topics();
        $topic_controller = new Topic();
    }
    if (isset($params['id'])) {
        $conditions[] = "id=" . $params['id'];
    }
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "picture!=''";
                    break;
                case 'news':
                    $url_fix = "news/list.php?";
                default:
                    break;
            }
        }
    }
    $orderby = null;
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $topic->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $topic->setLimitOffset($offset, $limit);
    $sql = "SELECT * FROM {$topic->table_prefix}topics " . $topic->getCondition() . "{$orderby}" . $topic->getLimitOffset() . "";
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $topic->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;
        //Todo:news/topic/topic-name.html
        //$item['url'] = $url_fix."topicid=".$item['id'];
        if (!empty($item['alias_name'])) {
            $name = trim($item['alias_name']);
        } else {
            $name = trim($item['title']);
        }
        $item['url'] = smarty_function_the_url(array("module" => "special", "type" => "topic", "name" => urlencode($name)));
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['thumb'] = $item['src'] = pb_get_attachmenturl($item['picture'], '', 'small');
        $item['link'] = '<a title="' . $item['title'] . '" href="' . $item['url'] . '">' . $item['title'] . '</a>';
        $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();
    }
}
Ejemplo n.º 15
0
    $_POST['memberfield']['area_id'] = PbController::getMultiId($_POST['area']['id']);
    unset($vals['created']);
    unset($_POST['memberfield']['created']);
    $result = $member->save($vals, "update", $the_memberid);
    $memberfield->primaryKey = "member_id";
    $result = $memberfield->save($_POST['memberfield'], "update", $the_memberid);
    $member->clearCache($the_memberid);
    $member->updateMemberCaches($the_memberid);
    if (isset($_POST['personal']['resume_status'])) {
        $result = $pdb->Execute("REPLACE INTO {$tb_prefix}personals (member_id,resume_status,max_education) VALUE (" . $the_memberid . ",'" . $_POST['personal']['resume_status'] . "','" . $_POST['personal']['max_education'] . "')");
    }
    if (!$result) {
        flash('action_failed');
    } else {
        flash('success');
    }
}
unset($G['typeoption']['gender'][-1]);
setvar("Genders", $G['typeoption']['gender']);
setvar("Educations", $G['typeoption']['education']);
setvar("OfficeRedirects", explode(",", L("office_redirects", "tpl")));
$personal = $pdb->GetRow("SELECT * FROM {$tb_prefix}personals WHERE member_id=" . $the_memberid);
setvar("resume_status", $personal['resume_status']);
setvar("max_education", $personal['max_education']);
if (!empty($memberinfo['photo'])) {
    $memberinfo['image'] = pb_get_attachmenturl($memberinfo['photo'], "../", "small");
}
$r2 = $area->disSubOptions($memberinfo['area_id'], "area_");
$memberinfo = am($memberinfo, $r2);
setvar("item", $memberinfo);
vtemplate("personal");
Ejemplo n.º 16
0
 function lists()
 {
     global $viewhelper;
     $conditions = array();
     $viewhelper->setPosition(L("sub_special", "tpl"), "index.php?do=topic");
     $viewhelper->setTitle(L("sub_special", "tpl"));
     $types = cache_read("type");
     $result = $this->topic->findAll("*", null, $conditions, "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]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small');
             }
         }
         setvar("module", strtolower(get_class($this)));
         setvar("items", $result);
     }
     render("list.default");
 }
Ejemplo n.º 17
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: 2124 $
 */
function smarty_function_get($params, &$smarty)
{
    extract($params);
    global $tb_prefix, $pdb;
    if (empty($var)) {
        $var = "item";
    }
    //depth
    if (class_exists("Industries")) {
        $industry = new Industries();
        $obj_controller = new Industry();
    } else {
        uses("industry");
        $industry = new Industries();
        $obj_controller = new Industry();
    }
    switch ($from) {
        case "market":
            $latest_commend_markets = $industry->GetArray("SELECT * FROM " . $tb_prefix . "markets WHERE if_commend='1' AND status='1' AND picture!='' ORDER BY id DESC LIMIT 0,10");
            $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[] = $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":
            $return = $industry->getCacheIndustry();
            break;
        case "type":
            if (!empty($name)) {
                $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);
    }
    $smarty->assign($var, $return);
    unset($return, $from, $item);
}
Ejemplo n.º 18
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");
 }
Ejemplo n.º 19
0
 function getFocus($params)
 {
     $focus_lists = array();
     $target = '';
     $width = 220;
     $height = 160;
     $flash_src = STATICURL . "images/focus.swf";
     if (isset($params['target'])) {
         $target = trim($params['target']);
     }
     if (isset($params['table'])) {
         $target = trim($params['table']);
     }
     if (isset($params['from'])) {
         $target = trim($params['from']);
     }
     switch ($target) {
         case "fair":
             $table = "expos";
             $fields = "id,name AS title,picture,picture AS image";
             $url = "index.php?do=fair&action=detail&id=";
             break;
         default:
             $table = "newses";
             $fields = "id,title,picture,picture AS image";
             $url = "index.php?do=news&action=detail&id=";
             break;
     }
     $sql = "SELECT " . $fields . " FROM " . $this->table_prefix . $table . " WHERE status='1' AND picture!='' ORDER BY id desc LIMIT 0,6";
     $tmp_arr = $this->dbstuff->GetArray($sql);
     if (!empty($tmp_arr)) {
         foreach ($tmp_arr as $key => $val) {
             $focus_lists['pics'][] = pb_get_attachmenturl($val['picture']);
             $focus_lists['links'][] = $url . $val['id'];
             $focus_lists['texts'][] = pb_lang_split($val['title']);
         }
     }
     $pics = implode("|", $focus_lists['pics']);
     $links = implode("|", $focus_lists['links']);
     $texts = implode("|", $focus_lists['texts']);
     return "<script type=\"text/javascript\">\n\t\t\tvar focus_width={$width};\n\t\t\tvar focus_height={$height};\n\t\t\tvar text_height=30;\n\t\t\tvar swf_height = focus_height+text_height;\n\t\t\tvar pics ='{$pics}';\n\t\t\tvar links='{$links}';\n\t\t\tvar texts='{$texts}';\n\t\t\tdocument.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"'+ focus_width +'\" height=\"'+ swf_height +'\">');\n\t\t\tdocument.write('<param name=\"allowScriptAccess\" value=\"sameDomain\"><param name=\"movie\" value=\"{$flash_src}\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#F0F0F0\">');\n\t\t\tdocument.write('<param name=\"menu\" value=\"false\"><param name=wmode value=\"opaque\">');\n\t\t\tdocument.write('<param name=\"FlashVars\" value=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\">');\n\t\t\tdocument.write('<embed src=\"{$flash_src}\" wmode=\"opaque\" FlashVars=\"pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'\" menu=\"false\" bgcolor=\"#F0F0F0\" quality=\"high\" width=\"'+ focus_width +'\" height=\"'+ focus_height +'\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');  \n\t\t\tdocument.write('</object>');\n\t\t\t</script>";
 }
Ejemplo n.º 20
0
        $viewhelper->setPosition($tmp_info['name'], "fair/list.php?areaid=" . $tmp_info['id']);
    }
}
$amount = $expo->findCount(null, $conditions);
$result = $expo->findAll("*", null, $conditions, "id desc", $pos, $limit);
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($result[$i]['description'])), 0, 100);
        $result[$i]['typename'] = $_PB_CACHE['expotype'][$result[$i]['expotype_id']];
        $result[$i]['title'] = $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']);
$viewhelper->setTitle(L("search", "tpl"));
$viewhelper->setPosition(L("search", "tpl"));
setvar("paging", array('total' => $amount));
render("fair/list");
Ejemplo n.º 21
0
    }
    if (!$result) {
        flash();
    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    $res = null;
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $sql = "select * FROM {$tb_prefix}markets WHERE id=" . $id;
            $res = $pdb->GetRow($sql);
            $res['image'] = pb_get_attachmenturl($res['picture'], '../', 'small');
            $r1 = $industry->disSubOptions($res['industry_id'], "industry_");
            $r2 = $area->disSubOptions($res['area_id'], "area_");
            $res = am($res, $r1, $r2);
            setvar("item", $res);
        }
        setvar("MarketStatus", $typeoption->get_cache_type("common_status"));
        setvar("AskAction", $typeoption->get_cache_type("common_option"));
        $tpl_file = "market.edit";
        template($tpl_file);
        exit;
    }
    if ($do == "del" && !empty($id)) {
        $market->del($id);
    }
}
Ejemplo n.º 22
0
 function detail()
 {
     global $viewhelper, $G, $pb_user;
     $positions = $titles = array();
     uses("trade", "member", "company", "tradefield", "form", "industry", "area", "meta");
     $offer = new Tradefields();
     $area = new Areas();
     $meta = new Metas();
     $industry = new Industries();
     $company = new Companies();
     $trade = new Trade();
     $trade_model = new Trades();
     $member = new Members();
     //$typeoption = new Typeoption();
     $form = new Forms();
     setvar("Genders", cache_read("typeoption", 'gender'));
     setvar("PhoneTypes", cache_read("typeoption", 'phone_type'));
     $viewhelper->setTitle(L("offer", "tpl"));
     $viewhelper->setPosition(L("offer", "tpl"), "index.php?do=offer");
     if (isset($_GET['title'])) {
         $title = trim($_GET['title']);
         $res = $trade_model->findByTitle($title);
         $id = $res['id'];
     }
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (!empty($id)) {
         $trade->setInfoById($id);
         $info = $trade->info;
         if (empty($info['id'])) {
             flash("data_not_exists", '', 0);
         }
         $info['title_clear'] = $info['title'];
         $info['title'] .= ($G['setting']['offer_expire_method'] == 1 || $G['setting']['offer_expire_method'] == 3) && $info['expdate'] < $offer->timestamp ? "[" . L("has_expired", "tpl") . "]" : '';
         $info['title'] .= !empty($info['if_urgent']) ? "[" . L("urgent_buy", "tpl") . "]" : '';
         if ($info['expdate'] < $offer->timestamp && $G['setting']['offer_expire_method'] == 2) {
             flash("has_been_expired", URL, 0, $info['title_clear'] . " ");
         }
     } else {
         flash("data_not_exists", '', 0);
     }
     if ($info['status'] != 1) {
         flash("under_checking", null, 0, $info['title_clear'] . " ");
     }
     $trade_types = $trade->getTradeTypes();
     $viewhelper->setTitle($trade_types[$info['type_id']]);
     $viewhelper->setPosition($trade_types[$info['type_id']], "index.php?do=offer&action=lists&typeid=" . $info['type_id']);
     $trade_model->clicked($id);
     if ($info['require_point'] > 0) {
         //check member points
         if (empty($pb_user)) {
             flash("please_login_first", URL . "logging.php");
         }
         $point = $member->field("points", "id='" . $pb_user['pb_userid'] . "'");
         if ($point < $info['require_point']) {
             flash("not_enough_points", URL, 0, $info['require_point']);
         }
     }
     $form_vars = array();
     if (isset($info['formattribute_ids'])) {
         $form_vars = $form->getAttributes(explode(",", $info['formattribute_ids']));
     }
     setvar("ObjectParams", $form_vars);
     $info['pubdate'] = df($info['pubdate']);
     $info['expdate'] = df($info['expdate']);
     $info['image'] = pb_get_attachmenturl($info['picture']);
     $login_check = 1;
     if ($info['type_id'] == 1) {
         $login_check = $G['setting']['buy_logincheck'];
     } elseif ($info['type_id'] == 2) {
         $login_check = $G['setting']['sell_logincheck'];
     }
     if (!empty($info['member_id'])) {
         $member_info = $member->getInfoById($info['member_id']);
         $info['link_people'] = $member_info['last_name'];
         $info['space_name'] = $member_info['space_name'];
         $info['tel'] = $member_info['tel'];
         $info['address'] = $member_info['address'];
         $info['zipcode'] = $member_info['zipcode'];
         $info['fax'] = $member_info['fax'];
         $info['site_url'] = $member_info['site_url'];
         setvar("MEMBER", $member_info);
     }
     if (!empty($info['company_id'])) {
         $company_info = $company->getInfoById($info['company_id']);
         if (!empty($company_info)) {
             $info['companyname'] = $company_info['name'];
             $info['link_people'] = $company_info['link_man'];
             $info['address'] = $company_info['address'];
             $info['zipcode'] = $company_info['zipcode'];
             $info['site_url'] = pb_hidestr($company_info['site_url']);
             $info['tel'] = pb_hidestr($company_info['tel']);
             $info['fax'] = pb_hidestr($company_info['fax']);
         }
         setvar("COMPANY", $company_info);
     }
     setvar("LoginCheck", $login_check);
     $info['title'] = strip_tags($info['title']);
     $info['industry_names'] = $industry->disSubNames($info['industry_id'], null, true, "offer");
     $info['area_names'] = $area->disSubNames($info['area_id'], null, true, "offer");
     //delete the pre num.2011.9.1
     //		$info['tel'] = preg_replace('/\((.+?)\)/i', '', pb_hidestr($info['tel']));
     //		$info['fax'] = preg_replace('/\((.+?)\)/i', '', pb_hidestr($info['fax']));
     $info = pb_lang_split_recursive($info);
     setvar("item", $info);
     $meta_info = $meta->getSEOById($id, 'trade', false);
     empty($meta_info['title']) ? $viewhelper->setTitle($info['title'], $info['picture']) : $viewhelper->setTitle($meta_info['title']);
     empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']);
     $viewhelper->setPosition($info['title_clear']);
     if (isset($meta_info['keyword'])) {
         $viewhelper->setMetaKeyword($meta_info['keyword']);
     }
     setvar("forward", $this->url(array("module" => "offer", "id" => $id)));
     render("offer/detail");
 }
Ejemplo n.º 23
0
            $newses = $pdb->GetArray("SELECT news_id FROM {$tb_prefix}topicnews WHERE topic_id=" . $res['id']);
            if (!empty($newses)) {
                $tmp_str = array();
                foreach ($newses as $key => $val) {
                    $tmp_str[] = $val['news_id'];
                }
                $res['news'] = implode("\n", $tmp_str);
            }
            if (!empty($res['picture'])) {
                $res['image'] = pb_get_attachmenturl($res['picture'], "../");
            }
            setvar("item", $res);
        }
        $tpl_file = "newstopic.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $topic->findCount(null, $conditions);
$page->setPagenav($amount);
$result = $topic->findAll("*", null, $conditions, "id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        if (!empty($result[$i]['picture'])) {
            $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], "../");
        }
    }
}
setvar("Items", $result);
uaAssign(array("ByPages" => $page->pagenav));
template($tpl_file);
Ejemplo n.º 24
0
    $vals['type'] = 'inquery';
    $vals['title'] = $_POST['title'];
    $vals['content'] = implode("<br />", $_POST['inquery']);
    $result = $pms->SendToUser($pb_userinfo['pb_username'], $pdb->GetOne("SELECT username FROM {$tb_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 {$tb_prefix}products WHERE id=" . $pid;
$res = $pdb->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", $typeoption->get_cache_type("im_type"));
    setvar("TelTypes", $typeoption->get_cache_type("phone_type"));
    setvar("item", $res);
}
$viewhelper->setTitle($res['name']);
$member_info = $pdb->GetRow("SELECT mf.first_name,mf.last_name,m.email as MemberEmail FROM {$tb_prefix}members m LEFT JOIN {$tb_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");
Ejemplo n.º 25
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_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();
    }
}
Ejemplo n.º 26
0
 function formatResult($result)
 {
     global $_PB_CACHE, $form;
     if (class_exists("Trade")) {
         $trade_controller = new Trade();
     } else {
         uses("trade");
         $trade_controller = new Trade();
     }
     if (!empty($result)) {
         if (empty($_PB_CACHE['trusttype'])) {
             require CACHE_PATH . 'cache_trusttype.php';
         }
         $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;
                     }
                 }
             }
             $result[$i]['im'] = $this->formatIM($result[$i]['cache_contacts']);
             $result[$i]['pubdate'] = @date("Y-m-d", $result[$i]['submit_time']);
             $result[$i]['content'] = strip_tags($result[$i]['content']);
             $result[$i]['url'] = $trade_controller->rewrite($result[$i]['id'], $result[$i]['type_id']);
             if (!empty($result[$i]['membergroup_id'])) {
                 $result[$i]['gradeimg'] = 'images/group/' . $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['avatar'];
                 $result[$i]['gradename'] = $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['name'];
             }
             $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'middle');
             $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="' . $_PB_CACHE['trusttype'][$val]['avatar'] . '" alt="' . $_PB_CACHE['trusttype'][$val]['name'] . '" />';
                 }
             }
             $result[$i]['trusttype'] = $trusttype_images;
         }
         return $result;
     } else {
         return null;
     }
 }
Ejemplo n.º 27
0
        }
        if ($_GET['FromDate'] && $_GET['FromDate'] != "None" && $_GET['ToDate'] && $_GET['ToDate'] != "None") {
            $condition = "Product.created BETWEEN ";
            $condition .= Times::dateConvert($_GET['FromDate']);
            $condition .= " AND ";
            $condition .= Times::dateConvert($_GET['ToDate']);
            $conditions[] = $condition;
        }
    }
}
$amount = $product->findCount(null, $conditions, "Product.id", null);
unset($joins);
$joins[] = "LEFT JOIN {$tb_prefix}companies c ON c.id=Product.company_id";
$page->setPagenav($amount);
//print_r($amount);
//exit;
$fields = "Product.id,Product.company_id AS CompanyID,c.id AS CID,c.name AS companyname,Product.name AS ProductName,Product.status AS ProductStatus,Product.created,Product.ifcommend as Ifcommend, Product.state as ProductState,Product.picture as ProductPicture ";
$result = $product->findAll($fields, $joins, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['pubdate'] = date("Y-m-d", $result[$i]['created']);
        if (!empty($result[$i]['picture'])) {
            $result[$i]['image'] = pb_get_attachmenturl($result[$i]['ProductPicture'], "../", "small");
        }
    }
}
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
//print_r($page->pagenav);
//exit;
template($tpl_file);
Ejemplo n.º 28
0
 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");
 }
Ejemplo n.º 29
0
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;
}
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'] = $_PB_CACHE['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'];
}
$pdb->setFetchMode(ADODB_FETCH_BOTH);
$company->info['description'] = nl2br(strip_tags($company->info['description']));
$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)) {
Ejemplo n.º 30
0
         if ($val['parent_id'] == 0) {
             $set_types[$val['id']] = $val;
             foreach ($trade_types as $key1 => $val1) {
                 if ($val1['parent_id'] == $val['id']) {
                     $set_types[$val['id']]['child'][$val1['id']] = $val1;
                 }
             }
         }
     }
     setvar("select_tradetypes", $set_types);
     if (!empty($item)) {
         unset($item['id']);
         $item['type_id'] = 2;
         $item['title'] = $item['name'];
         if (isset($item['picture'])) {
             $item['image'] = pb_get_attachmenturl($item['picture'], "../");
         }
         setvar("type_id", $item['type_id']);
         setvar("item", $item);
     }
     $tpl_file = "offer_edit";
     template($tpl_file);
     exit;
 }
 if ($do == "update" && !empty($id)) {
     $vals = array();
     $vals['modified'] = $time_stamp;
     $conditions[] = "status='1'";
     $pre_update_time = $pdb->GetOne("select modified from {$tb_prefix}trades where id=" . $id . " and member_id=" . $the_memberid);
     if ($pre_update_time > $time_stamp - $tMaxHours * 3600) {
         flash("only_one_time_within_hours");