⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 previewentry.php

📁 BLOG HOSTER---PHP & MYSQL Create Blogs in seconds Installation of your BlogHoster system is easy.
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?
$previewpage = "previewentry";
include "./manager/header.php";


$entry_info[title] = stripslashes($_POST['title']);
$entry_info[contents] = str_replace("&amp;", "&", str_replace("&gt;", ">", str_replace("&lt;", "<", stripslashes($_POST['contents']))));
$month = stripslashes($_POST['month']);
$day = stripslashes($_POST['day']);
$year = stripslashes($_POST['year']);
$hour = stripslashes($_POST['hour']);
$minute = stripslashes($_POST['minute']);
$ampm = stripslashes($_POST['ampm']);
$date = strtotime("$month/$day/$year $hour:$minute:00 $ampm");
$entry_info[date] = untimezone($date);
$entry_info[comments] = stripslashes($_POST['comments']);
$entry_info[trackbacks] = stripslashes($_POST['trackbacks']);
$entry_info[ec_id] = $_POST['ec_id'];
if(isset($_POST['e_id'])) { $e_id = $_POST['e_id']; } else { $e_id = 0; }

// CENSOR BAD WORDS FOR PREVIEW
$bad_words = explode(",", trim($admin_info[banned_badwords]));
$bad_words_replace = explode(",", trim($admin_info[banned_badwords_replace]));
$entry_info[contents] = str_replace($bad_words, $bad_words_replace, $entry_info[contents]);
$entry_info[title] = str_replace($bad_words, $bad_words_replace, $entry_info[title]);

$template = $user_info[template];

// CHECK FOR MISSING AVATAR FIRST
$avatar = $user_info[avatar];
$avatar_stripped = str_replace(" ", "", $avatar);
if($avatar_stripped == "" OR $avatar_stripped == "http://") {
$avatar = "./images/noavatar2.gif";
}

// CHANGE <, >, ", AND STATIC VARIABLES
$search_array = Array("&lt;", "&gt;", "&quot;", "<%WindowTitle%>", "<%Title%>", "<%Description%>", "<%Avatar%>", "<%Email%>", "<%ProfileURL%>", "<%MainPageURL%>", "<%ArchiveURL%>", "<%SiteFeedURL%>", "<%FriendsPageURL%>");
$replace_array = Array("<", ">", "\"", "$user_info[title] - $entry_info[title]", "$user_info[title]", "$user_info[description]", "$avatar", "$user_info[email]", "#", "#", "#", "#", "#");
$template = str_replace($search_array, $replace_array, $template);


// REMOVE ANYTHING BETWEEN <IFMAINPAGE> CONTAINERS
$ifmainpagecount = occurrencecount("<IfMainPage>", "</IfMainPage>", $template, "0");
for($a=0;$a<$ifmainpagecount;$a++) {
$template = str_replace("<IfMainPage>".between("<IfMainPage>", "</IfMainPage>", $template)."</IfMainPage>", "", $template);
}

// REMOVE ANYTHING BETWEEN <IFARCHIVEPAGE> CONTAINERS
$ifarchivepagecount = occurrencecount("<IfArchivePage>", "</IfArchivePage>", $template, "0");
for($a=0;$a<$ifarchivepagecount;$a++) {
$template = str_replace("<IfArchivePage>".between("<IfArchivePage>", "</IfArchivePage>", $template)."</IfArchivePage>", "", $template);
}

// REMOVE ANYTHING BETWEEN <IFFRIENDSPAGE> CONTAINERS
$iffriendspagecount = occurrencecount("<IfFriendsPage>", "</IfFriendsPage>", $template, "0");
for($a=0;$a<$iffriendspagecount;$a++) {
$template = str_replace("<IfFriendsPage>".between("<IfFriendsPage>", "</IfFriendsPage>", $template)."</IfFriendsPage>", "", $template);
}

// INPUT FRIENDS
$friendscount = occurrencecount("<Friends>", "</Friends>", $template, "0");
for($f=0;$f<$friendscount;$f++) {
 $insert = "";
 $friends = between("<Friends>", "</Friends>", $template);
 $allfriends = mysql_query("SELECT m_id, member_u_id FROM bhost_members WHERE u_id='$user_info[u_id]'");
 while($friend = mysql_fetch_assoc($allfriends)) {
 $friend_info = mysql_fetch_assoc(mysql_query("SELECT u_id, username FROM bhost_users WHERE u_id='$friend[member_u_id]'"));
 $insert .= $friends;
 $insert = str_replace("<%FriendUsername%>", "$friend_info[username]", $insert);
 $insert = str_replace("<%FriendURL%>", "#", $insert);
 $insert = str_replace("<%FriendProfileURL%>", "#", $insert);
 }
 $template = str_replace("<Friends>".$friends."</Friends>", $insert, $template);
}

// INPUT LINKS
$linkscount = occurrencecount("<Link>", "</Link>", $template, "0");
for($f=0;$f<$linkscount;$f++) {
 $insert = "";
 $link = between("<Link>", "</Link>", $template);
 if($user_info[links_url] != "") {
 $links_url = explode("<!>", trim($user_info[links_url]));
 $links_title = explode("<!>", trim($user_info[links_title]));
 for($l=0;$l<count($links_url);$l++) {
 $insert .= $link;
 $insert = str_replace("<%LinkTitle%>", "$links_title[$l]", $insert);
 $insert = str_replace("<%LinkURL%>", "$links_url[$l]", $insert);
 }}
 $template = str_replace("<Link>".$link."</Link>", $insert, $template);
}

