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

Discuz投票自动回复插件

May 25, 2016 pm 05:08 PM

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;
?>
Copy after login

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;
?>
Copy after login

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);				
	}
}
?>
Copy after login

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>
Copy after login

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

1209.jpg

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


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Discuz background login problem solution revealed Discuz background login problem solution revealed Mar 03, 2024 am 08:57 AM

The solution to the Discuz background login problem is revealed. Specific code examples are needed. With the rapid development of the Internet, website construction has become more and more common, and Discuz, as a commonly used forum website building system, has been favored by many webmasters. However, precisely because of its powerful functions, sometimes we encounter some problems when using Discuz, such as background login problems. Today, we will reveal the solution to the Discuz background login problem and provide specific code examples. We hope to help those in need.

How to set up automatic reply in Xianyu How to set up automatic reply How to set up automatic reply in Xianyu How to set up automatic reply Mar 13, 2024 am 10:50 AM

Xianyu can easily meet the needs of everyone. Everyone can buy the goods they need here, and they can also sell their idle items here, making money easily. It is very cost-effective. Friends in need can You can use it to sell all the idle items that you no longer need. You can not only free up space, but also get money. You can set the price freely and others can buy it directly. Sometimes if you are not satisfied with the price and want it, you can also We will talk to you about the price or get more detailed product information. If we don’t reply at this time, we may lose a customer, so we can set up some automatic replies, which can effectively help everyone retain customers for some time. Very useful. The editor here provides you with how to set up automatic replies.

How to set up QQ automatic reply? QQ automatic reply setting steps How to set up QQ automatic reply? QQ automatic reply setting steps Mar 15, 2024 pm 03:13 PM

QQ is a popular social networking software that not only supports multiple communication methods such as text, voice, and video, but also has rich personalized settings. Among them, the automatic reply function is a very practical setting. It can automatically send preset reply content to your friends when you are busy or unable to reply to messages in time, thus avoiding the embarrassment caused by failure to reply in time. In this way, when you are busy or temporarily away, QQ will automatically send preset replies to your friends, allowing you to enjoy social fun and easily cope with various scenarios. How to set up QQ automatic reply? QQ automatic reply setting steps 1. Unlock the phone, open the QQ application, on the homepage message page, lightly click the [Status] icon in the upper left corner, or long press your [avatar] to enter immediately

A must-have for Discuz users! Comprehensive analysis of renaming props! A must-have for Discuz users! Comprehensive analysis of renaming props! Mar 12, 2024 pm 10:15 PM

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

What is Discuz? Definition and function introduction of Discuz What is Discuz? Definition and function introduction of Discuz Mar 03, 2024 am 10:33 AM

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

Detailed explanation of Discuz registration process: allowing you to easily modify personal information Detailed explanation of Discuz registration process: allowing you to easily modify personal information Mar 13, 2024 pm 12:21 PM

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Mar 03, 2024 am 09:33 AM

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Discuz! It is a very popular forum program that provides users with a platform for convenient communication. Using Discuz! When accessing a forum, sometimes you may encounter an incorrect password, which may cause users to be unable to log in and use the forum normally. Well, meet Discuz! When the password is wrong, how should we quickly solve the problem? Some solutions will be shared below, with specific code examples provided for reference. 1. Check whether the password

How to set up automatic replies in Outlook 2013 - How to set up automatic replies in Outlook 2013 How to set up automatic replies in Outlook 2013 - How to set up automatic replies in Outlook 2013 Mar 05, 2024 pm 02:01 PM

Recently, many new friends who have just used Outlook 2013 have asked me how to set up automatic replies in Outlook 2013. Below, I will bring you how to set up automatic replies in Outlook 2013. Let's take a look below. After logging in, the following interface will pop up. Click on the file on the upper left to enter. The following file options interface pops up, click [Auto Reply] to enter the automatic reply setting interface. By default, automatic sending of emails is not checked. We can click and check to set the period of time for automatic reply, as shown in the figure below. You can finally edit the content that needs to be restored. Click OK when the editing is completed, and then ask your colleagues to send you an email to see the effect.

See all articles