story_books.php
2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* @version $Id: story_books.php 1 9:02 2010年9月25日Z 蓝色随想 $
* @package DedeCMS.Module.Book
* @copyright Copyright (c) 2007 - 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__). "/config.php");
require_once DEDEINC. '/datalistcp.class.php';
setcookie("ENV_GOBACK_URL", $dedeNowurl, time()+3600,"/");
CheckPurview('story_list');
if(!isset($action)) $action = '';
if(!isset($catid)) $catid = 0;
if(!isset($keyword)) $keyword = "";
if(!isset($orderby)) $orderby = 0;
if(!isset($ischeck)) $ischeck = 0;
if(!isset($cid)) $cid = 0;
if($action == 'checked')
{
$id = intval($id);
$query="UPDATE #@__story_books SET ischeck=1 WHERE bid='$id'";
if($dsql->ExecuteNoneQuery($query))
{
showmsg('审核成功','story_books.php');
exit();
}
else
{
showmsg('审核失败','story_books.php');
exit();
}
}
//读取所有栏目列表
$dsql->SetQuery("SELECT id,classname,pid,rank FROM #@__story_catalog ORDER BY rank ASC");
$dsql->Execute();
$ranks = Array();
$btypes = Array();
$stypes = Array();
while($row = $dsql->GetArray())
{
if($row['pid']==0)
{
$btypes[$row['id']] = $row['classname'];
}
else
{
$stypes[$row['pid']][$row['id']] = $row['classname'];
}
$ranks[$row['id']] = $row['rank'];
}
$addquery = "";
if($ischeck == 1)
{
$addquery .= " and ischeck=0 ";
}
$orderby = " ORDER BY b.bid DESC ";
if($catid!=0)
{
$addquery .= " And (b.bcatid='$catid' OR b.catid='$catid') ";
}
if($keyword!="")
{
$addquery .= " And (b.bookname LIKE '%$keyword%' OR b.author LIKE '%$keyword%') ";
}
$query = "
SELECT b.bid,b.catid,b.bookname,b.booktype,b.litpic,b.ischeck,b.postnum,b.senddate,c.id AS cid,c.classname FROM #@__story_books b
LEFT JOIN #@__story_catalog c ON c.id = b.catid WHERE b.bid>0 $addquery $orderby
";
$dlist = new DataListCP();
$dlist->pageSize = 20;
$dlist->SetParameter("keyword", $keyword);
$dlist->SetParameter("catid", $cid);
$dlist->SetParameter("orderby", $orderby);
$dlist->SetTemplate(DEDEADMIN. '/templets/story_books.htm');
$dlist->SetSource($query);
$dlist->Display();