Exemplo n.º 1
0
	function print_summary($link) {
		global $current_user;
		static $comment_counter = 0;

		if(!$this->read) return;
		$comment_counter++;
		echo '<li id="c-'.$this->id.'"><div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$_SERVER['PHP_SELF'].'?id='.$link->id.'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a>&nbsp;&nbsp;&nbsp;'.$this->put_smileys(save_text_to_html($this->content)).'</div>';
		echo '<div class="comment-info">';
		echo _('escrito por'). ' <a href="./user.php?login='******'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date);
		echo '<img src="'.get_gravatar_url($this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="gravatar.com" /></div></li>'."\n";

	}
Exemplo n.º 2
0
	function print_summary($link, $length = 0) {
		global $current_user, $globals;
		static $comment_counter = 0;

		if(!$this->read) return;
		$comment_counter++;
		echo '<li id="ccontainer-'.$this->id.'">';
		echo '<div class="comment-body" id="comment-'.$comment_counter.'"><a href="'.$link->get_relative_permalink().'#comment-'.$comment_counter.'"><strong>#'.$comment_counter.'</strong></a>';
		echo '&nbsp;&nbsp;&nbsp;<span id="c-'.$this->id.'">'. "\n";
		//if($globals['external_ads']) echo "<!-- google_ad_section_start -->\n";
		$this->print_text($length);
		//if($globals['external_ads']) echo "<!-- google_ad_section_end -->\n";
		echo '</span></div>';
		echo '<div class="comment-info">';
		echo _('escrito por'). ' <a href="'.$globals['base_url'].'user.php?login='******'">'.$this->username.'</a> '._('hace').' '.txt_time_diff($this->date);
		echo '<img src="'.get_avatar_url($this->author, $this->avatar, $this->email, 20).'" width="20" height="20" alt="'.$this->username.'" title="avatar" /></div>';
		echo "</li>\n";
	}
Exemplo n.º 3
0
 function print_summary($link, $length = 0, $single_link = true)
 {
     global $current_user, $globals;
     if (!$this->read) {
         return;
     }
     echo '<li id="ccontainer-' . $this->id . '">';
     $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 > 80) {
             $comment_class .= ' high';
         }
     }
     $this->link_permalink = $link->get_relative_permalink();
     echo '<div class="' . $comment_class . '">';
     echo '<a href="' . $this->link_permalink . get_comment_page_suffix($globals['comments_page_size'], $this->order, $globals['link']->comments) . '#comment-' . $this->order . '"><strong>#' . $this->order . '</strong></a>';
     if ($single_link) {
         echo '<span id="comment-' . $this->order . '">';
     }
     echo '&nbsp;&nbsp;&nbsp;<span  id="cid-' . $this->id . '">';
     if ($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>';
     } else {
         $this->print_text($length, $single_link);
     }
     if ($single_link) {
         echo '</span>';
     }
     echo '</span></div>';
     // The comments info bar
     echo '<div class="' . $comment_meta_class . '">';
     // Check that the user can vote
     if ($this->type != 'admin' && $this->user_level != 'disabled') {
         // Print the votes info (left)
         echo '<div class="comment-votes-info">';
         if ($current_user->user_id > 0 && $this->author != $current_user->user_id && $single_link) {
             $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 '&nbsp;&nbsp;<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_c_v.php?id=' . $this->id . '\')">';
             echo '<img src="' . $globals['base_url'] . 'img/common/vote-info01.png" width="12" height="12" alt="+ info" title="' . _('¿quién ha votado?') . '"/>';
             echo '</a>';
         }
         echo '</div>';
     }
     // Print comment info (right)
     echo '<div class="comment-info">';
     echo _('por') . ' ';
     if ($this->type == 'admin') {
         echo '<strong>' . get_server_name() . '</strong> ';
         if ($current_user->user_level == 'god' || $current_user->user_level == 'admin') {
             echo ' (' . $this->username . ') ';
         }
     } elseif ($single_link) {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '" id="cauthor-' . $this->order . '">' . $this->username . '</a> ';
     } else {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '">' . $this->username . '</a> ';
     }
     // Print dates
     if ($globals['now'] - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
     } else {
         echo _('hace') . ' ' . txt_time_diff($this->date);
     }
     if (!$this->hidden && $this->type != 'admin') {
         echo '<img src="' . get_avatar_url($this->author, $this->avatar, 20) . '" width="20" height="20" alt="' . $this->username . '" title="' . $this->username . ',&nbsp;karma:&nbsp;' . $this->user_karma . '" />';
     }
     echo '</div></div>';
     echo "</li>\n";
 }
Exemplo n.º 4
0
 //
 if (!empty($_REQUEST['time'])) {
     /////
     // Prepare for times
     /////
     if (!($time = check_integer('time'))) {
         die;
     }
     $sql = "SELECT link_id, link_votes as votes FROM links, sub_statuses WHERE id = {$site_id} AND link_id = link AND ";
     if ($time < 0 || $time > 86400 * 5) {
         $time = 86400 * 2;
     }
     $from = time() - $time;
     $sql .= "date > FROM_UNIXTIME({$from}) AND ";
     $sql .= "status = 'published' ORDER BY link_votes DESC LIMIT {$rows}";
     $title = $site_info->name . ': ' . sprintf(_('más votadas en %s'), txt_time_diff($from));
 } elseif (!empty($_REQUEST['favorites'])) {
     /////
     // users' favorites
     /////
     $user_id = guess_user_id($_REQUEST['favorites']);
     $sql = "SELECT link_id FROM links, favorites WHERE favorite_user_id={$user_id} AND favorite_type='link' AND favorite_link_id=link_id ORDER BY favorite_date DESC limit {$rows}";
     $user_login = $db->get_var("select user_login from users where user_id={$user_id}");
     $title = $site_info->name . ': ' . sprintf(_('favoritas de %s'), $user_login);
 } elseif (!empty($_REQUEST['voted_by'])) {
     // voted links
     $user_id = guess_user_id($_REQUEST['voted_by']);
     if (!$user_id > 0) {
         die;
     }
     $sql = "SELECT vote_link_id FROM votes WHERE vote_type='links' and vote_user_id = {$user_id} and vote_value > 0 ORDER BY vote_date DESC limit {$rows}";
Exemplo n.º 5
0
 function fill_smarty($smarty)
 {
     global $current_user, $the_template, $comment_counter, $link, $ranklist, $db;
     if (!$ranklist) {
         $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N);
         $ranklist = array();
         $rank = 1;
         if ($users) {
             foreach ($users as $dbuser) {
                 $ranklist[$dbuser[0]] = $rank;
                 $rank += $dbuser[1];
             }
         }
     }
     $smarty->assign('comment_counter', $comment_counter);
     $text = save_text_to_html($this->content);
     $vars = array('comment_text' => $text, 'comment_id' => $this->id, 'smarty' => $smarty);
     check_actions('show_comment_content', $vars);
     $smarty->assign('comment_content', $vars['comment_text']);
     $vars = array('comment_form_label' => '');
     check_actions('comment_form_label', $vars);
     $smarty->assign('comment_form_label', $vars['comment_form_label']);
     $smarty->assign('current_userid', $current_user->user_id);
     $smarty->assign('user_logged_in', $current_user->user_login);
     $vars = array('comment_username' => $this->username(), 'is_anonymous' => 0, 'comment_id' => $this->id);
     check_actions('show_comment_username', $vars);
     $smarty->assign('user_username', $vars['comment_username']);
     $smarty->assign('user_rank', $ranklist[$this->userkarma]);
     $smarty->assign('is_anonymous', $vars['is_anonymous']);
     $smarty->assign('user_extra_fields', $this->extra_field);
     //$smarty->assign('link_submitter', $link->username());
     $smarty->assign('comment_id', $this->id);
     $smarty->assign('comment_status', $this->status);
     $smarty->assign('comment_author', $this->author);
     $smarty->assign('comment_link', $this->link);
     $smarty->assign('user_view_url', getmyurl('user', $this->username));
     $smarty->assign('comment_date_timestamp', $this->date);
     $smarty->assign('comment_date', date('F, d Y g:i A', $this->date));
     $smarty->assign('comment_age', txt_time_diff($this->date));
     $smarty->assign('comment_randkey', $this->randkey);
     $smarty->assign('comment_votes', $this->votes);
     $smarty->assign('comment_parent', $this->parent);
     $smarty->assign('hide_comment_edit', $this->hideedit);
     $this->user_vote_count = $this->votes($current_user->user_id);
     $smarty->assign('comment_user_vote_count', $this->user_vote_count);
     $smarty->assign('comment_shakebox_currentuser_votes', $this->votes($current_user->user_id, '>0'));
     $smarty->assign('comment_shakebox_currentuser_reports', $this->votes($current_user->user_id, '<0'));
     // if the person logged in is the person viewing the comment, show 'you' instead of the name
     $smarty->assign('user_userlogin', $this->username);
     // the url for the edit comment link
     $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id));
     $smarty->assign('delete_comment_url', my_pligg_base . '/delete.php?comment_id=' . $this->id);
     // avatars
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar', $avatars = get_avatar('all', '', $this->username, ''));
     $smarty->assign('Avatar_ImgSrc', $avatars['large']);
     $smarty->assign('Avatar_ImgSrc_Small', $avatars['small']);
     // does the person logged in have admin or moderator status?
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     $canIhaveAccess = $canIhaveAccess + checklevel('moderator');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 1);
     }
     // the link to upvote the comment
     $jslinky = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_votey', $jslinky);
     $jslinky = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_unvotey', $jslinky);
     // the link to downvote the comment
     $jslinkn = "cvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_voten', $jslinkn);
     $jslinkn = "cunvote({$current_user->user_id},{$this->id},{$this->id}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10,'" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_unvoten', $jslinkn);
     // misc
     $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting);
     $smarty->assign('my_base_url', my_base_url);
     $smarty->assign('my_pligg_base', my_pligg_base);
     $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small);
     return $smarty;
 }
