This blob has been accessed 279 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- error_reporting(E_ERROR);
- if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
- header("Location: login.php");
- }
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
- }
- return $data;
- }
- else {
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
- }
- $login_username = file_get_contents("data/username.txt");
- if (isset($_POST['title_input']) and isset($_POST['body_input'])) {
- header("Location: edit.php?entry={$_REQUEST['entry']}");
- }
- if (!isset($_REQUEST['entry'])) {
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}")) {
- }
- if (!isset($_SESSION['logged_in'])) {
- }
- $do = 0;
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/wiki.txt") and (file_exists("data/items/{$_REQUEST['entry']}/edit.txt") or (file_get_contents("data/items/{$_REQUEST['entry']}/author.txt") == $_SESSION['logged_in']))) {
- $do = 1;
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/lock.txt")) {
- $do = 0;
- }
- if ($_SESSION['logged_in'] == $login_username) {
- $do = 1;
- }
- if ($do == 0) {
- }
- 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);
- }
- function entry2date($f_entry) {
- $f_entry_year = substr($f_entry,0,4);
- $f_entry_month = substr($f_entry,4,2);
- $f_entry_day = substr($f_entry,6,2);
- $f_entry_hour = substr($f_entry,8,2);
- $f_entry_min = substr($f_entry,10,2);
- $f_entry_sec = substr($f_entry,12,2);
- echo date("l, M j, Y, g:i A",mktime($f_entry_hour,$f_entry_min,$f_entry_sec,$f_entry_month,$f_entry_day,$f_entry_year));
- }
- $title_file = "data/items/{$_REQUEST['entry']}/title.txt";
- $body_file = "data/items/{$_REQUEST['entry']}/body.txt";
- $date_file = "data/items/{$_REQUEST['entry']}/date.txt";
- $img_file = "data/items/{$_REQUEST['entry']}/image.txt";
- $revisions_file = "data/items/{$_REQUEST['entry']}/revisions.txt";
- function return_bytes($val) {
- $val = trim($val);
- switch($last) {
- case 'k':
- case 'K':
- return (int) $val * 1024;
- break;
- case 'm':
- case 'M':
- return (int) $val * 1048576;
- break;
- default:
- return $val;
- }
- }
- $server_upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
- $server_post_max_size = return_bytes(ini_get('post_max_size'));
- $server_memory_limit = return_bytes(ini_get('memory_limit'));
- $max_file_size = $server_upload_max_filesize;
- if ($server_upload_max_filesize > $server_post_max_size) {
- $max_file_size = $server_post_max_size;
- }
- if ($server_post_max_size > $server_memory_limit) {
- $max_file_size = $server_memory_limit;
- }
- ?>
- <title>Edit</title>
- <style>
- body {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $font_body = file_get_contents("data/fonts/body.txt");
- echo "{$font_body},";
- }
- ?> arial, helvetica, sans-serif;
- background-color: #ffffff;
- }
- p, td {
- 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_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$font_panel_title},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px;
- font-weight: bold
- }
- .input_body {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 525px;
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$font_panel_body},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px
- }
- #panel_title {
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$font_panel_title},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 12px;
- font-weight: bold;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #ffffff;
- margin: 0px;
- border-color: #cccccc;
- border-width: 1px 1px 0px 1px;
- border-style: solid solid none solid;
- }
- #panel_body {
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$font_panel_body},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #ffffff;
- margin: 0px;
- border-color: #cccccc;
- border-width: 1px 1px 1px 1px;
- border-style: solid solid solid solid;
- }
- #panel_footer {
- font-family: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$font_panel_footer},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px;
- color: #666666;
- padding: 5px 5px 5px 5px;
- background-color: #ffffff;
- margin: 0px;
- border-color: #cccccc;
- border-width: 0px 1px 1px 1px;
- border-style: none solid solid solid;
- }
- .input_cat {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 40px;
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$font_panel_body},";
- }
- ?> arial, helvetica, sans-serif;
- font-size: 11px
- }
- <?php if (file_exists("data/css.txt")) { readfile("data/css.txt"); } ?>
- </style>
- <?php
- if (isset($_POST['auth_member']) and !empty($_POST['auth_member']) and isset($_POST['auth_toggle']) and !empty($_POST['auth_toggle'])) {
- if (($_POST['auth_toggle'] == "ack") and file_exists("data/members/active/{$_POST['auth_member']}")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
- mkdir("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
- }
- }
- if (($_POST['auth_toggle'] == "nak") and file_exists("data/members/active/{$_POST['auth_member']}")) {
- if (file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
- rmdirr("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
- }
- }
- }
- if (isset($_POST['category']) and !empty($_POST['category'])) {
- if (($_POST['do'] == "unfile") and file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
- rmdirr("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}");
- if (count(glob("data/items/{$_REQUEST['entry']}/categories/*")) < 1) {
- rmdirr("data/items/{$_REQUEST['entry']}/categories");
- }
- }
- if (($_POST['do'] == "file") and !file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/categories")) {
- mkdir("data/items/{$_REQUEST['entry']}/categories");
- }
- mkdir("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}");
- }
- }
- if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_POST['comment_txt']) and !empty($_POST['comment_txt']) and isset($_REQUEST['type']) and !empty($_REQUEST['type']) and (($_REQUEST['type'] == "live") or ($_REQUEST['type'] == "pending"))) {
- $comment_txt = ucfirst($_POST['comment_txt']);
- $comment_txt = str_replace("\n", '<br />', $comment_txt);
- $comment_txt = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $comment_txt);
- $comment_txt = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $comment_txt);
- $comment_txt = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $comment_txt);
- $comment_txt = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $comment_txt);
- $comment_txt_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/comment.txt";
- $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt";
- $comment_revisions_count = $comment_revisions_count + 1;
- }
- if (isset($_REQUEST['comment']) and !empty($_REQUEST['comment']) and isset($_REQUEST['type']) and !empty($_REQUEST['type']) and (($_REQUEST['type'] == "live") or ($_REQUEST['type'] == "pending"))) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}")) {
- }
- ?>
- <table border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc"><tr><td width="525">
- <div id="panel_title"><?php readfile("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/firstname.txt"); ?> <?php readfile("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/lastname.txt"); ?> <<?php readfile("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/email.txt"); ?>></div>
- <div id="panel_body"><?php readfile("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/comment.txt"); ?></div>
- <?php
- entry2date($_REQUEST['comment']);
- if (file_exists("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt")) {
- echo " (Revision ";
- readfile("data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt");
- echo ")";
- }
- ?>
- </font></div>
- </td></tr></table>
- <table border="0" cellspacing="2" cellpadding="0">
- <form enctype="multipart/form-data" action="edit.php" method="post">
- <tr><td><textarea class="input_body" name="comment_txt" rows="10"><?php
- $comment_txt_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/comment.txt";
- $comment_smiley2emoticon = str_replace('<br />', "\n", $read_comment_txt_file);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $comment_smiley2emoticon);
- $comment_smiley2emoticon = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $comment_smiley2emoticon);
- echo $comment_smiley2emoticon;
- ?></textarea></td></tr>
- <tr><td><input type="hidden" name="entry" value="<?php echo $_REQUEST['entry']; ?>"></td></tr>
- <tr><td><input type="hidden" name="comment" value="<?php echo $_REQUEST['comment']; ?>"></td></tr>
- <tr><td><input type="hidden" name="type" value="<?php echo $_REQUEST['type']; ?>"></td></tr>
- <tr><td><input class="input_body" type="submit" value="click here to update this comment"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="index.php?entry=<?php echo $_REQUEST['entry']; ?>&show=comments" method="post">
- <tr><td><input class="input_body" type="submit" value="click here to view posted entry"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="index.php" method="post">
- <tr><td><input class="input_body" type="submit" value="click here to go to the index page"></td></tr>
- </form>
- </table>
- <?php
- }
- ?>
- <table border="0" cellspacing="0" cellpadding="0"><tr><td>
- <table border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc"><tr><td width="525">
- <div id="panel_body"><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php readfile($body_file); ?></td></tr></table></div>
- if (file_exists("data/items/{$_REQUEST['entry']}/author.txt")) {
- readfile("data/items/{$_REQUEST['entry']}/author.txt");
- echo " - ";
- }
- entry2date($_REQUEST['entry']);
- if (file_exists($revisions_file)) {
- echo ' (Revision ';
- readfile($revisions_file);
- echo " - ";
- echo date("l, M j, Y, g:i A", filemtime("data/items/{$_REQUEST['entry']}/body.txt"));
- echo ')';
- }
- ?>
- </font></div>
- </td></tr></table>
- <form enctype="multipart/form-data" action="edit.php" method="post">
- <?php if (($_SESSION['logged_in'] == $login_username) or (file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt"))) { ?>
- <input type="hidden" name="max_file_size" value="<?php echo $max_file_size; ?>">
- <p><table border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
- <tr><td><input autocomplete="off" type="file" name="album_image_input"> Upload optional album image. Enter optional caption below.</td></tr>
- <tr><td><input autocomplete="off" type="text" name="caption" class="input_body"></td></tr>
- <tr><td><input type="hidden" name="max_file_size" value="<?php echo $max_file_size; ?>"></td></tr>
- <tr><td><input autocomplete="off" type="file" name="entry_image_input"> Upload optional GIF, JPG, or PNG entry image.</td></tr>
- <tr><td><input type="hidden" name="max_file_size" value="<?php echo $max_file_size; ?>"></td></tr>
- <tr><td><input autocomplete="off" type="file" name="file_input"> Upload optional file. Max size supported by server is <?php echo ($max_file_size/(1024*1024)); ?>MB.</td></tr>
- <?php
- }
- if ($_SESSION['logged_in'] == $login_username) {
- ?>
- <tr><td><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.";
- }
- ?></td></tr>
- <tr><td><input autocomplete="off" type="text" name="maxlines" <?php
- if (file_exists("data/items/{$_REQUEST['entry']}/maxlines.txt")) {
- echo "value=\"";
- readfile("data/items/{$_REQUEST['entry']}/maxlines.txt");
- echo "\"";
- }
- ?>
- > <?php
- if (file_exists("data/items/{$_REQUEST['entry']}/maxlines.txt")) {
- echo "Enter new maximum lines for initial display or clear field to disable.";
- }
- else {
- echo "Enter optional maximum lines for initial display.";
- }
- ?></td></tr>
- <tr><td><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.</td></tr>
- <tr><td><input type="checkbox" name="pdf" <?php if (file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) { echo checked; } ?>>Allow PDF generation for this entry.</td></tr>
- <tr><td><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.</td></tr>
- <tr><td><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<?php if (file_exists("data/ml.txt")) { echo " and to the mailing list"; } ?>, even if always display is set.</td></tr>
- <?php if (file_exists("data/bb.txt")) { ?>
- <tr><td><input type="checkbox" name="member" <?php $member_sem = "data/items/{$_REQUEST['entry']}/member.txt"; if (file_exists($member_sem)) { echo checked; } ?>>Only registered members can view this entry.</td></tr>
- <?php } ?>
- <?php
- if (file_exists("data/bb.txt") and file_exists("data/wiki.txt")) { ?>
- <tr><td><input type="checkbox" name="edit" <?php $edit_sem = "data/items/{$_REQUEST['entry']}/edit.txt"; if (file_exists($edit_sem)) { echo checked; } ?>>Registered members can edit this entry.</td></tr>
- <tr><td><input type="checkbox" name="lock" <?php if (file_exists("data/items/{$_REQUEST['entry']}/lock.txt")) { echo checked; } ?>>Only the administrator can edit this entry. </td></tr>
- <?php
- }
- ?>
- <tr><td><input type="checkbox" name="lastmod" <?php $lastmod_sem = "data/items/{$_REQUEST['entry']}/lastmod.txt"; if (file_exists($lastmod_sem)) { echo checked; } ?>>Display last modification date and time.</td></tr>
- <?php } ?>
- </table></p>
- <input type="hidden" name="entry" value="<?php echo $_REQUEST['entry']; ?>">
- <table border="0" cellspacing="0" cellpadding="0"><tr><td>
- <table border="0" cellspacing="2" cellpadding="0">
- <tr><td><input autocomplete="off" class="input_title" type="text" name="title_input" value="<?php readfile($title_file); ?>"></td></tr>
- <tr><td><textarea class="input_body" name="body_input" rows="15">
- <?php
- $body_read_content = str_replace('<br />', "\n", $read_body_file);
- $body_read_content = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $body_read_content);
- $body_read_content = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $body_read_content);
- $body_read_content = str_replace('<!-- html -->', '<html>', $body_read_content);
- $body_read_content = str_replace('<!-- /html -->', '</html>', $body_read_content);
- $body_read_content = str_replace('<span style="background-color: #ffff00;">', '<highlight>', $body_read_content);
- $body_read_content = str_replace('</span>', '</highlight>', $body_read_content);
- echo $body_read_content;
- ?>
- </textarea></td></tr>
- <tr><td><input class="input_body" type="submit" value="click here to update this entry"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="index.php?entry=<?php echo $_REQUEST['entry']; ?>" method="post">
- <tr><td><input class=input_body type=submit value="click here to view posted entry"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="index.php" method="post">
- <tr><td><input class="input_body" type="submit" value="click here to go to the index page"></td></tr>
- </form>
- </table>
- </td><td width="10"></td><td>
- <table border="0" cellspacing="1" cellpadding="2">
- <tr><td><img src="images/smileys/crying.png" border="0"></td><td>:((</td><td >crying</td></tr>
- <tr><td><img src="images/smileys/frown.png" border="0"></td><td>:(</td><td>frown</td></tr>
- <tr><td><img src="images/smileys/indifferent.png" border="0"></td><td>:|</td><td>indifferent</td></tr>
- <tr><td><img src="images/smileys/laughing.png" border="0"></td><td>:D</td><td>laughing</td></tr>
- <tr><td><img src="images/smileys/lick.png" border="0"></td><td>:P</td><td>lick</td></tr>
- <tr><td><img src="images/smileys/ohno.png" border="0"></td><td>:O</td><td>oh no!</td></tr>
- <tr><td><img src="images/smileys/smile.png" border="0"></td><td>:)</td><td>smile</td></tr>
- <tr><td><img src="images/smileys/surprised.png" border="0"></td><td>=)</td><td>surprised</td></tr>
- <tr><td><img src="images/smileys/undecided.png" border="0"></td><td>:\</td><td>undecided</td></tr>
- <tr><td><img src="images/smileys/wink.png" border="0"></td><td>;)</td><td>wink</td></tr>
- </table>
- </td></tr></table>
- </td><td width="25"></td><td valign="top">
- <?php
- // improve category handling (20100221) - start
- if (file_exists("data/categories")) {
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td valign=\"top\" width=\"150\">";
- if ($dh_cat = opendir("data/categories")) {
- while (($entry_cat = readdir($dh_cat)) !== false) {
- if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
- if (file_exists("data/categories/$entry_cat/private.txt") and ($login_username != $_SESSION['logged_in'])) {
- continue;
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/categories/$entry_cat")) {
- $filed_cat[] = $entry_cat;
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/categories/$entry_cat")) {
- $unfiled_cat[] = $entry_cat;
- }
- }
- }
- closedir($dh_cat);
- sort($filed_cat);
- sort($unfiled_cat);
- reset($filed_cat);
- reset($unfiled_cat);
- $count_filed_cat = count($filed_cat);
- $count_unfiled_cat = count($unfiled_cat);
- }
- if ($count_filed_cat > 0) {
- echo "<p><b>Filed Under</b></p>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
- foreach ($filed_cat as $filed_category) {
- echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">";
- echo "<input type=\"hidden\" name=\"entry\" value=\"{$_REQUEST['entry']}\">";
- echo "<input type=\"hidden\" name=\"category\" value=\"$filed_category\">";
- echo "<input type=\"hidden\" name=\"do\" value=\"unfile\">";
- echo "<tr bgcolor=\"#ffffff\"><td><a href=\"index.php?category=$filed_category\">$filed_category</a></td>";
- echo "<td width=\"14\"><input type=\"image\" src=\"images/widget.x.png\"></td></tr>";
- echo "</form>";
- }
- echo "</table>";
- }
- echo "</td><td width=\"25\"></td><td valign=\"top\" width=\"150\">";
- if ($count_unfiled_cat > 0) {
- echo "<p><b>Available Categories</b></p>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
- foreach ($unfiled_cat as $unfiled_category) {
- echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">";
- echo "<input type=\"hidden\" name=\"entry\" value=\"{$_REQUEST['entry']}\">";
- echo "<input type=\"hidden\" name=\"category\" value=\"$unfiled_category\">";
- echo "<input type=\"hidden\" name=\"do\" value=\"file\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"14\"><input type=\"image\" src=\"images/widget.ok.png\"></td>";
- echo "<td align=\"right\"><a href=\"index.php?category=$unfiled_category\">$unfiled_category</a></td></tr>";
- echo "</form>";
- }
- echo "</table>";
- }
- echo "</td></tr></table><br>";
- }
- // improve category handling (20100221) - end
- // add member authorization (20100221) - start
- if (file_exists("data/members/active")) {
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\"><tr><td valign=\"top\" width=\"150\">";
- if ($dh_ack_members = opendir("data/items/{$_REQUEST['entry']}/members")) {
- while (($ack_member = readdir($dh_ack_members)) !== false) {
- if ($ack_member != "." && $ack_member != "..") {
- $ack_members[] = $ack_member;
- }
- }
- closedir($dh_ack_members);
- sort($ack_members);
- reset($ack_members);
- $count_ack_members = count($ack_members);
- }
- if ($dh_nak_members = opendir("data/members/active")) {
- while (($nak_member = readdir($dh_nak_members)) !== false) {
- if ($nak_member != "." && $nak_member != "..") {
- if (file_exists("data/items/{$_REQUEST['entry']}/members/$nak_member")) {
- continue;
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/$nak_member")) {
- $nak_members[] = $nak_member;
- }
- }
- }
- closedir($dh_nak_members);
- sort($nak_members);
- reset($nak_members);
- $count_nak_members = count($nak_members);
- }
- if ($count_ack_members > 0) {
- echo "<p><b>Authorized Members</b></p>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
- foreach ($ack_members as $ack_member) {
- echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">";
- echo "<input type=\"hidden\" name=\"entry\" value=\"{$_REQUEST['entry']}\">";
- echo "<input type=\"hidden\" name=\"auth_member\" value=\"$ack_member\">";
- echo "<input type=\"hidden\" name=\"auth_toggle\" value=\"nak\">";
- echo "<tr bgcolor=\"#ffffff\"><td><a href=\"member.php?id=$ack_member\">$ack_member</a></td>";
- echo "<td width=\"14\"><input type=\"image\" src=\"images/widget.x.png\"></td></tr>";
- echo "</form>";
- }
- echo "</table>";
- }
- echo "</td><td width=\"25\"></td><td valign=\"top\" width=\"150\">";
- if ($count_nak_members > 0) {
- echo "<p><b>Registered Members</b></p>";
- echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#cccccc\" width=\"150\">";
- foreach ($nak_members as $nak_member) {
- echo "<form enctype=\"multipart/form-data\" action=\"edit.php\" method=\"post\">";
- echo "<input type=\"hidden\" name=\"entry\" value=\"{$_REQUEST['entry']}\">";
- echo "<input type=\"hidden\" name=\"auth_member\" value=\"$nak_member\">";
- echo "<input type=\"hidden\" name=\"auth_toggle\" value=\"ack\">";
- echo "<tr bgcolor=\"#ffffff\"><td width=\"14\"><input type=\"image\" src=\"images/widget.ok.png\"></td>";
- echo "<td align=\"right\"><a href=\"member.php?id=$nak_member\">$nak_member</a></td></tr>";
- echo "</form>";
- }
- echo "</table>";
- }
- echo "</td></tr></table><br>";
- }
- // add member authorization (20100221) - end
- ?>
- </td></tr></table>
- <?php
- if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/title.old")) {
- unlink("data/items/{$_REQUEST['entry']}/title.old");
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/body.old")) {
- unlink("data/items/{$_REQUEST['entry']}/body.old");
- }
- copy("data/items/{$_REQUEST['entry']}/title.txt","data/items/{$_REQUEST['entry']}/title.old");
- copy("data/items/{$_REQUEST['entry']}/body.txt","data/items/{$_REQUEST['entry']}/body.old");
- // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
- $title_write_content = ucwords($_POST['title_input']);
- $title_write_content = str_replace('<','<',$title_write_content);
- $title_write_content = str_replace('>','>',$title_write_content);
- $title_write_content = str_replace(' A ',' a ',$title_write_content);
- $title_write_content = str_replace(' An ',' an ',$title_write_content);
- $title_write_content = str_replace(' And ',' and ',$title_write_content);
- $title_write_content = str_replace(' As ',' as ',$title_write_content);
- $title_write_content = str_replace(' At ',' at ',$title_write_content);
- $title_write_content = str_replace(' But ',' but ',$title_write_content);
- $title_write_content = str_replace(' By ',' by ',$title_write_content);
- $title_write_content = str_replace(' For ',' for ',$title_write_content);
- $title_write_content = str_replace(' In ',' in ',$title_write_content);
- $title_write_content = str_replace(' Of ',' of ',$title_write_content);
- $title_write_content = str_replace(' On ',' on ',$title_write_content);
- $title_write_content = str_replace(' Or ',' or ',$title_write_content);
- $title_write_content = str_replace(' The ',' the ',$title_write_content);
- $title_write_content = str_replace(' To ',' to ',$title_write_content);
- function reformat_html($defang_html) {
- $store_html=split("<html>",$defang_html);
- $defang_html="";
- $defang_html.=$store_html[0];
- foreach($store_html as $itm_html=>$refh_html) {
- if(eregi("</html>",$refh_html)) {
- $store_html1=split("</html>",$refh_html);
- $store_html1[0]=eregi_replace("\n","",$store_html1[0]);
- foreach($store_html1 as $itm_html1=>$refh_html1) {
- if($itm_html1==0)
- $refh_html1="<!-- html -->$refh_html1<!-- /html -->";
- $defang_html.=$refh_html1;
- }
- }
- }
- return $defang_html;
- }
- function reformat_code($defang_code) {
- $store_code=split("<code>",$defang_code);
- $defang_code="";
- $defang_code.=$store_code[0];
- foreach($store_code as $itm_code=>$refh_code) {
- if(eregi("</code>",$refh_code)) {
- $store_code1=split("</code>",$refh_code);
- $store_code1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">',':((',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">',':(',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">',':|',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">',':D',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">',':P',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">',':O',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">',':)',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">','=)',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">',':\\',$store_code1[0]);
- $store_code1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">',';)',$store_code1[0]);
- $store_code1[0]=htmlentities($store_code1[0],ENT_NOQUOTES);
- foreach($store_code1 as $itm_code1=>$refh_code1) {
- if($itm_code1==0)
- $refh_code1="<code>$refh_code1</code>";
- $defang_code.=$refh_code1;
- }
- }
- }
- return $defang_code;
- }
- $body_write_content = ucfirst($_POST['body_input']);
- $body_write_content = str_replace("[html]", '<html>', $body_write_content);
- $body_write_content = str_replace("[/html]", '</html>', $body_write_content);
- $body_write_content = reformat_html($body_write_content);
- $body_write_content = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $body_write_content);
- $body_write_content = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $body_write_content);
- $body_write_content = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $body_write_content);
- $body_write_content = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $body_write_content);
- $body_write_content = str_replace('[code]', '<code>', $body_write_content);
- $body_write_content = str_replace('[/code]', '</code>', $body_write_content);
- $body_write_content = reformat_code($body_write_content);
- $body_write_content = str_replace("\n", '<br />', $body_write_content);
- $body_write_content = str_replace('[b]', '<b>', $body_write_content);
- $body_write_content = str_replace('[/b]', '</b>', $body_write_content);
- $body_write_content = str_replace('[i]', '<i>', $body_write_content);
- $body_write_content = str_replace('[/i]', '</i>', $body_write_content);
- $body_write_content = str_replace('[u]', '<u>', $body_write_content);
- $body_write_content = str_replace('[/u]', '</u>', $body_write_content);
- $body_write_content = str_replace('[strike]', '<strike>', $body_write_content);
- $body_write_content = str_replace('[/strike]', '</strike>', $body_write_content);
- $body_write_content = str_replace('[sup]', '<sup>', $body_write_content);
- $body_write_content = str_replace('[/sup]', '</sup>', $body_write_content);
- $body_write_content = str_replace('[sub]', '<sub>', $body_write_content);
- $body_write_content = str_replace('[/sub]', '</sub>', $body_write_content);
- $body_write_content = str_replace('[highlight]', '<highlight>', $body_write_content);
- $body_write_content = str_replace('[/highlight]', '</highlight>', $body_write_content);
- $body_write_content = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $body_write_content);
- $body_write_content = str_replace('</highlight>', '</span>', $body_write_content);
- $body_write_content = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>',$body_write_content);
- $revisions_count = $revisions_count + 1;
- if (isset($_FILES['album_image_input']) and !empty($_FILES['album_image_input'])) {
- if (is_uploaded_file($_FILES['album_image_input']['tmp_name'])) {
- if ($_FILES['album_image_input']['size']<=$max_file_size) {
- if (($_FILES['album_image_input']['type']=="image/gif") || ($_FILES['album_image_input']['type']=="image/pjpeg") || ($_FILES['album_image_input']['type']=="image/jpeg") || ($_FILES['album_image_input']['type']=="image/png")) {
- $album_image_input_name = str_replace(" ","_",$_FILES['album_image_input']['name']);
- if (!file_exists("images/{$_REQUEST['entry']}/album/$album_image_input_name")) {
- if (!file_exists("images/{$_REQUEST['entry']}")) {
- mkdir("images/{$_REQUEST['entry']}");
- }
- if (!file_exists("images/{$_REQUEST['entry']}/album")) {
- mkdir("images/{$_REQUEST['entry']}/album");
- }
- if (!file_exists("data/albums")) {
- mkdir("data/albums");
- }
- if (!file_exists("data/albums/{$_REQUEST['entry']}")) {
- mkdir("data/albums/{$_REQUEST['entry']}");
- }
- if (isset($_POST['caption']) and !empty($_POST['caption'])) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/album")) {
- mkdir("data/items/{$_REQUEST['entry']}/album");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/album/captions")) {
- mkdir("data/items/{$_REQUEST['entry']}/album/captions");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/album/captions/{$album_image_input_name}.txt")) {
- $caption_txt = ucfirst($_POST['caption']);
- $caption_txt = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $caption_txt);
- $caption_txt = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $caption_txt);
- $caption_txt = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $caption_txt);
- $caption_txt = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $caption_txt);
- $caption_txt = str_replace('[code]', '<code>', $caption_txt);
- $caption_txt = str_replace('[/code]', '</code>', $caption_txt);
- $caption_txt = str_replace("\n", '<br />', $caption_txt);
- $caption_txt = str_replace('[b]', '<b>', $caption_txt);
- $caption_txt = str_replace('[/b]', '</b>', $caption_txt);
- $caption_txt = str_replace('[i]', '<i>', $caption_txt);
- $caption_txt = str_replace('[/i]', '</i>', $caption_txt);
- $caption_txt = str_replace('[u]', '<u>', $caption_txt);
- $caption_txt = str_replace('[/u]', '</u>', $caption_txt);
- $caption_txt = str_replace('[strike]', '<strike>', $caption_txt);
- $caption_txt = str_replace('[/strike]', '</strike>', $caption_txt);
- $caption_txt = str_replace('[sup]', '<sup>', $caption_txt);
- $caption_txt = str_replace('[/sup]', '</sup>', $caption_txt);
- $caption_txt = str_replace('[sub]', '<sub>', $caption_txt);
- $caption_txt = str_replace('[/sub]', '</sub>', $caption_txt);
- $caption_txt = str_replace('[highlight]', '<highlight>', $caption_txt);
- $caption_txt = str_replace('[/highlight]', '</highlight>', $caption_txt);
- $caption_txt = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $caption_txt);
- $caption_txt = str_replace('</highlight>', '</span>', $caption_txt);
- $fp_caption_txt = fopen("data/items/{$_REQUEST['entry']}/album/captions/{$album_image_input_name}.txt","w");
- }
- }
- $res = copy($_FILES['album_image_input']['tmp_name'],"images/{$_REQUEST['entry']}/album/$album_image_input_name");
- unlink($_FILES['album_image_input']['tmp_name']);
- }
- else {
- unlink($_FILES['album_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['album_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['album_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['album_image_input']['tmp_name']);
- }
- }
- if (isset($_FILES['entry_image_input']) and !empty($_FILES['entry_image_input'])) {
- if (is_uploaded_file($_FILES['entry_image_input']['tmp_name'])) {
- if ($_FILES['entry_image_input']['size']<=$max_file_size) {
- if (($_FILES['entry_image_input']['type']=="image/gif") || ($_FILES['entry_image_input']['type']=="image/pjpeg") || ($_FILES['entry_image_input']['type']=="image/jpeg") || ($_FILES['entry_image_input']['type']=="image/png")) {
- $entry_image_input_name = str_replace(" ","_",$_FILES['entry_image_input']['name']);
- if (!file_exists("images/{$_REQUEST['entry']}/$entry_image_input_name")) {
- if (!file_exists("images/{$_REQUEST['entry']}")) {
- mkdir("images/{$_REQUEST['entry']}");
- }
- $res = copy($_FILES['entry_image_input']['tmp_name'], "images/{$_REQUEST['entry']}/$entry_image_input_name");
- unlink($_FILES['entry_image_input']['tmp_name']);
- $entry_image_size = getimagesize("images/{$_REQUEST['entry']}/$entry_image_input_name");
- $entry_image_width = $entry_image_size[0];
- $entry_image_height = $entry_image_size[1];
- $max_entry_image_width = 513;
- if ($entry_image_width > $max_entry_image_width) {
- $sizefactor = (double) ($max_entry_image_width / $entry_image_width) ;
- $entry_image_width = (int) ($entry_image_width * $sizefactor);
- $entry_image_height = (int) ($entry_image_height * $sizefactor);
- }
- $body_write_content = "<img src=\"images/{$_REQUEST['entry']}/$entry_image_input_name\" border=\"0\" width=\"$entry_image_width\" height=\"$entry_image_height\">\n\r$body_write_content";
- }
- else {
- unlink($_FILES['entry_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['entry_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['entry_image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['entry_image_input']['tmp_name']);
- }
- }
- if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
- if (is_uploaded_file($_FILES['file_input']['tmp_name'])) {
- if ($_FILES['file_input']['size']<=$max_file_size) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/filedrop")) {
- mkdir("data/items/{$_REQUEST['entry']}/filedrop");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/filedrop/files")) {
- mkdir("data/items/{$_REQUEST['entry']}/filedrop/files");
- }
- $file_input_name = str_replace(" ","_",$_FILES['file_input']['name']);
- if (!file_exists("data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name")) {
- $res = copy($_FILES['file_input']['tmp_name'], "data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name");
- unlink($_FILES['file_input']['tmp_name']);
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
- }
- if (file_exists("data/wiki.txt")) {
- $old_title = file_get_contents("data/items/{$_REQUEST['entry']}/title.old");
- $old_body = file_get_contents("data/items/{$_REQUEST['entry']}/body.old");
- if (($old_title != $title_write_content) or ($old_body != $body_write_content)) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta");
- }
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
- }
- copy("data/items/{$_REQUEST['entry']}/body.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/prev.txt");
- copy("data/items/{$_REQUEST['entry']}/date.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/date.txt");
- if (file_exists("data/items/{$_REQUEST['entry']}/contrib.txt")) {
- copy("data/items/{$_REQUEST['entry']}/contrib.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/contrib.txt");
- }
- }
- }
- if (file_exists("data/wiki.txt") and (file_exists("data/items/{$_REQUEST['entry']}/edit.txt") or (file_get_contents("data/items/{$_REQUEST['entry']}/author.txt") == $_SESSION['logged_in']))) {
- }
- if ($_SESSION['logged_in'] == $login_username) {
- $sticky_sem = 'data/sticky/' . $_REQUEST['entry'];
- if (isset($_POST['sticky']) and !empty($_POST['sticky']) and ($_POST['sticky'] == "on")) {
- if (!file_exists("data/sticky")) {
- mkdir("data/sticky");
- }
- if (!file_exists($sticky_sem)) {
- touch($sticky_sem);
- }
- }
- if (!isset($_POST['sticky']) or empty($_POST['sticky'])) {
- if (file_exists($sticky_sem)) {
- unlink($sticky_sem);
- }
- }
- $display_sem = "data/items/{$_REQUEST['entry']}/cat.txt";
- if (isset($_POST['display']) and !empty($_POST['display']) and ($_POST['display'] == "on")) {
- if (!file_exists($display_sem)) {
- touch($display_sem);
- }
- }
- if (!isset($_POST['display']) or empty($_POST['display'])) {
- if (file_exists($display_sem)) {
- unlink($display_sem);
- }
- }
- $private_sem = "data/items/{$_REQUEST['entry']}/private.txt";
- if (isset($_POST['private']) and !empty($_POST['private']) and ($_POST['private'] == "on")) {
- if (!file_exists($private_sem)) {
- touch($private_sem);
- }
- }
- if (!isset($_POST['private']) or empty($_POST['private'])) {
- if (file_exists($private_sem)) {
- unlink($private_sem);
- }
- }
- $member_sem = "data/items/{$_REQUEST['entry']}/member.txt";
- if (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on")) {
- if (!file_exists($member_sem)) {
- touch($member_sem);
- }
- }
- if (!isset($_POST['member']) or empty($_POST['member'])) {
- if (file_exists($member_sem)) {
- unlink($member_sem);
- }
- }
- $edit_sem = "data/items/{$_REQUEST['entry']}/edit.txt";
- if (isset($_POST['edit']) and !empty($_POST['edit']) and ($_POST['edit'] == "on")) {
- if (!file_exists($edit_sem)) {
- touch($edit_sem);
- }
- }
- if (!isset($_POST['edit']) or empty($_POST['edit'])) {
- if (file_exists($edit_sem)) {
- unlink($edit_sem);
- }
- }
- if (isset($_POST['lock']) and !empty($_POST['lock']) and ($_POST['lock'] == "on")) {
- if (file_exists("data/items/{$_REQUEST['entry']}/edit.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/edit.txt");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/lock.txt")) {
- touch("data/items/{$_REQUEST['entry']}/lock.txt");
- }
- }
- if (!isset($_POST['lock']) or empty($_POST['lock'])) {
- if (file_exists("data/items/{$_REQUEST['entry']}/lock.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/lock.txt");
- }
- }
- $lastmod_sem = "data/items/{$_REQUEST['entry']}/lastmod.txt";
- if (isset($_POST['lastmod']) and !empty($_POST['lastmod']) and ($_POST['lastmod'] == "on")) {
- if (!file_exists($lastmod_sem)) {
- touch($lastmod_sem);
- }
- }
- if (!isset($_POST['lastmod']) or empty($_POST['lastmod'])) {
- if (file_exists($lastmod_sem)) {
- unlink($lastmod_sem);
- }
- }
- if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/pdf")) {
- mkdir("data/items/{$_REQUEST['entry']}/pdf");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) {
- mkdir("data/items/{$_REQUEST['entry']}/pdf/file");
- }
- if (!file_exists("data/items/{$_REQUEST['entry']}/pdf/count")) {
- mkdir("data/items/{$_REQUEST['entry']}/pdf/count");
- }
- $entry = $_REQUEST['entry'];
- $author_file = "data/author.txt";
- $title_file = "data/items/$entry/title.txt";
- $date_file = "data/items/$entry/date.txt";
- $body_file = "data/items/$entry/body.txt";
- $author = file_get_contents($author_file);
- $title = file_get_contents($title_file);
- $date = file_get_contents($date_file);
- $link = "<a href=\"http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry\">http://{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?entry=$entry</a>";
- $link = str_replace("pdf.php?entry=","index.php?entry=",$link);
- $link = str_replace("edit.php?entry=","index.php?entry=",$link);
- $body = file_get_contents($body_file);
- $body = str_replace("\n","<br />",$body);
- $html = "<br><i>by $author</i><br><br>$date<br><br>Canonical Source<br>$link<br><br><br>$body";
- $filename = strtolower($title);
- $filename = strtolower($_SERVER['SERVER_NAME']) . "-" . $entry . "-" . $filename . ".pdf";
- $filename = str_replace(" ","-",$filename);
- $filename = "data/items/$entry/pdf/file/$filename";
- require('fpdf.php');
- class PDF extends FPDF
- {
- var $B;
- var $I;
- var $U;
- var $HREF;
- function PDF($orientation='P',$unit='mm',$format='letter')
- {
- $this->FPDF($orientation,$unit,$format);
- $this->B=0;
- $this->I=0;
- $this->U=0;
- $this->HREF='';
- }
- function WriteHTML($html)
- {
- $html=str_replace("\n",' ',$html);
- $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
- foreach($a as $i=>$e)
- {
- if($i%2==0)
- {
- if($this->HREF)
- $this->PutLink($this->HREF,$e);
- else
- $this->Write(5,$e);
- }
- else
- {
- if($e{0}=='/')
- $this->CloseTag(strtoupper(substr($e,1)));
- else
- {
- $a2=explode(' ',$e);
- $tag=strtoupper(array_shift($a2));
- $attr=array();
- foreach($a2 as $v)
- if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
- $attr[strtoupper($a3[1])]=$a3[2];
- $this->OpenTag($tag,$attr);
- }
- }
- }
- }
- function OpenTag($tag,$attr)
- {
- if($tag=='B' or $tag=='I' or $tag=='U')
- $this->SetStyle($tag,true);
- if($tag=='A')
- $this->HREF=$attr['HREF'];
- if($tag=='BR')
- $this->Ln(5);
- }
- function CloseTag($tag)
- {
- if($tag=='B' or $tag=='I' or $tag=='U')
- $this->SetStyle($tag,false);
- if($tag=='A')
- $this->HREF='';
- }
- function SetStyle($tag,$enable)
- {
- $this->$tag+=($enable ? 1 : -1);
- $style='';
- foreach(array('B','I','U') as $s)
- if($this->$s>0)
- $style.=$s;
- $this->SetFont('',$style);
- }
- function PutLink($URL,$txt)
- {
- $this->SetTextColor(0,0,255);
- $this->SetStyle('U',true);
- $this->Write(5,$txt,$URL);
- $this->SetStyle('U',false);
- $this->SetTextColor(0);
- }
- }
- $pdf=new PDF();
- $pdf->AddPage();
- $pdf->SetTitle($title);
- $pdf->SetAuthor($author);
- $pdf->SetFont('Helvetica','B',14);
- $pdf->WriteHTML($title);
- $pdf->SetFont('Helvetica','',10);
- $pdf->WriteHTML($html);
- $pdf->Output($filename);
- }
- if (!isset($_POST['pdf']) or empty($_POST['pdf'])) {
- if (file_exists("data/items/{$_REQUEST['entry']}/pdf/file")) {
- rmdirr("data/items/{$_REQUEST['entry']}/pdf/file");
- }
- }
- $passwd_file = "data/items/{$_REQUEST['entry']}/passwd.txt";
- if (isset($_POST['passwd']) and !empty($_POST['passwd']) and ($_POST['passwd'] != "password")) {
- $passwd_crypt = sha1($_POST['passwd']);
- $passwd_crypt = md5($passwd_crypt);
- $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
- }
- if (!isset($_POST['passwd']) or empty($_POST['passwd'])) {
- if (file_exists($passwd_file)) {
- unlink($passwd_file);
- }
- }
- if (isset($_POST['maxlines']) and !empty($_POST['maxlines']) and is_numeric($_POST['maxlines'])) {
- }
- if (!isset($_POST['maxlines']) or empty($_POST['maxlines'])) {
- if (file_exists("data/items/{$_REQUEST['entry']}/maxlines.txt")) {
- unlink("data/items/{$_REQUEST['entry']}/maxlines.txt");
- }
- }
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/title.old")) {
- unlink("data/items/{$_REQUEST['entry']}/title.old");
- }
- if (file_exists("data/items/{$_REQUEST['entry']}/body.old")) {
- unlink("data/items/{$_REQUEST['entry']}/body.old");
- }
- $default_ping_url = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
- if (!file_exists("data/ping.txt")) {
- }
- $ping_urls = explode("|", file_get_contents("data/ping.txt"));
- foreach ($ping_urls as $ping_url) {
- $ping = file_get_contents($ping_url);
- unset($ping);
- }
- ?>