コード例 #1
0
ファイル: project_pubfun.php プロジェクト: sauger/forbes
function get_news_by_pos($pos, $page = '')
{
    $db = get_db();
    $pos = addslashes($pos);
    $sql = "select * from fb_position where name='{$pos}'";
    if ($page) {
        $page = $db->query("select id from fb_position where name='{$page}' and page_id=0");
        $page_id = $page[0]->id;
        $sql .= " and page_id={$page_id}";
        if ($db->record_count == 0) {
            return false;
        }
    }
    $record = $db->query($sql);
    if ($record === false) {
        return false;
    }
    switch ($record[0]->type) {
        case 'category':
            $category = new category_class('news');
            $category_id = $record[0]->category_id;
            $all_category_ids = $category->children_map($category_id);
            $all_category_ids = implode(',', $all_category_ids);
            $sql = 'select n.created_at,n.id as id,n.id as news_id,n.title,n.short_title,n.video_photo_src,n.description,n.sub_headline,n.category_id from fb_news n left join fb_category c on n.category_id=c.id where n.is_adopt=1 and c.id in(' . $all_category_ids . ') and c.category_type="news" order by n.created_at desc limit ' . $record[0]->position_limit;
            break;
        case 'news':
            $sql = 'select n.created_at,n.id as id,n.id as news_id,n.title,n.short_title,n.video_photo_src,n.description,n.sub_headline,n.author_id from fb_position_relation f left join fb_news n on f.news_id=n.id where n.is_adopt=1 and f.type="news" and f.position_id=' . $record[0]->id . ' order by f.priority limit ' . $record[0]->position_limit;
            break;
        case 'list':
            $sql = "select n.id,n.name,n.image_src,n.comment from fb_position_relation f join fb_custom_list_type n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='list' order by f.priority limit {$record[0]->position_limit}";
            break;
        case 'image':
            $sql = "select n.* from fb_position_relation f join fb_images n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='image' and n.is_adopt=1 order by f.priority limit {$record[0]->position_limit}";
            break;
        case 'column':
            $sql = "select n.* from fb_position_relation f join fb_user n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='column' and n.role_name='column' order by f.priority limit {$record[0]->position_limit}";
            break;
        case 'journalist':
            $sql = "select n.* from fb_position_relation f join fb_user n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='journalist' and n.role_name='journalist' order by f.priority limit {$record[0]->position_limit}";
            break;
        case 'magazine':
            $sql = "select n.* from fb_position_relation f join fb_magazine n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='magazine' order by f.priority limit {$record[0]->position_limit}";
            break;
        case 'activity':
            $sql = "select n.* from fb_position_relation f join fb_event n on f.news_id=n.id where f.position_id={$record[0]->id} and f.type='activity' order by f.priority limit {$record[0]->position_limit}";
            break;
        default:
            return false;
            break;
    }
    return $db->query($sql);
}
コード例 #2
0
ファイル: news_list2.php プロジェクト: sauger/forbes
judge_role();
$category = new category_class('news');
$title = $_REQUEST['title'];
$category_id = $_REQUEST['category'] ? $_REQUEST['category'] : -1;
$is_adopt = $_REQUEST['adopt'];
$up = $_REQUEST['up'];
$language_tag = $_REQUEST['language_tag'] ? $_REQUEST['language_tag'] : 0;
$db = get_db();
$c = array();
array_push($c, "language_tag={$language_tag}");
array_push($c, "category_id is not null");
if ($title != '') {
    array_push($c, "title like '%" . trim($title) . "%' or keywords like '%" . trim($title) . "%' or description like '%" . trim($title) . "%' or author like '%{$title}%'");
}
if ($category_id > 0) {
    $cate_ids = implode(',', $category->children_map($category_id));
    array_push($c, "category_id in({$cate_ids})");
}
array_push($c, "is_adopt=0");
if ($up != '') {
    array_push($c, "set_up={$up}");
}
if (role_name() == 'column_editor' || role_name() == 'column_writer') {
    $c[] = "publisher={$_SESSION['admin_user_id']}";
}
$news = new table_class($tb_news);
$record = $news->paginate('all', array('conditions' => implode(' and ', $c), 'order' => 'created_at desc,category_id'), 30);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
コード例 #3
0
ファイル: bottom.inc.php プロジェクト: sauger/forbes
<div id="bottom_banner">
	<div id="bottom_top"></div>
	<div id="bottom_center">
	<div class="bottom_value">
			<div class="main_cate">[<a target="_blank" href="/list/">榜单</a>]</div>
			<div class="sub_cate"><a href="">富豪榜</a></div>
			<div class="sub_cate"><a href="">城市榜</a></div>
			<div class="sub_cate"><a href="">公司榜</a></div>
			<div class="sub_cate"><a href="">体育榜</a></div>
			<div class="sub_cate"><a href="">人物</a></div>
			<div class="sub_cate"><a href="">教育榜</a></div>
	</div>
	<div class="bottom_value">
			<div class="main_cate">[<a target="_blank" href="/billionaires/">富豪</a>]</div>
			<?php 
