function print_text($length = 0, $html_id = false) { global $current_user, $globals; if ($length > 0 && mb_strlen($this->content) > $length + $length / 2) { $this->content = preg_replace('/&\\w*$/', '', mb_substr($this->content, 0, $length)); $expand = '... ' . '<a href="javascript:load_html(\'get_commentmobile.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">» ' . _('ver todo el comentario') . '</a>'; } echo put_smileys(save_text_to_html($this->content)) . $expand; echo "\n"; }
function print_summary($link) { global $current_user; static $comment_counter = 0; if(!$this->read) return; $comment_counter++; echo '<li id="c-'.$this->id.'"><div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$_SERVER['PHP_SELF'].'?id='.$link->id.'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a> '.$this->put_smileys(save_text_to_html($this->content)).'</div>'; echo '<div class="comment-info">'; echo _('escrito por'). ' <a href="./user.php?login='******'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date); echo '<img src="'.get_gravatar_url($this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="gravatar.com" /></div></li>'."\n"; }
include_once mnminclude . 'search.php'; include_once mnminclude . 'smartyvariables.php'; // ------------------------------------------------------------------------------------- global $the_template, $main_smarty, $db; $body = ''; $res = "select comment_content,comment_id,link_id, " . table_links . ".link_title_url, " . table_links . ".link_category from " . table_comments . "," . table_links . " WHERE comment_link_id = link_id ORDER BY comment_date DESC limit " . comments_size_sidebar . ""; $list_comments = $db->get_results($res); if ($list_comments) { foreach ($list_comments as $row) { if ($row->link_title_url == "") { $story_url = getmyurl("story", $row->link_id); } else { $story_url = getmyurl("storyURL", comments_category_safe_name($row->link_category), urlencode($row->link_title_url), $row->link_id); } $main_smarty->assign('comment_url', $story_url . "#c" . $row->comment_id); $main_smarty->assign('comment_text', ShortenText(save_text_to_html($row->comment_content))); $body .= $main_smarty->fetch($the_template . '/sidebar_comments.tpl'); } } $main_smarty->assign('live_url', getmyurl("comments")); $main_smarty->assign('sc_body', $body); $main_smarty->display($the_template . '/sidebar_comments_wrapper.tpl'); $main_smarty->assign('ss_toggle_id', 'latcomments'); // determine the amount of characters to show for each comment function ShortenText($text) { $chars = comments_length_sidebar; $text = strip_tags($text); $text = $text . " "; $text = substr($text, 0, $chars); $text = substr($text, 0, strrpos($text, ' '));
stats_increment('ajax'); } include_once mnminclude . 'post.php'; if (!empty($_GET['id'])) { if (preg_match('/([\\w\\.\\-_]+)-(\\d+)/', $_GET['id'], $matches) > 0) { $user = $db->escape($matches[1]); $date = $matches[2]; $id = (int) $db->get_var("select post_id from posts, users where user_login = '******' and post_user_id = user_id and post_date < FROM_UNIXTIME({$date}) order by post_date desc limit 1"); if (!$id > 0) { echo '<strong>Error: </strong>' . _('usuario o nota no encontrada'); die; } } else { $id = intval($_GET['id']); } } else { die; } $post = new Post(); $post->id = $id; $post->read(); if (!$post->read) { die; } echo '<div style="font-size:8.5pt;width:280px; margin-right:15px; overflow:hidden">'; if ($post->avatar) { echo '<img src="' . get_avatar_url($post->author, $post->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 5px 0;"/>'; } echo '<a href="' . post_get_base_url($post->username) . '" target="_blank"><strong>' . $post->username . '</strong></a> (' . $post->src . ')<br/>'; echo put_smileys(save_text_to_html($post->content)); echo '</div>';
function print_text($length = 0) { global $current_user, $globals; if (!$this->basic_summary && ($this->author == $current_user->user_id && time() - $this->date < $globals['posts_edit_time'] || $current_user->user_level == 'god' && time() - $this->date < $globals['posts_edit_time_admin'])) { // Admins can edit up to 10 days $expand = ' <a href="javascript:post_edit(' . $this->id . ')" title="' . _('editar') . '"><img class="mini-icon-text" src="' . $globals['base_static'] . 'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>'; } elseif ($length > 0) { $this->content = text_to_summary($this->content, $length); } echo put_smileys($this->put_tooltips(save_text_to_html($this->content, 'posts'))) . $expand; echo "\n"; }
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; } }
function print_text($length = 0) { global $current_user, $globals; if ($this->author == $current_user->user_id && time() - $this->date < $globals['comment_edit_time']) { $expand = '<br /><br />» ' . '<a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'ccontainer-'.$this->id.'\',0,'.$this->id.')" title="'._('editar').'">'._('editar comentario').'</a>'; } elseif ($length>0 && strlen($this->content) > $length + $length/2) { $this->content = substr($this->content, 0 , $length); $expand = '...<br /><br />» ' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'c-'.$this->id.'\',0,'.$this->id.')" title="'._('resto del comentario').'">'._('ver todo el comentario').'</a>'; } echo $this->put_smileys(save_text_to_html($this->content)) . $expand; }
function print_text($length = 0, $single_link = true) { global $current_user, $globals; if ($this->author == $current_user->user_id && $globals['now'] - $this->date < $globals['comment_edit_time'] || $current_user->user_level == 'god') { // gods can always edit $expand = ' <a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'ccontainer-' . $this->id . '\',0,' . $this->id . ')" title="' . _('editar comentario') . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>'; } elseif ($length > 0 && mb_strlen($this->content) > $length + $length / 2) { $this->content = preg_replace('/&\\w*$/', '', mb_substr($this->content, 0, $length)); $expand = '... ' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">» ' . _('ver todo el comentario') . '</a>'; } echo put_smileys($this->put_comment_tooltips(save_text_to_html($this->content))) . $expand; echo "\n"; }
} END WARNING ******/ if ($last_modified <= $if_modified) { header('HTTP/1.1 304 Not Modified'); exit; } do_header($title); $comment = new Comment(); $link = new Link(); $comments = $db->get_col($sql); if ($comments) { foreach ($comments as $comment_id) { $comment->id = $comment_id; $comment->read(); $content = save_text_to_html($comment->content); echo "\t<item>\n"; $link_id = $link->id = $comment->link; $link->read(); $link_title = $db->get_var("select link_title from links where link_id = {$link_id}"); // Title must not carry htmlentities echo "\t\t<title><![CDATA[" . html_entity_decode($link_title) . "]]></title>\n"; echo "\t\t<link>" . $link->get_permalink() . "#comment-" . $comment->order . "</link>\n"; echo "\t\t<pubDate>" . date("r", $comment->date) . "</pubDate>\n"; echo "\t\t<dc:creator>{$comment->username}</dc:creator>\n"; echo "\t\t<guid>" . $link->get_permalink() . "#comment-" . $comment->order . "</guid>\n"; echo "\t\t<description><![CDATA[<p>{$content}"; echo '</p><p>» ' . _('autor') . ': <strong>' . $comment->username . '</strong></p>'; echo '<p><img src="http://' . get_server_name() . $globals['base_url'] . 'backend/vote_com_img.php?id=' . $link->id . '" alt="votes" width=200, height=16 /></p>'; echo "]]></description>\n"; echo "\t</item>\n\n";
stats_increment('ajax'); if (!empty($_GET['id'])) { if (!empty($_GET['link'])) { $link = intval($_GET['link']); $order = intval($_GET['id']); $id = $db->get_var("select comment_id from comments where comment_link_id={$link} and comment_order={$order}"); if (!$id > 0) { die; } } else { $id = intval($_GET['id']); } } else { die; } $comment = new Comment(); $comment->id = $id; $comment->read(); if (!$comment->read) { die; } if ($comment->type != 'admin') { if ($comment->avatar) { echo '<img src="' . get_avatar_url($comment->author, $comment->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 4px 0;"/>'; } echo '<strong>' . $comment->username . '</strong><br/>'; } else { echo '<strong>' . get_server_name() . '</strong><br/>'; } echo put_smileys(save_text_to_html(mb_substr($comment->content, 0, 1000)));
// $id = 0; $sql = "SELECT post_id FROM posts WHERE {$from_time} ORDER BY post_date DESC LIMIT {$rows}"; $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(post_date) FROM posts ORDER BY post_date DESC LIMIT 1"); $title = _('Nótame') . ': ' . _('notas'); } do_header($title); $post = new Post(); $posts = $db->get_col($sql); if ($posts) { foreach ($posts as $post_id) { $post->id = $post_id; $post->read(); $title = text_to_summary($post->clean_content(), 40); $title = $post->username . ': ' . htmlentities2unicodeentities($title); $content = htmlentities2unicodeentities(put_smileys(save_text_to_html($post->clean_content()))); echo "\t<item>\n"; echo "\t\t<title>{$title}</title>\n"; echo "\t\t<link>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</link>\n"; echo "\t\t<pubDate>" . date("r", $post->date) . "</pubDate>\n"; echo "\t\t<dc:creator>{$post->username}</dc:creator>\n"; echo "\t\t<guid>http://" . get_server_name() . post_get_base_url($post->username) . '/' . $post->id . "</guid>\n"; // Insert GEO if ($latlng = geo_latlng('user', $post->author)) { echo "\t\t<georss:point>{$latlng->lat} {$latlng->lng}</georss:point>\n"; } echo "\t\t<description><![CDATA[{$content}"; echo '</p><p>» ' . _('autor') . ': <strong>' . $post->username . '</strong></p>'; echo "]]></description>\n"; echo "\t</item>\n\n"; }
} do_header($title); if ($comments) { foreach ($comments as $comment_id) { $comment = Comment::from_db($comment_id); if ($comment->type == 'admin') { if ($individual_user) { continue; } else { $comment->username = get_server_name(); } } if ($comment->user_level == 'disabled') { $content = '[' . _('Usuario deshabilitado') . ']'; } else { $content = put_smileys(save_text_to_html(htmlentities2unicodeentities($comment->content))); } echo "\t<item>\n"; $link = Link::from_db($comment->link); echo "\t\t<meneame:comment_id>{$comment->id}</meneame:comment_id>\n"; echo "\t\t<meneame:link_id>{$comment->link}</meneame:link_id>\n"; echo "\t\t<meneame:order>{$comment->c_order}</meneame:order>\n"; echo "\t\t<meneame:user>{$comment->username}</meneame:user>\n"; echo "\t\t<meneame:votes>" . intval($comment->votes) . "</meneame:votes>\n"; echo "\t\t<meneame:karma>" . intval($comment->karma) . "</meneame:karma>\n"; echo "\t\t<meneame:url>" . 'http://' . get_server_name() . $comment->get_relative_individual_permalink() . "</meneame:url>\n"; // Title must not carry htmlentities echo "\t\t<title>#{$comment->order} " . htmlentities2unicodeentities($link->title) . "</title>\n"; echo "\t\t<link>" . $link->get_permalink() . "/000" . $comment->order . "</link>\n"; echo "\t\t<pubDate>" . date("r", $comment->date) . "</pubDate>\n"; echo "\t\t<dc:creator>{$comment->username}</dc:creator>\n";
function print_text($length = 0) { global $current_user, $globals; if ($this->author == $current_user->user_id && time() - $this->date < 3600 || $current_user->user_level == 'god' && time() - $this->date < 864000) { // Admins can edit up to 10 days $expand = ' <a href="javascript:get_votes(\'post_edit.php\',\'edit_post\',\'pcontainer-' . $this->id . '\',0,' . $this->id . ')" title="' . _('editar') . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>'; } echo put_smileys($this->put_tooltips(save_text_to_html($this->content))) . $expand; echo "\n"; }
if (!empty($option)) { echo '<a href="./">' . _('Todas') . '</a> '; } echo '<a href="../">' . _('Muéveme') . '</a>'; echo '</div>'; echo "<ul>\n"; switch ($option) { case '': case '_all': $sql = "SELECT post_id from posts order by post_date desc LIMIT {$page_size}"; break; default: $user = new User(); $user->username = $db->escape($option); if (!$user->read()) { not_found(); } $sql = "SELECT post_id FROM posts WHERE post_user_id={$user->id} ORDER BY post_id desc limit {$page_size}"; } $posts = $db->get_col($sql); if ($posts) { foreach ($posts as $post_id) { $post->id = $post_id; $post->read(); echo '<li><a href="./?id=' . htmlspecialchars($post->username) . '">' . $post->username . '</a>: '; echo '<span class="text">' . save_text_to_html($post->content) . '</span>'; echo "</li>\n"; } } echo "</ul>\n"; echo "</body></html>";
function print_text($length = 0, $html_id=false) { global $current_user, $globals; if (!$html_id) $html_id = $this->id; if (!$this->basic_summary && ( ($this->author == $current_user->user_id && $globals['now'] - $this->date < $globals['comment_edit_time']) || (($this->author != $current_user->user_id || $this->type == 'admin') && $current_user->user_level == 'god')) ) { // gods can always edit $expand = ' <a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'c-'.$html_id.'\',0,'.$this->id.')" title="'._('editar comentario').'"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>'; } if ($length > 0 && mb_strlen($this->content) > $length + $length/2) { $this->content = preg_replace('/[&<\{]\w*$/', '', mb_substr($this->content, 0 , $length)); // Check all html tags are closed if (preg_match('/<\w+>/', $this->content)) { $this->content = close_tags($this->content); } $this->content = preg_replace('/&\w*$|<\w{1,6}>([^<>]*)$/', "$1", mb_substr($this->content, 0 , $length)); $expand .= ' ' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-'.$this->id.'\',0,'.$this->id.')" title="'._('resto del comentario').'">» '._('ver todo el comentario').'</a>'; } echo put_smileys($this->put_comment_tooltips(save_text_to_html($this->content, 'comments'))) . $expand; echo "\n"; }
function fill_smarty($smarty) { global $current_user, $the_template, $comment_counter, $link, $ranklist, $db; if (!$ranklist) { $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N); $ranklist = array(); $rank = 1; if ($users) { foreach ($users as $dbuser) { $ranklist[$dbuser[0]] = $rank; $rank += $dbuser[1]; } } } $smarty->assign('comment_counter', $comment_counter); $text = save_text_to_html($this->content); $vars = array('comment_text' => $text, 'comment_id' => $this->id, 'smarty' => $smarty); check_actions('show_comment_content', $vars); $smarty->assign('comment_content', $vars['comment_text']); $vars = array('comment_form_label' => ''); check_actions('comment_form_label', $vars); $smarty->assign('comment_form_label', $vars['comment_form_label']); $smarty->assign('current_userid', $current_user->user_id); $smarty->assign('user_logged_in', $current_user->user_login); $vars = array('comment_username' => $this->username(), 'is_anonymous' => 0, 'comment_id' => $this->id); check_actions('show_comment_username', $vars); $smarty->assign('user_username', $vars['comment_username']); $smarty->assign('user_rank', $ranklist[$this->userkarma]); $smarty->assign('is_anonymous', $vars['is_anonymous']); $smarty->assign('user_extra_fields', $this->extra_field); //$smarty->assign('link_submitter', $link->username()); $smarty->assign('comment_id', $this->id); $smarty->assign('comment_status', $this->status); $smarty->assign('comment_author', $this->author); $smarty->assign('comment_link', $this->link); $smarty->assign('user_view_url', getmyurl('user', $this->username)); $smarty->assign('comment_date_timestamp', $this->date); $smarty->assign('comment_date', date('F, d Y g:i A', $this->date)); $smarty->assign('comment_age', txt_time_diff($this->date)); $smarty->assign('comment_randkey', $this->randkey); $smarty->assign('comment_votes', $this->votes); $smarty->assign('comment_parent', $this->parent); $smarty->assign('hide_comment_edit', $this->hideedit); $this->user_vote_count = $this->votes($current_user->user_id); $smarty->assign('comment_user_vote_count', $this->user_vote_count); $smarty->assign('comment_shakebox_currentuser_votes', $this->votes($current_user->user_id, '>0')); $smarty->assign('comment_shakebox_currentuser_reports', $this->votes($current_user->user_id, '<0')); // if the person logged in is the person viewing the comment, show 'you' instead of the name $smarty->assign('user_userlogin', $this->username); // the url for the edit comment link $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id)); $smarty->assign('delete_comment_url', my_pligg_base . '/delete.php?comment_id=' . $this->id); // avatars $smarty->assign('UseAvatars', do_we_use_avatars()); $smarty->assign('Avatar', $avatars = get_avatar('all', '', $this->username, '')); $smarty->assign('Avatar_ImgSrc', $avatars['large']); $smarty->assign('Avatar_ImgSrc_Small', $avatars['small']); // does the person logged in have admin or moderator status? $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('admin'); $canIhaveAccess = $canIhaveAccess + checklevel('moderator'); if ($canIhaveAccess == 1) { $smarty->assign('isadmin', 1); } // the link to upvote the comment $jslinky = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_votey', $jslinky); $jslinky = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_unvotey', $jslinky); // the link to downvote the comment $jslinkn = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_voten', $jslinkn); $jslinkn = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_unvoten', $jslinkn); // misc $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting); $smarty->assign('my_base_url', my_base_url); $smarty->assign('my_pligg_base', my_pligg_base); $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small); return $smarty; }
function fill_smarty($smarty) { global $current_user, $the_template, $comment_counter, $link; $smarty->assign('comment_counter', $comment_counter); $smarty->assign('comment_content', save_text_to_html($this->content)); $smarty->assign('current_userid', $current_user->user_id); $smarty->assign('user_logged_in', $current_user->user_login); $smarty->assign('user_username', $this->username()); $smarty->assign('comment_id', $this->id); $smarty->assign('comment_author', $this->author); $smarty->assign('comment_link', $this->link); $smarty->assign('user_view_url', getmyurl('user', $this->username())); $smarty->assign('comment_age', txt_time_diff($this->date)); $smarty->assign('comment_randkey', $this->randkey); $smarty->assign('comment_votes', $this->votes); $smarty->assign('comment_parent', $this->parent); $smarty->assign('hide_comment_edit', $this->hideedit); $this->user_vote_count = $this->votes($current_user->user_id); $smarty->assign('comment_user_vote_count', $this->user_vote_count); // if the person logged in is the person viewing the comment, show 'you' instead of the name if ($current_user->user_login == $this->username()) { $smarty->assign('user_username', 'you'); } // the url for the edit comment link $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id)); // avatars $smarty->assign('UseAvatars', do_we_use_avatars()); $smarty->assign('Avatar_ImgSrc', get_avatar('small', "", $this->username(), "")); //spellchecker $smarty->assign('Spell_Checker', Spell_Checker); // does the person logged in have admin or god access? $canIhaveAccess = 0; $canIhaveAccess = $canIhaveAccess + checklevel('god'); $canIhaveAccess = $canIhaveAccess + checklevel('admin'); if ($canIhaveAccess == 1) { $smarty->assign('isadmin', 1); } // the link to upvote the comment $jslinky = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 10, '" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_votey', $jslinky); // the link to downvote the comment $jslinkn = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', -10, '" . my_base_url . my_pligg_base . "/')"; $smarty->assign('link_shakebox_javascript_voten', $jslinkn); // misc $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting); $smarty->assign('my_base_url', my_base_url); $smarty->assign('my_pligg_base', my_pligg_base); $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small); return $smarty; }
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'); } } } }
function print_text($length = 0, $single_link = true) { global $current_user, $globals; if ($this->author == $current_user->user_id && time() - $this->date < $globals['comment_edit_time'] || $current_user->user_level == 'god' && time() - $this->date < 10800) { // Admins can edit up to 3 hours $expand = '<br /><br />» ' . '<a href="javascript:get_votes(\'comment_edit.php\',\'edit_comment\',\'ccontainer-' . $this->id . '\',0,' . $this->id . ')" title="' . _('editar') . '">' . _('editar comentario') . '</a>'; } elseif ($length > 0 && mb_strlen($this->content) > $length + $length / 2) { $this->content = mb_substr($this->content, 0, $length); $expand = '...<br /><br />» ' . '<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('resto del comentario') . '">' . _('ver todo el comentario') . '</a>'; } if ($single_link) { echo $this->put_smileys($this->put_comment_tooltips(save_text_to_html($this->content))) . $expand; } else { echo $this->put_smileys(save_text_to_html($this->content)) . $expand; } echo "\n"; }