Exemplo n.º 6
0
	static function print_form($link, $rows=12) {
		global $current_user, $globals;

		if (!$link->votes > 0) return;
    if ($link->association && !in_array($current_user->user_id, $globals['association_users'])) {
      // so a xente da asociacion pode comentar aqui
			echo '<div class="commentform warn">'."\n";
			echo _('Tes que ser da asociación para poder comentar nesta noticia')."\n";
			echo '</div>'."\n";
    } elseif($link->date < $globals['now']-$globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
			// Comments already closed
			echo '<div class="commentform warn">'."\n";
			echo _('comentarios cerrados')."\n";
			echo '</div>'."\n";
		} elseif ($current_user->authenticated 
					&& (($current_user->user_karma > $globals['min_karma_for_comments'] 
							&& $current_user->user_date < $globals['now'] - $globals['min_time_for_comments']) 
						|| $current_user->user_id == $link->author)) {
			// User can comment
			echo '<div class="commentform">'."\n";
			echo '<form action="" method="post">'."\n";
			echo '<fieldset>'."\n";
			echo '<legend>'._('envía un comentario'). ' <em style="font-size:80%">'._('porque alguien en Internet está equivocado').'</em></legend>'."\n";
			print_simpleformat_buttons('comment');
			echo '<label for="comment">'. _('texto del comentario / no se admiten etiquetas HTML').'<br /><span class="note">'._('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta').'</span></label>'."\n";
			echo '<div><textarea name="comment_content" id="comment" cols="75" rows="'.$rows.'"></textarea></div>'."\n";
			echo '<input class="button" type="submit" name="submit" value="'._('enviar el comentario').'" />'."\n";
			// Allow gods to put "admin" comments which does not allow votes
			if ($current_user->user_level == 'god') {
				echo '&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>'._('admin').' </strong><input name="type" type="checkbox" value="admin"/></label>'."\n";
			}
			echo '<input type="hidden" name="process" value="newcomment" />'."\n";
			echo '<input type="hidden" name="randkey" value="'.rand(1000000,100000000).'" />'."\n";
			echo '<input type="hidden" name="link_id" value="'.$link->id.'" />'."\n";
			echo '<input type="hidden" name="user_id" value="'.$current_user->user_id.'" />'."\n";
			echo '<input type="hidden" name="parent_id" value="0" />'."\n"; // for comment replies
			echo '</fieldset>'."\n";
			echo '</form>'."\n";
			echo "</div>\n";
      echo '<div style="visibility:hidden;text-align:center;" id="comentarNoticia" ><a href="#" >'._("Comentar Noticia").'</a></div>'."\n";
		} else {
			// Not enough karma or anonymous user
			if($tab_option == 1) do_comment_pages($link->comments, $current_page);
			if ($current_user->authenticated) {
				if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
					$remaining = txt_time_diff($globals['now'], $current_user->user_date+$globals['min_time_for_comments']);
					$msg = _('debes esperar') . " $remaining " . _('para escribir el primer comentario');
				}
				if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
					$msg = _('no tienes el mínimo karma requerido')." (" . $globals['min_karma_for_comments'] . ") ". _('para comentar'). ": ".$current_user->user_karma;
				}
				echo '<div class="commentform warn">'."\n";
				echo $msg . "\n";
				echo '</div>'."\n";
			} elseif (!$globals['bot']){
				echo '<div class="commentform warn">'."\n";
				echo '<a href="'.get_auth_link().'login.php?return='.$_SERVER['REQUEST_URI'].'">'._('Autentifícate si deseas escribir').'</a> '._('comentarios').'. '._('O crea tu cuenta'). ' <a href="'.$globals['base_url'].'register.php">aquí.</a>'."\n";
				echo '</div>'."\n";

				echo '<div style="margin-top: 20px" align="center">';
				print_oauth_icons();
				echo '</div>'."\n";
			}
		}
	}
