Cutenews Comment Hack
This hack lists all commenters below each cutenews article/post. Warning: This many not work depending on the version of cutenews, etc.
///////////
////////////////
/////////////////////
//////////////////// 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] != "") && (!strstr($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 .= "<br />";
}
}
}
}
if (fmod($i, $linebreak)=="0") $output = substr($output, 0, -(strlen($separator)+6));
else $output = substr($output, 0, -strlen($separator));
$output = str_replace('#', '', $output);
return $output;
}
$url_target href=\"$mail_or_url".stripslashes($single_comment_
////////////////
/////////////////////
//////////////////// 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] != "") && (!strstr($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 .= "<br />";
}
}
}
}
if (fmod($i, $linebreak)=="0") $output = substr($output, 0, -(strlen($separator)+6));
else $output = substr($output, 0, -strlen($separator));
$output = str_replace('#', '', $output);
return $output;
}
2. Open /cutenews/inc/shows.inc.php and find:
$output = str_replace("{title}", $news_arr[2], $template_full);
and add below:
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);
and then find:
$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);
$output = $template_active;
and add below:
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);
$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);
Now you can use [commenters-header]{commenters:N:S}[/commenters-header] in your template (Active News/Full Story) to list the commenters for each article.
N is the number of commenters per line (0 = all in one line) and
S is the separator between each commenter.
Everything between [commenters-header] and [/commenters-header] shows only if there is a comment.
For example:
[commenters-header]{commenters:2: - }[/commenters-header]
would show this:
commenter1 - commenter2 -
commenter3 - commenter4
Alicia is a 15 year old girl living in the USA.
She is caring, sarcastic, funny, outgoing, and just your average girl.
She is loves all kinds of music.
Loves being surrounded by the people she cares about. Enjoys being on the computer. Aspires to be a web designer, in any shape or form. 
