source: temp/test-xoops.ec-cube.net/html/modules/newbb/reply.php @ 405

Revision 405, 5.7 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: reply.php,v 1.4 2005/09/04 20:46:10 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27// Author: Kazumi Ono (AKA onokazu)                                          //
28// URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //
29// Project: The XOOPS Project                                                //
30// ------------------------------------------------------------------------- //
31include 'header.php';
32foreach (array('forum', 'topic_id', 'post_id', 'order', 'pid') as $getint) {
33    ${$getint} = isset($_GET[$getint]) ? intval($_GET[$getint]) : 0;
34}
35$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] != 'flat') ? 'thread' : 'flat';
36if ( empty($forum) ) {
37    redirect_header("index.php", 2, _MD_ERRORFORUM);
38    exit();
39} elseif ( empty($topic_id) ) {
40    redirect_header("viewforum.php?forum=$forum", 2, _MD_ERRORTOPIC);
41    exit();
42} elseif ( empty($post_id) ) {
43    redirect_header("viewtopic.php?topic_id=$topic_id&amp;order=$order&amp;viewmode=$viewmode&amp;pid=$pid&amp;forum=$forum", 2, _MD_ERRORPOST);
44    exit();
45} else {
46    if ( is_locked($topic_id) ) {
47        redirect_header("viewtopic.php?topic_id=$topic_id&amp;order=$order&amp;viewmode=$viewmode&amp;pid=$pid&amp;forum=$forum", 2, _MD_TOPICLOCKED);
48        exit();
49    }
50    $sql = "SELECT forum_type, forum_name, forum_access, allow_html, allow_sig, posts_per_page, hot_threshold, topics_per_page FROM ".$xoopsDB->prefix("bb_forums")." WHERE forum_id = $forum";
51    if ( !$result = $xoopsDB->query($sql) ) {
52        redirect_header('index.php',1,_MD_ERROROCCURED);
53        exit();
54    }
55    $forumdata = $xoopsDB->fetchArray($result);
56    $myts =& MyTextSanitizer::getInstance();
57    if ( $forumdata['forum_type'] == 1 ) {
58        // To get here, we have a logged-in user. So, check whether that user is allowed to post in
59        // this private forum.
60        $accesserror = 0; //initialize
61        if ( $xoopsUser ) {
62            if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
63                if ( !check_priv_forum_auth($xoopsUser->uid(), $forum, true) ) {
64                    $accesserror = 1;
65                }
66            }
67        } else {
68            $accesserror = 1;
69        }
70        if ( $accesserror == 1 ) {
71            redirect_header("viewtopic.php?topic_id=$topic_id&amp;post_id=$post_id&amp;order=$order&amp;viewmode=$viewmode&amp;pid=$pid&amp;forum=$forum",2,_MD_NORIGHTTOPOST);
72            exit();
73        }
74        // Ok, looks like we're good.
75    } else {
76        $accesserror = 0;
77        if ( $forumdata['forum_access'] == 3 ) {
78            if ( $xoopsUser ) {
79                if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
80                    if ( !is_moderator($forum, $xoopsUser->uid()) ) {
81                        $accesserror = 1;
82                    }
83                }
84            } else {
85                $accesserror = 1;
86            }
87        } elseif ( $forumdata['forum_access'] == 1 && !$xoopsUser ) {
88            $accesserror = 1;
89        }
90        if ( $accesserror == 1 ) {
91            redirect_header("viewtopic.php?topic_id=$topic_id&amp;post_id=$post_id&amp;order=$order&amp;viewmode=$viewmode&amp;pid=$pid&amp;forum=$forum",2,_MD_NORIGHTTOPOST);
92            exit();
93        }
94    }
95    include XOOPS_ROOT_PATH.'/header.php';
96    include_once 'class/class.forumposts.php';
97    $forumpost = new ForumPosts($post_id);
98    $r_message = $forumpost->text();
99    $r_date = formatTimestamp($forumpost->posttime());
100    $r_name = ($forumpost->uid() != 0) ? XoopsUser::getUnameFromId($forumpost->uid()) : $xoopsConfig['anonymous'];
101    $r_content = _MD_BY." ".$r_name." "._MD_ON." ".$r_date."<br /><br />";
102    $r_content .= $r_message;
103    $r_subject=$forumpost->subject();
104    if (!preg_match("/^Re:/i",$r_subject)) {
105        $subject = 'Re: '.$myts->htmlSpecialChars($r_subject);
106    } else {
107        $subject = $myts->htmlSpecialChars($r_subject);
108    }
109    $q_message = $forumpost->text("Quotes");
110    $hidden = "[quote]\n";
111    $hidden .= sprintf(_MD_USERWROTE,$r_name);
112    $hidden .= "\n".$q_message."[/quote]";
113    $message = "";
114    themecenterposts($r_subject,$r_content);
115    echo "<br />";
116    $pid=$post_id;
117    unset($post_id);
118    $topic_id=$forumpost->topic();
119    $forum=$forumpost->forum();
120    $isreply =1;
121    $istopic = 0;
122    include 'include/forumform.inc.php';
123    include XOOPS_ROOT_PATH.'/footer.php';
124}
125?>
Note: See TracBrowser for help on using the repository browser.