찾다
php教程PHP源码Discuz投票自动回复插件

Discuz投票自动回复插件

<?php

if(!defined(&#39;IN_DISCUZ&#39;)) {
	exit(&#39;Access Denied&#39;);
}

$sql = <<<EOF

CREATE TABLE `c_reply_poll` (
	`tid` MEDIUMINT(8) UNSIGNED NULL DEFAULT &#39;0&#39;,
	`dateline` INT(11) NOT NULL DEFAULT &#39;0&#39;
)
COMMENT=&#39;投票自动生成回贴&#39;
COLLATE=&#39;utf8_general_ci&#39;
ENGINE=InnoDB;

EOF;

runquery($sql);

$finish = TRUE;
?>

2. [文件] uninstall.php

<?php
/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: uninstall.php 25889 2011-11-24 09:52:20Z monkey $
 */

if(!defined(&#39;IN_DISCUZ&#39;)) {
	exit(&#39;Access Denied&#39;);
}

$sql = <<<EOF
DROP TABLE IF EXISTS `c_reply_poll`;
EOF;

runquery($sql);

$finish = TRUE;
?>

3. [文件] replypoll.class.php 

<?php
/**
 * 投票自动生成回贴插件
 * 
 * TODO:回贴格式可以在后台自定义
 * 在post_newthread.php文件向c_reply_poll表记录用户选择自动回复功能
 * @Author Ricky Feng
 */
require_once libfile(&#39;function/forum&#39;);

if(!defined(&#39;IN_DISCUZ&#39;)) {
	exit(&#39;Access Denied&#39;);
}

class plugin_replypoll {
	protected $cookie_key = &#39;replypoll_plugin_autoreply&#39;;
	 
	function common(){
		global $_G;
			
		if ($_GET[&#39;action&#39;] == &#39;newthread&#39; && $_GET[&#39;topicsubmit&#39;] && $_GET[&#39;autoreply&#39;]) {
			dsetcookie($this->cookie_key ,1);
		}
		
		if ($_GET[&#39;action&#39;] == &#39;votepoll&#39; && $_GET[&#39;pollsubmit&#39;] && isset($_GET[&#39;fid&#39;]) && $_GET[&#39;tid&#39;]) {

			$_GET[&#39;fid&#39;] = intval($_GET[&#39;fid&#39;]);
			$_GET[&#39;tid&#39;] = intval($_GET[&#39;tid&#39;]);
			
			if (! $result = DB::result_first("SELECT COUNT(*) FROM c_reply_poll WHERE tid = " .$_GET[&#39;tid&#39;]) ) {
				return;
			}
			
			$arr = C::t(&#39;forum_polloption&#39;)->fetch_all_by_tid($_GET[&#39;tid&#39;]);
			$polloption = array();
			foreach($arr as $k=>$v) {
				$polloption[$v[&#39;polloptionid&#39;]]  = $v;
			}
			
			$message = &#39;我选择了{ &#39;;
			foreach ($_POST[&#39;pollanswers&#39;] as $key => $val) {
				$message .= $polloption[$val][&#39;polloption&#39;] . &#39;,&#39;;
			}
			$message = trim($message,",") . &#39; }&#39;;
			
			$data = array(
					&#39;fid&#39; => $_GET[&#39;fid&#39;],
					&#39;tid&#39; => $_GET[&#39;tid&#39;],
					&#39;first&#39; => &#39;0&#39;,
					&#39;author&#39; => $_G[&#39;username&#39;],
					&#39;authorid&#39; => $_G[&#39;uid&#39;],
					&#39;dateline&#39; => time(),
					&#39;message&#39; => $message,
					&#39;invisible&#39; => 0,
					&#39;anonymous&#39; => 0,
					&#39;usesig&#39; => 0,
					&#39;htmlon&#39; => 0,
					&#39;bbcodeoff&#39; => &#39;-1&#39;,
					&#39;smileyoff&#39; => 0,
					&#39;parseurloff&#39; => 0,
					&#39;attachment&#39; => &#39;0&#39;,
					&#39;replycredit&#39; => 0,
					&#39;status&#39; => 0,
					&#39;postid&#39; => 0
			);
			insertpost($data);
			C::t(&#39;forum_forum&#39;)->update_forum_counter($_GET[&#39;fid&#39;], 0, 1, 0);		
		}
	}
}

class plugin_replypoll_forum extends plugin_replypoll {
	
	function post_poll_extra_output() {
		$html .= &#39;<p class="mbn">&#39;;
		$html .= &#39;<input type="checkbox" tabindex="1" value="1" class="pc" id="overt" name="autoreply">&#39;;
		$html .= &#39;<label for="overt"> 投票结果自动生成回贴</label>&#39;;
		$html .= &#39;</p>&#39;;
		return $html;
	}	
	
	function viewthread_poll_top_output() {
		if ($autoreply = getcookie($this->cookie_key) && isset($_GET[&#39;tid&#39;])) {
			$tid = intval($_GET[&#39;tid&#39;]);
			DB::query("INSERT INTO c_reply_poll VALUE($tid, UNIX_TIMESTAMP())");
		}
		dsetcookie($this->cookie_key , null, -1);				
	}
}
?>

4. [文件] discuz_plugin_replypoll.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<root>
	<item id="Title"><![CDATA[Discuz! Plugin]]></item>
	<item id="Version"><![CDATA[X2.5]]></item>
	<item id="Time"><![CDATA[2013-01-21 10:04]]></item>
	<item id="From"><![CDATA[39(http://xxx.net/)]]></item>
	<item id="Data">
		<item id="plugin">
			<item id="available"><![CDATA[1]]></item>
			<item id="adminid"><![CDATA[0]]></item>
			<item id="name"><![CDATA[replypoll]]></item>
			<item id="identifier"><![CDATA[replypoll]]></item>
			<item id="description"><![CDATA[]]></item>
			<item id="datatables"><![CDATA[]]></item>
			<item id="directory"><![CDATA[replypoll/]]></item>
			<item id="copyright"><![CDATA[xx]]></item>
			<item id="version"><![CDATA[ver 1.0]]></item>
			<item id="__modules">
				<item id="0">
					<item id="name"><![CDATA[replypoll]]></item>
					<item id="menu"><![CDATA[]]></item>
					<item id="url"><![CDATA[]]></item>
					<item id="type"><![CDATA[11]]></item>
					<item id="adminid"><![CDATA[0]]></item>
					<item id="displayorder"><![CDATA[0]]></item>
					<item id="navtitle"><![CDATA[]]></item>
					<item id="navicon"><![CDATA[]]></item>
					<item id="navsubname"><![CDATA[]]></item>
					<item id="navsuburl"><![CDATA[]]></item>
				</item>
			</item>
		</item>
		<item id="version"><![CDATA[X2.5]]></item>
		<item id="installfile"><![CDATA[install.php]]></item>
		<item id="uninstallfile"><![CDATA[uninstall.php]]></item>					
	</item>
</root>

5. [图片] QQ拼音截图未命名.jpg

1209.jpg

以上就是Discuz投票自动回复插件的内容,更多相关内容请关注PHP中文网(www.php.cn)!


성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
3 몇 주 전By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25 : Myrise에서 모든 것을 잠금 해제하는 방법
4 몇 주 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

Atom Editor Mac 버전 다운로드

Atom Editor Mac 버전 다운로드

가장 인기 있는 오픈 소스 편집기

ZendStudio 13.5.1 맥

ZendStudio 13.5.1 맥

강력한 PHP 통합 개발 환경

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

WebStorm Mac 버전

WebStorm Mac 버전

유용한 JavaScript 개발 도구

VSCode Windows 64비트 다운로드

VSCode Windows 64비트 다운로드

Microsoft에서 출시한 강력한 무료 IDE 편집기