Exemplo n.º 7
0
// pagename
define('pagename', 'rss');
$main_smarty->assign('pagename', pagename);
$rows = isset($_GET['rows']) && is_numeric($_GET['rows']) ? $_GET['rows'] : 20;
$status = sanitize($_GET['status'], 3) != '' ? sanitize($_GET['status'], 3) : 'published';
$time = isset($_GET['time']) && is_numeric($_GET['time']) ? $_GET['time'] : 0;
if ($time > 0) {
    // Prepare for times
    $sql = "SELECT link_id, count(*) as votes FROM " . table_votes . ", " . table_links . " WHERE  ";
    if ($time > 0) {
        $from = time() - $time;
        $sql .= "vote_date > FROM_UNIXTIME({$from}) AND ";
    }
    $sql .= "vote_link_id=link_id  AND (link_status='published' OR link_status='new') GROUP BY vote_link_id  ORDER BY votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = $main_smarty->get_config_vars('PLIGG_Visual_RSS_Recent') . ' ' . txt_time_diff($from);
    $link_date = "";
} else {
    // All the others
    $tmpsearch = new Search();
    $tmpsearch->searchTerm = isset($_GET['search']) && sanitize($_GET['search'], 3) != '' ? sanitize($_GET['search'], 3) : '';
    $search = $tmpsearch->get_search_clause();
    if ($search) {
        $status = 'all';
    }
    switch ($status) {
        case 'published':
            $order_field = 'link_date';
            $link_date = 'date';
            $title = " | " . $main_smarty->get_config_vars("PLIGG_Visual_Published_News");
            break;
Exemplo n.º 8
0
if (!empty($_REQUEST['time'])) {
    /////
    // Prepare for times
    /////
    if (!($time = check_integer('time'))) {
        die;
    }
    $sql = "SELECT link_id, link_votes as votes FROM links WHERE ";
    if ($time < 0 || $time > 86400 * 5) {
        $time = 86400 * 2;
    }
    $from = time() - $time;
    $sql .= "link_date > FROM_UNIXTIME({$from}) AND ";
    $sql .= "link_status = 'published' ORDER BY link_votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = _('Menéame') . ': ' . sprintf(_('más votadas en %s'), txt_time_diff($from));
} elseif (!empty($_REQUEST['favorites'])) {
    /////
    // RSS for users' favorites
    /////
    $user_id = guess_user_id($_REQUEST['favorites']);
    $sql = "SELECT link_id FROM links, favorites WHERE favorite_user_id={$user_id} AND favorite_type='link' AND favorite_link_id=link_id ORDER BY favorite_date DESC limit {$rows}";
    $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(max(favorite_date)) from favorites where favorite_user_id={$user_id} AND favorite_type='link'");
    $user_login = $db->get_var("select user_login from users where user_id={$user_id}");
    $title = _('Menéame') . ': ' . sprintf(_('favoritas de %s'), $user_login);
    $globals['redirect_feedburner'] = false;
} elseif (!empty($_REQUEST['voted_by'])) {
    // RSS for voted links
    $user_id = guess_user_id($_REQUEST['voted_by']);
    if (!$user_id > 0) {
        die;
Exemplo n.º 9
0
$from_where = " FROM " . table_links . " \n\t\tLEFT JOIN " . table_users . " ON link_author=user_id \n\t\t{$from}\n\t\tWHERE link_status = 'published' {$where}";
$order_by = " ORDER BY link_published_date DESC, link_date DESC";
// pagename
define('pagename', 'live_published');
$main_smarty->assign('pagename', pagename);
// get the data to be displayed
$rows = $db->get_var("SELECT count(*) as count {$from_where} {$order_by}");
$stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}");
$link = new Link();
//$user = new User;
if ($stories) {
    foreach ($stories as $story) {
        $link->id = $story->link_id;
        $cached_links[$story->link_id] = $story;
        $link->read();
        $live_item['link_date'] = txt_time_diff($link->published_date);
        $live_item['link_title'] = $link->title;
        if (Voting_Method == 2) {
            $live_item['link_votes'] = $link->rating($link->id) / 2;
        } else {
            $live_item['link_votes'] = $link->votes;
        }
        $live_item['link_username'] = $story->user_login;
        $live_item['link_category'] = GetCatName($link->category);
        $live_item['link_category_url'] = getmyurl("maincategory", $link->category_safe_name());
        $live_item['link_url'] = $link->get_internal_url();
        $live_items[] = $live_item;
    }
    $main_smarty->assign('live_items', $live_items);
}
// pagination
Exemplo n.º 10
0
 function fill_smarty($smarty)
 {
     global $current_user, $the_template, $comment_counter, $link;
     $smarty->assign('comment_counter', $comment_counter);
     $smarty->assign('comment_content', save_text_to_html($this->content));
     $smarty->assign('current_userid', $current_user->user_id);
     $smarty->assign('user_logged_in', $current_user->user_login);
     $smarty->assign('user_username', $this->username());
     $smarty->assign('comment_id', $this->id);
     $smarty->assign('comment_author', $this->author);
     $smarty->assign('comment_link', $this->link);
     $smarty->assign('user_view_url', getmyurl('user', $this->username()));
     $smarty->assign('comment_age', txt_time_diff($this->date));
     $smarty->assign('comment_randkey', $this->randkey);
     $smarty->assign('comment_votes', $this->votes);
     $smarty->assign('comment_parent', $this->parent);
     $smarty->assign('hide_comment_edit', $this->hideedit);
     $this->user_vote_count = $this->votes($current_user->user_id);
     $smarty->assign('comment_user_vote_count', $this->user_vote_count);
     // if the person logged in is the person viewing the comment, show 'you' instead of the name
     if ($current_user->user_login == $this->username()) {
         $smarty->assign('user_username', 'you');
     }
     // the url for the edit comment link
     $smarty->assign('edit_comment_url', getmyurl('editcomment', $this->id, $link->id));
     // avatars
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar_ImgSrc', get_avatar('small', "", $this->username(), ""));
     //spellchecker
     $smarty->assign('Spell_Checker', Spell_Checker);
     // does the person logged in have admin or god access?
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('god');
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 1);
     }
     // the link to upvote the comment
     $jslinky = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 10, '" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_votey', $jslinky);
     // the link to downvote the comment
     $jslinkn = "cvote({$current_user->user_id}, {$this->id}, {$this->id}, " . "'" . md5($current_user->user_id . $this->randkey) . "', -10,  '" . my_base_url . my_pligg_base . "/')";
     $smarty->assign('link_shakebox_javascript_voten', $jslinkn);
     // misc
     $smarty->assign('Enable_Comment_Voting', Enable_Comment_Voting);
     $smarty->assign('my_base_url', my_base_url);
     $smarty->assign('my_pligg_base', my_pligg_base);
     $smarty->assign('Default_Gravatar_Small', Default_Gravatar_Small);
     return $smarty;
 }
Exemplo n.º 11
0
} else $rows = 30;
	
$if_modified = get_if_modified();

if(!empty($_REQUEST['time'])) {
	// Prepare for times
	if(!($time = check_integer('time')))
		die;
	$sql = "SELECT link_id, count(*) as votes FROM votes, links WHERE  ";	
	if ($time > 0) {
		$from = time()-$time;
		$sql .= "vote_date > FROM_UNIXTIME($from) AND ";
	}
	$sql .= "vote_link_id=link_id  AND link_status != 'discard' GROUP BY vote_link_id  ORDER BY votes DESC LIMIT $rows";
	$last_modified = time();
	$title = _('Menéame: más votadas en') . ' ' . txt_time_diff($from);
	//$link_date = "modified";
	$link_date = "";
} else {
	// All the others
	$search = get_search_clause('boolean');
	// The link_status to search
	if(!empty($_REQUEST['status'])) {
		$status = $db->escape(preg_replace('/ /', '', trim($_REQUEST['status'])));
	} else {
		// By default it searches on all
		if($search) $status = 'all';
		else $status = 'published';
	}
	/*****  WARNING
		this function is to redirect to feed burner
Exemplo n.º 12
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";
     }
 }
Exemplo n.º 13
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);
     }
     echo '<div class="news-summary">';
     echo '<div class="news-body">';
     $this->print_warn();
     /*
     		if (! $globals['link']) {
     			$url = $this->get_permalink();
     			$nofollow = '';
     */
     if ($this->status != 'published') {
         $nofollow = ' rel="nofollow"';
     } else {
         $nofollow = '';
     }
     $url = htmlspecialchars($this->url);
     if ($type != 'preview' && !empty($this->title) && !empty($this->content)) {
         $this->print_shake_box();
     }
     echo '<h1>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     echo '</h1>';
     echo '<div class="news-submitted">';
     echo '<strong>' . txt_shorter($this->url, 40) . '</strong><br/>';
     if ($globals['link']) {
         printf(_('por %s'), ' <a href="' . get_user_uri($this->username, 'history') . '">' . $this->username . '</a> ');
         // Print dates
         if ($globals['now'] - $this->date > 604800) {
             // 7 days
             if ($this->status == 'published') {
                 echo _('publicado el') . get_date_time($this->date);
             } else {
                 echo _('el') . get_date_time($this->sent_date);
             }
         } else {
             if ($this->status == 'published') {
                 echo _('publicado hace') . txt_time_diff($this->date);
             } else {
                 echo _('hace') . txt_time_diff($this->sent_date);
             }
         }
     }
     echo "</div>\n";
     $text = text_to_html($this->content);
     // Change links to mydomain.net to m.mydomain.net (used in "related")
     $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);
     }
     echo $text;
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
     } else {
         $comments_mess = _('sin comentarios');
     }
     echo '<span class="comments"><a href="' . $this->get_relative_permalink() . '">' . $comments_mess . '</a> </span>';
     echo '&nbsp;<span class="tool"><a href="http://' . preg_replace('/(\\.|^)m\\./', '$1', get_server_name()) . $this->get_relative_permalink() . '"><strong>' . _('versión estándar') . '&nbsp;&#187;</strong></a></span>';
     /*
      * Disabled, it does not give too much information and is hidden to the right (at least in Android)
     		if ($globals['link']) {
     			// Print meta and category
     			echo ' <span class="tool">'._('en').': ';
     			echo $this->meta_name.', ';
     			echo $this->category_name;
     			echo '</span>';
     		}
     */
     echo '</div>' . "\n";
     // End news details
     if ($globals['link']) {
         echo '<div class="news-details">';
         echo '<strong>karma</strong>: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span>&nbsp;&nbsp;';
         echo '<strong>' . _('negativos') . '</strong>: ' . $this->negatives . '&nbsp;&nbsp;';
         echo '<strong>' . _('usuarios') . '</strong>: ' . $this->votes . '&nbsp;&nbsp;';
         echo '<strong>' . _('anónimos') . '</strong>: ' . $this->anonymous . '&nbsp;&nbsp;';
         echo '</div>' . "\n";
     }
     echo '</div>' . "\n";
     echo '</div>' . "\n";
 }
