Esempio n. 1
0
 function print_summary($link = 0, $length = 0, $single_link = true)
 {
     global $current_user, $globals;
     if (!$this->read) {
         return;
     }
     if (!$link && $this->link > 0) {
         $link = new Link();
         $link->id = $this->link;
         $link->read();
         $this->link_object = $link;
     }
     $this->link_permalink = $link->get_relative_permalink();
     $this->check_visibility();
     if ($this->hidden) {
         $comment_meta_class = 'comment-meta-hidden';
         $comment_class = 'comment-body-hidden';
     } else {
         $comment_meta_class = 'comment-meta';
         $comment_class = 'comment-body';
         if ($this->karma > $globals['comment_highlight_karma']) {
             $comment_class .= ' high';
         }
     }
     $this->truncate($length);
     $this->txt_content = $this->to_html($this->content);
     if ($this->type == 'admin') {
         $author = '<strong>' . _('admin') . '</strong> ';
     } else {
         $author = '<a href="' . get_user_uri($this->username) . '" title="karma:&nbsp;' . $this->user_karma . '">' . $this->username . '</a> ';
     }
     if ($this->media_size > 0) {
         $this->media_thumb_dir = Upload::get_cache_relative_dir($this->id);
     }
     $vars = compact('comment_meta_class', 'comment_class', 'author');
     $vars['self'] = $this;
     return Haanga::Load('mobile/comment_summary.html', $vars);
 }
