$limit = 500; } } else { $user = ''; } header('Content-Type: text/html; charset=utf-8'); $media = $db->get_results("select type, id, version, unix_timestamp(date) as date, mime, user as uid, user_login as user from media, users where type in {$type_in} {$user} and version = 0 and user_id = media.user order by date desc limit {$limit}"); $images = array(); if ($media) { foreach ($media as $image) { if (!$show_all) { switch ($image->type) { case 'comment': $karma = $db->get_var("select comment_karma from comments where comment_id = {$image->id}"); break; case 'post': $karma = $db->get_var("select post_karma from posts where post_id = {$image->id}"); break; default: $karma = 0; } } if ($show_all || $karma > -10) { $image->url = Upload::get_url($image->type, $image->id, $image->version, $image->date, $image->mime); $images[] = $image; } } } if ($images) { Haanga::Load("backend/gallery.html", compact('images')); }
$globals['time_enabled_comments'] = min($globals['time_enabled_comments_status'][$link->status], $globals['time_enabled_comments']); } // Check for comment post if ($_POST['process'] == 'newcomment') { $new = new Comment(); $new_comment_error = $new->save_from_post($link); } $username = $comment->type == 'admin' ? 'admin' : $comment->username; if ($comment->type != 'admin') { $globals['search_options'] = array('w' => 'comments', 'u' => $comment->username); } $comment->check_visibility(); if (!$comment->hide_comment) { $globals['description'] = _('Autor') . ": {$username}, " . _('Resumen') . ': ' . text_to_summary($comment->content, 250); if ($globals['media_public'] && $comment->media_size > 0) { $globals['thumbnail'] = Upload::get_url('comment', $comment->id, 0, $comment->media_date, $comment->media_mime); } elseif ($comment->avatar) { $globals['thumbnail'] = get_avatar_url($comment->author, $comment->avatar, 80); } $title = text_to_summary($comment->content, 120); } else { $title = ''; } if (isset($globals['canonical_server_name']) && !empty($globals['canonical_server_name'])) { $globals['extra_head'] = '<link rel="canonical" href="http://' . $globals['canonical_server_name'] . $comment->get_relative_individual_permalink() . '" />'; } do_header($title . ' | ' . $globals['site_name']); //do_subheader(_('comentario de') . ' ' . $username); /*** SIDEBAR ****/ echo '<div id="sidebar">'; do_banner_right();
function prepare_summary_text($length = 0) { global $globals, $current_user; if ($this->single_link) { $this->html_id = $this->order; } else { $this->html_id = $this->id; } $this->can_edit = (!isset($this->basic_summary) || !$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'); if ($length > 0) { $this->truncate($length); } $this->txt_content = $this->to_html($this->content); if ($this->media_size > 0) { $this->media_thumb_dir = Upload::get_cache_relative_dir($this->id); $this->media_url = Upload::get_url('comment', $this->id, 0, $this->media_date, $this->media_mime); } }
function prepare_summary_text($length = 0) { global $current_user, $globals; if (empty($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 $this->can_edit = true; } else { $this->can_edit = false; } if ($length > 0) { $this->content = text_to_summary($this->content, $length); } $this->content = $this->to_html($this->content) . $expand; if ($this->media_size > 0) { $this->media_thumb_dir = Upload::get_cache_relative_dir($this->id); $this->media_url = Upload::get_url('post', $this->id, 0, $this->media_date, $this->media_mime); } }
function has_thumb() { global $globals; if (!empty($this->thumb_url)) { return $this->thumb_url; } if ($this->media_size > 0) { // New format $base = $globals['base_static_noversion']; $this->thumb_uri = Upload::get_cache_relative_dir($this->id) . "/media_thumb-link-{$this->id}.{$this->media_extension}?{$this->media_date}"; $this->thumb_url = $base . $this->thumb_uri; $this->media_url = Upload::get_url('link', $this->id, 0, $this->media_date, $this->media_mime); $this->thumb_x = $this->thumb_y = $globals['thumb_size']; return $this->thumb_url; } $this->thumb_url = false; return false; }