This commit has been accessed 712 times via Git panel.
commit 18a29752fa9a2e0a60809fbf717ab43e95c290d4
tree 09c6f337c73f73c042baa9f91ccccf994aed7322
parent 2d702a44ad667d898a2159e49d5b18b091e26c8d
author Engels Antonio <engels@majcms.org> 1280601593 +0800
committer Engels Antonio <engels@majcms.org> 1280601593 +0800
CSS progressive enhancements
Aggregate recurring functions
Code clean-up and optimization
diff --git a/add.php b/add.php
index 59b0f21..a1e868c 100644
--- a/add.php
+++ b/add.php
@@ -1,61 +1,41 @@
<?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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
-if (isset($_POST['title_input']) and isset($_POST['body_input']) and !empty($_POST['title_input']) and !empty($_POST['body_input'])) {
- header("Location: index.php");
-}
-
-if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
- $login_username = file_get_contents("data/username.txt");
-}
-
-if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
-
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
-
- $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
-
- if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
- unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
- }
- }
-
- if ((file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) and file_exists("data/bb.txt") and !file_exists("data/noadd.txt")) {
- $login_username = $_SESSION['logged_in'];
- }
-}
-
-if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- exit();
-}
-
+ session_start();
+
+ header("Cache-control: private");
+
+ error_reporting(E_ERROR);
+
+ require("core.php");
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+ header("Location: login.php");
+ }
+
+ if (isset($_POST['title_input']) and isset($_POST['body_input']) and !empty($_POST['title_input']) and !empty($_POST['body_input'])) {
+ header("Location: index.php");
+ }
+
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+ $login_username = file_get_contents("data/username.txt");
+ }
+
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+ $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
+ if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
+ unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
+ }
+ }
+
+ if ((file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) and file_exists("data/bb.txt") and !file_exists("data/noadd.txt")) {
+ $login_username = $_SESSION['logged_in'];
+ }
+ }
+
+ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+ exit();
+ }
?>
<title>Add</title>
@@ -63,161 +43,180 @@ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username
<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;
+ 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;
+ font-size: 11px;
}
a {
- font-weight: bold;
- text-decoration: none;
+ font-weight: bold;
+ text-decoration: none;
}
a:link, a:visited {
- color: #666666;
+ color: #666666;
}
a:hover {
- color: #336699;
+ color: #336699;
}
a:active {
- color: #336699;
-}
-
-.input_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 512px;
- 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: 512px;
- 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: #336699;
+}
+
+.input_title {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 512px;
+ 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: 512px;
+ 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
}
</style>
<?php
-
-if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
-}
-else {
- $offset = 0;
-}
-
-$entry_year = date("Y", time() + $offset);
-$entry_month = date("m", time() + $offset);
-$entry_day = date("d", time() + $offset);
-$entry_hour = date("H", time() + $offset);
-$entry_min = date("i", time() + $offset);
-$entry_sec = date("s", time() + $offset);
-
-function return_bytes($val) {
- $val = trim($val);
- $last = $val{strlen($val)-1};
-
- 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;
-}
-
+ if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+ } else {
+ $offset = 0;
+ }
+
+ $entry_year = date("Y", time() + $offset);
+ $entry_month = date("m", time() + $offset);
+ $entry_day = date("d", time() + $offset);
+ $entry_hour = date("H", time() + $offset);
+ $entry_min = date("i", time() + $offset);
+ $entry_sec = date("s", time() + $offset);
+
+ $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;
+ }
?>
<form enctype="multipart/form-data" action="add.php" method="post">
<p>
<?php
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt")) {
+?>
-if ($_SESSION['logged_in'] != file_get_contents("data/username.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt")) { ?>
-
-<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php
+ echo $max_file_size;
+?>">
<input autocomplete="off" type="file" name="image_input"> Upload optional GIF, JPG, or PNG 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. Max size supported by server is <?php echo ($max_file_size/(1024*1024)); ?>MB.</p>
-
-<?php } ?>
-
+<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. Max size supported by server is <?php
+ echo($max_file_size / (1024 * 1024));
+?>MB.</p>
<?php
+ }
+?>
-if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+<?php
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
?>
<select name="select_year">
<option selected>
-<option><?php echo $entry_year; ?>
-<option><?php $ante_year_1 = $entry_year - 1; echo $ante_year_1; ?>
-<option><?php $ante_year_2 = $entry_year - 2; echo $ante_year_2; ?>
-<option><?php $ante_year_3 = $entry_year - 3; echo $ante_year_3; ?>
-<option><?php $ante_year_4 = $entry_year - 4; echo $ante_year_4; ?>
-<option><?php $ante_year_5 = $entry_year - 5; echo $ante_year_5; ?>
-<option><?php $ante_year_6 = $entry_year - 6; echo $ante_year_6; ?>
-<option><?php $ante_year_7 = $entry_year - 7; echo $ante_year_7; ?>
-<option><?php $ante_year_8 = $entry_year - 8; echo $ante_year_8; ?>
-<option><?php $ante_year_9 = $entry_year - 9; echo $ante_year_9; ?>
-<option><?php $ante_year_10 = $entry_year - 10; echo $ante_year_10; ?>
+<option><?php
+ echo $entry_year;
+?>
+<option><?php
+ $ante_year_1 = $entry_year - 1;
+ echo $ante_year_1;
+?>
+<option><?php
+ $ante_year_2 = $entry_year - 2;
+ echo $ante_year_2;
+?>
+<option><?php
+ $ante_year_3 = $entry_year - 3;
+ echo $ante_year_3;
+?>
+<option><?php
+ $ante_year_4 = $entry_year - 4;
+ echo $ante_year_4;
+?>
+<option><?php
+ $ante_year_5 = $entry_year - 5;
+ echo $ante_year_5;
+?>
+<option><?php
+ $ante_year_6 = $entry_year - 6;
+ echo $ante_year_6;
+?>
+<option><?php
+ $ante_year_7 = $entry_year - 7;
+ echo $ante_year_7;
+?>
+<option><?php
+ $ante_year_8 = $entry_year - 8;
+ echo $ante_year_8;
+?>
+<option><?php
+ $ante_year_9 = $entry_year - 9;
+ echo $ante_year_9;
+?>
+<option><?php
+ $ante_year_10 = $entry_year - 10;
+ echo $ante_year_10;
+?>
</select>
<select name="select_month">
<option selected>
-<option><?php echo $entry_month; ?>
+<option><?php
+ echo $entry_month;
+?>
<option>01
<option>02
<option>03
@@ -234,7 +233,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_day">
<option selected>
-<option><?php echo $entry_day; ?>
+<option><?php
+ echo $entry_day;
+?>
<option>01
<option>02
<option>03
@@ -270,7 +271,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_hour">
<option selected>
-<option><?php echo $entry_hour; ?>
+<option><?php
+ echo $entry_hour;
+?>
<option>00
<option>01
<option>02
@@ -299,7 +302,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_min">
<option selected>
-<option><?php echo $entry_min; ?>
+<option><?php
+ echo $entry_min;
+?>
<option>00
<option>01
<option>02
@@ -362,66 +367,86 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<option>59
</select> Enter antedate value in YYYY-MM-DD-HH-MM format.</p>
-<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php
+ echo $max_file_size;
+?>">
<input autocomplete="off" type="file" name="image_input"> Upload optional GIF, JPG, or PNG 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. Max size supported by server is <?php echo ($max_file_size/(1024*1024)); ?>MB.</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. Max size supported by server is <?php
+ echo($max_file_size / (1024 * 1024));
+?>MB.</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")) {
- while (($entry_cat = readdir($dh_cat)) !== false) {
-
- if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
- $show_cat[] = $entry_cat;
- }
- }
- closedir($dh_cat);
- }
-
- sort($show_cat);
- reset($show_cat);
- $count_cat = count($show_cat);
-
- if ($count_cat > 0) {
-
- echo "<p><select name=\"category\"><option value=\"\" selected>unfiled";
-
- foreach ($show_cat as $category) {
- echo "<option value=\"";
- echo strtolower($category);
- echo "\">";
-
- if (file_exists("data/categories/$category/title.txt")) {
- readfile("data/categories/$category/title.txt");
- }
- else {
- echo strtolower($category);
- }
- }
-
- echo "</select> Select category.</p>";
-
- }
- }
+ if (file_exists("data/categories")) {
+ if ($dh_cat = opendir("data/categories")) {
+ while (($entry_cat = readdir($dh_cat)) !== false) {
+ if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+ $show_cat[] = $entry_cat;
+ }
+ }
+ closedir($dh_cat);
+ }
+
+ sort($show_cat);
+ reset($show_cat);
+ $count_cat = count($show_cat);
+
+ if ($count_cat > 0) {
+ echo "<p><select name=\"category\"><option value=\"\" selected>unfiled";
+
+ foreach ($show_cat as $category) {
+ echo "<option value=\"";
+ echo strtolower($category);
+ echo "\">";
+
+ if (file_exists("data/categories/$category/title.txt")) {
+ readfile("data/categories/$category/title.txt");
+ } else {
+ echo strtolower($category);
+ }
+ }
+
+ echo "</select> Select category.</p>";
+ }
+ }
?>
<p><input type="checkbox" name="sticky">Put entry title in Quick Links box.<br>
<input type="checkbox" name="pdf">Allow PDF generation for this entry.<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" <?php if (file_exists("data/ml.txt")) { 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.
+<input type="checkbox" name="private" <?php
+ if (file_exists("data/ml.txt")) {
+ 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.
-<?php if (file_exists("data/bb.txt")) { ?>
+<?php
+ if (file_exists("data/bb.txt")) {
+?>
<br>
-<input type="checkbox" name="member" <?php if (file_exists("data/member.txt")) { echo checked; } ?>>Only registered members can view this entry.
+<input type="checkbox" name="member" <?php
+ if (file_exists("data/member.txt")) {
+ echo checked;
+ }
+?>>Only registered members can view this entry.
-<?php } ?>
+<?php
+ }
+?>
</p>
-<?php } ?>
+<?php
+ }
+?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td>
@@ -455,598 +480,373 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
</td></tr></table>
<?php
-
-if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
- exit();
-}
-
-if (!isset($_POST['select_year']) or !isset($_POST['select_month']) or !isset($_POST['select_day']) or !isset($_POST['select_hour']) or !isset($_POST['select_min']) or empty($_POST['select_year']) or empty($_POST['select_month']) or empty($_POST['select_day']) or empty($_POST['select_hour']) or empty($_POST['select_min'])) {
-
- $entry = date("YmdHis", time() + $offset);
- $timestamp = date("l, M j, Y, g:i A", time() + $offset);
-}
-else {
-
- $entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
- $timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
-}
-
-if (!file_exists("data/items")) {
- mkdir("data/items");
-}
-
-$dir = "data/items/";
-$item_dir = $dir . $entry;
-
-if (!file_exists("images")) {
- mkdir("images");
-}
-
-$image_dir = 'images/' . $entry;
-$file_dir = $item_dir . '/filedrop';
-
-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);
-
-mkdir($item_dir);
-
-// 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);
-
-$title_file = $item_dir . '/title.txt';
-$fp_title_txt = fopen($title_file,"w");
-fwrite($fp_title_txt,$title_write_content);
-fclose($fp_title_txt);
-
-$author_file = $item_dir . '/author.txt';
-$fp_author_txt = fopen($author_file,"w");
-fwrite($fp_author_txt,$_SESSION['logged_in']);
-fclose($fp_author_txt);
-
-if (file_get_contents("data/username.txt") == $_SESSION['logged_in']) {
- $post_file = "data/lastpost.txt";
-}
-elseif (file_exists("data/members/active/{$_SESSION['logged_in']}")) {
- $post_file = "data/members/active/{$_SESSION['logged_in']}/bb-post.txt";
-}
-
-$fp_post_txt = fopen($post_file,"w");
-fwrite($fp_post_txt,$entry);
-fclose($fp_post_txt);
-
-$date_file = $item_dir . '/date.txt';
-$fp_date_txt = fopen($date_file,"w");
-fwrite($fp_date_txt,$timestamp);
-fclose($fp_date_txt);
-
-if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
-
- if (is_uploaded_file($_FILES['image_input']['tmp_name'])) {
-
- if ($_FILES['image_input']['size']<=$max_file_size) {
-
- if (($_FILES['image_input']['type']=="image/gif") || ($_FILES['image_input']['type']=="image/pjpeg") || ($_FILES['image_input']['type']=="image/jpeg") || ($_FILES['image_input']['type']=="image/png")) {
-
- if (!file_exists($image_dir)) {
- mkdir($image_dir);
- }
-
- $image_input_name = str_replace(" ","_",$_FILES['image_input']['name']);
-
- if (!file_exists("$image_dir/$image_input_name")) {
- $res = copy($_FILES['image_input']['tmp_name'], "$image_dir/$image_input_name");
- unlink($_FILES['image_input']['tmp_name']);
-
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['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) {
-
- $filedrop_dir = "$item_dir/filedrop";
-
- if (!file_exists($filedrop_dir)) {
- mkdir($filedrop_dir);
- }
-
- $file_dir = "$filedrop_dir/files";
-
- if (!file_exists($file_dir)) {
- mkdir($file_dir);
- }
-
- $file_input_name = str_replace(" ","_",$_FILES['file_input']['name']);
-
- if (!file_exists("$file_dir/$file_input_name")) {
- $res = copy($_FILES['file_input']['tmp_name'], "$file_dir/$file_input_name");
- unlink($_FILES['file_input']['tmp_name']);
-
- $fp_file_txt = fopen("$filedrop_dir/{$file_input_name}.txt","w");
- fwrite($fp_file_txt,"$file_dir/$file_input_name");
- fclose($fp_file_txt);
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
-}
-
-$body_file = "$item_dir/body.txt";
-
-$fp_body_txt = fopen($body_file,"w");
-
-if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
- if (file_exists("$image_dir/$image_input_name")) {
-
- $entry_image_size = getimagesize("$image_dir/$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=\"$image_dir/$image_input_name\" border=\"0\" width=\"$entry_image_width\" height=\"$entry_image_height\"><br>$body_write_content";
- }
-}
-
-fwrite($fp_body_txt,$body_write_content);
-fclose($fp_body_txt);
-
-$sticky_sem = "data/sticky/$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);
- }
-}
-
-$display_sem = "data/items/$entry/cat.txt";
-if (isset($_POST['display']) and !empty($_POST['display']) and ($_POST['display'] == "on")) {
- if (!file_exists($display_sem)) {
- touch($display_sem);
- }
-}
-
-$private_sem = "data/items/$entry/private.txt";
-if (isset($_POST['private']) and !empty($_POST['private']) and ($_POST['private'] == "on")) {
- if (!file_exists($private_sem)) {
- touch($private_sem);
- }
-}
-
-if (file_exists("data/bb.txt") and file_exists("data/member.txt") and (($_SESSION['logged_in'] != file_get_contents("data/username.txt")) or (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on")))) {
- touch("data/items/$entry/member.txt");
-}
-
-if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists($private_sem)) {
-
- if (file_exists("data/ml-reply2.txt")) {
- $ml_reply2 = file_get_contents("data/ml-reply2.txt");
- }
-
- if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
- $ml_author = file_get_contents("data/author.txt");
-
- if (file_exists("data/ml-from.txt")) {
- $ml_from = $ml_reply2;
- }
- else {
- $ml_from = file_get_contents("data/email.txt");
- }
-
- $ml_from = '"' . $ml_author . '" <' . $ml_from . '>';
- }
-
- if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/bb.txt")) {
- $ml_from_firstname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt");
- $ml_from_lastname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt");
-
- if (file_exists("data/ml-from.txt")) {
- $ml_from = $ml_reply2;
- }
- else {
- $ml_from = file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt");
- }
-
- $ml_from = '"' . "$ml_from_firstname $ml_from_lastname" . '" <' . $ml_from . '>';
- }
- }
-
- $ml_subject = ucfirst($_POST['title_input']);
- if (file_exists("data/ml-prepend.txt")) {
- $ml_subject = file_get_contents("data/ml-prepend.txt") . " " . $ml_subject;
- }
-
- $ml_mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
- $ml_body = ucfirst($_POST['body_input']);
- $ml_body = str_replace('<br />', "\n", $ml_body);
- $ml_body = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $ml_body);
- $ml_body = str_replace('&','&',$ml_body);
- $ml_body = str_replace('®','(R)',$ml_body);
- $ml_body = strip_tags($ml_body);
-
- if (file_exists("data/ml-header.txt")) {
- $ml_header = file_get_contents("data/ml-header.txt");
- $ml_body = $ml_header . "\n\n" . $ml_body;
- }
-
- $ml_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
- $ml_url = str_replace('//', '/', $ml_url);
- $ml_url = "http://" . $ml_url . "index.php?entry={$entry}&show=comments";
-
- $ml_body = $ml_body . "\n\nPlease visit the following URL for the online version of this message:\n\n" . $ml_url;
-
- if (file_exists("data/items/$entry/member.txt")) {
- $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
- }
-
- if (file_exists("data/ml-footer.txt")) {
- $ml_footer = file_get_contents("data/ml-footer.txt");
- $ml_body = $ml_body . "\n\n" . $ml_footer;
- }
-
- if ($dh_ml_member = opendir("data/members/active")) {
- while (($ml_member = readdir($dh_ml_member)) !== false) {
- if ($ml_member != "." && $ml_member != ".." && fnmatch("*", $ml_member)) {
-
- if (file_exists("data/members/active/$ml_member/noml.txt")) {
- continue;
- }
-
- if (file_exists("data/members/active/$ml_member/vacation.txt")) {
- continue;
- }
-
- $ml_to_firstname = file_get_contents("data/members/active/$ml_member/firstname.txt");
- $ml_to_lastname = file_get_contents("data/members/active/$ml_member/lastname.txt");
- $ml_to = file_get_contents("data/members/active/$ml_member/email.txt");
- $ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
-
- if (file_exists("data/ml-reply2.txt")) {
- mail($ml_to, $ml_subject, $ml_body,
- "From: $ml_from\r\n" .
- "Reply-To: $ml_reply2\r\n" .
- "References: $entry\r\n" .
- "X-Mailer: $ml_mailer");
- }
- else {
- mail($ml_to, $ml_subject, $ml_body,
- "From: $ml_from\r\n" .
- "References: $entry\r\n" .
- "X-Mailer: $ml_mailer");
- }
- }
- }
- closedir($dh_ml_member);
- }
-}
-
-if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on")) {
- if (!file_exists("data/items/$entry/pdf")) {
- mkdir("data/items/$entry/pdf");
- }
- if (!file_exists("data/items/$entry/pdf/file")) {
- mkdir("data/items/$entry/pdf/file");
- }
- if (!file_exists("data/items/$entry/pdf/count")) {
- mkdir("data/items/$entry/pdf/count");
- }
-
- $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("add.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['category']) and !empty($_POST['category']) and file_exists("data/categories/{$_POST['category']}")) {
-
- if (!file_exists("data/items/$entry/categories")) {
- mkdir("data/items/$entry/categories");
- }
-
- if (!file_exists("data/items/$entry/categories/{$_POST['category']}")) {
- mkdir("data/items/$entry/categories/{$_POST['category']}");
- }
-}
-
-
-if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
-
- $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
-
- if (file_exists("data/categories/$bb_cat")) {
-
- if (!file_exists("data/items/$entry/categories")) {
- mkdir("data/items/$entry/categories");
- }
-
- if (!file_exists("data/items/$entry/categories/$bb_cat")) {
- mkdir("data/items/$entry/categories/$bb_cat");
- }
- }
-}
-
-if (isset($_POST['passwd']) and !empty($_POST['passwd'])) {
- if (($_POST['passwd'] == "password") or empty($_POST['passwd'])) {
- unlink("data/items/$entry/passwd.txt");
- }
- else {
- $passwd_crypt = sha1($_POST['passwd']);
- $passwd_crypt = md5($passwd_crypt);
- $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
-
- $fp_passwd_txt = fopen("data/items/$entry/passwd.txt","w");
- fwrite($fp_passwd_txt, $passwd_crypt);
- fclose($fp_passwd_txt);
- }
-}
-
-if (file_exists("data/ping.txt")) {
-
- $ping_urls = file_get_contents("data/ping.txt");
-
- $get_ping_urls = explode("|", $ping_urls);
-
- foreach ($get_ping_urls as $ping_url) {
- $ping = file_get_contents($ping_url);
- unset($ping);
- }
-}
-
+ if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
+ exit();
+ }
+
+ if (!isset($_POST['select_year']) or !isset($_POST['select_month']) or !isset($_POST['select_day']) or !isset($_POST['select_hour']) or !isset($_POST['select_min']) or empty($_POST['select_year']) or empty($_POST['select_month']) or empty($_POST['select_day']) or empty($_POST['select_hour']) or empty($_POST['select_min'])) {
+ $entry = date("YmdHis", time() + $offset);
+ $timestamp = date("l, M j, Y, g:i A", time() + $offset);
+ } else {
+ $entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
+ $timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
+ }
+
+ if (!file_exists("data/items")) {
+ mkdir("data/items");
+ }
+
+ $dir = "data/items/";
+ $item_dir = $dir . $entry;
+
+ if (!file_exists("images")) {
+ mkdir("images");
+ }
+
+ $image_dir = 'images/' . $entry;
+ $file_dir = $item_dir . '/filedrop';
+
+ mkdir($item_dir);
+
+ $title_write_content = format_title_put($_POST['title_input']);
+ $body_write_content = format_body_put($_POST['body_input']);
+
+ $title_file = $item_dir . '/title.txt';
+ $fp_title_txt = fopen($title_file, "w");
+ fwrite($fp_title_txt, $title_write_content);
+ fclose($fp_title_txt);
+
+ $author_file = $item_dir . '/author.txt';
+ $fp_author_txt = fopen($author_file, "w");
+ fwrite($fp_author_txt, $_SESSION['logged_in']);
+ fclose($fp_author_txt);
+
+ if (file_get_contents("data/username.txt") == $_SESSION['logged_in']) {
+ $post_file = "data/lastpost.txt";
+ } elseif (file_exists("data/members/active/{$_SESSION['logged_in']}")) {
+ $post_file = "data/members/active/{$_SESSION['logged_in']}/bb-post.txt";
+ }
+
+ $fp_post_txt = fopen($post_file, "w");
+ fwrite($fp_post_txt, $entry);
+ fclose($fp_post_txt);
+
+ $date_file = $item_dir . '/date.txt';
+ $fp_date_txt = fopen($date_file, "w");
+ fwrite($fp_date_txt, $timestamp);
+ fclose($fp_date_txt);
+
+ if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+ if (is_uploaded_file($_FILES['image_input']['tmp_name'])) {
+ if ($_FILES['image_input']['size'] <= $max_file_size) {
+ if (($_FILES['image_input']['type'] == "image/gif") || ($_FILES['image_input']['type'] == "image/pjpeg") || ($_FILES['image_input']['type'] == "image/jpeg") || ($_FILES['image_input']['type'] == "image/png")) {
+ if (!file_exists($image_dir)) {
+ mkdir($image_dir);
+ }
+
+ $image_input_name = str_replace(" ", "_", $_FILES['image_input']['name']);
+
+ if (!file_exists("$image_dir/$image_input_name")) {
+ $res = copy($_FILES['image_input']['tmp_name'], "$image_dir/$image_input_name");
+ unlink($_FILES['image_input']['tmp_name']);
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['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) {
+ $filedrop_dir = "$item_dir/filedrop";
+
+ if (!file_exists($filedrop_dir)) {
+ mkdir($filedrop_dir);
+ }
+
+ $file_dir = "$filedrop_dir/files";
+
+ if (!file_exists($file_dir)) {
+ mkdir($file_dir);
+ }
+
+ $file_input_name = str_replace(" ", "_", $_FILES['file_input']['name']);
+
+ if (!file_exists("$file_dir/$file_input_name")) {
+ $res = copy($_FILES['file_input']['tmp_name'], "$file_dir/$file_input_name");
+ unlink($_FILES['file_input']['tmp_name']);
+
+
+ $fp_file_txt = fopen("$filedrop_dir/{$file_input_name}.txt", "w");
+ fwrite($fp_file_txt, "$file_dir/$file_input_name");
+ fclose($fp_file_txt);
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ }
+
+
+ $body_file = "$item_dir/body.txt";
+
+ $fp_body_txt = fopen($body_file, "w");
+
+ if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+ if (file_exists("$image_dir/$image_input_name")) {
+ $entry_image_size = getimagesize("$image_dir/$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=\"$image_dir/$image_input_name\" border=\"0\" width=\"$entry_image_width\" height=\"$entry_image_height\"><br>$body_write_content";
+ }
+ }
+
+ fwrite($fp_body_txt, $body_write_content);
+ fclose($fp_body_txt);
+
+ $sticky_sem = "data/sticky/$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);
+ }
+ }
+
+ $display_sem = "data/items/$entry/cat.txt";
+ if (isset($_POST['display']) and !empty($_POST['display']) and ($_POST['display'] == "on")) {
+ if (!file_exists($display_sem)) {
+ touch($display_sem);
+ }
+ }
+
+ $private_sem = "data/items/$entry/private.txt";
+ if (isset($_POST['private']) and !empty($_POST['private']) and ($_POST['private'] == "on")) {
+ if (!file_exists($private_sem)) {
+ touch($private_sem);
+ }
+ }
+
+ if (file_exists("data/bb.txt") and file_exists("data/member.txt") and (($_SESSION['logged_in'] != file_get_contents("data/username.txt")) or (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on")))) {
+ touch("data/items/$entry/member.txt");
+ }
+
+ if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists($private_sem)) {
+ if (file_exists("data/ml-reply2.txt")) {
+ $ml_reply2 = file_get_contents("data/ml-reply2.txt");
+ }
+
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+ $ml_author = file_get_contents("data/author.txt");
+
+ if (file_exists("data/ml-from.txt")) {
+ $ml_from = $ml_reply2;
+ } else {
+ $ml_from = file_get_contents("data/email.txt");
+ }
+
+ $ml_from = '"' . $ml_author . '" <' . $ml_from . '>';
+ }
+
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/bb.txt")) {
+ $ml_from_firstname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt");
+ $ml_from_lastname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt");
+
+ if (file_exists("data/ml-from.txt")) {
+ $ml_from = $ml_reply2;
+ } else {
+ $ml_from = file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt");
+ }
+
+ $ml_from = '"' . "$ml_from_firstname $ml_from_lastname" . '" <' . $ml_from . '>';
+ }
+ }
+
+ $ml_subject = ucfirst($_POST['title_input']);
+ if (file_exists("data/ml-prepend.txt")) {
+ $ml_subject = file_get_contents("data/ml-prepend.txt") . " " . $ml_subject;
+ }
+
+ $ml_mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
+ $ml_body = ucfirst($_POST['body_input']);
+ $ml_body = str_replace('<br />', "\n", $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $ml_body);
+ $ml_body = str_replace('&', '&', $ml_body);
+ $ml_body = str_replace('®', '(R)', $ml_body);
+ $ml_body = strip_tags($ml_body);
+
+ if (file_exists("data/ml-header.txt")) {
+ $ml_header = file_get_contents("data/ml-header.txt");
+ $ml_body = $ml_header . "\n\n" . $ml_body;
+ }
+
+ $ml_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
+ $ml_url = str_replace('//', '/', $ml_url);
+ $ml_url = "http://" . $ml_url . "index.php?entry={$entry}&show=comments";
+
+ $ml_body = $ml_body . "\n\nPlease visit the following URL for the online version of this message:\n\n" . $ml_url;
+
+ if (file_exists("data/items/$entry/member.txt")) {
+ $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
+ }
+
+ if (file_exists("data/ml-footer.txt")) {
+ $ml_footer = file_get_contents("data/ml-footer.txt");
+ $ml_body = $ml_body . "\n\n" . $ml_footer;
+ }
+
+ if ($dh_ml_member = opendir("data/members/active")) {
+ while (($ml_member = readdir($dh_ml_member)) !== false) {
+ if ($ml_member != "." && $ml_member != ".." && fnmatch("*", $ml_member)) {
+ if (file_exists("data/members/active/$ml_member/noml.txt")) {
+ continue;
+ }
+
+ if (file_exists("data/members/active/$ml_member/vacation.txt")) {
+ continue;
+ }
+
+ $ml_to_firstname = file_get_contents("data/members/active/$ml_member/firstname.txt");
+ $ml_to_lastname = file_get_contents("data/members/active/$ml_member/lastname.txt");
+ $ml_to = file_get_contents("data/members/active/$ml_member/email.txt");
+ $ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
+
+ if (file_exists("data/ml-reply2.txt")) {
+ mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ } else {
+ mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ }
+ }
+ }
+ closedir($dh_ml_member);
+ }
+ }
+
+ if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on")) {
+ if (!file_exists("data/items/$entry/pdf")) {
+ mkdir("data/items/$entry/pdf");
+ }
+ if (!file_exists("data/items/$entry/pdf/file")) {
+ mkdir("data/items/$entry/pdf/file");
+ }
+ if (!file_exists("data/items/$entry/pdf/count")) {
+ mkdir("data/items/$entry/pdf/count");
+ }
+
+ $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("add.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";
+
+ $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['category']) and !empty($_POST['category']) and file_exists("data/categories/{$_POST['category']}")) {
+ if (!file_exists("data/items/$entry/categories")) {
+ mkdir("data/items/$entry/categories");
+ }
+
+ if (!file_exists("data/items/$entry/categories/{$_POST['category']}")) {
+ mkdir("data/items/$entry/categories/{$_POST['category']}");
+ }
+ }
+
+
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
+ $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
+ if (file_exists("data/categories/$bb_cat")) {
+ if (!file_exists("data/items/$entry/categories")) {
+ mkdir("data/items/$entry/categories");
+ }
+
+ if (!file_exists("data/items/$entry/categories/$bb_cat")) {
+ mkdir("data/items/$entry/categories/$bb_cat");
+ }
+ }
+ }
+
+ if (isset($_POST['passwd']) and !empty($_POST['passwd'])) {
+ if (($_POST['passwd'] == "password") or empty($_POST['passwd'])) {
+ unlink("data/items/$entry/passwd.txt");
+ } else {
+ $passwd_crypt = sha1($_POST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+
+ $fp_passwd_txt = fopen("data/items/$entry/passwd.txt", "w");
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ }
+ }
+
+ if (file_exists("data/ping.txt")) {
+ $ping_urls = file_get_contents("data/ping.txt");
+
+ $get_ping_urls = explode("|", $ping_urls);
+
+ foreach ($get_ping_urls as $ping_url) {
+ $ping = file_get_contents($ping_url);
+ unset($ping);
+ }
+ }
?>
diff --git a/album.php b/album.php
index 3cc3539..a55bd06 100644
--- a/album.php
+++ b/album.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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 $album_image_exif_key => $album_image_exif_valueue) {
- $data[$album_image_exif_key] = stripslashes_array($album_image_exif_valueue);
- }
- return $data;
- }
- else {
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
-}
-
if (!isset($_REQUEST['entry']) or empty($_REQUEST['entry'])) {
exit();
}
diff --git a/cat.php b/cat.php
index 58ff2bb..da9fb61 100644
--- a/cat.php
+++ b/cat.php
@@ -6,54 +6,18 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$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 (file_exists("data/items")) {
if ($dh_cat_txt = opendir("data/items")) {
diff --git a/colors.php b/colors.php
index 51b48ca..11a33eb 100644
--- a/colors.php
+++ b/colors.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$login_username = file_get_contents("data/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
@@ -50,31 +37,6 @@ if (!file_exists("data/schemes/colors")) {
mkdir("data/schemes/colors");
}
-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($_POST['reset']) and ($_POST['reset'] == "go")) {
rmdirr("data/colors");
diff --git a/core.php b/core.php
new file mode 100644
index 0000000..0d0d919
--- /dev/null
+++ b/core.php
@@ -0,0 +1,267 @@
+<?php
+ // 20100729 - aggregate recurring functions
+
+ if (get_magic_quotes_gpc()) {
+ function stripslashes_array($data) {
+ if (is_array($data)) {
+ foreach ($data as $key => $value) {
+ $data[$key] = stripslashes_array($value);
+ } //foreach ($data as $key => $value)
+ return $data;
+ } //if (is_array($data))
+ else {
+ return stripslashes($data);
+ } //else
+ } //function stripslashes_array($data)
+ $_REQUEST = stripslashes_array($_REQUEST);
+ } //if (get_magic_quotes_gpc())
+
+
+ function rmdirr($dir) {
+ if (!file_exists($dir)) {
+ return false;
+ } //if (!file_exists($dir))
+
+ if (is_file($dir)) {
+ return unlink($dir);
+ } //if (is_file($dir))
+
+ $recurse = dir($dir);
+
+ while (false !== $entry = $recurse->read()) {
+ if ($entry == '.' || $entry == '..') {
+ continue;
+ } //if ($entry == '.' || $entry == '..')
+
+ rmdirr("$dir/$entry");
+ } //while (false !== $entry = $recurse->read())
+
+ $recurse->close();
+ return rmdir($dir);
+ } //function rmdirr($dir)
+
+
+ function return_bytes($val) {
+ $val = trim($val);
+ $last = $val{strlen($val) - 1};
+
+ switch ($last) {
+ case 'k':
+ case 'K':
+ return(int)$val * 1024;
+ break;
+ case 'm':
+ case 'M':
+ return(int)$val * 1048576;
+ break;
+ default:
+ return $val;
+ } //switch ($last)
+ } //function return_bytes($val)
+
+
+ function entry2date($entry) {
+ $entry_year = substr($entry, 0, 4);
+ $entry_month = substr($entry, 4, 2);
+ $entry_day = substr($entry, 6, 2);
+ $entry_hour = substr($entry, 8, 2);
+ $entry_min = substr($entry, 10, 2);
+ $entry_sec = substr($entry, 12, 2);
+
+ echo date("l, M j, Y, g:i A", mktime($entry_hour, $entry_min, $entry_sec, $entry_month, $entry_day, $entry_year));
+ } //function entry2date($entry)
+
+
+ function reformat_html($data) {
+ $store_0 = split("<html>", $data);
+ $data = "";
+ $data .= $store_0[0];
+
+ foreach ($store_0 as $item_0 => $ref_0) {
+ if (eregi("</html>", $ref_0)) {
+ $store_1 = split("</html>", $ref_0);
+ $store_1[0] = eregi_replace("\n", "", $store_1[0]);
+
+ foreach ($store_1 as $item_1 => $ref_1) {
+ if ($item_1 == 0)
+ $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
+ $data .= $ref_1;
+ } //foreach ($store_1 as $item_1 => $ref_1)
+ } //if (eregi("</html>", $ref_0))
+ } //foreach ($store_0 as $item_0 => $ref_0)
+ return $data;
+ } //function reformat_html($data)
+
+
+ function reformat_code($data) {
+ $store_0 = split("<code>", $data);
+ $data = "";
+ $data .= $store_0[0];
+
+ foreach ($store_0 as $item_0 => $ref_0) {
+ if (eregi("</code>", $ref_0)) {
+ $store_1 = split("</code>", $ref_0);
+ $store_1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">', ':((', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">', ':(', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">', ':P', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">', ':)', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">', ';)', $store_1[0]);
+ $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
+
+ foreach ($store_1 as $item_1 => $ref_1) {
+ if ($item_1 == 0)
+ $ref_1 = "<code>$ref_1</code>";
+ $data .= $ref_1;
+ } //foreach ($store_1 as $item_1 => $ref_1)
+ } //if (eregi("</code>", $ref_0))
+ } //foreach ($store_0 as $item_0 => $ref_0)
+ return $data;
+ } //function reformat_code($data)
+
+
+ function format_title_put($data) {
+ // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
+ $data = ucwords($data);
+ $data = str_replace('<', '<', $data);
+ $data = str_replace('>', '>', $data);
+ $data = str_replace(' A ', ' a ', $data);
+ $data = str_replace(' An ', ' an ', $data);
+ $data = str_replace(' And ', ' and ', $data);
+ $data = str_replace(' As ', ' as ', $data);
+ $data = str_replace(' At ', ' at ', $data);
+ $data = str_replace(' But ', ' but ', $data);
+ $data = str_replace(' By ', ' by ', $data);
+ $data = str_replace(' For ', ' for ', $data);
+ $data = str_replace(' In ', ' in ', $data);
+ $data = str_replace(' Of ', ' of ', $data);
+ $data = str_replace(' On ', ' on ', $data);
+ $data = str_replace(' Or ', ' or ', $data);
+ $data = str_replace(' The ', ' the ', $data);
+ $data = str_replace(' To ', ' to ', $data);
+
+ return $data;
+ } //function format_title_put($data)
+
+
+ function format_body_put($data) {
+ $data = ucfirst($data);
+ $data = str_replace("[html]", '<html>', $data);
+ $data = str_replace("[/html]", '</html>', $data);
+ $data = reformat_html($data);
+ $data = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $data);
+ $data = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $data);
+ $data = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $data);
+ $data = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $data);
+ $data = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $data);
+ $data = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $data);
+ $data = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $data);
+ $data = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $data);
+ $data = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $data);
+ $data = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $data);
+ $data = str_replace('[code]', '<code>', $data);
+ $data = str_replace('[/code]', '</code>', $data);
+ $data = reformat_code($data);
+ $data = str_replace("\n", '<br />', $data);
+ $data = str_replace('[b]', '<b>', $data);
+ $data = str_replace('[/b]', '</b>', $data);
+ $data = str_replace('[i]', '<i>', $data);
+ $data = str_replace('[/i]', '</i>', $data);
+ $data = str_replace('[u]', '<u>', $data);
+ $data = str_replace('[/u]', '</u>', $data);
+ $data = str_replace('[strike]', '<strike>', $data);
+ $data = str_replace('[/strike]', '</strike>', $data);
+ $data = str_replace('[sup]', '<sup>', $data);
+ $data = str_replace('[/sup]', '</sup>', $data);
+ $data = str_replace('[sub]', '<sub>', $data);
+ $data = str_replace('[/sub]', '</sub>', $data);
+ $data = str_replace('[highlight]', '<highlight>', $data);
+ $data = str_replace('[/highlight]', '</highlight>', $data);
+ $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
+ $data = str_replace('</highlight>', '</span>', $data);
+ $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
+
+ return $data;
+ } //function format_body_put($data)
+
+
+ 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 PDF($orientation = 'P', $unit = 'mm', $format = 'letter')
+
+ 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);
+ } //if ($i % 2 == 0)
+ 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);
+ } //else
+ } //else
+ } //foreach ($a as $i => $e)
+ } //function WriteHTML($html)
+
+ 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 OpenTag($tag, $attr)
+
+ function CloseTag($tag) {
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U')
+ $this->SetStyle($tag, false);
+ if ($tag == 'A')
+ $this->HREF = '';
+ } //function CloseTag($tag)
+
+ 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 SetStyle($tag, $enable)
+
+ 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);
+ } //function PutLink($URL, $txt)
+ } //class PDF extends FPDF
+?>
diff --git a/css.php b/css.php
index 161ed68..d5321b0 100644
--- a/css.php
+++ b/css.php
@@ -1,114 +1,141 @@
<?php
if (file_exists("data/fonts/body-size.txt")) {
- $maj_body_px = file_get_contents("data/fonts/body-size.txt") . "px";
+ $maj_font_Dpx = file_get_contents("data/fonts/body-size.txt") . "px";
}
else {
- $maj_body_px = "11px";
+ $maj_font_Dpx = "11px";
}
if (file_exists("data/fonts/input-size.txt")) {
- $maj_input_px = file_get_contents("data/fonts/input-size.txt") . "px";
+ $maj_font_Ipx = file_get_contents("data/fonts/input-size.txt") . "px";
}
else {
- $maj_input_px = "11px";
+ $maj_font_Ipx = "11px";
}
if (file_exists("data/fonts/panel-title-size.txt")) {
- $maj_font_12px = file_get_contents("data/fonts/panel-title-size.txt") . "px";
+ $maj_font_Lpx = file_get_contents("data/fonts/panel-title-size.txt") . "px";
}
else {
- $maj_font_12px = "12px";
+ $maj_font_Lpx = "12px";
}
if (file_exists("data/fonts/panel-body-size.txt")) {
- $maj_font_11px = file_get_contents("data/fonts/panel-body-size.txt") . "px";
+ $maj_font_Mpx = file_get_contents("data/fonts/panel-body-size.txt") . "px";
}
else {
- $maj_font_11px = "11px";
+ $maj_font_Mpx = "11px";
}
if (file_exists("data/fonts/panel-footer-size.txt")) {
- $maj_font_10px = file_get_contents("data/fonts/panel-footer-size.txt") . "px";
+ $maj_font_Spx = file_get_contents("data/fonts/panel-footer-size.txt") . "px";
}
else {
- $maj_font_10px = "10px";
+ $maj_font_Spx = "10px";
+}
+
+if (file_exists("data/round.txt")) {
+ $maj_border_radius = file_get_contents("data/round.txt") . "px";
+}
+else {
+ $maj_border_radius = "5px";
}
?>
<style>
-html {
- font-size: <?php echo $maj_font_11px; ?>;
+* {
+ font-size: <?php echo $maj_font_Mpx; ?>;
}
body {
- margin: 0px 0px 10px 10px;
padding: 0px;
+ margin: 0px 0px 10px 10px;
+ color: #666666;
+ background-color: #ffffff;
text-align: left;
+ font-family: arial,helvetica,sans-serif;
+ <?php
- font-size: <?php echo $maj_body_px; ?>;
-
- color: <?php
- if (file_exists("data/colors/font.txt")) {
- $maj_font_color = file_get_contents("data/colors/font.txt");
- echo $maj_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $maj_font_body = file_get_contents("data/fonts/body.txt");
- echo "{$maj_font_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- background-color: <?php
- if (file_exists("data/colors/bg.txt")) {
- $maj_background_color = file_get_contents("data/colors/bg.txt");
- if ($maj_background_color == "transparent") {
- echo "#ffffff";
- }
- else {
- echo $maj_background_color;
- }
- }
- else {
- echo "#ffffff";
- }
- ?>;
+ echo "font-size: $maj_font_Dpx;";
- <?php
- if (file_exists("images/background.gif") and !file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
- background-image: url('images/background.gif');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
- }
- if (!file_exists("images/background.gif") and file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
- background-image: url('images/background.jpg');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
- }
- if (!file_exists("images/background.gif") and !file_exists("images/background.jpg") and file_exists("images/background.png")) { ?>
- background-image: url('images/background.png');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
+ if (file_exists("data/colors/font.txt")) {
+ $maj_font_color = file_get_contents("data/colors/font.txt");
+ echo "\n\tcolor: $maj_font_color;";
+ }
+
+ if (file_exists("data/fonts/body.txt")) {
+ $maj_font_body = file_get_contents("data/fonts/body.txt");
+ echo "\n\tfont-family: $maj_font_body,arial,helvetica,sans-serif;";
}
+
+ if (file_exists("data/colors/bg.txt")) {
+ $maj_background_color = file_get_contents("data/colors/bg.txt");
+ if ($maj_background_color == "transparent") {
+ echo "\n\tbackground-color: #ffffff;";
+ }
+ else {
+ echo "\n\tbackground-color: $maj_background_color;";
+ }
+ }
+
+ if (file_exists("images/background.gif") or file_exists("images/background.jpg") or file_exists("images/background.png")) {
+
+ if (file_exists("images/background.gif") and !file_exists("images/background.jpg") and !file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.gif\");";
+ }
+
+ if (!file_exists("images/background.gif") and file_exists("images/background.jpg") and !file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.jpg\");";
+ }
+
+ if (!file_exists("images/background.gif") and !file_exists("images/background.jpg") and file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.png\");";
+ }
+
+ echo "\n\tbackground-attachment: ";
+
+ if (file_exists("data/bg-scroll.txt")) {
+ echo "scroll";
+ }
+ else {
+ echo "fixed";
+ }
+
+ echo ";";
+
+ echo "\n\tbackground-repeat: ";
+
+ if (file_exists("data/bg-repeat.txt")) {
+ readfile("data/bg-repeat.txt");
+ }
+ else {
+ echo "repeat";
+ }
+
+ echo ";";
+
+ echo "\n\tbackground-position: ";
+
+ if (file_exists("data/bg-position.txt")) {
+ readfile("data/bg-position.txt");
+ }
+ else {
+ echo "top left";
+ }
+
+ echo ";";
+ }
+
+ echo "\n";
+
?>
}
p,td {
- font-size: <?php echo $maj_font_11px; ?>;
+ font-size: <?php echo $maj_font_Mpx; ?>;
}
a {
@@ -117,51 +144,59 @@ a {
}
a:link {
- color: <?php
- if (file_exists("data/colors/link.txt")) {
- $maj_a_link_color = file_get_contents("data/colors/link.txt");
- echo $maj_a_link_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ color: #666666;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/link.txt")) {
+ $maj_a_link_color = file_get_contents("data/colors/link.txt");
+ echo "\tcolor: $maj_a_link_color;\n";
+ }
+
+ ?>
}
a:visited {
- color: <?php
- if (file_exists("data/colors/vlink.txt")) {
- $maj_a_visited_color = file_get_contents("data/colors/vlink.txt");
- echo $maj_a_visited_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ color: #666666;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/vlink.txt")) {
+ $maj_a_visited_color = file_get_contents("data/colors/vlink.txt");
+ echo "\tcolor: $maj_a_visited_color;\n";
+ }
+
+ ?>
}
a:hover {
- color: <?php
- if (file_exists("data/colors/hover.txt")) {
- $maj_a_hover_color = file_get_contents("data/colors/hover.txt");
- echo $maj_a_hover_color;
- }
- else {
- echo "#336699";
- }
- ?>;
+ color: #336699;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/hover.txt")) {
+ $maj_a_hover_color = file_get_contents("data/colors/hover.txt");
+ echo "\tcolor: $maj_a_hover_color;\n";
+ }
+
+ ?>
}
a:active {
- color: <?php
- if (file_exists("data/colors/hover.txt")) {
- $maj_a_active_color = file_get_contents("data/colors/hover.txt");
- echo $maj_a_active_color;
- }
- else {
- echo "#336699";
- }
- ?>;
+ color: #336699;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/hover.txt")) {
+ $maj_a_active_color = file_get_contents("data/colors/hover.txt");
+ echo "\tcolor: $maj_a_active_color;\n";
+ }
+
+ ?>
}
a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
@@ -170,543 +205,282 @@ a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
}
.panel_title {
- padding: 5px 5px 5px 5px;
- margin: 0px 0px 0px 0px;
+ padding: 5px;
+ margin: 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
border-width: 1px 1px 0px 1px;
border-style: solid solid none solid;
+ font-family: arial,helvetica,sans-serif;
font-weight: bold;
+ <?php
+
+ echo "font-size: $maj_font_Lpx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-top-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-top-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-topright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-topleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-topright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-topleft: $maj_border_radius;";
+ echo "\n\tborder-top-right-radius: $maj_border_radius;";
+ echo "\n\tborder-top-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pt-font.txt")) {
+ $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
+ echo "\n\tcolor: $maj_panel_title_font_color;";
+ }
- font-size: <?php echo $maj_font_12px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$maj_font_panel_title},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pt-font.txt")) {
- $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
- echo $maj_panel_title_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/colors/pt-bg.txt")) {
+ $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_title_background_color;";
+ }
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_title_border_color;";
+ }
+
+ if (file_exists("data/fonts/panel-title.txt")) {
+ $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
+ echo "\n\tfont-family: $maj_font_panel_title,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.panel_body {
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$maj_font_panel_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pb-font.txt")) {
- $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
- echo $maj_panel_body_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
+ padding: 5px;
+ margin: 0px 0px 10px 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 1px;
+ border-style: solid;
+ font-family: arial,helvetica,sans-serif;
<?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+
+ echo "font-size: $maj_font_Mpx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-bottom-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-bottom-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\tborder-bottom-right-radius: $maj_border_radius;";
+ echo "\n\tborder-bottom-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pb-font.txt")) {
+ $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
+ echo "\n\tcolor: $maj_panel_body_font_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_body_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
+ if (file_exists("data/colors/pb-bg.txt")) {
+ $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_body_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'margin: 0px 0px 0px 0px;';
- }
- else {
- echo 'margin: 0px 0px 10px 0px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_body_border_color;";
+ }
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_body_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-body.txt")) {
+ $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
+ echo "\n\tfont-family: $maj_font_panel_body,arial,helvetica,sans-serif;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 1px 1px 1px 1px;';
- echo 'border-style: solid solid solid solid;';
- }
+ echo "\n";
+
?>
}
.panel_footer {
+ padding: 5px;
+ margin: 0px 0px 10px 0px;
+ color: #999999;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 0px 1px 1px 1px;
+ border-style: none solid solid solid;
text-align: right;
-
- font-size: <?php echo $maj_font_10px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $maj_font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$maj_font_panel_footer},";
- }
- ?> arial,helvetica,sans-serif;
-
-
-
- color: <?php
- if (file_exists("data/colors/pf-font.txt")) {
- $maj_panel_footer_font_color = file_get_contents("data/colors/pf-font.txt");
- echo $maj_panel_footer_font_color;
- }
- else {
- echo "#999999";
- }
- ?>;
-
+ font-family: arial,helvetica,sans-serif;
<?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+
+ echo "font-size: $maj_font_Spx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-bottom-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-bottom-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\tborder-bottom-right-radius: $maj_border_radius;";
+ echo "\n\tborder-bottom-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pf-font.txt")) {
+ $maj_panel_footer_font_color = file_get_contents("data/colors/pf-font.txt");
+ echo "\n\tcolor: $maj_panel_footer_font_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_footer_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_footer_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
+ if (file_exists("data/colors/pf-bg.txt")) {
+ $maj_panel_footer_background_color = file_get_contents("data/colors/pf-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_footer_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'margin: 0px 0px 0px 0px;';
- }
- else {
- echo 'margin: 0px 0px 10px 0px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_footer_border_color;";
+ }
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_footer_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-footer.txt")) {
+ $maj_font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
+ echo "\n\tfont-family: $maj_font_panel_footer,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 0px 1px 1px 1px;';
- echo 'border-style: none solid solid solid;';
- }
?>
}
.input {
width: 300px;
+ color: #666666;
background: #ffffff;
+ border: #999999 solid 1px;
+ font-family: arial,helvetica,sans-serif;
+ <?php
+
+ echo "font-size: $maj_font_Ipx;";
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_input_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tcolor: $maj_input_color;";
+ }
- font-size: <?php echo $maj_input_px; ?>;
-
- color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_input_color = file_get_contents("data/colors/border.txt");
- echo $maj_input_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- border: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_footer_border_color;
- }
- else {
- echo "#999999";
- }
- ?> solid 1px;
-
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $maj_font_input = file_get_contents("data/fonts/input.txt");
- echo "{$maj_font_input},";
- }
- ?> arial,helvetica,sans-serif;
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_footer_border_color;";
+ }
+
+ if (file_exists("data/fonts/input.txt")) {
+ $maj_font_input = file_get_contents("data/fonts/input.txt");
+ echo "\n\tfont-family: $maj_font_input,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.search {
+ width: 100%;
color: #666666;
background: #ffffff;
- width: 100%;
-
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $maj_font_input = file_get_contents("data/fonts/input.txt");
- echo "{$maj_font_input},";
- }
- ?> arial,helvetica,sans-serif;
+ font-family: arial,helvetica,sans-serif;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;";
+
+ if (file_exists("data/fonts/input.txt")) {
+ $maj_font_input = file_get_contents("data/fonts/input.txt");
+ echo "\n\tfont-family: $maj_font_input,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.panel_free {
- padding: 0px 0px 0px 0px;
- margin: 0px 0px 0px 0px;
+ padding: 0px;
+ margin: 0px;
}
-.rbtop {
- display: block;
- background: transparent;
- font-size: 1px;
- margin: 0px 0px 0px 0px;
-}
-
-.rbbottom {
- display: block;
- background: transparent;
- font-size: 1px;
- margin: 0px 0px 10px 0px;
-}
-
-.rb1t,.rb2t,.rb3t,.rb4t,.rb1b,.rb2b,.rb3b,.rb4b,.rb1e,.rb2e,.rb3e,.rb4e {
- display: block;
- overflow: hidden;
-}
-
-.rb1t,.rb2t,.rb3t,.rb1b,.rb2b,.rb3b,.rb1e,.rb2e,.rb3e {
- height: 1px;
-}
-
-.rb2t,.rb3t,.rb4t {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb2b,.rb3b,.rb4b {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
+.panel_entry_body {
+ padding: 5px;
+ margin: 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 1px;
+ border-style: solid;
+ font-family: arial,helvetica,sans-serif;
+ <?php
-.rb2e,.rb3e,.rb4e {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb1t,.rb1b,.rb1e {
- margin: 0 5px;
-
- background: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb2t,.rb2b,.rb2e {
- margin: 0 3px;
- border-width: 0 2px;
-}
-
-.rb3t,.rb3b,.rb3e {
- margin: 0 2px;
-}
-
-.rb4t,.rb4b,.rb4e {
- height: 2px;
- margin: 0 1px;
-}
-
-.xtitle {
- display: block;
- border:0 solid;
- border-width:0 1px;
- padding: 1px 5px 5px 5px;
- font-weight: bold;
+ echo "font-size: $maj_font_Mpx;";
- font-size: <?php echo $maj_font_12px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$maj_font_panel_title},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pt-font.txt")) {
- $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
- echo $maj_panel_title_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rbspace {
- height: 3px;
-}
+ if (file_exists("data/colors/pb-font.txt")) {
+ $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
+ echo "\n\tcolor: $maj_panel_body_font_color;";
+ }
-.panel_entry_body {
- margin: 0px 0px 0px 0px;
-
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$maj_font_panel_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pb-font.txt")) {
- $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
- echo $maj_panel_body_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ if (file_exists("data/colors/pb-bg.txt")) {
+ $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_body_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_body_border_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_body_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_body_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-body.txt")) {
+ $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
+ echo "\n\tfont-family: $maj_font_panel_body,arial,helvetica,sans-serif;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 1px 1px 1px 1px;';
- echo 'border-style: solid solid solid solid;';
- }
+ echo "\n";
+
?>
}
.panel_category {
- padding: 5px 5px 5px 5px;
- margin: 0px 0px 0px 0px;
+ padding: 5px;
+ margin: 0px;
+ color: #999999;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 0px 1px 1px 1px;
+ border-style: none solid solid solid;
text-align: left;
+ font-family: arial,helvetica,sans-serif;
+ <?php
- font-size: <?php echo $maj_font_10px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $maj_font_panel_category = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$maj_font_panel_category},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pf-font.txt")) {
- $maj_panel_category_font_color = file_get_contents("data/colors/pf-font.txt");
- echo $maj_panel_category_font_color;
- }
- else {
- echo "#999999";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_category_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_category_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_category_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_category_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ echo "font-size: $maj_font_Spx;";
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 0px 1px 1px 1px;';
- echo 'border-style: none solid solid solid;';
- }
+ if (file_exists("data/colors/pf-font.txt")) {
+ $maj_panel_category_font_color = file_get_contents("data/colors/pf-font.txt");
+ echo "\n\tcolor: $maj_panel_category_font_color;";
+ }
+
+ if (file_exists("data/colors/pf-bg.txt")) {
+ $maj_panel_category_background_color = file_get_contents("data/colors/pf-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_category_background_color;";
+ }
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_category_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_category_border_color;";
+ }
+
+ if (file_exists("data/fonts/panel-footer.txt")) {
+ $maj_font_panel_category = file_get_contents("data/fonts/panel-footer.txt");
+ echo "\n\tfont-family: $maj_font_panel_category,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
?>
}
diff --git a/del.php b/del.php
index b3f9fc3..631d53f 100644
--- a/del.php
+++ b/del.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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 (file_exists("data/offset.txt")) {
@@ -34,31 +21,6 @@ else {
$offset = 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);
-}
-
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['target']) and !empty($_REQUEST['target'])) {
diff --git a/dig.php b/dig.php
index 5c90d8d..90ca003 100644
--- a/dig.php
+++ b/dig.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
if (file_exists("data/offset.txt")) {
$offset = file_get_contents("data/offset.txt");
}
diff --git a/edit.php b/edit.php
index 528f03a..028d32f 100644
--- a/edit.php
+++ b/edit.php
@@ -1,140 +1,71 @@
<?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'])) {
- exit();
-}
-
-if (!file_exists("data/items/{$_REQUEST['entry']}")) {
- exit();
-}
-
-if (!isset($_SESSION['logged_in'])) {
- exit();
-}
-
-$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) {
- 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);
-}
-
-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);
- $last = $val{strlen($val)-1};
-
- 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;
-}
-
+ session_start();
+
+ header("Cache-control: private");
+
+ error_reporting(E_ERROR);
+
+ require("core.php");
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+ header("Location: login.php");
+ }
+
+ $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'])) {
+ exit();
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}")) {
+ exit();
+ }
+
+ if (!isset($_SESSION['logged_in'])) {
+ exit();
+ }
+
+ $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) {
+ exit();
+ }
+
+ $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";
+
+ $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>
@@ -142,373 +73,371 @@ if ($server_post_max_size > $server_memory_limit) {
<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;
+ 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;
+ font-size: 11px;
}
a {
- font-weight: bold;
- text-decoration: none;
+ font-weight: bold;
+ text-decoration: none;
}
a:link, a:visited {
- color: #666666;
+ color: #666666;
}
a:hover {
- color: #336699;
+ color: #336699;
}
a:active {
- color: #336699;
+ 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_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
+.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;
+ 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;
+ 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;
+ 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
+.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"); } ?>
+<?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")) {
- mkdir("data/items/{$_REQUEST['entry']}/members");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
- mkdir("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/imembers")) {
- mkdir("data/items/{$_REQUEST['entry']}/imembers");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
- mkdir("data/items/{$_REQUEST['entry']}/imembers/{$_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 (file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
- rmdirr("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}");
- }
- }
-}
-
-if (isset($_POST['category']) and !empty($_POST['category'])) {
-
- if (file_exists("data/categories/{$_REQUEST['category']}/members")) {
-
- if ($dh_cat_members = opendir("data/categories/{$_REQUEST['category']}/members")) {
-
- while (($get_cat_member = readdir($dh_cat_members)) !== false) {
-
- if ($get_cat_member != "." && $get_cat_member != "..") {
-
- if (file_exists("data/members/active/$get_cat_member")) {
- $get_cat_members[] = $get_cat_member;
- }
- else {
- rmdirr("data/categories/{$_REQUEST['category']}/members/$get_cat_member");
- }
- }
- }
- closedir($dh_cat_members);
- }
- }
-
- 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 (file_exists("data/categories")) {
-
- if ($dh_get_categories = opendir("data/categories")) {
-
- while (($get_category = readdir($dh_get_categories)) !== false) {
-
- if ($get_category != "." && $get_category != "..") {
- $get_categories[] = $get_category;
- }
- }
- closedir($dh_get_categories);
- }
-
- foreach ($get_cat_members as $get_cat_mem) {
-
- $count_mem = 0;
-
- foreach ($get_categories as $get_category) {
-
- if (file_exists("data/categories/$get_category/members/$get_cat_mem") and ($_REQUEST['category'] != $get_category) and file_exists("data/items/{$_REQUEST['entry']}/categories/$get_category")) {
- $count_mem = $count_mem + 1;
- }
- }
-
- if (($count_mem < 1) and !file_exists("data/items/{$_REQUEST['entry']}/imembers/$get_cat_mem")) {
- rmdirr("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
- }
- }
-
- }
- }
-
- 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']}");
-
- foreach ($get_cat_members as $get_cat_mem) {
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/$get_cat_mem")) {
- mkdir("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
- }
- }
- }
-}
-
-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";
- $open_comment_txt_file = fopen($comment_txt_file,"w");
- fwrite($open_comment_txt_file,$comment_txt);
- fclose($open_comment_txt_file);
-
- $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt";
- $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
- $comment_revisions_count = fread($fp_comment_revisions_file, filesize($comment_revisions_file));
- fclose($fp_comment_revisions_file);
-
- $comment_revisions_count = $comment_revisions_count + 1;
- $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
- fwrite($fp_comment_revisions_file, $comment_revisions_count);
- fclose($fp_comment_revisions_file);
-}
-
-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']}")) {
- exit();
- }
-
+ 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")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/imembers")) {
+ mkdir("data/items/{$_REQUEST['entry']}/imembers");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
+ mkdir("data/items/{$_REQUEST['entry']}/imembers/{$_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 (file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
+ rmdirr("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}");
+ }
+ }
+ }
+
+ if (isset($_POST['category']) and !empty($_POST['category'])) {
+ if (file_exists("data/categories/{$_REQUEST['category']}/members")) {
+ if ($dh_cat_members = opendir("data/categories/{$_REQUEST['category']}/members")) {
+ while (($get_cat_member = readdir($dh_cat_members)) !== false) {
+ if ($get_cat_member != "." && $get_cat_member != "..") {
+ if (file_exists("data/members/active/$get_cat_member")) {
+ $get_cat_members[] = $get_cat_member;
+ } else {
+ rmdirr("data/categories/{$_REQUEST['category']}/members/$get_cat_member");
+ }
+ }
+ }
+ closedir($dh_cat_members);
+ }
+ }
+
+ 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 (file_exists("data/categories")) {
+ if ($dh_get_categories = opendir("data/categories")) {
+ while (($get_category = readdir($dh_get_categories)) !== false) {
+ if ($get_category != "." && $get_category != "..") {
+ $get_categories[] = $get_category;
+ }
+ }
+ closedir($dh_get_categories);
+ }
+
+ foreach ($get_cat_members as $get_cat_mem) {
+ $count_mem = 0;
+
+ foreach ($get_categories as $get_category) {
+ if (file_exists("data/categories/$get_category/members/$get_cat_mem") and ($_REQUEST['category'] != $get_category) and file_exists("data/items/{$_REQUEST['entry']}/categories/$get_category")) {
+ $count_mem = $count_mem + 1;
+ }
+ }
+
+ if (($count_mem < 1) and !file_exists("data/items/{$_REQUEST['entry']}/imembers/$get_cat_mem")) {
+ rmdirr("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
+ }
+ }
+ }
+ }
+
+ 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']}");
+
+ foreach ($get_cat_members as $get_cat_mem) {
+ if (!file_exists("data/items/{$_REQUEST['entry']}/members/$get_cat_mem")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
+ }
+ }
+ }
+ }
+
+ 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";
+ $open_comment_txt_file = fopen($comment_txt_file, "w");
+ fwrite($open_comment_txt_file, $comment_txt);
+ fclose($open_comment_txt_file);
+
+ $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt";
+ $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
+ $comment_revisions_count = fread($fp_comment_revisions_file, filesize($comment_revisions_file));
+ fclose($fp_comment_revisions_file);
+
+ $comment_revisions_count = $comment_revisions_count + 1;
+ $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
+ fwrite($fp_comment_revisions_file, $comment_revisions_count);
+ fclose($fp_comment_revisions_file);
+ }
+
+ 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']}")) {
+ exit();
+ }
?>
- <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>
- <div id="panel_footer"><font style="font-size: 10px; color: #999999;">
- <?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";
- $open_comment_txt_file = fopen($comment_txt_file,"r");
- $read_comment_txt_file = fread($open_comment_txt_file,filesize($comment_txt_file));
- fclose($open_comment_txt_file);
-
- $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>
+ <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>
+ <div id="panel_footer"><font style="font-size: 10px; color: #999999;">
+ <?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";
+ $open_comment_txt_file = fopen($comment_txt_file, "r");
+ $read_comment_txt_file = fread($open_comment_txt_file, filesize($comment_txt_file));
+ fclose($open_comment_txt_file);
+
+ $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
- exit();
-}
-
+ exit();
+ }
?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc"><tr><td width="525">
-<div id="panel_title"><?php readfile($title_file); ?></div>
-<div id="panel_body"><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php readfile($body_file); ?></td></tr></table></div>
-<div id="panel_footer"><font style="font-size: 10px; color: #999999;"><?php
-
-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 ')';
-}
-
+<div id="panel_title"><?php
+ readfile($title_file);
+?></div>
+<div id="panel_body"><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php
+ readfile($body_file);
+?></td></tr></table></div>
+<div id="panel_footer"><font style="font-size: 10px; color: #999999;"><?php
+ 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>
@@ -518,128 +447,180 @@ if (file_exists($revisions_file)) {
<p><table border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
-<?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"))) { ?>
+<?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; ?>">
+<input type="hidden" name="max_file_size" value="<?php
+ echo $max_file_size;
+?>">
<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 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 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 } ?>
+ <tr><td><input autocomplete="off" type="password" name="passwd" <?php
+ if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "value=\"password\"";
+ }
+?>
- <?php
+ > <?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 "\"";
+ }
+?>
- if (file_exists("data/bb.txt") and file_exists("data/wiki.txt")) { ?>
+ > <?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="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>
+ <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
+ }
+?>
- }
+ <?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>
+ <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 } ?>
+<?php
+ }
+?>
</table></p>
-<input type="hidden" name="entry" value="<?php echo $_REQUEST['entry']; ?>">
+<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><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
-
-$open_body_file = fopen($body_file,"r");
-$read_body_file = fread($open_body_file,filesize($body_file));
-fclose($open_body_file);
-
-$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;
-
+<?php
+ $open_body_file = fopen($body_file, "r");
+ $read_body_file = fread($open_body_file, filesize($body_file));
+ fclose($open_body_file);
+
+ $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">
+<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>
@@ -669,848 +650,614 @@ echo $body_read_content;
</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 != "..") {
-
- 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 != "..") {
-
- if (file_exists("data/members/active/$ack_member")) {
- $ack_members[] = $ack_member;
- }
- else {
- rmdirr("data/items/{$_REQUEST['entry']}/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
-
+ // 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 != "..") {
+ 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 != "..") {
+ if (file_exists("data/members/active/$ack_member")) {
+ $ack_members[] = $ack_member;
+ } else {
+ rmdirr("data/items/{$_REQUEST['entry']}/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'])) {
- exit();
-}
-
-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);
-
-$fp_revisions_file = fopen($revisions_file, "r");
-$revisions_count = fread($fp_revisions_file, filesize($revisions_file));
-fclose($fp_revisions_file);
-
-$revisions_count = $revisions_count + 1;
-
-$fp_revisions_file = fopen($revisions_file, "w");
-fwrite($fp_revisions_file, $revisions_count);
-fclose($fp_revisions_file);
-
-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");
- fwrite($fp_caption_txt,$caption_txt);
- fclose($fp_caption_txt);
- }
- }
-
- $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']);
-
- $fp_file_txt = fopen("data/items/{$_REQUEST['entry']}/filedrop/{$file_input_name}.txt","w");
- fwrite($fp_file_txt,"data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name");
- fclose($fp_file_txt);
- }
- 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;
- }
-
- $ddate = date("YmdHis", time() + $offset);
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
- }
-
- $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
- fwrite($new_body,$body_write_content);
- fclose($new_body);
-
- $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
- fwrite($new_title,$title_write_content);
- fclose($new_title);
-
- copy("data/items/{$_REQUEST['entry']}/title.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/ptitle.txt");
- 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");
- }
-
- $open_editor_file = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/editor.txt","w");
- fwrite($open_editor_file,$_SESSION['logged_in']);
- fclose($open_editor_file);
- }
-}
-
-$open_title_file = fopen($title_file,"w");
-fwrite($open_title_file,$title_write_content);
-fclose($open_title_file);
-
-$open_body_file = fopen($body_file,"w");
-fwrite($open_body_file,$body_write_content);
-fclose($open_body_file);
-
-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']))) {
- $open_contrib_file = fopen("data/items/{$_REQUEST['entry']}/contrib.txt","w");
- fwrite($open_contrib_file,$_SESSION['logged_in']);
- fclose($open_contrib_file);
-}
-
-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")) {
- $fp_passwd_txt = fopen("$passwd_file","w");
- $passwd_crypt = sha1($_POST['passwd']);
- $passwd_crypt = md5($passwd_crypt);
- $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
- fwrite($fp_passwd_txt, $passwd_crypt);
- fclose($fp_passwd_txt);
- }
-
- 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'])) {
- $fp_maxlines_txt = fopen("data/items/{$_REQUEST['entry']}/maxlines.txt","w");
- fwrite($fp_maxlines_txt, $_POST['maxlines']);
- fclose($fp_maxlines_txt);
- }
-
- 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");
-}
-
-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);
- }
-}
-
+ if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
+ exit();
+ }
+
+ 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");
+
+ $title_write_content = format_title_put($_POST['title_input']);
+ $body_write_content = format_body_put($_POST['body_input']);
+
+ $fp_revisions_file = fopen($revisions_file, "r");
+ $revisions_count = fread($fp_revisions_file, filesize($revisions_file));
+ fclose($fp_revisions_file);
+
+ $revisions_count = $revisions_count + 1;
+
+ $fp_revisions_file = fopen($revisions_file, "w");
+ fwrite($fp_revisions_file, $revisions_count);
+ fclose($fp_revisions_file);
+
+ 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");
+ fwrite($fp_caption_txt, $caption_txt);
+ fclose($fp_caption_txt);
+ }
+ }
+
+
+ $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']);
+
+
+ $fp_file_txt = fopen("data/items/{$_REQUEST['entry']}/filedrop/{$file_input_name}.txt", "w");
+ fwrite($fp_file_txt, "data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name");
+ fclose($fp_file_txt);
+ } 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;
+ }
+
+ $ddate = date("YmdHis", time() + $offset);
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
+ }
+
+ $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt", "w");
+ fwrite($new_body, $body_write_content);
+ fclose($new_body);
+
+ $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt", "w");
+ fwrite($new_title, $title_write_content);
+ fclose($new_title);
+
+ copy("data/items/{$_REQUEST['entry']}/title.txt", "data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/ptitle.txt");
+ 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");
+ }
+
+ $open_editor_file = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/editor.txt", "w");
+ fwrite($open_editor_file, $_SESSION['logged_in']);
+ fclose($open_editor_file);
+ }
+ }
+
+ $open_title_file = fopen($title_file, "w");
+ fwrite($open_title_file, $title_write_content);
+ fclose($open_title_file);
+
+ $open_body_file = fopen($body_file, "w");
+ fwrite($open_body_file, $body_write_content);
+ fclose($open_body_file);
+
+ 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']))) {
+ $open_contrib_file = fopen("data/items/{$_REQUEST['entry']}/contrib.txt", "w");
+ fwrite($open_contrib_file, $_SESSION['logged_in']);
+ fclose($open_contrib_file);
+ }
+
+ 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";
+
+ $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")) {
+ $fp_passwd_txt = fopen("$passwd_file", "w");
+ $passwd_crypt = sha1($_POST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ }
+
+ 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'])) {
+ $fp_maxlines_txt = fopen("data/items/{$_REQUEST['entry']}/maxlines.txt", "w");
+ fwrite($fp_maxlines_txt, $_POST['maxlines']);
+ fclose($fp_maxlines_txt);
+ }
+
+ 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");
+ }
+
+ 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);
+ }
+ }
?>
diff --git a/fonts.php b/fonts.php
index b63fcc4..a3fff89 100644
--- a/fonts.php
+++ b/fonts.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$login_username = file_get_contents("data/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
@@ -35,31 +22,6 @@ if (!file_exists("data/fonts")) {
mkdir("data/fonts");
}
-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($_POST['reset']) and !empty($_POST['reset']) and ($_POST['reset'] == "go")) {
rmdirr("data/fonts");
}
diff --git a/fpdf.php b/fpdf.php
old mode 100755
new mode 100644
diff --git a/index.php b/index.php
index b449098..2dd7618 100644
--- a/index.php
+++ b/index.php
@@ -8,25 +8,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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($maj_data) {
- if (is_array($maj_data)) {
- foreach ($maj_data as $maj_key => $maj_value) {
- $maj_data[$maj_key] = stripslashes_array($maj_value);
- }
- return $maj_data;
- }
- else {
- return stripslashes($maj_data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
-}
-
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
$maj_req_entry = trim($_REQUEST['entry']);
}
@@ -89,7 +76,7 @@ $maj_wtable = $maj_wside + $maj_wspace + $maj_wmain + $maj_wspace + $maj_wside;
$maj_default_blog_title = "My Activity Journal";
$maj_default_username = "maj";
$maj_default_password = "php";
-$maj_default_blog_profile = 'This cool site is powered by <a href="http://maj.sourceforge.net/" target="_maj">My Activity Journal</a>, a simple, <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://www.opensource.org/licenses/gpl-license.php" target="_maj">Open Source</a> blog written from scratch as a spare time family project by <a href="http://psylocke.org/" target="_maj">Psylocke</a>, <a href="http://gaffud.com/" target="_maj">Magie</a>, and <a href="http://engels.mortega.net/" target="_maj">Engels</a> Antonio.';
+$maj_default_blog_profile = 'This cool site is powered by My Activity Journal (<a href="http://majcms.org/" target="_maj">MAJ</a>), a simple, <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://opensource.org/" target="_maj">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.';
$maj_default_blog_author = "My Activity Journal";
if (!file_exists("data")) {
@@ -185,31 +172,6 @@ function str_rand($maj_length = 8,$maj_seeds = 'abcdefghijklmnopqrstuvwxyz012345
return $maj_str;
}
-function rmdirr($maj_recurse_dirname) {
-
- if (!file_exists($maj_recurse_dirname)) {
- return false;
- }
-
- if (is_file($maj_recurse_dirname)) {
- return unli
tree 09c6f337c73f73c042baa9f91ccccf994aed7322
parent 2d702a44ad667d898a2159e49d5b18b091e26c8d
author Engels Antonio <engels@majcms.org> 1280601593 +0800
committer Engels Antonio <engels@majcms.org> 1280601593 +0800
CSS progressive enhancements
Aggregate recurring functions
Code clean-up and optimization
diff --git a/add.php b/add.php
index 59b0f21..a1e868c 100644
--- a/add.php
+++ b/add.php
@@ -1,61 +1,41 @@
<?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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
-if (isset($_POST['title_input']) and isset($_POST['body_input']) and !empty($_POST['title_input']) and !empty($_POST['body_input'])) {
- header("Location: index.php");
-}
-
-if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
- $login_username = file_get_contents("data/username.txt");
-}
-
-if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
-
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
-
- $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
-
- if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
- unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
- }
- }
-
- if ((file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) and file_exists("data/bb.txt") and !file_exists("data/noadd.txt")) {
- $login_username = $_SESSION['logged_in'];
- }
-}
-
-if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- exit();
-}
-
+ session_start();
+
+ header("Cache-control: private");
+
+ error_reporting(E_ERROR);
+
+ require("core.php");
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+ header("Location: login.php");
+ }
+
+ if (isset($_POST['title_input']) and isset($_POST['body_input']) and !empty($_POST['title_input']) and !empty($_POST['body_input'])) {
+ header("Location: index.php");
+ }
+
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+ $login_username = file_get_contents("data/username.txt");
+ }
+
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) {
+ $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
+ if (!file_exists("data/categories/$bb_cat") or ($bb_cat == "")) {
+ unlink("data/members/active/{$_SESSION['logged_in']}/category.txt");
+ }
+ }
+
+ if ((file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") or file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt")) and file_exists("data/bb.txt") and !file_exists("data/noadd.txt")) {
+ $login_username = $_SESSION['logged_in'];
+ }
+ }
+
+ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
+ exit();
+ }
?>
<title>Add</title>
@@ -63,161 +43,180 @@ if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username
<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;
+ 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;
+ font-size: 11px;
}
a {
- font-weight: bold;
- text-decoration: none;
+ font-weight: bold;
+ text-decoration: none;
}
a:link, a:visited {
- color: #666666;
+ color: #666666;
}
a:hover {
- color: #336699;
+ color: #336699;
}
a:active {
- color: #336699;
-}
-
-.input_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 512px;
- 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: 512px;
- 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: #336699;
+}
+
+.input_title {
+ color: #666666;
+ background: #ffffff;
+ border: #999999 solid 1px;
+ width: 512px;
+ 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: 512px;
+ 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
}
</style>
<?php
-
-if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
-}
-else {
- $offset = 0;
-}
-
-$entry_year = date("Y", time() + $offset);
-$entry_month = date("m", time() + $offset);
-$entry_day = date("d", time() + $offset);
-$entry_hour = date("H", time() + $offset);
-$entry_min = date("i", time() + $offset);
-$entry_sec = date("s", time() + $offset);
-
-function return_bytes($val) {
- $val = trim($val);
- $last = $val{strlen($val)-1};
-
- 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;
-}
-
+ if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+ } else {
+ $offset = 0;
+ }
+
+ $entry_year = date("Y", time() + $offset);
+ $entry_month = date("m", time() + $offset);
+ $entry_day = date("d", time() + $offset);
+ $entry_hour = date("H", time() + $offset);
+ $entry_min = date("i", time() + $offset);
+ $entry_sec = date("s", time() + $offset);
+
+ $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;
+ }
?>
<form enctype="multipart/form-data" action="add.php" method="post">
<p>
<?php
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt")) {
+?>
-if ($_SESSION['logged_in'] != file_get_contents("data/username.txt") and file_exists("data/members/active/{$_SESSION['logged_in']}") and file_exists("data/members/active/{$_SESSION['logged_in']}/ul.txt")) { ?>
-
-<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php
+ echo $max_file_size;
+?>">
<input autocomplete="off" type="file" name="image_input"> Upload optional GIF, JPG, or PNG 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. Max size supported by server is <?php echo ($max_file_size/(1024*1024)); ?>MB.</p>
-
-<?php } ?>
-
+<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. Max size supported by server is <?php
+ echo($max_file_size / (1024 * 1024));
+?>MB.</p>
<?php
+ }
+?>
-if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+<?php
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
?>
<select name="select_year">
<option selected>
-<option><?php echo $entry_year; ?>
-<option><?php $ante_year_1 = $entry_year - 1; echo $ante_year_1; ?>
-<option><?php $ante_year_2 = $entry_year - 2; echo $ante_year_2; ?>
-<option><?php $ante_year_3 = $entry_year - 3; echo $ante_year_3; ?>
-<option><?php $ante_year_4 = $entry_year - 4; echo $ante_year_4; ?>
-<option><?php $ante_year_5 = $entry_year - 5; echo $ante_year_5; ?>
-<option><?php $ante_year_6 = $entry_year - 6; echo $ante_year_6; ?>
-<option><?php $ante_year_7 = $entry_year - 7; echo $ante_year_7; ?>
-<option><?php $ante_year_8 = $entry_year - 8; echo $ante_year_8; ?>
-<option><?php $ante_year_9 = $entry_year - 9; echo $ante_year_9; ?>
-<option><?php $ante_year_10 = $entry_year - 10; echo $ante_year_10; ?>
+<option><?php
+ echo $entry_year;
+?>
+<option><?php
+ $ante_year_1 = $entry_year - 1;
+ echo $ante_year_1;
+?>
+<option><?php
+ $ante_year_2 = $entry_year - 2;
+ echo $ante_year_2;
+?>
+<option><?php
+ $ante_year_3 = $entry_year - 3;
+ echo $ante_year_3;
+?>
+<option><?php
+ $ante_year_4 = $entry_year - 4;
+ echo $ante_year_4;
+?>
+<option><?php
+ $ante_year_5 = $entry_year - 5;
+ echo $ante_year_5;
+?>
+<option><?php
+ $ante_year_6 = $entry_year - 6;
+ echo $ante_year_6;
+?>
+<option><?php
+ $ante_year_7 = $entry_year - 7;
+ echo $ante_year_7;
+?>
+<option><?php
+ $ante_year_8 = $entry_year - 8;
+ echo $ante_year_8;
+?>
+<option><?php
+ $ante_year_9 = $entry_year - 9;
+ echo $ante_year_9;
+?>
+<option><?php
+ $ante_year_10 = $entry_year - 10;
+ echo $ante_year_10;
+?>
</select>
<select name="select_month">
<option selected>
-<option><?php echo $entry_month; ?>
+<option><?php
+ echo $entry_month;
+?>
<option>01
<option>02
<option>03
@@ -234,7 +233,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_day">
<option selected>
-<option><?php echo $entry_day; ?>
+<option><?php
+ echo $entry_day;
+?>
<option>01
<option>02
<option>03
@@ -270,7 +271,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_hour">
<option selected>
-<option><?php echo $entry_hour; ?>
+<option><?php
+ echo $entry_hour;
+?>
<option>00
<option>01
<option>02
@@ -299,7 +302,9 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<select name="select_min">
<option selected>
-<option><?php echo $entry_min; ?>
+<option><?php
+ echo $entry_min;
+?>
<option>00
<option>01
<option>02
@@ -362,66 +367,86 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
<option>59
</select> Enter antedate value in YYYY-MM-DD-HH-MM format.</p>
-<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
+<p><input type="hidden" name="MAX_FILE_SIZE" value="<?php
+ echo $max_file_size;
+?>">
<input autocomplete="off" type="file" name="image_input"> Upload optional GIF, JPG, or PNG 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. Max size supported by server is <?php echo ($max_file_size/(1024*1024)); ?>MB.</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. Max size supported by server is <?php
+ echo($max_file_size / (1024 * 1024));
+?>MB.</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")) {
- while (($entry_cat = readdir($dh_cat)) !== false) {
-
- if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
- $show_cat[] = $entry_cat;
- }
- }
- closedir($dh_cat);
- }
-
- sort($show_cat);
- reset($show_cat);
- $count_cat = count($show_cat);
-
- if ($count_cat > 0) {
-
- echo "<p><select name=\"category\"><option value=\"\" selected>unfiled";
-
- foreach ($show_cat as $category) {
- echo "<option value=\"";
- echo strtolower($category);
- echo "\">";
-
- if (file_exists("data/categories/$category/title.txt")) {
- readfile("data/categories/$category/title.txt");
- }
- else {
- echo strtolower($category);
- }
- }
-
- echo "</select> Select category.</p>";
-
- }
- }
+ if (file_exists("data/categories")) {
+ if ($dh_cat = opendir("data/categories")) {
+ while (($entry_cat = readdir($dh_cat)) !== false) {
+ if ($entry_cat != "." && $entry_cat != ".." && fnmatch("*", $entry_cat)) {
+ $show_cat[] = $entry_cat;
+ }
+ }
+ closedir($dh_cat);
+ }
+
+ sort($show_cat);
+ reset($show_cat);
+ $count_cat = count($show_cat);
+
+ if ($count_cat > 0) {
+ echo "<p><select name=\"category\"><option value=\"\" selected>unfiled";
+
+ foreach ($show_cat as $category) {
+ echo "<option value=\"";
+ echo strtolower($category);
+ echo "\">";
+
+ if (file_exists("data/categories/$category/title.txt")) {
+ readfile("data/categories/$category/title.txt");
+ } else {
+ echo strtolower($category);
+ }
+ }
+
+ echo "</select> Select category.</p>";
+ }
+ }
?>
<p><input type="checkbox" name="sticky">Put entry title in Quick Links box.<br>
<input type="checkbox" name="pdf">Allow PDF generation for this entry.<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" <?php if (file_exists("data/ml.txt")) { 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.
+<input type="checkbox" name="private" <?php
+ if (file_exists("data/ml.txt")) {
+ 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.
-<?php if (file_exists("data/bb.txt")) { ?>
+<?php
+ if (file_exists("data/bb.txt")) {
+?>
<br>
-<input type="checkbox" name="member" <?php if (file_exists("data/member.txt")) { echo checked; } ?>>Only registered members can view this entry.
+<input type="checkbox" name="member" <?php
+ if (file_exists("data/member.txt")) {
+ echo checked;
+ }
+?>>Only registered members can view this entry.
-<?php } ?>
+<?php
+ }
+?>
</p>
-<?php } ?>
+<?php
+ }
+?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td>
@@ -455,598 +480,373 @@ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
</td></tr></table>
<?php
-
-if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
- exit();
-}
-
-if (!isset($_POST['select_year']) or !isset($_POST['select_month']) or !isset($_POST['select_day']) or !isset($_POST['select_hour']) or !isset($_POST['select_min']) or empty($_POST['select_year']) or empty($_POST['select_month']) or empty($_POST['select_day']) or empty($_POST['select_hour']) or empty($_POST['select_min'])) {
-
- $entry = date("YmdHis", time() + $offset);
- $timestamp = date("l, M j, Y, g:i A", time() + $offset);
-}
-else {
-
- $entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
- $timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
-}
-
-if (!file_exists("data/items")) {
- mkdir("data/items");
-}
-
-$dir = "data/items/";
-$item_dir = $dir . $entry;
-
-if (!file_exists("images")) {
- mkdir("images");
-}
-
-$image_dir = 'images/' . $entry;
-$file_dir = $item_dir . '/filedrop';
-
-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);
-
-mkdir($item_dir);
-
-// 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);
-
-$title_file = $item_dir . '/title.txt';
-$fp_title_txt = fopen($title_file,"w");
-fwrite($fp_title_txt,$title_write_content);
-fclose($fp_title_txt);
-
-$author_file = $item_dir . '/author.txt';
-$fp_author_txt = fopen($author_file,"w");
-fwrite($fp_author_txt,$_SESSION['logged_in']);
-fclose($fp_author_txt);
-
-if (file_get_contents("data/username.txt") == $_SESSION['logged_in']) {
- $post_file = "data/lastpost.txt";
-}
-elseif (file_exists("data/members/active/{$_SESSION['logged_in']}")) {
- $post_file = "data/members/active/{$_SESSION['logged_in']}/bb-post.txt";
-}
-
-$fp_post_txt = fopen($post_file,"w");
-fwrite($fp_post_txt,$entry);
-fclose($fp_post_txt);
-
-$date_file = $item_dir . '/date.txt';
-$fp_date_txt = fopen($date_file,"w");
-fwrite($fp_date_txt,$timestamp);
-fclose($fp_date_txt);
-
-if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
-
- if (is_uploaded_file($_FILES['image_input']['tmp_name'])) {
-
- if ($_FILES['image_input']['size']<=$max_file_size) {
-
- if (($_FILES['image_input']['type']=="image/gif") || ($_FILES['image_input']['type']=="image/pjpeg") || ($_FILES['image_input']['type']=="image/jpeg") || ($_FILES['image_input']['type']=="image/png")) {
-
- if (!file_exists($image_dir)) {
- mkdir($image_dir);
- }
-
- $image_input_name = str_replace(" ","_",$_FILES['image_input']['name']);
-
- if (!file_exists("$image_dir/$image_input_name")) {
- $res = copy($_FILES['image_input']['tmp_name'], "$image_dir/$image_input_name");
- unlink($_FILES['image_input']['tmp_name']);
-
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['image_input']['tmp_name']);
- }
- }
- else {
- unlink($_FILES['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) {
-
- $filedrop_dir = "$item_dir/filedrop";
-
- if (!file_exists($filedrop_dir)) {
- mkdir($filedrop_dir);
- }
-
- $file_dir = "$filedrop_dir/files";
-
- if (!file_exists($file_dir)) {
- mkdir($file_dir);
- }
-
- $file_input_name = str_replace(" ","_",$_FILES['file_input']['name']);
-
- if (!file_exists("$file_dir/$file_input_name")) {
- $res = copy($_FILES['file_input']['tmp_name'], "$file_dir/$file_input_name");
- unlink($_FILES['file_input']['tmp_name']);
-
- $fp_file_txt = fopen("$filedrop_dir/{$file_input_name}.txt","w");
- fwrite($fp_file_txt,"$file_dir/$file_input_name");
- fclose($fp_file_txt);
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
- }
- else {
- unlink($_FILES['file_input']['tmp_name']);
- }
-
-}
-
-$body_file = "$item_dir/body.txt";
-
-$fp_body_txt = fopen($body_file,"w");
-
-if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
- if (file_exists("$image_dir/$image_input_name")) {
-
- $entry_image_size = getimagesize("$image_dir/$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=\"$image_dir/$image_input_name\" border=\"0\" width=\"$entry_image_width\" height=\"$entry_image_height\"><br>$body_write_content";
- }
-}
-
-fwrite($fp_body_txt,$body_write_content);
-fclose($fp_body_txt);
-
-$sticky_sem = "data/sticky/$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);
- }
-}
-
-$display_sem = "data/items/$entry/cat.txt";
-if (isset($_POST['display']) and !empty($_POST['display']) and ($_POST['display'] == "on")) {
- if (!file_exists($display_sem)) {
- touch($display_sem);
- }
-}
-
-$private_sem = "data/items/$entry/private.txt";
-if (isset($_POST['private']) and !empty($_POST['private']) and ($_POST['private'] == "on")) {
- if (!file_exists($private_sem)) {
- touch($private_sem);
- }
-}
-
-if (file_exists("data/bb.txt") and file_exists("data/member.txt") and (($_SESSION['logged_in'] != file_get_contents("data/username.txt")) or (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on")))) {
- touch("data/items/$entry/member.txt");
-}
-
-if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists($private_sem)) {
-
- if (file_exists("data/ml-reply2.txt")) {
- $ml_reply2 = file_get_contents("data/ml-reply2.txt");
- }
-
- if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
- $ml_author = file_get_contents("data/author.txt");
-
- if (file_exists("data/ml-from.txt")) {
- $ml_from = $ml_reply2;
- }
- else {
- $ml_from = file_get_contents("data/email.txt");
- }
-
- $ml_from = '"' . $ml_author . '" <' . $ml_from . '>';
- }
-
- if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
- if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/bb.txt")) {
- $ml_from_firstname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt");
- $ml_from_lastname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt");
-
- if (file_exists("data/ml-from.txt")) {
- $ml_from = $ml_reply2;
- }
- else {
- $ml_from = file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt");
- }
-
- $ml_from = '"' . "$ml_from_firstname $ml_from_lastname" . '" <' . $ml_from . '>';
- }
- }
-
- $ml_subject = ucfirst($_POST['title_input']);
- if (file_exists("data/ml-prepend.txt")) {
- $ml_subject = file_get_contents("data/ml-prepend.txt") . " " . $ml_subject;
- }
-
- $ml_mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
- $ml_body = ucfirst($_POST['body_input']);
- $ml_body = str_replace('<br />', "\n", $ml_body);
- $ml_body = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $ml_body);
- $ml_body = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $ml_body);
- $ml_body = str_replace('&','&',$ml_body);
- $ml_body = str_replace('®','(R)',$ml_body);
- $ml_body = strip_tags($ml_body);
-
- if (file_exists("data/ml-header.txt")) {
- $ml_header = file_get_contents("data/ml-header.txt");
- $ml_body = $ml_header . "\n\n" . $ml_body;
- }
-
- $ml_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
- $ml_url = str_replace('//', '/', $ml_url);
- $ml_url = "http://" . $ml_url . "index.php?entry={$entry}&show=comments";
-
- $ml_body = $ml_body . "\n\nPlease visit the following URL for the online version of this message:\n\n" . $ml_url;
-
- if (file_exists("data/items/$entry/member.txt")) {
- $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
- }
-
- if (file_exists("data/ml-footer.txt")) {
- $ml_footer = file_get_contents("data/ml-footer.txt");
- $ml_body = $ml_body . "\n\n" . $ml_footer;
- }
-
- if ($dh_ml_member = opendir("data/members/active")) {
- while (($ml_member = readdir($dh_ml_member)) !== false) {
- if ($ml_member != "." && $ml_member != ".." && fnmatch("*", $ml_member)) {
-
- if (file_exists("data/members/active/$ml_member/noml.txt")) {
- continue;
- }
-
- if (file_exists("data/members/active/$ml_member/vacation.txt")) {
- continue;
- }
-
- $ml_to_firstname = file_get_contents("data/members/active/$ml_member/firstname.txt");
- $ml_to_lastname = file_get_contents("data/members/active/$ml_member/lastname.txt");
- $ml_to = file_get_contents("data/members/active/$ml_member/email.txt");
- $ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
-
- if (file_exists("data/ml-reply2.txt")) {
- mail($ml_to, $ml_subject, $ml_body,
- "From: $ml_from\r\n" .
- "Reply-To: $ml_reply2\r\n" .
- "References: $entry\r\n" .
- "X-Mailer: $ml_mailer");
- }
- else {
- mail($ml_to, $ml_subject, $ml_body,
- "From: $ml_from\r\n" .
- "References: $entry\r\n" .
- "X-Mailer: $ml_mailer");
- }
- }
- }
- closedir($dh_ml_member);
- }
-}
-
-if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on")) {
- if (!file_exists("data/items/$entry/pdf")) {
- mkdir("data/items/$entry/pdf");
- }
- if (!file_exists("data/items/$entry/pdf/file")) {
- mkdir("data/items/$entry/pdf/file");
- }
- if (!file_exists("data/items/$entry/pdf/count")) {
- mkdir("data/items/$entry/pdf/count");
- }
-
- $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("add.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['category']) and !empty($_POST['category']) and file_exists("data/categories/{$_POST['category']}")) {
-
- if (!file_exists("data/items/$entry/categories")) {
- mkdir("data/items/$entry/categories");
- }
-
- if (!file_exists("data/items/$entry/categories/{$_POST['category']}")) {
- mkdir("data/items/$entry/categories/{$_POST['category']}");
- }
-}
-
-
-if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
-
- $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
-
- if (file_exists("data/categories/$bb_cat")) {
-
- if (!file_exists("data/items/$entry/categories")) {
- mkdir("data/items/$entry/categories");
- }
-
- if (!file_exists("data/items/$entry/categories/$bb_cat")) {
- mkdir("data/items/$entry/categories/$bb_cat");
- }
- }
-}
-
-if (isset($_POST['passwd']) and !empty($_POST['passwd'])) {
- if (($_POST['passwd'] == "password") or empty($_POST['passwd'])) {
- unlink("data/items/$entry/passwd.txt");
- }
- else {
- $passwd_crypt = sha1($_POST['passwd']);
- $passwd_crypt = md5($passwd_crypt);
- $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
-
- $fp_passwd_txt = fopen("data/items/$entry/passwd.txt","w");
- fwrite($fp_passwd_txt, $passwd_crypt);
- fclose($fp_passwd_txt);
- }
-}
-
-if (file_exists("data/ping.txt")) {
-
- $ping_urls = file_get_contents("data/ping.txt");
-
- $get_ping_urls = explode("|", $ping_urls);
-
- foreach ($get_ping_urls as $ping_url) {
- $ping = file_get_contents($ping_url);
- unset($ping);
- }
-}
-
+ if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
+ exit();
+ }
+
+ if (!isset($_POST['select_year']) or !isset($_POST['select_month']) or !isset($_POST['select_day']) or !isset($_POST['select_hour']) or !isset($_POST['select_min']) or empty($_POST['select_year']) or empty($_POST['select_month']) or empty($_POST['select_day']) or empty($_POST['select_hour']) or empty($_POST['select_min'])) {
+ $entry = date("YmdHis", time() + $offset);
+ $timestamp = date("l, M j, Y, g:i A", time() + $offset);
+ } else {
+ $entry = $_POST['select_year'] . $_POST['select_month'] . $_POST['select_day'] . $_POST['select_hour'] . $_POST['select_min'] . $entry_sec;
+ $timestamp = date("l, M j, Y, g:i A", mktime($_POST['select_hour'], $_POST['select_min'], $entry_sec, $_POST['select_month'], $_POST['select_day'], $_POST['select_year']));
+ }
+
+ if (!file_exists("data/items")) {
+ mkdir("data/items");
+ }
+
+ $dir = "data/items/";
+ $item_dir = $dir . $entry;
+
+ if (!file_exists("images")) {
+ mkdir("images");
+ }
+
+ $image_dir = 'images/' . $entry;
+ $file_dir = $item_dir . '/filedrop';
+
+ mkdir($item_dir);
+
+ $title_write_content = format_title_put($_POST['title_input']);
+ $body_write_content = format_body_put($_POST['body_input']);
+
+ $title_file = $item_dir . '/title.txt';
+ $fp_title_txt = fopen($title_file, "w");
+ fwrite($fp_title_txt, $title_write_content);
+ fclose($fp_title_txt);
+
+ $author_file = $item_dir . '/author.txt';
+ $fp_author_txt = fopen($author_file, "w");
+ fwrite($fp_author_txt, $_SESSION['logged_in']);
+ fclose($fp_author_txt);
+
+ if (file_get_contents("data/username.txt") == $_SESSION['logged_in']) {
+ $post_file = "data/lastpost.txt";
+ } elseif (file_exists("data/members/active/{$_SESSION['logged_in']}")) {
+ $post_file = "data/members/active/{$_SESSION['logged_in']}/bb-post.txt";
+ }
+
+ $fp_post_txt = fopen($post_file, "w");
+ fwrite($fp_post_txt, $entry);
+ fclose($fp_post_txt);
+
+ $date_file = $item_dir . '/date.txt';
+ $fp_date_txt = fopen($date_file, "w");
+ fwrite($fp_date_txt, $timestamp);
+ fclose($fp_date_txt);
+
+ if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+ if (is_uploaded_file($_FILES['image_input']['tmp_name'])) {
+ if ($_FILES['image_input']['size'] <= $max_file_size) {
+ if (($_FILES['image_input']['type'] == "image/gif") || ($_FILES['image_input']['type'] == "image/pjpeg") || ($_FILES['image_input']['type'] == "image/jpeg") || ($_FILES['image_input']['type'] == "image/png")) {
+ if (!file_exists($image_dir)) {
+ mkdir($image_dir);
+ }
+
+ $image_input_name = str_replace(" ", "_", $_FILES['image_input']['name']);
+
+ if (!file_exists("$image_dir/$image_input_name")) {
+ $res = copy($_FILES['image_input']['tmp_name'], "$image_dir/$image_input_name");
+ unlink($_FILES['image_input']['tmp_name']);
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['image_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['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) {
+ $filedrop_dir = "$item_dir/filedrop";
+
+ if (!file_exists($filedrop_dir)) {
+ mkdir($filedrop_dir);
+ }
+
+ $file_dir = "$filedrop_dir/files";
+
+ if (!file_exists($file_dir)) {
+ mkdir($file_dir);
+ }
+
+ $file_input_name = str_replace(" ", "_", $_FILES['file_input']['name']);
+
+ if (!file_exists("$file_dir/$file_input_name")) {
+ $res = copy($_FILES['file_input']['tmp_name'], "$file_dir/$file_input_name");
+ unlink($_FILES['file_input']['tmp_name']);
+
+
+ $fp_file_txt = fopen("$filedrop_dir/{$file_input_name}.txt", "w");
+ fwrite($fp_file_txt, "$file_dir/$file_input_name");
+ fclose($fp_file_txt);
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ } else {
+ unlink($_FILES['file_input']['tmp_name']);
+ }
+ }
+
+
+ $body_file = "$item_dir/body.txt";
+
+ $fp_body_txt = fopen($body_file, "w");
+
+ if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
+ if (file_exists("$image_dir/$image_input_name")) {
+ $entry_image_size = getimagesize("$image_dir/$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=\"$image_dir/$image_input_name\" border=\"0\" width=\"$entry_image_width\" height=\"$entry_image_height\"><br>$body_write_content";
+ }
+ }
+
+ fwrite($fp_body_txt, $body_write_content);
+ fclose($fp_body_txt);
+
+ $sticky_sem = "data/sticky/$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);
+ }
+ }
+
+ $display_sem = "data/items/$entry/cat.txt";
+ if (isset($_POST['display']) and !empty($_POST['display']) and ($_POST['display'] == "on")) {
+ if (!file_exists($display_sem)) {
+ touch($display_sem);
+ }
+ }
+
+ $private_sem = "data/items/$entry/private.txt";
+ if (isset($_POST['private']) and !empty($_POST['private']) and ($_POST['private'] == "on")) {
+ if (!file_exists($private_sem)) {
+ touch($private_sem);
+ }
+ }
+
+ if (file_exists("data/bb.txt") and file_exists("data/member.txt") and (($_SESSION['logged_in'] != file_get_contents("data/username.txt")) or (isset($_POST['member']) and !empty($_POST['member']) and ($_POST['member'] == "on")))) {
+ touch("data/items/$entry/member.txt");
+ }
+
+ if (file_exists("data/members/active") and file_exists("data/ml.txt") and file_exists("data/email.txt") and !file_exists($private_sem)) {
+ if (file_exists("data/ml-reply2.txt")) {
+ $ml_reply2 = file_get_contents("data/ml-reply2.txt");
+ }
+
+ if ($_SESSION['logged_in'] == file_get_contents("data/username.txt")) {
+ $ml_author = file_get_contents("data/author.txt");
+
+ if (file_exists("data/ml-from.txt")) {
+ $ml_from = $ml_reply2;
+ } else {
+ $ml_from = file_get_contents("data/email.txt");
+ }
+
+ $ml_from = '"' . $ml_author . '" <' . $ml_from . '>';
+ }
+
+ if ($_SESSION['logged_in'] != file_get_contents("data/username.txt")) {
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/rw.txt") and file_exists("data/bb.txt")) {
+ $ml_from_firstname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/firstname.txt");
+ $ml_from_lastname = file_get_contents("data/members/active/{$_SESSION['logged_in']}/lastname.txt");
+
+ if (file_exists("data/ml-from.txt")) {
+ $ml_from = $ml_reply2;
+ } else {
+ $ml_from = file_get_contents("data/members/active/{$_SESSION['logged_in']}/email.txt");
+ }
+
+ $ml_from = '"' . "$ml_from_firstname $ml_from_lastname" . '" <' . $ml_from . '>';
+ }
+ }
+
+ $ml_subject = ucfirst($_POST['title_input']);
+ if (file_exists("data/ml-prepend.txt")) {
+ $ml_subject = file_get_contents("data/ml-prepend.txt") . " " . $ml_subject;
+ }
+
+ $ml_mailer = 'MAJ/0.14 (PHP/' . phpversion() . ')';
+ $ml_body = ucfirst($_POST['body_input']);
+ $ml_body = str_replace('<br />', "\n", $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/crying.png" border="0">', ':((', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/frown.png" border="0">', ':(', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/lick.png" border="0">', ':P', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/smile.png" border="0">', ':)', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $ml_body);
+ $ml_body = str_replace('<img src="images/smileys/wink.png" border="0">', ';)', $ml_body);
+ $ml_body = str_replace('&', '&', $ml_body);
+ $ml_body = str_replace('®', '(R)', $ml_body);
+ $ml_body = strip_tags($ml_body);
+
+ if (file_exists("data/ml-header.txt")) {
+ $ml_header = file_get_contents("data/ml-header.txt");
+ $ml_body = $ml_header . "\n\n" . $ml_body;
+ }
+
+ $ml_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/";
+ $ml_url = str_replace('//', '/', $ml_url);
+ $ml_url = "http://" . $ml_url . "index.php?entry={$entry}&show=comments";
+
+ $ml_body = $ml_body . "\n\nPlease visit the following URL for the online version of this message:\n\n" . $ml_url;
+
+ if (file_exists("data/items/$entry/member.txt")) {
+ $ml_body = $ml_body . "\n\nYou need to login first to view the entry or to add a comment.";
+ }
+
+ if (file_exists("data/ml-footer.txt")) {
+ $ml_footer = file_get_contents("data/ml-footer.txt");
+ $ml_body = $ml_body . "\n\n" . $ml_footer;
+ }
+
+ if ($dh_ml_member = opendir("data/members/active")) {
+ while (($ml_member = readdir($dh_ml_member)) !== false) {
+ if ($ml_member != "." && $ml_member != ".." && fnmatch("*", $ml_member)) {
+ if (file_exists("data/members/active/$ml_member/noml.txt")) {
+ continue;
+ }
+
+ if (file_exists("data/members/active/$ml_member/vacation.txt")) {
+ continue;
+ }
+
+ $ml_to_firstname = file_get_contents("data/members/active/$ml_member/firstname.txt");
+ $ml_to_lastname = file_get_contents("data/members/active/$ml_member/lastname.txt");
+ $ml_to = file_get_contents("data/members/active/$ml_member/email.txt");
+ $ml_to = '"' . "$ml_to_firstname $ml_to_lastname" . '" <' . $ml_to . '>';
+
+ if (file_exists("data/ml-reply2.txt")) {
+ mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "Reply-To: $ml_reply2\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ } else {
+ mail($ml_to, $ml_subject, $ml_body, "From: $ml_from\r\n" . "References: $entry\r\n" . "X-Mailer: $ml_mailer");
+ }
+ }
+ }
+ closedir($dh_ml_member);
+ }
+ }
+
+ if (isset($_POST['pdf']) and !empty($_POST['pdf']) and ($_POST['pdf'] == "on")) {
+ if (!file_exists("data/items/$entry/pdf")) {
+ mkdir("data/items/$entry/pdf");
+ }
+ if (!file_exists("data/items/$entry/pdf/file")) {
+ mkdir("data/items/$entry/pdf/file");
+ }
+ if (!file_exists("data/items/$entry/pdf/count")) {
+ mkdir("data/items/$entry/pdf/count");
+ }
+
+ $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("add.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";
+
+ $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['category']) and !empty($_POST['category']) and file_exists("data/categories/{$_POST['category']}")) {
+ if (!file_exists("data/items/$entry/categories")) {
+ mkdir("data/items/$entry/categories");
+ }
+
+ if (!file_exists("data/items/$entry/categories/{$_POST['category']}")) {
+ mkdir("data/items/$entry/categories/{$_POST['category']}");
+ }
+ }
+
+
+ if (file_exists("data/members/active/{$_SESSION['logged_in']}/category.txt") and file_exists("data/bb.txt")) {
+ $bb_cat = file_get_contents("data/members/active/{$_SESSION['logged_in']}/category.txt");
+
+ if (file_exists("data/categories/$bb_cat")) {
+ if (!file_exists("data/items/$entry/categories")) {
+ mkdir("data/items/$entry/categories");
+ }
+
+ if (!file_exists("data/items/$entry/categories/$bb_cat")) {
+ mkdir("data/items/$entry/categories/$bb_cat");
+ }
+ }
+ }
+
+ if (isset($_POST['passwd']) and !empty($_POST['passwd'])) {
+ if (($_POST['passwd'] == "password") or empty($_POST['passwd'])) {
+ unlink("data/items/$entry/passwd.txt");
+ } else {
+ $passwd_crypt = sha1($_POST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+
+ $fp_passwd_txt = fopen("data/items/$entry/passwd.txt", "w");
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ }
+ }
+
+ if (file_exists("data/ping.txt")) {
+ $ping_urls = file_get_contents("data/ping.txt");
+
+ $get_ping_urls = explode("|", $ping_urls);
+
+ foreach ($get_ping_urls as $ping_url) {
+ $ping = file_get_contents($ping_url);
+ unset($ping);
+ }
+ }
?>
diff --git a/album.php b/album.php
index 3cc3539..a55bd06 100644
--- a/album.php
+++ b/album.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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 $album_image_exif_key => $album_image_exif_valueue) {
- $data[$album_image_exif_key] = stripslashes_array($album_image_exif_valueue);
- }
- return $data;
- }
- else {
- return stripslashes($data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
-}
-
if (!isset($_REQUEST['entry']) or empty($_REQUEST['entry'])) {
exit();
}
diff --git a/cat.php b/cat.php
index 58ff2bb..da9fb61 100644
--- a/cat.php
+++ b/cat.php
@@ -6,54 +6,18 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$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 (file_exists("data/items")) {
if ($dh_cat_txt = opendir("data/items")) {
diff --git a/colors.php b/colors.php
index 51b48ca..11a33eb 100644
--- a/colors.php
+++ b/colors.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$login_username = file_get_contents("data/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
@@ -50,31 +37,6 @@ if (!file_exists("data/schemes/colors")) {
mkdir("data/schemes/colors");
}
-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($_POST['reset']) and ($_POST['reset'] == "go")) {
rmdirr("data/colors");
diff --git a/core.php b/core.php
new file mode 100644
index 0000000..0d0d919
--- /dev/null
+++ b/core.php
@@ -0,0 +1,267 @@
+<?php
+ // 20100729 - aggregate recurring functions
+
+ if (get_magic_quotes_gpc()) {
+ function stripslashes_array($data) {
+ if (is_array($data)) {
+ foreach ($data as $key => $value) {
+ $data[$key] = stripslashes_array($value);
+ } //foreach ($data as $key => $value)
+ return $data;
+ } //if (is_array($data))
+ else {
+ return stripslashes($data);
+ } //else
+ } //function stripslashes_array($data)
+ $_REQUEST = stripslashes_array($_REQUEST);
+ } //if (get_magic_quotes_gpc())
+
+
+ function rmdirr($dir) {
+ if (!file_exists($dir)) {
+ return false;
+ } //if (!file_exists($dir))
+
+ if (is_file($dir)) {
+ return unlink($dir);
+ } //if (is_file($dir))
+
+ $recurse = dir($dir);
+
+ while (false !== $entry = $recurse->read()) {
+ if ($entry == '.' || $entry == '..') {
+ continue;
+ } //if ($entry == '.' || $entry == '..')
+
+ rmdirr("$dir/$entry");
+ } //while (false !== $entry = $recurse->read())
+
+ $recurse->close();
+ return rmdir($dir);
+ } //function rmdirr($dir)
+
+
+ function return_bytes($val) {
+ $val = trim($val);
+ $last = $val{strlen($val) - 1};
+
+ switch ($last) {
+ case 'k':
+ case 'K':
+ return(int)$val * 1024;
+ break;
+ case 'm':
+ case 'M':
+ return(int)$val * 1048576;
+ break;
+ default:
+ return $val;
+ } //switch ($last)
+ } //function return_bytes($val)
+
+
+ function entry2date($entry) {
+ $entry_year = substr($entry, 0, 4);
+ $entry_month = substr($entry, 4, 2);
+ $entry_day = substr($entry, 6, 2);
+ $entry_hour = substr($entry, 8, 2);
+ $entry_min = substr($entry, 10, 2);
+ $entry_sec = substr($entry, 12, 2);
+
+ echo date("l, M j, Y, g:i A", mktime($entry_hour, $entry_min, $entry_sec, $entry_month, $entry_day, $entry_year));
+ } //function entry2date($entry)
+
+
+ function reformat_html($data) {
+ $store_0 = split("<html>", $data);
+ $data = "";
+ $data .= $store_0[0];
+
+ foreach ($store_0 as $item_0 => $ref_0) {
+ if (eregi("</html>", $ref_0)) {
+ $store_1 = split("</html>", $ref_0);
+ $store_1[0] = eregi_replace("\n", "", $store_1[0]);
+
+ foreach ($store_1 as $item_1 => $ref_1) {
+ if ($item_1 == 0)
+ $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
+ $data .= $ref_1;
+ } //foreach ($store_1 as $item_1 => $ref_1)
+ } //if (eregi("</html>", $ref_0))
+ } //foreach ($store_0 as $item_0 => $ref_0)
+ return $data;
+ } //function reformat_html($data)
+
+
+ function reformat_code($data) {
+ $store_0 = split("<code>", $data);
+ $data = "";
+ $data .= $store_0[0];
+
+ foreach ($store_0 as $item_0 => $ref_0) {
+ if (eregi("</code>", $ref_0)) {
+ $store_1 = split("</code>", $ref_0);
+ $store_1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">', ':((', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">', ':(', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">', ':P', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">', ':)', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $store_1[0]);
+ $store_1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">', ';)', $store_1[0]);
+ $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
+
+ foreach ($store_1 as $item_1 => $ref_1) {
+ if ($item_1 == 0)
+ $ref_1 = "<code>$ref_1</code>";
+ $data .= $ref_1;
+ } //foreach ($store_1 as $item_1 => $ref_1)
+ } //if (eregi("</code>", $ref_0))
+ } //foreach ($store_0 as $item_0 => $ref_0)
+ return $data;
+ } //function reformat_code($data)
+
+
+ function format_title_put($data) {
+ // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
+ $data = ucwords($data);
+ $data = str_replace('<', '<', $data);
+ $data = str_replace('>', '>', $data);
+ $data = str_replace(' A ', ' a ', $data);
+ $data = str_replace(' An ', ' an ', $data);
+ $data = str_replace(' And ', ' and ', $data);
+ $data = str_replace(' As ', ' as ', $data);
+ $data = str_replace(' At ', ' at ', $data);
+ $data = str_replace(' But ', ' but ', $data);
+ $data = str_replace(' By ', ' by ', $data);
+ $data = str_replace(' For ', ' for ', $data);
+ $data = str_replace(' In ', ' in ', $data);
+ $data = str_replace(' Of ', ' of ', $data);
+ $data = str_replace(' On ', ' on ', $data);
+ $data = str_replace(' Or ', ' or ', $data);
+ $data = str_replace(' The ', ' the ', $data);
+ $data = str_replace(' To ', ' to ', $data);
+
+ return $data;
+ } //function format_title_put($data)
+
+
+ function format_body_put($data) {
+ $data = ucfirst($data);
+ $data = str_replace("[html]", '<html>', $data);
+ $data = str_replace("[/html]", '</html>', $data);
+ $data = reformat_html($data);
+ $data = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $data);
+ $data = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $data);
+ $data = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $data);
+ $data = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $data);
+ $data = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $data);
+ $data = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $data);
+ $data = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $data);
+ $data = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $data);
+ $data = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $data);
+ $data = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $data);
+ $data = str_replace('[code]', '<code>', $data);
+ $data = str_replace('[/code]', '</code>', $data);
+ $data = reformat_code($data);
+ $data = str_replace("\n", '<br />', $data);
+ $data = str_replace('[b]', '<b>', $data);
+ $data = str_replace('[/b]', '</b>', $data);
+ $data = str_replace('[i]', '<i>', $data);
+ $data = str_replace('[/i]', '</i>', $data);
+ $data = str_replace('[u]', '<u>', $data);
+ $data = str_replace('[/u]', '</u>', $data);
+ $data = str_replace('[strike]', '<strike>', $data);
+ $data = str_replace('[/strike]', '</strike>', $data);
+ $data = str_replace('[sup]', '<sup>', $data);
+ $data = str_replace('[/sup]', '</sup>', $data);
+ $data = str_replace('[sub]', '<sub>', $data);
+ $data = str_replace('[/sub]', '</sub>', $data);
+ $data = str_replace('[highlight]', '<highlight>', $data);
+ $data = str_replace('[/highlight]', '</highlight>', $data);
+ $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
+ $data = str_replace('</highlight>', '</span>', $data);
+ $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
+
+ return $data;
+ } //function format_body_put($data)
+
+
+ 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 PDF($orientation = 'P', $unit = 'mm', $format = 'letter')
+
+ 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);
+ } //if ($i % 2 == 0)
+ 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);
+ } //else
+ } //else
+ } //foreach ($a as $i => $e)
+ } //function WriteHTML($html)
+
+ 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 OpenTag($tag, $attr)
+
+ function CloseTag($tag) {
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U')
+ $this->SetStyle($tag, false);
+ if ($tag == 'A')
+ $this->HREF = '';
+ } //function CloseTag($tag)
+
+ 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 SetStyle($tag, $enable)
+
+ 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);
+ } //function PutLink($URL, $txt)
+ } //class PDF extends FPDF
+?>
diff --git a/css.php b/css.php
index 161ed68..d5321b0 100644
--- a/css.php
+++ b/css.php
@@ -1,114 +1,141 @@
<?php
if (file_exists("data/fonts/body-size.txt")) {
- $maj_body_px = file_get_contents("data/fonts/body-size.txt") . "px";
+ $maj_font_Dpx = file_get_contents("data/fonts/body-size.txt") . "px";
}
else {
- $maj_body_px = "11px";
+ $maj_font_Dpx = "11px";
}
if (file_exists("data/fonts/input-size.txt")) {
- $maj_input_px = file_get_contents("data/fonts/input-size.txt") . "px";
+ $maj_font_Ipx = file_get_contents("data/fonts/input-size.txt") . "px";
}
else {
- $maj_input_px = "11px";
+ $maj_font_Ipx = "11px";
}
if (file_exists("data/fonts/panel-title-size.txt")) {
- $maj_font_12px = file_get_contents("data/fonts/panel-title-size.txt") . "px";
+ $maj_font_Lpx = file_get_contents("data/fonts/panel-title-size.txt") . "px";
}
else {
- $maj_font_12px = "12px";
+ $maj_font_Lpx = "12px";
}
if (file_exists("data/fonts/panel-body-size.txt")) {
- $maj_font_11px = file_get_contents("data/fonts/panel-body-size.txt") . "px";
+ $maj_font_Mpx = file_get_contents("data/fonts/panel-body-size.txt") . "px";
}
else {
- $maj_font_11px = "11px";
+ $maj_font_Mpx = "11px";
}
if (file_exists("data/fonts/panel-footer-size.txt")) {
- $maj_font_10px = file_get_contents("data/fonts/panel-footer-size.txt") . "px";
+ $maj_font_Spx = file_get_contents("data/fonts/panel-footer-size.txt") . "px";
}
else {
- $maj_font_10px = "10px";
+ $maj_font_Spx = "10px";
+}
+
+if (file_exists("data/round.txt")) {
+ $maj_border_radius = file_get_contents("data/round.txt") . "px";
+}
+else {
+ $maj_border_radius = "5px";
}
?>
<style>
-html {
- font-size: <?php echo $maj_font_11px; ?>;
+* {
+ font-size: <?php echo $maj_font_Mpx; ?>;
}
body {
- margin: 0px 0px 10px 10px;
padding: 0px;
+ margin: 0px 0px 10px 10px;
+ color: #666666;
+ background-color: #ffffff;
text-align: left;
+ font-family: arial,helvetica,sans-serif;
+ <?php
- font-size: <?php echo $maj_body_px; ?>;
-
- color: <?php
- if (file_exists("data/colors/font.txt")) {
- $maj_font_color = file_get_contents("data/colors/font.txt");
- echo $maj_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/body.txt")) {
- $maj_font_body = file_get_contents("data/fonts/body.txt");
- echo "{$maj_font_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- background-color: <?php
- if (file_exists("data/colors/bg.txt")) {
- $maj_background_color = file_get_contents("data/colors/bg.txt");
- if ($maj_background_color == "transparent") {
- echo "#ffffff";
- }
- else {
- echo $maj_background_color;
- }
- }
- else {
- echo "#ffffff";
- }
- ?>;
+ echo "font-size: $maj_font_Dpx;";
- <?php
- if (file_exists("images/background.gif") and !file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
- background-image: url('images/background.gif');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
- }
- if (!file_exists("images/background.gif") and file_exists("images/background.jpg") and !file_exists("images/background.png")) { ?>
- background-image: url('images/background.jpg');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
- }
- if (!file_exists("images/background.gif") and !file_exists("images/background.jpg") and file_exists("images/background.png")) { ?>
- background-image: url('images/background.png');
- background-attachment: <?php if (file_exists("data/bg-scroll.txt")) { echo scroll; } else { echo fixed; } ?>;
- background-repeat: <?php if (file_exists("data/bg-repeat.txt")) { readfile("data/bg-repeat.txt"); } else { echo repeat; } ?>;
- background-position: <?php if (file_exists("data/bg-position.txt")) { readfile("data/bg-position.txt"); } else { echo "top left"; } ?>;
- <?php
+ if (file_exists("data/colors/font.txt")) {
+ $maj_font_color = file_get_contents("data/colors/font.txt");
+ echo "\n\tcolor: $maj_font_color;";
+ }
+
+ if (file_exists("data/fonts/body.txt")) {
+ $maj_font_body = file_get_contents("data/fonts/body.txt");
+ echo "\n\tfont-family: $maj_font_body,arial,helvetica,sans-serif;";
}
+
+ if (file_exists("data/colors/bg.txt")) {
+ $maj_background_color = file_get_contents("data/colors/bg.txt");
+ if ($maj_background_color == "transparent") {
+ echo "\n\tbackground-color: #ffffff;";
+ }
+ else {
+ echo "\n\tbackground-color: $maj_background_color;";
+ }
+ }
+
+ if (file_exists("images/background.gif") or file_exists("images/background.jpg") or file_exists("images/background.png")) {
+
+ if (file_exists("images/background.gif") and !file_exists("images/background.jpg") and !file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.gif\");";
+ }
+
+ if (!file_exists("images/background.gif") and file_exists("images/background.jpg") and !file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.jpg\");";
+ }
+
+ if (!file_exists("images/background.gif") and !file_exists("images/background.jpg") and file_exists("images/background.png")) {
+ echo "\n\tbackground-image: url(\"images/background.png\");";
+ }
+
+ echo "\n\tbackground-attachment: ";
+
+ if (file_exists("data/bg-scroll.txt")) {
+ echo "scroll";
+ }
+ else {
+ echo "fixed";
+ }
+
+ echo ";";
+
+ echo "\n\tbackground-repeat: ";
+
+ if (file_exists("data/bg-repeat.txt")) {
+ readfile("data/bg-repeat.txt");
+ }
+ else {
+ echo "repeat";
+ }
+
+ echo ";";
+
+ echo "\n\tbackground-position: ";
+
+ if (file_exists("data/bg-position.txt")) {
+ readfile("data/bg-position.txt");
+ }
+ else {
+ echo "top left";
+ }
+
+ echo ";";
+ }
+
+ echo "\n";
+
?>
}
p,td {
- font-size: <?php echo $maj_font_11px; ?>;
+ font-size: <?php echo $maj_font_Mpx; ?>;
}
a {
@@ -117,51 +144,59 @@ a {
}
a:link {
- color: <?php
- if (file_exists("data/colors/link.txt")) {
- $maj_a_link_color = file_get_contents("data/colors/link.txt");
- echo $maj_a_link_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ color: #666666;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/link.txt")) {
+ $maj_a_link_color = file_get_contents("data/colors/link.txt");
+ echo "\tcolor: $maj_a_link_color;\n";
+ }
+
+ ?>
}
a:visited {
- color: <?php
- if (file_exists("data/colors/vlink.txt")) {
- $maj_a_visited_color = file_get_contents("data/colors/vlink.txt");
- echo $maj_a_visited_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ color: #666666;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/vlink.txt")) {
+ $maj_a_visited_color = file_get_contents("data/colors/vlink.txt");
+ echo "\tcolor: $maj_a_visited_color;\n";
+ }
+
+ ?>
}
a:hover {
- color: <?php
- if (file_exists("data/colors/hover.txt")) {
- $maj_a_hover_color = file_get_contents("data/colors/hover.txt");
- echo $maj_a_hover_color;
- }
- else {
- echo "#336699";
- }
- ?>;
+ color: #336699;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/hover.txt")) {
+ $maj_a_hover_color = file_get_contents("data/colors/hover.txt");
+ echo "\tcolor: $maj_a_hover_color;\n";
+ }
+
+ ?>
}
a:active {
- color: <?php
- if (file_exists("data/colors/hover.txt")) {
- $maj_a_active_color = file_get_contents("data/colors/hover.txt");
- echo $maj_a_active_color;
- }
- else {
- echo "#336699";
- }
- ?>;
+ color: #336699;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;\n";
+
+ if (file_exists("data/colors/hover.txt")) {
+ $maj_a_active_color = file_get_contents("data/colors/hover.txt");
+ echo "\tcolor: $maj_a_active_color;\n";
+ }
+
+ ?>
}
a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
@@ -170,543 +205,282 @@ a.navlink:link,a.navlink:visited,a.navlink:active,a.navlink:hover {
}
.panel_title {
- padding: 5px 5px 5px 5px;
- margin: 0px 0px 0px 0px;
+ padding: 5px;
+ margin: 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
border-width: 1px 1px 0px 1px;
border-style: solid solid none solid;
+ font-family: arial,helvetica,sans-serif;
font-weight: bold;
+ <?php
+
+ echo "font-size: $maj_font_Lpx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-top-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-top-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-topright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-topleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-topright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-topleft: $maj_border_radius;";
+ echo "\n\tborder-top-right-radius: $maj_border_radius;";
+ echo "\n\tborder-top-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pt-font.txt")) {
+ $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
+ echo "\n\tcolor: $maj_panel_title_font_color;";
+ }
- font-size: <?php echo $maj_font_12px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$maj_font_panel_title},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pt-font.txt")) {
- $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
- echo $maj_panel_title_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/colors/pt-bg.txt")) {
+ $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_title_background_color;";
+ }
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_title_border_color;";
+ }
+
+ if (file_exists("data/fonts/panel-title.txt")) {
+ $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
+ echo "\n\tfont-family: $maj_font_panel_title,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.panel_body {
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$maj_font_panel_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pb-font.txt")) {
- $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
- echo $maj_panel_body_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
+ padding: 5px;
+ margin: 0px 0px 10px 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 1px;
+ border-style: solid;
+ font-family: arial,helvetica,sans-serif;
<?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+
+ echo "font-size: $maj_font_Mpx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-bottom-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-bottom-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\tborder-bottom-right-radius: $maj_border_radius;";
+ echo "\n\tborder-bottom-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pb-font.txt")) {
+ $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
+ echo "\n\tcolor: $maj_panel_body_font_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_body_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
+ if (file_exists("data/colors/pb-bg.txt")) {
+ $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_body_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'margin: 0px 0px 0px 0px;';
- }
- else {
- echo 'margin: 0px 0px 10px 0px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_body_border_color;";
+ }
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_body_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-body.txt")) {
+ $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
+ echo "\n\tfont-family: $maj_font_panel_body,arial,helvetica,sans-serif;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 1px 1px 1px 1px;';
- echo 'border-style: solid solid solid solid;';
- }
+ echo "\n";
+
?>
}
.panel_footer {
+ padding: 5px;
+ margin: 0px 0px 10px 0px;
+ color: #999999;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 0px 1px 1px 1px;
+ border-style: none solid solid solid;
text-align: right;
-
- font-size: <?php echo $maj_font_10px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $maj_font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$maj_font_panel_footer},";
- }
- ?> arial,helvetica,sans-serif;
-
-
-
- color: <?php
- if (file_exists("data/colors/pf-font.txt")) {
- $maj_panel_footer_font_color = file_get_contents("data/colors/pf-font.txt");
- echo $maj_panel_footer_font_color;
- }
- else {
- echo "#999999";
- }
- ?>;
-
+ font-family: arial,helvetica,sans-serif;
<?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+
+ echo "font-size: $maj_font_Spx;";
+
+ if (file_exists("data/round.txt")) {
+ echo "\n\t-webkit-border-bottom-right-radius: $maj_border_radius;";
+ echo "\n\t-webkit-border-bottom-left-radius: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-khtml-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomright: $maj_border_radius;";
+ echo "\n\t-moz-border-radius-bottomleft: $maj_border_radius;";
+ echo "\n\tborder-bottom-right-radius: $maj_border_radius;";
+ echo "\n\tborder-bottom-left-radius: $maj_border_radius;";
+ }
+
+ if (file_exists("data/colors/pf-font.txt")) {
+ $maj_panel_footer_font_color = file_get_contents("data/colors/pf-font.txt");
+ echo "\n\tcolor: $maj_panel_footer_font_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_footer_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_footer_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
+ if (file_exists("data/colors/pf-bg.txt")) {
+ $maj_panel_footer_background_color = file_get_contents("data/colors/pf-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_footer_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'margin: 0px 0px 0px 0px;';
- }
- else {
- echo 'margin: 0px 0px 10px 0px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_footer_border_color;";
+ }
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_footer_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-footer.txt")) {
+ $maj_font_panel_footer = file_get_contents("data/fonts/panel-footer.txt");
+ echo "\n\tfont-family: $maj_font_panel_footer,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 0px 1px 1px 1px;';
- echo 'border-style: none solid solid solid;';
- }
?>
}
.input {
width: 300px;
+ color: #666666;
background: #ffffff;
+ border: #999999 solid 1px;
+ font-family: arial,helvetica,sans-serif;
+ <?php
+
+ echo "font-size: $maj_font_Ipx;";
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_input_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tcolor: $maj_input_color;";
+ }
- font-size: <?php echo $maj_input_px; ?>;
-
- color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_input_color = file_get_contents("data/colors/border.txt");
- echo $maj_input_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- border: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_footer_border_color;
- }
- else {
- echo "#999999";
- }
- ?> solid 1px;
-
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $maj_font_input = file_get_contents("data/fonts/input.txt");
- echo "{$maj_font_input},";
- }
- ?> arial,helvetica,sans-serif;
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_footer_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_footer_border_color;";
+ }
+
+ if (file_exists("data/fonts/input.txt")) {
+ $maj_font_input = file_get_contents("data/fonts/input.txt");
+ echo "\n\tfont-family: $maj_font_input,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.search {
+ width: 100%;
color: #666666;
background: #ffffff;
- width: 100%;
-
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/input.txt")) {
- $maj_font_input = file_get_contents("data/fonts/input.txt");
- echo "{$maj_font_input},";
- }
- ?> arial,helvetica,sans-serif;
+ font-family: arial,helvetica,sans-serif;
+ <?php
+
+ echo "font-size: $maj_font_Mpx;";
+
+ if (file_exists("data/fonts/input.txt")) {
+ $maj_font_input = file_get_contents("data/fonts/input.txt");
+ echo "\n\tfont-family: $maj_font_input,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
+ ?>
}
.panel_free {
- padding: 0px 0px 0px 0px;
- margin: 0px 0px 0px 0px;
+ padding: 0px;
+ margin: 0px;
}
-.rbtop {
- display: block;
- background: transparent;
- font-size: 1px;
- margin: 0px 0px 0px 0px;
-}
-
-.rbbottom {
- display: block;
- background: transparent;
- font-size: 1px;
- margin: 0px 0px 10px 0px;
-}
-
-.rb1t,.rb2t,.rb3t,.rb4t,.rb1b,.rb2b,.rb3b,.rb4b,.rb1e,.rb2e,.rb3e,.rb4e {
- display: block;
- overflow: hidden;
-}
-
-.rb1t,.rb2t,.rb3t,.rb1b,.rb2b,.rb3b,.rb1e,.rb2e,.rb3e {
- height: 1px;
-}
-
-.rb2t,.rb3t,.rb4t {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb2b,.rb3b,.rb4b {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
+.panel_entry_body {
+ padding: 5px;
+ margin: 0px;
+ color: #666666;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 1px;
+ border-style: solid;
+ font-family: arial,helvetica,sans-serif;
+ <?php
-.rb2e,.rb3e,.rb4e {
- border-left: 1px solid;
- border-right: 1px solid;
-
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb1t,.rb1b,.rb1e {
- margin: 0 5px;
-
- background: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rb2t,.rb2b,.rb2e {
- margin: 0 3px;
- border-width: 0 2px;
-}
-
-.rb3t,.rb3b,.rb3e {
- margin: 0 2px;
-}
-
-.rb4t,.rb4b,.rb4e {
- height: 2px;
- margin: 0 1px;
-}
-
-.xtitle {
- display: block;
- border:0 solid;
- border-width:0 1px;
- padding: 1px 5px 5px 5px;
- font-weight: bold;
+ echo "font-size: $maj_font_Mpx;";
- font-size: <?php echo $maj_font_12px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-title.txt")) {
- $maj_font_panel_title = file_get_contents("data/fonts/panel-title.txt");
- echo "{$maj_font_panel_title},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pt-font.txt")) {
- $maj_panel_title_font_color = file_get_contents("data/colors/pt-font.txt");
- echo $maj_panel_title_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pt-bg.txt")) {
- $maj_panel_title_background_color = file_get_contents("data/colors/pt-bg.txt");
- echo $maj_panel_title_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_title_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_title_border_color;
- }
- else {
- echo "#cccccc";
- };
- ?>;
-}
-
-.rbspace {
- height: 3px;
-}
+ if (file_exists("data/colors/pb-font.txt")) {
+ $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
+ echo "\n\tcolor: $maj_panel_body_font_color;";
+ }
-.panel_entry_body {
- margin: 0px 0px 0px 0px;
-
- font-size: <?php echo $maj_font_11px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-body.txt")) {
- $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
- echo "{$maj_font_panel_body},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pb-font.txt")) {
- $maj_panel_body_font_color = file_get_contents("data/colors/pb-font.txt");
- echo $maj_panel_body_font_color;
- }
- else {
- echo "#666666";
- }
- ?>;
+ if (file_exists("data/colors/pb-bg.txt")) {
+ $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_body_background_color;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'padding: 5px 5px 2px 5px;';
- }
- else {
- echo 'padding: 5px 5px 5px 5px;';
- }
- ?>
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_body_border_color;";
+ }
- background-color: <?php
- if (file_exists("data/colors/pb-bg.txt")) {
- $maj_panel_body_background_color = file_get_contents("data/colors/pb-bg.txt");
- echo $maj_panel_body_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_body_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_body_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ if (file_exists("data/fonts/panel-body.txt")) {
+ $maj_font_panel_body = file_get_contents("data/fonts/panel-body.txt");
+ echo "\n\tfont-family: $maj_font_panel_body,arial,helvetica,sans-serif;";
+ }
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 1px 1px 1px 1px;';
- echo 'border-style: solid solid solid solid;';
- }
+ echo "\n";
+
?>
}
.panel_category {
- padding: 5px 5px 5px 5px;
- margin: 0px 0px 0px 0px;
+ padding: 5px;
+ margin: 0px;
+ color: #999999;
+ background-color: transparent;
+ border-color: #cccccc;
+ border-width: 0px 1px 1px 1px;
+ border-style: none solid solid solid;
text-align: left;
+ font-family: arial,helvetica,sans-serif;
+ <?php
- font-size: <?php echo $maj_font_10px; ?>;
-
- font-family: <?php
- if (file_exists("data/fonts/panel-footer.txt")) {
- $maj_font_panel_category = file_get_contents("data/fonts/panel-footer.txt");
- echo "{$maj_font_panel_category},";
- }
- ?> arial,helvetica,sans-serif;
-
- color: <?php
- if (file_exists("data/colors/pf-font.txt")) {
- $maj_panel_category_font_color = file_get_contents("data/colors/pf-font.txt");
- echo $maj_panel_category_font_color;
- }
- else {
- echo "#999999";
- }
- ?>;
-
- background-color: <?php
- if (file_exists("data/colors/pf-bg.txt")) {
- $maj_panel_category_background_color = file_get_contents("data/colors/pf-bg.txt");
- echo $maj_panel_category_background_color;
- }
- else {
- echo "transparent";
- }
- ?>;
-
- border-color: <?php
- if (file_exists("data/colors/border.txt")) {
- $maj_panel_category_border_color = file_get_contents("data/colors/border.txt");
- echo $maj_panel_category_border_color;
- }
- else {
- echo "#cccccc";
- }
- ?>;
+ echo "font-size: $maj_font_Spx;";
- <?php
- if (file_exists("data/round.txt")) {
- echo 'border-width: 1px 1px 0px 1px;';
- echo 'border-style: solid solid none solid;';
- }
- else {
- echo 'border-width: 0px 1px 1px 1px;';
- echo 'border-style: none solid solid solid;';
- }
+ if (file_exists("data/colors/pf-font.txt")) {
+ $maj_panel_category_font_color = file_get_contents("data/colors/pf-font.txt");
+ echo "\n\tcolor: $maj_panel_category_font_color;";
+ }
+
+ if (file_exists("data/colors/pf-bg.txt")) {
+ $maj_panel_category_background_color = file_get_contents("data/colors/pf-bg.txt");
+ echo "\n\tbackground-color: $maj_panel_category_background_color;";
+ }
+
+ if (file_exists("data/colors/border.txt")) {
+ $maj_panel_category_border_color = file_get_contents("data/colors/border.txt");
+ echo "\n\tborder-color: $maj_panel_category_border_color;";
+ }
+
+ if (file_exists("data/fonts/panel-footer.txt")) {
+ $maj_font_panel_category = file_get_contents("data/fonts/panel-footer.txt");
+ echo "\n\tfont-family: $maj_font_panel_category,arial,helvetica,sans-serif;";
+ }
+
+ echo "\n";
+
?>
}
diff --git a/del.php b/del.php
index b3f9fc3..631d53f 100644
--- a/del.php
+++ b/del.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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 (file_exists("data/offset.txt")) {
@@ -34,31 +21,6 @@ else {
$offset = 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);
-}
-
if (isset($_SESSION['logged_in']) and ($_SESSION['logged_in'] == $login_username)) {
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry']) and isset($_REQUEST['target']) and !empty($_REQUEST['target'])) {
diff --git a/dig.php b/dig.php
index 5c90d8d..90ca003 100644
--- a/dig.php
+++ b/dig.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
if (file_exists("data/offset.txt")) {
$offset = file_get_contents("data/offset.txt");
}
diff --git a/edit.php b/edit.php
index 528f03a..028d32f 100644
--- a/edit.php
+++ b/edit.php
@@ -1,140 +1,71 @@
<?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'])) {
- exit();
-}
-
-if (!file_exists("data/items/{$_REQUEST['entry']}")) {
- exit();
-}
-
-if (!isset($_SESSION['logged_in'])) {
- exit();
-}
-
-$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) {
- 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);
-}
-
-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);
- $last = $val{strlen($val)-1};
-
- 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;
-}
-
+ session_start();
+
+ header("Cache-control: private");
+
+ error_reporting(E_ERROR);
+
+ require("core.php");
+
+ if (isset($_SESSION['logged_in']) and ($_SESSION['user_agent'] != $_SERVER['HTTP_USER_AGENT'])) {
+ header("Location: login.php");
+ }
+
+ $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'])) {
+ exit();
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}")) {
+ exit();
+ }
+
+ if (!isset($_SESSION['logged_in'])) {
+ exit();
+ }
+
+ $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) {
+ exit();
+ }
+
+ $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";
+
+ $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>
@@ -142,373 +73,371 @@ if ($server_post_max_size > $server_memory_limit) {
<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;
+ 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;
+ font-size: 11px;
}
a {
- font-weight: bold;
- text-decoration: none;
+ font-weight: bold;
+ text-decoration: none;
}
a:link, a:visited {
- color: #666666;
+ color: #666666;
}
a:hover {
- color: #336699;
+ color: #336699;
}
a:active {
- color: #336699;
+ 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_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
+.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;
+ 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;
+ 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;
+ 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
+.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"); } ?>
+<?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")) {
- mkdir("data/items/{$_REQUEST['entry']}/members");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
- mkdir("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/imembers")) {
- mkdir("data/items/{$_REQUEST['entry']}/imembers");
- }
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
- mkdir("data/items/{$_REQUEST['entry']}/imembers/{$_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 (file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
- rmdirr("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}");
- }
- }
-}
-
-if (isset($_POST['category']) and !empty($_POST['category'])) {
-
- if (file_exists("data/categories/{$_REQUEST['category']}/members")) {
-
- if ($dh_cat_members = opendir("data/categories/{$_REQUEST['category']}/members")) {
-
- while (($get_cat_member = readdir($dh_cat_members)) !== false) {
-
- if ($get_cat_member != "." && $get_cat_member != "..") {
-
- if (file_exists("data/members/active/$get_cat_member")) {
- $get_cat_members[] = $get_cat_member;
- }
- else {
- rmdirr("data/categories/{$_REQUEST['category']}/members/$get_cat_member");
- }
- }
- }
- closedir($dh_cat_members);
- }
- }
-
- 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 (file_exists("data/categories")) {
-
- if ($dh_get_categories = opendir("data/categories")) {
-
- while (($get_category = readdir($dh_get_categories)) !== false) {
-
- if ($get_category != "." && $get_category != "..") {
- $get_categories[] = $get_category;
- }
- }
- closedir($dh_get_categories);
- }
-
- foreach ($get_cat_members as $get_cat_mem) {
-
- $count_mem = 0;
-
- foreach ($get_categories as $get_category) {
-
- if (file_exists("data/categories/$get_category/members/$get_cat_mem") and ($_REQUEST['category'] != $get_category) and file_exists("data/items/{$_REQUEST['entry']}/categories/$get_category")) {
- $count_mem = $count_mem + 1;
- }
- }
-
- if (($count_mem < 1) and !file_exists("data/items/{$_REQUEST['entry']}/imembers/$get_cat_mem")) {
- rmdirr("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
- }
- }
-
- }
- }
-
- 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']}");
-
- foreach ($get_cat_members as $get_cat_mem) {
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/members/$get_cat_mem")) {
- mkdir("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
- }
- }
- }
-}
-
-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";
- $open_comment_txt_file = fopen($comment_txt_file,"w");
- fwrite($open_comment_txt_file,$comment_txt);
- fclose($open_comment_txt_file);
-
- $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt";
- $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
- $comment_revisions_count = fread($fp_comment_revisions_file, filesize($comment_revisions_file));
- fclose($fp_comment_revisions_file);
-
- $comment_revisions_count = $comment_revisions_count + 1;
- $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
- fwrite($fp_comment_revisions_file, $comment_revisions_count);
- fclose($fp_comment_revisions_file);
-}
-
-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']}")) {
- exit();
- }
-
+ 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")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members/{$_POST['auth_member']}");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/imembers")) {
+ mkdir("data/items/{$_REQUEST['entry']}/imembers");
+ }
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
+ mkdir("data/items/{$_REQUEST['entry']}/imembers/{$_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 (file_exists("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}")) {
+ rmdirr("data/items/{$_REQUEST['entry']}/imembers/{$_POST['auth_member']}");
+ }
+ }
+ }
+
+ if (isset($_POST['category']) and !empty($_POST['category'])) {
+ if (file_exists("data/categories/{$_REQUEST['category']}/members")) {
+ if ($dh_cat_members = opendir("data/categories/{$_REQUEST['category']}/members")) {
+ while (($get_cat_member = readdir($dh_cat_members)) !== false) {
+ if ($get_cat_member != "." && $get_cat_member != "..") {
+ if (file_exists("data/members/active/$get_cat_member")) {
+ $get_cat_members[] = $get_cat_member;
+ } else {
+ rmdirr("data/categories/{$_REQUEST['category']}/members/$get_cat_member");
+ }
+ }
+ }
+ closedir($dh_cat_members);
+ }
+ }
+
+ 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 (file_exists("data/categories")) {
+ if ($dh_get_categories = opendir("data/categories")) {
+ while (($get_category = readdir($dh_get_categories)) !== false) {
+ if ($get_category != "." && $get_category != "..") {
+ $get_categories[] = $get_category;
+ }
+ }
+ closedir($dh_get_categories);
+ }
+
+ foreach ($get_cat_members as $get_cat_mem) {
+ $count_mem = 0;
+
+ foreach ($get_categories as $get_category) {
+ if (file_exists("data/categories/$get_category/members/$get_cat_mem") and ($_REQUEST['category'] != $get_category) and file_exists("data/items/{$_REQUEST['entry']}/categories/$get_category")) {
+ $count_mem = $count_mem + 1;
+ }
+ }
+
+ if (($count_mem < 1) and !file_exists("data/items/{$_REQUEST['entry']}/imembers/$get_cat_mem")) {
+ rmdirr("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
+ }
+ }
+ }
+ }
+
+ 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']}");
+
+ foreach ($get_cat_members as $get_cat_mem) {
+ if (!file_exists("data/items/{$_REQUEST['entry']}/members/$get_cat_mem")) {
+ mkdir("data/items/{$_REQUEST['entry']}/members/$get_cat_mem");
+ }
+ }
+ }
+ }
+
+ 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";
+ $open_comment_txt_file = fopen($comment_txt_file, "w");
+ fwrite($open_comment_txt_file, $comment_txt);
+ fclose($open_comment_txt_file);
+
+ $comment_revisions_file = "data/items/{$_REQUEST['entry']}/comments/{$_REQUEST['type']}/{$_REQUEST['comment']}/revisions.txt";
+ $fp_comment_revisions_file = fopen($comment_revisions_file, "r");
+ $comment_revisions_count = fread($fp_comment_revisions_file, filesize($comment_revisions_file));
+ fclose($fp_comment_revisions_file);
+
+ $comment_revisions_count = $comment_revisions_count + 1;
+ $fp_comment_revisions_file = fopen($comment_revisions_file, "w");
+ fwrite($fp_comment_revisions_file, $comment_revisions_count);
+ fclose($fp_comment_revisions_file);
+ }
+
+ 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']}")) {
+ exit();
+ }
?>
- <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>
- <div id="panel_footer"><font style="font-size: 10px; color: #999999;">
- <?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";
- $open_comment_txt_file = fopen($comment_txt_file,"r");
- $read_comment_txt_file = fread($open_comment_txt_file,filesize($comment_txt_file));
- fclose($open_comment_txt_file);
-
- $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>
+ <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>
+ <div id="panel_footer"><font style="font-size: 10px; color: #999999;">
+ <?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";
+ $open_comment_txt_file = fopen($comment_txt_file, "r");
+ $read_comment_txt_file = fread($open_comment_txt_file, filesize($comment_txt_file));
+ fclose($open_comment_txt_file);
+
+ $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
- exit();
-}
-
+ exit();
+ }
?>
<table border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#cccccc"><tr><td width="525">
-<div id="panel_title"><?php readfile($title_file); ?></div>
-<div id="panel_body"><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php readfile($body_file); ?></td></tr></table></div>
-<div id="panel_footer"><font style="font-size: 10px; color: #999999;"><?php
-
-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 ')';
-}
-
+<div id="panel_title"><?php
+ readfile($title_file);
+?></div>
+<div id="panel_body"><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php
+ readfile($body_file);
+?></td></tr></table></div>
+<div id="panel_footer"><font style="font-size: 10px; color: #999999;"><?php
+ 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>
@@ -518,128 +447,180 @@ if (file_exists($revisions_file)) {
<p><table border="0" cellspacing="2" cellpadding="0" bgcolor="#ffffff">
-<?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"))) { ?>
+<?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; ?>">
+<input type="hidden" name="max_file_size" value="<?php
+ echo $max_file_size;
+?>">
<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 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 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 } ?>
+ <tr><td><input autocomplete="off" type="password" name="passwd" <?php
+ if (file_exists("data/items/{$_REQUEST['entry']}/passwd.txt")) {
+ echo "value=\"password\"";
+ }
+?>
- <?php
+ > <?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 "\"";
+ }
+?>
- if (file_exists("data/bb.txt") and file_exists("data/wiki.txt")) { ?>
+ > <?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="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>
+ <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
+ }
+?>
- }
+ <?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>
+ <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 } ?>
+<?php
+ }
+?>
</table></p>
-<input type="hidden" name="entry" value="<?php echo $_REQUEST['entry']; ?>">
+<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><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
-
-$open_body_file = fopen($body_file,"r");
-$read_body_file = fread($open_body_file,filesize($body_file));
-fclose($open_body_file);
-
-$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;
-
+<?php
+ $open_body_file = fopen($body_file, "r");
+ $read_body_file = fread($open_body_file, filesize($body_file));
+ fclose($open_body_file);
+
+ $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">
+<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>
@@ -669,848 +650,614 @@ echo $body_read_content;
</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 != "..") {
-
- 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 != "..") {
-
- if (file_exists("data/members/active/$ack_member")) {
- $ack_members[] = $ack_member;
- }
- else {
- rmdirr("data/items/{$_REQUEST['entry']}/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
-
+ // 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 != "..") {
+ 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 != "..") {
+ if (file_exists("data/members/active/$ack_member")) {
+ $ack_members[] = $ack_member;
+ } else {
+ rmdirr("data/items/{$_REQUEST['entry']}/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'])) {
- exit();
-}
-
-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);
-
-$fp_revisions_file = fopen($revisions_file, "r");
-$revisions_count = fread($fp_revisions_file, filesize($revisions_file));
-fclose($fp_revisions_file);
-
-$revisions_count = $revisions_count + 1;
-
-$fp_revisions_file = fopen($revisions_file, "w");
-fwrite($fp_revisions_file, $revisions_count);
-fclose($fp_revisions_file);
-
-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");
- fwrite($fp_caption_txt,$caption_txt);
- fclose($fp_caption_txt);
- }
- }
-
- $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']);
-
- $fp_file_txt = fopen("data/items/{$_REQUEST['entry']}/filedrop/{$file_input_name}.txt","w");
- fwrite($fp_file_txt,"data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name");
- fclose($fp_file_txt);
- }
- 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;
- }
-
- $ddate = date("YmdHis", time() + $offset);
-
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
- }
-
- $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
- fwrite($new_body,$body_write_content);
- fclose($new_body);
-
- $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
- fwrite($new_title,$title_write_content);
- fclose($new_title);
-
- copy("data/items/{$_REQUEST['entry']}/title.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/ptitle.txt");
- 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");
- }
-
- $open_editor_file = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/editor.txt","w");
- fwrite($open_editor_file,$_SESSION['logged_in']);
- fclose($open_editor_file);
- }
-}
-
-$open_title_file = fopen($title_file,"w");
-fwrite($open_title_file,$title_write_content);
-fclose($open_title_file);
-
-$open_body_file = fopen($body_file,"w");
-fwrite($open_body_file,$body_write_content);
-fclose($open_body_file);
-
-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']))) {
- $open_contrib_file = fopen("data/items/{$_REQUEST['entry']}/contrib.txt","w");
- fwrite($open_contrib_file,$_SESSION['logged_in']);
- fclose($open_contrib_file);
-}
-
-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")) {
- $fp_passwd_txt = fopen("$passwd_file","w");
- $passwd_crypt = sha1($_POST['passwd']);
- $passwd_crypt = md5($passwd_crypt);
- $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
- fwrite($fp_passwd_txt, $passwd_crypt);
- fclose($fp_passwd_txt);
- }
-
- 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'])) {
- $fp_maxlines_txt = fopen("data/items/{$_REQUEST['entry']}/maxlines.txt","w");
- fwrite($fp_maxlines_txt, $_POST['maxlines']);
- fclose($fp_maxlines_txt);
- }
-
- 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");
-}
-
-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);
- }
-}
-
+ if (!isset($_POST['title_input']) or !isset($_POST['body_input']) or empty($_POST['title_input']) or empty($_POST['body_input'])) {
+ exit();
+ }
+
+ 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");
+
+ $title_write_content = format_title_put($_POST['title_input']);
+ $body_write_content = format_body_put($_POST['body_input']);
+
+ $fp_revisions_file = fopen($revisions_file, "r");
+ $revisions_count = fread($fp_revisions_file, filesize($revisions_file));
+ fclose($fp_revisions_file);
+
+ $revisions_count = $revisions_count + 1;
+
+ $fp_revisions_file = fopen($revisions_file, "w");
+ fwrite($fp_revisions_file, $revisions_count);
+ fclose($fp_revisions_file);
+
+ 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");
+ fwrite($fp_caption_txt, $caption_txt);
+ fclose($fp_caption_txt);
+ }
+ }
+
+
+ $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']);
+
+
+ $fp_file_txt = fopen("data/items/{$_REQUEST['entry']}/filedrop/{$file_input_name}.txt", "w");
+ fwrite($fp_file_txt, "data/items/{$_REQUEST['entry']}/filedrop/files/$file_input_name");
+ fclose($fp_file_txt);
+ } 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;
+ }
+
+ $ddate = date("YmdHis", time() + $offset);
+
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
+ }
+
+ $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt", "w");
+ fwrite($new_body, $body_write_content);
+ fclose($new_body);
+
+ $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt", "w");
+ fwrite($new_title, $title_write_content);
+ fclose($new_title);
+
+ copy("data/items/{$_REQUEST['entry']}/title.txt", "data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/ptitle.txt");
+ 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");
+ }
+
+ $open_editor_file = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/editor.txt", "w");
+ fwrite($open_editor_file, $_SESSION['logged_in']);
+ fclose($open_editor_file);
+ }
+ }
+
+ $open_title_file = fopen($title_file, "w");
+ fwrite($open_title_file, $title_write_content);
+ fclose($open_title_file);
+
+ $open_body_file = fopen($body_file, "w");
+ fwrite($open_body_file, $body_write_content);
+ fclose($open_body_file);
+
+ 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']))) {
+ $open_contrib_file = fopen("data/items/{$_REQUEST['entry']}/contrib.txt", "w");
+ fwrite($open_contrib_file, $_SESSION['logged_in']);
+ fclose($open_contrib_file);
+ }
+
+ 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";
+
+ $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")) {
+ $fp_passwd_txt = fopen("$passwd_file", "w");
+ $passwd_crypt = sha1($_POST['passwd']);
+ $passwd_crypt = md5($passwd_crypt);
+ $passwd_crypt = crypt($passwd_crypt, $passwd_crypt);
+ fwrite($fp_passwd_txt, $passwd_crypt);
+ fclose($fp_passwd_txt);
+ }
+
+ 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'])) {
+ $fp_maxlines_txt = fopen("data/items/{$_REQUEST['entry']}/maxlines.txt", "w");
+ fwrite($fp_maxlines_txt, $_POST['maxlines']);
+ fclose($fp_maxlines_txt);
+ }
+
+ 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");
+ }
+
+ 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);
+ }
+ }
?>
diff --git a/fonts.php b/fonts.php
index b63fcc4..a3fff89 100644
--- a/fonts.php
+++ b/fonts.php
@@ -6,25 +6,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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);
- }
- }
- $_POST = stripslashes_array($_POST);
-}
-
$login_username = file_get_contents("data/username.txt");
if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
@@ -35,31 +22,6 @@ if (!file_exists("data/fonts")) {
mkdir("data/fonts");
}
-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($_POST['reset']) and !empty($_POST['reset']) and ($_POST['reset'] == "go")) {
rmdirr("data/fonts");
}
diff --git a/fpdf.php b/fpdf.php
old mode 100755
new mode 100644
diff --git a/index.php b/index.php
index b449098..2dd7618 100644
--- a/index.php
+++ b/index.php
@@ -8,25 +8,12 @@ header("Cache-control: private");
error_reporting(E_ERROR);
+require("core.php");
+
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($maj_data) {
- if (is_array($maj_data)) {
- foreach ($maj_data as $maj_key => $maj_value) {
- $maj_data[$maj_key] = stripslashes_array($maj_value);
- }
- return $maj_data;
- }
- else {
- return stripslashes($maj_data);
- }
- }
- $_REQUEST = stripslashes_array($_REQUEST);
-}
-
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
$maj_req_entry = trim($_REQUEST['entry']);
}
@@ -89,7 +76,7 @@ $maj_wtable = $maj_wside + $maj_wspace + $maj_wmain + $maj_wspace + $maj_wside;
$maj_default_blog_title = "My Activity Journal";
$maj_default_username = "maj";
$maj_default_password = "php";
-$maj_default_blog_profile = 'This cool site is powered by <a href="http://maj.sourceforge.net/" target="_maj">My Activity Journal</a>, a simple, <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://www.opensource.org/licenses/gpl-license.php" target="_maj">Open Source</a> blog written from scratch as a spare time family project by <a href="http://psylocke.org/" target="_maj">Psylocke</a>, <a href="http://gaffud.com/" target="_maj">Magie</a>, and <a href="http://engels.mortega.net/" target="_maj">Engels</a> Antonio.';
+$maj_default_blog_profile = 'This cool site is powered by My Activity Journal (<a href="http://majcms.org/" target="_maj">MAJ</a>), a simple, <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://opensource.org/" target="_maj">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.';
$maj_default_blog_author = "My Activity Journal";
if (!file_exists("data")) {
@@ -185,31 +172,6 @@ function str_rand($maj_length = 8,$maj_seeds = 'abcdefghijklmnopqrstuvwxyz012345
return $maj_str;
}
-function rmdirr($maj_recurse_dirname) {
-
- if (!file_exists($maj_recurse_dirname)) {
- return false;
- }
-
- if (is_file($maj_recurse_dirname)) {
- return unli