Пример #1
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('&', '&', 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;
 }
Пример #2
0
 function listado_cartera()
 {
     global $db, $config;
     echo "<div id=\"listado-cartera\">\r\n";
     // Caja novedades
     caja_novedades();
     $SELECT = "SELECT usuario_saldo, usuario_id, usuario_email, usuario_grupo FROM usuarios WHERE usuario_id='" . $_SESSION["usuario_id"] . "'";
     $saldo = $db->get_results($SELECT);
     $SELECT = "SELECT SUM(saldo) as saldototal FROM carteras WHERE usuario='" . $_SESSION["usuario"] . "' AND acciones>='1'";
     $invertido = $db->get_results($SELECT);
     echo "<div>";
     echo "<fieldset><legend>Perfil de <b><a href=\"index.php?usuario=" . $_SESSION["usuario"] . "\">" . $_SESSION["usuario"] . "</a></b></legend>";
     echo "<div class=\"doscolumnas\">";
     echo "<div class=\"col2izq\"> <a href=\"index.php?log=" . $_SESSION["usuario"] . "\">Historial</a> </div>";
     echo "<div class=\"col2der\">&nbsp;";
     echo "<a href=\"index.php?usuario=" . $_SESSION["usuario"] . "\"><img src=\"" . gravatar($_SESSION["usuario"], "50") . "\" alt=\"" . $usuario . "\" title=\"" . $usuario . "\" align=\"right\" border=\"0\"></a>";
     echo "</div>";
     if ($saldo[0]->usuario_grupo) {
         echo "<div class=\"col2izq\">&nbsp;Grupo:</div>";
         $nombre_grupo = $db->get_var("SELECT grupo_nombre FROM grupos WHERE grupo_id='" . $saldo[0]->usuario_grupo . "'");
         echo "<div class=\"col2der\">";
         echo "<b>&nbsp;<a href=\"ranking.php?grupo=" . $nombre_grupo . "\">" . $nombre_grupo . "</a></b>";
         if ($_SESSION["usuario"] == $db->get_var("SELECT grupo_admin FROM grupos WHERE grupo_id='" . $saldo[0]->usuario_grupo . "'")) {
             $solicitudes = $db->get_var("SELECT count(*) from grupos_solicitud WHERE grupo_id='" . $saldo[0]->usuario_grupo . "'");
             if ($solicitudes >= 1) {
                 echo "<br /><a href=\"index.php?usuario=" . $_SESSION["usuario"] . "\">" . $solicitudes . " pendientes</a>";
             }
         }
         echo " </div>";
     }
     echo "<div class=\"col2izq\">&nbsp;Saldo:</div>";
     echo "<div class=\"col2der\">&nbsp;<b>" . number_format($saldo[0]->usuario_saldo, 2, ",", ".") . "</b> €</div>";
     echo "<div class=\"col2izq\">&nbsp;Invertido:</div><div class=\"col2der\"> <b>" . number_format($invertido[0]->saldototal, 2, ",", ".") . "</b> €</div>";
     $total = $saldo[0]->usuario_saldo + $invertido[0]->saldototal;
     echo "<div class=\"col2izq\">&nbsp;Total:</div><div class=\"col2der\">&nbsp; <b>" . number_format($total, 2, ",", ".") . "</b> €</div>";
     echo "</div>";
     echo "</fieldset>";
     echo "</div>";
     // Caja Karma
     caja_karma();
     echo "<a href=\"rss.php?usuario=" . $_SESSION["usuario"] . "\"><img src=\"images/rss.jpg\" border=\"0\"></a> Tu cartera: ";
     $SELECT = "SELECT * FROM carteras WHERE usuario='" . $_SESSION["usuario"] . "' AND acciones>='1' ORDER BY ticker";
     $result = $db->get_results($SELECT);
     $row = 0;
     while (isset($result[$row]->id)) {
         echo "<div id=\"cartera-" . $result[$row]->ticker . "\">";
         $SELECT = "SELECT valor, timestamp FROM quotes WHERE ticker='" . $result[$row]->ticker . "' ORDER BY 'timestamp' DESC LIMIT 0 , 1 ";
         $valor = $db->get_results($SELECT);
         $valor_actual = $valor[0]->valor * $result[$row]->acciones;
         $comision = $valor_actual * $config['comision'] / 100 * 2;
         echo "\r\n";
         if ($valor_actual < $result[$row]->saldo) {
             echo "<fieldset class=\"baja\">";
         } else {
             if ($valor_actual > $result[$row]->saldo) {
                 echo "<fieldset class=\"sube\">";
             } else {
                 echo "<fieldset>";
             }
         }
         echo "<legend><a href=\"index.php?ticker=" . $result[$row]->ticker . "\">" . $result[$row]->ticker . "</a> " . $valor[0]->valor . " € </legend>";
         echo "<div class=\"doscolumnas\">";
         echo "<div class=\"col2izq\">Acciones: </div><div class=\"col2der\">" . $result[$row]->acciones . "</div>";
         echo "<div class=\"col2izq\">Invertido: </div><div class=\"col2der\">" . number_format($result[$row]->saldo, 2, ",", ".") . " €</div>";
         echo "<div class=\"col2izq\">Actual: </div><div class=\"col2der\">" . number_format($valor_actual, 2, ",", ".") . " € </div>";
         $diferencia = $valor_actual - $result[$row]->saldo;
         $diferencia_porcentaje = $valor_actual * 100 / $result[$row]->saldo - 100;
         echo "<div class=\"col2izq\">Diferencia %:</div><div class=\"col2der\">" . number_format($diferencia_porcentaje, 2, ",", ".") . " %</div>";
         echo "<div class=\"col2izq\">Diferencia: </div><div class=\"col2der\">" . number_format($diferencia, 2, ",", ".") . " € </div>";
         $alertas = $db->get_var("SELECT count(id) from alertas where usuario='" . $_SESSION["usuario"] . "' AND ticker='" . $result[$row]->ticker . "'");
         $alertas_cumplidas = $db->get_var("SELECT count(id) from alertas where usuario='" . $_SESSION["usuario"] . "' AND ticker='" . $result[$row]->ticker . "' AND estado='AVISADO'");
         //Cambiar al activar alertas
         if ($alertas >= 1) {
             echo "<div class=\"col2izq\">Alertas: </div><div class=\"col2der\">(<strong>" . $alertas_cumplidas . "</strong> / " . $alertas . ")</div>";
         }
         if ($result[$row]->notas) {
             echo "<div class=\"col2izq\"><b>Tus notas:</b></div>";
             $notas = txt_shorter($result[$row]->notas);
             echo "<div class=\"col2der\"><a href=\"index.php?ticker=" . $result[$row]->ticker . "\">" . $notas . "</a>";
             echo "</div>";
         }
         echo "</div>";
         // fin doscolumnas
         echo "</fieldset>";
         echo "</div>";
         // Fin div cartera (ajax)
         $row++;
     }
     echo "</div>\r\n";
     //end div listado-cartera
 }
