This blob has been accessed 308 times via Git panel.
- <?php
- session_start();
- header("Cache-control: private");
- if (isset($_REQUEST['title_input']) and isset($_REQUEST['body_input']) and !empty($_REQUEST['title_input']) and !empty($_REQUEST['body_input'])) {
- header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']));
- }
- $username_file = 'data/username.txt';
- if (!isset($_SESSION['logged_in']) or ($_SESSION['logged_in'] != $login_username)) {
- }
- ?>
- <style>
- body
- {
- color: #666666;
- margin: 10px;
- padding: 0px;
- text-align: left;
- font-family: verdana, helvetica, sans-serif;
- background-color: #FFFFFF;
- }
- p
- {
- font-size: 11px;
- }
- a
- {
- font-weight: bold;
- text-decoration: none;
- }
- a:link, a:visited
- {
- color: #666666;
- }
- a:hover
- {
- color: #336699;
- }
- a:active {
- color: #336699;
- }
- .input_title {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 512px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px;
- font-weight: bold
- }
- .input_body {
- color: #666666;
- background: #ffffff;
- border: #999999 solid 1px;
- width: 512px;
- font-family: verdana,helvetica,sans-serif;
- font-size: 11px
- }
- </style>
- <?php
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
- $image_path = "images/";
- $max_image_size = 2000000;
- $max_file_size = 2000000;
- ?>
- <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
- <p>
- <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; ?>
- </select>
- <select name="select_month">
- <option selected>
- <option><?php echo $entry_month; ?>
- <option>01
- <option>02
- <option>03
- <option>04
- <option>05
- <option>06
- <option>07
- <option>08
- <option>09
- <option>10
- <option>11
- <option>12
- </select>
- <select name="select_day">
- <option selected>
- <option><?php echo $entry_day; ?>
- <option>01
- <option>02
- <option>03
- <option>04
- <option>05
- <option>06
- <option>07
- <option>08
- <option>09
- <option>10
- <option>11
- <option>12
- <option>13
- <option>14
- <option>15
- <option>16
- <option>17
- <option>18
- <option>19
- <option>20
- <option>21
- <option>22
- <option>23
- <option>24
- <option>25
- <option>26
- <option>27
- <option>28
- <option>29
- <option>30
- <option>31
- </select>
- <select name="select_hour">
- <option selected>
- <option><?php echo $entry_hour; ?>
- <option>00
- <option>01
- <option>02
- <option>03
- <option>04
- <option>05
- <option>06
- <option>07
- <option>08
- <option>09
- <option>10
- <option>11
- <option>12
- <option>13
- <option>14
- <option>15
- <option>16
- <option>17
- <option>18
- <option>19
- <option>20
- <option>21
- <option>22
- <option>23
- </select>
- <select name="select_min">
- <option selected>
- <option><?php echo $entry_min; ?>
- <option>00
- <option>01
- <option>02
- <option>03
- <option>04
- <option>05
- <option>06
- <option>07
- <option>08
- <option>09
- <option>10
- <option>11
- <option>12
- <option>13
- <option>14
- <option>15
- <option>16
- <option>17
- <option>18
- <option>19
- <option>20
- <option>21
- <option>22
- <option>23
- <option>24
- <option>25
- <option>26
- <option>27
- <option>28
- <option>29
- <option>30
- <option>31
- <option>32
- <option>33
- <option>34
- <option>35
- <option>36
- <option>37
- <option>38
- <option>39
- <option>40
- <option>41
- <option>42
- <option>43
- <option>44
- <option>45
- <option>46
- <option>47
- <option>48
- <option>49
- <option>50
- <option>51
- <option>52
- <option>53
- <option>54
- <option>55
- <option>56
- <option>57
- <option>58
- <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_image_size; ?>">
- <input autocomplete=off type=file name=image_input> Select optional image.</p>
- <p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>">
- <input autocomplete=off type=file name=file_input> Select optional file.</p>
- <?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 selected>unfiled";
- foreach ($show_cat as $category) {
- echo "<option>";
- echo strtolower($category);
- }
- echo "</select> Select category.</p>";
- }
- }
- ?>
- <p><input type=checkbox name=sticky>Put entry title in Links box.<br>
- <input type=checkbox name=display>Always display. If this is not a private entry, it will be displayed even if its category is hidden or isolated.<br>
- <input type=checkbox name=private>Private entry. This entry will unconditionally be invisible to visitors, even if always display is set.</p>
- <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></td></tr>
- <tr><td><textarea class=input_body name=body_input rows=15></textarea></td></tr>
- <tr><td><input class=input_body type=submit value="click here to post this new entry"></td></tr>
- </form>
- <form enctype="multipart/form-data" action="<?php echo 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); ?>" method="post">
- <tr><td><input class=input_body type=submit value="click here to go to the index page"></td></tr>
- </form>
- </table>
- </td><td width=10></td><td>
- <table border=0 cellspacing=1 cellpadding=2>
- <tr><td><img src=images/smileys/crying.png border=0></td><td><p>:((</p></td><td ><p>crying</p></td></tr>
- <tr><td><img src=images/smileys/frown.png border=0></td><td><p>:(</p></td><td><p>frown</p></td></tr>
- <tr><td><img src=images/smileys/indifferent.png border=0></td><td><p>:|</p></td><td><p>indifferent</p></td></tr>
- <tr><td><img src=images/smileys/laughing.png border=0></td><td><p>:D</p></td><td><p>laughing</p></td></tr>
- <tr><td><img src=images/smileys/lick.png border=0></td><td><p>:P</p></td><td><p>lick</p></td></tr>
- <tr><td><img src=images/smileys/ohno.png border=0></td><td><p>:O</p></td><td><p>oh no!</p></td></tr>
- <tr><td><img src=images/smileys/smile.png border=0></td><td><p>:)</p></td><td><p>smile</p></td></tr>
- <tr><td><img src=images/smileys/surprised.png border=0></td><td><p>=)</p></td><td><p>surprised</p></td></tr>
- <tr><td><img src=images/smileys/undecided.png border=0></td><td><p>:\</p></td><td><p>undecided</p></td></tr>
- <tr><td><img src=images/smileys/wink.png border=0></td><td><p>;)</p></td><td><p>wink</p></td></tr>
- </td></tr>
- </table>
- </td></tr></table>
- <?php
- if (!isset($_REQUEST['title_input']) or !isset($_REQUEST['body_input']) or empty($_REQUEST['title_input']) or empty($_REQUEST['body_input'])) {
- // echo "<p>no input!</p>";
- }
- if (!isset($_REQUEST['select_year']) or !isset($_REQUEST['select_month']) or !isset($_REQUEST['select_day']) or !isset($_REQUEST['select_hour']) or !isset($_REQUEST['select_min']) or empty($_REQUEST['select_year']) or empty($_REQUEST['select_month']) or empty($_REQUEST['select_day']) or empty($_REQUEST['select_hour']) or empty($_REQUEST['select_min'])) {
- // GNU date format
- //$timestamp = date("D M j H:i:s \P\H\T Y", time() + $offset);
- // Simple PHP Blog format
- echo '<p>' . $entry . '<br>' . $timestamp . '<br>' . date("l, M j, Y, g:i A") . '</p>';
- }
- else {
- $entry = $_REQUEST['select_year'] . $_REQUEST['select_month'] . $_REQUEST['select_day'] . $_REQUEST['select_hour'] . $_REQUEST['select_min'] . $entry_sec;
- // GNU date format
- //$timestamp = date("D M j H:i:s \P\H\T Y", mktime($_REQUEST['select_hour'], $_REQUEST['select_min'], $entry_sec, $_REQUEST['select_month'], $_REQUEST['select_day'], $_REQUEST['select_year']));
- // Simple PHP Blog format
- $timestamp = date("l, M j, Y, g:i A", mktime($_REQUEST['select_hour'], $_REQUEST['select_min'], $entry_sec, $_REQUEST['select_month'], $_REQUEST['select_day'], $_REQUEST['select_year']));
- echo '<p>' . $entry . '<br>' . $timestamp . '<br>' . date("l, M j, Y, g:i A") . '</p>';
- }
- if (!file_exists("data/items")) {
- mkdir("data/items");
- chmod("data/items", 0777);
- }
- $dir = "data/items/";
- $item_dir = $dir . $entry;
- if (!file_exists("images")) {
- mkdir("images");
- chmod("images", 0777);
- }
- $image_dir = 'images/' . $entry;
- $file_dir = $item_dir . '/filedrop';
- $body_write_content = ucfirst($_REQUEST['body_input']);
- $body_write_content = str_replace("\n", '<br />', $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('[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);
- mkdir($item_dir, 0777);
- chmod($item_dir, 0777);
- $title_write_content = ucfirst($_REQUEST['title_input']);
- $title_file = $item_dir . '/title.txt';
- chmod($title_file, 0666);
- $date_file = $item_dir . '/date.txt';
- chmod($date_file, 0666);
- 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_image_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, 0777);
- chmod($image_dir, 0777);
- }
- if (!file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
- $res = copy($_FILES['image_input']['tmp_name'], $image_dir . '/' . $_FILES['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, 0777);
- chmod($filedrop_dir, 0777);
- }
- $file_dir = "$filedrop_dir/files";
- if (!file_exists($file_dir)) {
- mkdir($file_dir, 0777);
- chmod($file_dir, 0777);
- }
- if (!file_exists($file_dir . '/' . $_FILES['file_input']['name'])) {
- $res = copy($_FILES['file_input']['tmp_name'], $file_dir . '/' . $_FILES['file_input']['name']);
- unlink($_FILES['file_input']['tmp_name']);
- $file_src = $file_dir . '/' . $_FILES['file_input']['name'];
- $file_file = $filedrop_dir . '/' . $_FILES['file_input']['name'] . '.txt';
- chmod($file_file, 0666);
- }
- 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';
- chmod($body_file, 0666);
- if (isset($_FILES['image_input']) and !empty($_FILES['image_input'])) {
- if (file_exists($image_dir . '/' . $_FILES['image_input']['name'])) {
- $entry_image_size = getimagesize($image_dir . '/' . $_FILES['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 . '/' . $_FILES['image_input']['name'] . ' border=0 width=' . $entry_image_width . ' height=' . $entry_image_height . '><br>' . $body_write_content;
- }
- }
- $sticky_sem = 'data/sticky/' . $entry;
- if (isset($_REQUEST['sticky']) and !empty($_REQUEST['sticky']) and ($_REQUEST['sticky'] == "on")) {
- if (!file_exists("data/sticky")) {
- mkdir("data/sticky", 0777);
- chmod("data/sticky", 0777);
- }
- if (!file_exists($sticky_sem)) {
- touch($sticky_sem);
- chmod($sticky_sem, 0666);
- }
- }
- $display_sem = "data/items/$entry/cat.txt";
- if (isset($_REQUEST['display']) and !empty($_REQUEST['display']) and ($_REQUEST['display'] == "on")) {
- if (!file_exists($display_sem)) {
- touch($display_sem);
- chmod($display_sem, 0666);
- }
- }
- $private_sem = "data/items/$entry/private.txt";
- if (isset($_REQUEST['private']) and !empty($_REQUEST['private']) and ($_REQUEST['private'] == "on")) {
- if (!file_exists($private_sem)) {
- touch($private_sem);
- chmod($private_sem, 0666);
- }
- }
- if (isset($_REQUEST['category']) and !empty($_REQUEST['category'])) {
- if (!file_exists("data/categories")) {
- mkdir("data/categories", 0777);
- chmod("data/categories", 0777);
- }
- if (file_exists("data/categories/{$_REQUEST['category']}")) {
- chmod("data/items/$entry/category.txt", 0666);
- }
- }
- $default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
- $ping_urls_file = "data/ping.txt";
- if (!file_exists($ping_urls_file)) {
- chmod($ping_urls_file, 0666);
- }
- $get_ping_urls = explode("|", $ping_urls);
- foreach ($get_ping_urls as $ping_url) {
- $ping = file_get_contents($ping_url);
- //$ping_urls_add_file = "data/ping-add.txt";
- //$fp_ping_urls_add_txt = fopen($ping_urls_add_file,"w");
- //fwrite($fp_ping_urls_add_txt, $ping);
- //fclose($fp_ping_urls_add_txt);
- //chmod($ping_urls_add_file, 0666);
- clear($ping);
- }
- ?>