$entry1
$entry2 $entry3."; } elseif($entry_info[privacy] == "1") { $error = "$entry1
$entry4 $entry3."; } elseif($entry_info[privacy] == "0") { $error = "$entry1
$entry5 $entry3."; } echo $head; echo "
$error
"; echo $foot; exit(); } header("Location: $weblog_url"); exit(); } $entry_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND e_id='$e_id'")); // RETRIEVE TEMPLATE $template = $weblog_info[template]; $template = bh_engine($template); // REPLACE windowtitle VARIABLE $template = str_replace("<%WindowTitle%>", "$weblog_info[title] - $entry_info[title]", $template); // REMOVE ANYTHING BETWEEN CONTAINERS $ifmainpagecount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifmainpagecount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } // REMOVE ANYTHING BETWEEN CONTAINERS $ifarchivepagecount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifarchivepagecount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } // REMOVE ANYTHING BETWEEN CONTAINERS $iffriendspagecount = occurrencecount("", "", $template, "0"); for($a=0;$a<$iffriendspagecount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } // CHECK FOR SHOW COMMENT PERMISSIONS if($owner_group_info[allow_comments] == "0" | $weblog_info[show_comments] == "0") { $remove_comments = "yes"; } elseif($owner_group_info[allow_friends] == "1" & $weblog_info[show_comments] == "1" & ($user_status != "owner" & $user_status != "admin" & $user_status != "member" & $user_status != "site_owner") & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | ($user_status == "guest" & $is_friend != "yes"))) { $remove_comments = "yes"; } elseif($weblog_info[show_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") { $remove_comments = "yes"; } elseif($entry_info[comments] == "0") { $remove_comments = "yes"; } else { $remove_comments = "no"; } // REMOVE ANYTHING BETWEEN AND CONTAINERS IF COMMENTS NOT ALLOWED if($remove_comments == "yes") { $ifcommentsallowedcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifcommentsallowedcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } $commentcontcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$commentcontcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } } // CHECK FOR POST COMMENT PERMISSIONS if($owner_group_info[allow_comments] == "0" | $weblog_info[show_comments] == "0" | $weblog_info[who_comments] == "0") { $remove_post_comments = "yes"; } elseif($owner_group_info[allow_friends] == "1" & $weblog_info[who_comments] == "1" & ($user_status != "owner" & $user_status != "admin" & $user_status != "member" & $user_status != "site_owner") & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | ($user_status == "guest" & $is_friend != "yes"))) { $remove_post_comments = "yes"; } elseif($weblog_info[who_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") { $remove_post_comments = "yes"; } elseif($entry_info[comments] == "0") { $remove_post_comments = "yes"; } else { $remove_post_comments = "no"; } // REMOVE ANYTHING BETWEEN CONTAINERS IF POST COMMENTS NOT ALLOWED if($remove_post_comments == "yes") { $ifpostcommentsallowedcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifpostcommentsallowedcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } } // REMOVE ANYTHING BETWEEN AND CONTAINERS IF TRACKBACKS NOT ALLOWED if($owner_group_info[allow_trackback] == "0" | $entry_info[trackbacks] == "0") { $iftrackbacksallowedcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$iftrackbacksallowedcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } $trackbackcontcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$trackbackcontcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } } // CREATE PAGE VARIABLES $entry_date = mysql_fetch_assoc(mysql_query("SELECT date FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND e_id='$e_id'")); $total_entries = mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND draft='0' $privacy")); $current_page = mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND date >= '$entry_date[date]' AND draft='0' $privacy")); $prev = mysql_fetch_assoc(mysql_query("SELECT e_id, date FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND date > '$entry_date[date]' AND draft='0' $privacy ORDER BY date ASC LIMIT 0,1")); $next = mysql_fetch_assoc(mysql_query("SELECT e_id, date FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND date < '$entry_date[date]' AND draft='0' $privacy ORDER BY date DESC LIMIT 0,1")); $minimum = mysql_fetch_assoc(mysql_query("SELECT e_id, date FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND draft='0' $privacy ORDER BY date LIMIT 0,1")); $maximum = mysql_fetch_assoc(mysql_query("SELECT e_id, date FROM bhost_entries WHERE w_id='$weblog_info[w_id]' AND draft='0' $privacy ORDER BY date DESC LIMIT 0,1")); if($next[date] < $minimum[date] | $next == FALSE) { $next[e_id] = $minimum[e_id]; } if($prev[date] > $maximum[date] | $prev == FALSE) { $prev[e_id] = $maximum[e_id]; } // REMOVE ANYTHING BETWEEN CONTAINERS IF ONLY ONE PAGE if($total_entries == 1) { $ifpagescount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifpagescount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } } // REMOVE ANYTHING BETWEEN IF NOTHING LATER if($e_id == $maximum[e_id]) { $template = str_replace("", "", $template); $template = str_replace("", "", $template); } // REMOVE ANYTHING BETWEEN IF NOTHING EARLIER if($e_id == $minimum[e_id]) { $template = str_replace("", "", $template); $template = str_replace("", "", $template); } // INPUT PAGE VARIABLES $search_array2 = Array("", "", "", "", "<%CurrentPage%>", "<%TotalPages%>"); $replace_array2 = Array("", "", "", "", "$current_page", "$total_entries"); $template = str_replace($search_array2, $replace_array2, $template); // REMOVE ENTRY CATEGORIES IF NOT ALLOWED if($owner_group_info[allow_entry_cat] != "1") { $ifcategoriesallowedcount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifcategoriesallowedcount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } $template = str_replace("<%EntryCategory%>", "", $template); } // CHECK FOR ENTRIES $entrycount = occurrencecount("", "", $template, "0"); for($i=0;$i<$entrycount;$i++) { $insert = ""; $entry = between("", "", $template); $entry_author = mysql_fetch_assoc(mysql_query("SELECT username, display_name, avatar FROM bhost_users WHERE u_id='$entry_info[author_u_id]'")); $numofcomments = mysql_num_rows(mysql_query("SELECT c_id FROM bhost_comments WHERE w_id='$weblog_info[w_id]' AND e_id='$entry_info[e_id]'")); $numoftrackbacks = mysql_num_rows(mysql_query("SELECT tb_id FROM bhost_trackbacks WHERE w_id='$weblog_info[w_id]' AND e_id='$entry_info[e_id]'")); $insert .= "".$entry; $entrytitle = str_replace("<", "<", $entry_info[title]); $entrytitle = str_replace(">", ">", $entrytitle); $entrybody = str_replace("<", "<", $entry_info[contents]); $entrybody = str_replace(">", ">", $entrybody); $entrybody = str_replace("'", "'", $entrybody); if($entry_author[display_name] == "") { $entry_author[display_name] = $entry_author[username]; } if($entry_info[ec_id] == 0) { $ifcategoriesallowedcount = occurrencecount("", "", $insert, "0"); for($a=0;$a<$ifcategoriesallowedcount;$a++) { $insert = str_replace("".between("", "", $insert)."", "", $insert); } $entry_category = "$entry7"; } else { $entry_cat = mysql_fetch_assoc(mysql_query("SELECT ec_id, name FROM bhost_entrycategories WHERE ec_id='$entry_info[ec_id]' AND w_id='$weblog_info[w_id]'")); $entry_category = "$entry_cat[name]"; } // CHECK FOR MISSING AVATAR FIRST $entry_avatar = $entry_author[avatar]; $avatar_stripped = str_replace(" ", "", $entry_avatar); if($avatar_stripped == "" OR $avatar_stripped == "http://") { $entry_avatar = url("/images/", "images/noavatar2.gif"); } $search_array3 = Array("<%EntryDate%>", "<%EntryTitle%>", "<%EntryURL%>", "<%EntryBody%>", "<%EntryAuthor%>", "<%EntryAuthorURL%>", "<%EntryAuthorAvatar%>", "<%EntryTime%>", "<%EntryCategory%>", "", ""); $replace_array3 = Array(cdate("$weblog_info[format_date]", timezone($entry_info[date])), "$entrytitle", url("entry", "$weblog_info[weblog]", "", "$entry_info[e_id]"), "$entrybody", "$entry_author[display_name]", url("profile", "", "$entry_author[username]"), "$entry_avatar", cdate("$weblog_info[format_time]", timezone($entry_info[date])), "$entry_category", "", ""); $insert = str_replace($search_array3, $replace_array3, $insert); if($remove_comments != "yes") { $insert = str_replace("<%CommentPostURL%>", url("post_comment", "$weblog_info[weblog]", "", "$entry_info[e_id]"), $insert); $insert = str_replace("<%EntryCommentCount%>", $numofcomments, $insert); $commentcount = occurrencecount("", "", $insert, "0"); for($f=0;$f<$commentcount;$f++) { $insert2 = ""; $comment = between("", "", $insert); $comments = mysql_query("SELECT * FROM bhost_comments WHERE w_id='$weblog_info[w_id]' AND e_id='$e_id' ORDER BY date"); while($comment_info = mysql_fetch_assoc($comments)) { $comment_author_query = mysql_query("SELECT u_id, avatar FROM bhost_users WHERE username='$comment_info[username]' AND u_id='$comment_info[author_u_id]'"); $comment_author_check = mysql_num_rows($comment_author_query); $comment_author = @mysql_fetch_assoc($comment_author_query); if($comment_author_check == 1) { $commentauthor = "$comment_info[username]"; if(str_replace(" ", "", $comment_author[avatar]) == "") { $commentauthoravatar = url("/images/", "images/noavatar.gif"); } else { $commentauthoravatar = "$comment_author[avatar]"; } } else { if($comment_info[author_u_id] != "0") { $commentauthor = "$comment_info[username]"; } else { $commentauthor = $comment_info[username]; } $commentauthoravatar = url("/images/", "images/noavatar.gif"); } $this_comment = $comment; $comment_edit = "no"; $comment_delete = "no"; $comment_ip = "no"; if($is_admin_logged_in == "yes") { $comment_edit = "yes"; $comment_delete = "yes"; if($weblog_info[logip_comments] == "1") { $comment_ip = "yes"; } else { $comment_ip = "no"; } } elseif((($user_status == "owner" | $user_status == "admin" | $user_status == "site_owner") | ($user_status == "member" & $user_info[u_id] == $entry_info[author_u_id])) & $is_logged_in == "yes") { $comment_edit = "yes"; $comment_delete = "yes"; if($weblog_info[logip_comments] == "1") { $comment_ip = "yes"; } else { $comment_ip = "no"; } } elseif($user_info[u_id] == $comment_author[u_id] & $is_logged_in == "yes") { if($weblog_info[manage_comments] == "3") { $comment_edit = "yes"; $comment_delete = "yes"; $comment_ip = "no"; } elseif($weblog_info[manage_comments] == "2") { $comment_edit = "no"; $comment_delete = "yes"; $comment_ip = "no"; } elseif($weblog_info[manage_comments] == "1") { $comment_edit = "yes"; $comment_delete = "no"; $comment_ip = "no"; } else { $comment_edit = "no"; $comment_delete = "no"; $comment_ip = "no"; } } else { $comment_edit = "no"; $comment_delete = "no"; $comment_ip = "no"; } if($comment_edit == "yes") { $this_comment = str_replace("", "", $this_comment); $this_comment = str_replace("", "", $this_comment); } else { $this_comment = str_replace("".between("", "", $this_comment)."", "", $this_comment); } if($comment_delete == "yes") { $this_comment = str_replace("", "", $this_comment); $this_comment = str_replace("", "", $this_comment); } else { $this_comment = str_replace("".between("", "", $this_comment)."", "", $this_comment); } if($comment_ip == "yes") { if($comment_info[IP] == "") { $IP = "IP Not Logged"; } else { $IP = $comment_info[IP]; } $this_comment = str_replace("<%CommentAuthorIP%>", "($IP)", $this_comment); } else { $this_comment = str_replace("<%CommentAuthorIP%>", "", $this_comment); } $insert2 .= "".$this_comment; $search_array4 = Array("<%CommentDate%>", "<%CommentTitle%>", "<%CommentBody%>", "<%CommentAuthor%>", "<%CommentAuthorAvatar%>", "<%CommentTime%>", "<%CommentURL%>"); $replace_array4 = Array(cdate("$weblog_info[format_date]", timezone($comment_info[date])), "$comment_info[title]", "$comment_info[contents]", "$commentauthor", "$commentauthoravatar", cdate("$weblog_info[format_time]", timezone($comment_info[date])), url("entry", "$weblog_info[weblog]", "", "$entry_info[e_id]", "", "", "#c$comment_info[c_id]")); $insert2 = str_replace($search_array4, $replace_array4, $insert2); } $insert = str_replace("".$comment."", $insert2, $insert); } } if($owner_group_info[allow_trackback] != "0" | $entry_info[trackbacks] != "0") { $insert = str_replace("<%EntryTrackbackURL%>", url("trackback", "$weblog_info[weblog]", "", "$entry_info[e_id]"), $insert); $insert = str_replace("<%TrackbackCount%>", $numoftrackbacks, $insert); $trackback_class = new Trackback("$weblog_info[title]", "$owner_info[display_name]", "UTF-8"); $trackbackrdf = $trackback_class->rdf_autodiscover(date("r", $entry_info[date]), $entry_info[title], $entry_info[contents], url("entry", "$weblog_info[weblog]", "", "$entry_info[e_id]"), url("trackback", "$weblog_info[weblog]", "", "$entry_info[e_id]")); $insert = str_replace("<%TrackbackRDF%>", $trackbackrdf, $insert); $trackbackcount = occurrencecount("", "", $insert, "0"); for($f=0;$f<$trackbackcount;$f++) { $insert3 = ""; $trackback = between("", "", $insert); $trackbacks = mysql_query("SELECT * FROM bhost_trackbacks WHERE w_id='$weblog_info[w_id]' AND e_id='$e_id' ORDER BY tb_date"); while($trackback_info = mysql_fetch_assoc($trackbacks)) { $this_trackback = $trackback; $trackback_delete = "no"; if($is_admin_logged_in == "yes") { $trackback_delete = "yes"; } elseif((($user_status == "owner" | $user_status == "admin" | $user_status == "site_owner") | ($user_status == "member" & $user_info[u_id] == $entry_info[author_u_id])) & $is_logged_in == "yes") { $trackback_delete = "yes"; } else { $trackback_delete = "no"; } if($trackback_delete == "yes") { $this_trackback = str_replace("", "", $this_trackback); $this_trackback = str_replace("", "", $this_trackback); } else { $this_trackback = str_replace("".between("", "", $this_trackback)."", "", $this_trackback); } $insert3 .= "".$this_trackback; $search_array5 = Array("<%TrackbackBlogName%>", "<%TrackbackURL%>", "<%TrackbackTitle%>", "<%TrackbackExcerpt%>", "<%TrackbackDate%>", "<%TrackbackTime%>"); $replace_array5 = Array("$trackback_info[tb_blog_name]", "$trackback_info[tb_url]", "$trackback_info[tb_title]", "$trackback_info[tb_excerpt]", cdate("$weblog_info[format_date]", timezone($trackback_info[tb_date])), cdate("$weblog_info[format_time]", timezone($trackback_info[tb_date]))); $insert3 = str_replace($search_array5, $replace_array5, $insert3); } $insert = str_replace("".$trackback."", $insert3, $insert); } } $template = str_replace("".$entry."", $insert, $template); } $search_vars = Array("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); $template = str_replace($search_vars, "", $template); // OUTPUT WEBLOG echo $template; ?>