function print_summary($type = 'full', $karma_best_comment = 0, $show_tags = true) { global $current_user, $current_user, $globals, $db; if (!$this->read) { return; } $this->is_votable(); switch ($this->status) { case 'queued': // another color box for not-published $box_class = 'mnm-queued'; break; case 'abuse': // another color box for discarded // another color box for discarded case 'autodiscard': // another color box for discarded // another color box for discarded case 'discard': // another color box for discarded $box_class = 'mnm-discarded'; break; case 'published': // default for published // default for published default: $box_class = 'mnm-published'; break; } $this->has_warning = !(!$this->check_warn() || $this->is_discarded()); $this->is_editable = $this->author == $current_user->user_id && $this->is_editable(); $this->total_votes = $this->votes + $this->anonymous; $this->rpermalink = $this->get_relative_permalink(); $this->author_html = '<a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a>'; $this->normal_link = preg_replace('/\\/mobile\\//', '/', $this->get_relative_permalink()); $this->show_shakebox = $type != 'preview' && $this->votes > 0; $this->thumb_url = $this->has_thumb(); if ($this->status == 'abuse' || $this->has_warning) { $this->negative_text = FALSE; $negatives = $db->get_row("select SQL_CACHE vote_value, count(vote_value) as count from votes where vote_type='links' and vote_link_id={$this->id} and vote_value < 0 group by vote_value order by count desc limit 1"); if ($negatives->count > 2 && $negatives->count >= $this->negatives / 2 && ($negatives->vote_value == -6 || $negatives->vote_value == -8)) { $this->negative_text = get_negative_vote($negatives->vote_value); } } $text = $this->content; $my_domain = get_server_name(); $parent_domain = preg_replace('/m\\./', '', $my_domain); if ($parent_domain != $my_domain && preg_match('#[^\\.]' . preg_quote($parent_domain) . '/#', $text)) { $text = preg_replace('#([^\\.])' . preg_quote($parent_domain) . '/#', "\$1{$my_domain}/", $text); } $vars = compact('type', 'karma_best_comment', 'show_tags', 'box_class', 'nofollow', 'url', 'text'); $vars['self'] = $this; return Haanga::Load('mobile/link_summary.html', $vars); }
function print_summary($link = 0, $length = 0, $single_link = true) { global $current_user, $globals; if (!$this->read) { return; } echo '<li id="c-' . $this->order . '">'; $this->hidden = $this->karma < -80 || $this->user_level == 'disabled' && $this->type != 'admin'; 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->link_permalink = $link->get_relative_permalink(); echo '<div class="' . $comment_class . '">'; echo '<strong>#' . $this->order . '</strong>'; echo ' <span id="cid-' . $this->id . '">'; if ($this->hidden && ($current_user->user_comment_pref & 1) == 0) { echo '» <a href="javascript:load_html(\'get_commentmobile.php\',\'comment\',\'cid-' . $this->id . '\',0,' . $this->id . ')" title="' . _('ver comentario') . '">' . _('ver comentario') . '</a>'; } else { $this->print_text($length); } echo '</span></div>'; // The comments info bar echo '<div class="' . $comment_meta_class . '">'; 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> '; } printf(_('por %s el %s'), $author, get_date_time($this->date)); // Check that the user can vote if ($this->type != 'admin' && $this->user_level != 'disabled') { echo ' ' . _('votos') . ': <span id="vc-' . $this->id . '">' . $this->votes . '</span>, ' . _('karma') . ': <span id="vk-' . $this->id . '">' . $this->karma . '</span>'; } echo '</div>'; echo "</li>\n"; }
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 show_profile() { global $user, $user_levels, $globals, $site_key, $current_user; echo '<div>'; echo '<form enctype="multipart/form-data" action="' . get_auth_link() . 'profile.php" method="post" id="thisform" AUTOCOMPLETE="off">'; echo '<fieldset><legend>'; echo '<span class="sign">' . _('opciones de usuario') . " <a href='" . get_user_uri($user->username) . "'>{$user->username}</a>: {$user->level}</span></legend>"; echo '<img class="thumbnail" src="' . $globals['base_url'] . 'backend/get_avatar.php?id=' . $user->id . '&size=80&t=' . time() . '" width="80" height="80" alt="' . $user->username . '" />'; echo '<input type="hidden" name="process" value="1" />'; echo '<input type="hidden" name="user_id" value="' . $user->id . '" />'; echo '<input type="hidden" name="form_hash" value="' . md5($site_key . $user->id . mnminclude) . '" />'; get_form_auth_ip(); echo '<p><label>' . _('usuario') . ':</label><br/>'; echo '<input type="text" autocomplete="off" name="username" id="username" value="' . $user->username . '"/>'; echo '</p>'; echo '<p><label>' . _('nombre real') . ':</label><br/>'; echo '<input type="text" autocomplete="off" name="names" id="names" value="' . $user->names . '"/>'; echo '</p>'; echo '<p><label>' . _('correo electrónico') . ':</label><br/>'; echo '<input type="text" autocomplete="off" name="email" id="email" value="' . $user->email . '"/>'; echo '</p>'; echo '<p><label>' . _('página web') . ':</label><br/>'; echo '<input type="text" autocomplete="off" name="url" id="url" value="' . $user->url . '" />'; echo '</p>'; if (is_avatars_enabled()) { echo '<input type="hidden" name="MAX_FILE_SIZE" value="300000" />'; echo '<p><label>' . _('avatar') . ':</label><br/>'; echo '<input type="file" autocomplete="off" name="image" />'; echo '</p>'; } echo '<p><label for="password">' . _("nueva clave") . ':</label><br />' . "\n"; echo '<input type="password" autocomplete="off" id="password" name="password" size="25" onkeyup="return securePasswordCheck(this.form.password);"/></p>' . "\n"; echo '<p><label for="verify">' . _("repite la clave") . ': </label><br />' . "\n"; echo '<input type="password" autocomplete="off" id="verify" name="password2" size="25" onkeyup="checkEqualFields(this.form.password2, this.form.password)"/></p>' . "\n"; echo '<p><input type="submit" name="save_profile" value="' . _('actualizar') . '"/></p>'; echo '</fieldset>'; echo "</form></div>\n"; }
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, $id = 'home') { global $current_user, $dblang, $globals, $greetings; check_auth_page(); header('Content-Type: text/html; charset=utf-8'); http_cache(); if (!empty($globals['link_id'])) { // Pingback autodiscovery // http://www.hixie.ch/specs/pingback/pingback header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php'); } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; //echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n"; echo '<head>' . "\n"; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n"; echo '<meta name="ROBOTS" content="NOARCHIVE" />' . "\n"; echo "<title>{$title}</title>\n"; do_css_includes(); echo '<meta name="generator" content="meneame" />' . "\n"; if ($globals['noindex']) { echo '<meta name="robots" content="noindex,follow"/>' . "\n"; } if ($globals['tags']) { echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n"; } if ($globals['description']) { echo '<meta name="description" content="' . $globals['description'] . '" />' . "\n"; } if ($globals['link']) { echo '<link rel="pingback" href="http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php"/>' . "\n"; } echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n"; echo '<link rel="search" type="application/opensearchdescription+xml" title="' . _("menéame search") . '" href="http://' . get_server_name() . $globals['base_url'] . 'opensearch_plugin.php"/>' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n"; if (!$globals['favicon']) { $globals['favicon'] = 'img/favicons/favicon4.ico'; } echo '<link rel="shortcut icon" href="' . $globals['base_static'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n"; do_js_includes(); if ($globals['thumbnail']) { // WARN: It's assumed a thumbanil comes with base_url included $thumb = $globals['thumbnail']; } else { $thumb = 'http://' . get_static_server_name() . $globals['base_url'] . $globals['thumbnail_logo']; } echo '<meta name="thumbnail_url" content="' . $thumb . "\"/>\n"; echo '<link rel="image_src" href="' . $thumb . "\"/>\n"; if ($globals['extra_head']) { echo $globals['extra_head']; } echo '</head>' . "\n"; echo "<body id=\"{$id}\" " . $globals['body_args'] . ">\n"; echo '<div id="wrap">' . "\n"; echo '<div id="header">' . "\n"; echo '<a href="' . $globals['base_url'] . '" title="' . _('inicio') . '" id="logo">' . _("menéame") . '</a>' . "\n"; echo '<ul id="headtools">' . "\n"; // Main search form echo '<li class="searchbox">' . "\n"; echo '<form action="' . $globals['base_url'] . 'search.php" method="get" name="top_search">' . "\n"; echo '<img src="' . $globals['base_static'] . 'img/common/search-left-04.png" width="6" height="22" alt=""/>'; if (!empty($_REQUEST['q'])) { echo '<input type="text" name="q" value="' . htmlspecialchars($_REQUEST['q']) . '" />'; } else { echo '<input name="q" value="' . _('buscar') . '..." type="text" onblur="if(this.value==\'\') this.value=\'' . _('buscar') . '...\';" onfocus="if(this.value==\'' . _('buscar') . '...\') this.value=\'\';"/>'; } echo '<a href="javascript:document.top_search.submit()"><img class="searchIcon" alt="' . _('buscar') . '" src="' . $globals['base_static'] . 'img/common/search-04.png" id="submit_image" width="28" height="22"/></a>' . "\n"; if ($globals['search_options']) { foreach ($globals['search_options'] as $name => $value) { echo '<input type="hidden" name="' . $name . '" value="' . $value . '"/>' . "\n"; } } echo '</form>'; echo '</li>' . "\n"; // form echo '<li><a href="http://meneame.wikispaces.com/Comenzando">' . _('ayuda') . ' <img src="' . $globals['base_static'] . 'img/common/help-bt-02.png" alt="help button" title="' . _('ayuda') . '" width="13" height="16" /></a></li>'; if ($current_user->admin) { echo '<li><a href="' . $globals['base_url'] . 'admin/bans.php">admin <img src="' . $globals['base_static'] . 'img/common/tools-bt-02.png" alt="tools button" title="herramientas" width="16" height="16" /> </a></li>' . "\n"; } if ($current_user->authenticated) { $randhello = array_rand($greetings, 1); echo '<li><a href="' . get_user_uri($current_user->user_login) . '" title="' . _('menéame te saluda en ') . $greetings[$randhello] . '">' . $randhello . ' ' . $current_user->user_login . ' <img src="' . get_avatar_url($current_user->user_id, $current_user->user_avatar, 20) . '" width="20" height="20" alt="' . $current_user->user_login . '"/></a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('cerrar sesión') . ' <img src="' . $globals['base_static'] . 'img/common/logout-bt-02.png" alt="" title="logout" width="22" height="16" /></a></li>' . "\n"; } else { echo '<li><a href="' . $globals['base_url'] . 'register.php">' . _('registrarse') . ' <img src="' . $globals['base_static'] . 'img/common/register-bt-02.png" alt="" title="register" width="16" height="18" /></a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . ' <img src="' . $globals['base_static'] . 'img/common/login-bt-02.png" alt="" title="login" width="22" height="16" /></a></li>' . "\n"; } //echo '<li><a href="'.$globals['base_url'].'faq-'.$dblang.'.php">' . _('acerca de menéame').'</a></li>' . "\n"; echo '</ul>' . "\n"; echo '</div>' . "\n"; echo '<div id="naviwrap">' . "\n"; echo '<ul>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'submit.php">' . _('enviar noticia') . '</a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'shakeit.php">' . _('pendientes') . '</a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'sneak.php">' . _('fisgona') . '</a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'notame/">' . _('nótame') . '</a></li>' . "\n"; echo '</ul></div>' . "\n"; do_banner_top(); echo '<div id="container">' . "\n"; }
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>'; }
</div> <?php if (!$isrunning) { ?> <div class="box"> <h2><?php echo __("Voters"); ?> </h2> <ul> <?php foreach ($whovoted as $voter) { ?> <li><a href="<?php echo get_user_uri($voter); ?> "><?php echo htmlspecialchars($voter); ?> </a></li> <?php } ?> </ul> </div> <?php } ?> <div class="box">
function do_categories() { global $globals, $current_user, $db, $user, $login; $options = array(); $options[$user->username] = get_user_uri($user->username); $options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories'); if ($current_user->user_id == $user->id || $current_user->user_level == 'god') { $options[_('modificar perfil') . ' →'] = $globals['base_url'] . 'profile.php?login='******'rss2.php?personal=' . $user->id, _('categorías personalizadas en rss2')); if (is_array($_POST['categories'])) { $db->query("delete from prefs where pref_user_id = {$current_user->user_id} and pref_key = 'category_" . SitesMgr::my_id() . "'"); $total = count(SitesMgr::get_categories()); if (count($_POST['categories']) < $total) { for ($i = 0; $i < count($_POST['categories']); $i++) { $cat = intval($_POST['categories'][$i]); $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ({$current_user->user_id}, 'category_" . SitesMgr::my_id() . "', {$cat})"); } } } print_categories_checkboxes($user); }
} $prefered_page_size = 20; $prefered_offset = ($prefered_page - 1) * $prefered_page_size; switch ($prefered_type) { case 'friends': $prefered_total = $db->get_var("SELECT count(*) FROM friends WHERE friend_type='affiliate' AND friend_from={$prefered_id} AND friend_to !=0"); $dbusers = $db->get_results("SELECT friend_to as who, friend_value FROM friends WHERE friend_type='affiliate' AND friend_from={$prefered_id} AND friend_to !=0 ORDER BY friend_value DESC LIMIT {$prefered_offset},{$prefered_page_size}"); break; case 'voters': $prefered_total = $db->get_var("SELECT count(*) FROM friends WHERE friend_type='affiliate' AND friend_to={$prefered_id} AND friend_from !=0"); $dbusers = $db->get_results("SELECT friend_from as who, friend_value FROM friends WHERE friend_type='affiliate' AND friend_to={$prefered_id} AND friend_from !=0 ORDER BY friend_value DESC LIMIT {$prefered_offset},{$prefered_page_size}"); break; } if ($dbusers) { $friend = new User(); echo '<div class="voters-list">'; foreach ($dbusers as $dbuser) { $friend->id = $dbuser->who; $value = $dbuser->friend_value * 100; $value = sprintf("%6.2f", $value); $friend->read(); echo '<div class="item">'; echo '<a href="' . get_user_uri($friend->username) . '" title="' . $value . ' %">'; echo '<img src="' . get_avatar_url($friend->id, $friend->avatar, 20) . '" width="20" height="20" alt="' . $friend->username . '"/>'; echo $friend->username . '</a>'; echo '</div>'; echo "\n"; } echo '</div>'; do_contained_pages($prefered_id, $prefered_total, $prefered_page, $prefered_page_size, 'get_prefered.php', $prefered_type, $prefered_type . '-container'); }
<p> <?php echo __('You can use this form to permanently delete the AUR account %s.', '<strong>' . htmlspecialchars($username) . '</strong>'); ?> </p> <p> <?php echo __('%sWARNING%s: This action cannot be undone.', '<strong>', '</strong>'); ?> </p> <form id="edit-profile-form" action="<?php echo get_user_uri($username) . 'delete/'; ?> " method="post"> <fieldset> <input type="hidden" name="Action" value="<?php echo $A; ?> " /> <input type="hidden" name="ID" value="<?php echo $UID; ?> " /> <input type="hidden" name="token" value="<?php echo htmlspecialchars($_COOKIE['AURSID']); ?> " /> </fieldset> <fieldset> <p><label class="confirmation"><input type="checkbox" name="confirm" value="1" />
function do_friends($option) { global $db, $user, $globals, $current_user; $header_options = array(_('amigos') => get_user_uri($user->username, 'friends'), _('elegido por') => get_user_uri($user->username, 'friend_of')); if ($user->id == $current_user->user_id) { $header_options[_('ignorados')] = get_user_uri($user->username, 'ignored'); $header_options[_('nuevos')] = get_user_uri($user->username, 'friends_new'); } $prefered_id = $user->id; $prefered_admin = $user->admin; switch ($option) { case 3: do_user_subheader($header_options, $option); $prefered_type = 'new'; break; case 2: do_user_subheader($header_options, $option); $prefered_type = 'ignored'; break; case 1: $prefered_type = 'to'; do_user_subheader($header_options, $option); break; default: do_user_subheader($header_options, $option, 'rss?friends_of=' . $user->id, _('envíos de amigos en rss2')); $prefered_type = 'from'; } echo '<div style="padding: 5px 0px 10px 5px">'; echo '<div id="' . $prefered_type . '-container">' . "\n"; require 'backend/get_friends_bars.php'; echo '</div>' . "\n"; echo '</div>' . "\n"; // Post processing switch ($option) { case 3: if ($user->id == $current_user->user_id) { User::update_new_friends_date(); } break; default: } }
function do_header($title, $id = 'home') { global $current_user, $dblang, $globals; check_auth_page(); header('Content-type: text/html; charset=utf-8'); http_cache(); //echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">' . "\n"; echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '">' . "\n"; echo '<head>' . "\n"; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n"; echo '<meta name="ROBOTS" content="NOARCHIVE" />' . "\n"; echo '<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>' . "\n"; echo "<title>{$title}</title>\n"; do_css_includes(); echo '<meta name="generator" content="meneame mobile" />' . "\n"; if (!empty($globals['noindex'])) { echo '<meta name="robots" content="noindex,follow"/>' . "\n"; } if (!empty($globals['tags'])) { echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n"; } if (empty($globals['favicon'])) { $globals['favicon'] = 'img/favicons/favicon4.ico'; } echo '<link rel="icon" href="' . $globals['base_static'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n"; echo '<link rel="apple-touch-icon" href="' . $globals['base_static'] . 'img/favicons/apple-touch-icon.png"/>' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n"; if ($globals['extra_head']) { echo $globals['extra_head']; } echo '</head>' . "\n"; echo "<body id=\"{$id}\" " . $globals['body_args'] . ">\n"; echo '<div id="header">' . "\n"; echo '<a href="' . $globals['base_url'] . '" title="' . _('inicio') . '" id="logo">' . _("menéame") . '</a>' . "\n"; echo '<ul id="headtools">'; echo '<li><a href="' . $globals['base_url'] . 'search.php">' . _('buscar') . '</a></li>'; if ($current_user->authenticated) { echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('logout') . '</a></li>'; echo '<li class="noborder"><a href="' . get_user_uri($current_user->user_login) . '" title="' . $current_user->user_login . '"><img src="' . get_avatar_url($current_user->user_id, $current_user->user_avatar, 20) . '" width="20" height="20" alt="' . $current_user->user_login . '"/></a></li>'; } else { echo '<li class="noborder"><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . '</a></li>'; } echo '</ul>' . "\n"; echo '</div>' . "\n"; do_banner_top_mobile(); echo '<div id="container">' . "\n"; }
function to_html($string, $fancy = true) { global $globals; $string = nl2br($string, true); $regexp = '#[^\\s\\.\\,\\:\\;\\¡\\!\\)\\-<>&\\?]{1,42}'; if ($fancy) { // Add smileys $regexp .= '|\\{\\S{3,14}\\}'; } if (is_a($this, 'Post')) { // references to @users $regexp .= '|@[\\p{L}\\.\\_][\\.\\d\\-_\\p{L}]+(?:,\\d+){0,1}'; } elseif (is_a($this, 'Comment')) { $regexp .= '|@[\\p{L}\\.][\\.\\d\\-_\\p{L}]+\\w'; } $regexp .= '|(https{0,1}:\\/\\/)([^\\s<>]{5,500}[^\\s<>,;:\\.])'; $regexp .= '|\\|([\\p{L}\\d_]+)'; $regexp = '/([\\s\\(\\[{}¡;,:¿>\\*]|^)(' . $regexp . ')/Smu'; $callback = function ($matches) { global $globals; switch ($matches[2][0]) { case '#': if (preg_match('/^#\\d+$/', $matches[2])) { $id = substr($matches[2], 1); if (is_a($this, 'Comment')) { if ($id > 0) { return $matches[1] . '<a class="tooltip c:' . $this->link . '-' . $id . '" href="' . $this->link_permalink . '/c0' . $id . '#c-' . $id . '" rel="nofollow">#' . $id . '</a>'; } else { return $matches[1] . '<a class="tooltip l:' . $this->link . '" href="' . $this->link_permalink . '" rel="nofollow">#' . $id . '</a>'; } } elseif (is_a($this, 'Link')) { return $matches[1] . '<a class="tooltip c:' . $this->id . '-' . $id . '" href="' . $this->get_permalink() . '/c0' . $id . '#c-' . $id . '" rel="nofollow">#' . $id . '</a>'; } } else { switch (get_class($this)) { case 'Link': $w = 'links'; break; case 'Comment': $w = 'comments'; break; case 'Post': $w = 'posts'; break; } return $matches[1] . '<a href="' . $globals['base_url'] . 'search?w=' . $w . '&q=%23' . substr($matches[2], 1) . '&o=date">#' . substr($matches[2], 1) . '</a>'; } break; case '@': $ref = substr($matches[2], 1); if (is_a($this, 'Post')) { $a = explode(',', $ref); if (count($a) > 1) { $user = $a[0]; $id = ',' . $a[1]; } else { $user = $ref; $id = ''; } $user_url = urlencode($user); return $matches[1] . "<a class='tooltip p:{$user_url}{$id}-{$this->date}' href='" . $globals['base_url'] . "backend/get_post_url?id={$user_url}{$id};" . $this->date . "'>@{$user}</a>"; } else { return $matches[1] . "<a class='tooltip u:{$ref}' href='" . get_user_uri($ref) . "'>@{$ref}</a>"; } break; case '{': $m = array($matches[2], substr($matches[2], 1, -1)); return $matches[1] . put_emojis_callback($m); case 'h': $suffix = ''; if (substr($matches[4], -1) == ')' && strrchr($matches[4], '(') === false) { $matches[4] = substr($matches[4], 0, -1); $suffix = ')'; } return $matches[1] . '<a href="' . $matches[3] . $matches[4] . '" title="' . $matches[4] . '" rel="nofollow">' . substr($matches[4], 0, 70) . '</a>' . $suffix; case '|': return $matches[1] . '<a href="' . $globals['base_url_general'] . 'm/' . $matches[5] . '">|' . $matches[5] . '</a>'; } return $matches[1] . $matches[2]; }; return preg_replace_callback($regexp, $callback, $string); }
<?php // 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 . 'html1-mobile.php'; $offset = (get_current_page() - 1) * $page_size; $url_args = $globals['path']; $login = clean_input_string($url_args[1]); if (empty($login)) { if ($current_user->user_id > 0) { header('Location: ' . get_user_uri($current_user->user_login)); die; } else { header('Location: ' . $globals['base_url']); die; } } $user = new User(); $user->username = $db->escape($login); if (!$user->read()) { not_found(); } do_header($login); echo '<div id="singlewrap">' . "\n"; $url_login = urlencode($login); do_profile();
function inline_friend_votes() { global $db, $current_user; $votes = $db->get_results("SELECT vote_user_id, vote_value, user_avatar, user_login, UNIX_TIMESTAMP(vote_date) as ts,inet_ntoa(vote_ip_int) as ip FROM votes, users, friends WHERE vote_type='links' and vote_link_id=$this->id AND vote_user_id=friend_to AND vote_user_id > 0 AND user_id = vote_user_id AND friend_type = 'manual' AND friend_from = $current_user->user_id AND friend_value > 0 AND vote_value > 0 AND vote_user_id != $this->author ORDER BY vote_date DESC"); if ($votes) { echo '<div style="padding: 3px 0 2px 0;">'; foreach ( $votes as $vote ){ $vote_detail .= ' '._('valor').": $vote->vote_value"; echo '<a href="'.get_user_uri($vote->user_login).'" title="'.$vote->user_login.': '.$vote_detail.'">'; echo '<img class="avatar" src="'.get_avatar_url($vote->vote_user_id, $vote->user_avatar, 40).'" width="40" height="40" alt=""/>'; echo '</a> '; $items++; } echo '</div>'; } }
?> <?php if (has_credential(CRED_ACCOUNT_SEARCH)) { ?> <li><a href="<?php echo get_uri('/accounts/'); ?> "><?php echo __("Accounts"); ?> </a></li> <?php } ?> <li><a href="<?php echo get_user_uri(username_from_sid($_COOKIE['AURSID'])) . 'edit/'; ?> "><?php echo __(" My Account"); ?> </a></li> <?php if (has_credential(CRED_TU_LIST_VOTES)) { ?> <li><a href="<?php echo get_uri('/tu/'); ?> "><?php echo __("Trusted User"); ?> </a></li><?php
function do_categories() { global $globals, $current_user, $db, $user, $login; $options = array(); $options[$user->username] = get_user_uri($user->username); $options[_('categorías personalizadas')] = get_user_uri($user->username, 'categories'); if ($current_user->user_id == $user->id || $current_user->user_level == 'god') { $options[_('modificar perfil').' →'] = $globals['base_url'].'profile.php?login='******'rss2.php?personal='.$user->id, _('categorías personalizadas en rss2')); if (is_array($_POST['categories'])) { $db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'category'"); $total = (int) $db->get_var("SELECT count(*) FROM categories WHERE category_parent != 0"); if (count($_POST['categories']) < $total) { for ($i=0; $i<count($_POST['categories']); $i++){ $cat = intval($_POST['categories'][$i]); $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ($current_user->user_id, 'category', $cat)"); } } } if ($_POST['comment_options_form']) { if ($_POST['karma_order']) { $db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'comment'"); $db->query("insert into prefs (pref_user_id, pref_key, pref_value) values ($current_user->user_id, 'comment', 'korder');"); // korder : karma_order } else { $db->query("delete from prefs where pref_user_id = $current_user->user_id and pref_key = 'comment'"); } } print_options_checkboxes($user); print_categories_checkboxes($user); }
function do_last($string) { global $db, $current_user; if (!$current_user->admin) { return false; } $list = ''; $res = $db->get_col("select user_login from users order by user_id desc limit 20"); if ($res) { foreach ($res as $user) { $list .= 'http://' . get_server_name() . get_user_uri($user) . ' '; } } return $list; }
} else { echo $items[$i]; } echo '</th>'; } echo '</tr>'; $user = new User(); $rows = $db->get_var("SELECT SQL_CACHE count(*) as count {$from_where}"); $users = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$page_size}"); if ($users) { foreach ($users as $dbuser) { $user->id = $dbuser->user_id; $user->read(); $user->all_stats(); echo '<tr>'; echo '<td style="font-size:100%"><a href="' . get_user_uri($user->username) . '"><img class="avatar" src="' . get_avatar_url($user->id, $user->avatar, 20) . '" width="20" height="20" alt="avatar" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $user->id . ');" onmouseout="tooltip.clear(event); " /> ' . $user->username . '</a></td>'; echo '<td class="short">' . $user->karma . ' '; $user->print_medals(); echo '</td>'; echo '<td class="short">' . $user->total_links . '</td>'; if ($user->total_links > 0) { echo '<td class="short">' . $user->published_links . ' (' . intval($user->published_links / $user->total_links * 100) . '%)</td>'; } else { echo '<td class="short">' . $user->published_links . ' (-)</td>'; } echo '<td class="short">' . $user->total_comments . '</td>'; echo '<td class="short">' . $user->total_votes . '</td>'; echo '</tr>'; } } echo "</table>\n\n";
function print_user_avatar($size = 40) { global $globals; echo '<a href="' . get_user_uri($this->username) . '" class="tooltip u:' . $this->author . '"><img class="avatar" src="' . get_avatar_url($this->author, $this->avatar, $size) . '" width="' . $size . '" height="' . $size . '" alt="' . $this->username . '"/></a>'; }
// Too much CPU and disk IO consuption echo '<a href="topusers.php?sortby=' . $i . '">' . $items[$i] . '</a>'; } else { echo $items[$i]; } echo '</th>'; } echo '</tr>'; $user = new User(); if ($users) { foreach ($users as $dbuser) { $user->id = $dbuser->user_id; $user->read(); $user->all_stats(); echo '<tr>'; echo '<td style="font-size:100%"><a href="' . get_user_uri($user->username) . '" class="tooltip u:' . $user->id . '"><img class="avatar" src="' . get_avatar_url($user->id, $user->avatar, 20) . '" width="20" height="20" alt="avatar"/> ' . $user->username . '</a></td>'; echo '<td class="short">' . $user->karma . ' '; $user->print_medals(); echo '</td>'; echo '<td class="short">' . $user->total_links . '</td>'; if ($user->total_links > 0) { echo '<td class="short">' . $user->published_links . ' (' . intval($user->published_links / $user->total_links * 100) . '%)</td>'; } else { echo '<td class="short">' . $user->published_links . ' (-)</td>'; } echo '<td class="short">' . $user->total_comments . '</td>'; echo '<td class="short">' . $user->total_votes . '</td>'; echo '</tr>'; } } echo "</table>\n\n";
$votes_page = intval($_GET['p']); } $votes_page_size = 40; $votes_offset = ($votes_page - 1) * $votes_page_size; $votes_users = $db->get_var("SELECT count(*) FROM league_votes WHERE match_id=" . $globals['match_id']); $sql = "SELECT \n league_votes.*, \n league_votes.date as vdate,\n user_avatar, \n score_visitor,\n score_local,\n m.date,\n user_login \nFROM \n league_votes, users, league_matches m\nWHERE \n m.id = {$globals['match_id']} \n AND m.id = match_id\n AND users.user_id = league_votes.user_id \nORDER BY league_votes.date DESC LIMIT {$votes_offset}, 40"; $votes = $db->get_results($sql); $globals['vote_values'] = array("empate", "al equipo local", "al equipo visitante"); if (!$votes) { return; } echo '<div class="game-voters-list">'; $win_class = ''; if (!empty($votes[0])) { if (strtotime($votes[0]->date) < time()) { $local = $votes[0]->score_local; $vis = $votes[0]->score_visitor; $win_class = $local == $vis ? 0 : ($local > $vis ? 1 : 2); } } foreach ($votes as $vote) { echo '<div class="item' . ($vote->value == $win_class ? ' winner' : '') . '">'; $vote_detail = _('votó') . " " . $globals['vote_values'][$vote->value]; $vote_detail .= ' ' . _('el') . date(" d-m-Y, H:i:s", strtotime($vote->vdate)); echo '<a href="' . get_user_uri($vote->user_login) . '" title="' . $vote_detail . '">'; echo '<img class="avatar" src="' . get_avatar_url($vote->user_id, $vote->user_avatar, 20) . '" width="20" height="20" alt=""/>'; echo $vote->user_login . '</a>'; echo '</div>'; } echo "</div>\n"; do_contained_pages($globals['match_id'], $votes_users, $votes_page, $votes_page_size, 'league_meneos.php', 'voters', 'voters-container-' . $globals['match_id']);
function save_profile() { global $db, $user, $current_user, $globals, $admin_mode, $site_key, $bio_max; $errors = 0; // benjami: control added (2005-12-22) $new_pass = false; $messages = array(); $form_hash = md5($site_key . $user->id . $current_user->user_id); if (isset($_POST['disabledme']) && intval($_POST['disable']) == 1 && $_POST['form_hash'] == $form_hash && $_POST['user_id'] == $current_user->user_id) { $old_user_login = $user->username; $old_user_id = $user->id; $user->disable(true); Log::insert('user_delete', $old_user_id, $old_user_id); syslog(LOG_NOTICE, "Meneame, disabling {$old_user_id} ({$old_user_login}) by {$current_user->user_login} -> {$user->username} "); $current_user->Logout(get_user_uri($user->username)); die; } if (!isset($_POST['save_profile']) || !isset($_POST['process']) || $_POST['user_id'] != $current_user->user_id && !$admin_mode) { return; } if (empty($_POST['form_hash']) || $_POST['form_hash'] != $form_hash) { array_push($messages, _('Falta la clave de control')); $errors++; } if (!empty($_POST['username']) && trim($_POST['username']) != $user->username) { $newname = trim($_POST['username']); if (strlen($newname) < 3) { array_push($messages, _('nombre demasiado corto')); $errors++; } if (!check_username($newname)) { array_push($messages, _('nombre de usuario erróneo, caracteres no admitidos')); $errors++; } elseif (user_exists($newname, $user->id)) { array_push($messages, _('el usuario ya existe')); $errors++; } else { $user->username = $newname; } } if (!empty($_POST['bio']) || $user->bio) { $bio = clean_text($_POST['bio'], 0, false, $bio_max); if ($bio != $user->bio) { $user->bio = $bio; } } if ($user->email != trim($_POST['email']) && !check_email(trim($_POST['email']))) { array_push($messages, _('el correo electrónico no es correcto')); $errors++; } elseif (!$admin_mode && trim($_POST['email']) != $current_user->user_email && email_exists(trim($_POST['email']), false)) { array_push($messages, _('ya existe otro usuario con esa dirección de correo')); $errors++; } else { $user->email = trim($_POST['email']); } $user->url = htmlspecialchars(clean_input_url($_POST['url'])); // Check IM address if (!empty($_POST['public_info'])) { $_POST['public_info'] = htmlspecialchars(clean_input_url($_POST['public_info'])); $public = $db->escape($_POST['public_info']); $im_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_public_info='{$public}'")); if ($im_count > 0) { array_push($messages, _('ya hay otro usuario con la misma dirección de MI, no se ha grabado')); $_POST['public_info'] = ''; $errors++; } } $user->phone = $_POST['phone']; $user->public_info = htmlspecialchars(clean_input_url($_POST['public_info'])); // End check IM address if ($user->id == $current_user->user_id) { // Check phone number if (!empty($_POST['phone'])) { if (!preg_match('/^\\+[0-9]{9,16}$/', $_POST['phone'])) { array_push($messages, _('número telefónico erróneo, no se ha grabado')); $_POST['phone'] = ''; $errors++; } else { $phone = $db->escape($_POST['phone']); $phone_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_phone='{$phone}'")); if ($phone_count > 0) { array_push($messages, _('ya hay otro usuario con el mismo número, no se ha grabado')); $_POST['phone'] = ''; $errors++; } } } $user->phone = $_POST['phone']; // End check phone number } // Verifies adsense code if ($globals['external_user_ads']) { $_POST['adcode'] = trim($_POST['adcode']); $_POST['adchannel'] = trim($_POST['adchannel']); if (!empty($_POST['adcode']) && $user->adcode != $_POST['adcode']) { if (!preg_match('/pub-[0-9]{16}$/', $_POST['adcode'])) { array_push($messages, _('código AdSense incorrecto, no se ha grabado')); $_POST['adcode'] = ''; $errors++; } else { $adcode_count = intval($db->get_var("select count(*) from users where user_id != {$user->id} and user_level != 'disabled' and user_level != 'autodisabled' and user_adcode='" . $_POST['adcode'] . "'")); if ($adcode_count > 0) { array_push($messages, _('ya hay otro usuario con la misma cuenta, no se ha grabado')); $_POST['adcode'] = ''; $errors++; } } } if (!empty($_POST['adcode']) && !empty($_POST['adchannel']) && $user->adchannel != $_POST['adchannel']) { if (!preg_match('/^[0-9]{10,12}$/', $_POST['adchannel'])) { array_push($messages, _('canal AdSense incorrecto, no se ha grabado')); $_POST['adchannel'] = ''; $errors++; } } $user->adcode = $_POST['adcode']; $user->adchannel = $_POST['adchannel']; } $user->names = clean_text($_POST['names']); if (!empty($_POST['password']) || !empty($_POST['password2'])) { if (!check_password($_POST["password"])) { array_push($messages, _('Clave demasiado corta, debe ser de 6 o más caracteres e incluir mayúsculas, minúsculas y números')); $errors = 1; } else { if (trim($_POST['password']) !== trim($_POST['password2'])) { array_push($messages, _('las claves no son iguales, no se ha modificado')); $errors = 1; } else { $new_pass = trim($_POST['password']); $user->pass = UserAuth::hash($new_pass); array_push($messages, _('La clave se ha cambiado')); $pass_changed = true; } } } if ($admin_mode && !empty($_POST['user_level'])) { $user->level = $db->escape($_POST['user_level']); } if ($admin_mode && !empty($_POST['karma']) && is_numeric($_POST['karma']) && $_POST['karma'] > 4 && $_POST['karma'] <= 20) { $user->karma = $_POST['karma']; } $user->comment_pref = intval($_POST['comment_pref']) + (intval($_POST['show_friends']) & 1) * 2 + (intval($_POST['show_2cols']) & 1) * 4; // Manage avatars upload if (!empty($_FILES['image']['tmp_name'])) { if (avatars_check_upload_size('image')) { $avatar_mtime = avatars_manage_upload($user->id, 'image'); if (!$avatar_mtime) { array_push($messages, _('error guardando la imagen')); $errors = 1; $user->avatar = 0; } else { $user->avatar = $avatar_mtime; } } else { array_push($messages, _('el tamaño de la imagen excede el límite')); $errors = 1; $user->avatar = 0; } } elseif ($_POST['avatar_delete']) { $user->avatar = 0; avatars_remove($user->id); } // Reset avatar for the logged user if ($current_user->user_id == $user->id) { $current_user->user_avatar = $user->avatar; } if (!$errors) { if (empty($user->ip)) { $user->ip = $globals['user_ip']; } $user->store(); $user->read(); if (!$admin_mode && ($current_user->user_login != $user->username || $current_user->user_email != $user->email || $new_pass)) { $current_user->Authenticate($user->username, $new_pass); } array_push($messages, _('datos actualizados')); } return $messages; }
switch ($what) { /* From notifier */ case 'privates': $url = post_get_base_url('_priv'); 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) {
} } if (isset($globals['canonical_server_name']) && $globals['canonical_server_name'] != get_server_name()) { $globals['noindex'] = true; } 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();
// Show logs echo '<div class="voters" id="voters">'; // AdSense do_banner_story(); print_story_tabs($tab_option); echo '<fieldset><legend>' . _('registro de eventos de la noticia') . '</legend>'; echo '<div id="voters-container">'; $logs = $db->get_results("select logs.*, user_id, user_login, user_avatar from logs, users where log_type in ('link_new', 'link_publish', 'link_discard', 'link_edit', 'link_geo_edit', 'link_depublished') and log_ref_id={$link->id} and user_id= log_user_id order by log_date asc"); if ($logs) { //echo '<div class="voters-list">'; foreach ($logs as $log) { echo '<div style="width:100%; display: block; clear: both; border-bottom: 1px solid #FFE2C5;">'; echo '<div style="width:30%; float: left;padding: 4px 0 4px 0;">' . $log->log_date . '</div>'; echo '<div style="width:24%; float: left;padding: 4px 0 4px 0;"><strong>' . $log->log_type . '</strong></div>'; echo '<div style="width:45%; float: left;padding: 4px 0 4px 0;">'; echo '<a href="' . get_user_uri($log->user_login) . '" title="' . $log->date . '">'; echo '<img src="' . get_avatar_url($log->log_user_id, $log->user_avatar, 20) . '" width="20" height="20" alt="' . $log->user_login . '"/> '; echo $log->user_login; echo '</a>'; echo '</div>'; echo '</div>'; } //echo '</div>'; } else { echo _('no hay registros'); } echo '</div><br />'; echo '</fieldset>'; echo '</div>'; break; case 5:
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; }
} include_once 'pager.php'; global $db, $globals; if (!isset($globals['link_id']) && !empty($_GET['id'])) { $globals['link_id'] = intval($_GET['id']); } if (!$globals['link_id'] > 0) { die; } if (!isset($_GET['p'])) { $favorites_page = 1; } else { $favorites_page = intval($_GET['p']); } $favorites_page_size = 20; $favorites_offset = ($favorites_page - 1) * $favorites_page_size; $favorites_users = $db->get_var("SELECT count(*) FROM favorites WHERE favorite_link_id=" . $globals['link_id']); $favorites = $db->get_results("SELECT favorite_user_id, user_avatar, user_login, date_format(favorite_date,'%d/%m %T') as date FROM favorites, users WHERE favorite_link_id=" . $globals['link_id'] . " AND user_id = favorite_user_id LIMIT {$favorites_offset},{$favorites_page_size}"); if (!$favorites) { return; } echo '<div class="voters-list">'; foreach ($favorites as $vote) { echo '<div class="item">'; echo '<a href="' . get_user_uri($vote->user_login, 'favorites') . '" title="' . $vote->date . '">'; echo '<img src="' . get_avatar_url($vote->favorite_user_id, $vote->user_avatar, 20) . '" width="20" height="20" alt="' . $vote->user_login . '"/>'; echo $vote->user_login . '</a>'; echo '</div>'; } echo "</div>\n"; do_contained_pages($globals['link_id'], $favorites_users, $favorites_page, $favorites_page_size, 'get_link_favorites.php', 'voters', 'voters-container');
function do_header($title, $id = 'home') { global $current_user, $dblang, $globals; if (!empty($globals['link_id'])) { // Pingback autodiscovery // http://www.hixie.ch/specs/pingback/pingback header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php'); } echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n"; //echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' . "\n"; echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '" lang="' . $dblang . '">' . "\n"; echo '<head>' . "\n"; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n"; echo "<title>{$title}</title>\n"; do_css_includes(); echo '<meta name="generator" content="meneame" />' . "\n"; if (!empty($globals['noindex'])) { echo '<meta name="robots" content="noindex,follow"/>' . "\n"; } if (!empty($globals['tags'])) { echo '<meta name="keywords" content="' . $globals['tags'] . '" />' . "\n"; } echo '<link rel="microsummary" type="application/x.microsummary+xml" href="' . $globals['base_url'] . 'microsummary.xml" />' . "\n"; echo '<link rel="search" type="application/opensearchdescription+xml" title="Menéame Search" href="http://' . get_server_name() . $globals['base_url'] . 'opensearch_plugin.php"/>' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('publicadas') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php" />' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('pendientes') . '" href="http://' . get_server_name() . $globals['base_url'] . 'rss2.php?status=queued" />' . "\n"; echo '<link rel="alternate" type="application/rss+xml" title="' . _('comentarios') . '" href="http://' . get_server_name() . $globals['base_url'] . 'comments_rss2.php" />' . "\n"; if (empty($globals['favicon'])) { $globals['favicon'] = 'img/favicons/favicon4.ico'; } echo '<link rel="icon" href="' . $globals['base_url'] . $globals['favicon'] . '" type="image/x-icon"/>' . "\n"; if (!empty($globals['link_id'])) { // Pingback autodiscovery // http://www.hixie.ch/specs/pingback/pingback echo '<link rel="pingback" href="http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php"/>' . "\n"; } do_js_includes(); echo '</head>' . "\n"; echo "<body id=\"{$id}\" " . $globals['body_args'] . ">\n"; echo '<div id="logo">' . "\n"; echo '<a href="' . $globals['base_url'] . '" title="la elefanta Eli"><img src="' . $globals['base_url'] . $globals['top_logo'] . '" alt="logo menéame" /></a>'; echo '</div>' . "\n"; echo '<div id="header">' . "\n"; echo '<ul>' . "\n"; //echo '<li><a href="'.$globals['base_url'].'telnet.php" title="'._('es la fisgona, pero más segura para el trabajo').'">'. _('¡la jefa!') . '</a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'faq-' . $dblang . '.php">' . _('acerca de menéame') . '</a></li>' . "\n"; if ($title != "login") { if ($current_user->authenticated) { echo '<li><a href="' . $globals['base_url'] . 'login.php?op=logout&return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('cerrar sesión') . '</a></li>' . "\n"; if ($current_user->user_level == 'god' || $current_user->user_level == 'admin') { echo '<li><a href="' . $globals['base_url'] . 'admin/bans.php">' . _('adm') . '</a></li>' . "\n"; } echo '<li><a href="' . get_user_uri($current_user->user_login) . '">' . '<img src="' . get_avatar_url($current_user->user_id, $current_user->user_avatar, 20) . '" width="20" height="20" alt="' . $current_user->user_login . '" title="' . _('perfil') . '" /> ' . $current_user->user_login . '</a></li>' . "\n"; } else { echo '<li><a href="' . $globals['base_url'] . 'register.php">' . _('registrarse') . '</a></li>' . "\n"; echo '<li><a href="' . $globals['base_url'] . 'login.php?return=' . urlencode($_SERVER['REQUEST_URI']) . '">' . _('login') . '</a></li>' . "\n"; } } // Main search form echo '<li>' . "\n"; echo '<form action="' . $globals['base_url'] . 'search.php" method="get" name="top_search">' . "\n"; if (!empty($_REQUEST['q'])) { echo '<input type="text" name="q" value="' . htmlspecialchars(strip_tags($_REQUEST['q'])) . '" />' . "\n"; } else { echo '<input name="q" value="' . _('buscar...') . '" type="text" onblur="if(this.value==\'\') this.value=\'' . _('buscar...') . '\';" onfocus="if(this.value==\'' . _('buscar...') . '\') this.value=\'\';"/>' . "\n"; } echo '<a href="javascript:document.top_search.submit()"><img class="searchIcon" align="top" alt="buscar" src="' . $globals['base_url'] . 'img/common/search-01.gif" id="submit_image"/></a>' . "\n"; echo '</form>' . "\n"; echo '</li>' . "\n"; // form echo '</ul>' . "\n"; echo '<span class="header-left"> </span>' . "\n"; echo '</div>' . "\n"; }