Esempio n. 2
0
	function print_summary($link = 0, $length = 0, $single_link=true, $no_padding = false) {
		global $current_user, $globals;

		if(!$this->read) return;

		if (! $link && $this->link > 0) {
			$link = new Link;
			$link->id = $this->link;
			$link->read();
			$this->link_object = $link;
		}


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


    if ($this->nested_level == 1) 
      $no_padding = true;

    if ($no_padding) {
      $padding = 0;//(int)$this->level * 30;
    } else {
      $padding = 33;//(int)$this->level * 30;
    }

		//echo '<div id="c-'.$html_id.'" class="'.(($this->nested_level>1)?'cmt':'cmt').'" style="margin-left:'.$padding.'px;" >';
    echo '<style>';
    echo '
div.cmt {
  border-width:0px 0px 0px 1px;
  border-style:dotted;
  border-color:#AADB7A;
}';
    echo '</style>';
		echo '<div id="c-'.$html_id.'" class="'.(($this->nested_level>1)?'cmt':'').'" style="margin-left:'.$padding.'px;" >';

    /*
		if ($this->type != 'admin' && $this->user_level != 'disabled') {
			// Print the votes info (left)

			if ($current_user->user_id > 0 
						&& $this->author != $current_user->user_id 
						&& $single_link
						&& $this->date > $globals['now'] - $globals['time_enabled_comments']
						&& $this->level != 'autodisabled') {
      */
				$this->print_shake_icons();
        /*
            } else {

                echo '<div style="float:left">';
                echo '<span id="c-votes-'.$this->id.'">';
                echo '<a href="javascript:menealo_comment('."$current_user->user_id,$this->id,1".')" title="'._('informativo, opinión razonada, buen humor...').'"><img src="'.$globals['base_static'].'img/common/vote-up02.png" width="18" height="16" alt="'._('voto positivo').'"/></a><br/>';
                echo '<a href="javascript:menealo_comment('."$current_user->user_id,$this->id,-1".')" title="'._('abuso, insulto, acoso, spam, magufo...').'"><img style="padding-top:5px;" src="'.$globals['base_static'].'img/common/vote-down02.png" width="18" height="16" alt="'._('voto negativo').'"/></a>&nbsp;';
                echo '</span>';
                echo '</div>';
            }
    }
         */

		$this->ignored = ($current_user->user_id > 0 && $this->type != 'admin' && User::friend_exists($current_user->user_id, $this->author) < 0);
		$this->hidden = ($globals['comment_highlight_karma'] > 0 && $this->karma < -$globals['comment_highlight_karma'])
						|| ($this->user_level == 'disabled' && $this->type != 'admin');

		if ($this->hidden || $this->ignored)  {
			$comment_meta_class = 'comment-meta-hidden';
			$comment_class = 'comment-body-hidden';
		} else {
			$comment_meta_class = 'comment-meta';
			$comment_class = 'comment-body';
			if ($this->type == 'admin') {
				$comment_class .= ' admin';
			} elseif ($globals['comment_highlight_karma'] > 0 && $this->karma > $globals['comment_highlight_karma']) {
				$comment_class .= ' high';
			}
		}
		$this->link_permalink =  $link->get_relative_permalink();

    /*
    $bgcolor = Array("R"=>hexdec("C5"),"G"=>hexdec("E7"),"B"=>hexdec("A4"));
    $n = $this->nested_level - 1;
    $bgcolor["R"] = min($bgcolor["R"] + (((255 - $bgcolor["R"]) / 5) * $n), 255);
    $bgcolor["G"] = min($bgcolor["G"] + (((255 - $bgcolor["G"]) / 5) * $n), 255);
    $bgcolor["B"] = min($bgcolor["B"] + (((255 - $bgcolor["B"]) / 5) * $n), 255);
    $bgcolor = dechex($bgcolor["R"]) . dechex($bgcolor["G"]) . dechex($bgcolor["B"]); 
     */
    $color_list = Array( '#C5E7A4',
      '#C4E6A2',
      '#A2E6A2',
      '#A2E6C4',
      '#A2E6E6',
      '#A2C4E6',
      '#A2A2E6',
      '#C4A2E6',
      '#E6A2E6',
      '#E6A2C4',
      '#E6A2A2',
      '#E6C4A2',
      '#E6E6A2',
      '#A6DA72',
      '#87CD42',
      '#A672DA',
      '#8742CD'
    );

    $bgcolor = $color_list[$this->nested_level];
    if (empty($bgcolor)) 
      $bgcolor = end($color_list);

		//echo '<div class="'.$comment_class.'" style="margin-bottom:10px;padding-bottom:5px;background-color:'.$bgcolor.' !important;">';
		echo '<div class="'.$comment_class.'" style="margin-bottom:10px;padding-bottom:5px;background-color:white;min-width:600px;">';
		//echo '<a href="'.$this->link_permalink.'/000'.$this->order.'"><strong>#'.$this->order.'</strong></a>';
    echo '<a href="#" class="f-'.$this->id.' fold" style="font-family:verdana;font-size:x-small;" ></strong>(-)</strong></a>';

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

		if ($this->ignored || ($this->hidden && ($current_user->user_comment_pref & 1) == 0)) {
			echo '&#187;&nbsp;<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-'.$this->id.'\',0,'.$this->id.')" title="'._('ver comentario').'">'._('ver comentario').'</a>';
		echo '</span>';
		} else {
			$this->print_text($length, $html_id);
			echo '</span>';
		}
		//echo '</div>';
    

		// The comments info bar
		echo '<div class="'.$comment_meta_class.' comment_mc" >';
		// Check that the user can vote
		echo '<div class="comment-votes-info">';

    echo '<a class="comment_vi" href="#c-'.$this->c_order.'" >#'.$this->c_order.'</a> ';

		if ($this->type != 'admin' && $this->user_level != 'disabled') {
			// Print the votes info (left)

      /*
			if ($current_user->user_id > 0 
						&& $this->author != $current_user->user_id 
						&& $single_link
						&& $this->date > $globals['now'] - $globals['time_enabled_comments']
						&& $this->level != 'autodisabled') {
				//$this->print_shake_icons();
			}
       */

			echo _('votos').': <span id="vc-'.$this->id.'">'.$this->votes.'</span>, '._('karma').': <span id="vk-'.$this->id.'">'.$this->karma.'</span>&nbsp;';
			// Add the icon to show votes
			if ($this->votes > 0 && $this->date > $globals['now'] - 30*86400) { // Show votes if newer than 30 days
				echo '<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/get_c_v.php?id='.$this->id.'\')">';
				echo '<img src="'.$globals['base_static'].'img/common/vote-info02.png" width="18" height="16" alt="+ info" title="'._('¿quién ha votado?').'"/>';
				echo '</a>';
			}
		}


		// Comment reply
		if ($current_user->user_id > 0 && $globals['link'] && $globals['link']->date > $globals['now'] - $globals['time_enabled_comments']) {
			echo '<a href="javascript:comment_reply('.$this->order.','.$this->id.')" title="'._('responder').'"><img src="'.$globals['base_static'].'img/common/reply02.png" width="18" height="16"/></a>';
		}
		
		// Comment permalink
		echo '<a href="'.$this->get_relative_individual_permalink().'" title="permalink"><img class="link-icon" src="'.$globals['base_static'].'img/common/link-02.png" width="18" height="16" alt="link" title="'._('enlace permanente').'"/></a>';


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

		}
		echo '</div>';



    
		// Print comment info (right)
		echo '<div class="comment-info">';

		if ($this->type == 'admin') {
			$author = '<strong>'._('admin').'</strong> ';
			if ($current_user->admin) {
				$author .= ' ('.$this->username.')';
			}
		} elseif ($single_link) {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'" id="cauthor-'.$this->order.'">'.$this->username.'</a>';
		} else {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'">'.$this->username.'</a>';
		}

		// Print dates
		if ($this->modified > $this->date + 1) {
			$edited = sprintf('<strong title="'. _('editado %s después').'">*&nbsp;</strong>', txt_time_diff($this->date, $this->modified));
		} else $edited = '';

		if (!$this->hidden && $this->type != 'admin' && $this->avatar) {
			$avatar = get_avatar_url($this->author, $this->avatar, 20);
		} else {
			$avatar = get_no_avatar_url(20);
		}


		if ($globals['now'] - $this->date > 604800) { // 7 days
			printf(_('el %s %s por %s'), get_date_time($this->date), $edited, $author);
		} else {
			printf(_('fai %s %s por %s'), txt_time_diff($this->date), $edited, $author);
		}
		
		echo '<img src="'.$avatar.'" width="20" height="20" alt="" title="'.$this->username.',&nbsp;karma:&nbsp;'.$this->user_karma.'" />';

		echo '</div>';
     
		echo '</div></div>';
	}
