function spam_trigger_killspam($id) { global $db, $current_user; # include_once(mnminclude.'link.php'); # include_once(mnminclude.'votes.php'); $oldlevel = $current_user->user_level; $current_user->user_level = 'admin'; killspam($id); $current_user->user_level = $oldlevel; return; $db->query('UPDATE `' . table_users . "` SET user_enabled=0, `user_pass` = '63205e60098a9758101eeff9df0912ccaaca6fca3e50cdce3', user_level='Spammer' WHERE `user_id` = {$id}"); $db->query('UPDATE `' . table_links . '` SET `link_status` = "discard" WHERE `link_author` = "' . $id . '"'); $results = $db->get_results("SELECT comment_id, comment_link_id FROM `" . table_comments . "` WHERE `comment_user_id` = {$id}"); if ($results) { foreach ($results as $result) { $comment_id = $result->comment_id; $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_id` = "' . $comment_id . '"'); $db->query('DELETE FROM `' . table_comments . '` WHERE `comment_parent` = "' . $comment_id . '"'); $link = new Link(); $link->id = $result->comment_link_id; $link->read(); $link->recalc_comments(); $link->store(); } } $results = $db->get_results("SELECT vote_id,vote_link_id FROM `" . table_votes . "` WHERE `vote_user_id` = {$id}"); if ($results) { foreach ($results as $result) { $db->query('DELETE FROM `' . table_votes . '` WHERE `vote_id` = "' . $result->vote_id . '"'); $link = new Link(); $link->id = $result->vote_link_id; $link->read(); $vote = new Vote(); $vote->type = 'links'; $vote->link = $result->vote_link_id; if (Voting_Method == 1) { $link->votes = $vote->count(); $link->reports = $link->count_all_votes("<0"); } elseif (Voting_Method == 2) { $link->votes = $vote->rating(); $link->votecount = $vote->count(); $link->reports = $link->count_all_votes("<0"); } $link->store_basic(); $link->check_should_publish(); } } $db->query('DELETE FROM `' . table_saved_links . '` WHERE `saved_user_id` = "' . $id . '"'); $db->query('DELETE FROM `' . table_trackbacks . '` WHERE `trackback_user_id` = "' . $id . '"'); $db->query('DELETE FROM `' . table_friends . '` WHERE `friend_id` = "' . $id . '"'); $db->query('DELETE FROM `' . table_messages . "` WHERE `sender`={$id} OR `receiver`={$id}"); }
// show the template $main_smarty->assign('tpl_center', '/admin/user_killspam_step1_center'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } else { showmyerror('userdoesntexist'); } } } if (sanitize($_GET["mode"], 3) == "yeskillspam") { // killspam step 2 // code to prevent CSRF $CSRF->check_expired('admin_users_killspam'); // code to prevent CSRF if ($CSRF->check_valid(sanitize($_GET['token'], 3), 'admin_users_killspam')) { $user = $db->get_row('SELECT * FROM ' . table_users . ' where user_login="******"user"], 3) . '"'); killspam($user->user_id); header("Location: " . my_pligg_base . "/admin/admin_users.php"); die; } else { $CSRF->show_invalid_error(1); } } if (sanitize($_GET["mode"], 3) == "search") { // search users $CSRF->create('admin_users_list', true, true); global $offset, $page_size; // Items per page drop-down if (isset($_GET["pagesize"]) && is_numeric($_GET["pagesize"])) { misc_data_update('pagesize', $_GET["pagesize"]); } $pagesize = get_misc_data('pagesize');
function akismet_showpage() { global $main_smarty, $the_template, $current_user, $db; force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { $navwhere['text1'] = 'Akismet'; $navwhere['link1'] = URL_akismet; define('pagename', 'akismet'); $main_smarty->assign('pagename', pagename); define('modulename', 'akismet'); $main_smarty->assign('modulename', modulename); if (isset($_REQUEST['view'])) { $view = sanitize($_REQUEST['view'], 3); } else { $view = ''; } if ($view == '') { $wordpress_key = get_misc_data('wordpress_key'); if ($wordpress_key == '') { header('Location: ' . URL_akismet . '&view=manageKey'); die; } $main_smarty->assign('spam_links_count', akismet_get_link_count()); $main_smarty->assign('spam_comments_count', akismet_get_comment_count()); $main_smarty = do_sidebar($main_smarty, $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', akismet_tpl_path . 'main'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } if ($view == 'updateKey') { if ($_REQUEST['key']) { $wordpress_key = sanitize($_REQUEST['key'], 3); // Verify key before save if (phpnum() >= 5) { include akismet_lib_path . 'Akismet.class_5.php'; $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key); if (!$akismet->isKeyValid()) { $main_smarty->assign('error', 1); } else { misc_data_update('wordpress_key', $wordpress_key); } } else { include akismet_lib_path . 'Akismet.class_4.php'; $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key); if (!$akismet->_isValidApiKey($wordpress_key)) { $main_smarty->assign('error', 1); } else { misc_data_update('wordpress_key', $wordpress_key); } } } else { $wordpress_key = ''; misc_data_update('wordpress_key', $wordpress_key); } $view = 'manageKey'; } if ($view == 'manageKey') { $wordpress_key = get_misc_data('wordpress_key'); $main_smarty->assign('wordpress_key', $wordpress_key); $main_smarty = do_sidebar($main_smarty, $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageKey'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } if ($view == 'manageSpam') { $sql = "SELECT " . table_links . ".*, " . table_users . ".user_login FROM " . table_links . " \r\n\t\t\t\t\tLEFT JOIN " . table_users . " ON link_author=user_id \r\n\t\t\t\t\tLEFT JOIN " . table_prefix . "spam_links ON linkid=link_id\r\n\t\t\t\t\tWHERE !ISNULL(linkid)"; $link_data = $db->get_results($sql); if (sizeof($link_data)) { $main_smarty->assign('link_data', object_2_array($link_data)); } else { header("Location: " . my_pligg_base . "/admin/admin_index.php"); // header('Location: ' . URL_akismet); die; } $main_smarty = do_sidebar($main_smarty, $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } if ($view == 'manageSettings') { $main_smarty = do_sidebar($main_smarty, $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } if ($view == 'manageSpamcomments') { $sql = "SELECT * FROM " . table_prefix . "spam_comments "; $link_data = $db->get_results($sql); if (sizeof($link_data)) { $user_cmt = new User(); $user_cmt_link = new Link(); $spam_output .= ' <form name="bulk_moderate" action="' . URL_akismet_isSpamcomment . '&action=bulkmod" method="post">'; $spam_output .= '<table class="table table-bordered table-striped">'; $spam_output .= "<thead>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Author</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Content</th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:65px;text-align:center;'><input type='checkbox' name='all1' onclick='mark_all_spam();' style='display:none;'><a onclick='mark_all_spam();' style='cursor:pointer;text-decoration:none;'>Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:80px;text-align:center;'><input type='checkbox' name='all2' onclick='mark_all_notspam();' style='display:none;'><a onclick='mark_all_notspam();' style='cursor:pointer;text-decoration:none;'>Not Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tbody>"; foreach ($link_data as $spam_cmts) { $user_cmt->id = $spam_cmts->userid; $user_cmt->read(); $user_name = $user_cmt->username; $user_cmt_link->id = $spam_cmts->linkid; $user_cmt_link->read(); $spam_output .= "<tr>"; $spam_output .= "\t<td>" . $user_name . "</td>"; $spam_output .= "\t<td><a href='story.php?id=" . ($user_cmt_link->id = $spam_cmts->linkid . "'>" . save_text_to_html($spam_cmts->cmt_content) . "</a></td>"); $spam_output .= ' <td style="text-align:center;"><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="spamcomment"></td>'; $spam_output .= ' <td style="text-align:center;"><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="notspamcomment"></td>'; $spam_output .= "</tr>"; } $spam_output .= "</tbody></table>"; $spam_output .= '<p align="right" style="margin-top:10px;"><input type="submit" name="submit" value="Apply Changes" class="btn btn-default" /></p>'; $spam_output .= "</form>"; $main_smarty->assign('spam_output', $spam_output); $main_smarty->assign('link_data', object_2_array($link_data)); } else { header("Location: " . my_pligg_base . "/admin/admin_index.php"); // header('Location: ' . URL_akismet); die; } $main_smarty = do_sidebar($main_smarty, $navwhere); $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel')); $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpamcomments'); $main_smarty->display($template_dir . '/admin/admin.tpl'); } if (phpnum() >= 5) { include_once akismet_lib_path . 'Akismet.class_5.php'; } else { include_once akismet_lib_path . 'Akismet.class_4.php'; } if ($view == 'isSpam') { if ($_GET['action'] == "bulkmod") { if (isset($_POST['submit'])) { $spam = array(); foreach ($_POST["spam"] as $k => $v) { $spam[intval($k)] = $v; } foreach ($spam as $key => $value) { if (isset($key)) { $link_id = sanitize($key, 3); } else { continue; } $link = new Link(); $link->id = $link_id; $link->read(); $user = new User(); $user->id = $link->author; $user->read(); if (phpnum() < 5) { $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $link->content, 'permalink' => my_base_url . getmyurl('story', $link->id)); $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment); } else { $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key')); $akismet->setCommentAuthor($user->username); $akismet->setCommentAuthorEmail($user->email); $akismet->setCommentAuthorURL($link->url); $akismet->setCommentContent($link->content); $akismet->setPermalink(my_base_url . getmyurl('story', $link->id)); } if ($value == "spam") { $link->status = 'spam'; $link->store(); killspam($user->id); $akismet->submitSpam(); } elseif ($value == "notspam") { $link->status = 'new'; $link->store(); $akismet->submitHam(); } $db->query("DELETE FROM " . table_prefix . "spam_links WHERE linkid={$link_id}"); } } } header('Location: ' . URL_akismet . '&view=manageSpam'); die; } if ($view == 'isSpamcomment') { if ($_GET['action'] == "bulkmod") { if (isset($_POST['submit'])) { $spamcomment = array(); foreach ($_POST["spamcomment"] as $k => $v) { $spamcomment[intval($k)] = $v; } foreach ($spamcomment as $key => $value) { if (isset($key)) { $link_id = sanitize($key, 3); } else { continue; } $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id; $result = $db->get_row($sql_result); #print_r($result); $link = new Link(); $link->id = $result->linkid; $link->read(); $user = new User(); $user->id = $result->userid; $user->read(); #print_r($user); if (phpnum() < 5) { $comment = array('author' => $user->username, 'email' => $user->email, 'website' => $link->url, 'body' => $result->cmt_content, 'permalink' => my_base_url . getmyurl('story', $link->id)); $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key'), $comment); } else { $akismet = new Akismet(my_base_url . my_pligg_base, get_misc_data('wordpress_key')); $akismet->setCommentAuthor($user->username); $akismet->setCommentAuthorEmail($user->email); $akismet->setCommentAuthorURL($link->url); $akismet->setCommentContent($result->cmt_content); $akismet->setPermalink(my_base_url . getmyurl('story', $link->id)); } if ($value == "spamcomment") { $akismet->submitSpam(); } elseif ($value == "notspamcomment") { $akismet->submitHam(); $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id , comment_date, comment_randkey, comment_content) VALUES ('{$result->cmt_parent}', '{$result->userid}', '{$result->linkid}', now(), '{$result->cmt_rand}', '{$result->cmt_content}')"; $db->query($sql); #print $sql; } $link->adjust_comment(1); $link->store(); $db->query(' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id); } } header('Location: ' . URL_akismet . '&view=manageSpamcomments'); die; } } } else { header("Location: " . getmyurl('login', $_SERVER['REQUEST_URI'])); die; } }
// the GPL version 2. see: http://www.pivotlog.net/help/help_about_gpl.php // for more information. // // --------------------------------------------------------------------------- // First line defense. if (file_exists(dirname(__FILE__) . "/first_defense.php")) { include_once dirname(__FILE__) . "/first_defense.php"; block_refererspam(); block_postedspam(); } include_once "pv_core.php"; include_once "modules/module_userreg.php"; // convert encoding to UTF-8 i18n_array_to_utf8($Pivot_Vars, $dummy_variable); // Using our integrated Spam Killer killspam(); $message = ""; // Check if the spam-key is set, but only for comments. Not for 'votes' and 'karma' if (isset($Pivot_Vars['piv_comment']) && !isset($Pivot_Vars['piv_spkey'])) { echo "Spam is not appreciated."; logspammer($Pivot_Vars['piv_comment'], "sskc"); die; } else { if (isset($Pivot_Vars['piv_comment']) && $Pivot_Vars['piv_spkey'] != md5($Cfg['server_spam_key'] . $Pivot_Vars['piv_code'])) { echo "Spam is not appreciated."; logspammer($Pivot_Vars['piv_comment'], "sskc"); die; } } add_hook("sumbit", "pre"); /**