function do_submit3() { global $db; $linkres = new Link(); $linkres->id = sanitize($_POST['id'], 3); if (!is_numeric($linkres->id)) { die; } if (!Submit_Complete_Step2 && $_SESSION['step'] != 2) { die('Wrong step'); } $linkres->read(); totals_adjust_count($linkres->status, -1); totals_adjust_count('queued', 1); $linkres->status = 'queued'; $vars = array('linkres' => &$linkres); check_actions('do_submit3', $vars); if ($vars['linkres']->status == 'discard') { $vars = array('link_id' => $linkres->id); check_actions('story_discard', $vars); } elseif ($vars['linkres']->status == 'spam') { $vars = array('link_id' => $linkres->id); check_actions('story_spam', $vars); } $linkres->store_basic(); $linkres->check_should_publish(); if (isset($_POST['trackback']) && sanitize($_POST['trackback'], 3) != '') { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = sanitize($_POST['trackback'], 3); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } $vars = array('linkres' => $linkres); check_actions('submit_pre_redirect', $vars); if ($vars['redirect']) { header('Location: ' . $vars['redirect']); } elseif ($linkres->link_group_id == 0) { header("Location: " . getmyurl('upcoming')); } else { $redirect = getmyurl("group_story", $linkres->link_group_id); header("Location: {$redirect}"); } die; }
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}"); }
function killspam($id) { global $db; require_once mnminclude . 'link.php'; require_once mnminclude . 'votes.php'; require_once mnminclude . 'tags.php'; $user = $db->get_row('SELECT * FROM ' . table_users . " where user_id={$id}"); if (!$user->user_id) { return; } canIChangeUser($user->user_level); $db->query('UPDATE `' . table_users . "` SET user_enabled=0, `user_pass` = '63205e60098a9758101eeff9df0912ccaaca6fca3e50cdce3', user_level = 'Spammer' WHERE `user_id` = {$id}"); $results = $db->get_results($sql = "SELECT comment_id, comment_link_id FROM `" . table_comments . "` WHERE `comment_user_id` = {$id}"); if ($results) { foreach ($results as $result) { $db->query($sql = 'UPDATE `' . table_comments . '` SET `comment_status` = "spam" WHERE `comment_id` = "' . $result->comment_id . '"'); $vars = array('comment_id' => $result->comment_id); check_actions('comment_spam', $vars); $link = new Link(); $link->id = $result->comment_link_id; $link->read(); $link->recalc_comments(); $link->store(); } } ban_ip($user->user_ip, $user->user_lastip); $results = $db->get_results("SELECT * FROM `" . table_groups . "` WHERE group_creator = '{$id}'"); if ($results) { foreach ($results as $result) { $db->query('DELETE FROM `' . table_group_member . '` WHERE member_group_id = ' . $result->group_id); $db->query('DELETE FROM `' . table_group_shared . '` WHERE share_group_id = ' . $result->group_id); } } $db->query("DELETE FROM `" . table_groups . "` WHERE group_creator = '{$id}'"); $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"); } elseif (Voting_Method == 3) { $link->votes = $vote->count(); $link->karma = $vote->karma(); $link->reports = $link->count_all_votes("<0"); } $link->store_basic(); $link->check_should_publish(); } } $results = $db->get_results($sql = "SELECT link_id, link_url FROM `" . table_links . "` WHERE `link_author` = {$id}"); global $USER_SPAM_RULESET, $FRIENDLY_DOMAINS; $filename = mnmpath . $USER_SPAM_RULESET; $lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $approved = file(mnmpath . $FRIENDLY_DOMAINS, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if ($results) { foreach ($results as $result) { if (preg_match('/:\\/\\/(www\\.)?([^\\/]+)(\\/|$)/', $result->link_url, $m)) { $domain = strtoupper($m[2]) . "\n"; if (!in_array($domain, $lines) && !in_array($domain, $approved)) { $lines[] = $domain; $changed = 1; } } $vars = array('link_id' => $result->link_id); check_actions('story_spam', $vars); } } if ($changed) { if (is_writable($filename)) { if ($handle = fopen($filename, 'w')) { fwrite($handle, join("\n", $lines)); fclose($handle); } } } $db->query($sql = 'UPDATE `' . table_links . '` SET `link_status` = "spam" WHERE `link_author` = "' . $id . '"'); $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}"); }
function do_the_import_stuff($feed) { global $db, $dblang, $RSSImport; $RSSImport = new RSSImport(); $added_one = false; $url = $feed->feed_url; $rss = fetch_rss($url); if ($_GET['override'] == $feed->feed_id) { $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if (!$canIhaveAccess == 1) { die('You are not authorized to override.'); } } $MyArray = array(); $Feed_Links = $RSSImport->get_feed_field_links($feed->feed_id); if (count($Feed_Links) > 0) { foreach ($Feed_Links as $link) { if ($link->pligg_field == 'link_title') { $MyArray['title'] = $link->feed_field; } if ($link->pligg_field == 'link_content') { $MyArray['content'] = $link->feed_field; } if ($link->pligg_field == 'link_url') { $MyArray['link_url'] = $link->feed_field; } if ($link->pligg_field == 'link_tags') { $MyArray['link_tags'] = $link->feed_field; } if ($link->pligg_field == 'link_field1') { $MyArray['link_field1'] = $link->feed_field; } if ($link->pligg_field == 'link_field2') { $MyArray['link_field2'] = $link->feed_field; } if ($link->pligg_field == 'link_field3') { $MyArray['link_field3'] = $link->feed_field; } if ($link->pligg_field == 'link_field4') { $MyArray['link_field4'] = $link->feed_field; } if ($link->pligg_field == 'link_field5') { $MyArray['link_field5'] = $link->feed_field; } if ($link->pligg_field == 'link_field6') { $MyArray['link_field6'] = $link->feed_field; } if ($link->pligg_field == 'link_field7') { $MyArray['link_field7'] = $link->feed_field; } if ($link->pligg_field == 'link_field8') { $MyArray['link_field8'] = $link->feed_field; } if ($link->pligg_field == 'link_field9') { $MyArray['link_field9'] = $link->feed_field; } if ($link->pligg_field == 'link_field10') { $MyArray['link_field10'] = $link->feed_field; } if ($link->pligg_field == 'link_field11') { $MyArray['link_field11'] = $link->feed_field; } if ($link->pligg_field == 'link_field12') { $MyArray['link_field12'] = $link->feed_field; } if ($link->pligg_field == 'link_field13') { $MyArray['link_field13'] = $link->feed_field; } if ($link->pligg_field == 'link_field14') { $MyArray['link_field14'] = $link->feed_field; } if ($link->pligg_field == 'link_field15') { $MyArray['link_field15'] = $link->feed_field; } } $thecount = 0; if ($feed->feed_last_item_first == 0) { $the_items = array_reverse($rss->items); } else { $the_items = $rss->items; } foreach ($the_items as $item) { echo "<strong>Title: " . get_val($item, $MyArray['title']) . "</strong><br/>"; echo "<strong>Content:</strong> " . strip_tags(substr(get_val($item, $MyArray['content']), 0, 256)) . "...<br>"; echo "<strong>URL:</strong> " . get_val($item, $MyArray['link_url']) . "<br/>"; $skipthis = 0; $linkres = new Link(); $linkres->randkey = rand(10000, 10000000); $linkres->status = $feed->feed_status; $linkres->author = $feed->feed_submitter; $linkres->title = get_val($item, $MyArray['title']); $linkres->title = strip_tags($linkres->title); $linkres->tags = get_val($item, $MyArray['link_tags']); // MJE: MOD to include title words as tags ---------------------------- if (trim($linkres->tags) == '') { $temp1 = strtolower($linkres->title); $stopwords = file(mnmpath . '/modules/rss_import/templates/stopwords.txt'); for ($zz = 0; $zz < count($stopwords); $zz++) { $pos = strpos($temp1, $stopwords[$zz] . ' '); if ($pos !== false && $pos == 0) { $temp1 = str_replace(trim($stopwords[$zz]) . ' ', ' ', $temp1); } $temp1 = str_replace(' ' . trim($stopwords[$zz]) . ' ', ' ', $temp1); } $pos = strpos($temp1, ' '); while ($pos !== false) { $temp1 = str_replace(' ', ' ', $temp1); $pos = strpos($temp1, ' '); } $temp1 = str_replace(' ', ", ", $temp1); // $out = ereg_replace("[^[:alpha:]]", "", $in); // strip all except letters and spaces and commas $linkres->tags = preg_replace('/[^a-z A-Z,]+/i', '', $temp1); } //---------------------------------------------------------------------- if (checklevel('god')) { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_God; } elseif (checklevel('admin')) { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Admin; } else { $Story_Content_Tags_To_Allow = Story_Content_Tags_To_Allow_Normal; } $linkres->title_url = makeUrlFriendly($linkres->title); $linkres->url = get_val($item, $MyArray['link_url']); $linkres->url_title = $linkres->title; $linkres->content = get_val($item, $MyArray['content']); $linkres->content = strip_tags($linkres->content, $Story_Content_Tags_To_Allow); $linkres->content = str_replace("\n", "<br />", $linkres->content); $linkres->link_field1 = get_val($item, $MyArray['link_field1']); $linkres->link_field2 = get_val($item, $MyArray['link_field2']); $linkres->link_field3 = get_val($item, $MyArray['link_field3']); $linkres->link_field4 = get_val($item, $MyArray['link_field4']); $linkres->link_field5 = get_val($item, $MyArray['link_field5']); $linkres->link_field6 = get_val($item, $MyArray['link_field6']); $linkres->link_field7 = get_val($item, $MyArray['link_field7']); $linkres->link_field8 = get_val($item, $MyArray['link_field8']); $linkres->link_field9 = get_val($item, $MyArray['link_field9']); $linkres->link_field10 = get_val($item, $MyArray['link_field10']); $linkres->link_field11 = get_val($item, $MyArray['link_field11']); $linkres->link_field12 = get_val($item, $MyArray['link_field12']); $linkres->link_field13 = get_val($item, $MyArray['link_field13']); $linkres->link_field14 = get_val($item, $MyArray['link_field14']); $linkres->link_field15 = get_val($item, $MyArray['link_field15']); $linkres->category = $feed->feed_category; //MJE: MOD $linkres->link_summary = utf8_substr(strip_tags($linkres->content), 0, StorySummary_ContentTruncate - 1); //--------- if ($thecount >= $feed->feed_item_limit && $skipthis == 0) { echo "Reached import limit, skipping<HR>"; $skipthis = 1; } if ($feed->feed_title_dupe == 0 && $skipthis == 0) { // 0 means don't allow, 1 means allow if ($linkres->duplicates_title($linkres->title) > 0) { //echo "Title Match, skipping: " . $linkres->title . "<HR>"; echo '<span style="color:#fc0000;">Title Match, skipping</span> <hr>'; $skipthis = 1; } } if ($feed->feed_url_dupe == 0 && $linkres->url != "" && $skipthis == 0) { // 0 means don't allow, 1 means allow if ($linkres->duplicates($linkres->url) > 0) { //echo "URL Match, skipping: " . $linkres->title . "<HR>"; echo '<span style="color:#fc0000;">URL Match, skipping</span> <hr>'; $skipthis = 1; } } if ($skipthis == 0) { echo "Importing <hr>"; $added_one = true; $linkres->store(); totals_adjust_count($linkres->status, 1); tags_insert_string($linkres->id, $dblang, $linkres->tags); require_once mnminclude . 'votes.php'; if ($feed->feed_random_vote_enable == 1) { $feed->feed_votes = rand($feed->feed_random_vote_min, $feed->feed_random_vote_max); } $votes = 0; for ($i = 1; $i <= $feed->feed_votes; $i++) { $value = 1; $vote = new Vote(); $vote->type = 'links'; $vote->user = 0; $vote->link = $linkres->id; $vote->ip = '0.0.0.' . $i; $vote->value = $value; $vote->insert(); $vote = ""; $votes += $value; // $vote = new Vote; // $vote->type='links'; // $vote->link=$linkres->id; } $linkres->votes = $votes; $linkres->store_basic(); $linkres->check_should_publish(); $thecount = $thecount + 1; } } $sql = "UPDATE `" . table_feeds . "` SET `feed_last_check` = FROM_UNIXTIME(" . (time() - 300) . ") WHERE `feed_id` = {$feed->feed_id};"; //echo $sql; $db->query($sql); } else { echo "Feed not fully setup, skipping <hr>"; } if ($added_one) { return true; } else { return false; } }
for ($i = 1; $i <= $feed->feed_votes; $i++) { $value = 10; $vote = new Vote(); $vote->type = 'links'; $vote->user = 0; $vote->link = $linkres->id; $vote->ip = '0.0.0.' . $i; $vote->value = $value; $vote->insert(); $vote = ""; $vote = new Vote(); $vote->type = 'links'; $vote->link = $linkres->id; $linkres->votes = $vote->count(); $linkres->store_basic(); $linkres->check_should_publish(); } $thecount = $thecount + 1; } } $sql = "Update `" . table_prefix . "feeds` set `feed_last_check` = FROM_UNIXTIME(" . (time() - 300) . ") where `feed_id` = {$feed->feed_id};"; //echo $sql; $db->query($sql); } else { echo "Feed not fully setup, skipping <hr>"; } } else { echo "Feed Frequency is " . $feed->feed_freq_hours . ".<br>"; $x = strtotime($feed->feed_last_check); $y = time() - $feed->feed_freq_hours * 3600; echo "Next run in " . intval(($x - $y) / 60 / 60 * 100) / 100 . " hours.";
function do_submit3() { global $db; $linkres = new Link(); $linkres->id = sanitize($_POST['id'], 3); if (!is_numeric($linkres->id)) { die; } $linkres->read(); totals_adjust_count($linkres->status, -1); totals_adjust_count('queued', 1); $linkres->status = 'queued'; $vars = array('linkres' => $linkres); check_actions('do_submit3', $vars); $linkres->store_basic(); $linkres->check_should_publish(); if (isset($_POST['trackback']) && sanitize($_POST['trackback'], 3) != '') { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = sanitize($_POST['trackback'], 3); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } if ($linkres->link_group_id == 0) { header("Location: " . getmyurl('upcoming')); die; } else { $redirect = getmyurl("group_story", $linkres->link_group_id); header("Location: {$redirect}"); die; } }
function do_submit3() { global $db; $linkres = new Link(); $linkres->id = $link_id = strip_tags($_POST['id']); $linkres->read(); //if (link_errors($linkres)) { // echo '<form id="thisform">'; // echo '<input type=button onclick="window.history.go(-2)" value="'._(PLIGG_Visual_Submit_Step3_Modify).'">'; // return; //} $linkres->status = 'queued'; $linkres->store_basic(); $linkres->check_should_publish(); if (!empty($_POST['trackback'])) { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = trim($_POST['trackback']); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send(); } header("Location: " . getmyurl('upcoming')); die; }