Exemplo n.º 14
0
 if (isset($_POST['process'])) {
     if ($_POST['process'] == 'newcomment') {
         insert_comment();
     }
 }
 // log the pageview
 $pageview = new Pageview();
 $pageview->type = 'story';
 $pageview->page_id = $link->id;
 $pageview->user_id = $current_user->user_id;
 require_once mnminclude . 'check_behind_proxy.php';
 $pageview->user_ip = check_ip_behind_proxy();
 // find the last pageview
 $last_visit = $pageview->last_visit();
 if ($last_visit != 0) {
     $last_visit = txt_time_diff($pageview->last_visit(), time());
 }
 $main_smarty->assign('last_visit', $last_visit);
 $pageview->insert();
 // Set globals
 $globals['link_id'] = $link->id;
 $globals['category_id'] = $link->category;
 $globals['category_name'] = $link->category_name();
 $globals['category_url'] = $link->category_safe_name();
 check_actions('story_top');
 $main_smarty->assign('link_submitter', $link->username());
 // setup breadcrumbs and page title
 $main_smarty->assign('posttitle', $link->title);
 $navwhere['text1'] = $globals['category_name'];
 $navwhere['link1'] = getmyurl('maincategory', makeCategoryFriendly($globals['category_url']));
 $navwhere['text2'] = $link->title;
Exemplo n.º 15
0
 function print_summary($length = 0)
 {
     global $current_user, $globals;
     if (!$this->read) {
         $this->read();
     }
     echo '<li id="pcontainer-' . $this->id . '">';
     $post_meta_class = 'comment-meta';
     $post_class = 'comment-body';
     echo '<div class="' . $post_class . '">';
     echo '<a href="' . get_user_uri($this->username) . '"><img onmouseover="return tooltip.ajax_delayed(event, \'get_user_info.php\', ' . $this->author . ');" onmouseout="tooltip.clear(event);" class="avatar" src="' . get_avatar_url($this->author, $this->avatar, 40) . '" width="40" height="40" alt="' . $this->username . '"/></a>';
     $this->print_text($length);
     echo '</div>';
     // The comments info bar
     echo '<div class="' . $post_meta_class . '">';
     // Print the votes info (left)
     echo '<div class="comment-votes-info">';
     // Check that the user can vote
     if ($current_user->user_id > 0 && $this->author != $current_user->user_id) {
         $this->print_shake_icons();
     }
     echo _('votos') . ': <span id="vc-' . $this->id . '">' . $this->votes . '</span>, karma: <span id="vk-' . $this->id . '">' . $this->karma . '</span>';
     // Add the icon to show votes
     if ($this->votes > 0 && $this->date > $globals['now'] - 30 * 86400) {
         // Show votes if newer than 30 days
         echo '&nbsp;&nbsp;<a href="javascript:modal_from_ajax(\'' . $globals['base_url'] . 'backend/get_p_v.php?id=' . $this->id . '\')">';
         echo '<img src="' . $globals['base_url'] . 'img/common/vote-info01.png" width="12" height="12" alt="+ info" title="' . _('¿quién ha votado?') . '"/>';
         echo '</a>';
     }
     echo '</div>';
     // Print comment info (right)
     echo '<div class="comment-info">';
     echo '<a href="' . post_get_base_url($this->username) . '">' . _('nota de') . ' ' . $this->username . '</a> ';
     echo '(' . $this->src . ') ';
     echo '(<a href="' . post_get_base_url($this->username) . '/' . $this->id . '" title="permalink">#</a>) ';
     // Print dates
     if (time() - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
     } else {
         echo _('hace') . ' ' . txt_time_diff($this->date);
     }
     echo '</div></div>';
     echo "</li>\n";
 }
Exemplo n.º 16
0
} else {
    $rows = 40;
}
if (!empty($_REQUEST['time'])) {
    // Prepare for times
    if (!($time = check_integer('time'))) {
        die;
    }
    $sql = "SELECT link_id, count(*) as votes FROM " . table_votes . ", " . table_links . " WHERE  ";
    if ($time > 0) {
        $from = time() - $time;
        $sql .= "vote_date > FROM_UNIXTIME({$from}) AND ";
    }
    $sql .= "vote_link_id=link_id  AND link_status != 'discard' GROUP BY vote_link_id  ORDER BY votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = _(PLIGG_Visual_RSS_Recent) . ' ' . txt_time_diff($from);
    //$link_date = "modified";
    $link_date = "";
} else {
    // All the others
    $tmpsearch = new Search();
    $tmpsearch->searchTerm = sanitize($_REQUEST['search'], 3);
    $search = $tmpsearch->get_search_clause();
    // The link_status to search
    if (!empty($_REQUEST['status'])) {
        $status = $_REQUEST['status'];
    } else {
        // By default it searches on all
        if ($search) {
            $status = 'published';
        } else {
Exemplo n.º 17
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";
 }
Exemplo n.º 18
0
if (!empty($_REQUEST['time'])) {
    /////
    // Prepare for times
    /////
    if (!($time = check_integer('time'))) {
        die;
    }
    $sql = "SELECT link_id, link_votes as votes FROM links, sub_statuses WHERE id = {$site_id} AND link_id = link AND ";
    if ($time < 0 || $time > 86400 * 5) {
        $time = 86400 * 2;
    }
    $from = time() - $time;
    $sql .= "date > FROM_UNIXTIME({$from}) AND ";
    $sql .= "status = 'published' ORDER BY link_votes DESC LIMIT {$rows}";
    $last_modified = time();
    $title = $globals['site_name'] . ': ' . sprintf(_('más votadas en %s'), txt_time_diff($from));
} elseif (!empty($_REQUEST['favorites'])) {
    /////
    // RSS for users' favorites
    /////
    $user_id = guess_user_id($_REQUEST['favorites']);
    $sql = "SELECT link_id FROM links, favorites WHERE favorite_user_id={$user_id} AND favorite_type='link' AND favorite_link_id=link_id ORDER BY favorite_date DESC limit {$rows}";
    $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(max(favorite_date)) from favorites where favorite_user_id={$user_id} AND favorite_type='link'");
    $user_login = $db->get_var("select user_login from users where user_id={$user_id}");
    $title = $globals['site_name'] . ': ' . sprintf(_('favoritas de %s'), $user_login);
    $globals['redirect_feedburner'] = false;
} elseif (!empty($_REQUEST['voted_by'])) {
    // RSS for voted links
    $user_id = guess_user_id($_REQUEST['voted_by']);
    if (!$user_id > 0) {
        die;
Exemplo n.º 19
0
        echo '<h2 class="title">' . $link->title . '</h2>';
        echo '<p>' . $link->to_html($link->content);
        echo ' <a href="' . htmlspecialchars($link->url) . '">' . _('Ver noticia') . ' &gt;</a></p>';
        echo '<p class="news-submitted"><img src="' . get_avatar_url($link->author, $link->avatar, 40) . '" class="senderimg" width="40" height="40" alt="avatar de ' . $link->username . '" />';
        echo ' ' . _('por') . ' <strong>' . $link->username . '</strong> ';
        // Print dates
        if (time() - $link->date > 604800) {
            // 7 days
            echo _('el') . get_date_time($link->sent_date);
            if ($link->status == 'published') {
                echo ', ' . _('publicado el') . get_date_time($link->date);
            }
        } else {
            echo _('hace') . txt_time_diff($link->sent_date);
            if ($link->status == 'published') {
                echo ', ' . _('publicado hace') . txt_time_diff($link->date);
            }
        }
        echo '</p>' . "\n";
        echo '<p class="gotop"><a href="#top">Ir arriba</a></p>';
        echo '</div></div>';
        echo '<div class="separator">&nbsp;</div>';
    }
}
echo "</div>\n";
echo "</body></html>";
function print_index_tabs($option = -1)
{
    global $globals, $db;
    echo '<div id="navbar">' . "\n";
    $active = array();
Exemplo n.º 20
0
 static function print_form($link, $rows = 5)
 {
     global $current_user, $globals;
     if (!$link->votes > 0) {
         return;
     }
     if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
         // Comments already closed
         echo '<div class="commentform warn">' . "\n";
         echo _('comentarios cerrados') . "\n";
         echo '</div>' . "\n";
     } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) {
         // User can comment
         echo '<div class="commentform">' . "\n";
         echo '<form action="" method="post" enctype="multipart/form-data" class="comment">' . "\n";
         echo '<input type="hidden" name="process" value="newcomment" />' . "\n";
         echo '<input type="hidden" name="randkey" value="' . rand(1000000, 100000000) . '" />' . "\n";
         echo '<fieldset>' . "\n";
         echo '<legend>' . _('envía un comentario') . '</legend>' . "\n";
         print_simpleformat_buttons('comment');
         echo '<label for="comment">' . _('texto del comentario') . '<br /><span class="note">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</span></label>' . "\n";
         echo '<div><textarea name="comment_content" class="droparea" id="comment" rows="' . $rows . '"></textarea></div>' . "\n";
         echo '<input class="button" type="submit" name="submit" value="' . _('enviar el comentario') . '" />' . "\n";
         // Allow gods to put "admin" comments which does not allow votes
         if ($current_user->user_level == 'god') {
             echo '&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>' . _('admin') . ' </strong><input name="type" type="checkbox" value="admin"/></label>' . "\n";
         }
         $comment = new Comment();
         // Foo comment
         $vars = compact('link', 'comment');
         Haanga::Load('comment_edit.html', $vars);
         echo '</fieldset>' . "\n";
         echo '</form>' . "\n";
         echo "</div>\n";
     } else {
         // Not enough karma or anonymous user
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         if ($current_user->authenticated) {
             if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
                 $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']);
                 $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario');
             }
             if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
                 $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma;
             }
             echo '<div class="commentform warn">' . "\n";
             echo $msg . "\n";
             echo '</div>' . "\n";
         } elseif (!$globals['bot']) {
             echo '<div class="commentform warn">' . "\n";
             echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n";
             echo '</div>' . "\n";
             print_oauth_icons();
         }
     }
 }