Esempio n. 3
0
function do_best_queued()
{
    global $db, $globals, $dblang;
    if ($globals['mobile']) {
        return;
    }
    $foo_link = new Link();
    $key = 'best_queued_' . $globals['css_main'] . '_' . $globals['meta_current'];
    if (memcache_mprint($key)) {
        return;
    }
    if ($globals['meta_current'] && $globals['meta_categories']) {
        $category_list = 'and link_category in (' . $globals['meta_categories'] . ')';
        $title = sprintf(_('candidatas en «%s»'), $globals['meta_current_name']);
    } else {
        $category_list = '';
        $title = _('candidatas');
    }
    $output = '<div class="sidebox"><div class="header"><h4><a href="' . $globals['base_url'] . 'promote.php">' . $title . '</a></h4></div>';
    $min_date = date("Y-m-d H:i:00", $globals['now'] - 86400 * 4);
    // 4 days
    // The order is not exactly the votes
    // but a time-decreasing function applied to the number of votes
    $res = $db->get_results("select link_id from links where link_status='queued' and link_date > '{$min_date}' {$category_list} order by link_karma desc limit 15");
    if ($res) {
        $link = new Link();
        foreach ($res as $l) {
            $output .= '<div class="cell">';
            $link->id = $l->link_id;
            $link->read();
            $url = $link->get_relative_permalink();
            $output .= '<div class="votes queued">' . ($link->votes + $link->anonymous) . '</div>';
            if ($link->negatives >= $link->votes / 10) {
                // add the warn icon if it has 10% negatives
                $warn = 'style="padding-left:20px;background: url(../../img/common/error_s.png) no-repeat left center"';
            } else {
                $warn = '';
                // Show the thumbnail only if it has less than 10% negatives
                if ($thumb = $link->has_thumb()) {
                    $link->thumb_x = round($link->thumb_x / 2);
                    $link->thumb_y = round($link->thumb_y / 2);
                    $output .= "<img src='{$thumb}' width='{$link->thumb_x}' height='{$link->thumb_y}' alt='' class='thumbnail'/>";
                }
            }
            $output .= '<h5 ' . $warn . '><a href="' . $url . '">' . $link->title . '</a></h5>';
            $output .= '</div>';
            // class="cell";
        }
        $output .= '</div>' . "\n";
        echo $output;
        memcache_madd($key, $output, 180);
    }
}
Esempio n. 4
0
function do_best_comments()
{
    global $db, $globals, $dblang;
    $foo_link = new Link();
    if (memcache_mprint('best_comments')) {
        return;
    }
    $min_date = date("Y-m-d H:i:00", $globals['now'] - 22000);
    // about 6 hours
    $res = $db->get_results("select comment_id, comment_order, user_login, link_id, link_uri, link_title, link_comments from comments, links, users  where comment_date > '{$min_date}' and comment_karma > 10 and comment_link_id = link_id and comment_user_id = user_id order by comment_karma desc limit 12");
    if ($res) {
        $output = '<div class="vertical-box">';
        $output .= '<h4><a href="' . $globals['base_url'] . 'topcomments.php">' . _('mejores comentarios') . '</a></h4><ul>' . "\n";
        foreach ($res as $comment) {
            $foo_link->uri = $comment->link_uri;
            $link = $foo_link->get_relative_permalink() . get_comment_page_suffix($globals['comments_page_size'], $comment->comment_order, $comment->link_comments) . '#comment-' . $comment->comment_order;
            $output .= '<li>' . $comment->user_login . ' ' . _('en') . ' <a  onmouseout="tooltip.clear(event);"  onclick="tooltip.clear(this);" onmouseover="return tooltip.ajax_delayed(event, \'get_comment_tooltip.php\', \'' . $comment->comment_id . '\', 10000);" href="' . $link . '">' . $comment->link_title . '</a></li>' . "\n";
        }
        $output .= '</ul></div>';
        echo $output;
        memcache_madd('best_comments', $output, 300);
    }
}
Esempio n. 5
0
<?php

