Esempio n. 1
0
 function Add($title)
 {
     global $current_adminer_id, $G;
     $title = pb_strip_spaces(strip_tags($title));
     $exists = $this->checkTagExists($title);
     $closed = 1;
     //invisible
     if (isset($G['setting']['tag_check']) && $G['setting']['tag_check'] == 0) {
         $closed = 0;
     }
     if ($exists) {
         $this->dbstuff->Execute("UPDATE " . $this->table_prefix . "tags SET numbers=numbers+1 WHERE id=" . $this->id);
         return false;
     } else {
         if (!empty($current_adminer_id)) {
             $member_id = $current_adminer_id;
         } elseif (!empty($_SESSION['MemberID'])) {
             $member_id = $_SESSION['MemberID'];
         } else {
             $member_id = 0;
         }
         $sql = "INSERT INTO " . $this->table_prefix . "tags (member_id,name,numbers,closed,created,modified) VALUE ('" . $member_id . "','" . $title . "',1,'" . $closed . "'," . $this->timestamp . "," . $this->timestamp . ")";
         return $this->dbstuff->Execute($sql);
     }
 }
Esempio n. 2
0
 function Add($title, $closed = 0)
 {
     $title = pb_strip_spaces(strip_tags($title));
     $exists = $this->checkTagExists($title);
     if ($exists) {
         $this->dbstuff->Execute("UPDATE " . $this->table_prefix . "tags SET numbers=numbers+1 WHERE id=" . $this->id);
         return false;
     } else {
         $sql = "INSERT INTO " . $this->table_prefix . "tags (name,closed,created) VALUE ('" . $title . "','" . $closed . "'," . $this->timestamp . ")";
         return $this->dbstuff->Execute($sql);
     }
 }
Esempio n. 3
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_brand($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "brand";
    }
    if (class_exists("Brands")) {
        $brand = new Brands();
        $brand_controller = new Brand();
    } else {
        uses("brand");
        $brand = new Brands();
        $brand_controller = new Brand();
    }
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "picture!=''";
                    break;
                case 'hot':
                    $orderbys[] = "hits DESC";
                    break;
                case 'commend':
                    $conditions[] = "if_commend='1'";
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($params['companyid'])) {
        $conditions[] = "b.company_id=" . $params['companyid'];
    }
    if (isset($params['memberid'])) {
        $conditions[] = "b.member_id=" . $params['memberid'];
    }
    if (isset($params['typeid'])) {
        $conditions[] = "b.type_id=" . $params['typeid'];
    }
    if (isset($params['removal'])) {
        $conditions[] = "b.id!=" . $params['removal'];
    }
    $orderby = null;
    if (!empty($orderbys)) {
        $orderby .= " ORDER BY " . implode(",", $orderbys);
    }
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . implode(",", array(trim($params['orderby']), $orderby)) . " ";
    }
    if (empty($orderby)) {
        $orderby = " ORDER BY id DESC ";
    }
    $brand->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $brand->setLimitOffset($offset, $limit);
    $sql = "SELECT id,name,name as title,picture,alias_name,description,description as content FROM {$brand->table_prefix}brands b " . $brand->getCondition() . "{$orderby}" . $brand->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $brand->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $url = $brand->getPermaLink($item['id']);
        $item['url'] = $url;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['name']), 0, $params['titlelen']);
        }
        $item['link'] = '<a title="' . $item['name'] . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['description']), 0, $params['infolen']);
            }
        }
        $item['src'] = $item['thumb'] = "attachment/" . $item['picture'] . ".small.jpg";
        $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();
    }
}
Esempio n. 4
0
 function setMetaDescription($meta_description)
 {
     $this->metaDescription = mb_substr(pb_strip_spaces(strip_tags(pb_lang_split($meta_description))), 0, 100);
 }
Esempio n. 5
0
 function setMetaDescription($meta_description)
 {
     $this->metaDescription = pb_strip_spaces(strip_tags($meta_description));
 }