Exemplo n.º 21
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";
		}

	}
Exemplo n.º 22
0
 function print_summary($type = 'full')
 {
     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 = htmlentities($this->url);
     echo '<div class="news-summary" id="news-' . $this->id . '">';
     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 '<h3>';
     echo '<a href="' . $url . '"' . $nofollow . '>' . $this->title . '</a>';
     echo '</h3>';
     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="avatar" 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 _('enviado por') . ' <a href="' . get_user_uri($this->username, 'history') . '" title="karma:&nbsp;' . $this->user_karma . '">' . $this->username . '</a> ';
     // Print dates
     if (time() - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
         if ($this->status == 'published') {
             echo ', ' . _('publicado el') . get_date_time($this->published_date);
         }
     } else {
         echo _('hace') . txt_time_diff($this->date);
         if ($this->status == 'published') {
             echo ', ' . _('publicado hace') . txt_time_diff($this->published_date);
         }
     }
     echo "</div>\n";
     if ($type == 'full' || $type == 'preview') {
         echo '<div class="news-body-text">';
         if ($globals['do_websnapr'] && $type == 'full' && $globals['link_id'] > 0 && !empty($this->url_title)) {
             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 text_to_html($this->content) . '</div>';
     }
     if (!empty($this->tags)) {
         echo '<div class="news-tags">';
         echo '<strong><a href="' . $globals['base_url'] . 'cloud.php" title="' . _('nube') . '">' . _('etiquetas') . '</a></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 ',';
             }
             echo ' <a href="' . $globals['base_url'] . '?search=tag:' . $tag_url . '">' . $tag_item . '</a>';
             $tags_counter++;
         }
         echo '</div>' . "\n";
     }
     if ($globals['external_ads']) {
         echo "<!-- google_ad_section_end -->\n";
     }
     echo '<div class="news-details">';
     if ($this->comments > 0) {
         $comments_mess = $this->comments . ' ' . _('comentarios');
         $comment_class = "comments_yes";
     } else {
         $comments_mess = _('sin comentarios');
         $comment_class = "comments_no";
     }
     echo '<a href="' . $this->get_relative_permalink() . '" class="tool ' . $comment_class . '">' . $comments_mess . '</a>';
     echo '<span class="tool">' . _('categoría') . ': <a href="' . $globals['base_url'] . '?category=' . $this->category . '" title="' . _('categoría') . '">' . $this->category_name() . '</a></span>';
     echo ' <span class="tool"><a href="' . $this->get_relative_permalink() . '/voters">' . _('negativos') . '</a>: <span id="a-neg-' . $this->id . '">' . $this->negatives . '</span></span>';
     echo ' <span class="tool">karma: <span id="a-karma-' . $this->id . '">' . intval($this->karma) . '</span></span>';
     // Allow to modify it
     if ($type != 'preview' && $this->is_editable()) {
         echo ' <span  class="tool"><a href="' . $globals['base_url'] . 'editlink.php?id=' . $this->id . '&amp;user='******'">' . _('editar') . '</a></span> ';
     }
     if (!$this->voted && $current_user->user_id > 0 && $this->status != 'published' && $this->votes > 0 && $type != 'preview' && $current_user->user_karma >= $globals['min_karma_for_negatives'] && $this->votes_enabled) {
         $this->print_problem_form();
     }
     echo '</div>' . "\n";
     echo '</div></div>' . "\n";
 }
Exemplo n.º 23
0
$main_smarty->assign('pagename', pagename);
// get the data to be displayed
$rows = $db->get_var("SELECT count(*) as count {$from_where} {$order_by}");
$comments = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}");
//$comment = new Comment;
//$user = new User;
$link = new Link();
if ($comments) {
    foreach ($comments as $dbcomment) {
        //		$comment->id = $dbcomment->comment_id;
        //		$comment->read();
        $live_item['comment_content'] = $dbcomment->comment_content;
        //		$user->id = $comment->author;
        //		$user->read();
        $live_item['comment_author'] = $dbcomment->user_login;
        $live_item['comment_date'] = txt_time_diff(strtotime($dbcomment->comment_date));
        $link->id = $dbcomment->link_id;
        $cached_links[$dbcomment->link_id] = $dbcomment;
        $link->read();
        $live_item['comment_link_title'] = $link->title;
        $live_item['comment_link_url'] = $link->get_internal_url();
        $live_items[] = $live_item;
    }
    $main_smarty->assign('live_items', $live_items);
}
// pagination
$main_smarty->assign('live_pagination', do_pages($rows, $top_users_size, "comments", true));
// sidebar
$main_smarty = do_sidebar($main_smarty);
// show the template
$main_smarty->assign('tpl_center', $the_template . '/live_comments_center');
Exemplo n.º 24
0
 if (isset($_POST['process'])) {
     if ($_POST['process'] == 'newcomment') {
         insert_comment();
     }
 }
 // log the pageview
 $pageview = new Pageview();
 $pageview->type = 'story';
 $pageview->page_id = $link->id;
 $pageview->user_id = $current_user->user_id;
 require_once mnminclude . 'check_behind_proxy.php';
 $pageview->user_ip = check_ip_behind_proxy();
 // find the last pageview
 $last_visit = $pageview->last_visit();
 if ($last_visit != 0) {
     $last_visit = txt_time_diff($pageview->last_visit(), $time);
 }
 $main_smarty->assign('last_visit', $last_visit);
 $pageview->insert();
 // Set globals
 $globals['link_id'] = $link->id;
 $globals['category_id'] = $link->category;
 $globals['category_name'] = $link->category_name();
 check_actions('story_top');
 $main_smarty->assign('link_submitter', $link->username());
 // setup breadcrumbs and title
 $main_smarty->assign('posttitle', " - " . $link->title);
 $navwhere['text1'] = $globals['category_name'];
 $navwhere['link1'] = getmyurl('maincategory', makeCategoryFriendly($globals['category_name']));
 $navwhere['text2'] = $link->title;
 $navwhere['link2'] = getmyurl('storycattitle', makeCategoryFriendly($globals['category_name']), urlencode($link->title_url));