// The source code packaged with this file is Free Software, Copyright (C) 2009 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
if ($globals['url_shortener_mobile_to'] && $globals['mobile']) {
    $server_to = $globals['url_shortener_mobile_to'];
} else {
    $server_to = $globals['url_shortener_to'];
}
if (preg_match('/^\\/*$/', $_SERVER['PATH_INFO'])) {
    header('Location: http://' . $server_to);
    die;
}
$url_args = preg_split('/\\/+/', $_SERVER['PATH_INFO']);
// If the first argument are only numbers, redirect to the story with that id
$link = new Link();
if (preg_match('/^[\\da-z]+$/', $url_args[1])) {
    $link->id = intval(base_convert($url_args[1], 36, 10));
    if ($link->read_basic('id')) {
        header('HTTP/1.1 301 Moved');
        header('Location: http://' . $server_to . $link->get_relative_permalink());
        die;
    }
}
not_found('Link not found');
die;
Esempio n. 6
0
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include '../config.php';
include mnminclude . 'comment.php';
include mnminclude . 'link.php';
header('Content-Type: text/html; charset=utf-8');
stats_increment('ajax');
$id = intval($_GET['id']);
if (!$id > 0) {
    die;
}
$comment = new Comment();
$comment->id = $id;
$comment->read();
if (!$comment->read) {
    die;
}
$link = new Link();
$link->id = $comment->link;
$link->read_basic();
echo '<div style="font-size:8.5pt;width:280px; margin-right:15px; overflow:hidden">';
if ($comment->avatar) {
    echo '<img src="' . get_avatar_url($comment->author, $comment->avatar, 40) . '" width="40" height="40" alt="avatar" style="float:left; margin: 0 5px 4px 0;"/>';
}
echo '<a href="' . $link->get_relative_permalink() . '#comment-' . $comment->order . '" target="_blank"><strong>' . $comment->username . '</strong></a><br/>';
echo put_smileys(text_to_summary($comment->content, 500));
echo '</div>';
Esempio n. 7
0
// Ricardo Galli <gallir at uib dot es> and
// Beldar <beldar.cat at gmail dot com>
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// 		http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// The code below was made by Beldar <beldar at gmail dot com>
if (!defined('mnmpath')) {
    include_once '../config.php';
    header('Content-Type: text/html; charset=utf-8');
}
include_once mnminclude . 'comment.php';
include_once mnminclude . 'link.php';
stats_increment('ajax');
if (empty($_GET['id'])) {
    die;
}
$id = intval($_GET['id']);
$comment = new Comment();
$comment->id = $id;
$comment->read();
if (!$comment->read) {
    die;
}
$link = new Link();
$link->id = $comment->link;
if (!$link->read_basic()) {
    die;
}
$comment->link_permalink = $link->get_relative_permalink();
$comment->print_text(0);
Esempio n. 8
0
	function print_summary($link = 0, $length = 0, $single_link=true) {
		global $current_user, $globals;

		if(!$this->read) return;

		if (! $link && $this->link > 0) {
			$link = new Link;
			$link->id = $this->link;
			$link->read();
			$this->link_object = $link;
		}


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

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

		$this->ignored = ($current_user->user_id > 0 && $this->type != 'admin' && User::friend_exists($current_user->user_id, $this->author) < 0);
		$this->hidden = ($globals['comment_highlight_karma'] > 0 && $this->karma < -$globals['comment_highlight_karma'])
						|| ($this->user_level == 'disabled' && $this->type != 'admin');

		if ($this->hidden || $this->ignored)  {
			$comment_meta_class = 'comment-meta-hidden';
			$comment_class = 'comment-body-hidden';
		} else {
			$comment_meta_class = 'comment-meta';
			$comment_class = 'comment-body';
			if ($this->type == 'admin') {
				$comment_class .= ' admin';
			} elseif ($globals['comment_highlight_karma'] > 0 && $this->karma > $globals['comment_highlight_karma']) {
				$comment_class .= ' high';
			}
		}
		$this->link_permalink =  $link->get_relative_permalink();
		echo '<div class="'.$comment_class.'">';
		echo '<a href="'.$this->link_permalink.'/000'.$this->order.'"><strong>#'.$this->order.'</strong></a>';

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

		if ($this->ignored || ($this->hidden && ($current_user->user_comment_pref & 1) == 0)) {
			echo '&#187;&nbsp;<a href="javascript:get_votes(\'get_comment.php\',\'comment\',\'cid-'.$this->id.'\',0,'.$this->id.')" title="'._('ver comentario').'">'._('ver comentario').'</a>';
		echo '</span>';
		} else {
			$this->print_text($length, $html_id);
			echo '</span>';
		}
		echo '</div>';

		// The comments info bar
		echo '<div class="'.$comment_meta_class.'">';
		// Check that the user can vote
		echo '<div class="comment-votes-info">';
		if ($this->type != 'admin' && $this->user_level != 'disabled') {
			// Print the votes info (left)

			if ($current_user->user_id > 0 
						&& $this->author != $current_user->user_id 
						&& $single_link
						&& $this->date > $globals['now'] - $globals['time_enabled_comments']
						&& $this->level != 'autodisabled') {
				$this->print_shake_icons();
			}

			echo _('votos').': <span id="vc-'.$this->id.'">'.$this->votes.'</span>, '._('karma').': <span id="vk-'.$this->id.'">'.$this->karma.'</span>&nbsp;';
			// Add the icon to show votes
			if ($this->votes > 0 && $this->date > $globals['now'] - 30*86400) { // Show votes if newer than 30 days
				echo '<a href="javascript:modal_from_ajax(\''.$globals['base_url'].'backend/get_c_v.php?id='.$this->id.'\')">';
				echo '<img src="'.$globals['base_static'].'img/common/vote-info02.png" width="18" height="16" alt="+ info" title="'._('¿quién ha votado?').'"/>';
				echo '</a>';
			}
		}

		// Comment reply
		if ($current_user->user_id > 0 && $globals['link'] && $globals['link']->date > $globals['now'] - $globals['time_enabled_comments']) {
			echo '<a href="javascript:comment_reply('.$this->order.')" title="'._('responder').'"><img src="'.$globals['base_static'].'img/common/reply02.png" width="18" height="16"/></a>';
		}
		
		// Comment permalink
		echo '<a href="'.$this->get_relative_individual_permalink().'" title="permalink"><img class="link-icon" src="'.$globals['base_static'].'img/common/link-02.png" width="18" height="16" alt="link" title="'._('enlace permanente').'"/></a>';


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



		// Print comment info (right)
		echo '<div class="comment-info">';

		if ($this->type == 'admin') {
			$author = '<strong>'._('admin').'</strong> ';
			if ($current_user->admin) {
				$author .= ' ('.$this->username.')';
			}
		} elseif ($single_link) {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'" id="cauthor-'.$this->order.'">'.$this->username.'</a>';
		} else {
			$author = '<a href="'.get_user_uri($this->username).'" title="karma:&nbsp;'.$this->user_karma.'">'.$this->username.'</a>';
		}

		// Print dates
		if ($this->modified > $this->date + 1) {
			$edited = sprintf('<strong title="'. _('editado %s después').'">*&nbsp;</strong>', txt_time_diff($this->date, $this->modified));
		} else $edited = '';

		if (!$this->hidden && $this->type != 'admin' && $this->avatar) {
			$avatar = get_avatar_url($this->author, $this->avatar, 20);
		} else {
			$avatar = get_no_avatar_url(20);
		}


		if ($globals['now'] - $this->date > 604800) { // 7 days
			printf(_('el %s %s por %s'), get_date_time($this->date), $edited, $author);
		} else {
			printf(_('hace %s %s por %s'), txt_time_diff($this->date), $edited, $author);
		}
		
		echo '<img src="'.$avatar.'" width="20" height="20" alt="" title="'.$this->username.',&nbsp;karma:&nbsp;'.$this->user_karma.'" />';

		echo '</div></div>';
		echo "</div>\n";
	}
