", "$weblog_info[title] - $friends3", $template); // REMOVE ANYTHING BETWEEN CONTAINERS $ifentrypagecount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifentrypagecount;$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 $ifmainpagecount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifmainpagecount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } // BUILD FRIENDS QUERY $query = ""; $count = 0; $where = "u_id='$owner_info[u_id]'"; $where_not = "friend_u_id <> '$owner_info[u_id]'"; if($weblog_info[friends] == "1" | $weblog_info[friends] == "2") { $admins = explode(",", trim($weblog_info[level1])); for($a=0;$a $maxpage) { $page = $maxpage; } elseif($page < 1) { $page = 1; } $start = ($page - 1) * $weblog_info[entries_per_page]; $prev = $page - 1; $next = $page + 1; // REMOVE ANYTHING BETWEEN CONTAINERS IF ONLY ONE PAGE if($maxpage == 1) { $ifpagescount = occurrencecount("", "", $template, "0"); for($a=0;$a<$ifpagescount;$a++) { $template = str_replace("".between("", "", $template)."", "", $template); } } // REMOVE ANYTHING BETWEEN IF NOTHING LATER if($page == 1) { $template = str_replace("", "", $template); $template = str_replace("", "", $template); } // REMOVE ANYTHING BETWEEN IF NOTHING EARLIER if($page == $maxpage) { $template = str_replace("", "", $template); $template = str_replace("", "", $template); } // INPUT PAGE VARIABLES $search_array2 = Array("", "", "", "", "<%CurrentPage%>", "<%TotalPages%>"); $replace_array2 = Array("", "", "", "", "$page", "$maxpage"); $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); } $entries = mysql_query("SELECT * FROM bhost_entries WHERE $entry_e_id ORDER BY date DESC, e_id DESC LIMIT $start, $weblog_info[entries_per_page]"); // CHECK FOR ENTRIES $entrycount = occurrencecount("", "", $template, "0"); for($i=0;$i<$entrycount;$i++) { $insert = ""; $entry = between("", "", $template); while($entry_info = mysql_fetch_assoc($entries)) { $entry_weblog = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_weblogs WHERE w_id='$entry_info[w_id]'")); $entry_author = mysql_fetch_assoc(mysql_query("SELECT u_id, g_id, 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='$entry_info[w_id]' AND e_id='$entry_info[e_id]'")); $numoftrackbacks = mysql_num_rows(mysql_query("SELECT tb_id FROM bhost_trackbacks WHERE e_id='$entry_info[e_id]'")); $entry_owner = mysql_fetch_assoc(mysql_query("SELECT g_id FROM bhost_users WHERE u_id='$entry_weblog[u_id]'")); $entry_owner_group = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_groups WHERE g_id='$entry_owner[g_id]'")); if($entry_author[display_name] == "") { $entry_author[display_name] = $entry_author[username]; } // SET USER STATUS $entry_is_friend = "no"; $where2 = "u_id = '$entry_owner_info[u_id]'"; if($entry_weblog[friends] == "1") { $admins = explode(",", trim($entry_weblog[level1])); for($a=0;$a AND CONTAINERS IF COMMENTS NOT ALLOWED IN ENTRY $ifcommentsallowedcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$ifcommentsallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $commentcontcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$commentcontcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $ifpostcommentsallowedcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$ifpostcommentsallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $remove_entry_comments = "yes"; } // CHECK FOR COMMENT PERMISSIONS if($entry_owner_group[allow_comments] == "0" | $entry_weblog[show_comments] == "0") { $remove_comments = "yes"; } elseif($entry_owner_group[allow_friends] == "1" & $entry_weblog[show_comments] == "1" & ($entry_user_status == "owner" | $entry_user_status == "admin" | $entry_user_status == "member" | $entry_user_status == "site_owner") & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | $entry_is_friend != "yes")) { $remove_comments = "yes"; } elseif($entry_weblog[show_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") { $remove_comments = "yes"; } else { $remove_comments = "no"; } // REMOVE ANYTHING BETWEEN AND CONTAINERS IF COMMENTS NOT ALLOWED if($remove_comments == "yes") { $ifcommentsallowedcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$ifcommentsallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $commentcontcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$commentcontcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } } // CHECK FOR POST COMMENT PERMISSIONS if($entry_owner_group[allow_comments] == "0" | $entry_weblog[show_comments] == "0" | $entry_weblog[who_comments] == "0") { $remove_post_comments = "yes"; } elseif($entry_owner_group[allow_friends] == "1" & $entry_weblog[who_comments] == "1" & ($entry_user_status == "owner" | $entry_user_status == "admin" | $entry_user_status == "member" | $entry_user_status == "site_owner") & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | $entry_is_friend != "yes")) { $remove_post_comments = "yes"; } elseif($entry_weblog[who_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") { $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("", "", $this_entry, "0"); for($a=0;$a<$ifpostcommentsallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } } // REMOVE ANYTHING BETWEEN AND CONTAINERS IF TRACKBACKS NOT ALLOWED if($entry_owner_group[allow_trackback] == "0" | $entry_info[trackbacks] == "0") { $iftrackbacksallowedcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$iftrackbacksallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $trackbackcontcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$trackbackcontcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } } if($entry_info[ec_id] == 0) { $ifcategoriesallowedcount = occurrencecount("", "", $this_entry, "0"); for($a=0;$a<$ifcategoriesallowedcount;$a++) { $this_entry = str_replace("".between("", "", $this_entry)."", "", $this_entry); } $entry_category = "$friends2"; } 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='$entry_info[w_id]'")); $entry_category = "$entry_cat[name]"; } $insert .= "".$this_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); // 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("$entry_weblog[format_date]", timezone($entry_info[date])), "$entrytitle", url("entry", "$entry_weblog[weblog]", "", "$entry_info[e_id]"), "$entrybody", "$entry_author[display_name]", url("profile", "", "$entry_author[username]"), "$entry_avatar", cdate("$entry_weblog[format_time]", timezone($entry_info[date])), "$entry_category", "", ""); $insert = str_replace($search_array3, $replace_array3, $insert); if($remove_comments != "yes" & $remove_entry_comments != "yes") { $insert = str_replace("<%EntryCommentCount%>", $numofcomments, $insert); $insert = str_replace("<%CommentPostURL%>", url("post_comment", "$entry_weblog[weblog]", "", "$entry_info[e_id]"), $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='$entry_weblog[w_id]' AND e_id='$entry_info[e_id]' ORDER BY date"); while($comment_info = mysql_fetch_assoc($comments)) { $comment_author_check = mysql_num_rows(mysql_query("SELECT u_id FROM bhost_users WHERE username='$comment_info[username]' AND u_id='$comment_info[author_u_id]'")); $comment_author = @mysql_fetch_assoc(mysql_query("SELECT u_id, avatar FROM bhost_users WHERE username='$comment_info[username]' AND u_id='$comment_info[author_u_id]'")); 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; $this_comment = str_replace("".between("", "", $this_comment)."", "", $this_comment); $this_comment = str_replace("".between("", "", $this_comment)."", "", $this_comment); $this_comment = str_replace("<%CommentAuthorIP%>", "", $this_comment); $insert2 .= "".$this_comment; $search_array4 = Array("<%CommentDate%>", "<%CommentTitle%>", "<%CommentBody%>", "<%CommentAuthor%>", "<%CommentAuthorAvatar%>", "<%CommentTime%>", "<%CommentURL%>"); $replace_array4 = Array(cdate("$entry_weblog[format_date]", timezone($comment_info[date])), "$comment_info[title]", "$comment_info[contents]", "$commentauthor", "$commentauthoravatar", cdate("$entry_weblog[format_time]", timezone($comment_info[date])), url("entry", "$entry_weblog[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($entry_owner_group[allow_trackback] != "0" | $entry_info[trackbacks] != "0") { $insert = str_replace("<%EntryTrackbackURL%>", url("trackback", "$entry_weblog[weblog]", "", "$entry_info[e_id]"), $insert); $insert = str_replace("<%TrackbackCount%>", $numoftrackbacks, $insert); $trackbackcount = occurrencecount("", "", $insert, "0"); for($f=0;$f<$trackbackcount;$f++) { $insert3 = ""; $trackback = between("", "", $insert); $trackbacks = mysql_query("SELECT * FROM bhost_trackbacks WHERE e_id='$entry_info[e_id]' ORDER BY tb_date"); while($trackback_info = mysql_fetch_assoc($trackbacks)) { $this_trackback = $trackback; $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("$entry_weblog[format_date]", timezone($trackback_info[tb_date])), cdate("$entry_weblog[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("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "<%TrackbackRDF%>", "", ""); $template = str_replace($search_vars, "", $template); // OUTPUT WEBLOG echo $template; ?>