Exemplo n.º 25
0
$queued = $db->get_var('SELECT count(*) from ' . table_links . ' where link_status = "queued";');
$main_smarty->assign('queued', $queued);
$main_smarty->assign('total', $queued + $published);
$votes = $db->get_var('SELECT count(*) from ' . table_votes . ' where vote_type="links";');
$main_smarty->assign('votes', $votes);
$comments = $db->get_var('SELECT count(*) from ' . table_comments . ';');
$main_smarty->assign('comments', $comments);
$sql = mysql_query("SELECT link_id,link_date FROM " . table_links . " ORDER BY link_date DESC LIMIT 1");
while ($rows = mysql_fetch_array($sql)) {
    $link_date = txt_time_diff(unixtimestamp($rows['link_date']));
    $main_smarty->assign('link_date', $link_date . ' ' . $main_smarty->get_config_vars('PLIGG_Visual_Comment_Ago'));
    $main_smarty->assign('link_id', $rows['link_id']);
}
$sql = mysql_query("SELECT link_id,comment_id,comment_link_id,comment_date FROM " . table_comments . "," . table_links . " WHERE comment_link_id = link_id ORDER BY comment_date DESC LIMIT 1");
while ($rows = mysql_fetch_array($sql)) {
    $comment_date = txt_time_diff(unixtimestamp($rows['comment_date']));
    $main_smarty->assign('comment_date', $comment_date . ' ' . $main_smarty->get_config_vars('PLIGG_Visual_Comment_Ago'));
    $main_smarty->assign('link_id', $rows['link_id']);
    $main_smarty->assign('comment_id', $rows['comment_id']);
}
$sql = "SELECT user_login FROM " . table_users . " ORDER BY user_id DESC LIMIT 1";
$last_user = $db->get_var($sql);
$main_smarty->assign('last_user', $last_user);
// read the mysql database to get the pligg version
$sql = "SELECT data FROM " . table_misc_data . " WHERE name = 'pligg_version'";
$pligg_version = $db->get_var($sql);
$main_smarty->assign('version_number', $pligg_version);
// pagename
define('pagename', 'admin_index');
$main_smarty->assign('pagename', pagename);
// show the template
Exemplo n.º 26
0
	function print_summary($type='full') {
		global $current_user, $current_user, $globals;

		if(!$this->read) return;
		if($this->is_votable()) {
			$this->voted = $this->vote_exists($current_user->user_id);
		}

		$url = $this->url;
		$title_short = wordwrap($this->title, 36, " ", 1);

		echo '<div class="news-summary" id="news-'.$this->id.'">';
		echo '<div class="news-body">';
		if ($type != 'preview' && !empty($this->title)) {
			$this->print_shake_box($votes_enabled);
		}
		echo '<h3 id="title'.$this->id.'">';
		echo '<a href="'.htmlspecialchars($url).'">'. $title_short. '</a>';
		echo '</h3>';
		echo '<div class="news-submitted">';
		if ($type != 'short')
			echo '<a href="user.php?login='******'" title="'.$this->username.'"><img src="'.get_gravatar_url($this->email, 25).'" width="25" height="25" alt="icon gravatar.com" /></a>';
		echo '<strong>'.htmlentities(preg_replace('/^http:\/\//', '', txt_shorter($this->url))).'</strong>'."<br />\n";
		if ( $globals['interface'] == "monouser" )
			echo _('enviado hace').txt_time_diff($this->date);
		else
			echo _('enviado por').' <a href="user.php?login='******'&amp;view=history"><strong>'.$this->username.'</strong></a> '._('hace').txt_time_diff($this->date);
		if($this->status == 'published')
			echo ', '  ._('publicado hace').txt_time_diff($this->published_date);
		echo "</div>\n";
		if($type=='full' || $type=='preview') {
			if ( $globals['interface'] == "monouser" ) 
				echo '<div class="news-body-text">'.trim($this->content).'</div>';
			else
				echo '<div class="news-body-text">'.text_to_html($this->content).'</div>';
		}
		if (!empty($this->tags)) {
			echo '<div class="news-tags">';
			echo '<strong><a href="cloud.php" title="'._('nube').'">'._('etiquetas').'</a></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 ',';
				echo ' <a href="index.php?search=tag:'.$tag_url.'">'.$tag_item.'</a>';
				$tags_counter++;
			}
			echo '</div>';
		}

		echo '<div class="news-details">';
		if ($globals['comments']) {
			$ncomments = $this->comments();
			if($ncomments > 0) {
				$comments_mess = $ncomments . ' ' . _('comentarios');
				$comment_class = "comments";
			} else  {
				$comments_mess = _('sin comentarios');
				$comment_class = "comments_no";
			}
			if(empty($globals['link_id']))
				echo '<a href="story.php?id='.$this->id.'" class="tool '.$comment_class.'">'.$comments_mess. '</a>';
			else
				echo '<span class="tool comments">'.$comments_mess. '</span>';
		}

		/*
		if (!empty($this->tags)) {
			echo '<span class="tool"><a href="cloud.php" title="'._('nube').'">'._('etiquetas').'</a>:';
			$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 ',';
				echo ' <a href="index.php?search=tag:'.$tag_url.'">'.$tag_item.'</a>';
				$tags_counter++;
			}
			echo '</span>';
		}
		*/
		echo '<span class="tool">'._('categoría'). ': <a href="./index.php?category='.$this->category.'" title="'._('categoría').'">'.$this->category_name().'</a></span>';

		// Allow to modify it
		if ($type != 'preview' && $this->is_editable()) {
			echo ' <span  class="tool"><a href="editlink.php?id='.$this->id.'">'._('editar').'</a></span> ';
		}

		if($current_user->user_id > 0 && $this->status!='published' && $this->votes > 0 && $type != 'preview' &&
				$current_user->user_karma > 5 && $this->votes_enabled /*&& $this->author != $current_user->user_id*/) {
			$this->print_problem_form();
		} elseif ($current_user->user_level == 'god') {
			$this->print_problem_form();
		}

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

	}
$from_where = " FROM " . table_links . " \r\n\t\tLEFT JOIN " . table_users . " ON link_author=user_id \r\n\t\t{$from}\r\n\t\tWHERE link_status = 'queued' {$where}";
$order_by = " ORDER BY link_id DESC";
// pagename
define('pagename', 'unpublished');
$main_smarty->assign('pagename', pagename);
// get the data to be displayed
$rows = $db->get_var("SELECT count(*) as count {$from_where} {$order_by}");
$stories = $db->get_results("{$select} {$from_where} {$order_by} LIMIT {$offset},{$top_users_size}");
$link = new Link();
//$user = new User;
if ($stories) {
    foreach ($stories as $dblink) {
        $link->id = $dblink->link_id;
        $cached_links[$dblink->link_id] = $dblink;
        $link->read();
        $live_item['link_date'] = txt_time_diff($link->date);
        $live_item['link_title'] = $link->title;
        if (Voting_Method == 2) {
            $live_item['link_votes'] = $link->rating($link->id) / 2;
        } else {
            $live_item['link_votes'] = $link->votes;
        }
        $live_item['link_username'] = $dblink->user_login;
        $live_item['link_category'] = GetCatName($link->category);
        $live_item['link_category_url'] = getmyurl("queuedcategory", $link->category_safe_name());
        #		$live_item['link_category_url'] = $link->category_safe_name();
        $live_item['link_url'] = $link->get_internal_url();
        $live_items[] = $live_item;
    }
    $main_smarty->assign('live_items', $live_items);
}
Exemplo n.º 28
0
 static function print_form($link, $rows = 5)
 {
     global $current_user, $globals;
     if (!$link->votes > 0) {
         return;
     }
     $comment = new Comment();
     // Foo comment
     $comment->randkey = rand(1000000, 100000000);
     if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
         // Comments already closed
         echo '<div class="commentform warn">' . "\n";
         echo _('comentarios cerrados') . "\n";
         echo '</div>' . "\n";
     } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) {
         // User can comment
         echo '<div class="commentform">' . "\n";
         echo '<form action="" method="post" enctype="multipart/form-data" class="comment">';
         echo '<input type="hidden" name="process" value="newcomment" />';
         echo '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />';
         echo '<fieldset>' . "\n";
         echo '<legend>' . _('envía un comentario') . '</legend>';
         $vars = compact('link', 'comment');
         Haanga::Load('comment_edit.html', $vars);
         echo '<div class="note" style="margin-top:10px">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</div>';
         echo '</fieldset>' . "\n";
         echo '</form>' . "\n";
         echo "</div>\n";
     } else {
         // Not enough karma or anonymous user
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         if ($current_user->authenticated) {
             if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
                 $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']);
                 $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario');
             }
             if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
                 $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma;
             }
             echo '<div class="commentform warn">' . "\n";
             echo $msg . "\n";
             echo '</div>' . "\n";
         } elseif (!$globals['bot']) {
             echo '<div class="commentform warn">' . "\n";
             echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n";
             echo '</div>' . "\n";
             print_oauth_icons();
         }
     }
 }
