function get_posts_menu($tab_selected, $username) { global $globals, $current_user; if ($tab_selected != 4 && $current_user->user_id > 0) { $username = $current_user->user_login; } switch ($tab_selected) { case 2: $id = _('popular'); break; case 3: $id = _('mapa'); break; case 4: $id = $username; break; case 5: $id = _('privados'); break; case 1: default: $id = _('todas'); break; } $items = array(); $items[] = new MenuOption(_('todas'), post_get_base_url(''), $id, _('todas las notas')); $items[] = new MenuOption(_('popular'), post_get_base_url('_best'), $id, _('notas populares')); if ($globals['google_maps_api']) { $items[] = new MenuOption(_('mapa'), post_get_base_url('_geo'), $id, _('mapa animado')); } if (!empty($username)) { $items[] = new MenuOption($username, post_get_base_url($username), $id, $username); } if ($current_user->user_id > 0) { $items[] = new MenuOption(_('Privados'), post_get_base_url('_priv'), $id, _('mensajes privados'), array(), 'privados'); } return $items; }
function do_redirect($type) { global $globals, $current_user; $url = '/'; // If everything fails, it will be redirected to the home switch ($type) { case 'privates': $url = post_get_base_url('_priv'); break; case 'posts': $url = post_get_base_url($current_user->user_login) . '/_conversation'; break; case 'comments': $url = get_user_uri($current_user->user_login, 'conversation'); break; case 'friends': $url = get_user_uri($current_user->user_login, 'friends_new'); break; } header("HTTP/1.1 302 Moved"); header('Location: ' . $url); header("Content-Length: 0"); }
function do_header($title) { global $if_modified, $last_modified, $dblang, $globals; if (!$last_modified > 0) { if ($if_modified > 0) { $last_modified = $if_modified; } else { $last_modified = time(); } } header('X-If-Modified: ' . gmdate('D, d M Y H:i:s', $if_modified)); header('X-Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified)); if ($last_modified <= $if_modified) { header('HTTP/1.1 304 Not Modified'); exit; } header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $last_modified) . ' GMT'); header('Content-type: text/xml; charset=UTF-8', true); echo '<?xml version="1.0" encoding="UTF-8"?' . '>' . "\n"; echo '<rss version="2.0" ' . "\n"; echo ' xmlns:atom="http://www.w3.org/2005/Atom"' . "\n"; echo ' xmlns:content="http://purl.org/rss/1.0/modules/content/"' . "\n"; echo ' xmlns:wfw="http://wellformedweb.org/CommentAPI/"' . "\n"; echo ' xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n"; echo ' xmlns:georss="http://www.georss.org/georss"' . "\n"; echo ' >' . "\n"; echo '<channel>' . "\n"; echo ' <title>' . $title . '</title>' . "\n"; echo ' <atom:link href="http://' . get_server_name() . __(clean_input_url($_SERVER['REQUEST_URI'])) . '" rel="self" type="application/rss+xml" />' . "\n"; echo ' <link>http://' . get_server_name() . post_get_base_url() . '</link>' . "\n"; echo "\t<image><title>" . $title . "</title><link>http://" . get_server_name() . post_get_base_url() . "</link><url>http://" . get_static_server_name() . $globals['base_url'] . "img/common/eli-rss.png</url></image>\n"; echo ' <description>' . _('Sitio colaborativo de publicación y comunicación entre blogs') . '</description>' . "\n"; echo ' <pubDate>' . date("r", $last_modified) . '</pubDate>' . "\n"; echo ' <generator>http://blog.meneame.net/</generator>' . "\n"; echo ' <language>' . $dblang . '</language>' . "\n"; }
$width = 140; $height = 120; $avatar = 40; $text_length = 150; } if (!empty($_GET['border'])) { $border = get_hex_color($_GET['border'], '#'); } else { $border = '#bbb'; } $id = $db->get_var($sql); if (!$id > 0) { die; } $post = new Post(); $post->id = $id; $post->read(); if (!$post->read) { die; } echo 'document.write(\''; echo '<a href="http://' . get_server_name() . post_get_base_url($post->username) . '" style="text-decoration: none; border: none">'; echo '<div style="overflow: hidden; background: #fff; width: ' . $width . 'px; max-height: ' . $height . 'px; border: 1px solid; border-color: ' . $border . '; ">'; echo '<div style="padding: 4px 4px 4px 4px;">'; echo '<div style="overflow: hidden; color: #666; text-align: left; font-family: sans-serif; font-size: 8pt; padding: 0; line-height: 1.1">'; echo '<img src="' . get_avatar_url($post->author, $post->avatar, $avatar) . '" width="' . $avatar . '" height="' . $avatar . '" alt="avatar" style="float:left; margin: 0 5px 4px 0;" border: none/>'; echo '<div>'; echo '<span style="color: #111;">' . $post->username . '</span><br/>'; echo addslashes(text_to_summary($post->content, $text_length)); echo '</div></div></div></div></a>'; echo '\');';
function do_best_posts() { global $db, $globals, $dblang; $min_date = date("Y-m-d H:00:00", $globals['now'] - 22000); // about 6 hours $res = $db->get_results("select post_id, post_content, user_login from posts, users where post_date > '{$min_date}' and post_user_id = user_id order by post_karma desc limit 10"); if ($res) { echo '<div class="vertical-box">'; echo '<h4><a href="' . post_get_base_url('_best') . '">' . _('¿mejores? notas') . '</a></h4><ul>'; foreach ($res as $post) { echo '<li>' . $post->user_login . ': <a onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_post_tooltip.php\', \'' . $post->post_id . '\', 10000);" href="' . post_get_base_url($post->user_login) . '/' . $post->post_id . '">' . text_to_summary($post->post_content, 50) . '</a></li>' . "\n"; } echo '</ul></div>'; } }
function print_summary($length = 0) { global $current_user, $globals; if (!$this->read) { $this->read(); } echo '<li id="pcontainer-' . $this->id . '">'; $post_meta_class = 'comment-meta'; $post_class = 'comment-body'; echo '<div class="' . $post_class . '">'; echo '<a href="' . get_user_uri($this->username) . '"><img onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" class="avatar" src="' . get_avatar_url($this->author, $this->avatar, 40) . '" width="40" height="40" alt="' . $this->username . '"/></a>'; $this->print_text($length); echo '</div>'; // The comments info bar echo '<div class="' . $post_meta_class . '">'; // Print the votes info (left) echo '<div class="comment-votes-info">'; // Check that the user can vote if ($current_user->user_id > 0 && $this->author != $current_user->user_id) { $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_p_v.php?id=' . $this->id . '\')">'; echo '<img src="' . $globals['base_url'] . 'img/common/vote-info01.png" width="12" height="12" alt="+ info" title="' . _('¿quién ha votado?') . '"/>'; echo '</a>'; } echo '</div>'; // Print comment info (right) echo '<div class="comment-info">'; echo '<a href="' . post_get_base_url($this->username) . '">' . _('nota de') . ' ' . $this->username . '</a> '; echo '(' . $this->src . ') '; echo '(<a href="' . post_get_base_url($this->username) . '/' . $this->id . '" title="permalink">#</a>) '; // Print dates if (time() - $this->date > 604800) { // 7 days echo _('el') . get_date_time($this->date); } else { echo _('hace') . ' ' . txt_time_diff($this->date); } echo '</div></div>'; echo "</li>\n"; }
function notify_user($from, $to, $text) { $sender = new User($from); $user = new User($to); if (!$user || !$sender) { return; } if (!check_email($user->email)) { return; } if (!User::get_pref($to, 'notify_priv')) { return; } $url = 'http://' . get_server_name() . post_get_base_url('_priv'); $subject = "Notificación de mensaje privado de {$sender->username}"; $message = "{$sender->username} " . _('escribió') . ":\n{$url}\n\n{$text}"; require_once mnminclude . 'mail.php'; send_mail($user->email, $subject, $message); }
do_redirection($url); exit(0); case 'posts': $url = post_get_base_url($current_user->user_login) . '/_conversation'; do_redirection($url); exit(0); case 'comments': $url = get_user_uri($current_user->user_login, 'conversation'); do_redirection($url); exit(0); case 'friends': $url = get_user_uri($current_user->user_login, 'friends_new'); do_redirection($url); exit(0); case 'post': $url = 'http://' . get_server_name() . post_get_base_url($id); do_redirection($url); exit(0); case 'comment': $c = new Comment(); $c->id = $id; $url = 'http://' . get_server_name() . $c->get_relative_individual_permalink(); do_redirection($url); exit(0); default: $l = Link::from_db($id, null, false); if (!$l) { exit(0); } if (!$globals['mobile'] && !$globals['mobile_version'] && $current_user->user_id > 0 && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') { if ($globals['base_bar_url']) {
if (!$date) { $date = $globals['now']; } $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) { // Check if the user exists $uid = (int) $db->get_var("select user_id from users where user_login = '******' limit 1"); if (!$uid) { not_found('<strong>Error: </strong>' . _('usuario inexistente')); } else { header('Location: http://' . get_server_name() . post_get_base_url($user)); die; } die; } } else { $id = intval($_GET['id']); } } else { die; } $post = new Post(); $post->id = $id; $post->read(); if (!$post->read) { not_found('<strong>Error: </strong>' . _('nota no encontrada')); die; } header('Location: http://' . get_server_name() . post_get_base_url($post->id)); echo $link;
static function get_menu_items($view, $user) { global $globals, $current_user; switch ($view) { case 'subs': $id = _('subs'); break; case 'history': case 'shaken': case 'friends_shaken': case 'favorites': $id = _('historias'); break; case 'commented': case 'favorite_comments': case 'shaken_comments': case 'conversation': $id = _('comentarios'); break; case 'friends': case 'friend_of': case 'ignored': case 'friends_new': $id = _('relaciones'); break; case 'categories': case 'profile': $id = _('perfil'); break; default: do_error(_('opción inexistente'), 404); break; } $items = array(); $items[] = new MenuOption(_('perfil'), get_user_uri($user), $id, _('información de usuario')); $items[] = new MenuOption(_('relaciones'), get_user_uri($user, 'friends'), $id, _('amigos e ignorados')); $items[] = new MenuOption(_('subs'), get_user_uri($user, 'subs'), $id, _('sub menéames')); $items[] = new MenuOption(_('historias'), get_user_uri($user, 'history'), $id, _('información de envíos')); $items[] = new MenuOption(_('comentarios'), get_user_uri($user, 'commented'), $id, _('información de comentarios')); $items[] = new MenuOption(_('notas'), post_get_base_url($user), $id, _('página de notas')); return $items; }
function print_summary($length = 0) { global $current_user, $globals; if (!$this->read) { $this->read(); } $this->hidden = $this->karma < $globals['post_hide_karma'] || $this->user_level == 'disabled'; $this->ignored = $current_user->user_id > 0 && User::friend_exists($current_user->user_id, $this->author) < 0; echo '<div id="pcontainer-' . $this->id . '">'; if ($this->hidden || $this->ignored) { $post_meta_class = 'comment-meta-hidden'; $post_class = 'comment-body-hidden'; } else { $post_meta_class = 'comment-meta'; $post_class = 'comment-body'; if ($this->karma > $globals['post_highlight_karma']) { $post_class .= ' high'; } } echo '<div class="' . $post_class . '" id="pid-' . $this->id . '">'; if ($this->ignored || $this->hidden && ($current_user->user_comment_pref & 1) == 0) { echo '» <a href="javascript:get_votes(\'get_post.php\',\'post\',\'pid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('ver texto') . '">' . _('ver texto') . '</a>'; } else { $this->print_user_avatar(40); $this->print_text($length); } echo '</div>'; // The comments info bar echo '<div class="' . $post_meta_class . '">'; // Print the votes info (left) echo '<div class="comment-votes-info">'; // Check that the user can vote if ($current_user->user_id > 0 && $this->author != $current_user->user_id && $this->date > time() - $globals['time_enabled_votes']) { $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_p_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>'; } // Reply button if ($current_user->user_id > 0) { echo '<a href="javascript:post_reply(' . $this->id . ',\'' . $this->username . '\')" title="' . _('responder') . '"><img src="' . $globals['base_static'] . 'img/common/reply02.png" width="18" height="16"/></a>'; } // Permalink echo '<a href="' . post_get_base_url($this->id) . '" 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_post.php\',\'' . $current_user->user_id . '\',\'fav-' . $this->id . '\',0,\'' . $this->id . '\')">' . favorite_teaser($current_user->user_id, $this, 'post') . '</a>'; } echo '</div>'; // Print comment info (right) echo '<div class="comment-info">'; $author = '<a href="' . post_get_base_url($this->username) . '">' . ' ' . $this->username . '</a> (' . $this->src . ')'; // Print dates if ($globals['now'] - $this->date > 604800) { // 7 days printf(_('el %s %s por %s'), get_date_time($this->date), '', $author); } else { printf(_('hace %s %s por %s'), txt_time_diff($this->date), '', $author); } //$this->print_user_avatar(20); echo '</div></div>'; echo "</div>\n"; }
function do_posts_tabs($tab_selected, $username) { global $globals, $current_user; $reload_text = _('recargar'); $active = ' class="tabmain-this"'; echo '<ul class="tabmain">' . "\n"; // All if ($tab_selected == 1) { echo '<li'.$active.'><a href="'.post_get_base_url().'" title="'.$reload_text.'"><em>'._('todos').'</em></a></li>' . "\n"; } else { echo '<li><a href="'.post_get_base_url().'">'._('todos').'</a></li>' . "\n"; } // Best if ($tab_selected == 2) { echo '<li'.$active.'><a href="'.post_get_base_url('_best').'" title="'.$reload_text.'"><em>'._('popular').'</em></a></li>' . "\n"; } else { echo '<li><a href="'.post_get_base_url('_best').'" title="'._('más votadas en 24 horas').'">'._('popular').'</a></li>' . "\n"; } // GEO if ($globals['google_maps_api']) { if ($tab_selected == 3) { echo '<li'.$active.'><a href="'.post_get_base_url('_geo').'" title="'.$reload_text.'"><em>'._('mapa').'</em></a></li>' . "\n"; } else { echo '<li><a href="'.post_get_base_url('_geo').'" title="'._('geo').'">'._('mapa').'</a></li>' . "\n"; } } // User if ($tab_selected == 4) { echo '<li'.$active.'><a href="'.post_get_base_url($username).'" title="'.$reload_text.'"><em>'.$username.'</em></a></li>' . "\n"; } elseif ($current_user->user_id > 0) { echo '<li><a href="'.post_get_base_url($current_user->user_login).'">'.$current_user->user_login.'</a></li>' . "\n"; } // END STANDARD TABS echo '</ul>' . "\n"; }
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". // The code below was made by Beldar <beldar at gmail dot com> if (!defined('mnmpath')) { include_once '../config.php'; header('Content-Type: text/html; charset=utf-8'); 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) { not_found('<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; } header('Location: http://' . get_server_name() . post_get_base_url($post->username) . "/{$post->id}"); echo $link;
function do_user_tabs($option, $user) { global $globals, $current_user; $active = array(); $active[$option] = 'class="tabsub-this"'; echo '<ul class="tabsub">' . "\n"; echo '<li><a ' . $active[1] . ' href="' . get_user_uri($user) . '">' . _('perfil') . '</a></li>'; echo '<li><a ' . $active[8] . ' href="' . get_user_uri($user, 'categories') . '">' . _('personalización') . '</a></li>'; echo '<li><a ' . $active[7] . ' href="' . get_user_uri($user, 'friends') . '"> <img src="' . $globals['base_url'] . 'img/common/icon_heart_bi.gif" alt="amigos e ignorados" width="16" height="16" title="' . _('amigos e ignorados') . '"/> </a></li>'; echo '<li><a ' . $active[2] . ' href="' . get_user_uri($user, 'history') . '">' . _('enviadas') . '</a></li>'; if (!$globals['bot']) { echo '<li><a ' . $active[6] . ' href="' . get_user_uri($user, 'favorites') . '"> ' . FAV_YES . ' </a></li>'; echo '<li><a ' . $active[3] . ' href="' . get_user_uri($user, 'commented') . '">' . _('comentarios') . '</a></li>'; echo '<li><a ' . $active[4] . ' href="' . get_user_uri($user, 'shaken') . '">' . _('votadas') . '</a></li>'; //echo '<li><a '.$active[5].' href="'.get_user_uri($user, 'preferred').'">'._('autores preferidos'). '</a></li>'; } echo '<li><a href="' . post_get_base_url($user) . '">' . _('notas') . '</a></li>'; echo '</ul>'; }
function do_best_posts() { global $db, $globals, $dblang; if ($globals['mobile']) { return; } $output = ''; $key = 'best_posts_' . $globals['site_shortname'] . $globals['v']; if (memcache_mprint($key)) { return; } echo '<!-- Calculating ' . __FUNCTION__ . ' -->'; $min_date = date("Y-m-d H:i:00", $globals['now'] - 86400); // about 24 hours $res = $db->get_results("select post_id from posts, users where post_date > '{$min_date}' and post_user_id = user_id and post_karma > 0 order by post_karma desc limit 10"); if ($res) { $objects = array(); $title = _('mejores notas'); $url = post_get_base_url('_best'); foreach ($res as $p) { $obj = new stdClass(); $post = new Post(); $post->id = $p->post_id; $post->read(); $obj->id = $post->id; $obj->link = post_get_base_url() . $post->id; $obj->user_id = $post->author; $obj->avatar = $post->avatar; $obj->title = text_to_summary($post->clean_content(), 80); $obj->username = $post->username; $obj->tooltip = 'p'; $objects[] = $obj; } $vars = compact('objects', 'title', 'url'); $output = Haanga::Load('best_comments_posts.html', $vars, true); echo $output; memcache_madd($key, $output, 300); } }
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 do_best_posts() { global $db, $globals, $dblang; if ($globals['mobile']) { return; } $output = ''; $key = 'best_posts_' . $globals['css_main']; if (memcache_mprint($key)) { return; } $min_date = date("Y-m-d H:i:00", $globals['now'] - 86400); // about 24 hours $res = $db->get_results("select post_id from posts, users where post_date > '{$min_date}' and post_user_id = user_id and post_karma > 0 order by post_karma desc limit 10"); if ($res) { $output .= '<div class="sidebox"><div class="header"><h4><a href="' . post_get_base_url('_best') . '">' . _('mejores notas') . '</a></h4></div><div class="comments"><ul>' . "\n"; foreach ($res as $p) { $post = new Post(); $post->id = $p->post_id; $post->read(); $output .= '<li><img src="' . get_avatar_url($post->author, $post->avatar, 20) . '" alt="" width="20" height="20" class="avatar"/>'; $output .= '<p><strong>' . $post->username . '</strong>: <a onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_post_tooltip.php\', \'' . $post->id . '\', 10000);" href="' . post_get_base_url($post->username) . '/' . $post->id . '"><em>' . text_to_summary($post->clean_content(), 80) . '</em></a></p></li>' . "\n"; } $output .= '</ul></div></div>'; echo $output; memcache_madd($key, $output, 300); } }
function do_user_tabs($option, $user, $has_subheader = false) { global $globals, $current_user; $active = array(); $active[$option] = ' class="tabsub-this"'; if ($has_subheader) { echo '<ul class="tabsub" style="margin-bottom: 0">'."\n"; } else { echo '<ul class="tabsub">'."\n"; } echo '<li'.$active[1].'><a href="'.get_user_uri($user).'">'._('personal'). '</a></li>'; // echo '<li'.$active[8].'><a href="'.get_user_uri($user, 'categories').'">'._('personalización'). '</a></li>'; //echo '<li'.$active[9].'><a href="'.get_user_uri($user, 'conversation').'">'._('conversación'). '</a></li>'; echo '<li'.$active[7].'><a href="'.get_user_uri($user, 'friends').'"> <img src="'.$globals['base_static'].'img/common/icon_friend_bi_00.png" alt="amigos e ignorados" width="18" height="16" title="'._('amigos e ignorados').'"/> </a></li>'; echo '<li'.$active[2].'><a href="'.get_user_uri($user, 'history').'">'._('enlaces'). '</a></li>'; //echo '<li'.$active[6].'><a href="'.get_user_uri($user, 'favorites').'"> '.FAV_YES. ' </a></li>'; echo '<li'.$active[3].'><a href="'.get_user_uri($user, 'commented').'">'._('comentarios'). '</a></li>'; //echo '<li'.$active[4].'><a href="'.get_user_uri($user, 'shaken').'">'._('votadas'). '</a></li>'; echo '<li><a href="'.post_get_base_url($user).'">'._('notas'). ' →</a></li>'; echo '</ul>'; }
function get_post($time, $type, $postid, $userid) { global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items; $event = $db->get_row("select user_login, post_user_id, post_content, media.size as media_size from posts LEFT JOIN media ON (media.type='post' and media.id = posts.post_id and media.version = 0), users where post_id = {$postid} and user_id={$userid}"); if (!$event) { return; } $json['link'] = post_get_base_url($postid); $json['ts'] = $time; $json['type'] = $type; $json['who'] = $event->user_login; $json['status'] = _('nótame'); $json['title'] = put_smileys(text_to_summary(preg_replace('/(@[\\S.-]+)(,\\d+)/', '$1', $event->post_content), 130)); if (mb_strlen(trim($json['title'])) == 0) { $json['title'] = '...'; } $json['votes'] = 0; $json['com'] = 0; $json['uid'] = $userid; $json['id'] = $postid; if ($userid > 0) { $json['icon'] = get_avatar_url($userid, -1, 20); } if ($event->media_size > 0) { $json['thumb'] = $globals['base_static'] . Upload::get_cache_relative_dir($postid) . "/media_thumb-post-{$postid}.jpg"; } $key = $time . ':' . $type . ':' . $postid; $events[$key] = $json; if ($time > $last_timestamp) { $last_timestamp = $time; } }
case 'sent': $where = "privates.user = {$current_user->user_id}"; $order_by = "ORDER BY date desc"; $limit = "LIMIT {$offset},{$page_size}"; $view = 1; break; default: $where = "privates.to = {$current_user->user_id}"; $order_by = "ORDER BY date desc"; $limit = "LIMIT {$offset},{$page_size}"; $view = 0; User::reset_notification($current_user->user_id, 'private'); } $rows = $db->get_var("select count(*) from privates where {$where}"); do_header($page_title, _('privados'), get_posts_menu(5, $user->username)); $options = array(_('recibidos') => post_get_base_url('_priv'), _('enviados') => post_get_base_url('_priv') . '/sent'); do_priv_subheader($options, $view); /*** SIDEBAR ****/ echo '<div id="sidebar">'; do_banner_right(); //do_best_stories(); if ($rows > 20) { do_best_posts(); do_best_comments(); } echo '</div>' . "\n"; /*** END SIDEBAR ***/ echo '<div id="newswrap"><!-- sneakme/priv.php -->' . "\n"; if (check_email($current_user->user_email)) { Haanga::Load('priv_notify.html'); }
do_redirection($url); exit(0); case 'posts': $url = post_get_base_url($current_user->user_login) . '/_conversation'; do_redirection($url); exit(0); case 'comments': $url = get_user_uri($current_user->user_login, 'conversation'); do_redirection($url); exit(0); case 'friends': $url = get_user_uri($current_user->user_login, 'friends_new'); do_redirection($url); exit(0); case 'post': $url = $globals['scheme'] . '//' . get_server_name() . post_get_base_url($id); do_redirection($url); exit(0); case 'comment': $c = new Comment(); $c->id = $id; $url = $globals['scheme'] . '//' . get_server_name() . $c->get_relative_individual_permalink(); do_redirection($url); exit(0); default: $l = Link::from_db($id, null, false); if (!$l) { exit(0); } if (!$globals['mobile'] && !$globals['mobile_version'] && !empty($l->url) && $current_user->user_id > 0 && (empty($globals['https']) || preg_match('/^https:/', $l->url)) && User::get_pref($current_user->user_id, 'use_bar') && $db->get_var("select blog_type from blogs where blog_id = {$l->blog}") != 'noiframe') { $url = $globals['scheme'] . '//' . get_server_name() . $globals['base_url'] . 'b/' . $id;
function get_post($time, $type, $postid, $userid) { global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items; $event = $db->get_row("select SQL_CACHE user_login, post_user_id, post_content from posts, users where post_id = {$postid} and user_id={$userid}"); if (!$event) { return; } $json['link'] = post_get_base_url($event->user_login) . "/{$postid}"; $json['ts'] = $time; $json['type'] = $type; $json['who'] = $event->user_login; $json['status'] = _('nótame'); $json['title'] = put_smileys(text_to_summary(preg_replace('/(@[\\S.-]+)(,\\d+)/', '$1', $event->post_content), 130)); $json['votes'] = 0; $json['com'] = 0; $json['uid'] = $userid; $json['id'] = $postid; if ($userid > 0) { $json['icon'] = get_avatar_url($userid, -1, 20); } $key = $time . ':' . $type . ':' . $postid; $events[$key] = $json; if ($time > $last_timestamp) { $last_timestamp = $time; } }
do_header($page_title, _('nótame'), get_posts_menu($tab_option, $user->username)); $conversation_extra = ''; if ($tab_option == 4) { if ($current_user->user_id == $user->id) { //$conversation_extra = ' ['.Post::get_unread_conversations($user->id).']'; $conversation_extra = ' [<span id="p_c_counter">0</span>]'; $whose = _('mías'); } else { $whose = _('suyas'); } $options = array($whose => post_get_base_url($user->username), _('amigos') => post_get_base_url("{$user->username}/_friends"), _('favoritos') => post_get_base_url("{$user->username}/_favorites"), _('conversación') . $conversation_extra => post_get_base_url("{$user->username}/_conversation"), sprintf(_('debates con %s'), $user->username) => $globals['base_url'] . "between.php?type=posts&u1={$current_user->user_login}&u2={$user->username}", sprintf(_('perfil de %s'), $user->username) => get_user_uri($user->username)); } elseif ($tab_option == 1 && $current_user->user_id > 0) { //$conversation_extra = ' ['.Post::get_unread_conversations($user->id).']'; $conversation_extra = ' [<span id="p_c_counter">0</span>]'; $view = 0; $options = array(_('todas') => post_get_base_url(''), _('amigos') => post_get_base_url("{$current_user->user_login}/_friends"), _('favoritos') => post_get_base_url("{$current_user->user_login}/_favorites"), _('conversación') . $conversation_extra => post_get_base_url("{$current_user->user_login}/_conversation"), _('últimas imágenes') => "javascript:fancybox_gallery('post');", _('debates') . ' →' => $globals['base_url'] . "between.php?type=posts&u1={$current_user->user_login}"); } else { $options = false; } do_post_subheader($options, $view, $rss_option); /*** SIDEBAR ****/ echo '<div id="sidebar">'; do_banner_right(); //do_best_stories(); if ($rows > 20) { do_best_posts(); do_best_comments(); do_last_blogs(); } do_banner_promotions(); echo '</div>' . "\n";
function get_post($time, $type, $postid, $userid) { global $db, $current_user, $events, $last_timestamp, $foo_link, $max_items; $event = $db->get_row("select user_login, post_user_id, post_content from posts, users where post_id = {$postid} and user_id={$userid}"); if (!$event) { return; } // Dont show her notes if the user ignored if ($type == 'post' && friend_exists($current_user->user_id, $userid) < 0) { return; } $json['link'] = post_get_base_url($event->user_login) . "/{$postid}"; $json['ts'] = $time; $json['type'] = $type; $json['who'] = addslashes($event->user_login); $json['status'] = _('nótame'); $json['title'] = addslashes(text_to_summary($event->post_content, 130)); $json['votes'] = 0; $json['com'] = 0; $json['uid'] = $userid; $json['id'] = $postid; if ($userid > 0) { $json['icon'] = get_avatar_url($userid, -1, 20); } $key = $time . ':' . $type . ':' . $postid; $events[$key] = json_encode_single($json); if ($time > $last_timestamp) { $last_timestamp = $time; } }