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
 *      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'])) {
            $conditions[] = "News.keywords like '%" . trim($_GET['news']['keywords']) . "%'";
Esempio n. 3
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("newstype");
require LIB_PATH . 'page.class.php';
require LIB_PATH . 'cache.class.php';
require "session_cp.inc.php";
$newstype = new Newstypes();
$cache = new Caches();
$page = new Pages();
$conditions = array();
$tpl_file = "newstype";
if (isset($_POST['save']) && !empty($_POST['data']['newstype']['name'])) {
    $vals = array();
    $vals = $_POST['data']['newstype'];
    $vals['level_id'] = intval($pdb->GetOne("SELECT level_id AS new_levelid FROM {$tb_prefix}newstypes WHERE id='" . $vals['parent_id'] . "'") + 1);
    if (!empty($_POST['id'])) {
        $result = $newstype->save($vals, "update", $_POST['id']);
    } elseif (!empty($vals['name'])) {
        $vals['created'] = $time_stamp;
        $names = explode("\r\n", $vals['name']);
        $tmp_name = array();
        if (!empty($names)) {
            foreach ($names as $val) {
                $name = $val;
Esempio n. 4
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_newstype($params, $content, &$smarty, &$repeat)
{
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "newstype";
    }
    $conditions = array();
    $orderby = array();
    if (isset($params['id'])) {
        $conditions[] = "id = " . $params['id'];
    }
    if (class_exists("Newstype")) {
        $newstype = new Newstypes();
        $newstype_controller = new Newstype();
    } else {
        uses("newstype");
        $newstype = new Newstypes();
        $newstype_controller = new Newstype();
    }
    if (isset($params['exclude'])) {
        $conditions[] = "id NOT IN (" . $params['exclude'] . ")";
    }
    if (isset($params['include'])) {
        $conditions[] = "id IN(" . $params['include'] . ")";
    }
    if (isset($params['level'])) {
        $conditions[] = "level_id='" . $params['level'] . "'";
    }
    if (isset($params['parentid'])) {
        $conditions[] = "parent_id='" . $params['parentid'] . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "id DESC ";
    }
    $newstype->setOrderby($orderby);
    $newstype->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $newstype->setLimitOffset($offset, $limit);
    if (isset($params['exclude'])) {
        $conditions[] = $newstype->getExcludeIds($params['exclude']);
    }
    if (isset($params['include'])) {
        $conditions[] = $newstype->getIncludeIds($params['include']);
    }
    $sql = "SELECT * FROM {$newstype->table_prefix}newstypes " . $newstype->getCondition() . $newstype->getOrderby() . $newstype->getLimitOffset();
    $res = $newstype->GetArray($sql);
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $res;
        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;
        $url = smarty_function_the_url(array("module" => "search", "typeid" => $item['id'], "do" => "news"));
        $item['url'] = $url;
        $item['rownum'] = $key;
        $item['title'] = $item['name'];
        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>';
        $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();
    }
}