// INPUT RECENT ENTRIES
$recententrycount = occurrencecount("<RecentEntry>", "</RecentEntry>", $template, "0");
for($r=0;$r<$recententrycount;$r++) {
 $insert = "";
 $recententry = between("<RecentEntry>", "</RecentEntry>", $template);
 if($e_id != 0) { 
  $recent_entries = $user_info[recent_entries]; 
 } else { 
  if(str_replace(" ", "", $entry_info[title]) == "") { $title = "<i>$previewentry1</i>"; } else { $title = $entry_info[title]; }
  $title = str_replace("&lt;", "<", $title);
  $title = str_replace("&gt;", ">", $title);
  $recent_entries = $user_info[recent_entries] - 1;
  $insert .= $recententry;
  $insert = str_replace("<%RecentEntryTitle%>", "<a href='#'>$title</a>", $insert);
  $insert = str_replace("<%RecentEntryDate%>", cdate("$user_info[format_date]", "<a href='#'>".timezone($recent_info[date]))."</a>", $insert);
  $insert = str_replace("<%RecentEntryTime%>", cdate("$user_info[format_time]", "<a href='#'>".timezone($recent_info[date]))."</a>", $insert);
 }
 $recent = mysql_query("SELECT e_id, title, date FROM bhost_entries WHERE u_id='$user_info[u_id]' AND draft='0' ORDER BY date DESC LIMIT $recent_entries");
 while($recent_info = mysql_fetch_assoc($recent)) {
  if(str_replace(" ", "", $recent_info[title]) == "") { $title = "<i>$previewentry1</i>"; } else { $title = $recent_info[title]; }
  $title = str_replace("&lt;", "<", $title);
  $title = str_replace("&gt;", ">", $title);
  $insert .= $recententry;
  $insert = str_replace("<%RecentEntryTitle%>", "<a href='#'>$title</a>", $insert);
  $insert = str_replace("<%RecentEntryDate%>", cdate("$user_info[format_date]", "<a href='#'>".timezone($recent_info[date]))."</a>", $insert);
  $insert = str_replace("<%RecentEntryTime%>", cdate("$user_info[format_time]", "<a href='#'>".timezone($recent_info[date]))."</a>", $insert);
 }
 $template = str_replace("<RecentEntry>".$recententry."</RecentEntry>", $insert, $template);
}


// CHECK FOR SHOW COMMENT PERMISSIONS
if($group_info[allow_comments] == "0" | $user_info[show_comments] == "0") {
$remove_comments = "yes";
} elseif($entry_info[comments] == "0") {
$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>", $template, "0");
 for($a=0;$a<$ifcommentsallowedcount;$a++) {
 $template = str_replace("<IfCommentsAllowed>".between("<IfCommentsAllowed>", "</IfCommentsAllowed>", $template)."</IfCommentsAllowed>", "", $template);
 }
 $commentcontcount = occurrencecount("<Comment>", "</Comment>", $template, "0");
 for($a=0;$a<$commentcontcount;$a++) {
 $template = str_replace("<Comment>".between("<Comment>", "</Comment>", $template)."</Comment>", "", $template);
 }
}



// CHECK FOR POST COMMENT PERMISSIONS
if($group_info[allow_comments] == "0" | $user_info[show_comments] == "0" | $user_info[who_comments] == "0") {
$remove_post_comments = "yes"; 
} elseif($entry_info[comments] == "0") {
$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>", $template, "0");
 for($a=0;$a<$ifpostcommentsallowedcount;$a++) {
 $template = str_replace("<IfCommentPostAllowed>".between("<IfCommentPostAllowed>", "</IfCommentPostAllowed>", $template)."</IfCommentPostAllowed>", "", $template);
 }
}

// REMOVE ANYTHING BETWEEN <IFTRACKBACKSALLOWED> AND <TRACKBACK> CONTAINERS IF TRACKBACKS NOT ALLOWED
if($group_info[allow_trackback] == "0" | $entry_info[trackbacks] == "0") {
 $iftrackbacksallowedcount = occurrencecount("<IfTrackbacksAllowed>", "</IfTrackbacksAllowed>", $template, "0");
 for($a=0;$a<$iftrackbacksallowedcount;$a++) {
 $template = str_replace("<IfTrackbacksAllowed>".between("<IfTrackbacksAllowed>", "</IfTrackbacksAllowed>", $template)."</IfTrackbacksAllowed>", "", $template);
 }
 $trackbackcontcount = occurrencecount("<Trackback>", "</Trackback>", $template, "0");
 for($a=0;$a<$trackbackcontcount;$a++) {
 $template = str_replace("<Trackback>".between("<Trackback>", "</Trackback>", $template)."</Trackback>", "", $template);
 }
}


// CREATE PAGE VARIABLES
$entry_date[date] = $entry_info[date];
if($e_id == 0) {
$total_entries = 1+mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE u_id='$user_info[u_id]' AND draft='0'"));
$current_page = 1+mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE u_id='$user_info[u_id]' AND date >= '$entry_date[date]' AND draft='0'"));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -