本文整理汇总了PHP中Link::recalc_comments方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::recalc_comments方法的具体用法?PHP Link::recalc_comments怎么用?PHP Link::recalc_comments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::recalc_comments方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_comment
function delete_comment($key)
{
global $db;
if (!is_numeric($key)) {
return;
}
$link_id = $db->get_var("SELECT comment_link_id FROM `" . table_comments . "` WHERE `comment_id` = " . $key . ";");
$vars = array('comment_id' => $key);
check_actions('comment_deleted', $vars);
$comments = $db->get_results($sql = "SELECT comment_id FROM " . table_comments . " WHERE `comment_parent` = '{$key}'");
foreach ($comments as $comment) {
$vars = array('comment_id' => $comment->comment_id);
check_actions('comment_deleted', $vars);
}
$db->query('DELETE FROM `' . table_comments . '` WHERE `comment_parent` = "' . $key . '"');
$db->query('DELETE FROM `' . table_comments . '` WHERE `comment_id` = "' . $key . '"');
$link = new Link();
$link->id = $link_id;
$link->read();
$link->recalc_comments();
$link->store();
}
示例2: header
header('Location: ' . $my_pligg_base . '/' . $redirectUrl);
}
}
if (isset($_REQUEST['comment_id'])) {
global $db;
$comment_id = $_REQUEST['comment_id'];
if (!is_numeric($comment_id)) {
die;
}
$link_id = $db->get_var("SELECT comment_link_id FROM `" . table_comments . "` WHERE `comment_id` = {$comment_id}");
$vars = array('comment_id' => $comment_id);
check_actions('comment_deleted', $vars);
$db->query('DELETE FROM `' . table_comments . '` WHERE `comment_id` = "' . $comment_id . '"');
$comments = $db->get_results($sql = "SELECT comment_id FROM " . table_comments . " WHERE `comment_parent` = '{$comment_id}'");
foreach ($comments as $comment) {
$vars = array('comment_id' => $comment->comment_id);
check_actions('comment_deleted', $vars);
}
$db->query('DELETE FROM `' . table_comments . '` WHERE `comment_parent` = "' . $comment_id . '"');
$link = new Link();
$link->id = $link_id;
$link->read();
$link->recalc_comments();
$link->store();
$link = '';
if ($_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], $my_base_url . $my_pligg_base) === 0) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
} else {
header('Location: ' . $my_base_url . $my_pligg_base);
}
}
示例3: Vote
function insert_vote($user = 0, $value = 10)
{
global $anon_karma;
require_once mnminclude . 'votes.php';
if (!is_numeric($this->id)) {
return false;
}
$vote = new Vote();
$vote->type = 'comments';
$vote->user = $user;
$vote->link = $this->id;
$vote->value = $value;
if ($vote->insert()) {
$vote = new Vote();
$vote->type = 'comments';
$vote->link = $this->id;
$this->votes = $vote->count() - $vote->count('<0');
if (comment_buries_spam > 0 && $vote->count_all("<0") >= comment_buries_spam) {
$this->status = 'discard';
$this->store();
$vars = array('comment_id' => $this->id);
check_actions('comment_spam', $vars);
require_once mnminclude . 'link.php';
$link = new Link();
$link->id = $this->link;
$link->read();
$link->recalc_comments();
$link->store();
}
$vars = array('vote' => $this);
check_actions('comment_insert_vote_post', $vars);
return $vote->sum();
}
return false;
}
示例4: spam_trigger_killspam
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}");
}
示例5: killspam
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}");
}