/[LeafOK_CVS]/fenglin/bbs/restore.php
ViewVC logotype

Contents of /fenglin/bbs/restore.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Sat Mar 29 01:23:59 2025 UTC (11 months, 2 weeks ago) by sysadm
Branch: MAIN
Changes since 1.5: +19 -10 lines
Allow restore article deleted by admin only

1 <?
2 require_once "../lib/db_open.inc.php";
3 require_once "./common_lib.inc.php";
4 require_once "./session_init.inc.php";
5 ?>
6 <?
7 if (isset($_GET["id"]))
8 $id=intval($_GET["id"]);
9 else
10 $id=0;
11
12 $rs=mysql_query("SELECT TID, SID, m_del FROM bbs WHERE AID = $id AND visible = 0");
13 if($row=mysql_fetch_array($rs))
14 {
15 $tid=$row["TID"];
16 $sid=$row["SID"];
17 }
18 else
19 {
20 error_msg("没有找到文章!", false);
21 exit();
22 }
23 mysql_free_result($rs);
24
25 if (!($_SESSION["BBS_priv"]->checkpriv($sid,S_POST | S_MAN_S)
26 && $row["m_del"]))
27 {
28 error_msg("您无权恢复此文章!", true);
29 exit();
30 }
31
32 if ($tid != 0)
33 {
34 $rs=mysql_query("SELECT AID FROM bbs WHERE AID = $tid AND visible = 1");
35 if(mysql_num_rows($rs) == 0)
36 {
37 error_msg("需要先恢复主题!", true);
38 exit();
39 }
40 }
41
42 mysql_query("update bbs set visible = 1, m_del = 0 where AID = $id")
43 or die("Delete article error!");
44
45 //Add log
46 article_op_log($id,$_SESSION["BBS_uid"],'S',client_addr(),$db_conn)
47 or die("Add log error!");
48
49 //Set last reply date
50 if ($tid!=0)
51 {
52 mysql_query("update bbs set reply_count=reply_count+1 where aid=$tid")
53 or die("Update article error!");
54 }
55
56 mysql_close($db_conn);
57
58 if ($tid==0)
59 {
60 header ("Location: view_article.php?id=$id");
61 }
62 else
63 {
64 header ("Location: view_article.php?id=$tid#$id");
65 }
66 ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1