function status_comment_submit($vars) { global $db, $main_smarty; if (get_misc_data('status_switch') != '1') { return; } $comment = $vars['comment']; if (!$comment->id) { return; } $user = new User(); $user->id = $comment->author; $linkres = new Link(); $linkres->id = $comment->link; if ($user->read() && $linkres->read()) { if (!status_is_allowed($user) || !$user->extra_field['status_switch'] || !$user->extra_field['status_comment']) { return; } $main_smarty->config_load(status_lang_conf); $text = $main_smarty->get_config_vars('PLIGG_Status_Comment_Update'); $limit = get_misc_data('status_max_chars'); if ($limit > 0 && strlen($text) + strlen($user->username) + strlen($linkres->title) - 4 > $limit) { $linkres->title = substr($linkres->title, 0, max($limit + 4 - strlen($text) - strlen($user->username) - 3, 10)) . '...'; } $text = sprintf($text, $user->username, '<a href="' . $linkres->get_internal_url() . '">' . $linkres->title . '</a>'); $db->query($sql = "INSERT INTO " . table_prefix . "updates SET update_time=UNIX_TIMESTAMP(), \r\n\t\t\t\t\t\t\t update_type='c',\r\n\t\t\t\t\t\t\t update_user_id='{$comment->author}',\r\n\t\t\t\t\t\t\t update_link_id='{$comment->id}',\r\n\t\t\t\t\t\t\t update_text='{$text}'\r\n\t\t\t\t\t\t\t "); } }
function related_stories($storyid, $related_tags, $category) { // this returns similar stories based on tags in common and in the same category global $db; if (!is_numeric($storyid)) { die; } $related_tags = "'" . preg_replace('/,\\s*/', "','", addslashes($related_tags)) . "'"; // This gives us the proper string structure for IN SQL statement // Select 20 stories that share tags with the current story and order them by number of tags they share $sql = "SELECT tag_link_id, COUNT(tag_link_id) AS relevance\n\t\t\tFROM " . table_tags . "\n\t\t\tWHERE tag_words IN ({$related_tags}) AND tag_link_id!={$storyid}\n\t\t\tGROUP BY tag_link_id \n\t\t\tORDER BY relevance DESC \n\t\t\tLIMIT 20"; $related_story = $db->get_results($sql); $related_story = object_2_array($related_story); $stories = array(); foreach ($related_story as $id => $rs) { $rs2 = new Link(); $rs2->id = $rs['tag_link_id']; if ($rs2->read() && ($rs2->status == 'new' || $rs2->status == 'published')) { $related_story[$id] = array_merge($related_story[$id], array('link_id' => $rs2->id, 'link_category' => $rs2->category, 'link_title' => $rs2->title, 'link_title_url' => $rs2->title_url)); if ($rs2->title_url == "") { $related_story[$id]['url'] = getmyurl("story", $rs2->id); } else { $related_story[$id]['url'] = getmyurl("storyURL", $rs2->category_safe_names(), urlencode($rs2->title_url), $rs2->id); } $stories[] = $related_story[$id]; } } return $stories; }
function store() { // save the comment to the database global $db, $current_user, $the_template; if (!$this->date) { $this->date = time(); } $comment_id = $this->id; if (!is_numeric($comment_id)) { return false; } $comment_author = $this->author; $comment_link = $this->link; $comment_karma = $this->karma; $comment_date = $this->date; $comment_randkey = $this->randkey; $comment_content = $db->escape($this->content); $comment_votes = $this->votes; $comment_parent = $this->parent; if ($this->id === 0) { $this->canSave = true; // assume we can save $vars = array('comment' => &$this); check_actions('comment_save', $vars); if ($this->canSave == true) { // if this is a new comment $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id, comment_karma, comment_date, comment_randkey, comment_content) VALUES ({$comment_parent}, {$comment_author}, {$comment_link}, {$comment_karma}, FROM_UNIXTIME({$comment_date}), {$comment_randkey}, '{$comment_content}')"; $db->query($sql); $this->id = $db->insert_id; $link = new Link(); $link->id = $this->link; $link->read(); $link->adjust_comment(1); $link->store(); $link = ''; $vars = array('comment' => &$this); check_actions('comment_post_save', $vars); } } else { // if we're editing an existing comment $sql = "UPDATE " . table_comments . " set comment_votes={$comment_votes}, comment_user_id={$comment_author}, comment_link_id={$comment_link}, comment_karma={$comment_karma}, comment_date=FROM_UNIXTIME({$comment_date}), comment_randkey={$comment_randkey}, comment_content='{$comment_content}' WHERE comment_id={$comment_id}"; $db->query($sql); } $vars = array('comment' => $this); check_actions('comment_store_post_sql', $vars); }
function do_link_item($sql) { global $db; $link = new Link(); $links = $db->get_col($sql); if ($links) { foreach ($links as $link_id) { $link->id = $link_id; $link->read(); if ($_REQUEST['url'] == 'source') { $url = __($link->url); } else { $url = $link->get_permalink(); } echo '<DT><A HREF="' . $url . '" REL="nofollow">' . $link->title . '</A>' . "\n"; } } }
function insert_anonymous_comment(&$vars) { global $db; $link_id = $vars['link_id']; $user_id = $vars['user_id']; $randkey = $vars['randkey']; $comment_content = $vars['comment_content']; $a_username = $vars['a_username']; $a_email = $vars['a_email']; $a_website = $vars['a_website']; $sql = "INSERT INTO " . table_comments . " (comment_user_id, comment_link_id, comment_date, comment_randkey, comment_content,`comment_anonymous_username`, `comment_anonymous_email`, `comment_anonymous_website` ) VALUES ({$user_id}, {$link_id}, NOW(), {$randkey}, '{$comment_content}', '{$a_username}','{$a_email}', '{$a_website}')"; $result = $db->query($sql); // DB 12/17/08 $link = new Link(); $link->id = $link_id; $link->read(); $link->adjust_comment(1); $link->store(); ///// }
function show() { global $main_smarty, $db; include_once mnminclude . 'search.php'; $search = new Search(); $search->orderBy = $this->orderBy; $search->pagesize = $this->pagesize; $search->filterToStatus = $this->filterToStatus; $search->filterToTimeFrame = $this->filterToTimeFrame; $search->doSearch(); $linksum_sql = $search->sql; $link = new Link(); $links = $db->get_col($linksum_sql); if ($links) { foreach ($links as $link_id) { $link->id = $link_id; $link->read(); $main_smarty = $link->fill_smarty($main_smarty); $main_smarty->display($this->template); } } }
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(); }
function print_summary($link = 0, $length = 0, $single_link = true) { global $current_user, $globals; if (!$this->read) { return; } if (!$link && $this->link > 0) { $link = new Link(); $link->id = $this->link; $link->read(); $this->link_object = $link; } $this->link_permalink = $link->get_relative_permalink(); $this->check_visibility(); if ($this->hidden) { $comment_meta_class = 'comment-meta-hidden'; $comment_class = 'comment-body-hidden'; } else { $comment_meta_class = 'comment-meta'; $comment_class = 'comment-body'; if ($this->karma > $globals['comment_highlight_karma']) { $comment_class .= ' high'; } } $this->truncate($length); $this->txt_content = $this->to_html($this->content); if ($this->type == 'admin') { $author = '<strong>' . _('admin') . '</strong> '; } else { $author = '<a href="' . get_user_uri($this->username) . '" title="karma: ' . $this->user_karma . '">' . $this->username . '</a> '; } if ($this->media_size > 0) { $this->media_thumb_dir = Upload::get_cache_relative_dir($this->id); } $vars = compact('comment_meta_class', 'comment_class', 'author'); $vars['self'] = $this; return Haanga::Load('mobile/comment_summary.html', $vars); }
function group_shared($requestID, $catId, $flag = 0) { global $db, $main_smarty, $the_template, $page_size, $cached_links; if (!is_numeric($requestID)) { die; } $link = new Link(); $group_shared_display = ""; if ($catId) { $child_cats = ''; // do we also search the subcategories? if (Independent_Subcategories == true) { $child_array = ''; // get a list of all children and put them in $child_array. children_id_to_array($child_array, table_categories, $catId); if ($child_array != '') { // build the sql foreach ($child_array as $child_cat_id) { $child_cat_sql .= ' OR `link_category` = ' . $child_cat_id . ' '; if (Multiple_Categories) { $child_cat_sql .= ' OR ac_cat_id = ' . $child_cat_id . ' '; } } } } if (Multiple_Categories) { $child_cat_sql .= " OR ac_cat_id = {$catId} "; } $from_where .= " AND (link_category={$catId} " . $child_cat_sql . ")"; } $offset = (get_current_page() - 1) * $page_size; if ($flag == 1) { $sql = "SELECT SQL_CALC_FOUND_ROWS b.* FROM " . table_group_shared . " a\r\n\t\t\t\t LEFT JOIN " . table_links . " b ON link_id=share_link_id\r\n\t\t\t\t WHERE share_group_id = {$requestID} AND !ISNULL(link_id) {$from_where} \r\n\t\t\t\t GROUP BY link_id\r\n\t\t\t\t ORDER BY link_published_date DESC, link_date DESC "; } else { $sql = "SELECT SQL_CALC_FOUND_ROWS b.* FROM " . table_group_shared . " a\r\n\t\t\t\t LEFT JOIN " . table_links . " b ON link_id=share_link_id\r\n\t\t\t\t WHERE share_group_id = {$requestID} AND !ISNULL(link_id) {$from_where} \r\n\t\t\t\t GROUP BY link_id\r\n\t\t\t\t ORDER BY link_published_date DESC, link_date DESC LIMIT {$offset}, {$page_size}"; } // Search on additional categories if ($catId && Multiple_Categories) { $sql = str_replace("WHERE", " LEFT JOIN " . table_additional_categories . " ON ac_link_id=link_id WHERE", $sql); } $links = $db->get_results($sql); $rows = $db->get_var("SELECT FOUND_ROWS()"); if ($flag == 1) { return $rows; } if ($links) { foreach ($links as $dblink) { $link->id = $dblink->link_id; $cached_links[$dblink->link_id] = $dblink; $link->read(); $group_shared_display .= $link->print_summary('summary', true); } } $main_smarty->assign('group_shared_display', $group_shared_display); //for auto scrolling if (Auto_scroll == 2 || Auto_scroll == 3) { $main_smarty->assign("scrollpageSize", $page_size); $main_smarty->assign('total_row', $rows); if ($catId) { $main_smarty->assign('catID', $catId); } $main_smarty->assign('total_row', $rows); } else { $main_smarty->assign('group_story_pagination', do_pages($rows, $page_size, 'group_story', true)); } }
die; } $tb_url = $_POST['url']; $title = $_POST['title']; $excerpt = $_POST['excerpt']; $blog_name = $_POST['blog_name']; $charset = $_POST['charset']; if (!empty($charset)) { $title = @iconv($charset, 'UTF-8//IGNORE', $title); $excerpt = @iconv($charset, 'UTF-8//IGNORE', $excerpt); $blog_name = @iconv($charset, 'UTF-8//IGNORE', $blog_name); } $tb_id = intval($_GET['id']); $link = new Link(); $link->id = $tb_id; if (!$tb_id > 0 || !$link->read()) { trackback_response(1, 'I really need an ID for this to work.'); } if (empty($title) && empty($tb_url) && empty($blog_name)) { // If it doesn't look like a trackback at all... header('Location: ' . $link->get_permalink()); exit; } if (!empty($tb_url) && !empty($title) && !empty($excerpt)) { header('Content-Type: text/xml; charset=UTF-8'); $title = htmlspecialchars(strip_tags($title)); $title = strlen($title) > 150 ? substr($title, 0, 150) . '...' : $title; $excerpt = strip_tags($excerpt); $excerpt = strlen($excerpt) > 200 ? substr($excerpt, 0, 200) . '...' : $excerpt; $trackres = new Trackback(); $trackres->link = $tb_id;
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; }
function do_best_queued() { global $db, $globals, $dblang; if ($globals['mobile']) { return; } $foo_link = new Link(); $key = 'best_queued_' . $globals['css_main'] . '_' . $globals['meta_current']; if (memcache_mprint($key)) { return; } if ($globals['meta_current'] && $globals['meta_categories']) { $category_list = 'and link_category in (' . $globals['meta_categories'] . ')'; $title = sprintf(_('candidatas en «%s»'), $globals['meta_current_name']); } else { $category_list = ''; $title = _('candidatas'); } $output = '<div class="sidebox"><div class="header"><h4><a href="' . $globals['base_url'] . 'promote.php">' . $title . '</a></h4></div>'; $min_date = date("Y-m-d H:i:00", $globals['now'] - 86400 * 4); // 4 days // The order is not exactly the votes // but a time-decreasing function applied to the number of votes $res = $db->get_results("select link_id from links where link_status='queued' and link_date > '{$min_date}' {$category_list} order by link_karma desc limit 15"); if ($res) { $link = new Link(); foreach ($res as $l) { $output .= '<div class="cell">'; $link->id = $l->link_id; $link->read(); $url = $link->get_relative_permalink(); $output .= '<div class="votes queued">' . ($link->votes + $link->anonymous) . '</div>'; if ($link->negatives >= $link->votes / 10) { // add the warn icon if it has 10% negatives $warn = 'style="padding-left:20px;background: url(../../img/common/error_s.png) no-repeat left center"'; } else { $warn = ''; // Show the thumbnail only if it has less than 10% negatives if ($thumb = $link->has_thumb()) { $link->thumb_x = round($link->thumb_x / 2); $link->thumb_y = round($link->thumb_y / 2); $output .= "<img src='{$thumb}' width='{$link->thumb_x}' height='{$link->thumb_y}' alt='' class='thumbnail'/>"; } } $output .= '<h5 ' . $warn . '><a href="' . $url . '">' . $link->title . '</a></h5>'; $output .= '</div>'; // class="cell"; } $output .= '</div>' . "\n"; echo $output; memcache_madd($key, $output, 180); } }
function print_summary($link = 0, $length = 0, $single_link=true, $no_padding = false) { global $current_user, $globals; if(!$this->read) return; if (! $link && $this->link > 0) { $link = new Link; $link->id = $this->link; $link->read(); $this->link_object = $link; } if ($single_link) $html_id = $this->order; else $html_id = $this->id; if ($this->nested_level == 1) $no_padding = true; if ($no_padding) { $padding = 0;//(int)$this->level * 30; } else { $padding = 33;//(int)$this->level * 30; } //echo '<div id="c-'.$html_id.'" class="'.(($this->nested_level>1)?'cmt':'cmt').'" style="margin-left:'.$padding.'px;" >'; echo '<style>'; echo ' div.cmt { border-width:0px 0px 0px 1px; border-style:dotted; border-color:#AADB7A; }'; echo '</style>'; echo '<div id="c-'.$html_id.'" class="'.(($this->nested_level>1)?'cmt':'').'" style="margin-left:'.$padding.'px;" >'; /* if ($this->type != 'admin' && $this->user_level != 'disabled') { // Print the votes info (left) if ($current_user->user_id > 0 && $this->author != $current_user->user_id && $single_link && $this->date > $globals['now'] - $globals['time_enabled_comments'] && $this->level != 'autodisabled') { */ $this->print_shake_icons(); /* } else { echo '<div style="float:left">'; echo '<span id="c-votes-'.$this->id.'">'; echo '<a href="javascript:menealo_comment('."$current_user->user_id,$this->id,1".')" title="'._('informativo, opinión razonada, buen humor...').'"><img src="'.$globals['base_static'].'img/common/vote-up02.png" width="18" height="16" alt="'._('voto positivo').'"/></a><br/>'; echo '<a href="javascript:menealo_comment('."$current_user->user_id,$this->id,-1".')" title="'._('abuso, insulto, acoso, spam, magufo...').'"><img style="padding-top:5px;" src="'.$globals['base_static'].'img/common/vote-down02.png" width="18" height="16" alt="'._('voto negativo').'"/></a> '; echo '</span>'; echo '</div>'; } } */ $this->ignored = ($current_user->user_id > 0 && $this->type != 'admin' && User::friend_exists($current_user->user_id, $this->author) < 0); $this->hidden = ($globals['comment_highlight_karma'] > 0 && $this->karma < -$globals['comment_highlight_karma']) || ($this->user_level == 'disabled' && $this->type != 'admin'); if ($this->hidden || $this->ignored) { $comment_meta_class = 'comment-meta-hidden'; $comment_class = 'comment-body-hidden'; } else { $comment_meta_class = 'comment-meta'; $comment_class = 'comment-body'; if ($this->type == 'admin') { $comment_class .= ' admin'; } elseif ($globals['comment_highlight_karma'] > 0 && $this->karma > $globals['comment_highlight_karma']) { $comment_class .= ' high'; } } $this->link_permalink = $link->get_relative_permalink(); /* $bgcolor = Array("R"=>hexdec("C5"),"G"=>hexdec("E7"),"B"=>hexdec("A4")); $n = $this->nested_level - 1; $bgcolor["R"] = min($bgcolor["R"] + (((255 - $bgcolor["R"]) / 5) * $n), 255); $bgcolor["G"] = min($bgcolor["G"] + (((255 - $bgcolor["G"]) / 5) * $n), 255); $bgcolor["B"] = min($bgcolor["B"] + (((255 - $bgcolor["B"]) / 5) * $n), 255); $bgcolor = dechex($bgcolor["R"]) . dechex($bgcolor["G"]) . dechex($bgcolor["B"]); */ $color_list = Array( '#C5E7A4', '#C4E6A2', '#A2E6A2', '#A2E6C4', '#A2E6E6', '#A2C4E6', '#A2A2E6', '#C4A2E6', '#E6A2E6', '#E6A2C4', '#E6A2A2', '#E6C4A2', '#E6E6A2', '#A6DA72', '#87CD42', '#A672DA', '#8742CD' ); $bgcolor = $color_list[$this->nested_level]; if (empty($bgcolor)) $bgcolor = end($color_list); //echo '<div class="'.$comment_class.'" style="margin-bottom:10px;padding-bottom:5px;background-color:'.$bgcolor.' !important;">'; echo '<div class="'.$comment_class.'" style="margin-bottom:10px;padding-bottom:5px;background-color:white;min-width:600px;">'; //echo '<a href="'.$this->link_permalink.'/000'.$this->order.'"><strong>#'.$this->order.'</strong></a>'; echo '<a href="#" class="f-'.$this->id.' fold" style="font-family:verdana;font-size:x-small;" ></strong>(-)</strong></a>'; //echo ' <span id="cid-'.$this->id.'">'; echo ' <span id="cid-'.$this->id.'">'; if ($this->ignored || ($this->hidden && ($current_user->user_comment_pref & 1) == 0)) { echo '» <a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-'.$this->id.'\',0,'.$this->id.')" title="'._('ver comentario').'">'._('ver comentario').'</a>'; echo '</span>'; } else { $this->print_text($length, $html_id); echo '</span>'; } //echo '</div>'; // The comments info bar echo '<div class="'.$comment_meta_class.' comment_mc" >'; // Check that the user can vote echo '<div class="comment-votes-info">'; echo '<a class="comment_vi" href="#c-'.$this->c_order.'" >#'.$this->c_order.'</a> '; if ($this->type != 'admin' && $this->user_level != 'disabled') { // Print the votes info (left) /* if ($current_user->user_id > 0 && $this->author != $current_user->user_id && $single_link && $this->date > $globals['now'] - $globals['time_enabled_comments'] && $this->level != 'autodisabled') { //$this->print_shake_icons(); } */ echo _('votos').': <span id="vc-'.$this->id.'">'.$this->votes.'</span>, '._('karma').': <span id="vk-'.$this->id.'">'.$this->karma.'</span> '; // Add the icon to show votes if ($this->votes > 0 && $this->date > $globals['now'] - 30*86400) { // Show votes if newer than 30 days echo '<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/get_c_v.php?id='.$this->id.'\')">'; echo '<img src="'.$globals['base_static'].'img/common/vote-info02.png" width="18" height="16" alt="+ info" title="'._('¿quién ha votado?').'"/>'; echo '</a>'; } } // Comment reply if ($current_user->user_id > 0 && $globals['link'] && $globals['link']->date > $globals['now'] - $globals['time_enabled_comments']) { echo '<a href="javascript:comment_reply('.$this->order.','.$this->id.')" title="'._('responder').'"><img src="'.$globals['base_static'].'img/common/reply02.png" width="18" height="16"/></a>'; } // Comment permalink echo '<a href="'.$this->get_relative_individual_permalink().'" title="permalink"><img class="link-icon" src="'.$globals['base_static'].'img/common/link-02.png" width="18" height="16" alt="link" title="'._('enlace permanente').'"/></a>'; // If the user is authenticated, show favorite box if ($current_user->user_id > 0) { echo '<a id="fav-'.$this->id.'" href="javascript:get_votes(\'get_favorite_comment.php\',\''.$current_user->user_id.'\',\'fav-'.$this->id.'\',0,\''.$this->id.'\')">'.favorite_teaser($current_user->user_id, $this, 'comment').'</a>'; } echo '</div>'; // Print comment info (right) echo '<div class="comment-info">'; if ($this->type == 'admin') { $author = '<strong>'._('admin').'</strong> '; if ($current_user->admin) { $author .= ' ('.$this->username.')'; } } elseif ($single_link) { $author = '<a href="'.get_user_uri($this->username).'" title="karma: '.$this->user_karma.'" id="cauthor-'.$this->order.'">'.$this->username.'</a>'; } else { $author = '<a href="'.get_user_uri($this->username).'" title="karma: '.$this->user_karma.'">'.$this->username.'</a>'; } // Print dates if ($this->modified > $this->date + 1) { $edited = sprintf('<strong title="'. _('editado %s después').'">* </strong>', txt_time_diff($this->date, $this->modified)); } else $edited = ''; if (!$this->hidden && $this->type != 'admin' && $this->avatar) { $avatar = get_avatar_url($this->author, $this->avatar, 20); } else { $avatar = get_no_avatar_url(20); } if ($globals['now'] - $this->date > 604800) { // 7 days printf(_('el %s %s por %s'), get_date_time($this->date), $edited, $author); } else { printf(_('fai %s %s por %s'), txt_time_diff($this->date), $edited, $author); } echo '<img src="'.$avatar.'" width="20" height="20" alt="" title="'.$this->username.', karma: '.$this->user_karma.'" />'; echo '</div>'; echo '</div></div>'; }
function do_submit3() { global $db, $current_user; $linkres=new Link; $linkres->id=$link_id = intval($_POST['id']); $linkres->read(); // Check it is not in the queue already if($linkres->votes == 0 && $linkres->status != 'queued') { $linkres->status='queued'; $linkres->date=time(); $linkres->store_basic(); $linkres->insert_vote($current_user->user_id); $db->query("delete from links where link_author = $linkres->author and link_status='discard' and link_votes=0"); if(!empty($_POST['trackback'])) { require_once(mnminclude.'trackback.php'); $trackres = new Trackback; $trackres->url=preg_replace('/ /', '+', trim($_POST['trackback'])); $trackres->link=$linkres->id; $trackres->title=$linkres->title; $trackres->author=$linkres->author; $trackres->content=$linkres->content; $res = $trackres->send(); } } header("Location: ./shakeit.php"); die; }
function do_shaken() { global $db, $rows, $user, $offset, $page_size, $globals; if ($globals['bot']) { return; } do_user_subheader(array(_('envíos propios') => get_user_uri($user->username, 'history'), _('votados') => get_user_uri($user->username, 'shaken'), _('favoritos') => get_user_uri($user->username, 'favorites'), _('votados por amigos') => get_user_uri($user->username, 'friends_shaken')), 1, 'rss2.php?voted_by=' . $user->id, _('votadas en rss2')); $link = new Link(); $rows = -1; //$db->get_var("SELECT count(*) FROM votes WHERE vote_type='links' and vote_user_id=$user->id"); $links = $db->get_results("SELECT vote_link_id as id, vote_value FROM votes WHERE vote_type='links' and vote_user_id={$user->id} ORDER BY vote_date DESC LIMIT {$offset},{$page_size}"); if ($links) { foreach ($links as $linkdb) { $link->id = $linkdb->id; $link->read(); if ($link->author == $user->id) { continue; } echo '<div style="max-width: 60em">'; $link->print_summary('short', 0, false); if ($linkdb->vote_value < 0) { echo '<div class="box" style="z-index:1;margin:0 0 -5x 0;background:#FF3333;position:relative;top:-5px;left:85px;width:8em;padding: 1px 1px 1px 1px;border-color:#f00;opacity:0.9;text-align:center;font-size:0.9em;color:#fff;text-shadow: 0 1px 0 #000">'; echo get_negative_vote($linkdb->vote_value); echo "</div>\n"; } echo "</div>\n"; } echo '<br/><span style="color: #FF6400;"><strong>' . _('Nota') . '</strong>: ' . _('sólo se visualizan los votos de los últimos meses') . '</span><br />'; } }
function group_shared($requestID) { global $db, $main_smarty, $the_template, $page_size, $cached_links; if (!is_numeric($requestID)) { die; } $link = new Link(); $group_shared_display = ""; //$group_shared_display .= "SELECT link_id FROM " . table_links . " WHERE link_group_id=$requestID"; //$links = $db->get_col("SELECT link_id FROM " . table_links . " WHERE link_share_id = $requestID"); $rows = $db->get_var("SELECT COUNT(share_link_id) FROM " . table_group_shared . " WHERE share_group_id = {$requestID}"); $links = $db->get_results("SELECT * FROM " . table_group_shared . " WHERE share_group_id = {$requestID}"); if ($links) { foreach ($links as $dblink) { $link->id = $dblink->link_id; $cached_links[$dblink->link_id] = $dblink; $link->read(); $group_shared_display .= $link->print_summary('summary', true); } } $main_smarty->assign('group_shared_display', $group_shared_display); $main_smarty->assign('group_story_pagination', do_pages($rows, $page_size, 'group_story', true)); }
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 akismet_showpage() { global $main_smarty, $the_template, $current_user, $db; force_authentication(); $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); if ($canIhaveAccess == 1) { if (phpnum() >= 5) { include_once akismet_lib_path . 'Akismet.class_5.php'; } else { include_once akismet_lib_path . 'Akismet.class_4.php'; } $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'); } $spam_links = get_misc_data('spam_links'); if ($spam_links != '') { $spam_links = unserialize(get_misc_data('spam_links')); } else { $spam_links = array(); } $main_smarty->assign('spam_links', $spam_links); $main_smarty->assign('spam_links_count', count($spam_links)); $spam_comments = get_misc_data('spam_comments'); if ($spam_comments != '') { $spam_comments = unserialize(get_misc_data('spam_comments')); } else { $spam_comments = array(); } $main_smarty->assign('spam_comments', $spam_comments); $main_smarty->assign('spam_comments_count', count($spam_comments)); $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 == '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 == 'updateKey') { if (isset($_REQUEST['key'])) { $wordpress_key = sanitize($_REQUEST['key'], 3); } else { $wordpress_key = ''; } misc_data_update('wordpress_key', $wordpress_key); header('Location: ' . URL_akismet); } if ($view == 'manageSpam') { $spam_links = get_misc_data('spam_links'); if ($spam_links != '') { $spam_links = unserialize(get_misc_data('spam_links')); } else { $spam_links = array(); } if (count($spam_links) > 0) { $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE "; $sql .= 'link_id IN (' . implode(',', $spam_links) . ')'; $link_data = $db->get_results($sql); $main_smarty->assign('link_data', object_2_array($link_data)); } else { header('Location: ' . URL_akismet); } $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 == 'isSpam'){ if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';} $spam_links = get_misc_data('spam_links'); $spam_links = unserialize(get_misc_data('spam_links')); unset($spam_links[$link_id]); misc_data_update('spam_links', serialize($spam_links)); $link = new Link; $link->id = $link_id; $link->read(FALSE); $link->status = 'discard'; $link->store(); header('Location: ' . URL_akismet . '&view=manageSpam'); } if($view == 'isNotSpam'){ if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';} $spam_links = get_misc_data('spam_links'); $spam_links = unserialize(get_misc_data('spam_links')); unset($spam_links[$link_id]); misc_data_update('spam_links', serialize($spam_links)); $link = new Link; $link->id = $link_id; $link->read(FALSE); $link->status = 'queued'; $link->store(); header('Location: ' . URL_akismet . '&view=manageSpam'); } if($view == 'addSpam'){ $spam_links[1] = 1; misc_data_update('spam_links', serialize($spam_links)); header('Location: ' . URL_akismet . '&view=manageSpam'); } */ if ($view == 'manageSpamcomments') { $spam_comments = get_misc_data('spam_comments'); if ($spam_comments != '') { $spam_comments = unserialize(get_misc_data('spam_comments')); } else { $spam_comments = array(); } if (count($spam_comments) > 0) { $sql = "SELECT * FROM " . table_prefix . "spam_comments WHERE "; $sql .= 'linkid IN (' . implode(',', $spam_comments) . ')'; $link_data = $db->get_results($sql); $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>"; $spam_output .= "<tr><th>Author</th><th>Body</th><th>this is spam</th><th>this is NOT spam</th></tr>"; if ($link_data) { 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 .= "<td>" . $user_name . "</td>"; $spam_output .= "<td>" . save_text_to_html($spam_cmts->cmt_content) . "</td>"; $spam_output .= '<td><center><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="spamcomment"></center></td>'; $spam_output .= '<td><center><input type="radio" name="spamcomment[' . $spam_cmts->auto_id . ']" id="spamcomment-' . $spam_cmts->auto_id . '" value="notspamcomment"></center></td>'; $spam_output .= "</tr>"; } } $spam_output .= "</table>"; $spam_output .= '<p align="right"><input type="submit" name="submit" value="Change Status" class="log2" /></p>'; $spam_output .= "</form>"; $main_smarty->assign('spam_output', $spam_output); $main_smarty->assign('link_data', object_2_array($link_data)); } else { header('Location: ' . URL_akismet); } $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($the_template . '/pligg.tpl'); } 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 ($value == "spam") { if (isset($key)) { $link_id = sanitize($key, 3); } else { $link_id = ''; } $spam_links = get_misc_data('spam_links'); $spam_links = unserialize(get_misc_data('spam_links')); $key = array_search($link_id, $spam_links); unset($spam_links[$key]); misc_data_update('spam_links', serialize($spam_links)); $link = new Link(); $link->id = $link_id; $link->read(); $link->status = 'discard'; $link->store(); $user = new User(); $user->id = $link->author; $user->read(); $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(getmyurl('story', $link->id)); $akismet->submitSpam(); } elseif ($value == "notspam") { if (isset($key)) { $link_id = sanitize($key, 3); } else { $link_id = ''; } $spam_links = get_misc_data('spam_links'); $spam_links = unserialize(get_misc_data('spam_links')); $key = array_search($link_id, $spam_links); unset($spam_links[$key]); misc_data_update('spam_links', serialize($spam_links)); $link = new Link(); $link->id = $link_id; $link->read(FALSE); $link->status = 'queued'; $link->store(); $user = new User(); $user->id = $link->author; $user->read(); $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(getmyurl('story', $link->id)); $akismet->submitHam(); } } } } header('Location: ' . URL_akismet . '&view=manageSpam'); } 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 ($value == "spamcomment") { if (isset($key)) { $link_id = sanitize($key, 3); } else { $link_id = ''; } global $db; $spam_comments = get_misc_data('spam_comments'); $spam_comments = unserialize(get_misc_data('spam_comments')); $key = array_search($link_id, $spam_comments); unset($spam_comments[$key]); $sql_result = "Select * from " . table_prefix . "spam_comments where auto_id=" . $link_id; $result_arr = $db->get_results($sql_result); if ($result_arr) { foreach ($result_arr as $result_arr_comments) { $link = new Link(); $link->id = $result_arr_comments->linkid; $link->read(); $user = new User(); $user->id = $result_arr_comments->userid; $user->read(); $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_arr_comments->cmt_content); $akismet->setPermalink(getmyurl('story', $link->id)); $akismet->submitSpam(); } } misc_data_update('spam_comments', serialize($spam_comments)); $db->query(' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id); } elseif ($value == "notspamcomment") { if (isset($key)) { $link_id = sanitize($key, 3); } else { $link_id = ''; } global $db; $spam_comments = get_misc_data('spam_comments'); $spam_comments = unserialize(get_misc_data('spam_comments')); $key = array_search($link_id, $spam_comments); unset($spam_comments[$key]); $sql_result = " Select * from " . table_prefix . "spam_comments where auto_id={$link_id}"; $result_arr = $db->get_results($sql_result); if ($result_arr) { foreach ($result_arr as $result_arr_comments) { $link = new Link(); $link->id = $result_arr_comments->linkid; $link->read(); $user = new User(); $user->id = $result_arr_comments->userid; $user->read(); $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_arr_comments->cmt_content); $akismet->setPermalink(getmyurl('story', $link->id)); $akismet->submitHam(); $sql = "INSERT INTO " . table_comments . " (comment_parent, comment_user_id, comment_link_id , comment_date, comment_randkey, comment_content) VALUES ({$result_arr_comments->cmt_parent}, {$result_arr_comments->userid}, {$result_arr_comments->linkid}, now(), '{$result_arr_comments->cmt_rand}', '{$result_arr_comments->cmt_content}')"; $db->query($sql); } } misc_data_update('spam_comments', serialize($spam_comments)); $sql_delete = ' Delete from ' . table_prefix . 'spam_comments where auto_id=' . $link_id; $db->query($sql_delete); $link->adjust_comment(1); $link->store(); } } } header('Location: ' . URL_akismet . '&view=manageSpamcomments'); } } } }
// The source code packaged with this file is Free Software, Copyright (C) 2005 by // Ricardo Galli <gallir at uib dot es>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include 'config.php'; include mnminclude . 'link.php'; include mnminclude . 'html1.php'; $link = new Link(); if (!defined($_REQUEST['id']) && !empty($_SERVER['PATH_INFO'])) { $url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']); array_shift($url_args); // The first element is always a "/" $link->uri = $db->escape($url_args[0]); if (!$link->read('uri')) { not_found(); } } else { $url_args = preg_split('/\\/+/', $_REQUEST['id']); $link->id = intval($url_args[0]); if (is_numeric($url_args[0]) && $link->read('id')) { // Redirect to the right URL if the link has a "semantic" uri if (!empty($link->uri) && !empty($globals['base_story_url'])) { if (!empty($url_args[1])) { $extra_url = '/' . urlencode($url_args[1]); } header('Location: ' . $link->get_permalink() . $extra_url); die; } } else {
function show($fetch = false) { global $main_smarty, $db, $cached_links, $current_user; include_once mnminclude . 'search.php'; $search = new Search(); $search->orderBy = $this->orderBy; $search->pagesize = $this->pagesize; $search->filterToStatus = $this->filterToStatus; $search->filterToTimeFrame = $this->filterToTimeFrame; if ($this->category) { $thecat = get_cached_category_data('category_safe_name', $this->category); $search->category = $thecat->category_id; } $search->doSearch(); $linksum_sql = $search->sql; $link = new Link(); $links = $db->get_col($linksum_sql); $the_results = $links; if ($the_results) { // find out if the logged in user voted / reported each of // the stories that the search found and cache the results require_once mnminclude . 'votes.php'; // DB 03/02/09 // $vote = new Vote; // $vote->type='links'; // $vote->user=$current_user->user_id; // $vote->link=$the_results; // $results = $vote->user_list_all_votes(); ////// $vote = ''; $results = ''; // we don't actually need the results // we're just calling this to cache the results // so when we foreach the links we don't have to // run 1 extra query for each story to determine // current user votes // setup the link cache $i = 0; // if this query changes also change it in the read() function in /libs/link.php $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE "; foreach ($the_results as $link_id) { // first make sure we don't already have it cached if (!isset($cached_links[$link_id])) { if ($i > 0) { $sql .= ' OR '; } $sql .= " link_id = {$link_id} "; $i = $i + 1; } } // if $i = 0 then all the links are already cached // so don't touch the db // if $i > 0 then there is at least 1 link to get // so get the SQL and add results to the cache if ($i > 0) { $results = $db->get_results($sql); // add the results to the cache foreach ($results as $row) { $cached_links[$row->link_id] = $row; } } // end link cache setup } $ssLinks = ''; if ($links) { foreach ($links as $link_id) { $link->id = $link_id; $link->check_saved = false; $link->get_author_info = false; $link->check_friends = false; $link->read(); if (is_numeric($this->TitleLengthLimit) && strlen($link->title) > $this->TitleLengthLimit) { $link->title = utf8_substr($link->title, 0, $this->TitleLengthLimit) . '...'; } $main_smarty = $link->fill_smarty($main_smarty); $ssLinks .= $main_smarty->fetch($this->template); } } if ($fetch == true) { return $ssLinks; } else { echo $ssLinks; } }
function print_comment_list($comments, $user) { global $globals, $current_user; $link = new Link; $comment = new Comment; foreach ($comments as $dbcomment) { if ($dbcomment->comment_type == 'admin' && ! $current_user->admin) continue; $link->id=$dbcomment->link_id; $comment->id = $dbcomment->comment_id; if ($last_link != $link->id) { $link->read(); echo '<h4>'; echo '<a href="'.$link->get_permalink().'">'. $link->title. '</a>'; echo ' ['.$link->comments.']'; echo '</h4>'; $last_link = $link->id; } $comment->read(); echo '<ol class="comments-list">'; echo '<li>'; $comment->print_summary($link, 2000, false); echo '</li>'; echo "</ol>\n"; } }
function report_dupe($url) { global $globals; $link = new Link; if(($found = $link->duplicates($url))) { $dupe = new Link; $dupe->id = $found; $dupe->read(); echo '<p class="error"><strong>'._('noticia repetida').'</strong></p> '; echo '<p class="error-text">'._('disculpas').'</p>'; $dupe->print_summary(); echo '<br style="clear: both;" /><br/>' . "\n"; echo '<form class="genericform" action="">'; echo '<input class="button" type="button" onclick="window.history.go(-1)" value="« '._('retroceder').'" />'; echo '</form>'. "\n"; echo '</div>'. "\n"; return true; } return false; }
// The source code packaged with this file is Free Software, Copyright (C) 2009 by // Ricardo Galli <gallir at gallir dot com>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include '../config.php'; $colors = array('negatives' => '#CB4B4B', 'positives' => '#4DA74D', 'anonymous' => '#AFD8F8', 'karma' => '#FF6400'); header('Content-Type: application/json; charset=utf-8'); if (empty($_GET['id'])) { die; } $id = intval($_GET['id']); $link = new Link(); $link->id = $id; $link->read(); if (!$link->read) { die; } if (($array = $link->read_annotation("link-karma")) != false) { $data['anonymous'] = array(); $data['positives'] = array(); $data['negatives'] = array(); $data['karma'] = array(); $data['clicks'] = array(); $array = array_reverse($array); foreach ($array as $log) { foreach (array_keys($data) as $key) { $item = array($log['time'] * 1000, $log[$key]); array_push($data[$key], $item); }
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}"); }
include mnminclude . 'geo.php'; header('Content-Type: text/plain; charset=UTF-8'); stats_increment('ajax'); if (!($id = intval($_REQUEST['id']))) { error(_('falta el id') . " {$link}"); } $type = $_REQUEST['type']; if ($type == 'user') { if ($id != $current_user->user_id) { error(_('usuario incorrecto')); } } elseif ($type == 'link') { require_once mnminclude . 'link.php'; $link = new Link(); $link->id = $id; if (!$link->read()) { error(_('Artículo inexistente')); } if (!$link->is_map_editable()) { error(_("noticia no modificable")); } } else { error(_('tipo incorrecto')); } $lat = (double) $_REQUEST['lat']; $lng = (double) $_REQUEST['lng']; $text = clean_text($_REQUEST['text'], 0, true, 75); if (geo_insert($type, $id, $lat, $lng, $text)) { echo "OK"; if ($type == 'link') { require_once mnminclude . 'log.php';
function akismet_link_to_spam($link_id) { global $db; $link = new Link(); $link->id = $link_id; $link->read(); $link->status = 'spam'; $link->store(); $db->query("INSERT INTO " . table_prefix . "spam_links (`auto_id` , `userid` , `linkid`) VALUES (NULL, {$link->author}, {$link_id})"); }
$config->store(); } } } // pagename define('pagename', 'delete'); $main_smarty->assign('pagename', pagename); if (isset($_REQUEST['link_id'])) { global $db; $link_id = $_REQUEST['link_id']; if (!is_numeric($link_id)) { die; } $linkres = new Link(); $linkres->id = $link_id; $linkres->read(); //echo $linkres->status; totals_adjust_count($linkres->status, -1); //$linkres->store_basic(); // module system hook $vars = array('link_id' => $linkres->id); check_actions('admin_story_delete', $vars); /*********find out the page slug dynamically ***********/ $linkslugvalue = $db->get_results("SELECT " . table_links . ".link_category, " . table_categories . ".category_safe_name FROM " . table_categories . " LEFT JOIN " . table_links . " ON " . table_links . ".link_category = " . table_categories . ".category__auto_id WHERE " . table_links . ".link_id = '" . $link_id . "' LIMIT 0,1"); $linkslug = ''; foreach ($linkslugvalue as $slug) { $linkslug = $slug->category_safe_name; } if ($linkslug != '') { $redirectUrl = $linkslug; }
function do_commented() { global $db, $main_smarty, $rows, $user, $offset, $page_size, $cached_links; $output = ''; $link = new Link(); $rows = $db->get_var("SELECT count(*) FROM " . table_links . ", " . table_comments . " WHERE comment_status='published' AND comment_user_id={$user->id} AND comment_link_id=link_id"); $links = $db->get_results("SELECT DISTINCT * FROM " . table_links . ", " . table_comments . " WHERE comment_status='published' AND comment_user_id={$user->id} AND comment_link_id=link_id AND (link_status='published' OR link_status='queued') ORDER BY link_date DESC LIMIT {$offset},{$page_size}"); if ($links) { foreach ($links as $dblink) { $link->id = $dblink->link_id; $cached_links[$dblink->link_id] = $dblink; $link->read(); $output .= $link->print_summary('summary', true); } } $main_smarty->assign('user_page', $output); }
Header("Location: " . $url); die; } // if we're using "Friendly URL's for stories" if (isset($requestTitle)) { $requestID = $db->get_var($sql = "SELECT link_id FROM " . table_links . " WHERE `link_title_url` = '" . $db->escape(sanitize($requestTitle, 4)) . "';"); // Search in old urls if not found if (!is_numeric($requestID)) { $requestID = $db->get_var($sql = "SELECT old_link_id FROM " . table_old_urls . " WHERE `old_title_url` = '" . $db->escape(sanitize($requestTitle, 4)) . "';"); } } if (is_numeric($requestID)) { $id = $requestID; $link = new Link(); $link->id = $requestID; if ($link->read() == false || sizeof($thecat) > 0 && (array_diff($thecat, $link->additional_cats, array($link->category)) || sizeof($thecat) != sizeof($link->additional_cats) + 1) || ($link->status == 'spam' || $link->status == 'discard') && !checklevel('admin') && !checklevel('moderator')) { // check for redirects include mnminclude . 'redirector.php'; $x = new redirector($_SERVER['REQUEST_URI']); header("Location: {$my_pligg_base}/error_404.php"); die; } // Hide private group stories if ($link->link_group_id) { $privacy = $db->get_var("SELECT group_privacy FROM " . table_groups . " WHERE group_id = {$link->link_group_id}"); if ($privacy == 'private' && !isMember($link->link_group_id)) { die('Access denied'); } } if (isset($_POST['process']) && sanitize($_POST['process'], 3) != '') { if (sanitize($_POST['process'], 3) == 'newcomment') {
function do_submit3() { global $db, $current_user; $linkres = new Link(); $linkres->id = $link_id = intval($_POST['id']); $linkres->read(); // Check it is not in the queue already if ($linkres->votes == 0 && $linkres->status != 'queued') { $linkres->status = 'queued'; $linkres->date = time(); $linkres->get_uri(); $linkres->store(); $linkres->insert_vote($current_user->user_id, $current_user->user_karma); // Add the new link log/event require_once mnminclude . 'log.php'; log_conditional_insert('link_new', $linkres->id, $linkres->author); $db->query("delete from links where link_author = {$linkres->author} and link_status='discard' and link_votes=0"); if (!empty($_POST['trackback'])) { require_once mnminclude . 'trackback.php'; $trackres = new Trackback(); $trackres->url = clean_input_url($_POST['trackback']); $trackres->link = $linkres->id; $trackres->title = $linkres->title; $trackres->author = $linkres->author; $trackres->content = $linkres->content; $res = $trackres->send($linkres); } } header("Location: shakeit.php"); die; }