Пример #3
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";
		}

	}
Пример #4
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";

	}
Пример #5
0
        echo "<fieldset class=\"sube\">";
    } else {
        echo "<fieldset>";
    }
}
echo "<legend><a href=\"index.php?ticker=" . $result[$row]->ticker . "\">" . $result[$row]->ticker . "</a> " . $valor[0]->valor . " € </legend>";
echo "<div class=\"doscolumnas\">";
echo "<div class=\"col2izq\">Acciones: </div><div class=\"col2der\">" . $result[$row]->acciones . "</div>";
echo "<div class=\"col2izq\">Invertido: </div><div class=\"col2der\">" . number_format($result[$row]->saldo, 2, ",", ".") . " €</div>";
echo "<div class=\"col2izq\">Actual: </div><div class=\"col2der\">" . number_format($valor_actual, 2, ",", ".") . " € </div>";
$diferencia = $valor_actual - $result[$row]->saldo;
$diferencia_porcentaje = $valor_actual * 100 / $result[$row]->saldo - 100;
echo "<div class=\"col2izq\">Diferencia %:</div><div class=\"col2der\">" . number_format($diferencia_porcentaje, 2, ",", ".") . " %</div>";
echo "<div class=\"col2izq\">Diferencia: </div><div class=\"col2der\">" . number_format($diferencia, 2, ",", ".") . " € </div>";
$alertas = $db->get_var("SELECT count(id) from alertas where usuario='" . $_SESSION["usuario"] . "' AND ticker='" . $result[$row]->ticker . "'");
$alertas_cumplidas = $db->get_var("SELECT count(id) from alertas where usuario='" . $_SESSION["usuario"] . "' AND ticker='" . $result[$row]->ticker . "' AND estado='AVISADO'");
//Cambiar al activar alertas
if ($alertas >= 1) {
    echo "<div class=\"col2izq\">Alertas: </div><div class=\"col2der\">(<strong>" . $alertas_cumplidas . "</strong> / " . $alertas . ")</div>";
}
if ($result[$row]->notas) {
    echo "<div class=\"col2izq\"><b>Tus notas:</b></div>";
    $notas = txt_shorter($result[$row]->notas);
    echo "<div class=\"col2der\"><a href=\"index.php?ticker=" . $result[$row]->ticker . "\">" . $notas . "</a>";
    echo "</div>";
}
echo "</div>";
// fin doscolumnas
echo "</fieldset>";
?>
	
     $filter_sql = " comment_status != 'spam' AND comment_status != 'discard'";
 }
 $filtered = $db->get_results($sql = "SELECT SQL_CALC_FOUND_ROWS * FROM " . table_comments . " \r\n\t\t\t\t\t\t\tLEFT JOIN " . table_users . " ON user_id=comment_user_id\r\n\t\t\t\t\t\t\tWHERE {$filter_sql} {$search_sql} {$user_sql} \r\n\t\t\t\t\t\t\tORDER BY comment_date DESC LIMIT {$offset},{$pagesize}");
 $rows = $db->get_var("SELECT FOUND_ROWS()");
 // read comments from database
 $user = new User();
 $comment = new Comment();
 if ($filtered) {
     $template_comments = array();
     foreach ($filtered as $dbfiltered) {
         $comment->id = $dbfiltered->comment_id;
         $cached_comments[$dbfiltered->comment_id] = $dbfiltered;
         $comment->read();
         #	    $user->id = $comment->author;
         #	    $user->read();
         $template_comments[] = array('comment_id' => $comment->id, 'comment_content' => txt_shorter($comment->content, 90), 'comment_content_long' => $comment->content, 'comment_votes' => $comment->votes, 'comment_author' => $dbfiltered->user_login, 'comment_link_id' => $comment->link, 'comment_status' => $comment->status, 'comment_date' => $dbfiltered->comment_date);
     }
     $main_smarty->assign('template_comments', $template_comments);
 }
 // breadcrumbs and page title
 $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
 $navwhere['link1'] = getmyurl('admin', '');
 $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_Comments');
 $main_smarty->assign('navbar_where', $navwhere);
 $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
 if (isset($_GET['action']) && sanitize($_GET['action'], 3) == "bulkmod" && isset($_POST['submit'])) {
     $CSRF->check_expired('admin_comments_edit');
     $killspammed = array();
     if ($CSRF->check_valid(sanitize($_POST['token'], 3), 'admin_comments_edit')) {
         $comment = array();
         foreach ($_POST["comment"] as $k => $v) {
Пример #7
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";
 }
Пример #8
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";
     }
 }
Пример #9
0
function admin_bans($ban_type)
{
    global $db, $globals, $offset, $page_size, $ban_text_length, $ban_comment_length, $current_user;
    require_once mnminclude . 'ban.php';
    $key = get_security_key();
    if ($current_user->user_level == "god" && check_security_key($_REQUEST["key"])) {
        if (!empty($_REQUEST["new_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"]);
        } elseif (!empty($_REQUEST["edit_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"], $_POST["ban_id"]);
        } elseif (!empty($_REQUEST["new_bans"])) {
            $array = preg_split("/\\s+/", $_POST["ban_text"]);
            $size = count($array);
            for ($i = 0; $i < $size; $i++) {
                insert_ban($ban_type, $array[$i], $_POST["ban_comment"], $_POST["ban_expire"]);
            }
        } elseif (!empty($_REQUEST["del_ban"])) {
            del_ban($_REQUEST["del_ban"]);
        }
    }
    // ex container-wide
    echo '<div class="genericform" style="margin:0">';
    echo '<div style="float:right;">' . "\n";
    echo '<form method="get" action="' . $globals['base_url'] . 'admin/bans.php">';
    echo '<input type="hidden" name="admin" value="' . $ban_type . '" />';
    echo '<input type="hidden" name="key" value="' . $key . '" />';
    echo '<input type="text" name="s" ';
    if ($_REQUEST["s"]) {
        $_REQUEST["s"] = clean_text($_REQUEST["s"]);
        echo ' value="' . $_REQUEST["s"] . '" ';
    } else {
        echo ' value="' . _('buscar') . '..." ';
    }
    echo 'onblur="if(this.value==\'\') this.value=\'' . _('buscar') . '...\';" onfocus="if(this.value==\'' . _('buscar') . '...\') this.value=\'\';" />';
    echo '&nbsp;<input style="padding:2px;" type="image" align="top" value="' . _('buscar') . '" alt="' . _('buscar') . '" src="' . $globals['base_static'] . 'img/common/search-03.png" />';
    echo '</form>';
    echo '</div>';
    if ($current_user->user_level == "god") {
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=new">' . _('Nuevo ban') . '</a> ]';
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=news">' . _('Múltiples bans') . '</a> ]';
    }
    if (!empty($_REQUEST["op"])) {
        echo '<form method="post" name="newban" action="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '">';
        echo '<input type="hidden" name="key" value="' . $key . '" />';
    }
    echo '<table class="decorated" style="font-size: 10pt">';
    echo '<tr><th width="25%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_text">' . $ban_type . '</a></th>';
    echo '<th width="30%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_comment">' . _('comentario') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_date">' . _('fecha creación') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_expire">' . _('fecha caducidad') . '</a></th>';
    echo '<th>' . _('Editar / Borrar') . '</th></tr>';
    switch ($_REQUEST["op"]) {
        case 'new':
            echo '<tr><td>';
            echo '<input type="text" id="ban_text" name="ban_text" size="30" maxlength="' . $ban_text_length . '" value="" />';
            echo '&nbsp;<span id="checkit"><input type="button" id="checkbutton1" value="' . _('verificar') . '" onclick="checkfield(\'ban_' . $ban_type . '\', this.form, this.form.ban_text)"/></span>' . "\n";
            echo '<br /><span id="ban_' . $ban_type . 'checkitvalue"></span>' . "\n";
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_ban" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear ban') . '" />';
            echo '</td></tr>';
            break;
        case 'news':
            echo '<tr><td>';
            echo '<textarea id="ban_text" name="ban_text" /></textarea>';
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_bans" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear bans') . '" />';
            echo '</td></tr>';
            break;
        case 'edit':
            $ban = new Ban();
            $ban->ban_id = (int) $_REQUEST["id"];
            $ban->read();
            echo '<tr><td>';
            echo '<input type="text" name="ban_text" id="ban_text" size="30" maxlength="' . $ban_text_length . '" value="' . $ban->ban_text . '" />';
            echo '</td><td>';
            echo '<input type="text" class="form-full" name="ban_comment" id="ban_comment" value="' . $ban->ban_comment . '" />';
            echo '</td><td>';
            echo $ban->ban_date;
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            echo '<option value="' . $ban->ban_expire . '">' . $ban->ban_expire . '</option>';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="ban_id" value="' . $ban->ban_id . '" />';
            echo '<input type="submit" name="edit_ban" value="' . _('Editar ban') . '" />';
            echo '</td></tr>';
            break;
    }
    if (empty($_REQUEST["op"])) {
        //listado de bans
        if (empty($_REQUEST["orderby"])) {
            $_REQUEST["orderby"] = "ban_text";
        } else {
            $_REQUEST["orderby"] = preg_replace('/[^a-z_]/i', '', $_REQUEST["orderby"]);
            if ($_REQUEST["orderby"] == 'ban_date') {
                $order = "DESC";
            }
        }
        $where = "WHERE ban_type='" . $ban_type . "'";
        if ($_REQUEST["s"]) {
            $search_text = $db->escape($_REQUEST["s"]);
            $where .= " AND (ban_text LIKE '%{$search_text}%' OR ban_comment LIKE '%{$search_text}%')";
        }
        $bans = $db->get_col("SELECT ban_id FROM bans " . $where . " ORDER BY " . $_REQUEST["orderby"] . " {$order} LIMIT {$offset},{$page_size}");
        $rows = $db->get_var("SELECT count(*) FROM bans " . $where);
        if ($bans) {
            $ban = new Ban();
            foreach ($bans as $ban_id) {
                $ban->ban_id = $ban_id;
                $ban->read();
                echo '<tr>';
                echo '<td onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);" >' . clean_text($ban->ban_text) . '</td>';
                echo '<td style="overflow: hidden;white-space: nowrap;" onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);">' . clean_text(txt_shorter($ban->ban_comment, 50)) . '</td>';
                echo '<td>' . $ban->ban_date . '</td>';
                echo '<td>' . $ban->ban_expire . '</td>';
                echo '<td>';
                if ($current_user->user_level == "god") {
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=edit&amp;id=' . $ban->ban_id . '" title="' . _('Editar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-edit-notice01.png" alt="' . 'Editar' . '" /></a>';
                    echo '&nbsp;/&nbsp;';
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;del_ban=' . $ban->ban_id . '&amp;key=' . $key . '" title="' . _('Eliminar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-reject01.png" alt="' . 'Eliminar' . '" /></a>';
                }
                echo '</td>';
                echo '</tr>';
            }
        }
    }
    echo '</table>';
    if (!empty($_REQUEST["op"])) {
        echo "</form>\n";
    }
    do_pages($rows, $page_size, false);
}
Пример #10
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";
 }
Пример #11
0
             $rows = $db->get_var("SELECT count(*) FROM " . table_comments . " WHERE (comment_date >= {$tsdt} AND comment_date <= {$fsdt})");
             break;
     }
 }
 // read comments from database
 $user = new User();
 $comment = new Comment();
 if ($filtered) {
     $template_comments = array();
     foreach ($filtered as $dbfiltered) {
         $comment->id = $dbfiltered->comment_id;
         $cached_comments[$dbfiltered->comment_id] = $dbfiltered;
         $comment->read();
         $user->id = $comment->author;
         $user->read();
         $template_comments[] = array('comment_id' => $comment->id, 'comment_content' => txt_shorter($comment->content, 60), 'comment_content_long' => $comment->content, 'comment_votes' => $comment->votes, 'comment_author' => $user->username, 'comment_link_id' => $comment->link, 'comment_date' => txt_time_diff($comment->date));
     }
     $main_smarty->assign('template_comments', $template_comments);
 }
 // breadcrumbs and page title
 $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
 $navwhere['link1'] = getmyurl('admin', '');
 $navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_Comments');
 $main_smarty->assign('navbar_where', $navwhere);
 $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
 // if admin deletes comment
 if (isset($_GET['action']) && sanitize($_GET['action'], 3) == "bulkmod") {
     if (isset($_POST['submit'])) {
         $comment = array();
         foreach ($_POST["comment"] as $k => $v) {
             $comment[intval($k)] = sanitize($v, 3);
Пример #12
0
 function fill_smarty($smarty, $type = 'full')
 {
     static $link_index = 0;
     global $current_user, $globals, $the_template;
     $smarty->assign('link_id', $this->id);
     $smarty->display('blank.tpl');
     //this is just to load the lang file so we can pull from it in php
     if (!$this->read) {
         return;
     }
     $url = str_replace('&amp;', '&', htmlspecialchars($this->url));
     $url_short = txt_shorter($url);
     if ($this->url == "http://") {
         $url_short = "http://";
     } else {
         $parsed = parse_url($this->url);
         $url_short = $parsed['scheme'] . "://" . $parsed['host'];
     }
     $title_short = htmlspecialchars(utf8_wordwrap($this->title, 30, " ", 1));
     $smarty->assign('viewtype', $type);
     $smarty->assign('URL_tagcloud', getmyurl("tagcloud"));
     $smarty->assign('No_URL_Name', No_URL_Name);
     if (track_outgoing == true) {
         if (track_outgoing_method == "id") {
             $smarty->assign('url', getmyurl("out", $this->id));
         }
         if (track_outgoing_method == "title") {
             $smarty->assign('url', getmyurl("outtitle", $this->title_url));
         }
         if (track_outgoing_method == "url") {
             $smarty->assign('url', getmyurl("outurl", $url));
         }
     } else {
         $smarty->assign('url', $url);
     }
     $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));
     if ($this->title_url == "") {
         $smarty->assign('story_url', getmyurl("story", $this->id));
         // internal link to the comments page
     } else {
         $smarty->assign('story_url', getmyurl("storyURL", $this->category_safe_name(), urlencode($this->title_url), $this->id));
         // internal link to the comments page
     }
     $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);
     if ($type == "summary") {
         if ($this->link_summary == "") {
             $smarty->assign('story_content', $this->truncate_content());
         } else {
             $smarty->assign('story_content', $this->link_summary);
         }
     }
     if ($type == "full") {
         $smarty->assign('story_content', $this->content);
     }
     $smarty->assign('link_submitter', $this->username());
     $smarty->assign('submitter_profile_url', getmyurl('user', $this->username()));
     $smarty->assign('link_submit_time', $this->date);
     $smarty->assign('link_submit_timeago', txt_time_diff($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());
     //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);
     if (Voting_Method == 2) {
         $this->rating = $this->rating($this->id) / 2;
         $smarty->assign('link_rating', $this->rating);
         $smarty->assign('link_rating_width', $this->rating * 25);
         $js5link = "menealo({$current_user->user_id}, {$this->id}, {$link_index}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 10)";
         $smarty->assign('link_shakebox_javascript_vote_5star', $js5link);
         $js4link = "menealo({$current_user->user_id}, {$this->id}, {$link_index}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 8)";
         $smarty->assign('link_shakebox_javascript_vote_4star', $js4link);
         $js3link = "menealo({$current_user->user_id}, {$this->id}, {$link_index}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 6)";
         $smarty->assign('link_shakebox_javascript_vote_3star', $js3link);
         $js2link = "menealo({$current_user->user_id}, {$this->id}, {$link_index}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 4)";
         $smarty->assign('link_shakebox_javascript_vote_2star', $js2link);
         $js1link = "menealo({$current_user->user_id}, {$this->id}, {$link_index}, " . "'" . md5($current_user->user_id . $this->randkey) . "', 2)";
         $smarty->assign('link_shakebox_javascript_vote_1star', $js1link);
         $this->votecount = $this->countvotes();
         $smarty->assign('vote_count', $this->votecount);
         if ($this->votes($current_user->user_id) > 0) {
             $smarty->assign('star_class', "-noh");
         } else {
             $smarty->assign('star_class', "");
         }
     }
     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->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('Enable_Recommend', Enable_Recommend);
     $smarty->assign('Recommend_Type', Recommend_Type);
     $smarty->assign('instpath', my_base_url . my_pligg_base . "/");
     $smarty->assign('UseAvatars', do_we_use_avatars());
     $smarty->assign('Avatar_ImgSrc', get_avatar('large', "", $this->username(), $this->author_email));
     $canIhaveAccess = 0;
     $canIhaveAccess = $canIhaveAccess + checklevel('god');
     $canIhaveAccess = $canIhaveAccess + checklevel('admin');
     if ($canIhaveAccess == 1) {
         $smarty->assign('isadmin', 'yes');
     }
     // 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);
     $smarty->assign('Enable_AddTo', Enable_AddTo);
     // --- //
     $smarty->assign('enable_tags', Enable_Tags);
     $smarty->assign('link_shakebox_index', $link_index);
     $smarty->assign('link_shakebox_votes', $this->votes);
     $smarty->assign('link_shakebox_currentuser_votes', $this->votes($current_user->user_id));
     $smarty->assign('link_shakebox_currentuser_reports', $this->reports($current_user->user_id));
     $jslink = "menealo({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',10)";
     $smarty->assign('link_shakebox_javascript_vote', $jslink);
     $jslink_negative = "menealo({$current_user->user_id},{$this->id},{$link_index}," . "'" . md5($current_user->user_id . $this->randkey) . "',-10)";
     $smarty->assign('link_shakebox_javascript_vote_negative', $jslink_negative);
     $alltagtext = $smarty->get_config_vars('PLIGG_Visual_Tags_All_Tags');
     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 ($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('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);
     $smarty->assign('enable_categorycolors', enable_categorycolors);
     //read enable or disable category colors in config.php
     $link_index++;
     check_actions('lib_link_summary_fill_smarty');
     return $smarty;
 }