Esempio n. 9
0
$link = new Link();
header("Content-type: text/html; charset=utf-8");
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $dblang . '">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<link rel="stylesheet" href="mueveme.css" type="text/css" />';
echo "<title>Mu&eacute;veme</title>\n";
echo '<meta name="generator" content="meneame" />' . "\n";
echo '</head>' . "\n";
echo '<body>';
echo '<div class="header">Muéveme</div>' . "\n";
echo '<div class="links">';
echo '<a href="notame/">Nótame</a>';
echo '</div>';
echo "<ul>\n";
$links = $db->get_col("SELECT link_id from links where link_status='published' order by link_date desc LIMIT {$page_size}");
if ($links) {
    foreach ($links as $link_id) {
        $link->id = $link_id;
        $link->read();
        $title_short = wordwrap($link->title, 36, " ", 1);
        echo '<li><a href="' . htmlspecialchars($link->url) . '">' . $title_short . '</a> ';
        echo "<em>[{$link->votes} " . _('meneos') . ", {$link->comments} " . _('comentarios') . "]</em>. ";
        echo '<span class="text">' . text_to_html($link->content) . '</span>';
        echo '&nbsp;&#187;&nbsp;<a href="http://meneame.net' . $link->get_relative_permalink() . '"><em>' . _('en menéame') . '</em></a>';
        echo "</li>\n";
    }
}
echo "</ul>\n";
echo "</body></html>";
Esempio n. 10
0
     $karma_mess = sprintf("<br>updated karma: %6d (%d, %d) -> %-6d (%d, %d)\n", $link->karma, $link->votes, $link->negatives, round($dblink->karma), $votes_pos, $votes_neg);
     if ($link->karma > $dblink->karma) {
         $changes = 1;
     } else {
         $changes = 2;
     }
     // increase
     $link->karma = round($dblink->karma);
     $link->votes = $votes_pos;
     $link->negatives = $votes_neg;
     $link->store_basic();
 } else {
     $karma_mess = '';
 }
 print "<tr><td class='tnumber{$imod}'>{$link->id}</td><td class='tnumber{$imod}'>" . $link->votes . "</td><td class='tnumber{$imod}'>" . $link->negatives . "</td><td class='tnumber{$imod}'>" . sprintf("%0.2f", $new_coef) . "</td><td class='tnumber{$imod}'>" . intval($link->karma) . "</td>";
 echo "<td class='tdata{$imod}'><a href='" . $link->get_relative_permalink() . "'>{$link->title}</a>\n";
 echo $karma_mess;
 if ($user->level == 'disabled') {
     echo " {$user->username} disabled, probably due to abuses, anonymous votes ignored.";
 }
 echo "</td>\n";
 if ($link->user_level != 'disabled' && $link->votes >= $min_votes && $dblink->karma >= $karma_threshold && $published < $max_to_publish) {
     $published++;
     $link->karma = round($dblink->karma);
     $link->status = 'published';
     $link->published_date = time();
     $link->store_basic();
     // Add the publish event/log
     log_insert('link_publish', $link->id, $link->author);
     $changes = 3;
     // to show a "published" later
Esempio n. 11
0
$counter = 0;
$comment = new Comment();
$link = new Link();
echo '<div class="comments">';
$min_date = date("Y-m-d H:00:00", time() - 86000);
//  about 24 hours
$comments = $db->get_results("SELECT comment_id, link_id FROM comments, links WHERE comment_date > '{$min_date}' and link_id=comment_link_id ORDER BY comment_karma desc, link_id asc limit 25");
if ($comments) {
    foreach ($comments as $dbcomment) {
        $link->id = $dbcomment->link_id;
        $comment->id = $dbcomment->comment_id;
        $link->read();
        $comment->read();
        if ($last_link != $link->id) {
            echo '<h3>';
            echo '<a href="' . $link->get_relative_permalink() . '">' . $link->title . '</a>';
            echo '</h3>';
        }
        echo '<ol class="comments-list">';
        echo '<li>';
        $comment->print_summary($link, 2000, false);
        echo '</li>';
        if ($last_link != $link->id) {
            $last_link = $link->id;
            $counter++;
        }
        echo "</ol>\n";
    }
}
echo '</div>';
echo '</div>';
Esempio n. 12
0
} elseif(is_numeric($_REQUEST['id'])) {
	$key = 'id';
	$link->id=intval($_REQUEST['id']);
} else {
	echo "duh?\n";
	die;
}


if (! $link->read($key) ) {
	header('Location: http://'.get_server_name().$globals['base_url']);
	die;
}

if ($_REQUEST['id'] > 0 && !empty($link->uri)) {
	if ($_SERVER['REQUEST_URI'] != $link->get_relative_permalink()) {
		//header("HTTP/1.1 301 Moved Permanently");
		header('Location: ' . $link->get_permalink());
		die;
	}
}

// Set globals
$globals['link']=$link;
$globals['link_id']=$link->id;
$globals['category_id']=$link->category;
$globals['category_name']=$link->category_name();
if ($link->status != 'published') 
	$globals['do_vote_queue']=true;
if (!empty($link->tags))
	$globals['tags']=$link->tags;