Example #1
0
	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>&nbsp;';
                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 '&nbsp;&nbsp;&nbsp;<span  id="cid-'.$this->id.'">';
		echo '&nbsp;&nbsp;<span  id="cid-'.$this->id.'">';

		if ($this->ignored || ($this->hidden && ($current_user->user_comment_pref & 1) == 0)) {
			echo '&#187;&nbsp;<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>&nbsp;';
			// 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:&nbsp;'.$this->user_karma.'" id="cauthor-'.$this->order.'">'.$this->username.'</a>';
		} else {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'">'.$this->username.'</a>';
		}

		// Print dates
		if ($this->modified > $this->date + 1) {
			$edited = sprintf('<strong title="'. _('editado %s después').'">*&nbsp;</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.',&nbsp;karma:&nbsp;'.$this->user_karma.'" />';

		echo '</div>';
     
		echo '</div></div>';
	}
Example #2
0
	function print_summary($type='full', $karma_best_comment = 0, $show_tags = true) {
		global $current_user, $current_user, $globals, $db;

		if(!$this->read) return;
		if($this->is_votable()) {
			$this->voted = $this->vote_exists($current_user->user_id);
			if (!$this->voted) $this->md5 = md5($current_user->user_id.$this->id.$this->randkey.$globals['user_ip']);
		}

		$url = htmlspecialchars($this->url);

		$this->permalink = $this->get_permalink();

		echo '<div class="news-summary">';
		echo '<div class="news-body">';
		if ($type != 'preview' && $this->title && $this->content 
				&& ($this->votes > 0 || $current_user->user_id == $this->author) ) {
			$this->print_shake_box();
		}

		$this->print_warn();

		if ($this->status != 'published') $nofollow = ' rel="nofollow"';
		else $nofollow = '';

		if($globals['ads']) echo "<!-- google_ad_section_start -->\n";

		echo '<h1>';
		echo '<a href="'.$url.'"'.$nofollow.'>'. $this->title. '</a>';

		// Content type (for video and images)
		if ($this->content_type == 'image') {
			echo '&nbsp;<img src="'.$globals['base_static'].'img/common/is-photo01.png" class="media-icon" width="18" height="15" alt="'._('imagen').'" title="'._('imagen').'" />';
		} elseif ($this->content_type == 'video') {
			echo '&nbsp;<img src="'.$globals['base_static'].'img/common/is-video01.png" class="media-icon" width="18" height="15" alt="'._('vídeo').'" title="'._('vídeo').'" />';
		}
		echo '</h1> ';

		echo '<div class="news-submitted">';
		if ($type != 'short') {
			echo '<a href="'.get_user_uri($this->username).'"><img src="'.get_avatar_url($this->author, $this->avatar, 25).'" width="25" height="25" alt="" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', '.$this->author.');" onmouseout="tooltip.clear(event);" /></a>';
		}
		echo '<strong>'.htmlentities(preg_replace('/^https*:\/\//', '', txt_shorter($this->url))).'</strong>'."&nbsp;<br />\n";

		// Allow to invert user in japanese translations
		printf (_('por %s'), ' <a href="'.get_user_uri($this->username, 'history').'">'.$this->username.'</a> ');

		// Print dates
		if ($globals['now'] - $this->date > 604800 || empty($_SERVER['HTTP_USER_AGENT'])) { // 7 days or user agent is empty
			echo _('el').get_date_time($this->sent_date);
			if($this->status == 'published')
				echo ', '  ._('publicado el').get_date_time($this->date);
		} else {
			echo _('hace').txt_time_diff($this->sent_date);
			if($this->status == 'published')
				echo ', '  ._('publicado hace').txt_time_diff($this->date);
		}
		echo "</div>\n";

		if($type=='full' || $type=='preview') {
			if (($src = $this->has_thumb())) {
				echo "<img src='$src' width='$this->thumb_x' height='$this->thumb_y' alt='' class='thumbnail'/>";
			}

			echo '<p>';
			echo text_to_html($this->content, 'links');
			if ($globals['link'] && $type != 'preview' ) {
				if ($this->is_editable()) {
					echo '&nbsp;&nbsp;<a href="'.$globals['base_url'].'editlink.php?id='.$this->id.'&amp;user='******'" title="'._('editar noticia').' #'.$this->id.'"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-misc01.png" alt="edit" width="18" height="12"/></a>';
				}
				if ($this->geo && $this->is_map_editable()) {
					echo '&nbsp;&nbsp;<a href="#" onclick="$(\'#geoedit\').load(\''.$globals['base_url']."geo/get_form.php?id=$this->id&amp;type=link&amp;icon=$this->status".'\'); return false;"><img class="mini-icon-text" src="'.$globals['base_static'].'img/common/edit-geo01.png" alt="edit" title="'._('editar geolocalización').'"/></a>';
				}
			}
			echo '</p>';
		}


    if ($this->start_date && (!$this->end_date || ($this->start_date==$this->end_date))) {
      echo '<div>';
      echo _('Data:').' <strong>'.Link::format_date($this->start_date).'</strong>';
      echo '</div>';
    } elseif ($this->start_date && $this->end_date) {
      echo '<div>';
      echo _('Do').' <strong>'.Link::format_date($this->start_date).'</strong> '._('ata o').' <strong>'.Link::format_date($this->end_date).'</strong>';
      echo '</div>';
    }


		// Print a summary of the best comment
		// with a least one vote and younger than a day
		if ($karma_best_comment > 0 && $this->comments > 0 && $this->comments < 50 && $globals['now'] - $this->date < 86400 &&
			($best_comment = $db->get_row("select SQL_CACHE comment_id, comment_order, substr(comment_content, 1, 225) as content from comments where comment_link_id = $this->id and comment_karma > $karma_best_comment and comment_votes > 0 order by comment_karma desc limit 1"))) {
			echo '<div class="box" style="font-size: 80%; border: 1px solid; border-color: #dadada; background: #fafafa; margin: 7px 50px 7px 25px; padding: 4px; overflow:hidden">';
			$link = $this->permalink.'/000'.$best_comment->comment_order;
			echo '<a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \''.$best_comment->comment_id.'\', 10000);" href="'.$link.'"><strong>'.$best_comment->comment_order.'</strong></a>';
			echo ':&nbsp;'.text_to_summary($best_comment->content, 200).'</div>';
		}

		if ($this->do_inline_friend_votes) $this->inline_friend_votes();

		echo '<div class="news-details main">';
		if($this->comments > 0) {
			$comments_mess = $this->comments . ' ' . _('comentarios');
		} else  {
			$comments_mess = _('sin comentarios');
		}
		echo '<span class="comments-counter">&nbsp;<a href="'.$this->get_relative_permalink().'">'.$comments_mess. '</a></span>';

		// If the user is authenticated, show favorite box
		if ($current_user->user_id > 0)  {
			echo '<span class="tool"><a id="fav-'.$this->id.'" href="javascript:get_votes(\'get_favorite.php\',\''.$current_user->user_id.'\',\'fav-'.$this->id.'\',0,\''.$this->id.'\')">'.favorite_teaser($current_user->user_id, $this).'</a></span>';
		}

		// Print meta and category
		echo ' <span class="tool">'._('en').': ';
		echo '<a href="'.$globals['base_url'].'?meta='.$this->meta_uri.'" title="'._('meta').'">'.$this->meta_name.'</a>, ';
		echo '<a href="'.$globals['base_url'].'?meta='.$this->meta_uri.'&amp;category='.$this->category.'" title="'._('categoría').'">'.$this->category_name.'</a>';
		echo '</span>';
		echo ' <span class="tool">karma: <span id="a-karma-'.$this->id.'">'.intval($this->karma).'</span></span>';

		if(!$this->voted &&
				$this->votes_enabled &&
				$this->negatives_allowed($globals['link_id'] > 0) && 
				$type != 'preview' /*&& $this->author != $current_user->user_id*/) {
				$this->print_problem_form();
		}

		echo '</div>'."\n";
		// End news details
		if($globals['ads']) echo "<!-- google_ad_section_end -->\n";

		// Displayed only in a story page
		// and tags in sent/voted listing
		if ($globals['link'] || $type == 'short') {
			if ($show_tags && !empty($this->tags)) {
				echo '<div class="news-details">';
				echo '<strong>'._('etiquetas').'</strong>:';
				$tags_array = explode(",", $this->tags);
				$tags_counter = 0;
				foreach ($tags_array as $tag_item) {
					$tag_item=trim($tag_item);
					$tag_url = urlencode($tag_item);
					if ($tags_counter > 0) echo ',';
					if ($globals['base_search_url']) {
						echo ' <a href="'.$globals['base_url'].$globals['base_search_url'].'tag:';
					} else {
						echo ' <a href="'.$globals['base_url'].'search.php?p=tag&amp;q=';
					}
					echo $tag_url.'">'.$tag_item.'</a>';
					$tags_counter++;
				}

				echo '</div>'."\n";
			}
			if ($type != 'short') {
				echo '<div class="news-details">';
				echo '<strong>'._('negativos').'</strong>: <span id="a-neg-'.$this->id.'">'.$this->negatives.'</span>&nbsp;&nbsp;';
				echo '<strong>'._('usuarios').'</strong>: <span id="a-usu-'.$this->id.'">'.$this->votes.'</span>&nbsp;&nbsp;';
				echo '<strong>'._('anónimos').'</strong>: <span id="a-ano-'.$this->id.'">'.$this->anonymous.'</span>&nbsp;&nbsp;';

				echo '<span class="tool">';
        echo '<strong>'.('orde').'</strong>: <select id="selectCommentOrder" >'
            .'<option value="kdate" '.(!$current_user->comment_options['korder']?'selected="selected"':'').'>'._('data').'</option>'
            .'<option value="korder" '.($current_user->comment_options['korder']?'selected="selected"':'').'>'._('karma').'</option>'
          .'</select>&nbsp;&nbsp;';
				echo '</span>';

				echo '<span class="tool">';
				// Share icons
				$short_permalink = $this->get_short_permalink();
				echo '<strong>';
				echo '<a href="'.$short_permalink.'" title="'._('enlace corto').'">'._('compartir').'</a>';
				echo '</strong>:';
				print_share_icons($this->permalink, $short_permalink, $this->title);
				echo '</span>';
				echo '</div>' . "\n";
			}
		}

		// Include post text ads
		do_banner_story();

		echo '</div>'."\n";
		echo '</div>'."\n";

		// Geo edit form div
		if ($this->geo && $this->is_map_editable())  {
			echo '<div id="geoedit" class="geoform" style="margin-left:20px">';
			if ($current_user->user_id == $this->author && $this->sent_date > $globals['now'] - 600 && !$this->latlng)  {
				geo_coder_print_form('link', $this->id, $globals['latlng'], _('ubica al origen de la noticia o evento (ciudad, país)'));
			}
			echo '</div>'."\n";
		}

	}
