Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.4
|
<?php /** * MyBB 1.4
|
* Copyright � 2008 MyBB Group, All Rights Reserved
| * Copyright © 2008 MyBB Group, All Rights Reserved
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: akismet.php 4279 2008-11-26 00:01:25Z Tikitiki $
| * $Id: akismet.php 5379 2011-02-21 11:06:42Z Tomm $
|
*/
// Disallow direct access to this file for security reasons
| */
// Disallow direct access to this file for security reasons
|
Zeile 52 | Zeile 52 |
---|
$lang->load("forum_akismet", false, true); return array(
|
$lang->load("forum_akismet", false, true); return array(
|
"name" => $lang->akismet, "description" => $lang->akismet_desc, "website" => "http://mybboard.net", "author" => "MyBB Group", "authorsite" => "http://mybboard.net", "version" => "1.2.1", "guid" => "e57a80dbe7ff85083596a1a3b7da3ce7",
| "name" => $lang->akismet, "description" => $lang->akismet_desc, "website" => "http://mybboard.net", "author" => "MyBB Group", "authorsite" => "http://mybboard.net", "version" => "1.2.1", "guid" => "e57a80dbe7ff85083596a1a3b7da3ce7",
|
"compatibility" => "14*", ); }
| "compatibility" => "14*", ); }
|
Zeile 82 | Zeile 82 |
---|
* * function hello_is_installed() * {
|
* * function hello_is_installed() * {
|
* global $db; * if($db->table_exists("hello_world")) * { * return true; * } * return false;
| * global $db; * if($db->table_exists("hello_world")) * { * return true; * } * return false;
|
* } * * _uninstall():
| * } * * _uninstall():
|
Zeile 116 | Zeile 116 |
---|
* { * } */
|
* { * } */
|
|
|
function akismet_install() { global $db, $mybb, $lang; if($db->field_exists('akismetstopped', "users")) {
|
function akismet_install() { global $db, $mybb, $lang; if($db->field_exists('akismetstopped', "users")) {
|
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP akismetstopped");
| $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP akismetstopped");
|
} // DELETE ALL SETTINGS TO AVOID DUPLICATES
| } // DELETE ALL SETTINGS TO AVOID DUPLICATES
|
Zeile 141 | Zeile 141 |
---|
$rows = $db->fetch_field($query, "rows"); $insertarray = array(
|
$rows = $db->fetch_field($query, "rows"); $insertarray = array(
|
'name' => 'akismet', 'title' => 'Akismet', 'description' => 'Options on how to configure and personalize Akismet', 'disporder' => $rows+1,
| 'name' => 'akismet', 'title' => 'Akismet', 'description' => 'Options on how to configure and personalize Akismet', 'disporder' => $rows+1,
|
'isdefault' => 0 ); $group['gid'] = $db->insert_query("settinggroups", $insertarray);
| 'isdefault' => 0 ); $group['gid'] = $db->insert_query("settinggroups", $insertarray);
|
Zeile 165 | Zeile 165 |
---|
'name' => 'akismetapikey', 'title' => 'API Key to use for Akismet', 'description' => $db->escape_string('The API Key used to connect to Akismet. Please check here for more details: <a href="http://wordpress.com/api-keys/" target="_blank">http://wordpress.com/api-keys/</a>'),
|
'name' => 'akismetapikey', 'title' => 'API Key to use for Akismet', 'description' => $db->escape_string('The API Key used to connect to Akismet. Please check here for more details: <a href="http://wordpress.com/api-keys/" target="_blank">http://wordpress.com/api-keys/</a>'),
|
'optionscode' => 'text', 'value' => '',
| 'optionscode' => 'text', 'value' => '',
|
'disporder' => 1,
|
'disporder' => 1,
|
'gid' => $group['gid'] ); $db->insert_query("settings", $insertarray);
| 'gid' => $group['gid'] ); $db->insert_query("settings", $insertarray);
|
$insertarray = array( 'name' => 'akismetnumtillban',
| $insertarray = array( 'name' => 'akismetnumtillban',
|
Zeile 179 | Zeile 179 |
---|
'optionscode' => 'text', 'value' => '3', 'disporder' => 2,
|
'optionscode' => 'text', 'value' => '3', 'disporder' => 2,
|
'gid' => $group['gid'] ); $db->insert_query("settings", $insertarray);
| 'gid' => $group['gid'] ); $db->insert_query("settings", $insertarray);
|
$insertarray = array( 'name' => 'akismetfidsignore', 'title' => 'Forums to Ignore',
| $insertarray = array( 'name' => 'akismetfidsignore', 'title' => 'Forums to Ignore',
|
Zeile 220 | Zeile 220 |
---|
rebuild_settings(); }
|
rebuild_settings(); }
|
|
|
function akismet_is_installed() { global $db;
| function akismet_is_installed() { global $db;
|
Zeile 241 | Zeile 241 |
---|
find_replace_templatesets("postbit", "#".preg_quote('{$post[\'button_spam\']}')."#i", '', 0); find_replace_templatesets("postbit_classic", "#".preg_quote('{$post[\'button_spam\']}')."#i", '', 0);
|
find_replace_templatesets("postbit", "#".preg_quote('{$post[\'button_spam\']}')."#i", '', 0); find_replace_templatesets("postbit_classic", "#".preg_quote('{$post[\'button_spam\']}')."#i", '', 0);
|
|
|
$db->delete_query("templates", "title = 'akismet_postbit_spam'"); find_replace_templatesets("postbit", "#".preg_quote('{$post[\'button_edit\']}')."#i", '{$post[\'button_spam\']}{$post[\'button_edit\']}');
| $db->delete_query("templates", "title = 'akismet_postbit_spam'"); find_replace_templatesets("postbit", "#".preg_quote('{$post[\'button_edit\']}')."#i", '{$post[\'button_spam\']}{$post[\'button_edit\']}');
|
Zeile 280 | Zeile 280 |
---|
if($db->field_exists('akismetstopped', "users")) {
|
if($db->field_exists('akismetstopped', "users")) {
|
$db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP akismetstopped");
| $db->write_query("ALTER TABLE ".TABLE_PREFIX."users DROP akismetstopped");
|
} // DELETE ALL SETTINGS TO AVOID DUPLICATES
| } // DELETE ALL SETTINGS TO AVOID DUPLICATES
|
Zeile 303 | Zeile 303 |
---|
if($installed == false && $mybb->input['plugin'] == "akismet") { global $message;
|
if($installed == false && $mybb->input['plugin'] == "akismet") { global $message;
|
|
|
flash_message($message, 'success'); admin_redirect("index.php?module=config/settings&action=change&gid=".intval($mybb->akismet_insert_gid)."#row_setting_akismetapikey"); } }
|
flash_message($message, 'success'); admin_redirect("index.php?module=config/settings&action=change&gid=".intval($mybb->akismet_insert_gid)."#row_setting_akismetapikey"); } }
|
|
|
function akismet_show_confirm_page() {
|
function akismet_show_confirm_page() {
|
global $mybb, $lang, $theme, $pid, $fid;
| global $mybb, $lang, $theme, $pid, $fid, $db, $headerinclude, $header, $footer;
|
$pid = intval($pid); $fid = intval($fid); $query = $db->simple_select("posts", "subject", "pid='{$pid}'", 1);
|
$pid = intval($pid); $fid = intval($fid); $query = $db->simple_select("posts", "subject", "pid='{$pid}'", 1);
|
$post = $db->fetch_array($query);
| $post = $db->fetch_array($query);
|
if(!$post) {
| if(!$post) {
|
Zeile 352 | Zeile 352 |
---|
{$footer} </body> </html>");
|
{$footer} </body> </html>");
|
| exit;
|
}
function akismet_moderation_start() {
|
}
function akismet_moderation_start() {
|
global $mybb, $db, $akismet, $lang, $cache;
| global $mybb, $db, $akismet, $lang, $cache, $fid, $pid;
|
if(!$mybb->settings['akismetswitch'] || $mybb->input['action'] != 'mark_as_spam') {
| if(!$mybb->settings['akismetswitch'] || $mybb->input['action'] != 'mark_as_spam') {
|
Zeile 378 | Zeile 379 |
---|
} $fid = intval($mybb->input['fid']);
|
} $fid = intval($mybb->input['fid']);
|
|
|
if(!is_moderator($fid)) { error("No Permissions to do this action."); } $query = $db->query("
|
if(!is_moderator($fid)) { error("No Permissions to do this action."); } $query = $db->query("
|
SELECT p.username, u.email, u.website, u.akismetstopped, p.message, p.ipaddress, p.tid, p.replyto, p.fid
| SELECT p.uid, p.username, u.email, u.website, u.akismetstopped, p.message, p.ipaddress, p.tid, p.replyto, p.fid, f.usepostcounts
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
| LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=p.fid)
|
WHERE p.pid = '{$pid}' "); $post = $db->fetch_array($query);
| WHERE p.pid = '{$pid}' "); $post = $db->fetch_array($query);
|
Zeile 423 | Zeile 425 |
---|
{ $db->update_query("posts", array('visible' => '-4'), "pid = '{$pid}'"); $snippit = "post";
|
{ $db->update_query("posts", array('visible' => '-4'), "pid = '{$pid}'"); $snippit = "post";
|
}
| }
|
if(!$akismet)
|
if(!$akismet)
|
{
| {
|
$akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array); } $akismet->submit_spam();
|
$akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array); } $akismet->submit_spam();
|
$unapprovedakismetthread = 0; $unapprovedakismetpost = 0;
| $numakismetthread = $numakismetpost = 0;
|
if($snippit == "thread") { $query = $db->query(" SELECT p.uid, u.usergroup FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
if($snippit == "thread") { $query = $db->query(" SELECT p.uid, u.usergroup FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
WHERE tid = '{$post['tid']}'
| WHERE p.tid = '{$post['tid']}'
|
"); while($post2 = $db->fetch_array($query)) {
|
"); while($post2 = $db->fetch_array($query)) {
|
| ++$numakismetpost;
if($post['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid = '{$post2['uid']}'"); }
|
if($mybb->settings['akismetuidsignore']) { $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']);
|
if($mybb->settings['akismetuidsignore']) { $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']);
|
if(in_array($post2['usergroup'], $akismet_uids_ignore))
| if(in_array($post2['usergroup'], $akismet_uids_ignore) || is_super_admin($post2['uid']))
|
{ continue; }
|
{ continue; }
|
| } if(is_super_admin($post2['uid'])) { continue;
|
} $db->write_query("UPDATE ".TABLE_PREFIX."users SET akismetstopped=akismetstopped+1 WHERE uid = '{$post2['uid']}'"); $query1 = $db->simple_select("users", "akismetstopped", "uid = '{$post2['uid']}'"); $akismetstopped = $db->fetch_field($query1, 'akismetstopped');
|
} $db->write_query("UPDATE ".TABLE_PREFIX."users SET akismetstopped=akismetstopped+1 WHERE uid = '{$post2['uid']}'"); $query1 = $db->simple_select("users", "akismetstopped", "uid = '{$post2['uid']}'"); $akismetstopped = $db->fetch_field($query1, 'akismetstopped');
|
|
|
// Check if the person should be banned if($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban']) { $banned_user = array( "uid" => $post2['uid'],
|
// Check if the person should be banned if($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban']) { $banned_user = array( "uid" => $post2['uid'],
|
"admin" => "Akismet",
| "admin" => 0,
|
"gid" => 7, "oldgroup" => $post2['usergroup'], "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"gid" => 7, "oldgroup" => $post2['usergroup'], "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"reason" => "Automatically banned by the Akismet system for spamming."
| "reason" => "Automatically banned by the Akismet system for spamming.", "oldadditionalgroups" => ''
|
); $db->insert_query("banned", $banned_user);
| ); $db->insert_query("banned", $banned_user);
|
Zeile 477 | Zeile 491 |
---|
$cache->update_moderators(); }
|
$cache->update_moderators(); }
|
++$unapprovedakismetthread; ++$unapprovedakismetpost;
| |
}
|
}
|
| ++$numakismetthread;
|
} else {
| } else {
|
Zeile 496 | Zeile 509 |
---|
{ continue; }
|
{ continue; }
|
| } if(is_super_admin($post['uid'])) { continue;
|
} // Check if the person should be banned if($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban'])
|
} // Check if the person should be banned if($mybb->settings['akismetnumtillban'] > 0 && $akismetstopped >= $mybb->settings['akismetnumtillban'])
|
{
| {
|
$banned_user = array( "uid" => $post['uid'],
|
$banned_user = array( "uid" => $post['uid'],
|
"admin" => "Akismet",
| "admin" => 0,
|
"gid" => 7, "oldgroup" => $usergroup, "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"gid" => 7, "oldgroup" => $usergroup, "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"reason" => "Automatically banned by the Akismet system for spamming."
| "reason" => "Automatically banned by the Akismet system for spamming.", "oldadditionalgroups" => ''
|
); $db->insert_query("banned", $banned_user);
| ); $db->insert_query("banned", $banned_user);
|
Zeile 518 | Zeile 537 |
---|
$cache->update_moderators(); }
|
$cache->update_moderators(); }
|
++$unapprovedakismetthread; ++$unapprovedakismetpost;
| ++$numakismetpost; if($post['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid = '{$post['uid']}'"); }
|
}
|
}
|
update_thread_counters($post['tid'], array('unapprovedposts' => '-'.$unapprovedakismetpost)); update_forum_counters($post['fid'], array('unapprovedthreads' => $unapprovedakismetthread, 'unapprovedposts' => '-'.$unapprovedakismetpost));
| update_thread_counters($post['tid'], array('replies' => '-'.$numakismetpost)); update_forum_counters($post['fid'], array('threads' => '-'.$numakismetthread, 'posts' => '-'.$numakismetpost));
|
if($snippit == "thread") {
| if($snippit == "thread") {
|
Zeile 540 | Zeile 563 |
---|
global $templates, $mybb, $theme, $lang; if(!$mybb->settings['akismetswitch'] || !is_moderator($post['fid']))
|
global $templates, $mybb, $theme, $lang; if(!$mybb->settings['akismetswitch'] || !is_moderator($post['fid']))
|
| { return; } if($mybb->settings['akismetuidsignore']) { $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']); if(in_array($usergroup, $akismet_uids_ignore)) { return; } } if(is_super_admin($post['uid']))
|
{ return; }
| { return; }
|
Zeile 551 | Zeile 588 |
---|
function akismet_verify(&$post) {
|
function akismet_verify(&$post) {
|
global $mybb, $isspam, $akismet;
| global $mybb, $isspam, $akismet;
|
if($isspam == true && $mybb->settings['akismetswitch'] == 1) {
| if($isspam == true && $mybb->settings['akismetswitch'] == 1) {
|
Zeile 569 | Zeile 606 |
---|
global $mybb, $isspam, $akismet, $cache; $exclude_array = explode(',', $mybb->settings['akismetuserstoignore']);
|
global $mybb, $isspam, $akismet, $cache; $exclude_array = explode(',', $mybb->settings['akismetuserstoignore']);
|
if(!$mybb->settings['akismetswitch'] || in_array($mybb->user['uid'], $exclude_array))
| if(!$mybb->settings['akismetswitch'] || in_array($mybb->user['uid'], $exclude_array) || is_super_admin($mybb->user['uid']))
|
{ return;
|
{ return;
|
}
| }
|
if($mybb->settings['akismetfidsignore']) {
| if($mybb->settings['akismetfidsignore']) {
|
Zeile 588 | Zeile 625 |
---|
{ $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']); if(in_array($mybb->user['usergroup'], $akismet_uids_ignore))
|
{ $akismet_uids_ignore = explode(',', $mybb->settings['akismetuidsignore']); if(in_array($mybb->user['usergroup'], $akismet_uids_ignore))
|
{
| {
|
return; }
|
return; }
|
}
| }
|
$akismet_array = array( 'type' => 'post', 'username' => $post->data['username'],
| $akismet_array = array( 'type' => 'post', 'username' => $post->data['username'],
|
Zeile 601 | Zeile 638 |
---|
'message' => $post->data['message'], 'user_ip' => $mybb->user['ipaddress'] );
|
'message' => $post->data['message'], 'user_ip' => $mybb->user['ipaddress'] );
|
|
|
if(!$akismet) { $akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array); } if($akismet->check())
|
if(!$akismet) { $akismet = new Akismet($mybb->settings['bburl'], $mybb->settings['akismetapikey'], $akismet_array); } if($akismet->check())
|
{
| {
|
global $db; $isspam = true;
| global $db; $isspam = true;
|
Zeile 622 | Zeile 659 |
---|
{ $banned_user = array( "uid" => $mybb->user['uid'],
|
{ $banned_user = array( "uid" => $mybb->user['uid'],
|
"admin" => "Akismet",
| "admin" => 0,
|
"gid" => 7, "oldgroup" => $mybb->user['usergroup'], "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"gid" => 7, "oldgroup" => $mybb->user['usergroup'], "dateline" => TIME_NOW, "bantime" => 'perm', "lifted" => 'perm',
|
"reason" => "Automatically banned by the Akismet system for spamming."
| "reason" => "Automatically banned by the Akismet system for spamming.", "oldadditionalgroups" => ''
|
); $db->insert_query("banned", $banned_user);
| ); $db->insert_query("banned", $banned_user);
|
Zeile 647 | Zeile 685 |
---|
{ $mybbgroups .= ','.$mybb->user['additionalgroups']; }
|
{ $mybbgroups .= ','.$mybb->user['additionalgroups']; }
|
}
| }
|
// Fake visibility // Essentially because you can't modify the $visible variable we need to trick it
|
// Fake visibility // Essentially because you can't modify the $visible variable we need to trick it
|
// into thinking its saving a draft so it won't modify the users lastpost and postcount
| // into thinking its saving a draft so it won't modify the users lastpost and postcount
|
// In akismet_verify, its set back to -4 so we can still uniquely verify that this is a spam message // before it's inserted into the database. $post->data['savedraft'] = 1;
| // In akismet_verify, its set back to -4 so we can still uniquely verify that this is a spam message // before it's inserted into the database. $post->data['savedraft'] = 1;
|
Zeile 684 | Zeile 722 |
---|
$url = get_forum_link($fid); error("<div align=\"center\">".$lang->redirect_newthread."<br /><br />".$lang->sprintf($lang->redirect_return_forum, $url)."</div>", $lang->akismet_error);
|
$url = get_forum_link($fid); error("<div align=\"center\">".$lang->redirect_newthread."<br /><br />".$lang->sprintf($lang->redirect_return_forum, $url)."</div>", $lang->akismet_error);
|
}
| }
|
}
function akismet_action_handler(&$action)
| }
function akismet_action_handler(&$action)
|
Zeile 709 | Zeile 747 |
---|
} $sub_menu[$key] = array('id' => 'akismet', 'title' => $lang->akismet, 'link' => "index.php?module=forum/akismet");
|
} $sub_menu[$key] = array('id' => 'akismet', 'title' => $lang->akismet, 'link' => "index.php?module=forum/akismet");
|
}
| }
|
}
function akismet_admin_permissions(&$admin_permissions) {
|
}
function akismet_admin_permissions(&$admin_permissions) {
|
global $db, $mybb; if($mybb->settings['akismetswitch'] == 1)
| global $db, $mybb; if($mybb->settings['akismetswitch'] == 1)
|
{ global $lang;
| { global $lang;
|
Zeile 738 | Zeile 776 |
---|
$page->add_breadcrumb_item($lang->akismet); if($mybb->input['delete_all'] && $mybb->request_method == "post")
|
$page->add_breadcrumb_item($lang->akismet); if($mybb->input['delete_all'] && $mybb->request_method == "post")
|
{
| {
|
// User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=forum/akismet"); }
|
// User clicked no if($mybb->input['no']) { admin_redirect("index.php?module=forum/akismet"); }
|
|
|
if($mybb->request_method == "post") { // Delete the template $db->delete_query("posts", "visible = '-4'");
|
if($mybb->request_method == "post") { // Delete the template $db->delete_query("posts", "visible = '-4'");
|
|
|
// Log admin action log_admin_action();
|
// Log admin action log_admin_action();
|
|
|
flash_message($lang->success_deleted_spam, 'success'); admin_redirect("index.php?module=forum/akismet"); } else
|
flash_message($lang->success_deleted_spam, 'success'); admin_redirect("index.php?module=forum/akismet"); } else
|
{
| {
|
$page->output_confirm_action("index.php?module=forum/akismet&delete_all=1", $lang->confirm_spam_deletion); } }
| $page->output_confirm_action("index.php?module=forum/akismet&delete_all=1", $lang->confirm_spam_deletion); } }
|
Zeile 765 | Zeile 803 |
---|
if($mybb->input['unmark'] && $mybb->request_method == "post") { $unmark = $mybb->input['akismet'];
|
if($mybb->input['unmark'] && $mybb->request_method == "post") { $unmark = $mybb->input['akismet'];
|
|
|
if(empty($unmark)) { flash_message($lang->error_unmark, 'error');
| if(empty($unmark)) { flash_message($lang->error_unmark, 'error');
|
Zeile 779 | Zeile 817 |
---|
$posts_in .= $comma.intval($key); $comma = ','; }
|
$posts_in .= $comma.intval($key); $comma = ','; }
|
|
|
$query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while($post = $db->fetch_array($query)) {
| $query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while($post = $db->fetch_array($query)) {
|
Zeile 794 | Zeile 832 |
---|
$thread_list = implode(',', $threadp); $query = $db->query("
|
$thread_list = implode(',', $threadp); $query = $db->query("
|
SELECT p.tid, f.usepostcounts, p.uid, p.fid, p.dateline, t.lastpost, t.lastposter, t.lastposteruid, t.subject
| SELECT p.tid, f.usepostcounts, p.uid, p.fid, p.dateline, p.replyto, t.lastpost, t.lastposter, t.lastposteruid, t.subject
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=p.fid) WHERE p.pid IN ({$posts_in}) AND p.visible = '-4' "); while($post = $db->fetch_array($query))
|
FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid) LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=p.fid) WHERE p.pid IN ({$posts_in}) AND p.visible = '-4' "); while($post = $db->fetch_array($query))
|
{ if($post['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid = '{$post['uid']}'"); } update_thread_counters($post['tid'], array('posts' => '+1'));
| {
|
// Fetch the last post for this forum
|
// Fetch the last post for this forum
|
$query = $db->query("
| $query2 = $db->query("
|
SELECT tid, lastpost, lastposter, lastposteruid, subject FROM ".TABLE_PREFIX."threads WHERE fid='{$post['fid']}' AND visible='1' AND closed NOT LIKE 'moved|%' ORDER BY lastpost DESC LIMIT 0, 1 ");
|
SELECT tid, lastpost, lastposter, lastposteruid, subject FROM ".TABLE_PREFIX."threads WHERE fid='{$post['fid']}' AND visible='1' AND closed NOT LIKE 'moved|%' ORDER BY lastpost DESC LIMIT 0, 1 ");
|
$lastpost = $db->fetch_array($query);
| $lastpost = $db->fetch_array($query2);
|
if($post['lastpost'] > $lastpost['lastpost']) {
| if($post['lastpost'] > $lastpost['lastpost']) {
|
Zeile 826 | Zeile 857 |
---|
$lastpost['lastposteruid'] = $post['lastposteruid']; $lastpost['subject'] = $post['subject']; $lastpost['tid'] = $post['tid'];
|
$lastpost['lastposteruid'] = $post['lastposteruid']; $lastpost['subject'] = $post['subject']; $lastpost['tid'] = $post['tid'];
|
} // Fetch the number of threads and replies in this forum (Approved only) $query = $db->query(" SELECT COUNT(*) AS threads, SUM(replies) AS replies FROM ".TABLE_PREFIX."threads WHERE fid='{$post['fid']}' AND visible='1' AND closed NOT LIKE 'moved|%' "); $count = $db->fetch_array($query); $count['posts'] = $count['threads'] + $count['replies'];
| }
|
$update_count = array(
|
$update_count = array(
|
"posts" => intval($count['posts'])+1, "threads" => intval($count['threads'])+1,
| |
"lastpost" => intval($lastpost['lastpost']), "lastposter" => $db->escape_string($lastpost['lastposter']), "lastposteruid" => intval($lastpost['lastposteruid']), "lastposttid" => intval($lastpost['tid']), "lastpostsubject" => $db->escape_string($lastpost['subject']) );
|
"lastpost" => intval($lastpost['lastpost']), "lastposter" => $db->escape_string($lastpost['lastposter']), "lastposteruid" => intval($lastpost['lastposteruid']), "lastposttid" => intval($lastpost['tid']), "lastpostsubject" => $db->escape_string($lastpost['subject']) );
|
|
|
$db->update_query("forums", $update_count, "fid='{$post['fid']}'");
|
$db->update_query("forums", $update_count, "fid='{$post['fid']}'");
|
$query = $db->query(" SELECT COUNT(*) AS replies FROM ".TABLE_PREFIX."posts WHERE tid='{$post['tid']}' AND visible='1' OR pid = '{$post['pid']}' "); $treplies = $db->fetch_field($query, 'replies'); $query = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
| $query2 = $db->query(" SELECT u.uid, u.username, p.username AS postusername, p.dateline FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
|
WHERE p.tid='{$post['tid']}' AND p.visible='1' OR p.pid = '{$post['pid']}' ORDER BY p.dateline DESC LIMIT 1" );
|
WHERE p.tid='{$post['tid']}' AND p.visible='1' OR p.pid = '{$post['pid']}' ORDER BY p.dateline DESC LIMIT 1" );
|
$lastpost = $db->fetch_array($query); $query = $db->query("
| $lastpost = $db->fetch_array($query2); $query2 = $db->query("
|
SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
SELECT u.uid, u.username, p.username AS postusername, p.dateline
|
FROM ".TABLE_PREFIX."posts p
| FROM ".TABLE_PREFIX."posts p
|
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='{$post['tid']}' ORDER BY p.dateline ASC LIMIT 0,1 ");
|
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE p.tid='{$post['tid']}' ORDER BY p.dateline ASC LIMIT 0,1 ");
|
$firstpost = $db->fetch_array($query);
| $firstpost = $db->fetch_array($query2);
|
if(!$firstpost['username']) { $firstpost['username'] = $firstpost['postusername']; } if(!$lastpost['username'])
|
if(!$firstpost['username']) { $firstpost['username'] = $firstpost['postusername']; } if(!$lastpost['username'])
|
{
| {
|
$lastpost['username'] = $lastpost['postusername'];
|
$lastpost['username'] = $lastpost['postusername'];
|
}
| }
|
if(!$lastpost['dateline']) { $lastpost['username'] = $firstpost['username']; $lastpost['uid'] = $firstpost['uid']; $lastpost['dateline'] = $firstpost['dateline'];
|
if(!$lastpost['dateline']) { $lastpost['username'] = $firstpost['username']; $lastpost['uid'] = $firstpost['uid']; $lastpost['dateline'] = $firstpost['dateline'];
|
}
| }
|
$lastpost['username'] = $db->escape_string($lastpost['username']); $firstpost['username'] = $db->escape_string($firstpost['username']);
|
$lastpost['username'] = $db->escape_string($lastpost['username']); $firstpost['username'] = $db->escape_string($firstpost['username']);
|
--$mybb->user['akismetstopped']; if($mybb->user['akismetstopped'] < 0)
| $query2 = $db->simple_select("users", "akismetstopped", "uid='{$post['uid']}'"); $akismetstopped = $db->fetch_field($query2, "akismetstopped")-1; if($akismetstopped < 0)
|
{
|
{
|
$mybb->user['akismetstopped'] = 0;
| $akismetstopped = 0;
|
}
|
}
|
$db->update_query("users", array('akismetstopped' => $mybb->user['akismetstopped']), "uid='{$mybb->user['uid']}'");
| $db->update_query("users", array('akismetstopped' => $akismetstopped), "uid='{$post['uid']}'");
|
$update_array = array( 'username' => $firstpost['username'],
| $update_array = array( 'username' => $firstpost['username'],
|
Zeile 909 | Zeile 923 |
---|
'lastpost' => intval($lastpost['dateline']), 'lastposter' => $lastpost['username'], 'lastposteruid' => intval($lastpost['uid']),
|
'lastpost' => intval($lastpost['dateline']), 'lastposter' => $lastpost['username'], 'lastposteruid' => intval($lastpost['uid']),
|
'replies' => $treplies
| |
); $db->update_query("threads", $update_array, "tid='{$post['tid']}'");
|
); $db->update_query("threads", $update_array, "tid='{$post['tid']}'");
|
}
| if($post['usepostcounts'] != 0) { $db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum+1 WHERE uid = '{$post['uid']}'"); } $newthreads = $newreplies = 0; if($post['replyto'] == 0) { ++$newthreads; } else { ++$newreplies; } update_thread_counters($post['tid'], array('replies' => '+'.$newreplies)); update_forum_counters($post['fid'], array('threads' => '+'.$newthreads, 'posts' => '+1')); }
|
$approve = array( "visible" => 1, );
| $approve = array( "visible" => 1, );
|
Zeile 924 | Zeile 956 |
---|
} $db->update_query("posts", $approve, "pid IN ({$posts_in})");
|
} $db->update_query("posts", $approve, "pid IN ({$posts_in})");
|
|
|
// Log admin action log_admin_action(); flash_message($lang->success_unmarked, 'success');
|
// Log admin action log_admin_action(); flash_message($lang->success_unmarked, 'success');
|
admin_redirect("index.php?module=forum/akismet"); } if($mybb->input['delete'] && $mybb->request_method == "post")
| admin_redirect("index.php?module=forum/akismet"); } if($mybb->input['delete'] && $mybb->request_method == "post")
|
{ $deletepost = $mybb->input['akismet'];
|
{ $deletepost = $mybb->input['akismet'];
|
|
|
if(empty($deletepost)) { flash_message($lang->error_deletepost, 'error'); admin_redirect("index.php?module=forum/akismet");
|
if(empty($deletepost)) { flash_message($lang->error_deletepost, 'error'); admin_redirect("index.php?module=forum/akismet");
|
}
| }
|
$posts_in = ''; $comma = '';
| $posts_in = ''; $comma = '';
|
Zeile 948 | Zeile 980 |
---|
{ $posts_in .= $comma.intval($key); $comma = ',';
|
{ $posts_in .= $comma.intval($key); $comma = ',';
|
}
| }
|
$query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while($post = $db->fetch_array($query)) {
| $query = $db->simple_select("posts", "pid, tid", "pid IN ({$posts_in}) AND replyto = '0'"); while($post = $db->fetch_array($query)) {
|
Zeile 963 | Zeile 995 |
---|
require_once MYBB_ROOT."inc/functions_upload.php";
|
require_once MYBB_ROOT."inc/functions_upload.php";
|
foreach($deletepost as $key => $val)
| foreach($deletepost as $pid => $val)
|
{
|
{
|
if(array_key_exists($key, $threadp))
| if(array_key_exists($pid, $threadp))
|
{ $db->delete_query("posts", "pid IN ({$posts_in})"); $db->delete_query("attachments", "pid IN ({$posts_in})");
|
{ $db->delete_query("posts", "pid IN ({$posts_in})"); $db->delete_query("attachments", "pid IN ({$posts_in})");
|
|
|
// Get thread info
|
// Get thread info
|
$query = $db->simple_select("threads", "poll", "tid='{$threadp[".$key."]}'");
| $query = $db->simple_select("threads", "poll", "tid='".$threadp[$pid]."'");
|
$poll = $db->fetch_field($query, 'poll');
|
$poll = $db->fetch_field($query, 'poll');
|
|
|
// Delete threads, redirects, favorites, polls, and poll votes
|
// Delete threads, redirects, favorites, polls, and poll votes
|
$db->delete_query("threads", "tid='{$threadp[".$key."]}'"); $db->delete_query("threads", "closed='moved|{$threadp[".$key."]}'"); $db->delete_query("favorites", "tid='{$threadp[".$key."]}'"); $db->delete_query("polls", "tid='{$threadp[".$key."]}'"); $db->delete_query("pollvotes", "pid='$poll'");
| $db->delete_query("threads", "tid='".$threadp[$pid]."'"); $db->delete_query("threads", "closed='moved|".$threadp[$pid]."'"); $db->delete_query("threadsubscriptions", "tid='".$threadp[$pid]."'"); $db->delete_query("polls", "tid='".$threadp[$pid]."'"); $db->delete_query("pollvotes", "pid='{$poll}'");
|
} // Remove attachments
|
} // Remove attachments
|
remove_attachments($post['pid']);
| remove_attachments($pid);
|
// Delete the post
|
// Delete the post
|
$db->delete_query("posts", "pid='{$post['pid']}'");
| $db->delete_query("posts", "pid='{$pid}'");
|
} // Log admin action
| } // Log admin action
|
Zeile 997 | Zeile 1029 |
---|
} if(!$mybb->input['action'])
|
} if(!$mybb->input['action'])
|
{
| {
|
require MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
| require MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
|
Zeile 1038 | Zeile 1070 |
---|
{ if($post['uid'] != 0) {
|
{ if($post['uid'] != 0) {
|
$username = "<a href=\"".str_replace("{uid}", $post['uid'], PROFILE_URL)."\" target=\"_blank\">".format_name($post['username'], $post['usergroup'], $post['displaygroup'])."</a>";
| $username = "<a href=\"../".str_replace("{uid}", $post['uid'], PROFILE_URL)."\" target=\"_blank\">".format_name($post['username'], $post['usergroup'], $post['displaygroup'])."</a>";
|
} else {
| } else {
|
Zeile 1086 | Zeile 1118 |
---|
$form->output_submit_wrapper($buttons); $form->end();
|
$form->output_submit_wrapper($buttons); $form->end();
|
|
|
$page->output_footer(); }
| $page->output_footer(); }
|
Zeile 1094 | Zeile 1126 |
---|
}
/**
|
}
/**
|
* This class is Copyright 2007 Ryan Gordon (Tikitiki)
| * This class is Copyright 2009 Ryan Gordon (Tikitiki)
|
* Built to communicate with the akismet server */
| * Built to communicate with the akismet server */
|
Zeile 1277 | Zeile 1309 |
---|
* Formats the comment array to the Akismet API Standards * */
|
* Formats the comment array to the Akismet API Standards * */
|
function format_post()
| function format_post()
|
{ $format = array( 'type' => 'comment_type',
| { $format = array( 'type' => 'comment_type',
|
Zeile 1288 | Zeile 1320 |
---|
); // Basically we're assigning $long to the comment array if $short in the comment array, is not null
|
); // Basically we're assigning $long to the comment array if $short in the comment array, is not null
|
foreach($format as $short => $long)
| foreach($format as $short => $long)
|
{
|
{
|
if(isset($this->post[$short]))
| if(isset($this->post[$short]))
|
{ $this->post[$long] = $this->post[$short]; unset($this->post[$short]);
| { $this->post[$long] = $this->post[$short]; unset($this->post[$short]);
|
Zeile 1305 | Zeile 1337 |
---|
*/ function build_query_string() {
|
*/ function build_query_string() {
|
foreach($_SERVER as $key => $value)
| foreach($_SERVER as $key => $value)
|
{ if(in_array($key, $this->required)) { if($key == 'REMOTE_ADDR') { $this->post[$key] = $this->post['user_ip'];
|
{ if(in_array($key, $this->required)) { if($key == 'REMOTE_ADDR') { $this->post[$key] = $this->post['user_ip'];
|
} else
| } else
|
{ $this->post[$key] = $value; } } }
|
{ $this->post[$key] = $value; } } }
|
|
|
$query_string = ''; foreach($this->post as $key => $data)
|
$query_string = ''; foreach($this->post as $key => $data)
|
{
| {
|
$query_string .= $key.'='.urlencode(stripslashes($data)).'&'; }
| $query_string .= $key.'='.urlencode(stripslashes($data)).'&'; }
|
Zeile 1332 | Zeile 1364 |
---|
/** * Connects to the Akismet server
|
/** * Connects to the Akismet server
|
*
| *
|
* @return boolean True on success. */ function connect()
| * @return boolean True on success. */ function connect()
|
Zeile 1340 | Zeile 1372 |
---|
$this->connection = @fsockopen($this->host, 80); if(!$this->connection) {
|
$this->connection = @fsockopen($this->host, 80); if(!$this->connection) {
|
$this->set_error("server_not_found");
| $this->set_error("server_not_found");
|
return false;
|
return false;
|
}
| }
|
return true; }
| return true; }
|
Zeile 1388 | Zeile 1420 |
---|
$http_response = explode("\r\n\r\n", $http_response, 2); return $http_response[1];
|
$http_response = explode("\r\n\r\n", $http_response, 2); return $http_response[1];
|
} else
| } else
|
{ $this->set_error("response_failed"); return false;
| { $this->set_error("response_failed"); return false;
|
Zeile 1402 | Zeile 1434 |
---|
* Disconnects from the Akismet server * */
|
* Disconnects from the Akismet server * */
|
function disconnect()
| function disconnect()
|
{ @fclose($this->connection); }
| { @fclose($this->connection); }
|