'' "); foreach ($keywords as $kw) { if (strpos($comment, $kw["keyword"]) !== false) $skip_comment = true; } $banned_ips = xall_rows(" select * from ele_banned_ips where ip <> '' "); foreach ($banned_ips as $ip) { if ($_SERVER["REMOTE_ADDR"] == $ip) $skip_comment = true; } if (!$skip_comment) { xupdate(" insert into ele_comments (post_key, comment_dt, user_key, comment_status, comment_body, anonymous_name, anonymous_email) values ('$pk', now(), '$g_user_key', 'active', '$comment_txt', '$anonymous_name', '$anonymous_email') "); $comment = xinsert_id(); xupdate(" update ele_posts set n_comments = n_comments + 1 where post_key = $pk "); mc_delete("comments:$pk"); mc_delete("post:$pk"); $msg = "From: $g_user_info[first_name] $g_user_info[last_name] <$g_user_info[email_address]> (U#$g_user_info[user_key])\n"; $msg.= "Post: $post[title]\n"; $msg.= "Date: " . date("Y-m-d H:i:s") . "\n"; $msg.= "Comment:\n\n"; $msg.= stripslashes($comment_txt) . "\n\n"; mail($comments_to, "[$site_name] New comment on $post[title]", $msg, "From: $g_user_info[email_address]\r\n"); } xgoto(get_post_url($post, "comment_saved=1#comment-$comment")); } $photos = xall_rows(" select * from ele_photos where post_key = '$pk' order by add_dt desc "); $post["photos"] = $photos; $post["photos_cnt"] = count($photos); if ($post["post_type_key"]) { if ($post_type["use_related_links"]) $post["links"] = xall_rows("select * from ele_links where post_key = $pk and url <> ''"); $ptu = $post_type["post_type"]; $template_file = "post-" . string_to_url_component($ptu) . ".phtml"; $post['post_type'] = xone_column("SELECT post_type FROM ele_post_types WHERE post_type_key=".$post["post_type_key"], "post_type"); } else { $post_type = false; $post["links"] = false; $template_file = false; } $post['vote'] = 'none'; if(!empty($g_user_info)){ $user_key = $g_user_info['user_key']; $post['current_user_vote'] = xone_column("SELECT value FROM mbl_votes WHERE user_key=$user_key AND post_key = $pk", 'value'); } if(!isset($post['current_user_vote']) || $post['current_user_vote'] == '') $post['current_user_vote'] = '-1'; $post["comments"] = get_post_comments($pk); $post["comments_cnt"] = count($post["comments"]); $post["is_logged_in"] = $is_logged_in; $post["time"] = time(); if ($template_file && file_exists("templates/$template_file")) { display_template($template_file, $post); } else { $post["template_file"] = $template_file; display_template("post.phtml", $post); } ?>