<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="dt_check_st" active="1">
<title>Check similar thread before posting a new one</title>
<description>Check similar thread before posting a new one</description>
<version>1.0</version>
<url><=!=[=C=D=A=T=A=[http://vietvbb.vn/up/hackdb.php?do=findrelease&productid=dt_check_st]=]=></url>
<versioncheckurl><=!=[=C=D=A=T=A=[http://vietvbb.vn/up/hackdb.php?do=productcheck&productid=dt_check_st]=]=></versioncheckurl>
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
<template name="dt_check_st" templatetype="template" date="1274188617" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[<h2 class="blockhead">Here are the similar threads we found:</h2>
<div class="blockbody formcontrols">
<div class="blockrow texteditor">
<div class="editor_textbox_container">
<ul>
{vb:raw similarthreadbits}
</ul>
</div>
</div>
</div>]=]=></template>
<template name="dt_check_st_js" templatetype="template" date="1274186991" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[<script type="text/javascript">
<!-- Check similar thread - pdtan -->
<vb:literal>
function check_similar_thread(title)
{
ccAjax = new vB_AJAX_Handler(true);
ccAjax.onreadystatechange(uResponse);
ccAjax.send('ajax.php', 'do=get_similar_threads&title='+encodeURI(title));
fetch_object("loading").style.display='';
}
function uResponse()
{
if (ccAjax.handler.readyState == 4 && ccAjax.handler.status == 200)
{
message = ccAjax.handler.responseText;
fetch_object("loading").style.display='none';
if(message=='Error') message = 'No Similar Threads Found';
fetch_object("similar_threads_result").innerHTML = message;
}
}
</vb:literal>
<!-- / Check similar thread - pdtan -->
</script>
]=]=></template>
<template name="dt_check_st_threadbits" templatetype="template" date="1274194733" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[<li style="margin-bottom:3px;{vb:raw bg}">
<div>
<h5><a style="font-weight:bold;" href="{vb:link thread, {vb:raw simthread}}" title="{vb:raw simthread.preview}">{vb:raw simthread.title}</a></h5>
</div>
<div class="dateblock">
<span class="shade">By</span> {vb:raw simthread.postusername} <span class="shade">in forum</span> {vb:raw simthread.forumtitle} (<span class="shade">{vb:rawphrase replies}:</span> {vb:raw simthread.replycount} - <span class="shade">{vb:rawphrase last_post}:</span> {vb:raw simthread.lastreplydate}, <span class="time">{vb:raw simthread.lastreplytime}</span>)
</div>
</li>]=]=></template>
</templates>
<stylevardfns>
</stylevardfns>
<stylevars>
</stylevars>
<plugins>
<plugin active="1" executionorder="5">
<title>Check similar threads before posting a new one</title>
<hookname>ajax_start</hookname>
<phpcode><=!=[=C=D=A=T=A=[global $vbulletin,$permission;
if($_POST['do'] == 'get_similar_threads' AND $vbulletin->options['dt_check_st_active']){
$vbulletin->input->clean_array_gpc('p', array(
'title' => TYPE_STR,
 
);
$iii=0;
require_once(DIR . '/includes/functions_bigthree.php');
if ($coventry = fetch_coventry('string'))
{
$globalignore = "AND thread.postuserid NOT IN ($coventry)";
}
else
{
$globalignore = '';
}
if ($vbulletin->userinfo['userid'] AND in_coventry($vbulletin->userinfo['userid'], true))
{
$tachyselect = "
IF(tachythreadpost.userid IS NULL, thread.lastpost, tachythreadpost.lastpost) AS lastpost,
IF(tachythreadcounter.userid IS NULL, thread.replycount, thread.replycount + tachythreadcounter.replycount) AS replycount
";
$tachyjoin = "
LEFT JOIN " . TABLE_PREFIX . "tachythreadpost AS tachythreadpost ON
(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " . $vbulletin->userinfo['userid'] . ")
LEFT JOIN " . TABLE_PREFIX . "tachythreadcounter AS tachythreadcounter ON
(tachythreadcounter.threadid = thread.threadid AND tachythreadcounter.userid = " . $vbulletin->userinfo['userid'] . ")
";
}
else
{
$tachyselect = "thread.lastpost, thread.replycount";
$tachyjoin = "";
}
if($vbulletin->options['dt_check_st_exclforums'])
{
$sExtra = "AND thread.forumid NOT IN (0" . $vbulletin->options['dt_check_st_exclforums'] . ")";
}
else $sExtra = "";
require_once(DIR . '/includes/class_bootstrap_framework.php');
require_once(DIR . '/vb/types.php');
vB_Bootstrap_Framework::init();
$contenttypeid = vB_Types::instance()->getContentTypeId('vBForum_Thread');
$safetitle = $vbulletin->db->escape_string(convert_urlencoded_unicode(trim($vbulletin->GPC['title'])));
$threads = $vbulletin->db->query_read_slave("
SELECT searchgroup.groupid, MATCH(searchgroup_text.title) AGAINST ('$safetitle') AS score
FROM " . TABLE_PREFIX . "searchgroup AS searchgroup JOIN " . TABLE_PREFIX . "searchgroup_text AS searchgroup_text ON
(searchgroup.searchgroupid = searchgroup_text.searchgroupid)
WHERE MATCH(searchgroup_text.title) AGAINST ('$safetitle') AND
searchgroup.contenttypeid = $contenttypeid
HAVING score > 2
LIMIT {$vbulletin->options['dt_check_st_maxresults']}
");
$similarthreadids = array();
while ($thread = $vbulletin->db->fetch_array($threads))
{
$similarthreadids[] = $thread['groupid'];
}
$vbulletin->db->free_result($threads);
$simthrds = $db->query_read_slave("
SELECT thread.threadid, thread.forumid, thread.title, thread.prefixid, thread.taglist, thread.postusername, thread.postuserid,
$tachyselect,
forum.title AS forumtitle
" . iif($vbulletin->options['threadpreview'], ",post.pagetext AS preview") . "
" . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "
FROM " . TABLE_PREFIX . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON (forum.forumid = thread.forumid)
" . iif($vbulletin->options['threadpreview'], "LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)") . "
" . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON (subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND canview = 1)") . "
$tachyjoin
WHERE thread.threadid IN (0" . implode(',', $similarthreadids) . ") AND thread.visible = 1
" . iif (($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) OR ($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']) OR can_moderate($forumid), '', "AND forum.password = ''") . "
$globalignore
$sExtra
ORDER BY lastpost DESC
");
$similarthreadbits = '';
$forum_active_cache = array();
while ($simthread = $db->fetch_array($simthrds))
{
if (!isset($forum_active_cache["$simthread[forumid]"]))
{
$current_forum = $vbulletin->forumcache["$simthread[forumid]"];
while (!empty($current_forum))
{
if (!($current_forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
// all children of this forum should be hidden now
$forum_children = explode(',', trim($current_forum['childlist']));
foreach ($forum_children AS $forumid)
{
if ($forumid == '-1')
{
continue;
}
$forum_active_cache["$forumid"] = false;
}
break;
}
$forum_active_cache["$current_forum[forumid]"] = true;
$current_forum = $vbulletin->forumcache["$current_forum[parentid]"];
}
}
if (!$forum_active_cache["$simthread[forumid]"])
{
continue;
}
$fperms = fetch_permissions($simthread['forumid']);
if (($fperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND
(($fperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) OR ($vbulletin->userinfo['userid'] != 0 AND $simthread['postuserid'] == $vbulletin->userinfo['userid']))
 
{
// format thread preview if there is one
if (isset($ignore["$simthread[postuserid]"]))
{
$simthread['preview'] = '';
}
else if (isset($simthread['preview']) AND $vbulletin->options['threadpreview'] > 0)
{
$simthread['preview'] = strip_quotes($simthread['preview']);
$simthread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($simthread['preview'], false, true), $vbulletin->options['threadpreview']));
}
$simthread['lastreplydate'] = vbdate($vbulletin->options['dateformat'], $simthread['lastpost'], true);
$simthread['lastreplytime'] = vbdate($vbulletin->options['timeformat'], $simthread['lastpost']);
if ($simthread['prefixid'])
{
$simthread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$simthread[prefixid]_title_plain"]);
$simthread['prefix_rich'] = $vbphrase["prefix_$simthread[prefixid]_title_rich"];
}
else
{
$simthread['prefix_plain_html'] = '';
$simthread['prefix_rich'] = '';
}
$simthread['title'] = fetch_censored_text($simthread['title']);
if($iii%2==0) $bg = "background-color:#F2F6F8;";
else $bg = "";
$templater = vB_Template::create('dt_check_st_threadbits');
$templater->register('simthread', $simthread);
$templater->register('bg', $bg);
$similarthreadbits .= $templater->render();
$iii++;
//print_r($simthread);
}
}
if ($similarthreadbits)
{
$templater = vB_Template::create('dt_check_st');
$templater->register('similarthreadbits', $similarthreadbits);
$similarthreads = $templater->render();
}
else
{
$similarthreads = 'Error';
}
unset($similarthreadbits);
echo $similarthreads;
exit;
}]=]=></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Check similar threads before posting a new one</title>
<hookname>cache_templates</hookname>
<phpcode><=!=[=C=D=A=T=A=[global $vbulletin;
if($vbulletin->options['dt_check_st_active']){
$cache[] = 'dt_check_st_js';
$cache[] = 'dt_check_st';
$cache[] = 'dt_check_st_threadbits';
}]=]=></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Check similar threads before posting a new one</title>
<hookname>newthread_form_complete</hookname>
<phpcode><=!=[=C=D=A=T=A=[global $vbulletin;
if($vbulletin->options['dt_check_st_active']){
$messagearea = "<img id=\"loading\" style=\"display:none\" src=\"". $vbulletin->options['bburl'] ."/images/misc/progress.gif\" alt=\"Loading...\" border=\"0\" /><div id=\"similar_threads_result\"></div>" . $messagearea;
}]=]=></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Check similar threads before posting a new one</title>
<hookname>newthread_start</hookname>
<phpcode><=!=[=C=D=A=T=A=[global $vbulletin;
if($vbulletin->options['dt_check_st_active']){
$headinclude .= vB_Template::create('dt_check_st_js')->render();
}]=]=></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Check similar threads before posting a new one</title>
<hookname>process_templates_complete</hookname>
<phpcode><=!=[=C=D=A=T=A=[global $vbulletin;
if($vbulletin->options['dt_check_st_active']){
$vbulletin->templatecache['newthread'] = str_replace('name="subject"', 'name="subject" onblur="javascript
:check_similar_thread(this.value);"', $vbulletin->templatecache['newthread']);
}]=]=></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_dt_check_st_active_desc" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Select <b>No</b> to disable this hack.]=]=></phrase>
<phrase name="setting_dt_check_st_active_title" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Enabled?]=]=></phrase>
<phrase name="setting_dt_check_st_exclforums_desc" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Similar threads in these forums will not display in results.<br />
List ForumID, seperate by a comma.]=]=></phrase>
<phrase name="setting_dt_check_st_exclforums_title" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Excluded Forums]=]=></phrase>
<phrase name="setting_dt_check_st_maxresults_desc" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Maximum results will display when checking.]=]=></phrase>
<phrase name="setting_dt_check_st_maxresults_title" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Max Results]=]=></phrase>
<phrase name="settinggroup_dt_check_st" date="1274189740" username="Admin" version="1.0"><=!=[=C=D=A=T=A=[Check similar threads before posting a new one]=]=></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="dt_check_st" displayorder="65535">
<setting varname="dt_check_st_active" displayorder="10">
<datatype>boolean</datatype>
<optioncode>yesno</optioncode>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="dt_check_st_exclforums" displayorder="20">
<datatype>free</datatype>
</setting>
<setting varname="dt_check_st_maxresults" displayorder="30">
<datatype>integer</datatype>
<defaultvalue>5</defaultvalue>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
Скрыть