sunilvarma
03-03-2010, 04:56 AM
I have a plugin with the following code:
###hack
if ($vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_thread']) {
$user_ig = $vbulletin->db->query_read("SELECT threadid from ". TABLE_PREFIX ."cis_thread_ignore where userid = " . $vbulletin->userinfo['userid'] . " and ig_type = 'thread'");
while ($ignores = $vbulletin->db->fetch_array($user_ig)) {
$ignored .= "$ignores[threadid], ";
}
if ($ignored != '') { $ignored = substr($ignored, 0, -2); $globalignore .= $hook_query_where .= " AND thread.threadid NOT IN($ignored)"; }
if ($vbulletin->userinfo['cis_ignorelist_ignore']) {
$ignore_users = preg_replace('#\s+#s', ',', $vbulletin->userinfo['ignorelist']);
if ($ignore_users != '') {
$hook_query_where .= " AND thread.postuserid NOT IN($ignore_users)";
}
}
}
if ($vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_ignore_tag']) {
if ($vbulletin->userinfo['cis_ignoretags_ignore'] != '') {
require_once(DIR . '/includes/functions_newpost.php');
include_once(DIR . '/cis_includes.php');
$tags = fetch_valid_tags('',split_tag_list($vbulletin->userinfo['cis_ignoretags_ignore']), $errors);
foreach ($tags as $item) {
$tag = $db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "tag
WHERE tagtext = '" . $db->escape_string($item) . "'");
if ($tag['tagid'] != '') {
$tagged[$tag[tagid]] = $tag[tagid];
}
}
if (!empty($tagged)) {
foreach ($tagged as $tag) {
$dotags = $vbulletin->db->query_read("SELECT contentid from ". TABLE_PREFIX ."tagcontent where tagid = $tag");
while ($igs = $vbulletin->db->fetch_array($dotags)) {
$ignore_tags .= "$igs[threadid], ";
}
}
}
if ($ignore_tags != '') {
$ignore_tags = substr($ignore_tags, 0, -2);
$hook_query_where .= " AND thread.threadid NOT IN ($ignore_tags)";
}
}
}
###
It's causing the following DB error:
Database error in vBulletin 4.0.2:
Invalid SQL:
SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 1267592343 AND open <> 10, 1, 0)) AS newthread
FROM thread AS thread
WHERE forumid = 2
AND sticky = 0
AND visible = 1
AND thread.threadid NOT IN ();
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 13
Error Number : 1064
Request Date : Wednesday, March 3rd 2010 @ 01:55:07 AM
Error Date : Wednesday, March 3rd 2010 @ 01:55:07 AM
Script : http://localhost/vb40/forumdisplay.php?2-Main-Forum
Referrer : http://localhost/vb40/
IP Address : 127.0.0.1
Username : test1
Classname : vB_Database
MySQL Version :
Any help would be appreciated.
Thanks
Sunil
###hack
if ($vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_thread']) {
$user_ig = $vbulletin->db->query_read("SELECT threadid from ". TABLE_PREFIX ."cis_thread_ignore where userid = " . $vbulletin->userinfo['userid'] . " and ig_type = 'thread'");
while ($ignores = $vbulletin->db->fetch_array($user_ig)) {
$ignored .= "$ignores[threadid], ";
}
if ($ignored != '') { $ignored = substr($ignored, 0, -2); $globalignore .= $hook_query_where .= " AND thread.threadid NOT IN($ignored)"; }
if ($vbulletin->userinfo['cis_ignorelist_ignore']) {
$ignore_users = preg_replace('#\s+#s', ',', $vbulletin->userinfo['ignorelist']);
if ($ignore_users != '') {
$hook_query_where .= " AND thread.postuserid NOT IN($ignore_users)";
}
}
}
if ($vbulletin->userinfo['permissions']['cispermissions'] & $vbulletin->bf_ugp_cispermissions['can_ignore_tag']) {
if ($vbulletin->userinfo['cis_ignoretags_ignore'] != '') {
require_once(DIR . '/includes/functions_newpost.php');
include_once(DIR . '/cis_includes.php');
$tags = fetch_valid_tags('',split_tag_list($vbulletin->userinfo['cis_ignoretags_ignore']), $errors);
foreach ($tags as $item) {
$tag = $db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "tag
WHERE tagtext = '" . $db->escape_string($item) . "'");
if ($tag['tagid'] != '') {
$tagged[$tag[tagid]] = $tag[tagid];
}
}
if (!empty($tagged)) {
foreach ($tagged as $tag) {
$dotags = $vbulletin->db->query_read("SELECT contentid from ". TABLE_PREFIX ."tagcontent where tagid = $tag");
while ($igs = $vbulletin->db->fetch_array($dotags)) {
$ignore_tags .= "$igs[threadid], ";
}
}
}
if ($ignore_tags != '') {
$ignore_tags = substr($ignore_tags, 0, -2);
$hook_query_where .= " AND thread.threadid NOT IN ($ignore_tags)";
}
}
}
###
It's causing the following DB error:
Database error in vBulletin 4.0.2:
Invalid SQL:
SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 1267592343 AND open <> 10, 1, 0)) AS newthread
FROM thread AS thread
WHERE forumid = 2
AND sticky = 0
AND visible = 1
AND thread.threadid NOT IN ();
MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 13
Error Number : 1064
Request Date : Wednesday, March 3rd 2010 @ 01:55:07 AM
Error Date : Wednesday, March 3rd 2010 @ 01:55:07 AM
Script : http://localhost/vb40/forumdisplay.php?2-Main-Forum
Referrer : http://localhost/vb40/
IP Address : 127.0.0.1
Username : test1
Classname : vB_Database
MySQL Version :
Any help would be appreciated.
Thanks
Sunil