📄 friends.php
字号:
}
$ifpostcommentsallowedcount = occurrencecount("<IfCommentPostAllowed>", "</IfCommentPostAllowed>", $this_entry, "0");
for($a=0;$a<$ifpostcommentsallowedcount;$a++) {
$this_entry = str_replace("<IfCommentPostAllowed>".between("<IfCommentPostAllowed>", "</IfCommentPostAllowed>", $this_entry)."</IfCommentPostAllowed>", "", $this_entry);
}
$remove_entry_comments = "yes";
}
// CHECK FOR COMMENT PERMISSIONS
if($author_group_info[allow_comments] == "0" | $entry_author[show_comments] == "0") {
$remove_comments = "yes";
} elseif($author_group_info[allow_members] == "1" & $entry_author[show_comments] == "1" & $member_info[u_id] != $entry_author[u_id] & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | mysql_num_rows(mysql_query("SELECT m_id FROM bhost_members WHERE u_id='$entry_author[u_id]' AND member_u_id='$member_info[u_id]'")) != "1")) {
$remove_comments = "yes";
} elseif($entry_author[show_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") {
$remove_comments = "yes";
} else {
$remove_comments = "no";
}
// REMOVE ANYTHING BETWEEN <IFCOMMENTSALLOWED> AND <COMMENT> CONTAINERS IF COMMENTS NOT ALLOWED
if($remove_comments == "yes") {
$ifcommentsallowedcount = occurrencecount("<IfCommentsAllowed>", "</IfCommentsAllowed>", $this_entry, "0");
for($a=0;$a<$ifcommentsallowedcount;$a++) {
$this_entry = str_replace("<IfCommentsAllowed>".between("<IfCommentsAllowed>", "</IfCommentsAllowed>", $this_entry)."</IfCommentsAllowed>", "", $this_entry);
}
$commentcontcount = occurrencecount("<Comment>", "</Comment>", $this_entry, "0");
for($a=0;$a<$commentcontcount;$a++) {
$this_entry = str_replace("<Comment>".between("<Comment>", "</Comment>", $this_entry)."</Comment>", "", $this_entry);
}
}
// CHECK FOR POST COMMENT PERMISSIONS
if($author_group_info[allow_comments] == "0" | $entry_author[show_comments] == "0" | $entry_author[who_comments] == "0") {
$remove_post_comments = "yes";
} elseif($author_group_info[allow_members] == "1" & $entry_author[who_comments] == "1" & $member_info[u_id] != $entry_author[u_id] & $is_admin_logged_in != "yes" & ($is_logged_in == "no" | mysql_num_rows(mysql_query("SELECT m_id FROM bhost_members WHERE u_id='$entry_author[u_id]' AND member_u_id='$member_info[u_id]'")) != "1")) {
$remove_post_comments = "yes";
} elseif($entry_author[who_comments] == "2" & $is_logged_in == "no" & $is_admin_logged_in != "yes") {
$remove_post_comments = "yes";
} else {
$remove_post_comments = "no";
}
// REMOVE ANYTHING BETWEEN <IFCOMMENTPOSTALLOWED> CONTAINERS IF POST COMMENTS NOT ALLOWED
if($remove_post_comments == "yes") {
$ifpostcommentsallowedcount = occurrencecount("<IfCommentPostAllowed>", "</IfCommentPostAllowed>", $this_entry, "0");
for($a=0;$a<$ifpostcommentsallowedcount;$a++) {
$this_entry = str_replace("<IfCommentPostAllowed>".between("<IfCommentPostAllowed>", "</IfCommentPostAllowed>", $this_entry)."</IfCommentPostAllowed>", "", $this_entry);
}
}
// REMOVE ANYTHING BETWEEN <IFTRACKBACKSALLOWED> AND <TRACKBACK> CONTAINERS IF TRACKBACKS NOT ALLOWED
if($author_group_info[allow_trackback] == "0" | $entry_info[trackbacks] == "0") {
$iftrackbacksallowedcount = occurrencecount("<IfTrackbacksAllowed>", "</IfTrackbacksAllowed>", $this_entry, "0");
for($a=0;$a<$iftrackbacksallowedcount;$a++) {
$this_entry = str_replace("<IfTrackbacksAllowed>".between("<IfTrackbacksAllowed>", "</IfTrackbacksAllowed>", $this_entry)."</IfTrackbacksAllowed>", "", $this_entry);
}
$trackbackcontcount = occurrencecount("<Trackback>", "</Trackback>", $this_entry, "0");
for($a=0;$a<$trackbackcontcount;$a++) {
$this_entry = str_replace("<Trackback>".between("<Trackback>", "</Trackback>", $this_entry)."</Trackback>", "", $this_entry);
}
}
if($entry_info[ec_id] == 0) {
$ifcategoriesallowedcount = occurrencecount("<IfCategoriesAllowed>", "</IfCategoriesAllowed>", $this_entry, "0");
for($a=0;$a<$ifcategoriesallowedcount;$a++) {
$this_entry = str_replace("<IfCategoriesAllowed>".between("<IfCategoriesAllowed>", "</IfCategoriesAllowed>", $this_entry)."</IfCategoriesAllowed>", "", $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 u_id='$entry_info[u_id]'"));
$entry_category = "<a href='".url("index_cat", $entry_author[username], "0", "", "", "", "", $category="$entry_cat[name]")."'>$entry_cat[name]</a>";
}
$insert .= "<a name='e$entry_info[e_id]'></a>".$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%>", "<%EntryAuthorAvatar%>", "<%EntryTime%>", "<%EntryCategory%>", "<SendThisLink>", "</SendThisLink>");
$replace_array3 = Array(cdate("$entry_author[format_date]", timezone($entry_info[date])), "$entrytitle", url("entry", "$entry_author[username]", "$entry_info[e_id]"), "$entrybody", "<a href='".url("index", "$entry_author[username]")."'>$entry_author[display_name]</a>", "$entry_avatar", cdate("$entry_author[format_time]", timezone($entry_info[date])), "$entry_category", "<a href='".url("sendlink", "$entry_author[username]", "$entry_info[e_id]")."'>", "</a>");
$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_author[username]", "$entry_info[e_id]"), $insert);
$commentcount = occurrencecount("<Comment>", "</Comment>", $insert, "0");
for($f=0;$f<$commentcount;$f++) {
$insert2 = "";
$comment = between("<Comment>", "</Comment>", $insert);
$comments = mysql_query("SELECT * FROM bhost_comments WHERE u_id='$entry_author[u_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 = "<a href='".url("profile", "$comment_info[username]")."'>$comment_info[username]</a>";
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 = "<a href='".url("profile_nouser", "")."'>$comment_info[username]</a>";
} else {
$commentauthor = $comment_info[username];
}
$commentauthoravatar = url("/images/", "images/noavatar.gif");
}
$this_comment = $comment;
$this_comment = str_replace("<CommentEdit>".between("<CommentEdit>", "</CommentEdit>", $this_comment)."</CommentEdit>", "", $this_comment);
$this_comment = str_replace("<CommentDelete>".between("<CommentDelete>", "</CommentDelete>", $this_comment)."</CommentDelete>", "", $this_comment);
$this_comment = str_replace("<%CommentAuthorIP%>", "", $this_comment);
$insert2 .= "<a name='c$comment_info[c_id]'></a>".$this_comment;
$search_array4 = Array("<%CommentDate%>", "<%CommentTitle%>", "<%CommentBody%>", "<%CommentAuthor%>", "<%CommentAuthorAvatar%>", "<%CommentTime%>", "<%CommentURL%>");
$replace_array4 = Array(cdate("$entry_author[format_date]", timezone($comment_info[date])), "$comment_info[title]", "$comment_info[contents]", "$commentauthor", "$commentauthoravatar", cdate("$entry_author[format_time]", timezone($comment_info[date])), url("entry", "$entry_author[username]", "$entry_info[e_id]", "", "", "#c$comment_info[c_id]"));
$insert2 = str_replace($search_array4, $replace_array4, $insert2);
}
$insert = str_replace("<Comment>".$comment."</Comment>", $insert2, $insert);
}
}
if($group_info[allow_trackback] != "0" | $entry_info[trackbacks] != "0") {
$insert = str_replace("<%EntryTrackbackURL%>", url("trackback", "$entry_author[username]", "$entry_info[e_id]"), $insert);
$insert = str_replace("<%TrackbackCount%>", $numoftrackbacks, $insert);
$trackbackcount = occurrencecount("<Trackback>", "</Trackback>", $insert, "0");
for($f=0;$f<$trackbackcount;$f++) {
$insert3 = "";
$trackback = between("<Trackback>", "</Trackback>", $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("<TrackbackDelete>".between("<TrackbackDelete>", "</TrackbackDelete>", $this_trackback)."</TrackbackDelete>", "", $this_trackback);
$insert3 .= "<a name='tb$trackback_info[tb_id]'></a>".$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_author[format_date]", timezone($trackback_info[tb_date])), cdate("$entry_author[format_time]", timezone($trackback_info[tb_date])));
$insert3 = str_replace($search_array5, $replace_array5, $insert3);
}
$insert = str_replace("<Trackback>".$trackback."</Trackback>", $insert3, $insert);
}
}
}
$template = str_replace("<Entry>".$entry."</Entry>", $insert, $template);
}
// REPLACE ADS AT TOP
if(($group_info[show_ad] == 1 OR $group_info[show_ad] == 3) AND $group_info[html_ad] != "") {
// FIRST CHECK FOR BODY TAG
if(preg_match("/<(body)(.*)>/i", $template, $match1)) {
$template = str_replace($match1[0], "$match1[0]$group_info[html_ad]", $template);
// IF BODY TAG CANNOT BE FOUND, CHECK FOR HEAD TAG
} elseif(preg_match("/<(head)(.*)>/i", $template, $match2)) {
$template = str_replace($match2[0], "$group_info[html_ad]$match2[0]", $template);
// IF BODY AND HEAD TAGS CANT BE FOUND, STICK AD AT VERY TOP
} else {
$template = "$group_info[html_ad]$template";
}
}
// REPLACE ADS AT BOTTOM
if(($group_info[show_ad] == 2 OR $group_info[show_ad] == 3) AND $group_info[html_ad_bottom] != "") {
// FIRST CHECK FOR ENDING BODY TAG
if(preg_match("/(<\/body>)/i", $template, $match1)) {
$template = str_replace($match1[0], "$group_info[html_ad_bottom]$match1[0]", $template);
} elseif(preg_match("/<(\/html)(.*)>/i", $template, $match2)) {
$template = str_replace($match2[0], "$group_info[html_ad_bottom]$match2[0]", $template);
} else {
$template = "$template$group_info[html_ad_bottom]";
}
}
$search_vars = Array("<IfPages>", "</IfPages>", "<EarlierLink>", "</EarlierLink>", "<LaterLink>", "</LaterLink>", "<RecentEntry>", "</RecentEntry>", "<Entry>", "</Entry>", "<IfCommentsAllowed>", "</IfCommentsAllowed>", "<IfCommentPostAllowed>", "</IfCommentPostAllowed>", "<Comment>", "</Comment>", "<CommentEdit>", "</CommentEdit>", "<CommentDelete>", "</CommentDelete>", "<IfMainPage>", "</IfMainPage>", "<IfEntryPage>", "</IfEntryPage>", "<IfArchivePage>", "</IfArchivePage>", "<IfCategoriesAllowed>", "</IfCategoriesAllowed>", "<IfFriendsPage>", "</IfFriendsPage>", "<%TrackbackRDF%>", "<IfTrackbacksAllowed>", "</IfTrackbacksAllowed>");
$template = str_replace($search_vars, "", $template);
// OUTPUT WEBLOG
echo $template;
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -