Example #1
0
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         echo '<div class="commentform warn">' . "\n";
         echo _('comentarios cerrados') . "\n";
         echo '</div>' . "\n";
     } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] || $current_user->user_id == $link->author)) {
         // User can comment
         print_comment_form();
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
     } else {
         // Not enough karma or anonymous user
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         if ($current_user->authenticated && $current_user->user_karma <= $globals['min_karma_for_comments']) {
             echo '<div class="commentform warn">' . "\n";
             echo _('No tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma . "\n";
             echo '</div>' . "\n";
         } elseif (!$globals['bot']) {
             echo '<div class="commentform warn">' . "\n";
             echo '<a href="' . $globals['base_url'] . 'login.php?return=' . $_SERVER['REQUEST_URI'] . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí</a>' . "\n";
             echo '</div>' . "\n";
         }
     }
     echo '</div>' . "\n";
     break;
 case 3:
     // Show voters
Example #2
0
	$comments = $db->get_col("SELECT SQL_CACHE comment_id FROM comments WHERE comment_link_id=$link->id ORDER BY $order_field $limit");
	if ($comments) {
		echo '<ol class="comments-list">';
		foreach($comments as $comment_id) {
			if (($comment = Comment::from_db($comment_id))) {
				echo '<li>';
				$comment->print_summary($link, 2500, true);
				echo '</li>';
			}
			echo "\n";
		}
		echo "</ol>\n";
	}

	if($tab_option == 1) do_comment_pages($link->comments, $current_page);
	Comment::print_form($link);
	echo '</div>' . "\n";

	// Highlight a comment if it is referenced by the URL.
	// currently double border, width must be 3 at least
	echo '<script type="text/javascript">';
	echo 'if(location.href.match(/#(c-\d+)$/)){$("#"+RegExp.$1+">:first").css("border-style","solid").css("border-width","1px")}';
	echo "</script>\n";
	break;

case 3:
	// Show voters
	echo '<div class="voters" id="voters">';

	echo '<div id="voters-container" style="padding: 10px;">';
Example #3
0
	static function print_form($link, $rows=12) {
		global $current_user, $globals;

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

				echo '<div style="margin-top: 20px" align="center">';
				print_oauth_icons();
				echo '</div>'."\n";
			}
		}
	}
Example #4
0
 static function print_form($link, $rows = 5)
 {
     global $current_user, $globals;
     if (!$link->votes > 0) {
         return;
     }
     $comment = new Comment();
     // Foo comment
     $comment->randkey = rand(1000000, 100000000);
     if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
         // Comments already closed
         echo '<div class="commentform warn">' . "\n";
         echo _('comentarios cerrados') . "\n";
         echo '</div>' . "\n";
     } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) {
         // User can comment
         echo '<div class="commentform">' . "\n";
         echo '<form action="" method="post" enctype="multipart/form-data" class="comment">';
         echo '<input type="hidden" name="process" value="newcomment" />';
         echo '<input type="hidden" name="randkey" value="' . $comment->randkey . '" />';
         echo '<fieldset>' . "\n";
         echo '<legend>' . _('envía un comentario') . '</legend>';
         $vars = compact('link', 'comment');
         Haanga::Load('comment_edit.html', $vars);
         echo '<div class="note" style="margin-top:10px">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</div>';
         echo '</fieldset>' . "\n";
         echo '</form>' . "\n";
         echo "</div>\n";
     } else {
         // Not enough karma or anonymous user
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         if ($current_user->authenticated) {
             if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
                 $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']);
                 $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario');
             }
             if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
                 $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma;
             }
             echo '<div class="commentform warn">' . "\n";
             echo $msg . "\n";
             echo '</div>' . "\n";
         } elseif (!$globals['bot']) {
             echo '<div class="commentform warn">' . "\n";
             echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n";
             echo '</div>' . "\n";
             print_oauth_icons();
         }
     }
 }
