This commit has been accessed 606 times via Git panel.
commit 67d7367e9cd8915aafdcee5944fa7d31e98527b3
tree d0af4d63334345cb7bab6243fa7d5c69e503fc59
parent 5f2d4fb53d0869511ffdeb6f78e8a97441db2996
author Engels Antonio <engels@majcms.org> 1277314186 +0800
committer Engels Antonio <engels@majcms.org> 1277314186 +0800
maj-0.14-20060618.zip
diff --git a/add.php b/add.php
index f73af01..b12a810 100644
--- a/add.php
+++ b/add.php
@@ -80,8 +80,8 @@ $entry_min = date("i", time() + $offset);
$entry_sec = date("s", time() + $offset);
$image_path = "images/";
-$max_image_size = 2000000;
-$max_file_size = 2000000;
+$max_image_size = 8000000;
+$max_file_size = 8000000;
?>
@@ -254,6 +254,7 @@ $max_file_size = 2000000;
<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
<input autocomplete=off type=file name=file_input> Select optional file.</p>
+<p><input autocomplete=off type=password name=passwd> Enter optional password.</p>
<?php
if (file_exists("data/categories")) {
if ($dh_cat = opendir("data/categories")) {
@@ -284,7 +285,7 @@ $max_file_size = 2000000;
}
}
?>
-<p><input type=checkbox name=sticky>Put entry title in Links box.<br>
+<p><input type=checkbox name=sticky>Put entry title in Quick Links box.<br>
<input type=checkbox name=display>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
<input type=checkbox name=private>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
@@ -547,6 +548,21 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
}
}
+if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
+ if (($_REQUEST['passwd'] == "password") or empty($_REQUEST['passwd'])) {
+ unlink("data/items/$entry/passwd.txt");
+ }
+ else {
+ $fp_passwd_txt = fopen("data/items/$entry/passwd.txt","w");
+ $passwd_crypt = sha1($_REQUEST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ chmod("data/items/$entry/passwd.txt", 0666);
+ }
+}
+
$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
$ping_urls_file = "data/ping.txt";
diff --git a/edit.php b/edit.php
index a1ec400..3f919d9 100644
--- a/edit.php
+++ b/edit.php
@@ -48,8 +48,8 @@ $img_file = 'data/items/' . $_REQUEST['entry'] . '/image.txt';
$revisions_file = 'data/items/' . $_REQUEST['entry'] . '/revisions.txt';
$image_path = "images/";
-$max_image_size = 2000000;
-$max_file_size = 2000000;
+$max_image_size = 8000000;
+$max_file_size = 8000000;
if (file_exists("data/items/{$_REQUEST['entry']}/category.txt")) {
$category_check = 'data/categories/' . file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
@@ -289,6 +289,23 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
<input autocomplete=off type=file name=entry_image_input> Upload optional entry image.</p>
<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
<input autocomplete=off type=file name=file_input> Upload optional file.</p>
+<p><input autocomplete=off type=password name=passwd <?php
+
+if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "value=password";
+}
+?>
+
+> <?php
+
+if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "Enter new password or clear field to disable password protection.";
+}
+else {
+ echo "Enter optional password.";
+}
+?></p>
+
<?php
if (file_exists("data/categories")) {
if ($dh_cat = opendir("data/categories")) {
@@ -327,7 +344,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
}
}
?>
-<p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Links box.<br>
+<p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Quick Links box.<br>
<input type=checkbox name=display <?php $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt"; if (file_exists($display_sem)) { echo checked; } ?>>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
<input type=checkbox name=private <?php $private_sem = "data/items/{$_REQUEST['entry']}/private.txt"; if (file_exists($private_sem)) { echo checked; } ?>>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
@@ -653,6 +670,22 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
}
}
+$passwd_file = "data/items/{$_REQUEST['entry']}/passwd.txt";
+if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd']) and ($_REQUEST['passwd'] != "password")) {
+ $fp_passwd_txt = fopen("$passwd_file","w");
+ $passwd_crypt = sha1($_REQUEST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ chmod("$passwd_file", 0666);
+}
+if (!isset($_REQUEST['passwd']) or empty($_REQUEST['passwd'])) {
+ if (file_exists($passwd_file)) {
+ unlink($passwd_file);
+ }
+}
+
$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
$ping_urls_file = "data/ping.txt";
diff --git a/images/widget.protected.png b/images/widget.protected.png
new file mode 100644
index 0000000..cd709dd
Binary files /dev/null and b/images/widget.protected.png differ
diff --git a/index.php b/index.php
index 9153337..af428da 100644
--- a/index.php
+++ b/index.php
@@ -791,6 +791,7 @@ include("data/profile.php");
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
echo '<a href=add.php>Add Entry</a><br>';
echo '<a href=settings.php>Settings</a><br>';
+ echo '<a href=panels.php>Panels</a><br>';
echo '<a href=cat.php>Categories</a><br>';
echo '<a href=colors.php>Colors</a><br>';
echo '<a href=login.php>Logout</a>';
@@ -832,7 +833,7 @@ if (file_exists("data/sticky")) {
$count_sticky_list = count($show_sticky_list);
if ($count_sticky_list > 0) {
- echo '<div id=panel_title>Links</div>';
+ echo '<div id=panel_title>Quick Links</div>';
echo '<div id=panel_body>';
foreach ($show_sticky_list as $sticky_list_entry) {
echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=';
@@ -847,6 +848,39 @@ if (file_exists("data/sticky")) {
?>
<p></p>
+
+<?php
+if (file_exists("data/panels")) {
+ if ($dh_panel_list = opendir("data/panels")) {
+ while (($entry_panel_list = readdir($dh_panel_list)) !== false) {
+
+ if (file_exists("data/panels/$entry_panel_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+ continue;
+ }
+
+ if ($entry_panel_list != "." && $entry_panel_list != ".." && fnmatch("*", $entry_panel_list)) {
+ $show_panel_list[] = $entry_panel_list;
+ }
+ }
+ closedir($dh_panel_list);
+ }
+
+ sort($show_panel_list);
+ reset($show_panel_list);
+ $count_panel_list = count($show_panel_list);
+
+ if ($count_panel_list > 0) {
+ foreach ($show_panel_list as $panel_list_entry) {
+ echo '<div id=panel_title>';
+ readfile("data/panels/$panel_list_entry/title.txt");
+ echo '</div><div id=panel_body>';
+ include("data/panels/$panel_list_entry/panel.php");
+ echo '</div><p></p>';
+ }
+ }
+}
+?>
+
</td><td width=15></td><td valign=top width=525>
<?php
@@ -941,6 +975,10 @@ foreach ($disp as $d) {
echo '<a href=edit.php?entry=';
echo $d;
echo '><img src=images/widget.edit.png border=0 width=11 height=11 align=right alt="edit entry"></a>';
+ if (file_exists("$dir/$d/passwd.txt")) {
+ echo '<img src=images/widget.protected.png border=0 width=11 height=11 align=right alt="protected entry">';
+ }
+
if (file_exists("$dir/$d/private.txt")) {
echo '<img src=images/widget.private.png border=0 width=11 height=11 align=right alt="private entry">';
}
@@ -993,7 +1031,22 @@ foreach ($disp as $d) {
}
}
echo '</font><font style="font-size: 5px;"><br><br></font>';
- readfile("$dir/$d/body.txt");
+
+ if (file_exists("$dir/$d/passwd.txt")) {
+ $passwd = file_get_contents("$dir/$d/passwd.txt");
+ }
+ if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
+ $crypt_passwd = sha1($_REQUEST['passwd']);
+ $crypt_passwd = md5($crypt_passwd);
+ $crypt_passwd = crypt($crypt_passwd, $crypt_passwd);
+ }
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d>here</a> to enter it.";
+ }
+ else {
+ readfile("$dir/$d/body.txt");
+ }
+
echo '</div><div id=panel_footer>';
echo '<table border=0 cellspacing=0 cellpadding=0 width=513><tr><td align=right>';
echo '<font style="font-size: 10px; color: ';
@@ -1185,87 +1238,118 @@ else {
}
echo '</div><div id=panel_body>';
- /* thumbnail auto-clean-up (20060409) - This should delete thumbnails of non-existent album images. */
-
- if ($dh_album = opendir("images/$d/thumbnails")) {
- while (($thumbnail_album = readdir($dh_album)) !== false) {
- if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*", $thumbnail_album)) {
- $current_thumbnail = "images/$d/thumbnails/$thumbnail_album";
- $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
- $parent_image = "images/$d/album/$parent_image";
-
- if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
- unlink($current_thumbnail);
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=album>here</a> to enter it.";
+ }
+ else {
+
+ /* thumbnail auto-clean-up (20060409) - This should delete thumbnails of non-existent album images. */
+
+ if (file_exists("images/$d/thumbnails")) {
+ if ($dh_album = opendir("images/$d/thumbnails")) {
+ while (($thumbnail_album = readdir($dh_album)) !== false) {
+ if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*", $thumbnail_album)) {
+ $current_thumbnail = "images/$d/thumbnails/$thumbnail_album";
+ $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
+ $parent_image = "images/$d/album/$parent_image";
+ if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
+ unlink($current_thumbnail);
+ }
+ }
}
}
}
- }
-
- if ($dh_album = opendir("images/$d/album")) {
- while (($entry_album = readdir($dh_album)) !== false) {
- if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
-
- $current_image = "images/$d/album/$entry_album";
- $current_image_size = getimagesize($current_image);
- $current_width = $current_image_size[0];
- $current_height = $current_image_size[1];
- $max_width = 98;
- $max_height = 73;
-
- if (($current_width > $max_width) || ($current_height > $max_height)) {
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
- else {
- $sizefactor = (double) ($max_width / $current_width) ;
+
+ /* auto-sort entries (20060409) - MAJ previously relied on readdir() alone, causing entries to be displayed in the order in which they are stored by the filesystem. */
+
+ if (file_exists("images/$d/album")) {
+ if ($dh_album = opendir("images/$d/album")) {
+ while (($entry_album = readdir($dh_album)) !== false) {
+ if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+ $sort_album[] = $entry_album;
}
}
-
- $new_width = (int) ($current_width * $sizefactor);
- $new_height = (int) ($current_height * $sizefactor);
-
- /* auto-thumbnails (20060213) - In maj-0.14-20060131, album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
-
- if (!file_exists("images/$d/thumbnails/{$entry_album}-thumbnail.jpg")) {
-
- $work_thumb = imagecreatetruecolor($new_width,$new_height);
- $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
- switch($get_mimetype) {
- case "image/jpg":
- case "image/jpeg":
- $work_image = imagecreatefromjpeg($current_image);
- break;
- case "image/gif":
- $work_image = imagecreatefromgif($current_image);
- break;
- case "image/png":
- $work_image = imagecreatefrompng($current_image);
- break;
+ closedir($dh_album);
+ }
+
+ sort($sort_album);
+ reset($sort_album);
+ $count_album_entry = count($sort_album);
+
+ if ($count_album_entry < 1) {
+ rmdirr("images/$d/album");
+ rmdirr("images/$d/thumbnails");
+ }
+ else {
+ foreach($sort_album as $album_entry) {
+ $current_image = "images/$d/album/$album_entry";
+ $current_image_size = getimagesize($current_image);
+ $current_width = $current_image_size[0];
+ $current_height = $current_image_size[1];
+ $max_width = 98;
+ $max_height = 73;
+
+ if (($current_width > $max_width) || ($current_height > $max_height)) {
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
+ else {
+ $sizefactor = (double) ($max_width / $current_width) ;
+ }
}
-
- imagecopyresampled($work_thumb, $work_image ,0, 0, 0, 0, $new_width, $new_height, $current_width, $current_height);
-
- if (!file_exists("images/$d/thumbnails")) {
- mkdir("images/$d/thumbnails", 0777);
- chmod("images/$d/thumbnails", 0777);
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+
+ /* auto-thumbnails (20060213) - In maj-0.14-20060131, album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
+
+ if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
+
+ $work_thumb = imagecreatetruecolor($new_width,$new_height);
+ $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
+ switch($get_mimetype) {
+ case "image/jpg":
+ case "image/jpeg":
+ $work_image = imagecreatefromjpeg($current_image);
+ break;
+ case "image/gif":
+ $work_image = imagecreatefromgif($current_image);
+ break;
+ case "image/png":
+ $work_image = imagecreatefrompng($current_image);
+ break;
+ }
+
+ imagecopyresampled($work_thumb, $work_image ,0, 0, 0, 0, $new_width, $new_height, $current_width, $current_height);
+
+ if (!file_exists("images/$d/thumbnails")) {
+ mkdir("images/$d/thumbnails", 0777);
+ chmod("images/$d/thumbnails", 0777);
+ }
+
+ imagejpeg($work_thumb, "images/$d/thumbnails/{$album_entry}-thumbnail.jpg", 80);
+
}
+ echo "<a href=images/$d/album/$album_entry>";
- imagejpeg($work_thumb, "images/$d/thumbnails/{$entry_album}-thumbnail.jpg", 80);
+ /* auto-thumbnails (20060519) - Just in case php-gd does not exist, do it the old way. */
-}
+ if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
+ echo "<img src=images/$d/album/$album_entry width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+ else {
+ echo "<img src=images/$d/thumbnails/{$album_entry}-thumbnail.jpg width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
- echo "<a href=images/$d/album/$entry_album>";
- echo "<img src=images/$d/thumbnails/{$entry_album}-thumbnail.jpg width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- if (file_exists("data/items/$d/album/captions/{$entry_album}.txt")) {
- echo ' alt="';
- readfile("data/items/$d/album/captions/{$entry_album}.txt");
- echo '"';
+ if (file_exists("data/items/$d/album/captions/{$album_entry}.txt")) {
+ echo ' alt="';
+ readfile("data/items/$d/album/captions/{$album_entry}.txt");
+ echo '"';
+ }
+ echo "></a>";
}
- echo "></a>";
-
}
}
- closedir($dh_album);
}
echo '</div></td></tr></table></p>';
@@ -1281,134 +1365,150 @@ else {
}
echo '</div><div id=panel_body>';
- if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
- while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
- if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
- echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
- echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
- echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
- echo '<td><p><b>';
- echo $entry_filedrop;
- echo'</b><br>';
- $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
- $size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
- echo $size_string;
- $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
- if (file_exists($filedrop_count_file)) {
- $fp_filedrop_count = fopen($filedrop_count_file, "r");
- $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
- fclose($fp_filedrop_count);
- echo '<br>';
- echo $filedrop_count;
- if ($filedrop_count == 1) {
- echo ' download';
- }
- if ($filedrop_count > 1) {
- echo ' downloads';
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=filedrop>here</a> to enter it.";
+ }
+ else {
+
+ if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
+ while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
+ if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
+ echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
+ echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
+ echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
+ echo '<td><p><b>';
+ echo $entry_filedrop;
+ echo'</b><br>';
+ $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
+ $size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
+ echo $size_string;
+ $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
+ if (file_exists($filedrop_count_file)) {
+ $fp_filedrop_count = fopen($filedrop_count_file, "r");
+ $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
+ fclose($fp_filedrop_count);
+ echo '<br>';
+ echo $filedrop_count;
+ if ($filedrop_count == 1) {
+ echo ' download';
+ }
+ if ($filedrop_count > 1) {
+ echo ' downloads';
+ }
}
+ echo '</p></td></tr></table>';
}
- echo '</p></td></tr></table>';
}
+ closedir($dh_filedrop);
}
- closedir($dh_filedrop);
}
echo '</div></td></tr></table></p>';
-
}
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == comments) and !file_exists("data/nocomment.txt")) {
- echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
- if ($dh_comments = opendir("$dir/$d/comments/live")) {
- while (($entry_comments = readdir($dh_comments)) !== false) {
- if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) { $show_comments[] = $entry_comments;
- }
- }
- closedir($dh_comments);
- }
-
- asort($show_comments);
- reset($show_comments);
- foreach ($show_comments as $comment) {
- echo '<div id=panel_title>';
-
- if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
- echo '<a rel=nofollow target=_blank href=';
- readfile("$dir/$d/comments/live/$comment/url.txt");
- echo '>';
- }
-
- readfile("$dir/$d/comments/live/$comment/firstname.txt");
- echo ' ';
- readfile("$dir/$d/comments/live/$comment/lastname.txt");
-
- if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
- echo '</a>';
- }
-
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- echo ' <';
- readfile("$dir/$d/comments/live/$comment/email.txt");
- echo '>';
- }
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- echo '<a href=del.php?entry=' . $d . '&comment=' . $comment . '&type=live><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
- echo '<a href=edit.php?entry=' . $d . '&comment=' . $comment . '><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ }
+ else {
+ echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+ if ($dh_comments = opendir("$dir/$d/comments/live")) {
+ while (($entry_comments = readdir($dh_comments)) !== false) {
+ if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) { $show_comments[] = $entry_comments;
+ }
+ }
+ closedir($dh_comments);
}
- echo '</div>';
- echo '<div id=panel_body>';
- echo '<font style="font-size: 10px; color: #999999;">';
- readfile("$dir/$d/comments/live/$comment/timestamp.txt");
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- if (file_exists("$dir/$d/comments/live/$comment/revisions.txt")) {
- echo ' (Revision ';
- readfile("$dir/$d/comments/live/$comment/revisions.txt");
- echo ')';
+
+ asort($show_comments);
+ reset($show_comments);
+ foreach ($show_comments as $comment) {
+ echo '<div id=panel_title>';
+
+ if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+ echo '<a rel=nofollow target=_blank href=';
+ readfile("$dir/$d/comments/live/$comment/url.txt");
+ echo '>';
+ }
+
+ readfile("$dir/$d/comments/live/$comment/firstname.txt");
+ echo ' ';
+ readfile("$dir/$d/comments/live/$comment/lastname.txt");
+
+ if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+ echo '</a>';
+ }
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ echo ' <';
+ readfile("$dir/$d/comments/live/$comment/email.txt");
+ echo '>';
}
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ echo '<a href=del.php?entry=' . $d . '&comment=' . $comment . '&type=live><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
+ echo '<a href=edit.php?entry=' . $d . '&comment=' . $comment . '><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+ }
+ echo '</div>';
+ echo '<div id=panel_body>';
+ echo '<font style="font-size: 10px; color: #999999;">';
+ readfile("$dir/$d/comments/live/$comment/timestamp.txt");
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ if (file_exists("$dir/$d/comments/live/$comment/revisions.txt")) {
+ echo ' (Revision ';
+ readfile("$dir/$d/comments/live/$comment/revisions.txt");
+ echo ')';
+ }
+ }
+ echo '</font><font style="font-size: 5px;"><br><br></font>';
+ readfile("$dir/$d/comments/live/$comment/comment.txt");
+ echo '</div><p></p>';
}
- echo '</font><font style="font-size: 5px;"><br><br></font>';
- readfile("$dir/$d/comments/live/$comment/comment.txt");
- echo '</div><p></p>';
+ unset($show_comments);
+ echo '</td></tr></table></p>';
}
- unset($show_comments);
- echo '</td></tr></table></p>';
if (!file_exists("data/nocomment.txt")) {
echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
echo '<p></p><p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
- $capcha_rand = str_rand(7);
-
- echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
-
- ?>
-
- <table border=0 cellspacing=2 cellpadding=0 width=500>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?entry=<?php echo $d; ?>&show=comments" method="post">
- <input type=hidden name=capcha_get value="<?php echo $capcha_rand; ?>">
- <tr><td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td><td rowspan=7 valign=top width=75 align=right>
-<table border=0 cellspacing=1 cellpadding=2>
-<tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
-<tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
-<tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
-<tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
-<tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
-<tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
-<tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
-<tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
-<tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
-<tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
-</td></tr>
-</table>
- <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
- <tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
- <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
- <tr><td ><p>Comment*</p></td><td ><textarea class=input name=new_comment rows=10></textarea></td></tr>
- <tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=capcha_put maxlength=7></td></tr>
- <tr><td><p></p></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
- </form>
- </table>
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.";
+ }
+ else {
+
+ $capcha_rand = str_rand(7);
+
+ echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
+
+ ?>
+
+ <table border=0 cellspacing=2 cellpadding=0 width=500>
+ <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?entry=<?php echo $d; ?>&show=comments" method="post">
+ <input type=hidden name=capcha_get value="<?php echo $capcha_rand; ?>">
+ <tr><td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td><td rowspan=7 valign=top width=75 align=right>
+ <table border=0 cellspacing=1 cellpadding=2>
+ <tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
+ <tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
+ <tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
+ <tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
+ <tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
+ <tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
+ <tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
+ <tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
+ <tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
+ <tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
+ </td></tr>
+ </table>
+ <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
+ <tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
+ <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
+ <tr><td ><p>Comment*</p></td><td ><textarea class=input name=new_comment rows=10></textarea></td></tr>
+ <tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=capcha_put maxlength=7></td></tr>
+ <tr><td><p></p></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
+ </form>
+ </table>
+ <?php } ?>
</td></tr></table></p>
<?php
diff --git a/panels.php b/panels.php
new file mode 100644
index 0000000..941a2c7
--- /dev/null
+++ b/panels.php
@@ -0,0 +1,203 @@
+<?php
+
+session_start();
+header("Cache-control: private");
+
+$login_username = file_get_contents("data/username.txt");
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+ exit();
+}
+
+function rmdirr($recurse_dirname)
+{
+
+ if (!file_exists($recurse_dirname)) {
+ return false;
+ }
+
+ if (is_file($recurse_dirname)) {
+ return unlink($recurse_dirname);
+ }
+
+ $recurse_dir = dir($recurse_dirname);
+ while (false !== $recurse_entry = $recurse_dir->read()) {
+
+ if ($recurse_entry == '.' || $recurse_entry == '..') {
+ continue;
+ }
+
+ rmdirr("$recurse_dirname/$recurse_entry");
+ }
+
+ $recurse_dir->close();
+ return rmdir($recurse_dirname);
+}
+
+if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id']) and isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title']) and isset($_REQUEST['new_content']) and !empty($_REQUEST['new_content']) and !file_exists("data/panels/{$_REQUEST['new_id']}")) {
+
+ if (!file_exists("data/panels")) {
+ mkdir("data/panels", 0777);
+ }
+
+ $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
+
+ if (!file_exists("data/panels/$new_id")) {
+ mkdir("data/panels/$new_id", 0777);
+ }
+
+ $new_title = ucfirst(strip_tags(trim($_REQUEST['new_title'])));
+ $open_title_file = fopen("data/panels/$new_id/title.txt","w");
+ fwrite($open_title_file,$new_title);
+ fclose($open_title_file);
+ chmod("data/panels/$new_id/title.txt", 0666);
+
+ $panel_content = ucfirst(trim($_REQUEST['new_content']));
+
+ $new_content_file = fopen("data/panels/$new_id/panel.php","w");
+ fwrite($new_content_file,$panel_content);
+ fclose($new_content_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
+}
+
+if (isset($_REQUEST['panel_del']) and !empty($_REQUEST['panel_del']) and ($_REQUEST['panel_del'] == "on")) {
+ rmdirr("data/panels/{$_REQUEST['panel_id']}");
+}
+
+if ((!isset($_REQUEST['panel_hide']) or !empty($_REQUEST['panel_hide'])) and ($_REQUEST['panel_edit'] == "on")) {
+ if (file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
+ unlink("data/panels/{$_REQUEST['panel_id']}/private.txt");
+ }
+}
+
+if (isset($_REQUEST['panel_hide']) and !empty($_REQUEST['panel_hide']) and ($_REQUEST['panel_hide'] == "on")) {
+ if (!file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
+ touch("data/panels/{$_REQUEST['panel_id']}/private.txt");
+ chmod("data/panels/{$_REQUEST['panel_id']}/private.txt", 0666);
+ }
+}
+
+if (isset($_REQUEST['panel_title']) and !empty($_REQUEST['panel_title'])) {
+
+ $panel_title = ucfirst(strip_tags(trim($_REQUEST['panel_title'])));
+
+ if ($panel_title != file_get_contents("data/panels/{$_REQUEST['panel_id']}/title.txt")) {
+ $edit_title_file = fopen("data/panels/{$_REQUEST['panel_id']}/title.txt","w");
+ fwrite($edit_title_file,$panel_title);
+ fclose($edit_title_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/title.txt", 0666);
+ }
+}
+
+if (isset($_REQUEST['panel_content']) and !empty($_REQUEST['panel_content'])) {
+
+ $panel_content = ucfirst(trim($_REQUEST['panel_content']));
+
+ if ($panel_content != file_get_contents("data/panels/{$_REQUEST['panel_id']}/panel.php")) {
+ $edit_content_file = fopen("data/panels/{$_REQUEST['panel_id']}/panel.php","w");
+ fwrite($edit_content_file,$panel_content);
+ fclose($edit_content_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
+ }
+}
+
+?>
+
+<style>
+body
+{
+ color: #666666;
+ margin: 10px;
+ padding: 0px;
+ text-align: left;
+ font-family: verdana, helvetica, sans-serif;
+ background-color: #FFFFFF;
+}
+p
+{
+ font-size: 11px;
+}
+a
+{
+ font-weight: bold;
+ text-decoration: none;
+}
+a:link, a:visited
+{
+ color: #666666;
+}
+a:hover
+{
+ color: #336699;
+}
+a:active {
+ color: #336699;
+}
+.input {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 300px;
+ font-family: verdana,helvetica,sans-serif;
+ font-size: 11px
+}
+</style>
+
+<p><b>Add Panel</b></p><p>Enter a unique panel ID, the panel title, and panel contents. Use <a href=http://php.net target=_maj>PHP</a> and <a href=http://www.w3.org/MarkUp/ target=_maj>HTML</a> with care!</p>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<tr><td><p>panel id*</p></td><td><input type=text class=input name=new_id autocomplete=off maxlength=30></td></tr>
+<tr><td><p>title*</p></td><td><input type=text class=input name=new_title autocomplete=off maxlength=90></td></tr>
+<tr><td><p>content*</p></td><td><textarea class=input name=new_content rows=15></textarea></td></tr>
+<tr><td><p></p></td><td><input type=submit class=input value="click here to add a new panel"></td></tr>
+</form>
+<form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+<tr><td><p></p></td><td><input class=input type=submit value="click here to go to the index page"></td></tr>
+</form>
+</table>
+
+<?php
+ if (file_exists("data/panels")) {
+ if ($dh_panel = opendir("data/panels")) {
+ while (($entry_panel = readdir($dh_panel)) !== false) {
+
+ if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
+ $show_panel[] = $entry_panel;
+ }
+ }
+ closedir($dh_panel);
+ }
+
+ sort($show_panel);
+ reset($show_panel);
+ $count_panel = count($show_panel);
+
+ if ($count_panel > 0) {
+
+ echo "<p><br><b>Panel Management</b></p><p>Hiding a panel will make it invisible to visitors. Deleting a panel will remove all its contents.</p>";
+
+ echo "<table border=0 cellspacing=1 cellpadding=2>";
+
+ foreach ($show_panel as $panel) {
+ echo '<form enctype="multipart/form-data" action="';
+ echo $_SERVER['PHP_SELF'];
+ echo '" method="post">';
+ echo "<tr><td><p><b>";
+ echo strtolower(str_replace("_", " ", $panel));
+ echo '</b></p></td><td><p><input type=text class=input name=panel_title value="';
+ readfile("data/panels/$panel/title.txt");
+ echo '" autocomplete=off maxlength=90></p></td></tr><tr><td valign=top><p><input type=checkbox name=panel_hide';
+ if (file_exists("data/panels/$panel/private.txt")) {
+ echo " checked";
+ }
+ echo '> hide<br><input type=checkbox name=panel_del> delete </p></td><td><textarea class=input name=panel_content rows=10>';
+ readfile("data/panels/$panel/panel.php");
+ echo "</textarea></td></tr><tr><td></td><td><input type=hidden name=panel_id value=$panel><input type=hidden name=panel_edit value=on><input type=submit class=input value=submit></p></td>";
+ echo "</tr><tr><td></td><td><p> </p></td></tr></form>";
+ }
+
+ echo "</table>";
+ }
+ }
+?>
diff --git a/passwd.php b/passwd.php
new file mode 100644
index 0000000..0c5b5e1
--- /dev/null
+++ b/passwd.php
@@ -0,0 +1,78 @@
+<style>
+body
+{
+ color: #666666;
+ margin: 10px;
+ padding: 0px;
+ text-align: left;
+ font-family: verdana, helvetica, sans-serif;
+ background-color: #FFFFFF;
+}
+
+p
+{
+ font-size: 11px;
+}
+
+a
+{
+ font-weight: bold;
+ text-decoration: none;
+}
+
+a:link, a:visited
+{
+ color: #666666;
+}
+
+a:hover
+{
+ color: #336699;
+}
+
+a:active {
+ color: #336699;
+}
+.input {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 125px;
+ font-family: verdana,helvetica,sans-serif;
+ font-size: 11px;
+}
+</style>
+
+<?php
+
+if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
+
+ $dir = "data/items/" . $_REQUEST['entry'];
+
+ if (file_exists("$dir")) {
+ ?>
+ <form enctype="multipart/form-data" action="index.php?entry=<?php echo $_REQUEST['entry'];
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == comments)) {
+ echo "&show=comments";
+}
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
+ echo "&show=album";
+}
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
+ echo "&show=filedrop";
+}
+
+?>" method="post">
+ <input autocomplete=off class=input type=password name=passwd>
+ <input class=input type=submit value=submit>
+ </form>
+ <p>Enter the required password above or click <a href=index.php>here</a> to go back to the index page.</p>
+ <?php
+ }
+
+}
+
+?>
diff --git a/rss.php b/rss.php
index 8a20401..f1a1919 100644
--- a/rss.php
+++ b/rss.php
@@ -11,6 +11,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
$author_file = "data/author.txt";
$fp_author = fopen($author_file, "r");
$author = fread($fp_author, filesize($author_file));
@@ -40,6 +41,10 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
continue;
}
+ if (file_exists("data/items/$entry_rss_items/passwd.txt")) {
+ continue;
+ }
+
if ($entry_rss_items != "." && $entry_rss_items != ".." && fnmatch("*", $entry_rss_items) && !file_exists("data/items/$entry_rss_items/private.txt")) {
$show_rss_items[] = $entry_rss_items;
}
@@ -91,6 +96,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "</item>\n";
@@ -148,6 +154,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "<dc:creator>$author</dc:creator>\n";
@@ -194,6 +201,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "<dc:creator>$author</dc:creator>";
diff --git a/settings.php b/settings.php
index 5634d08..cff1edb 100644
--- a/settings.php
+++ b/settings.php
@@ -231,7 +231,7 @@ if (isset($_REQUEST['del_background']) and !empty($_REQUEST['del_background']) a
}
}
-$max_image_size = 2000000;
+$max_image_size = 8000000;
if (isset($_FILES['favicon']) and !empty($_FILES['favicon'])) {
tree d0af4d63334345cb7bab6243fa7d5c69e503fc59
parent 5f2d4fb53d0869511ffdeb6f78e8a97441db2996
author Engels Antonio <engels@majcms.org> 1277314186 +0800
committer Engels Antonio <engels@majcms.org> 1277314186 +0800
maj-0.14-20060618.zip
diff --git a/add.php b/add.php
index f73af01..b12a810 100644
--- a/add.php
+++ b/add.php
@@ -80,8 +80,8 @@ $entry_min = date("i", time() + $offset);
$entry_sec = date("s", time() + $offset);
$image_path = "images/";
-$max_image_size = 2000000;
-$max_file_size = 2000000;
+$max_image_size = 8000000;
+$max_file_size = 8000000;
?>
@@ -254,6 +254,7 @@ $max_file_size = 2000000;
<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
<input autocomplete=off type=file name=file_input> Select optional file.</p>
+<p><input autocomplete=off type=password name=passwd> Enter optional password.</p>
<?php
if (file_exists("data/categories")) {
if ($dh_cat = opendir("data/categories")) {
@@ -284,7 +285,7 @@ $max_file_size = 2000000;
}
}
?>
-<p><input type=checkbox name=sticky>Put entry title in Links box.<br>
+<p><input type=checkbox name=sticky>Put entry title in Quick Links box.<br>
<input type=checkbox name=display>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
<input type=checkbox name=private>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
@@ -547,6 +548,21 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
}
}
+if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
+ if (($_REQUEST['passwd'] == "password") or empty($_REQUEST['passwd'])) {
+ unlink("data/items/$entry/passwd.txt");
+ }
+ else {
+ $fp_passwd_txt = fopen("data/items/$entry/passwd.txt","w");
+ $passwd_crypt = sha1($_REQUEST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ chmod("data/items/$entry/passwd.txt", 0666);
+ }
+}
+
$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
$ping_urls_file = "data/ping.txt";
diff --git a/edit.php b/edit.php
index a1ec400..3f919d9 100644
--- a/edit.php
+++ b/edit.php
@@ -48,8 +48,8 @@ $img_file = 'data/items/' . $_REQUEST['entry'] . '/image.txt';
$revisions_file = 'data/items/' . $_REQUEST['entry'] . '/revisions.txt';
$image_path = "images/";
-$max_image_size = 2000000;
-$max_file_size = 2000000;
+$max_image_size = 8000000;
+$max_file_size = 8000000;
if (file_exists("data/items/{$_REQUEST['entry']}/category.txt")) {
$category_check = 'data/categories/' . file_get_contents("data/items/{$_REQUEST['entry']}/category.txt");
@@ -289,6 +289,23 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
<input autocomplete=off type=file name=entry_image_input> Upload optional entry image.</p>
<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
<input autocomplete=off type=file name=file_input> Upload optional file.</p>
+<p><input autocomplete=off type=password name=passwd <?php
+
+if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "value=password";
+}
+?>
+
+> <?php
+
+if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "Enter new password or clear field to disable password protection.";
+}
+else {
+ echo "Enter optional password.";
+}
+?></p>
+
<?php
if (file_exists("data/categories")) {
if ($dh_cat = opendir("data/categories")) {
@@ -327,7 +344,7 @@ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username
}
}
?>
-<p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Links box.<br>
+<p><input type=checkbox name=sticky <?php $sticky_sem = 'data/sticky/' . $_REQUEST['entry']; if (file_exists($sticky_sem)) { echo checked; } ?>>Put entry title in Quick Links box.<br>
<input type=checkbox name=display <?php $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt"; if (file_exists($display_sem)) { echo checked; } ?>>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
<input type=checkbox name=private <?php $private_sem = "data/items/{$_REQUEST['entry']}/private.txt"; if (file_exists($private_sem)) { echo checked; } ?>>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
<input type=hidden name=entry value="<?php echo $_REQUEST['entry']; ?>">
@@ -653,6 +670,22 @@ if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
}
}
+$passwd_file = "data/items/{$_REQUEST['entry']}/passwd.txt";
+if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd']) and ($_REQUEST['passwd'] != "password")) {
+ $fp_passwd_txt = fopen("$passwd_file","w");
+ $passwd_crypt = sha1($_REQUEST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ chmod("$passwd_file", 0666);
+}
+if (!isset($_REQUEST['passwd']) or empty($_REQUEST['passwd'])) {
+ if (file_exists($passwd_file)) {
+ unlink($passwd_file);
+ }
+}
+
$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
$ping_urls_file = "data/ping.txt";
diff --git a/images/widget.protected.png b/images/widget.protected.png
new file mode 100644
index 0000000..cd709dd
Binary files /dev/null and b/images/widget.protected.png differ
diff --git a/index.php b/index.php
index 9153337..af428da 100644
--- a/index.php
+++ b/index.php
@@ -791,6 +791,7 @@ include("data/profile.php");
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
echo '<a href=add.php>Add Entry</a><br>';
echo '<a href=settings.php>Settings</a><br>';
+ echo '<a href=panels.php>Panels</a><br>';
echo '<a href=cat.php>Categories</a><br>';
echo '<a href=colors.php>Colors</a><br>';
echo '<a href=login.php>Logout</a>';
@@ -832,7 +833,7 @@ if (file_exists("data/sticky")) {
$count_sticky_list = count($show_sticky_list);
if ($count_sticky_list > 0) {
- echo '<div id=panel_title>Links</div>';
+ echo '<div id=panel_title>Quick Links</div>';
echo '<div id=panel_body>';
foreach ($show_sticky_list as $sticky_list_entry) {
echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=';
@@ -847,6 +848,39 @@ if (file_exists("data/sticky")) {
?>
<p></p>
+
+<?php
+if (file_exists("data/panels")) {
+ if ($dh_panel_list = opendir("data/panels")) {
+ while (($entry_panel_list = readdir($dh_panel_list)) !== false) {
+
+ if (file_exists("data/panels/$entry_panel_list/private.txt") and !isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] != $login_username)) {
+ continue;
+ }
+
+ if ($entry_panel_list != "." && $entry_panel_list != ".." && fnmatch("*", $entry_panel_list)) {
+ $show_panel_list[] = $entry_panel_list;
+ }
+ }
+ closedir($dh_panel_list);
+ }
+
+ sort($show_panel_list);
+ reset($show_panel_list);
+ $count_panel_list = count($show_panel_list);
+
+ if ($count_panel_list > 0) {
+ foreach ($show_panel_list as $panel_list_entry) {
+ echo '<div id=panel_title>';
+ readfile("data/panels/$panel_list_entry/title.txt");
+ echo '</div><div id=panel_body>';
+ include("data/panels/$panel_list_entry/panel.php");
+ echo '</div><p></p>';
+ }
+ }
+}
+?>
+
</td><td width=15></td><td valign=top width=525>
<?php
@@ -941,6 +975,10 @@ foreach ($disp as $d) {
echo '<a href=edit.php?entry=';
echo $d;
echo '><img src=images/widget.edit.png border=0 width=11 height=11 align=right alt="edit entry"></a>';
+ if (file_exists("$dir/$d/passwd.txt")) {
+ echo '<img src=images/widget.protected.png border=0 width=11 height=11 align=right alt="protected entry">';
+ }
+
if (file_exists("$dir/$d/private.txt")) {
echo '<img src=images/widget.private.png border=0 width=11 height=11 align=right alt="private entry">';
}
@@ -993,7 +1031,22 @@ foreach ($disp as $d) {
}
}
echo '</font><font style="font-size: 5px;"><br><br></font>';
- readfile("$dir/$d/body.txt");
+
+ if (file_exists("$dir/$d/passwd.txt")) {
+ $passwd = file_get_contents("$dir/$d/passwd.txt");
+ }
+ if (isset($_REQUEST['passwd']) and !empty($_REQUEST['passwd'])) {
+ $crypt_passwd = sha1($_REQUEST['passwd']);
+ $crypt_passwd = md5($crypt_passwd);
+ $crypt_passwd = crypt($crypt_passwd, $crypt_passwd);
+ }
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d>here</a> to enter it.";
+ }
+ else {
+ readfile("$dir/$d/body.txt");
+ }
+
echo '</div><div id=panel_footer>';
echo '<table border=0 cellspacing=0 cellpadding=0 width=513><tr><td align=right>';
echo '<font style="font-size: 10px; color: ';
@@ -1185,87 +1238,118 @@ else {
}
echo '</div><div id=panel_body>';
- /* thumbnail auto-clean-up (20060409) - This should delete thumbnails of non-existent album images. */
-
- if ($dh_album = opendir("images/$d/thumbnails")) {
- while (($thumbnail_album = readdir($dh_album)) !== false) {
- if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*", $thumbnail_album)) {
- $current_thumbnail = "images/$d/thumbnails/$thumbnail_album";
- $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
- $parent_image = "images/$d/album/$parent_image";
-
- if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
- unlink($current_thumbnail);
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=album>here</a> to enter it.";
+ }
+ else {
+
+ /* thumbnail auto-clean-up (20060409) - This should delete thumbnails of non-existent album images. */
+
+ if (file_exists("images/$d/thumbnails")) {
+ if ($dh_album = opendir("images/$d/thumbnails")) {
+ while (($thumbnail_album = readdir($dh_album)) !== false) {
+ if ($thumbnail_album != "." && $thumbnail_album != ".." && fnmatch("*", $thumbnail_album)) {
+ $current_thumbnail = "images/$d/thumbnails/$thumbnail_album";
+ $parent_image = str_replace("-thumbnail.jpg","",$thumbnail_album);
+ $parent_image = "images/$d/album/$parent_image";
+ if (file_exists($current_thumbnail) and !file_exists($parent_image)) {
+ unlink($current_thumbnail);
+ }
+ }
}
}
}
- }
-
- if ($dh_album = opendir("images/$d/album")) {
- while (($entry_album = readdir($dh_album)) !== false) {
- if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
-
- $current_image = "images/$d/album/$entry_album";
- $current_image_size = getimagesize($current_image);
- $current_width = $current_image_size[0];
- $current_height = $current_image_size[1];
- $max_width = 98;
- $max_height = 73;
-
- if (($current_width > $max_width) || ($current_height > $max_height)) {
- if ($current_height > $current_width) {
- $sizefactor = (double) ($max_height / $current_height);
- }
- else {
- $sizefactor = (double) ($max_width / $current_width) ;
+
+ /* auto-sort entries (20060409) - MAJ previously relied on readdir() alone, causing entries to be displayed in the order in which they are stored by the filesystem. */
+
+ if (file_exists("images/$d/album")) {
+ if ($dh_album = opendir("images/$d/album")) {
+ while (($entry_album = readdir($dh_album)) !== false) {
+ if ($entry_album != "." && $entry_album != ".." && fnmatch("*", $entry_album)) {
+ $sort_album[] = $entry_album;
}
}
-
- $new_width = (int) ($current_width * $sizefactor);
- $new_height = (int) ($current_height * $sizefactor);
-
- /* auto-thumbnails (20060213) - In maj-0.14-20060131, album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
-
- if (!file_exists("images/$d/thumbnails/{$entry_album}-thumbnail.jpg")) {
-
- $work_thumb = imagecreatetruecolor($new_width,$new_height);
- $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
- switch($get_mimetype) {
- case "image/jpg":
- case "image/jpeg":
- $work_image = imagecreatefromjpeg($current_image);
- break;
- case "image/gif":
- $work_image = imagecreatefromgif($current_image);
- break;
- case "image/png":
- $work_image = imagecreatefrompng($current_image);
- break;
+ closedir($dh_album);
+ }
+
+ sort($sort_album);
+ reset($sort_album);
+ $count_album_entry = count($sort_album);
+
+ if ($count_album_entry < 1) {
+ rmdirr("images/$d/album");
+ rmdirr("images/$d/thumbnails");
+ }
+ else {
+ foreach($sort_album as $album_entry) {
+ $current_image = "images/$d/album/$album_entry";
+ $current_image_size = getimagesize($current_image);
+ $current_width = $current_image_size[0];
+ $current_height = $current_image_size[1];
+ $max_width = 98;
+ $max_height = 73;
+
+ if (($current_width > $max_width) || ($current_height > $max_height)) {
+ if ($current_height > $current_width) {
+ $sizefactor = (double) ($max_height / $current_height);
+ }
+ else {
+ $sizefactor = (double) ($max_width / $current_width) ;
+ }
}
-
- imagecopyresampled($work_thumb, $work_image ,0, 0, 0, 0, $new_width, $new_height, $current_width, $current_height);
-
- if (!file_exists("images/$d/thumbnails")) {
- mkdir("images/$d/thumbnails", 0777);
- chmod("images/$d/thumbnails", 0777);
+
+ $new_width = (int) ($current_width * $sizefactor);
+ $new_height = (int) ($current_height * $sizefactor);
+
+ /* auto-thumbnails (20060213) - In maj-0.14-20060131, album thumbnails were simply the original images displayed with smaller "width=" and "height=" values. Album index loading was painfully slow since the browser had to download the original images from the server. This should speed things up. We placed the "function" here instead of edit.php or add.php to make auto-thumbnail generation available for maj-0.14-20060131 users who may already have existing albums. */
+
+ if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
+
+ $work_thumb = imagecreatetruecolor($new_width,$new_height);
+ $get_mimetype = image_type_to_mime_type(exif_imagetype($current_image));
+ switch($get_mimetype) {
+ case "image/jpg":
+ case "image/jpeg":
+ $work_image = imagecreatefromjpeg($current_image);
+ break;
+ case "image/gif":
+ $work_image = imagecreatefromgif($current_image);
+ break;
+ case "image/png":
+ $work_image = imagecreatefrompng($current_image);
+ break;
+ }
+
+ imagecopyresampled($work_thumb, $work_image ,0, 0, 0, 0, $new_width, $new_height, $current_width, $current_height);
+
+ if (!file_exists("images/$d/thumbnails")) {
+ mkdir("images/$d/thumbnails", 0777);
+ chmod("images/$d/thumbnails", 0777);
+ }
+
+ imagejpeg($work_thumb, "images/$d/thumbnails/{$album_entry}-thumbnail.jpg", 80);
+
}
+ echo "<a href=images/$d/album/$album_entry>";
- imagejpeg($work_thumb, "images/$d/thumbnails/{$entry_album}-thumbnail.jpg", 80);
+ /* auto-thumbnails (20060519) - Just in case php-gd does not exist, do it the old way. */
-}
+ if (!file_exists("images/$d/thumbnails/{$album_entry}-thumbnail.jpg")) {
+ echo "<img src=images/$d/album/$album_entry width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
+ else {
+ echo "<img src=images/$d/thumbnails/{$album_entry}-thumbnail.jpg width=$new_width height=$new_height border=0 hspace=2 vspace=2";
+ }
- echo "<a href=images/$d/album/$entry_album>";
- echo "<img src=images/$d/thumbnails/{$entry_album}-thumbnail.jpg width=$new_width height=$new_height border=0 hspace=2 vspace=2";
- if (file_exists("data/items/$d/album/captions/{$entry_album}.txt")) {
- echo ' alt="';
- readfile("data/items/$d/album/captions/{$entry_album}.txt");
- echo '"';
+ if (file_exists("data/items/$d/album/captions/{$album_entry}.txt")) {
+ echo ' alt="';
+ readfile("data/items/$d/album/captions/{$album_entry}.txt");
+ echo '"';
+ }
+ echo "></a>";
}
- echo "></a>";
-
}
}
- closedir($dh_album);
}
echo '</div></td></tr></table></p>';
@@ -1281,134 +1365,150 @@ else {
}
echo '</div><div id=panel_body>';
- if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
- while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
- if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
- echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
- echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
- echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
- echo '<td><p><b>';
- echo $entry_filedrop;
- echo'</b><br>';
- $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
- $size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
- echo $size_string;
- $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
- if (file_exists($filedrop_count_file)) {
- $fp_filedrop_count = fopen($filedrop_count_file, "r");
- $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
- fclose($fp_filedrop_count);
- echo '<br>';
- echo $filedrop_count;
- if ($filedrop_count == 1) {
- echo ' download';
- }
- if ($filedrop_count > 1) {
- echo ' downloads';
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=filedrop>here</a> to enter it.";
+ }
+ else {
+
+ if ($dh_filedrop = opendir("data/items/$d/filedrop/files")) {
+ while (($entry_filedrop = readdir($dh_filedrop)) !== false) {
+ if ($entry_filedrop != "." && $entry_filedrop != ".." && fnmatch("*", $entry_filedrop)) {
+ echo '<table border=0 cellspacing=0 cellpadding=4><tr><td>';
+ echo '<a href=' . $_SERVER['PHP_SELF'] . '?entry=' . $d . '&download=' . $entry_filedrop. '>';
+ echo '<img src=images/filedrop.png width=36 height=36 border=0 alt="download file"></a></td>';
+ echo '<td><p><b>';
+ echo $entry_filedrop;
+ echo'</b><br>';
+ $size = filesize("data/items/$d/filedrop/files/$entry_filedrop");
+ $size_string = ($size > 512)?( ($size/1024 > 512) ?sprintf("%.02f MB",($size/1024)/1024) :sprintf("%.02f KB",$size/1024)) :sprintf("%d B",$size);
+ echo $size_string;
+ $filedrop_count_file = "data/items/$d/filedrop/count/$entry_filedrop" . '.txt';
+ if (file_exists($filedrop_count_file)) {
+ $fp_filedrop_count = fopen($filedrop_count_file, "r");
+ $filedrop_count = fread($fp_filedrop_count, filesize($filedrop_count_file));
+ fclose($fp_filedrop_count);
+ echo '<br>';
+ echo $filedrop_count;
+ if ($filedrop_count == 1) {
+ echo ' download';
+ }
+ if ($filedrop_count > 1) {
+ echo ' downloads';
+ }
}
+ echo '</p></td></tr></table>';
}
- echo '</p></td></tr></table>';
}
+ closedir($dh_filedrop);
}
- closedir($dh_filedrop);
}
echo '</div></td></tr></table></p>';
-
}
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['show']) and !empty($_REQUEST['show']) and ($_REQUEST['show'] == comments) and !file_exists("data/nocomment.txt")) {
- echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
- if ($dh_comments = opendir("$dir/$d/comments/live")) {
- while (($entry_comments = readdir($dh_comments)) !== false) {
- if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) { $show_comments[] = $entry_comments;
- }
- }
- closedir($dh_comments);
- }
-
- asort($show_comments);
- reset($show_comments);
- foreach ($show_comments as $comment) {
- echo '<div id=panel_title>';
-
- if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
- echo '<a rel=nofollow target=_blank href=';
- readfile("$dir/$d/comments/live/$comment/url.txt");
- echo '>';
- }
-
- readfile("$dir/$d/comments/live/$comment/firstname.txt");
- echo ' ';
- readfile("$dir/$d/comments/live/$comment/lastname.txt");
-
- if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
- echo '</a>';
- }
-
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- echo ' <';
- readfile("$dir/$d/comments/live/$comment/email.txt");
- echo '>';
- }
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- echo '<a href=del.php?entry=' . $d . '&comment=' . $comment . '&type=live><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
- echo '<a href=edit.php?entry=' . $d . '&comment=' . $comment . '><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ }
+ else {
+ echo '<p><table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
+ if ($dh_comments = opendir("$dir/$d/comments/live")) {
+ while (($entry_comments = readdir($dh_comments)) !== false) {
+ if ($entry_comments != "." && $entry_comments != ".." && fnmatch("*", $entry_comments)) { $show_comments[] = $entry_comments;
+ }
+ }
+ closedir($dh_comments);
}
- echo '</div>';
- echo '<div id=panel_body>';
- echo '<font style="font-size: 10px; color: #999999;">';
- readfile("$dir/$d/comments/live/$comment/timestamp.txt");
- if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
- if (file_exists("$dir/$d/comments/live/$comment/revisions.txt")) {
- echo ' (Revision ';
- readfile("$dir/$d/comments/live/$comment/revisions.txt");
- echo ')';
+
+ asort($show_comments);
+ reset($show_comments);
+ foreach ($show_comments as $comment) {
+ echo '<div id=panel_title>';
+
+ if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+ echo '<a rel=nofollow target=_blank href=';
+ readfile("$dir/$d/comments/live/$comment/url.txt");
+ echo '>';
+ }
+
+ readfile("$dir/$d/comments/live/$comment/firstname.txt");
+ echo ' ';
+ readfile("$dir/$d/comments/live/$comment/lastname.txt");
+
+ if (file_exists("$dir/$d/comments/live/$comment/url.txt")) {
+ echo '</a>';
+ }
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ echo ' <';
+ readfile("$dir/$d/comments/live/$comment/email.txt");
+ echo '>';
}
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ echo '<a href=del.php?entry=' . $d . '&comment=' . $comment . '&type=live><img src=images/widget.del.png width=10 height=10 border=0 align=right alt="delete comment"></a>';
+ echo '<a href=edit.php?entry=' . $d . '&comment=' . $comment . '><img src=images/widget.edit.png width=11 height=11 border=0 align=right alt="edit comment"></a>';
+ }
+ echo '</div>';
+ echo '<div id=panel_body>';
+ echo '<font style="font-size: 10px; color: #999999;">';
+ readfile("$dir/$d/comments/live/$comment/timestamp.txt");
+ if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
+ if (file_exists("$dir/$d/comments/live/$comment/revisions.txt")) {
+ echo ' (Revision ';
+ readfile("$dir/$d/comments/live/$comment/revisions.txt");
+ echo ')';
+ }
+ }
+ echo '</font><font style="font-size: 5px;"><br><br></font>';
+ readfile("$dir/$d/comments/live/$comment/comment.txt");
+ echo '</div><p></p>';
}
- echo '</font><font style="font-size: 5px;"><br><br></font>';
- readfile("$dir/$d/comments/live/$comment/comment.txt");
- echo '</div><p></p>';
+ unset($show_comments);
+ echo '</td></tr></table></p>';
}
- unset($show_comments);
- echo '</td></tr></table></p>';
if (!file_exists("data/nocomment.txt")) {
echo '<table border=0 cellspacing=0 cellpadding=0 width=525><tr><td>';
echo '<p></p><p><font style="font-size: 12px;"><b>Add Comment</b></font></p>';
- $capcha_rand = str_rand(7);
-
- echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
-
- ?>
-
- <table border=0 cellspacing=2 cellpadding=0 width=500>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?entry=<?php echo $d; ?>&show=comments" method="post">
- <input type=hidden name=capcha_get value="<?php echo $capcha_rand; ?>">
- <tr><td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td><td rowspan=7 valign=top width=75 align=right>
-<table border=0 cellspacing=1 cellpadding=2>
-<tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
-<tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
-<tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
-<tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
-<tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
-<tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
-<tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
-<tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
-<tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
-<tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
-</td></tr>
-</table>
- <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
- <tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
- <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
- <tr><td ><p>Comment*</p></td><td ><textarea class=input name=new_comment rows=10></textarea></td></tr>
- <tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=capcha_put maxlength=7></td></tr>
- <tr><td><p></p></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
- </form>
- </table>
+ if (file_exists("$dir/$d/passwd.txt") and (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) and (!isset($_REQUEST['passwd']) or ($crypt_passwd != $passwd))) {
+ echo "This entry is password protected. If you know the magic word, click <a href=passwd.php?entry=$d&show=comments>here</a> to enter it.";
+ }
+ else {
+
+ $capcha_rand = str_rand(7);
+
+ echo '<p>Fill out the form below and enter <b>' . $capcha_rand . '</b> in the anti-spam field to add your comment. Note that it will not be posted immediately, but will be e-mailed to me first.<br><br>';
+
+ ?>
+
+ <table border=0 cellspacing=2 cellpadding=0 width=500>
+ <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>?entry=<?php echo $d; ?>&show=comments" method="post">
+ <input type=hidden name=capcha_get value="<?php echo $capcha_rand; ?>">
+ <tr><td width=75><p>First Name*</p></td><td width=300><input class=input type=text autocomplete=off name=firstname maxlength=30></td><td rowspan=7 valign=top width=75 align=right>
+ <table border=0 cellspacing=1 cellpadding=2>
+ <tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
+ <tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
+ <tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
+ <tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
+ <tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
+ <tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
+ <tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
+ <tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
+ <tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
+ <tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
+ </td></tr>
+ </table>
+ <tr><td><p>Last Name*</p></td><td><input class=input type=text autocomplete=off name=lastname maxlength=30></td></tr>
+ <tr><td><p>E-mail*</p></td><td colspan=2><input class=input type=text autocomplete=off name=email maxlength=60></td></tr>
+ <tr><td><p>Website</p></td><td colspan=2><input class=input type=text autocomplete=off name=url maxlength=300></td></tr>
+ <tr><td ><p>Comment*</p></td><td ><textarea class=input name=new_comment rows=10></textarea></td></tr>
+ <tr><td><p>Anti-Spam*</p></td><td><input class=input type=text autocomplete=off name=capcha_put maxlength=7></td></tr>
+ <tr><td><p></p></td><td><input class=input type=submit value="click here to submit your comment"></td></tr>
+ </form>
+ </table>
+ <?php } ?>
</td></tr></table></p>
<?php
diff --git a/panels.php b/panels.php
new file mode 100644
index 0000000..941a2c7
--- /dev/null
+++ b/panels.php
@@ -0,0 +1,203 @@
+<?php
+
+session_start();
+header("Cache-control: private");
+
+$login_username = file_get_contents("data/username.txt");
+
+if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+ exit();
+}
+
+function rmdirr($recurse_dirname)
+{
+
+ if (!file_exists($recurse_dirname)) {
+ return false;
+ }
+
+ if (is_file($recurse_dirname)) {
+ return unlink($recurse_dirname);
+ }
+
+ $recurse_dir = dir($recurse_dirname);
+ while (false !== $recurse_entry = $recurse_dir->read()) {
+
+ if ($recurse_entry == '.' || $recurse_entry == '..') {
+ continue;
+ }
+
+ rmdirr("$recurse_dirname/$recurse_entry");
+ }
+
+ $recurse_dir->close();
+ return rmdir($recurse_dirname);
+}
+
+if (isset($_REQUEST['new_id']) and !empty($_REQUEST['new_id']) and isset($_REQUEST['new_title']) and !empty($_REQUEST['new_title']) and isset($_REQUEST['new_content']) and !empty($_REQUEST['new_content']) and !file_exists("data/panels/{$_REQUEST['new_id']}")) {
+
+ if (!file_exists("data/panels")) {
+ mkdir("data/panels", 0777);
+ }
+
+ $new_id = trim(strip_tags(strtolower(str_replace(" ", "_", $_REQUEST['new_id']))));
+
+ if (!file_exists("data/panels/$new_id")) {
+ mkdir("data/panels/$new_id", 0777);
+ }
+
+ $new_title = ucfirst(strip_tags(trim($_REQUEST['new_title'])));
+ $open_title_file = fopen("data/panels/$new_id/title.txt","w");
+ fwrite($open_title_file,$new_title);
+ fclose($open_title_file);
+ chmod("data/panels/$new_id/title.txt", 0666);
+
+ $panel_content = ucfirst(trim($_REQUEST['new_content']));
+
+ $new_content_file = fopen("data/panels/$new_id/panel.php","w");
+ fwrite($new_content_file,$panel_content);
+ fclose($new_content_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
+}
+
+if (isset($_REQUEST['panel_del']) and !empty($_REQUEST['panel_del']) and ($_REQUEST['panel_del'] == "on")) {
+ rmdirr("data/panels/{$_REQUEST['panel_id']}");
+}
+
+if ((!isset($_REQUEST['panel_hide']) or !empty($_REQUEST['panel_hide'])) and ($_REQUEST['panel_edit'] == "on")) {
+ if (file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
+ unlink("data/panels/{$_REQUEST['panel_id']}/private.txt");
+ }
+}
+
+if (isset($_REQUEST['panel_hide']) and !empty($_REQUEST['panel_hide']) and ($_REQUEST['panel_hide'] == "on")) {
+ if (!file_exists("data/panels/{$_REQUEST['panel_id']}/private.txt")) {
+ touch("data/panels/{$_REQUEST['panel_id']}/private.txt");
+ chmod("data/panels/{$_REQUEST['panel_id']}/private.txt", 0666);
+ }
+}
+
+if (isset($_REQUEST['panel_title']) and !empty($_REQUEST['panel_title'])) {
+
+ $panel_title = ucfirst(strip_tags(trim($_REQUEST['panel_title'])));
+
+ if ($panel_title != file_get_contents("data/panels/{$_REQUEST['panel_id']}/title.txt")) {
+ $edit_title_file = fopen("data/panels/{$_REQUEST['panel_id']}/title.txt","w");
+ fwrite($edit_title_file,$panel_title);
+ fclose($edit_title_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/title.txt", 0666);
+ }
+}
+
+if (isset($_REQUEST['panel_content']) and !empty($_REQUEST['panel_content'])) {
+
+ $panel_content = ucfirst(trim($_REQUEST['panel_content']));
+
+ if ($panel_content != file_get_contents("data/panels/{$_REQUEST['panel_id']}/panel.php")) {
+ $edit_content_file = fopen("data/panels/{$_REQUEST['panel_id']}/panel.php","w");
+ fwrite($edit_content_file,$panel_content);
+ fclose($edit_content_file);
+ chmod("data/panels/{$_REQUEST['panel_id']}/panel.php", 0666);
+ }
+}
+
+?>
+
+<style>
+body
+{
+ color: #666666;
+ margin: 10px;
+ padding: 0px;
+ text-align: left;
+ font-family: verdana, helvetica, sans-serif;
+ background-color: #FFFFFF;
+}
+p
+{
+ font-size: 11px;
+}
+a
+{
+ font-weight: bold;
+ text-decoration: none;
+}
+a:link, a:visited
+{
+ color: #666666;
+}
+a:hover
+{
+ color: #336699;
+}
+a:active {
+ color: #336699;
+}
+.input {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 300px;
+ font-family: verdana,helvetica,sans-serif;
+ font-size: 11px
+}
+</style>
+
+<p><b>Add Panel</b></p><p>Enter a unique panel ID, the panel title, and panel contents. Use <a href=http://php.net target=_maj>PHP</a> and <a href=http://www.w3.org/MarkUp/ target=_maj>HTML</a> with care!</p>
+
+<table border=0 cellspacing=1 cellpadding=2>
+<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
+<tr><td><p>panel id*</p></td><td><input type=text class=input name=new_id autocomplete=off maxlength=30></td></tr>
+<tr><td><p>title*</p></td><td><input type=text class=input name=new_title autocomplete=off maxlength=90></td></tr>
+<tr><td><p>content*</p></td><td><textarea class=input name=new_content rows=15></textarea></td></tr>
+<tr><td><p></p></td><td><input type=submit class=input value="click here to add a new panel"></td></tr>
+</form>
+<form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
+<tr><td><p></p></td><td><input class=input type=submit value="click here to go to the index page"></td></tr>
+</form>
+</table>
+
+<?php
+ if (file_exists("data/panels")) {
+ if ($dh_panel = opendir("data/panels")) {
+ while (($entry_panel = readdir($dh_panel)) !== false) {
+
+ if ($entry_panel != "." && $entry_panel != ".." && fnmatch("*", $entry_panel)) {
+ $show_panel[] = $entry_panel;
+ }
+ }
+ closedir($dh_panel);
+ }
+
+ sort($show_panel);
+ reset($show_panel);
+ $count_panel = count($show_panel);
+
+ if ($count_panel > 0) {
+
+ echo "<p><br><b>Panel Management</b></p><p>Hiding a panel will make it invisible to visitors. Deleting a panel will remove all its contents.</p>";
+
+ echo "<table border=0 cellspacing=1 cellpadding=2>";
+
+ foreach ($show_panel as $panel) {
+ echo '<form enctype="multipart/form-data" action="';
+ echo $_SERVER['PHP_SELF'];
+ echo '" method="post">';
+ echo "<tr><td><p><b>";
+ echo strtolower(str_replace("_", " ", $panel));
+ echo '</b></p></td><td><p><input type=text class=input name=panel_title value="';
+ readfile("data/panels/$panel/title.txt");
+ echo '" autocomplete=off maxlength=90></p></td></tr><tr><td valign=top><p><input type=checkbox name=panel_hide';
+ if (file_exists("data/panels/$panel/private.txt")) {
+ echo " checked";
+ }
+ echo '> hide<br><input type=checkbox name=panel_del> delete </p></td><td><textarea class=input name=panel_content rows=10>';
+ readfile("data/panels/$panel/panel.php");
+ echo "</textarea></td></tr><tr><td></td><td><input type=hidden name=panel_id value=$panel><input type=hidden name=panel_edit value=on><input type=submit class=input value=submit></p></td>";
+ echo "</tr><tr><td></td><td><p> </p></td></tr></form>";
+ }
+
+ echo "</table>";
+ }
+ }
+?>
diff --git a/passwd.php b/passwd.php
new file mode 100644
index 0000000..0c5b5e1
--- /dev/null
+++ b/passwd.php
@@ -0,0 +1,78 @@
+<style>
+body
+{
+ color: #666666;
+ margin: 10px;
+ padding: 0px;
+ text-align: left;
+ font-family: verdana, helvetica, sans-serif;
+ background-color: #FFFFFF;
+}
+
+p
+{
+ font-size: 11px;
+}
+
+a
+{
+ font-weight: bold;
+ text-decoration: none;
+}
+
+a:link, a:visited
+{
+ color: #666666;
+}
+
+a:hover
+{
+ color: #336699;
+}
+
+a:active {
+ color: #336699;
+}
+.input {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 125px;
+ font-family: verdana,helvetica,sans-serif;
+ font-size: 11px;
+}
+</style>
+
+<?php
+
+if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
+
+ $dir = "data/items/" . $_REQUEST['entry'];
+
+ if (file_exists("$dir")) {
+ ?>
+ <form enctype="multipart/form-data" action="index.php?entry=<?php echo $_REQUEST['entry'];
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == comments)) {
+ echo "&show=comments";
+}
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == album)) {
+ echo "&show=album";
+}
+
+if (isset($_REQUEST['show']) and ($_REQUEST['show'] == filedrop)) {
+ echo "&show=filedrop";
+}
+
+?>" method="post">
+ <input autocomplete=off class=input type=password name=passwd>
+ <input class=input type=submit value=submit>
+ </form>
+ <p>Enter the required password above or click <a href=index.php>here</a> to go back to the index page.</p>
+ <?php
+ }
+
+}
+
+?>
diff --git a/rss.php b/rss.php
index 8a20401..f1a1919 100644
--- a/rss.php
+++ b/rss.php
@@ -11,6 +11,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
$author_file = "data/author.txt";
$fp_author = fopen($author_file, "r");
$author = fread($fp_author, filesize($author_file));
@@ -40,6 +41,10 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
continue;
}
+ if (file_exists("data/items/$entry_rss_items/passwd.txt")) {
+ continue;
+ }
+
if ($entry_rss_items != "." && $entry_rss_items != ".." && fnmatch("*", $entry_rss_items) && !file_exists("data/items/$entry_rss_items/private.txt")) {
$show_rss_items[] = $entry_rss_items;
}
@@ -91,6 +96,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "</item>\n";
@@ -148,6 +154,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "<dc:creator>$author</dc:creator>\n";
@@ -194,6 +201,7 @@ if (isset($_REQUEST['ver']) and !empty($_REQUEST['ver'])) {
fclose($fp_description);
$description = strip_tags($description);
$description = htmlentities($description, ENT_NOQUOTES);
+ $description = str_replace("&","&",$description);
echo $description;
echo "</description>\n";
echo "<dc:creator>$author</dc:creator>";
diff --git a/settings.php b/settings.php
index 5634d08..cff1edb 100644
--- a/settings.php
+++ b/settings.php
@@ -231,7 +231,7 @@ if (isset($_REQUEST['del_background']) and !empty($_REQUEST['del_background']) a
}
}
-$max_image_size = 2000000;
+$max_image_size = 8000000;
if (isset($_FILES['favicon']) and !empty($_FILES['favicon'])) {