Esempio n. 1
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 $
 */
require "../libraries/common.inc.php";
uses("news", "typeoption", "newstype");
require "session_cp.inc.php";
require CACHE_PATH . 'cache_type.php';
require LIB_PATH . 'snoopy.class.php';
$news = new Newses();
$newstype = new Newstypes();
$snoopy = new Snoopy();
$typeoption = new Typeoption();
$conditions = array();
$tpl_file = "news.gather";
if (isset($_POST['gather']) && !empty($_POST['rules'])) {
    set_time_limit(180);
    $rules = stripslashes($_POST['rules']);
    $tmp_rules = explode("\r\n", $rules);
    if (!empty($tmp_rules) && count($tmp_rules) == 4) {
        list($remote_url, $remote_url_match, $remote_title_match, $remote_content_match) = $tmp_rules;
    } else {
        flash();
    }
    $snoopy->fetchlinks($remote_url);
    $urls = array();
    $urls = $snoopy->results;
Esempio 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: 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. 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 $
 */
require "../libraries/common.inc.php";
uses("news", "newstype", "membertype", "attachment", "tag", "typeoption");
require LIB_PATH . 'time.class.php';
require PHPB2B_ROOT . 'libraries/page.class.php';
require "session_cp.inc.php";
$tag = new Tags();
$page = new Pages();
$attachment = new Attachment('pic');
$typeoption = new Typeoption();
$membertype = new Membertypes();
$news = new Newses();
$newstype = new Newstypes();
$conditions = array();
$fields = null;
$tpl_file = "news";
setvar("AskAction", $typeoption->get_cache_type("common_option"));
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (isset($_GET['action'])) {
        $action = trim($_GET['action']);
    }
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "search") {
        if (isset($_GET['keywords'])) {
Esempio n. 4
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: 2048 $
 */
define('CURSCRIPT', 'detail');
require "../libraries/common.inc.php";
require "../share.inc.php";
uses("news", "tag");
$news = new Newses();
$tag = new Tags();
$conditions = array();
$viewhelper->setTitle(L("info", "tpl"));
$viewhelper->setPosition(L("info", "tpl"), "news/");
if (isset($_GET['title'])) {
    $title = rawurldecode(trim($_GET['title']));
    $res = $news->findByTitle($title);
    $id = $res['id'];
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
}
if (!empty($id)) {
    require CACHE_PATH . "cache_type.php";
    $news->clicked($id);
    $info = $news->read("*", $id);
    if (empty($info) or !$info) {
        flash("data_not_exists", '', 0);