Commenter Hack
O nome ou o link das pessoas que comentaram no seu post aparece no mesmo.
Preste muita atenção e salve os seus arquivos functions.inc.php e shows.inc.php antes de começar a modificá-los.
1.Abra o arquivo functions.inc.php e antes do último ?> adicione o seguinte:
//////////////////////////////////////////////////////////////////
// Function: Lists all commenters with mail or url when available
function list_commenters($news, $linebreak, $separator) {
$alle_comments = file("./data/comments.txt");
$i=0;
foreach($alle_comments as $comments_line)
{
$comments_line = trim($comments_line);
$comments_line_arr = explode("|>|", $comments_line);
if($news == $comments_line_arr[0])
{
$individual_comment = explode("||", $comments_line_arr[1]);
foreach ($individual_comment as $single_comment)
{
$single_comment_arr = explode("|", $single_comment);
if (($single_comment_arr[0] != "") &&
(!stristr($output, $single_comment_arr[1])))
{
$i++;
if($single_comment_arr[2] != "none")
{
if( preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+
([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $single_comment_arr[2])){
$url_target = "";$mail_or_url = "mailto:"; }
else
{
$url_target = "target=\"_blank\"";
$mail_or_url = "";
if(substr($single_comment_arr[2],0,3) == "www") $mail_or_url = "http://";
}
$output .= "<a $url_target href=\"$mail_or_url".stripslashes
($single_comment_arr[2])."\">".stripslashes($single_comment_arr[1]).
"</a>".$separator;
}
else $output .= $single_comment_arr[1].$separator;
if (fmod($i, $linebreak)==0) $output .= "
";
}
}
}
}
if (fmod($i, $linebreak)=="0") $output = substr($output, 0, -(strlen($separator)+6));
else $output = substr($output, 0, -strlen($separator));
return $output;
}
2.Salve e abra o arquivo shows.inc.php. Dê crtl+F e procure o seguinte:
$output = str_replace({title}, $news_arr[2], $template_full);
3.Depois dessa linha que você achou, adicione isso:
if(CountComments($news_arr[0], $archive) > 0){
$output = str_replace('[commenters-header]', '', $output);
$output = str_replace('[/commenters-header]', '', $output);
$output = preg_replace("#\{commenters:(.*):(.*)\}#ie", "list_commenters('".$news_arr[0]."', '\\1', '\\2')", $output);
}
else $output = preg_replace("#\[commenters-header\](.*?)\[/commenters-header\]#i", "", $output);
4.Ainda no shows.inc, procure o seguinte:
$output = $template_active;
5.Adicione depois dessa linha:
if(CountComments($news_arr[0], $archive) > 0){
$output = str_replace('[commenters-header]', '', $output);
$output = str_replace('[/commenters-header]', '', $output);
$output = preg_replace("#\{commenters:(.*):(.*)\}#ie", "list_commenters('".$news_arr[0]."', '\\1', '\\2')", $output);
}
else $output = preg_replace("#\[commenters-header\](.*?)\[/commenters-header\]#i", "", $output);
6.Salve o arquivo. Vá ao seu painel no cutenews, em edit templates. Coloque o seguinte no Active News e Full Story:
[commenters-header]{commenters:0:-}[/commenters-header]
0 é o número de nomes que você quer que apareça por linha. Se quiser, deixe 0 mesmo, que os nomes vão se adequar sozinhos
à sua widht. O - (tracinho), é o separador dos nomes. Você pode por o que quiser.
Qualquer dúvida, pergunte! =*
Tutoriais do Cutenews são feitos a partir da minha experiência com eles. Os códigos são retirados do
Fórum Oficial. Não copie, redistribua ou se inspire, e credite sempre!
« Voltar
Topo