Exemplo n.º 29
0
 function fill_smarty($smarty, $type = 'full')
 {
     static $link_index = 0;
     global $current_user, $globals, $the_template, $db, $ranklist;
     if (!$ranklist) {
         $users = $db->get_results("SELECT user_karma, COUNT(*) FROM " . table_users . " WHERE user_level NOT IN ('Spammer') AND user_karma>0 GROUP BY user_karma ORDER BY user_karma DESC", ARRAY_N);
         $ranklist = array();
         $rank = 1;
         if ($users) {
             foreach ($users as $dbuser) {
                 $ranklist[$dbuser[0]] = $rank;
                 $rank += $dbuser[1];
             }
         }
     }
     // DB 08/04/08
     if (!is_numeric($this->id)) {
         return false;
     }
     /////
     $smarty->assign('link_id', $this->id);
     if (!$this->read) {
         return $smarty;
     }
     $url = str_replace('&amp;', '&', htmlspecialchars($this->url));
     $url_short = txt_shorter($url);
     if ($this->url == "http://" || $this->url == '') {
         $url_short = "http://";
     } else {
         $parsed = parse_url($this->url);
         if (isset($parsed['scheme'])) {
             $url_short = $parsed['scheme'] . "://" . $parsed['host'];
         }
     }
     echo $parsed['scheme'];
     $title_short = htmlspecialchars(utf8_wordwrap($this->title, 30, " ", 1));
     $smarty->assign('viewtype', $type);
     $smarty->assign('URL_tagcloud', getmyurl("tagcloud"));
     $smarty->assign('URL_global_statistics', getmyurl("global_statistics"));
     $smarty->assign('No_URL_Name', No_URL_Name);
     if (track_outgoing == true && $url_short != "http://") {
         if (track_outgoing_method == "id") {
             $smarty->assign('url', getmyurl("out", $this->id));
         }
         if (track_outgoing_method == "title") {
             $smarty->assign('url', getmyurl("outtitle", urlencode($this->title_url)));
         }
         if (track_outgoing_method == "url") {
             $smarty->assign('url', getmyurl("outurl", $url));
         }
     } else {
         $smarty->assign('url', $url);
     }
     // DB 11/12/08
     if ($url_short == "http://" || $url_short == "://") {
         $smarty->assign('enc_url', urlencode(my_base_url . $this->get_internal_url()));
     } else {
         $smarty->assign('enc_url', urlencode($url));
     }
     /////
     $smarty->assign('url_short', $url_short);
     $smarty->assign('title_short', $title_short);
     //$smarty->assign('title_url', urlencode($this->title_url));
     $smarty->assign('enc_title_short', urlencode($title_short));
     $smarty->assign('story_url', $this->get_internal_url());
     $smarty->assign('story_edit_url', getmyurl("editlink", $this->id));
     $smarty->assign('story_admin_url', getmyurl("admin_modify", $this->id));
     $smarty->assign('story_comment_count', $this->comments());
     $smarty->assign('story_status', $this->status);
     //$smarty->assign('story_karma', $this->karma);
     if ($type == "summary") {
         if ($this->link_summary == "") {
             $smarty->assign('story_content', $this->truncate_content());
         } else {
             $smarty->assign('story_content', $this->link_summary);
         }
     }
     /*	$sql = "SELECT link_id FROM " . table_links . " WHERE link_category='$id'";
     		$links = $db->get_results($sql);
     		foreach($links as $link)
     		{
     			$db->query('UPDATE '.table_comments." SET comment_status='discard' WHERE comment_link_id={$link->link_id}");
     
     			$vars = array('link_id' => $link->link_id);
     			check_actions('story_discard', $vars);
     			$db->query('UPDATE '.table_links." SET link_status='discard' WHERE link_id={$link->link_id}");
     		}
     
     	*/
     if ($type == "full") {
         $smarty->assign('story_content', $this->content);
         $smarty->assign('story_id', $this->id);
     }
     if ($this->get_author_info == true) {
         $smarty->assign('link_submitter', $this->username());
         $smarty->assign('submitter_profile_url', getmyurl('user', $this->username));
         $smarty->assign('submitter_rank', $ranklist[$this->userkarma]);
     }
     $smarty->assign('link_submit_time', $this->date);
     $smarty->assign('link_submit_timeago', txt_time_diff($this->date));
     $smarty->assign('link_submit_date', date('F, d Y g:i A', $this->date));
     $smarty->assign('link_published_time', $this->published_date);
     $smarty->assign('link_published_timeago', txt_time_diff($this->published_date));
     $smarty->assign('link_category', $this->category_name());
     if (Multiple_Categories) {
         $cats = array();
         foreach ($this->additional_cats as $cat) {
             $url = $this->category_safe_name($cat);
             if ($this->status == "published") {
                 $url = getmyurl("maincategory", $url);
             }
             if ($this->status == "queued") {
                 $url = getmyurl("queuedcategory", $url);
             }
             if ($this->status == "discard") {
                 $url = getmyurl("discardedcategory", $url);
             }
             $cats[$url] = $this->category_name($cat);
         }
         $smarty->assign('link_additional_cats', $cats);
     }
     //assign category id to smarty, so we can use it in the templates. Needed for category colors!
     $smarty->assign('category_id', $this->category);
     global $URLMethod;
     $catvar = $this->category_safe_name();
     $smarty->assign('Voting_Method', Voting_Method);
     $this->votecount = $this->countvotes();
     if (Voting_Method == 2) {
         if (!$this->rating) {
             $this->rating = $this->rating($this->id) / 2;
         }
         $smarty->assign('link_rating', $this->rating);
         $smarty->assign('link_rating_width', $this->rating * 25);
         $current_user_id = $current_user->user_id;
         $jsLink = "vote({$current_user_id}, {$this->id}, {$link_index}, '" . md5($current_user_id . $this->randkey) . "', ";
         for ($stars = 1; $stars <= 5; $stars++) {
             $smarty->assign("link_shakebox_javascript_vote_{$stars}star", $jsLink . $stars * 2 . ')');
         }
         $smarty->assign('vote_count', $this->votecount);
         if ($this->votes($current_user_id) > 0) {
             $smarty->assign('star_class', "-noh");
         } else {
             $smarty->assign('star_class', "");
         }
     }
     $smarty->assign('get_group_membered', $this->get_group_membered());
     if ($this->status == "published") {
         $smarty->assign('category_url', getmyurl("maincategory", $catvar));
     }
     if ($this->status == "queued") {
         $smarty->assign('category_url', getmyurl("queuedcategory", $catvar));
     }
     if ($this->status == "discard") {
         $smarty->assign('category_url', getmyurl("discardedcategory", $catvar));
     }
     $smarty->assign('trackback_url', get_trackback($this->id));
     $smarty->assign('user_logged_in', $current_user->user_login);
     $smarty->assign('randmd5', md5($current_user->user_id . $this->randkey));
     $smarty->assign('user_id', $this->author);
     $smarty->assign('current_user_id', $current_user_id);
     if (Enable_Extra_Fields) {
         $main_smarty = $smarty;
         include mnminclude . 'extra_fields_smarty.php';
         $smarty = $main_smarty;
         $smarty->assign('link_field1', $this->link_field1);
         $smarty->assign('link_field2', $this->link_field2);
         $smarty->assign('link_field3', $this->link_field3);
         $smarty->assign('link_field4', $this->link_field4);
         $smarty->assign('link_field5', $this->link_field5);
         $smarty->assign('link_field6', $this->link_field6);
         $smarty->assign('link_field7', $this->link_field7);
         $smarty->assign('link_field8', $this->link_field8);
         $smarty->assign('link_field9', $this->link_field9);
         $smarty->assign('link_field10', $this->link_field10);
         $smarty->assign('link_field11', $this->link_field11);
         $smarty->assign('link_field12', $this->link_field12);
         $smarty->assign('link_field13', $this->link_field13);
         $smarty->assign('link_field14', $this->link_field14);
         $smarty->assign('link_field15', $this->link_field15);
     }
     $smarty->assign('link_group_id', $this->link_group_id);
     $smarty->assign('Enable_Recommend', Enable_Recommend);
     $smarty->assign('instpath', my_base_url . my_pligg_base . "/");
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar_ImgSrc', get_avatar('large', "", "", "", $this->userid));
     $smarty->assign('Avatar_ImgSrcs', get_avatar('small', "", "", "", $this->userid));
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('god');
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 'yes');
     }
     if ($this->check_friends == true) {
         // For Friends //
         include_once mnminclude . 'friend.php';
         $friend = new Friend();
         // make sure we're logged in and we didnt submit the link.
         if ($current_user->user_id > 0 && $current_user->user_login != $this->username()) {
             $friend_md5 = friend_MD5($current_user->user_login, $this->username());
             $smarty->assign('FriendMD5', $friend_md5);
             $isfriend = $friend->get_friend_status($this->author);
             if (!$isfriend) {
                 $friend_text = 'add to';
                 $friend_url = 'addfriend';
             } else {
                 $friend_text = 'remove from';
                 $friend_url = 'removefriend';
             }
             $smarty->assign('Friend_Text', $friend_text);
             $smarty->assign('user_add_remove', getmyurl('user_add_remove', $this->username(), $friend_url));
         }
         $smarty->assign('Allow_Friends', Allow_Friends);
         // --- //
     }
     if ($current_user->user_id != '') {
         $vars = array('author_id' => $this->author, 'link_id' => $this->id);
         check_actions('friends_activity_function', $vars);
         if ($vars['value'] == true) {
             $smarty->assign('friendvoted', 1);
         }
     }
     /*
     		//for friends voting activity
     		include_once(mnminclude.'friend.php');
     		$friend = new Friend;
     		$sql = 'SELECT ' . table_votes . '.*, ' . table_users . '.user_id FROM ' . table_votes . ' INNER JOIN ' . table_users . ' ON ' . table_votes . '.vote_user_id = ' . table_users . '.user_id WHERE (((' . table_votes . '.vote_value)>0) AND ((' . table_votes . '.vote_link_id)='.$this->id.') AND (' . table_votes . '.vote_type= "links"));';
     		$voters = $db->get_results($sql);
     		$voters = object_2_array($voters);
     		foreach($voters as $key => $val)
     		{
     			$voteduserid = $val['user_id'];
     			if($voteduserid == $friend->get_friend_status($this->author))
     			{
     				$friendvoted = 1;
     			}
     			$smarty->assign('friendvoted', $friendvoted);
     		}*/
     if ($this->check_saved == true) {
         global $cached_saved_links;
         if (isset($cached_saved_links[$this->id])) {
             $smarty->assign('link_mine', $cached_saved_links[$this->id]);
         } else {
             $smarty->assign('link_mine', $db->get_row("SELECT * FROM " . table_saved_links . " WHERE saved_user_id={$current_user->user_id} AND saved_link_id={$this->id} LIMIT 1;"));
         }
     }
     $smarty->assign('user_url_saved', getmyurl('user2', $current_user->user_login, 'saved'));
     $smarty->assign('user_add_links_private', getmyurl('user_add_links_private', $this->id));
     $smarty->assign('user_add_links_public', getmyurl('user_add_links_public', $this->id));
     $smarty->assign('group_story_links_publish', getmyurl('group_story_links_publish', $this->id));
     $smarty->assign('group_story_links_queued', getmyurl('group_story_links_queued', $this->id));
     $smarty->assign('group_story_links_discard', getmyurl('group_story_links_discard', $this->id));
     $smarty->assign('user_url_add_links', getmyurl('user_add_links', $this->id));
     $smarty->assign('user_url_remove_links', getmyurl('user_remove_links', $this->id));
     $smarty->assign('enable_tags', Enable_Tags);
     $smarty->assign('link_shakebox_index', $link_index);
     $smarty->assign('link_shakebox_votes', $this->votes);
     $smarty->assign('link_shakebox_showbury', $this->reports);
     $this->get_current_user_votes($current_user->user_id);
     $smarty->assign('link_shakebox_currentuser_votes', $this->current_user_votes);
     $smarty->assign('link_shakebox_currentuser_reports', $this->current_user_reports);
     if ($this->reports == -1) {
         // reporting was added to the svn and some people started using it
         // so in upgrade if someone already has the reports field, we set it to
         // -1. Then when we read() we check if -1. if it still is, update the count
         // from the votes table and store it into the link_reports field so we
         // don't have to look at the votes table again.
         $this->reports = $this->count_all_votes("<0");
         $this->store_basic();
         $smarty->assign('link_shakebox_reports', $this->reports);
     }
     $jslink = "vote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',10)";
     $jsreportlink = "vote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10)";
     $smarty->assign('link_shakebox_javascript_vote', $jslink);
     $jsunvote = "unvote({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',10)";
     $smarty->assign('link_shakebox_javascript_unvote', $jsunvote);
     $smarty->assign('link_shakebox_javascript_report', $jsreportlink);
     if (!defined('alltagtext')) {
         // for pages like index, this ->display was being called for each story
         // which was sometimes 15+ times per page. this way it's just called once
         $smarty->display('blank.tpl');
         //this is just to load the lang file so we can pull from it in php
         define('alltagtext', $smarty->get_config_vars('PLIGG_Visual_Tags_All_Tags'));
     }
     $alltagtext = alltagtext;
     if (Enable_Tags) {
         $smarty->assign('tags', $this->tags);
         if (!empty($this->tags)) {
             $tags_words = str_replace(", ", ",", $this->tags);
             $tags_count = substr_count($tags_words, ',');
             if ($tags_count > 1) {
                 $tags_words = $tags_words;
             }
             $tag_array = explode(",", $tags_words);
             $c = count($tag_array);
             $tag_array[$c] = $this->tags;
             $c++;
             for ($i = 0; $i <= $c; $i++) {
                 if (isset($tag_array[$i])) {
                     if ($URLMethod == 1) {
                         $tags_url_array[$i] = my_pligg_base . "/search.php?search=" . urlencode(trim($tag_array[$i])) . "&amp;tag=true";
                     } elseif ($URLMethod == 2) {
                         $tags_url_array[$i] = my_pligg_base . "/tag/" . urlencode(trim($tag_array[$i]));
                     }
                 }
             }
             $tag_array[$c - 1] = $alltagtext;
             $smarty->assign('tag_array', $tag_array);
             $smarty->assign('tags_url_array', $tags_url_array);
             $tags_url = urlencode($this->tags);
             $smarty->assign('tags_count', $tags_count);
             $smarty->assign('tags_words', $tags_words);
             $smarty->assign('tags_url', $tags_url);
         }
     }
     $smarty->assign('enable_group', enable_group);
     $smarty->assign('pagename', pagename);
     $smarty->assign('my_base_url', my_base_url);
     $smarty->assign('my_pligg_base', my_pligg_base);
     $smarty->assign('Default_Gravatar_Large', Default_Gravatar_Large);
     $link_index++;
     $vars['smarty'] = $smarty;
     check_actions('lib_link_summary_fill_smarty', $vars);
     return $smarty;
 }