Esempio n. 6
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_fair($params, $content, &$smarty, &$repeat)
{
    global $rewrite_able;
    $conditions = $orderby = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "fair";
    }
    require CACHE_PATH . "cache_type.php";
    require CACHE_PATH . "cache_area.php";
    if (class_exists("Expos")) {
        $fair = new Expos();
        $fair_controller = new Expo();
    } else {
        uses("expo");
        $fair_controller = new Expo();
        $fair = new Expos();
    }
    $conditions[] = "status=1";
    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 'commend':
                    $conditions[] = "if_commend>0";
                    break;
                case 'hot':
                    $orderby[] = "hits DESC";
                default:
                    break;
            }
        }
    }
    if (!empty($_GET['industryid'])) {
        $conditions['industry'] = "industry_id=" . intval($_GET['industryid']);
    }
    if (!empty($_GET['areaid'])) {
        $conditions['area'] = "area_id=" . intval($_GET['areaid']);
    }
    if (isset($params['typeid'])) {
        $conditions[] = "expotype_id=" . $params['typeid'];
    }
    if (isset($params['expday'])) {
        $conditions[] = "end_time<'" . ($params['expday'] * 86400 + $fair->time_stamp) . "'";
    }
    if (isset($params['subday'])) {
        $conditions[] = "begin_time>'" . ($fair->time_stamp - $params['subday'] * 86400) . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "id DESC";
    }
    $fair->setOrderby($orderby);
    $fair->setCondition($conditions);
    $orderby = null;
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $fair->setLimitOffset($offset, $limit);
    $mysql_limit = $fair->getLimitOffset();
    if (isset($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    $sql = "SELECT *,name AS title,description as content FROM {$fair->table_prefix}expos " . $fair->getCondition() . $fair->getOrderby() . $mysql_limit;
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $fair->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $url = $fair->getPermaLink($item['id'], null, 'fair');
        $item['url'] = $url;
        $item['rownum'] = $key;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['name']), 0, $params['titlelen']);
        }
        if (!$item['begin_time']) {
            $item['pubdate'] = L("invalid_datetime");
        } else {
            $item['pubdate'] = df($item['begin_time']);
        }
        $image_type = isset($params['imagetype']) ? trim($params['imagetype']) : "small";
        $item['thumb'] = $item['src'] = empty($item['picture']) ? pb_get_attachmenturl('', '', $image_type) : pb_get_attachmenturl($item['picture'], '', $image_type);
        $item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']) . "...";
            }
        }
        $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();
    }
}
Esempio n. 7
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_companynews($params, $content, &$smarty, &$repeat)
{
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "companynews";
    }
    if (class_exists("Companynews")) {
        $companynews = new Companynewses();
        $companynews_controller = new Companynews();
    } else {
        uses("companynews");
        $companynews = new Companynewses();
        $companynews_controller = new Companynews();
    }
    if (class_exists("Space")) {
        $space_controller = new Space();
    } else {
        uses("space");
        $space_controller = new Space();
    }
    $conditions = array();
    $orderby = array();
    $conditions[] = "cn.status=1";
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "cn.picture!=''";
                    break;
                case 'hot':
                    $orderby[] = 'clicked DESC';
                default:
                    break;
            }
        }
    }
    if (isset($params['tag'])) {
        $conditions[] = "cn.title like '%" . $params['tag'] . "%'";
    }
    if (!empty($params['companyid'])) {
        $conditions[] = "cn.company_id='" . $params['companyid'] . "'";
    }
    if (!empty($params['memberid'])) {
        $conditions[] = "cn.member_id='" . $params['memberid'] . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "cn.id DESC ";
    }
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    if (isset($_GET['pos'])) {
        $offset = intval($_GET['pos']);
    }
    $companynews->setOrderby($orderby);
    $companynews->setCondition($conditions);
    $companynews->setLimitOffset($offset, $limit);
    $sql = "SELECT cn.id,cn.company_id,cn.title as fulltitle,cn.title,cn.picture,cn.created,cn.content as fullcontent,cn.content,m.username AS userid FROM {$companynews->table_prefix}companynewses cn LEFT JOIN {$companynews->table_prefix}members m ON m.id=cn.member_id " . $companynews->getCondition() . $companynews->getOrderby() . $companynews->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $companynews->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $space_controller->setBaseUrlByUserId($item['userid'], "news");
        $url = $space_controller->rewriteDetail("news", $item['id']);
        $item['url'] = $url;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['link'] = '<a title="' . strip_tags($item['subject']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $item['thumb'] = $item['src'] = "attachment/" . $item['picture'] . ".small.jpg";
        $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();
    }
}
Esempio n. 8
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_news($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "news";
    }
    if (class_exists("News")) {
        $news = new Newses();
        $news_controller = new News();
    } else {
        uses("news");
        $news = new Newses();
        $news_controller = new News();
    }
    $orderby = array();
    require CACHE_PATH . "cache_type.php";
    $conditions[] = "n.status=1";
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "n.picture!=''";
                    break;
                case 'commend':
                    $conditions[] = "if_commend>0";
                    break;
                case 'hot':
                    $orderby[] = 'clicked DESC';
                    break;
                case 'focus':
                    $conditions[] = "n.if_focus='1'";
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($params['flag'])) {
        $conditions[] = "n.flag='" . $params['flag'] . "'";
    }
    if (isset($params['tag'])) {
        $conditions[] = "n.title like '%" . $params['tag'] . "%'";
    }
    if (!empty($params['typeid'])) {
        $conditions[] = "n.type_id=" . $params['typeid'];
    }
    if (!empty($params['id'])) {
        $conditions[] = "n.id='" . $params['id'] . "'";
    }
    if (!empty($params['dateline'])) {
        $dates = explode("-", $params['dateline']);
        $time_from = mktime(0, 0, 0, $dates[1], $dates[2], $dates[0]);
        $conditions[] = "n.created>'" . $time_from . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "id DESC ";
    }
    if (!empty($params['industryid'])) {
        $conditions['industry'] = "n.industry_id='" . $params['industryid'] . "'";
    }
    if (!empty($params['areaid'])) {
        $conditions['area'] = "n.area_id='" . $params['areaid'] . "'";
    }
    if (!empty($_GET['industryid'])) {
        $conditions['industry'] = "n.industry_id=" . intval($_GET['industryid']);
    }
    if (!empty($_GET['areaid'])) {
        $conditions['area'] = "n.area_id=" . intval($_GET['areaid']);
    }
    $news->setOrderby($orderby);
    $news->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $news->setLimitOffset($offset, $limit);
    $mysql_limit = $news->getLimitOffset();
    if (isset($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    $sql = "SELECT *,title as fulltitle,content as fullcontent FROM {$news->table_prefix}newses n " . $news->getCondition() . $news->getOrderby() . $mysql_limit;
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $news->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $item['rownum'] = $key;
        $url = $news->getPermaLink($item['id']);
        $item['url'] = $url;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $image_type = isset($params['imagetype']) ? trim($params['imagetype']) : "small";
        $item['thumb'] = empty($item['picture']) ? pb_get_attachmenturl('', '', $image_type) : pb_get_attachmenturl($item['picture'], '', $image_type);
        $item['src'] = $item['thumb'];
        $item['link'] = '<a title="' . strip_tags($item['fulltitle']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $item['typename'] = $item['type_id'] ? $_PB_CACHE['newstype'][$item['type_id']] : L("undefined_sort", "tpl");
        $item['pubdate'] = df($item['created']);
        $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();
    }
}
Esempio n. 9
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_job($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "job";
    }
    if (class_exists("Jobs")) {
        $job = new Jobs();
    } else {
        uses("job");
        $job = new Jobs();
    }
    if (!class_exists('Space')) {
        uses("space");
    }
    $space_controller = new Space();
    if (isset($params['companyid'])) {
        $conditions[] = "company_id=" . $params['companyid'];
    }
    if (isset($params['status'])) {
        $conditions[] = "j.status='" . $params['status'] . "'";
    }
    if (isset($params['memberid'])) {
        $conditions[] = "member_id=" . $params['memberid'];
    }
    if (isset($params['id'])) {
        $conditions[] = "j.id=" . $params['id'];
    }
    $orderby = null;
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $job->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $job->setLimitOffset($offset, $limit);
    $sql = "SELECT j.id,j.content,j.name,j.name as title,c.name AS companyname,c.cache_spacename AS userid FROM {$job->table_prefix}jobs j LEFT JOIN {$job->table_prefix}companies c ON c.id=j.company_id " . $job->getCondition() . "{$orderby}" . $job->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $job->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $space_controller->setBaseUrlByUserId($item['userid'], "job");
        $url = $space_controller->rewriteDetail("job", $item['id']);
        $item['url'] = $url;
        $item['space_url'] = $space_controller->rewrite($item['userid'], $item['company_id']);
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $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();
    }
}
Esempio n. 10
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_market($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "market";
    }
    if (class_exists("Markets")) {
        $market = new Markets();
        $market_controller = new Market();
    } else {
        uses("market");
        $market = new Markets();
        $market_controller = new Market();
    }
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "picture!=''";
                    break;
                case 'commend':
                    $conditions[] = "if_commend>0";
                    break;
                default:
                    break;
            }
        }
    }
    if (isset($params['areaid'])) {
        $conditions[] = "area_id=" . $params['areaid'];
    }
    if (isset($params['industryid'])) {
        $conditions[] = "industry_id=" . $params['industryid'];
    }
    if (isset($params['id'])) {
        $conditions[] = "id=" . $params['id'];
    }
    $orderby = null;
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $market->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $market->setLimitOffset($offset, $limit);
    $mysql_limit = $market->getLimitOffset();
    if (isset($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    $sql = "SELECT *,name as title FROM {$market->table_prefix}markets " . $market->getCondition() . "{$orderby}" . $mysql_limit;
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $market->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $url = $market->getPermaLink($item['id']);
        $item['url'] = $url;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['subject']), 0, $params['titlelen']);
        }
        $image_type = isset($params['imagetype']) ? trim($params['imagetype']) : "";
        $item['src'] = $item['thumb'] = empty($item['picture']) ? pb_get_attachmenturl('', '', $image_type) : pb_get_attachmenturl($item['picture'], '', $image_type);
        $item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $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();
    }
}
Esempio n. 11
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_help($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "help";
    }
    if (class_exists("Helps")) {
        $help = new Helps();
        $help_controller = new Help();
    } else {
        uses("help");
        $help_controller = new Help();
        $help = new Helps();
    }
    if (!empty($params['typeid'])) {
        $conditions[] = "helptype_id=" . $params['typeid'];
    }
    if (!empty($params['id'])) {
        $conditions[] = "id=" . $params['id'];
    }
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $help->setCondition($conditions);
    $orderby = null;
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $help->setLimitOffset($offset, $limit);
    $sql = "SELECT id,title,title as fulltitle,highlight FROM {$help->table_prefix}helps " . $help->getCondition() . "{$orderby}" . $help->getLimitOffset() . "";
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $help->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $item['iteration'] = ++$key;
        $url = $help->getPermaLink($item['id']);
        $item['url'] = $url;
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['style'] = parse_highlight($item['highlight']);
        $item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '" target="_blank">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            $item['content'] = strip_tags($item['content']);
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $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();
    }
}
Esempio n. 12
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_good($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "good";
    }
    if (class_exists("Goods")) {
        $good = new Goods();
        $good_controller = new Good();
    } else {
        uses("good");
        $good_controller = new Good();
        $good = new Goods();
    }
    if (!empty($params['typeid'])) {
        $conditions[] = "type_id=" . $params['typeid'];
    }
    if (!empty($params['id'])) {
        $conditions[] = "id=" . $params['id'];
    }
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $good->setCondition($conditions);
    $orderby = null;
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $good->setLimitOffset($offset, $limit);
    if ($limit == "-1") {
        $good->limit_offset = 0;
    }
    $mysql_limit = $good->getLimitOffset();
    if (isset($params['limit'])) {
        $mysql_limit = " " . trim($params['limit']);
    }
    $sql = "SELECT *,name AS title,description AS content FROM {$good->table_prefix}goods " . $good->getCondition() . "{$orderby}" . $mysql_limit . "";
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $good->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        if (isset($params['infolen'])) {
            $item['content'] = strip_tags($item['content']);
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $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();
    }
}