Example #3
0
	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;
		}


		if ($single_link) $html_id = $this->order;
		else $html_id = $this->id;

		echo '<div id="c-'.$html_id.'">';

		$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();
		echo '<div class="'.$comment_class.'">';
		echo '<a href="'.$this->link_permalink.'/000'.$this->order.'"><strong>#'.$this->order.'</strong></a>';

		echo '&nbsp;&nbsp;&nbsp;<span  id="cid-'.$this->id.'">';

		if ($this->ignored || ($this->hidden && ($current_user->user_comment_pref & 1) == 0)) {
			echo '&#187;&nbsp;<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.'">';
		// Check that the user can vote
		echo '<div class="comment-votes-info">';
		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>&nbsp;';
			// 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.')" 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:&nbsp;'.$this->user_karma.'" id="cauthor-'.$this->order.'">'.$this->username.'</a>';
		} else {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'">'.$this->username.'</a>';
		}

		// Print dates
		if ($this->modified > $this->date + 1) {
			$edited = sprintf('<strong title="'. _('editado %s después').'">*&nbsp;</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(_('hace %s %s por %s'), txt_time_diff($this->date), $edited, $author);
		}
		
		echo '<img src="'.$avatar.'" width="20" height="20" alt="" title="'.$this->username.',&nbsp;karma:&nbsp;'.$this->user_karma.'" />';

		echo '</div></div>';
		echo "</div>\n";
	}
