Sorry but you have been blocked from posting comments
");
$CN_HALT = TRUE;
break 1;
}
//----------------------------------
// Check if the name is protected
//----------------------------------
$is_member = FALSE;
foreach($all_users as $member_db_line)
{
if(!eregi("<\?",$member_db_line) and $member_db_line != ""){
$user_arr = explode("|",$member_db_line);
//if the name is protected
if((strtolower($user_arr[2]) == strtolower($name) or strtolower($user_arr[4]) == strtolower($name)) and ($user_arr[3] != $CNpass and $user_arr[3] != md5($password)) and $name != "")
{
//$comments = replace_comment("add", $comments); //commented because will mess up the
$comments = preg_replace(array("'\"'", "'\''", "''"), array(""", "'", ""), $comments);
$name = replace_comment("add", preg_replace("/\n/", "",$name));
$mail = replace_comment("add", preg_replace("/\n/", "",$mail));
echo"
This name is owned by a registered user and you must enter password to use it
";
$CN_HALT = TRUE;
break 2;
}
if(strtolower($user_arr[2]) == strtolower($name)) $is_member = TRUE;
//----------------------------------
// Member wants to save his pass in cookie ?
//----------------------------------
if($CNrememberPass == 1){
if(file_exists("$cutepath/remember.js")){
echo"";
echo"";
}
}
}
}
//----------------------------------
// Check if only members can comment
//----------------------------------
if($config_only_registered_comment == "yes" and !$is_member){
echo"
Sorry but only registered users can post comments, and '".htmlspecialchars($name)."' is not recognized as valid member.
");
$CN_HALT = TRUE;
break 1;
}
$time = time()+($config_date_adjust*60);
//----------------------------------
// Add The Comment ... Go Go GO!
//----------------------------------
$old_comments = file("$comm_file");
$new_comments = fopen("$comm_file", "w");
@flock ($new_comments,2);
$found = FALSE;
foreach($old_comments as $old_comments_line)
{
$old_comments_arr = explode("|>|", $old_comments_line);
if($old_comments_arr[0] == $id)
{
$old_comments_arr[1] = trim($old_comments_arr[1]);
fwrite($new_comments, "$old_comments_arr[0]|>|$old_comments_arr[1]$time|$name|$mail|$ip|$comments||\n");
$found = TRUE;
}else{
fwrite($new_comments, $old_comments_line);
//if we do not have the news ID in the comments.txt we are not doing anything (see comment below) (must make sure the news ID is valid)
}
}
if(!$found){
/* // do not add comment if News ID is not found \\ fwrite($new_comments, "$id|>|$time|$name|$mail|$ip|$comments||\n");*/
echo("
CuteNews did not added your comment because there is some problem with the comments database. go back
");
$CN_HALT = TRUE;
break 1;
}
@flock ($new_comments,3);
fclose($new_comments);
//----------------------------------
// Sign this comment in the Flood Protection
//----------------------------------
if($config_flood_time != "0" and $config_flood_time != "" ){
$flood_file = fopen("$cutepath/data/flood.db.php", "a");
@flock ($flood_file,2);
fwrite($flood_file, time()."|$ip|$id|\n");
@flock ($flood_file,3);
fclose($flood_file);
}
//----------------------------------
// Notify for New Comment ?
//----------------------------------
if($config_notify_comment == "yes" and $config_notify_status == "active"){
send_mail("$config_notify_email", "CuteNews - New Comment Added", "New Comment was added by $name:\n--------------------------$comments");
}
echo "";
}
//####################################################################################################################
// Show Full Story
//####################################################################################################################
if($allow_full_story){
if(!file_exists($news_file)){ die("Error! news file does not exists!"); }
$all_active_news = file("$news_file");
foreach($all_active_news as $active_news)
{
$news_arr = explode("|", $active_news);
if($news_arr[0] == $id and (!$catid or $catid == $news_arr[6]))
{
$found = TRUE;
if($news_arr[4] == "" and (!eregi("\{short-story\}", $template_full)) ){ $news_arr[4] = $news_arr[3]; }
if($my_names[$news_arr[1]]){ $my_author = $my_names[$news_arr[1]]; }
else{ $my_author = $news_arr[1]; }
$output = str_replace("{title}", $news_arr[2], $template_full);
$output = str_replace("{date}", date($config_timestamp_active, $news_arr[0]), $output);
$output = str_replace("{author}", $my_author, $output);
$output = str_replace("{short-story}", $news_arr[3], $output);
$output = str_replace("{full-story}", $news_arr[4], $output);
if($news_arr[5] != ""){$output = str_replace("{avatar}", "", $output); }
else{ $output = str_replace("{avatar}", "", $output); }
$output = str_replace("{avatar-url}", "$news_arr[5]", $output);
$output = str_replace("{comments-num}", countComments($news_arr[0], $archive), $output);
$output = str_replace("{category}", catid2name($news_arr[6]), $output);
$output = str_replace("{category-id}", $news_arr[6], $output);
if($cat_icon[$news_arr[6]] != ""){ $output = str_replace("{category-icon}", "", $output); }
else{ $output = str_replace("{category-icon}", "", $output); }
if($config_comments_popup == "yes"){
$output = str_replace("[com-link]","", $output);
}else{
$output = str_replace("[com-link]","", $output);
}
$output = str_replace("[/com-link]","", $output);
$output = str_replace("{author-name}", $name_to_nick[$news_arr[1]], $output);
if($my_mails[$news_arr[1]] != ""){
$output = str_replace("[mail]","", $output);
$output = str_replace("[/mail]","", $output);
}else{
$output = str_replace("[mail]","", $output);
$output = str_replace("[/mail]","", $output);
}
$output = str_replace("{news-id}", $news_arr[0], $output);
$output = str_replace("{archive-id}", $archive, $output);
$output = str_replace("{php-self}", $PHP_SELF, $output);
$output = str_replace("{cute-http-path}", $config_http_script_dir, $output);
$output = replace_news("show", $output);
echo $output;
}
}
if(!$found){
//
// Article ID was not found, if we have not specified an archive -> try to find the article in some archive.
//
// Auto-Find ID In archives
//----------------------------------------------------------------------
if(!$archive or $archive == ''){
//get all archives. (if any) and fit our lost id in the most propper archive.
$lost_id = $id;
$all_archives = FALSE;
$hope_archive = FALSE;
if(!$handle = opendir("$cutepath/data/archives")){ echo(" "); }
while (false !== ($file = readdir($handle)))
{
if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file))
{
$file_arr = explode(".", $file);
$all_archives[] = $file_arr[0];
}
}
closedir($handle);
if($all_archives){
sort($all_archives);
if(isset($all_archives[1])){
foreach($all_archives as $this_archive){
if($this_archive > $lost_id){ $hope_archive = $this_archive; break;}
}
}else{
if($all_archives[0] > $lost_id){ $hope_archive = $all_archives[0]; break;}
}
}
}
if($hope_archive){
echo"
You are now being redirected to the article in our archives if the redirection fails, please click here
";
}else{
echo("
Can not find an article with id: ". @(int) htmlspecialchars($id)."