This commit has been accessed 557 times via Git panel.
commit 925be945ddb35224eb7c1d1637408cdd842dbdd8
tree 4ccdbcd3a95166681cfec2f7bc189079aefb7f07
parent b6523f1dbec49a6d83dca511eae8eb367c80c764
author Engels Antonio <engels@majcms.org> 1277314198 +0800
committer Engels Antonio <engels@majcms.org> 1277314198 +0800
maj-0.14-20080701-bb.zip
diff --git a/dig.php b/dig.php
index 71045c8..3d42668 100644
--- a/dig.php
+++ b/dig.php
@@ -21,6 +21,13 @@ if (get_magic_quotes_gpc()) {
$_POST = stripslashes_array($_POST);
}
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
?>
<title>Dig!</title>
@@ -105,7 +112,9 @@ if (file_exists("data/bb.txt") and file_exists("data/members/active") and ($dh_s
}
$stop_time_member = round(microtime(), 3);
+
$generation_time_member = $stop_time_member - $start_time_member;
+ $generation_time_member = str_replace("-","",$generation_time_member);
$show_search_members = array_unique($show_search_members);
$show_search_members = array_values($show_search_members);
@@ -163,6 +172,12 @@ if ($dh_search_items = opendir($dir)) {
while (($entry_search_items = readdir($dh_search_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_search_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_search_items/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
@@ -208,7 +223,9 @@ if ($dh_search_items = opendir($dir)) {
}
$stop_time_item = round(microtime(), 3);
+
$generation_time_item = $stop_time_item - $start_time_item;
+$generation_time_item = str_replace("-","",$generation_time_item);
$show_search_items = array_unique($show_search_items);
$show_search_items = array_values($show_search_items);
diff --git a/index.php b/index.php
index 5b5ab41..453c23b 100644
--- a/index.php
+++ b/index.php
@@ -228,6 +228,24 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
rename($comment_dir, $live_dir);
unlink("$live_dir/key.txt");
+ $cmonth = date("Ym", time() + $offset);
+
+ if (!file_exists("data/comments/latest")) {
+ mkdir("data/comments/latest");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth")) {
+ mkdir("data/comments/latest/$cmonth");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}")) {
+ mkdir("data/comments/latest/$cmonth/{$_REQUEST['entry']}");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}/{$_REQUEST['comment']}")) {
+ mkdir("data/comments/latest/$cmonth/{$_REQUEST['entry']}/{$_REQUEST['comment']}");
+ }
+
$cat_dir = file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists("data/items/{$_REQUEST['entry']}/private.txt") and !file_exists("data/categories/$cat_dir/private.txt")) {
@@ -530,7 +548,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
"X-Mailer: $mailer");
}
- if (file_exists("data/email.txt")) {
+ if (file_exists("data/email.txt") and !file_exists("data/xscreen.txt")) {
$comment_notice = "The following comment was submitted by $email_to last $timestamp for the entry \"$commented_entry_title\":\n\n\"$comment_quote\"\n\nVisit the link below to approve and post this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=approve\n\nVisit the link below to disapprove and delete this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=delete\n\nYou can also approve or disapprove pending comments at a later time by logging on to your blog.";
$comment_notice = wordwrap($comment_notice);
@@ -1614,6 +1632,12 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-summary.txt") and !file_
if ($dh_latest_post_items = opendir($dir)) {
while (($entry_latest_post_items = readdir($dh_latest_post_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_latest_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_latest_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -1795,6 +1819,16 @@ if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($entry_main = readdir($dh)) !== false) {
+ if ($entry_main != "." && $entry_main != "..") {
+ $grand[] = $entry_main;
+ }
+
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_main > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_main/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -1903,6 +1937,45 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
reset($items);
+sort($grand);
+reset($grand);
+
+if (count($items) == "0") {
+
+ echo '<table border=0 cellspacing=0 cellpadding=0 bgcolor=#cccccc style="background-color: transparent;"><tr><td width=';
+ if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
+ echo "610";
+ }
+ else {
+ echo "525";
+ }
+ echo '>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Oops!</div><div id=panel_body>';
+
+ if (count($grand) == "0") {
+ echo "No entry yet.";
+ }
+ else {
+ echo "Entry does not exist.";
+ }
+
+ echo '</div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+
+ echo "</td></tr></table>";
+}
+
$start = $_REQUEST['start'];
if (!isset($_REQUEST['start']) or empty($_REQUEST['start'])) {
@@ -3732,6 +3805,12 @@ if ($end < sizeof($items)) {
if ($dh_latest_items = opendir($dir)) {
while (($entry_latest_items = readdir($dh_latest_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_latest_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_latest_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -3914,40 +3993,6 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
}
}
-if (($count_latest_items > 0) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
-
- if (file_exists("data/round.txt")) {
- echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
- }
- else {
- echo '<div id=panel_title>';
- }
-
- echo 'Recent Entries</div><div id=panel_body>';
-
- $increment_recent_entries = 0;
-
- if (($count_latest_items <= $increase) or ($count_latest_items <= $increase * 2)) {
- $increase = $count_latest_items;
- $show_recent_entries = $increase - 1;
- }
- else {
- $show_recent_entries = $increase * 2 - 1;
- }
-
- while ($increment_recent_entries <= $show_recent_entries) {
- echo '<a class=navlink href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_items[$increment_recent_entries] . '>';
- readfile("$dir/$show_latest_items[$increment_recent_entries]/title.txt");
- echo '</a><br>';
- $increment_recent_entries = $increment_recent_entries + 1;
- }
-
- echo '</div>';
-
- if (file_exists("data/round.txt")) {
- echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
- }
-}
?>
<?php
@@ -4030,26 +4075,29 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-stats.txt")) {
<?php
-if (file_exists("data/round.txt")) {
- echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-}
-else {
- echo '<div id=panel_title>';
-}
+if (count($grand) > 0) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
-?>
+ ?>
-Search</div>
-<form enctype="multipart/form-data" action="dig.php" method="post">
-<div id="panel_body">
-<input type="text" class="search" name="search" autocomplete="off" maxlength="55">
-</form>
-</div>
+ Search</div>
+ <form enctype="multipart/form-data" action="dig.php" method="post">
+ <div id="panel_body">
+ <input type="text" class="search" name="search" autocomplete="off" maxlength="55">
+ </form>
+ </div>
-<?php
+ <?php
-if (file_exists("data/round.txt")) {
- echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
}
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -4177,11 +4225,115 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
?>
+<?php
+
+if (($count_latest_items > 0) and ($count_latest_items > $increase) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Recent Entries</div><div id=panel_body>';
+
+ $increment_recent_entries = "0";
+
+ if ($count_latest_items < 10) {
+ $max_recent_entries = $count_latest_items;
+ }
+ else {
+ $max_recent_entries = "10";
+ }
+
+ while ($increment_recent_entries < $max_recent_entries) {
+ echo '<a class=navlink href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_items[$increment_recent_entries] . '>';
+ readfile("$dir/$show_latest_items[$increment_recent_entries]/title.txt");
+ echo '</a><br>';
+ $increment_recent_entries = $increment_recent_entries + 1;
+ }
+
+ echo '</div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+}
+
+?>
+
+<?php
+
+$count_latest_comments = 0;
+
+$cmonth = date("Ym", time() + $offset);
+
+if (!file_exists("data/comments/latest/$cmonth")) {
+ rmdirr("data/comments/latest");
+}
+
+if (!file_exists("data/comments/latest")) {
+ mkdir("data/comments/latest");
+}
+
+if (file_exists("data/comments/latest/$cmonth")) {
+
+ if ($dh_latest_comments = opendir("data/comments/latest/$cmonth")) {
+ while (($entry_latest_comments = readdir($dh_latest_comments)) !== false) {
+ if ($entry_latest_comments != "." && $entry_latest_comments != "..") {
+ $show_latest_comments[] = $entry_latest_comments;
+ }
+ }
+ closedir($dh_latest_comments);
+ }
+
+ rsort($show_latest_comments);
+ reset($show_latest_comments);
+
+ $count_latest_comments = count($show_latest_comments);
+}
+
+if (($count_latest_comments > 0) and ($count_latest_items > $increase) and (!file_exists("data/xlcomment.txt") or isset($_SESSION['logged_in']))) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Latest Comments</div><div id=panel_body><table border="0" cellspacing="0" cellpadding="0" width="100%">';
+
+ foreach ($show_latest_comments as $latest_comment_entry) {
+
+ $latest_comment_entry_title = file_get_contents("data/items/$latest_comment_entry/title.txt");
+
+ $latest_comment_entry_count = count(glob("data/comments/latest/$cmonth/$latest_comment_entry/*"));
+
+ echo "<tr><td valign=top><a class=navlink href=index.php?entry=$latest_comment_entry&show=comments>$latest_comment_entry_title</a></td><td align=right valign=top>$latest_comment_entry_count</td></tr>";
+ }
+
+ echo '</table></div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+}
+
+?>
+
<?php
if (file_exists("data/albums")) {
if ($dh_album_list = opendir("data/albums")) {
while (($entry_album_list = readdir($dh_album_list)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_album_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_album_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -4241,6 +4393,12 @@ if (!file_exists("data/xrand.txt")) {
if ($dh_random_post_items = opendir($dir)) {
while (($entry_random_post_items = readdir($dh_random_post_items)) !== false) {
+
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_random_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
if (file_exists("data/items/$entry_random_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
@@ -4299,7 +4457,7 @@ if (!file_exists("data/xrand.txt")) {
}
}
- if ($count_random_post_items > 0) {
+ if ($count_random_post_items > $limit_random_post_entries) {
echo "</div>";
if (file_exists("data/round.txt")) {
@@ -4315,6 +4473,12 @@ if (file_exists("data/items")) {
if ($dh_archive_list = opendir("data/items")) {
while (($entry_archive_list = readdir($dh_archive_list)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_archive_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/xarc.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -4346,7 +4510,7 @@ if (file_exists("data/items")) {
reset($show_archive_list);
$count_archive_list = count($show_archive_list);
- if (($count_archive_list > 0) and ($count_latest_items > 0)) {
+ if (($count_archive_list > 0) and ($count_latest_items > $increase) and ($count_latest_items > 0)) {
$archive_entries = implode(" ",$show_archive_list);
$unique_archive_list = array_unique($show_archive_list);
diff --git a/rss.php b/rss.php
index 4d5e61f..fb8423f 100644
--- a/rss.php
+++ b/rss.php
@@ -18,6 +18,13 @@ if (get_magic_quotes_gpc()) {
$_REQUEST = stripslashes_array($_REQUEST);
}
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
$title_file = "data/title.txt";
$fp_title = fopen($title_file, "r");
@@ -53,6 +60,12 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
if ($dh_rss_items = opendir($dir)) {
while (($entry_rss_items = readdir($dh_rss_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_rss_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_rss_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_rss_items/cat.txt")) {
diff --git a/settings.php b/settings.php
index f14a182..4a5c72d 100644
--- a/settings.php
+++ b/settings.php
@@ -252,6 +252,18 @@ if (!isset($_POST['xrecent']) or empty($_POST['xrecent'])) {
}
}
+if (isset($_POST['xlcomment']) and !empty($_POST['xlcomment']) and ($_POST['xlcomment'] == "on") and !file_exists("data/xlcomment.txt")) {
+ touch("data/xlcomment.txt");
+}
+
+if (!isset($_POST['xlcomment']) or empty($_POST['xlcomment'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/xlcomment.txt")) {
+ unlink("data/xlcomment.txt");
+ }
+ }
+}
+
if (isset($_POST['round']) and !empty($_POST['round']) and ($_POST['round'] == "on") and !file_exists("data/round.txt")) {
touch("data/round.txt");
}
@@ -1041,10 +1053,10 @@ a:active {
<tr><td><p>ping on content change</p></td><td><input autocomplete=off class=input type=text name=ping value="<?php readfile("data/ping.txt"); ?>"></td></tr>
<tr><td rowspan=<?php
if (file_exists("data/email.txt")) {
- echo "13";
+ echo "14";
}
else {
- echo "12";
+ echo "13";
}
?>
><p>toggles</p></td><td><p><input type=checkbox name=nocomment <?php if (file_exists("data/nocomment.txt")) { echo checked; } ?>> Do not allow visitors to post comments.</p></td></tr>
@@ -1055,6 +1067,7 @@ a:active {
<tr><td><p><input type=checkbox name=xscreen <?php if (file_exists("data/xscreen.txt")) { echo checked; } ?>> Do not screen comments. Automatically approve them.</p></td></tr>
<tr><td><p><input type=checkbox name=nopdf <?php if (file_exists("data/nopdf.txt")) { echo checked; } ?>> Do not allow PDF generation for all entries.</p></td></tr>
<tr><td><p><input type=checkbox name=xrecent <?php if (file_exists("data/xrecent.txt")) { echo checked; } ?>> Do not show recent entries panel to guests.</p></td></tr>
+<tr><td><p><input type=checkbox name=xlcomment <?php if (file_exists("data/xlcomment.txt")) { echo checked; } ?>> Do not show latest comments panel to guests.</p></td></tr>
<tr><td><p><input type=checkbox name=xrand <?php if (file_exists("data/xrand.txt")) { echo checked; } ?>> Do not show random entries panel.</p></td></tr>
<tr><td><p><input type=checkbox name=xarc <?php if (file_exists("data/xarc.txt")) { echo checked; } ?>> Do not show archives panel.</p></td></tr>
<tr><td><p><input type=checkbox name=xcat <?php if (file_exists("data/xcat.txt")) { echo checked; } ?>> Do not show categories panel.</p></td></tr>
diff --git a/sitemap.php b/sitemap.php
index 160448a..b34cf15 100644
--- a/sitemap.php
+++ b/sitemap.php
@@ -2,11 +2,24 @@
error_reporting(E_ERROR);
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
$dir = "data/items";
if ($dh_sitemap_items = opendir($dir)) {
while (($entry_sitemap_items = readdir($dh_sitemap_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_sitemap_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_sitemap_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_sitemap_items/cat.txt")) {
tree 4ccdbcd3a95166681cfec2f7bc189079aefb7f07
parent b6523f1dbec49a6d83dca511eae8eb367c80c764
author Engels Antonio <engels@majcms.org> 1277314198 +0800
committer Engels Antonio <engels@majcms.org> 1277314198 +0800
maj-0.14-20080701-bb.zip
diff --git a/dig.php b/dig.php
index 71045c8..3d42668 100644
--- a/dig.php
+++ b/dig.php
@@ -21,6 +21,13 @@ if (get_magic_quotes_gpc()) {
$_POST = stripslashes_array($_POST);
}
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
?>
<title>Dig!</title>
@@ -105,7 +112,9 @@ if (file_exists("data/bb.txt") and file_exists("data/members/active") and ($dh_s
}
$stop_time_member = round(microtime(), 3);
+
$generation_time_member = $stop_time_member - $start_time_member;
+ $generation_time_member = str_replace("-","",$generation_time_member);
$show_search_members = array_unique($show_search_members);
$show_search_members = array_values($show_search_members);
@@ -163,6 +172,12 @@ if ($dh_search_items = opendir($dir)) {
while (($entry_search_items = readdir($dh_search_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_search_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_search_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_search_items/cat.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
@@ -208,7 +223,9 @@ if ($dh_search_items = opendir($dir)) {
}
$stop_time_item = round(microtime(), 3);
+
$generation_time_item = $stop_time_item - $start_time_item;
+$generation_time_item = str_replace("-","",$generation_time_item);
$show_search_items = array_unique($show_search_items);
$show_search_items = array_values($show_search_items);
diff --git a/index.php b/index.php
index 5b5ab41..453c23b 100644
--- a/index.php
+++ b/index.php
@@ -228,6 +228,24 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST
rename($comment_dir, $live_dir);
unlink("$live_dir/key.txt");
+ $cmonth = date("Ym", time() + $offset);
+
+ if (!file_exists("data/comments/latest")) {
+ mkdir("data/comments/latest");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth")) {
+ mkdir("data/comments/latest/$cmonth");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}")) {
+ mkdir("data/comments/latest/$cmonth/{$_REQUEST['entry']}");
+ }
+
+ if (!file_exists("data/comments/latest/$cmonth/{$_REQUEST['entry']}/{$_REQUEST['comment']}")) {
+ mkdir("data/comments/latest/$cmonth/{$_REQUEST['entry']}/{$_REQUEST['comment']}");
+ }
+
$cat_dir = file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists("data/items/{$_REQUEST['entry']}/private.txt") and !file_exists("data/categories/$cat_dir/private.txt")) {
@@ -530,7 +548,7 @@ if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
"X-Mailer: $mailer");
}
- if (file_exists("data/email.txt")) {
+ if (file_exists("data/email.txt") and !file_exists("data/xscreen.txt")) {
$comment_notice = "The following comment was submitted by $email_to last $timestamp for the entry \"$commented_entry_title\":\n\n\"$comment_quote\"\n\nVisit the link below to approve and post this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=approve\n\nVisit the link below to disapprove and delete this pending comment:\n\n{$sig_url}index.php?entry={$_REQUEST['entry']}&comment={$comment_entry_dir}&key={$key_rand}&action=delete\n\nYou can also approve or disapprove pending comments at a later time by logging on to your blog.";
$comment_notice = wordwrap($comment_notice);
@@ -1614,6 +1632,12 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-summary.txt") and !file_
if ($dh_latest_post_items = opendir($dir)) {
while (($entry_latest_post_items = readdir($dh_latest_post_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_latest_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_latest_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -1795,6 +1819,16 @@ if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($entry_main = readdir($dh)) !== false) {
+ if ($entry_main != "." && $entry_main != "..") {
+ $grand[] = $entry_main;
+ }
+
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_main > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_main/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -1903,6 +1937,45 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
reset($items);
+sort($grand);
+reset($grand);
+
+if (count($items) == "0") {
+
+ echo '<table border=0 cellspacing=0 cellpadding=0 bgcolor=#cccccc style="background-color: transparent;"><tr><td width=';
+ if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
+ echo "610";
+ }
+ else {
+ echo "525";
+ }
+ echo '>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Oops!</div><div id=panel_body>';
+
+ if (count($grand) == "0") {
+ echo "No entry yet.";
+ }
+ else {
+ echo "Entry does not exist.";
+ }
+
+ echo '</div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+
+ echo "</td></tr></table>";
+}
+
$start = $_REQUEST['start'];
if (!isset($_REQUEST['start']) or empty($_REQUEST['start'])) {
@@ -3732,6 +3805,12 @@ if ($end < sizeof($items)) {
if ($dh_latest_items = opendir($dir)) {
while (($entry_latest_items = readdir($dh_latest_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_latest_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_latest_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -3914,40 +3993,6 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
}
}
-if (($count_latest_items > 0) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
-
- if (file_exists("data/round.txt")) {
- echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
- }
- else {
- echo '<div id=panel_title>';
- }
-
- echo 'Recent Entries</div><div id=panel_body>';
-
- $increment_recent_entries = 0;
-
- if (($count_latest_items <= $increase) or ($count_latest_items <= $increase * 2)) {
- $increase = $count_latest_items;
- $show_recent_entries = $increase - 1;
- }
- else {
- $show_recent_entries = $increase * 2 - 1;
- }
-
- while ($increment_recent_entries <= $show_recent_entries) {
- echo '<a class=navlink href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_items[$increment_recent_entries] . '>';
- readfile("$dir/$show_latest_items[$increment_recent_entries]/title.txt");
- echo '</a><br>';
- $increment_recent_entries = $increment_recent_entries + 1;
- }
-
- echo '</div>';
-
- if (file_exists("data/round.txt")) {
- echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
- }
-}
?>
<?php
@@ -4030,26 +4075,29 @@ if (file_exists("data/bb.txt") and file_exists("data/bb-stats.txt")) {
<?php
-if (file_exists("data/round.txt")) {
- echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
-}
-else {
- echo '<div id=panel_title>';
-}
+if (count($grand) > 0) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
-?>
+ ?>
-Search</div>
-<form enctype="multipart/form-data" action="dig.php" method="post">
-<div id="panel_body">
-<input type="text" class="search" name="search" autocomplete="off" maxlength="55">
-</form>
-</div>
+ Search</div>
+ <form enctype="multipart/form-data" action="dig.php" method="post">
+ <div id="panel_body">
+ <input type="text" class="search" name="search" autocomplete="off" maxlength="55">
+ </form>
+ </div>
-<?php
+ <?php
-if (file_exists("data/round.txt")) {
- echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
}
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
@@ -4177,11 +4225,115 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
?>
+<?php
+
+if (($count_latest_items > 0) and ($count_latest_items > $increase) and (!file_exists("data/xrecent.txt") or isset($_SESSION['logged_in']))) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Recent Entries</div><div id=panel_body>';
+
+ $increment_recent_entries = "0";
+
+ if ($count_latest_items < 10) {
+ $max_recent_entries = $count_latest_items;
+ }
+ else {
+ $max_recent_entries = "10";
+ }
+
+ while ($increment_recent_entries < $max_recent_entries) {
+ echo '<a class=navlink href=' . $_SERVER['PHP_SELF'] . '?entry=' . $show_latest_items[$increment_recent_entries] . '>';
+ readfile("$dir/$show_latest_items[$increment_recent_entries]/title.txt");
+ echo '</a><br>';
+ $increment_recent_entries = $increment_recent_entries + 1;
+ }
+
+ echo '</div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+}
+
+?>
+
+<?php
+
+$count_latest_comments = 0;
+
+$cmonth = date("Ym", time() + $offset);
+
+if (!file_exists("data/comments/latest/$cmonth")) {
+ rmdirr("data/comments/latest");
+}
+
+if (!file_exists("data/comments/latest")) {
+ mkdir("data/comments/latest");
+}
+
+if (file_exists("data/comments/latest/$cmonth")) {
+
+ if ($dh_latest_comments = opendir("data/comments/latest/$cmonth")) {
+ while (($entry_latest_comments = readdir($dh_latest_comments)) !== false) {
+ if ($entry_latest_comments != "." && $entry_latest_comments != "..") {
+ $show_latest_comments[] = $entry_latest_comments;
+ }
+ }
+ closedir($dh_latest_comments);
+ }
+
+ rsort($show_latest_comments);
+ reset($show_latest_comments);
+
+ $count_latest_comments = count($show_latest_comments);
+}
+
+if (($count_latest_comments > 0) and ($count_latest_items > $increase) and (!file_exists("data/xlcomment.txt") or isset($_SESSION['logged_in']))) {
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbtop"><b class="rb1t"></b><b class="rb2t"></b><b class="rb3t"></b><b class="rb4t"></b></b><div class="xtitle">';
+ }
+ else {
+ echo '<div id=panel_title>';
+ }
+
+ echo 'Latest Comments</div><div id=panel_body><table border="0" cellspacing="0" cellpadding="0" width="100%">';
+
+ foreach ($show_latest_comments as $latest_comment_entry) {
+
+ $latest_comment_entry_title = file_get_contents("data/items/$latest_comment_entry/title.txt");
+
+ $latest_comment_entry_count = count(glob("data/comments/latest/$cmonth/$latest_comment_entry/*"));
+
+ echo "<tr><td valign=top><a class=navlink href=index.php?entry=$latest_comment_entry&show=comments>$latest_comment_entry_title</a></td><td align=right valign=top>$latest_comment_entry_count</td></tr>";
+ }
+
+ echo '</table></div>';
+
+ if (file_exists("data/round.txt")) {
+ echo '<b class="rbbottom"><b class="rb4b"></b><b class="rb3b"></b><b class="rb2b"></b><b class="rb1b"></b></b>';
+ }
+}
+
+?>
+
<?php
if (file_exists("data/albums")) {
if ($dh_album_list = opendir("data/albums")) {
while (($entry_album_list = readdir($dh_album_list)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_album_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/items/$entry_album_list/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -4241,6 +4393,12 @@ if (!file_exists("data/xrand.txt")) {
if ($dh_random_post_items = opendir($dir)) {
while (($entry_random_post_items = readdir($dh_random_post_items)) !== false) {
+
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_random_post_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
if (file_exists("data/items/$entry_random_post_items/private.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
@@ -4299,7 +4457,7 @@ if (!file_exists("data/xrand.txt")) {
}
}
- if ($count_random_post_items > 0) {
+ if ($count_random_post_items > $limit_random_post_entries) {
echo "</div>";
if (file_exists("data/round.txt")) {
@@ -4315,6 +4473,12 @@ if (file_exists("data/items")) {
if ($dh_archive_list = opendir("data/items")) {
while (($entry_archive_list = readdir($dh_archive_list)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_archive_list > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
if (file_exists("data/xarc.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
continue;
}
@@ -4346,7 +4510,7 @@ if (file_exists("data/items")) {
reset($show_archive_list);
$count_archive_list = count($show_archive_list);
- if (($count_archive_list > 0) and ($count_latest_items > 0)) {
+ if (($count_archive_list > 0) and ($count_latest_items > $increase) and ($count_latest_items > 0)) {
$archive_entries = implode(" ",$show_archive_list);
$unique_archive_list = array_unique($show_archive_list);
diff --git a/rss.php b/rss.php
index 4d5e61f..fb8423f 100644
--- a/rss.php
+++ b/rss.php
@@ -18,6 +18,13 @@ if (get_magic_quotes_gpc()) {
$_REQUEST = stripslashes_array($_REQUEST);
}
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
$title_file = "data/title.txt";
$fp_title = fopen($title_file, "r");
@@ -53,6 +60,12 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
if ($dh_rss_items = opendir($dir)) {
while (($entry_rss_items = readdir($dh_rss_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_rss_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_rss_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_rss_items/cat.txt")) {
diff --git a/settings.php b/settings.php
index f14a182..4a5c72d 100644
--- a/settings.php
+++ b/settings.php
@@ -252,6 +252,18 @@ if (!isset($_POST['xrecent']) or empty($_POST['xrecent'])) {
}
}
+if (isset($_POST['xlcomment']) and !empty($_POST['xlcomment']) and ($_POST['xlcomment'] == "on") and !file_exists("data/xlcomment.txt")) {
+ touch("data/xlcomment.txt");
+}
+
+if (!isset($_POST['xlcomment']) or empty($_POST['xlcomment'])) {
+ if (isset($_POST['edit']) and ($_POST['edit'] == "on")) {
+ if (file_exists("data/xlcomment.txt")) {
+ unlink("data/xlcomment.txt");
+ }
+ }
+}
+
if (isset($_POST['round']) and !empty($_POST['round']) and ($_POST['round'] == "on") and !file_exists("data/round.txt")) {
touch("data/round.txt");
}
@@ -1041,10 +1053,10 @@ a:active {
<tr><td><p>ping on content change</p></td><td><input autocomplete=off class=input type=text name=ping value="<?php readfile("data/ping.txt"); ?>"></td></tr>
<tr><td rowspan=<?php
if (file_exists("data/email.txt")) {
- echo "13";
+ echo "14";
}
else {
- echo "12";
+ echo "13";
}
?>
><p>toggles</p></td><td><p><input type=checkbox name=nocomment <?php if (file_exists("data/nocomment.txt")) { echo checked; } ?>> Do not allow visitors to post comments.</p></td></tr>
@@ -1055,6 +1067,7 @@ a:active {
<tr><td><p><input type=checkbox name=xscreen <?php if (file_exists("data/xscreen.txt")) { echo checked; } ?>> Do not screen comments. Automatically approve them.</p></td></tr>
<tr><td><p><input type=checkbox name=nopdf <?php if (file_exists("data/nopdf.txt")) { echo checked; } ?>> Do not allow PDF generation for all entries.</p></td></tr>
<tr><td><p><input type=checkbox name=xrecent <?php if (file_exists("data/xrecent.txt")) { echo checked; } ?>> Do not show recent entries panel to guests.</p></td></tr>
+<tr><td><p><input type=checkbox name=xlcomment <?php if (file_exists("data/xlcomment.txt")) { echo checked; } ?>> Do not show latest comments panel to guests.</p></td></tr>
<tr><td><p><input type=checkbox name=xrand <?php if (file_exists("data/xrand.txt")) { echo checked; } ?>> Do not show random entries panel.</p></td></tr>
<tr><td><p><input type=checkbox name=xarc <?php if (file_exists("data/xarc.txt")) { echo checked; } ?>> Do not show archives panel.</p></td></tr>
<tr><td><p><input type=checkbox name=xcat <?php if (file_exists("data/xcat.txt")) { echo checked; } ?>> Do not show categories panel.</p></td></tr>
diff --git a/sitemap.php b/sitemap.php
index 160448a..b34cf15 100644
--- a/sitemap.php
+++ b/sitemap.php
@@ -2,11 +2,24 @@
error_reporting(E_ERROR);
+if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+}
+else {
+ $offset = 0;
+}
+
$dir = "data/items";
if ($dh_sitemap_items = opendir($dir)) {
while (($entry_sitemap_items = readdir($dh_sitemap_items)) !== false) {
+ $today = date("YmdHis", time() + $offset);
+
+ if (($entry_sitemap_items > $today) and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username))) {
+ continue;
+ }
+
$cat_dir = file_get_contents("data/items/$entry_sitemap_items/category.txt");
if (file_exists("data/categories/$cat_dir/private.txt") and !file_exists("data/items/$entry_sitemap_items/cat.txt")) {