PageRenderTime 17ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/edit.php

https://gitlab.com/VoyaTrax/vtforum
PHP | 114 lines | 73 code | 8 blank | 33 comment | 24 complexity | 06730819d916aa606488f439aaf4819e MD5 | raw file
  1<?php
  2// $Id: edit.php,v 1.3 2005/02/10 19:04:21 gij 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';
 33include_once XOOPS_ROOT_PATH.'/modules/vtforum/class/class.forumposts.php';
 34
 35$forumpost = new ForumPosts( intval( @$_GET['post_id'] ) ) ;
 36$post_id = $forumpost->postid() ;
 37if( empty( $post_id ) ) {
 38	die(_MD_VTFORUM_ERRORPOST);
 39}
 40$topic_id = $forumpost->topic() ;
 41$forum = $forumpost->forum() ;
 42
 43// lock check
 44if ( vtforum_is_locked($topic_id) ) {
 45	die(_MD_VTFORUM_TOPICLOCKED);
 46}
 47
 48$sql = sprintf("SELECT forum_type, forum_name, forum_access, allow_html, allow_sig, posts_per_page, hot_threshold, topics_per_page FROM %s WHERE forum_id = %u", $xoopsDB->prefix("vtforum_forums"), $forum);
 49if ( !$result = $xoopsDB->query($sql) ) {
 50	die(_MD_VTFORUM_ERROROCCURED);
 51}
 52$forumdata = $xoopsDB->fetchArray($result);
 53$myts =& MyTextSanitizer::getInstance();
 54
 55// CHECK ACCESS RIGHTS BY FORUM TYPE 
 56if ( $forumdata['forum_type'] == 1 ) {
 57	// To get here, we have a logged-in user. So, check whether that user is allowed to post in
 58	// this private forum.
 59	$accesserror = 0; //initialize
 60	if ( $xoopsUser ) {
 61		if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
 62			if ( !vtforum_check_priv_forum_post($xoopsUser->uid(), $forum) ) {
 63				$accesserror = 1;
 64			}
 65		}
 66	} else {
 67		$accesserror = 1;
 68	}
 69	if ( $accesserror == 1 ) {
 70		die(_MD_VTFORUM_NORIGHTTOPOST);
 71	}
 72} else {
 73	$accesserror = 0;
 74	if ( $forumdata['forum_access'] == 3 ) {
 75		if ( $xoopsUser ) {
 76			if ( !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
 77				if ( !vtforum_is_moderator($forum, $xoopsUser->uid()) ) {
 78					$accesserror = 1;
 79				}
 80			}
 81		} else {
 82			$accesserror = 1;
 83		}
 84	} elseif ( $forumdata['forum_access'] == 1 && !$xoopsUser ) {
 85		$accesserror = 1;
 86	}
 87	if ( $accesserror == 1 ) {
 88		die(_MD_VTFORUM_NORIGHTTOPOST);
 89	}
 90}
 91
 92
 93include XOOPS_ROOT_PATH."/header.php";
 94$nohtml = $forumpost->nohtml();
 95$nosmiley = $forumpost->nosmiley();
 96$icon = $forumpost->icon();
 97$attachsig = $forumpost->attachsig();
 98$topic_id=$forumpost->topic();
 99if ( $forumpost->istopic() ) {
100	$istopic = 1;
101} else {
102	$istopic = 0;
103}
104$subject=$forumpost->subject("Edit");
105$message=$forumpost->text("Edit");
106$solved=$forumpost->solved();
107$hidden = "";
108$myts =& MyTextSanitizer::getInstance();
109$viewmode = $myts->htmlspecialchars($viewmode);
110$formTitle = _MD_VTFORUM_EDITMODEC ;
111include XOOPS_ROOT_PATH.'/modules/vtforum/include/forumform.inc.php';
112include XOOPS_ROOT_PATH.'/footer.php';
113
114?>