$c_ids = $category->children_map(42, false);
$c_id = implode(',', $c_ids);
foreach ($c_ids as $cid) {
    ?>
			<div class="sub_cate"><a href="/review/list/<?php 
    echo $cid;
    ?>
"><?php 
    echo $category->find_name_by_id($cid);
    ?>
</a></div>
			<?php 
}
?>
	</div>
	<div class="bottom_value">
コード例 #4
0
ファイル: news_list.php プロジェクト: sauger/forbes
$db = get_db();
$category = new category_class('news');
if ($news_id) {
    $db->query("select author as name from fb_news where id={$news_id}");
    if ($db->record_count <= 0) {
        redirect('/error/');
        die;
    }
    $author = $db->field_by_name('name');
    $conditions[] = "author='{$author}'";
    $title = "作者:{$author}";
} else {
    if (empty($cid)) {
        $cid = 0;
    }
    $c_id = $category->children_map($cid);
    $c_id = implode(',', $c_id);
    $conditions[] = "a.category_id in ({$c_id})";
    $title = $category->find($cid)->name;
}
if ($author_type == 'column_writer' || $author_type == 'column_editor') {
    $conditions[] = "b.role_name = '{$author_type}'";
} elseif ($author_type == 'column') {
    $conditions[] = "b.role_name like '{$author_type}%'";
} else {
    $author_type = "";
    $conditions[] = "is_adopt = 1";
}
$sql = "select a.id,video_photo_src,a.author,a.created_at,a.title,a.content,a.description from fb_news a left join fb_user b on a.publisher=b.id where ";
if ($cid && $author_type == "" && (!$_REQUEST['page'] || $_REQUEST['page'] == 1)) {
    //normal category,find the top image;
コード例 #5
0
ファイル: update_pos.php プロジェクト: sauger/forbes_old
function update_news_column($category_name, $limit, $type, $position_name)
{
    if ($type == 'author') {
        $author_type = 2;
    } else {
        if ($type == 'journalist') {
            $author_type = 1;
        }
    }
    $db = get_db();
    $category = new category_class();
    $category_id = $category->find_by_name($category_name)->id;
    if (!$category_id) {
        return false;
    }
    $ids = $category->children_map($category_id);
    $ids = implode(",", $ids);
    $sql = "select t1.id,t1.title,t1.short_title,t1.created_at,t1.description,t1.video_photo_src,t2.nick_name,t2.image_src,t2.column_name from fb_news t1 join fb_user t2 on t1.author_id=t2.id where 1=1 and t1.is_adopt=1 and t1.author_type={$author_type} and t1.category_id in ({$ids}) and t2.role_name='{$type}' order by t1.created_at desc";
    $news = $db->query($sql);
    $news_count = $db->record_count;
    for ($i = 0; $i < $news_count; $i++) {
        for ($j = 0; $j < $limit; $j++) {
            $pos_name = $position_name . $j;
            $record = $db->query("select id,end_time from fb_page_pos where name='{$pos_name}'");
            if ($db->record_count == 1) {
                if ($record[0]->end_time > now()) {
                } else {
                    $pos = new table_class('fb_page_pos');
                    $pos->find($record[0]->id);
                    $end_time = date('Y-m-d H:00:00', strtotime("+1hours", time()));
                    $pos->end_time = $end_time;
                    $pos->display = $news[$i]->short_title;
                    $pos->title = $news[$i]->title;
                    $pos->image1 = $news[$i]->video_photo_src;
                    $pos->image2 = $news[$i]->image_src;
                    if (!$news[$i]->column_name) {
                        $pos->alias = $news[$i]->nick_name . '专栏';
                    } else {
                        $pos->alias = $news[$i]->column_name . '专栏';
                    }
                    $pos->description = $news[$i]->description;
                    $pos->href = dynamic_news_url($news[$i]);
                    $pos->static_href = static_news_url($news[$i]);
                    $pos->save();
                    break;
                }
            } else {
                $pos = new table_class('fb_page_pos');
                $pos->name = $pos_name;
                $end_time = date('Y-m-d H:00:00', strtotime("+1hours", time()));
                $pos->end_time = $end_time;
                $pos->display = $news[$i]->short_title;
                $pos->title = $news[$i]->title;
                $pos->image1 = $news[$i]->video_photo_src;
                $pos->image2 = $news[$i]->image_src;
                if (!$news[$i]->column_name) {
                    $pos->alias = $news[$i]->nick_name . '专栏';
                } else {
                    $pos->alias = $news[$i]->column_name . '专栏';
                }
                $pos->description = $news[$i]->description;
                $pos->href = dynamic_news_url($news[$i]);
                $pos->static_href = static_news_url($news[$i]);
                $pos->comment = $category_name . $i;
                $pos->save();
                break;
            }
        }
    }
}
コード例 #6
0
ファイル: post.php プロジェクト: justin1986/eachbb
<?php

include "../../frame.php";
$id = intval($_POST['id']);
$category = new category_class();
$ids = $category->children_map($id);
for ($i = 0; $i < count($ids); $i++) {
    $cate = new table_class("eb_category");
    $cate->delete($ids[$i]);
}
コード例 #7
0
ファイル: news_list.php プロジェクト: justin1986/eachbb
$title_id = $db->query("select name from eb_category where id={$id}");
css_include_tag('news_list');
//获得顶级category id;
$category = new category_class("news");
$item = $category->find($id);
if ($item->level >= 2) {
    $item_ids = $category->tree_map($id);
    $category_id = end($item_ids);
} else {
    $category_id = $id;
}
if (!$category_id) {
    die('invalid param');
}
$sub_category_items = $category->find_sub_category($category_id);
$all_category_ids = $category->children_map($category_id);
$exists_news_ids = array();
?>
<title>网趣宝贝-育儿资讯-<?php 
echo $title_id[0]->name;
?>
</title>
</head>
<body>
<div id="ibody">
	<?php 
include_once '../inc/_consult_top.php';
?>
		<div id="log_top">
			<div id="log_t">
				<a href="/" ><div id="log"></div></a>
コード例 #8
0
ファイル: _news_filter.php プロジェクト: justin1986/eachbb
$filter_adopt = isset($_REQUEST['filter_adopt']) ? $_REQUEST['filter_adopt'] : -1;
$filter_selected = isset($_REQUEST['filter_selected']) ? $_REQUEST['filter_selected'] : -1;
if ($filter_selected == 0) {
    $ids = $_REQUEST['selected_news'] ? $_REQUEST['selected_news'] : 0;
    $conditions[] = "id not in({$ids})";
} elseif ($filter_selected == 1) {
    $ids = $_REQUEST['selected_news'] ? $_REQUEST['selected_news'] : 0;
    $conditions[] = "id in({$ids})";
    $order = " find_in_set(id,'{$ids}')";
}
if ($filter_adopt != -1) {
    $conditions[] = 'is_adopt= ' . $filter_adopt;
}
$filter_category = $_REQUEST['filter_category'] ? $_REQUEST['filter_category'] : -1;
if ($filter_category != -1) {
    $cate_ids = implode(',', $category->children_map($filter_category));
    $conditions[] = 'category_id in (' . $cate_ids . ")";
}
if ($conditions) {
    $conditions = implode(' and ', $conditions);
}
$category->echo_jsdata();
$db = get_db();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv=Content-Type content="text/html; charset=utf-8">
	<meta http-equiv=Content-Language content=zh-CN>
	<title>发布新闻</title>
コード例 #9
0
ファイル: index.php プロジェクト: sauger/forbes
    ?>
' title='<?php 
    echo strip_tags($pos_items->{$pos_name}->description);
    ?>
' target='_blank'><?php 
    echo mb_string(strip_tags($pos_items->{$pos_name}->description), 50);
    ?>
</a>
									<?php 
}
?>
								</div>
							</div>
						</div>
						<?php 
$c_id = $category->children_map(42);
$c_id = implode(',', $c_id);
$news = $db->query("select id,created_at,title from fb_news where category_id in ({$c_id}) and is_adopt=1 group by title order by created_at desc limit 2");
foreach ($news as $v) {
    ?>
						<div class="guide_hr_val2">
							<a target="_blank" href="<?php 
    echo get_news_url($v);
    ?>
" title="<?php 
    echo $v->title;
    ?>
"><?php 
    echo $v->title;
    ?>
</a>