Example #4
0
 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 '&#187;&nbsp;<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>&nbsp;';
     // 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";
 }
Example #5
0
 function print_summary($type = 'full', $karma_best_comment = 0)
 {
     global $current_user, $current_user, $globals, $db;
     if (!$this->read) {
         return;
     }
     if ($this->is_votable()) {
         $this->voted = $this->vote_exists($current_user->user_id);
         if (!$this->voted) {
             $this->md5 = md5($current_user->user_id . $this->id . $this->randkey . $globals['user_ip']);
         }
     }
     $url = htmlspecialchars($this->url);
     echo '<div class="news-summary">';
     echo '<div class="news-body">';
     if ($type != 'preview' && !empty($this->title) && !empty($this->content)) {
         $this->print_shake_box($votes_enabled);
     }
     $this->print_warn();
     //if($globals['external_ads']) echo "<!-- google_ad_section_start -->\n";
     if ($this->status != 'published') {
         $nofollow = ' rel="nofollow"';
     } else {
         $nofollow = '';
     }
     echo '<h1>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     // Content type (for video and images)
     if ($this->content_type == 'image') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-photo01.png" class="media-icon" width="18" height="15" alt="' . _('imagen') . '" title="' . _('imagen') . '" />';
     } elseif ($this->content_type == 'video') {
         echo '&nbsp;<img src="' . $globals['base_url'] . 'img/common/is-video01.png" class="media-icon" width="18" height="15" alt="' . _('vídeo') . '" title="' . _('vídeo') . '" />';
     }
     echo '</h1>';
     if (!$globals['bot']) {
         // GEO
         if ($this->latlng) {
             echo '<div class="thumbnail" id="map" style="width:130px;height:130px">&nbsp;</div>' . "\n";
         } elseif ($type == 'full' && $globals['do_websnapr'] && $this->votes_enabled && $globals['link_id'] > 0 && !empty($this->url_title)) {
             // Websnapr
             // In order not to overload websnapr, display the image only if votes are enabled
             echo '<img class="news-websnapr" alt="websnapr.com" src="http://images.websnapr.com/?size=T&amp;url=' . $url . '" width="92" height="70"  onmouseover="return tooltip.ajax_delayed(event, \'get_link_snap.php\', ' . $this->id . ');" onmouseout="tooltip.clear(event);" onclick="tooltip.clear(this);"/>';
         }
         echo '<div class="news-submitted">';
         if ($type != 'short') {
             echo '<a href="' . get_user_uri($this->username) . '"><img src="' . get_avatar_url($this->author, $this->avatar, 25) . '" width="25" height="25" alt="' . $this->username . '" onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" /></a>';
         }
         echo '<strong>' . htmlentities(preg_replace('/^https*:\\/\\//', '', txt_shorter($this->url))) . '</strong>' . "<br />\n";
         echo _('por') . ' <a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a> ';
         // Print dates
         if ($globals['now'] - $this->date > 604800) {
             // 7 days
             echo _('el') . get_date_time($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado el') . get_date_time($this->date);
             }
         } else {
             echo _('hace') . txt_time_diff($this->sent_date);
             if ($this->status == 'published') {
                 echo ', ' . _('publicado hace') . txt_time_diff($this->date);
             }
         }
         echo "</div>\n";
     }
     if ($type == 'full' || $type == 'preview') {
         echo '<p>' . text_to_html($this->content);
         if ($type != 'preview') {
             if ($this->is_editable()) {
                 echo '&nbsp;&nbsp;<a href="' . $globals['base_url'] . 'editlink.php?id=' . $this->id . '&amp;user='******'" title="' . _('editar noticia') . ' #' . $this->id . '"><img src="' . $globals['base_url'] . 'img/common/edit-misc01.png" alt="edit"/></a>';
             }
             if ($this->geo && $this->is_map_editable()) {
                 echo '&nbsp;&nbsp;<a href="#" onclick="$(\'#geoedit\').load(\'' . $globals['base_url'] . "geo/get_form.php?id={$this->id}&amp;type=link&amp;icon={$this->status}" . '\'); return false;"><img src="' . $globals['base_url'] . 'img/common/edit-geo01.png" alt="edit" title="' . _('editar geolocalización') . '"/></a>';
             }
         }
         echo '</p>';
     }
     // Print a summary of the best comment
     if ($karma_best_comment > 0 && ($best_comment = $db->get_row("select comment_id, comment_order, comment_content from comments where comment_link_id = {$this->id} and comment_karma > {$karma_best_comment} order by comment_karma desc limit 1"))) {
         echo '<div style="font-size: 80%; border: 1px solid; border-color: #dadada; background: #fafafa; margin: 7px 50px 7px 25px; padding: 4px; overflow:hidden">';
         $link = $this->get_permalink() . get_comment_page_suffix($globals['comments_page_size'], $best_comment->comment_order, $this->comments) . '#comment-' . $best_comment->comment_order;
         echo '<a onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $best_comment->comment_id . '\', 10000);" href="' . $link . '"><strong>' . $best_comment->comment_order . '</strong></a>';
         echo ':&nbsp;' . text_to_summary($best_comment->comment_content, 200) . '</div>';
     }
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
     } else {
         $comments_mess = _('sin comentarios');
     }
     echo '<span class="comments">&nbsp;<a href="' . $this->get_relative_permalink() . '">' . $comments_mess . '</a></span>';
     // If the user is authenticated, show favorite box
     if ($current_user->user_id > 0) {
         echo '<span class="tool"><a id="fav-' . $this->id . '" href="javascript:get_votes(\'get_favorite.php\',\'' . $current_user->user_id . '\',\'fav-' . $this->id . '\',0,\'' . $this->id . '\')">' . favorite_teaser($current_user->user_id, $this->id) . '</a></span>';
     }
     // Print meta and category
     echo ' <span class="tool">' . _('en') . ': ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '" title="' . _('meta') . '">' . $this->meta_name . '</a>, ';
     echo '<a href="' . $globals['base_url'] . '?meta=' . $this->meta_uri . '&amp;category=' . $this->category . '" title="' . _('categoría') . '">' . $this->category_name . '</a>';
     echo '</span>';
     echo ' <span class="tool">karma: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span></span>';
     if (!$this->voted && $this->negatives_allowed() && $type != 'preview' && $this->votes_enabled) {
         $this->print_problem_form();
     }
     echo '</div>' . "\n";
     // End news details
     // Displayed only in a story page
     if ($globals['link']) {
         if (!empty($this->tags)) {
             echo '<div class="news-details">';
             echo '<strong>' . _('etiquetas') . '</strong>:';
             $tags_array = explode(",", $this->tags);
             $tags_counter = 0;
             foreach ($tags_array as $tag_item) {
                 $tag_item = trim($tag_item);
                 $tag_url = urlencode($tag_item);
                 if ($tags_counter > 0) {
                     echo ',';
                 }
                 if ($globals['base_search_url']) {
                     echo ' <a href="' . $globals['base_url'] . $globals['base_search_url'] . 'tag:';
                 } else {
                     echo ' <a href="' . $globals['base_url'] . 'search.php?p=tag&amp;q=';
                 }
                 echo $tag_url . '">' . $tag_item . '</a>';
                 $tags_counter++;
             }
             echo '</div>' . "\n";
         }
         echo '<div class="news-details">';
         echo '<strong>' . _('votos negativos') . '</strong>: <span id="a-neg-' . $this->id . '">' . $this->negatives . '</span>&nbsp;&nbsp;';
         echo '<strong>' . _('usuarios') . '</strong>: ' . $this->votes . '&nbsp;&nbsp;';
         echo '<strong>' . _('anónimos') . '</strong>: ' . $this->anonymous . '&nbsp;&nbsp;';
         echo '</div>' . "\n";
     } else {
         echo "<!--tags: {$this->tags}-->\n";
     }
     //if($globals['external_ads']) echo "<!-- google_ad_section_end -->\n";
     echo '</div>' . "\n";
     echo '</div>' . "\n";
     // Geo edit form div
     if ($this->geo && $this->is_map_editable()) {
         echo '<div id="geoedit" class="geoform" style="margin-left:20px">';
         if ($current_user->user_id == $this->author && !$this->latlng) {
             geo_coder_print_form('link', $this->id, $globals['latlng'], _('ubica al origen de la noticia o evento (ciudad, país)'));
         }
         echo '</div>' . "\n";
     }
 }