Example #5
0
                     $prev = $comment;
                 }
             }
             echo '<li>';
             $comment->print_summary($link, 2500, true);
             echo '</li>';
             $order++;
         }
         echo '</ol>';
     }
     if ($tab_option == 1) {
         if ($update_comments) {
             $link->update_comments();
         }
     }
     do_comment_pages($link->comments, $current_page, $last_com_first);
     if ($link->comments > 5) {
         add_javascript('get_total_answers("comment","' . $order_field . '",' . $link->id . ',' . $offset . ',' . $globals['comments_page_size'] . ');');
     }
     Comment::print_form($link);
     echo '</div>';
     break;
 case 3:
     // Show voters
     echo '<div class="voters" id="voters">';
     echo '<div id="voters-container" style="padding: 10px;">';
     if ($globals['link']->sent_date < $globals['now'] - 60 * 86400) {
         // older than 60 days
         echo _('Noticia antigua, datos de votos archivados');
     } else {
         include mnmpath . '/backend/meneos.php';
Example #6
0
 static function print_form($link, $rows = 5)
 {
     global $current_user, $globals;
     if (!$link->votes > 0) {
         return;
     }
     if ($link->date < $globals['now'] - $globals['time_enabled_comments'] || $link->comments >= $globals['max_comments']) {
         // Comments already closed
         echo '<div class="commentform warn">' . "\n";
         echo _('comentarios cerrados') . "\n";
         echo '</div>' . "\n";
     } elseif ($current_user->authenticated && ($current_user->user_karma > $globals['min_karma_for_comments'] && $current_user->user_date < $globals['now'] - $globals['min_time_for_comments'] || $current_user->user_id == $link->author)) {
         // User can comment
         echo '<div class="commentform">' . "\n";
         echo '<form action="" method="post" enctype="multipart/form-data" class="comment">' . "\n";
         echo '<input type="hidden" name="process" value="newcomment" />' . "\n";
         echo '<input type="hidden" name="randkey" value="' . rand(1000000, 100000000) . '" />' . "\n";
         echo '<fieldset>' . "\n";
         echo '<legend>' . _('envía un comentario') . '</legend>' . "\n";
         print_simpleformat_buttons('comment');
         echo '<label for="comment">' . _('texto del comentario') . '<br /><span class="note">' . _('comentarios xenófobos, racistas o difamatorios causarán la anulación de la cuenta') . '</span></label>' . "\n";
         echo '<div><textarea name="comment_content" class="droparea" id="comment" rows="' . $rows . '"></textarea></div>' . "\n";
         echo '<input class="button" type="submit" name="submit" value="' . _('enviar el comentario') . '" />' . "\n";
         // Allow gods to put "admin" comments which does not allow votes
         if ($current_user->user_level == 'god') {
             echo '&nbsp;&nbsp;&nbsp;&nbsp;<label><strong>' . _('admin') . ' </strong><input name="type" type="checkbox" value="admin"/></label>' . "\n";
         }
         $comment = new Comment();
         // Foo comment
         $vars = compact('link', 'comment');
         Haanga::Load('comment_edit.html', $vars);
         echo '</fieldset>' . "\n";
         echo '</form>' . "\n";
         echo "</div>\n";
     } else {
         // Not enough karma or anonymous user
         if ($tab_option == 1) {
             do_comment_pages($link->comments, $current_page);
         }
         if ($current_user->authenticated) {
             if ($current_user->user_date >= $globals['now'] - $globals['min_time_for_comments']) {
                 $remaining = txt_time_diff($globals['now'], $current_user->user_date + $globals['min_time_for_comments']);
                 $msg = _('debes esperar') . " {$remaining} " . _('para escribir el primer comentario');
             }
             if ($current_user->user_karma <= $globals['min_karma_for_comments']) {
                 $msg = _('no tienes el mínimo karma requerido') . " (" . $globals['min_karma_for_comments'] . ") " . _('para comentar') . ": " . $current_user->user_karma;
             }
             echo '<div class="commentform warn">' . "\n";
             echo $msg . "\n";
             echo '</div>' . "\n";
         } elseif (!$globals['bot']) {
             echo '<div class="commentform warn">' . "\n";
             echo '<a href="' . get_auth_link() . 'login.php?return=' . urlencode($globals['uri']) . '">' . _('Autentifícate si deseas escribir') . '</a> ' . _('comentarios') . '. ' . _('O crea tu cuenta') . ' <a href="' . $globals['base_url'] . 'register.php">aquí.</a>' . "\n";
             echo '</div>' . "\n";
             print_oauth_icons();
         }
     }
 }