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

Revision 405, 4.3 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: newtopic.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// ------------------------------------------------------------------------- //
31
32include 'header.php';
33foreach (array('forum', 'order') as $getint) {
34    ${$getint} = isset($_GET[$getint]) ? intval($_GET[$getint]) : 0;
35}
36$viewmode = (isset($_GET['viewmode']) && $_GET['viewmode'] != 'flat') ? 'thread' : 'flat';
37if ( empty($forum) ) {
38    redirect_header("index.php", 2, _MD_ERRORFORUM);
39    exit();
40} else {
41    $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";
42    if ( !$result = $xoopsDB->query($sql) ) {
43        redirect_header('index.php',2,_MD_ERROROCCURED);
44        exit();
45    }
46    $forumdata = $xoopsDB->fetchArray($result);
47    if ( $forumdata['forum_type'] == 1 ) {
48        // To get here, we have a logged-in user. So, check whether that user is allowed to post in
49        // this private forum.
50        $accesserror = 0; //initialize
51        if ( $xoopsUser ) {
52            //check if the user has forum admin right
53            if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
54                if ( !check_priv_forum_auth($xoopsUser->uid(), $forum, true) ) {
55                    $accesserror = 1;
56                }
57            }
58        } else {
59            $accesserror = 1;
60        }
61        if ( $accesserror == 1 ) {
62            redirect_header("viewforum.php?order=$order&amp;viewmode=$viewmode&amp;forum=$forum",2,_MD_NORIGHTTOPOST);
63            exit();
64        }
65        // Ok, looks like we're good.
66    } else {
67        $accesserror = 0;
68        if ( $forumdata['forum_access'] == 3 ) {
69            if ( $xoopsUser ) {
70                if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
71                    if ( !is_moderator($forum, $xoopsUser->uid()) ) {
72                        $accesserror = 1;
73                    }
74                }
75            } else {
76                $accesserror = 1;
77            }
78        } elseif ( $forumdata['forum_access'] == 1 && !$xoopsUser ) {
79            $accesserror = 1;
80        }
81        if ( $accesserror == 1 ) {
82            redirect_header("viewforum.php?order=$order&amp;viewmode=$viewmode&amp;forum=$forum",2,_MD_NORIGHTTOPOST);
83            exit();
84        }
85    }
86    include XOOPS_ROOT_PATH.'/header.php';
87    $istopic = 1;
88    $pid=0;
89    $subject = "";
90    $message = "";
91    $myts =& MyTextSanitizer::getInstance();
92    $hidden = "";
93    unset($post_id);
94    unset($topic_id);
95
96    include 'include/forumform.inc.php';
97    include XOOPS_ROOT_PATH.'/footer.php';
98}
99?>
Note: See TracBrowser for help on using the repository browser.