Exemplo n.º 30
0
 function print_summary($link, $length = 0, $single_link = true)
 {
     global $current_user, $globals;
     if (!$this->read) {
         return;
     }
     echo '<li id="ccontainer-' . $this->id . '">';
     $this->hidden = $this->karma < -50;
     if ($this->hidden) {
         $comment_meta_class = 'comment-meta-hidden';
         $comment_class = 'comment-body-hidden';
     } else {
         $comment_meta_class = 'comment-meta';
         $comment_class = 'comment-body';
     }
     echo '<div class="' . $comment_class . '">';
     echo '<a href="' . $link->get_relative_permalink() . '#comment-' . $this->order . '"><strong>#' . $this->order . '</strong></a>';
     if ($single_link) {
         echo '<span id="comment-' . $this->order . '">';
     }
     echo '&nbsp;&nbsp;&nbsp;<span  id="cid-' . $this->id . '">';
     if ($this->hidden && $current_user->user_comment_pref == 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>';
     } else {
         $this->print_text($length, $single_link);
     }
     if ($single_link) {
         echo '</span>';
     }
     echo '</span></div>';
     // The comments info bar
     echo '<div class="' . $comment_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 && $single_link) {
         $this->print_shake_icons();
     }
     echo _('votos') . ': <span id="vc-' . $this->id . '">' . $this->votes . '</span>, karma: <span id="vk-' . $this->id . '">' . $this->karma . '</span>';
     echo '</div>';
     // Print comment info (right)
     echo '<div class="comment-info">';
     echo _('por') . ' ';
     if ($single_link) {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '" id="cauthor-' . $this->order . '">' . $this->username . '</a> ';
     } else {
         echo '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '">' . $this->username . '</a> ';
     }
     // Print dates
     if (time() - $this->date > 604800) {
         // 7 days
         echo _('el') . get_date_time($this->date);
     } else {
         echo _('hace') . ' ' . txt_time_diff($this->date);
     }
     if (!$this->hidden) {
         echo '<img src="' . get_avatar_url($this->author, $this->avatar, 20) . '" width="20" height="20" alt="' . $this->username . '" title="' . $this->username . ',&nbsp;karma:&nbsp;' . $this->user_karma . '" />';
     }
     echo '</div></div>';
     echo "</li>\n";
 }