⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 post_reply.php

📁 国外非常不错的论坛
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php/*	Copyright (C) 2003-2005 UseBB Team	http://www.usebb.net		$Header: /cvsroot/usebb/UseBB/sources/post_reply.php,v 1.62 2005/08/13 11:36:09 pc_freak Exp $		This file is part of UseBB.		UseBB is free software; you can redistribute it and/or modify	it under the terms of the GNU General Public License as published by	the Free Software Foundation; either version 2 of the License, or	(at your option) any later version.		UseBB is distributed in the hope that it will be useful,	but WITHOUT ANY WARRANTY; without even the implied warranty of	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	GNU General Public License for more details.		You should have received a copy of the GNU General Public License	along with UseBB; if not, write to the Free Software	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*///// Die when called directly in browser//if ( !defined('INCLUDED') )	exit();//// Update and get the session information//$session->update('reply:'.$_GET['topic']);//// Include the page header//require(ROOT_PATH.'sources/page_head.php');$result = $db->query("SELECT t.id, t.topic_title, t.status_locked, t.forum_id, t.count_replies, f.id AS forum_id, f.name AS forum_name, f.status AS forum_status, f.auth, f.auto_lock, f.increase_post_count FROM ".TABLE_PREFIX."topics t, ".TABLE_PREFIX."forums f WHERE t.id = ".$_GET['topic']." AND f.id = t.forum_id");$topicdata = $db->fetch_result($result);if ( !$topicdata['id'] ) {		//	// This topic does not exist, show an error	//	header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');	$template->set_page_title($lang['Error']);	$template->parse('msgbox', 'global', array(		'box_title' => $lang['Error'],		'content' => sprintf($lang['NoSuchTopic'], 'ID '.$_GET['topic'])	));	} else {		if ( $topicdata['status_locked'] && !$functions->auth($topicdata['auth'], 'lock', $topicdata['forum_id']) ) {				$template->set_page_title($lang['TopicIsLocked']);		$template->parse('msgbox', 'global', array(			'box_title' => $lang['TopicIsLocked'],			'content' => $lang['TopicIsLockedExplain']		));			} elseif ( !$topicdata['forum_status'] && $functions->get_user_level() != LEVEL_ADMIN ) {				$template->set_page_title($lang['ForumIsLocked']);		$template->parse('msgbox', 'global', array(			'box_title' => $lang['ForumIsLocked'],			'content' => $lang['ForumIsLockedExplain']		));			} elseif ( $functions->auth($topicdata['auth'], 'reply', $topicdata['forum_id']) ) {				$_POST['user'] = ( !empty($_POST['user']) ) ? preg_replace('#\s+#', '_', $_POST['user']) : '';				if ( $session->sess_info['user_id'] ) {						$result = $db->query("SELECT COUNT(*) as subscribed FROM ".TABLE_PREFIX."subscriptions WHERE topic_id = ".$_GET['topic']." AND user_id = ".$session->sess_info['user_id']);			$subscribed = $db->fetch_result($result);			$subscribed = ( !$subscribed['subscribed'] ) ? false : true;					}				if ( ( $session->sess_info['user_id'] || ( !empty($_POST['user']) && preg_match(USER_PREG, $_POST['user']) && strlen($_POST['user']) <= $functions->get_config('username_max_length') ) ) && !empty($_POST['content']) && empty($_POST['preview']) && ( time() > $_SESSION['latest_post'] + $functions->get_config('flood_interval') || $functions->get_user_level() > LEVEL_MEMBER ) ) {						//			// Save the guest's username in the session			//			if ( !$session->sess_info['user_id'] )				$_SESSION['user'] = $_POST['user'];						$poster_id = ( $session->sess_info['user_id'] ) ? $session->sess_info['user_id'] : 0;			$poster_guest = ( !$session->sess_info['user_id'] ) ? $_POST['user'] : '';			$_POST['enable_bbcode'] = ( !empty($_POST['enable_bbcode']) ) ? 1 : 0;			$_POST['enable_smilies'] = ( !empty($_POST['enable_smilies']) ) ? 1 : 0;			$_POST['enable_sig'] = ( $session->sess_info['user_id'] && !empty($session->sess_info['user_info']['signature']) && !empty($_POST['enable_sig']) ) ? 1 : 0;			$_POST['enable_html'] = ( $functions->auth($topicdata['auth'], 'html', $topicdata['forum_id']) && !empty($_POST['enable_html']) ) ? 1 : 0;						$result = $db->query("INSERT INTO ".TABLE_PREFIX."posts VALUES(NULL, ".$_GET['topic'].", ".$poster_id.", '".$poster_guest."', '".$session->sess_info['ip_addr']."', '".$_POST['content']."', ".time().", 0, 0, ".$_POST['enable_bbcode'].", ".$_POST['enable_smilies'].", ".$_POST['enable_sig'].", ".$_POST['enable_html'].")");						$inserted_post_id = $db->last_id();			$update_topic_status = ( ( $functions->auth($topicdata['auth'], 'lock', $topicdata['forum_id']) && !empty($_POST['lock_topic']) ) || ( $topicdata['auto_lock'] && $topicdata['count_replies']+1 >= $topicdata['auto_lock'] ) ) ? ', status_locked = 1' : '';						$result = $db->query("UPDATE ".TABLE_PREFIX."topics SET last_post_id = ".$inserted_post_id.", count_replies = count_replies+1".$update_topic_status." WHERE id = ".$_GET['topic']);						$result = $db->query("UPDATE ".TABLE_PREFIX."forums SET posts = posts+1, last_topic_id = ".$_GET['topic']." WHERE id = ".$topicdata['forum_id']);						if ( $session->sess_info['user_id'] && $topicdata['increase_post_count'] ) {								$result = $db->query("UPDATE ".TABLE_PREFIX."members SET posts = posts+1 WHERE id = ".$session->sess_info['user_id']);							}						$result = $db->query("UPDATE ".TABLE_PREFIX."stats SET content = content+1 WHERE name = 'posts'");						if ( !$functions->get_config('disable_info_emails') ) {								//				// E-mail subscribed users				//				$result = $db->query("SELECT s.user_id AS id, u.level, u.email, u.language FROM ".TABLE_PREFIX."subscriptions s, ".TABLE_PREFIX."members u WHERE s.topic_id = ".$_GET['topic']." AND u.id = s.user_id AND s.user_id <> ".$session->sess_info['user_id']);							while ( $subscribed_user = $db->fetch_result($result) ) {										if ( $functions->auth($topicdata['auth'], 'read', $topicdata['forum_id'], false, $subscribed_user) ) {												//						// Fetch the language of the user						//						$user_lang = $functions->fetch_language($subscribed_user['language']);												$functions->usebb_mail(sprintf($user_lang['NewReplyEmailSubject'], stripslashes($topicdata['topic_title'])), $user_lang['NewReplyEmailBody'], array(							'poster_name' => ( $session->sess_info['user_id'] ) ? stripslashes($session->sess_info['user_info']['displayed_name']) : stripslashes($poster_guest),							'topic_title' => stripslashes($topicdata['topic_title']),							'topic_link' => $functions->get_config('board_url').$functions->make_url('topic.php', array('post' => $inserted_post_id), false).'#post'.$inserted_post_id,							'unsubscribe_link' => $functions->get_config('board_url').$functions->make_url('topic.php', array('id' => $_GET['topic'], 'act' => 'unsubscribe'), false)						), $functions->get_config('board_name'), $functions->get_config('admin_email'), $subscribed_user['email'], $subscribed_user['language'], $user_lang['character_encoding']);											}									}							}						//			// Subscribe user to topic			//			if ( $session->sess_info['user_id'] && !$subscribed && !empty($_POST['subscribe_topic']) ) {								$result = $db->query("INSERT INTO ".TABLE_PREFIX."subscriptions VALUES(".$_GET['topic'].", ".$session->sess_info['user_id'].")");									}						//			// This topic should be viewed			//			$_SESSION['viewed_topics'][$_GET['topic']] = time();			$_SESSION['latest_post'] = time();			

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -