This commit has been accessed 582 times via Git panel.
commit f5857046e48407a8e2a3763afb328bd5db1edcf4
tree 5b6c01d1986fd28aab7e80054557146fc4d3d39a
parent 73154ff659b8bf22cba60ab651b1c3f9197a6682
author Engels Antonio <engels@majcms.org> 1277314208 +0800
committer Engels Antonio <engels@majcms.org> 1277314208 +0800
maj-1.0-20090112-bb.zip
diff --git a/edit.php b/edit.php
index 7caf5ca..944a671 100644
--- a/edit.php
+++ b/edit.php
@@ -94,11 +94,11 @@ function entry2date($f_entry) {
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';
+$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";
$max_image_size = 8000000;
$max_file_size = 8000000;
@@ -249,6 +249,10 @@ if (isset($_POST['category']) and !empty($_POST['category'])) {
if (($_POST['do'] == "unfile") and file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
rmdirr("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}");
+
+ if (count(glob("data/items/{$_REQUEST['entry']}/categories/*")) < 1) {
+ rmdirr("data/items/{$_REQUEST['entry']}/categories");
+ }
}
if (($_POST['do'] == "file") and !file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
@@ -600,10 +604,22 @@ if ($count_unfiled_cat > 0) {
</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");
+
$title_write_content = ucfirst($_POST['title_input']);
$title_write_content = str_replace('<','<',$title_write_content);
$title_write_content = str_replace('>','>',$title_write_content);
@@ -696,7 +712,9 @@ $body_write_content = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_
$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);
@@ -886,46 +904,51 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
if (file_exists("data/wiki.txt")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki");
- }
+ $old_title = file_get_contents("data/items/{$_REQUEST['entry']}/title.old");
+ $old_body = file_get_contents("data/items/{$_REQUEST['entry']}/body.old");
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta");
- }
+ if (($old_title != $title_write_content) or ($old_body != $body_write_content)) {
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki");
+ }
- $ddate = date("YmdHis", time() + $offset);
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta");
+ }
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
- }
+ if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+ }
+ else {
+ $offset = 0;
+ }
- $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
- fwrite($new_body,$body_write_content);
- fclose($new_body);
+ $ddate = date("YmdHis", time() + $offset);
- $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
- fwrite($new_title,$title_write_content);
- fclose($new_title);
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
+ }
- copy("data/items/{$_REQUEST['entry']}/body.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/prev.txt");
- copy("data/items/{$_REQUEST['entry']}/date.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/date.txt");
+ $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
+ fwrite($new_body,$body_write_content);
+ fclose($new_body);
- 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");
- }
+ $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
+ fwrite($new_title,$title_write_content);
+ fclose($new_title);
- $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);
+ 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_body_file = fopen($body_file,"w");
@@ -1173,22 +1196,25 @@ if ($_SESSION['logged_in'] == $login_username) {
}
}
-$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
-$ping_urls_file = "data/ping.txt";
+if (file_exists("data/items/{$_REQUEST['entry']}/title.old")) {
+ unlink("data/items/{$_REQUEST['entry']}/title.old");
+}
-if (!file_exists($ping_urls_file)) {
- $fp_default_ping_txt = fopen($ping_urls_file,"w");
- fwrite($fp_default_ping_txt, $default_ping_urls);
- fclose($fp_default_ping_txt);
+if (file_exists("data/items/{$_REQUEST['entry']}/body.old")) {
+ unlink("data/items/{$_REQUEST['entry']}/body.old");
}
-$fp_ping_urls = fopen($ping_urls_file, "r");
-$ping_urls = fread($fp_ping_urls, filesize($ping_urls_file));
-fclose($fp_ping_urls);
+$default_ping_url = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+
+if (!file_exists("data/ping.txt")) {
+ $fp_default_ping_txt = fopen("data/ping.txt","w");
+ fwrite($fp_default_ping_txt, $default_ping_url);
+ fclose($fp_default_ping_txt);
+}
-$get_ping_urls = explode("|", $ping_urls);
+$ping_urls = explode("|", file_get_contents("data/ping.txt"));
-foreach ($get_ping_urls as $ping_url) {
+foreach ($ping_urls as $ping_url) {
$ping = file_get_contents($ping_url);
unset($ping);
}
diff --git a/rel.txt b/rel.txt
index ae8828e..56d9d61 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-20081231
\ No newline at end of file
+20090112
\ No newline at end of file
tree 5b6c01d1986fd28aab7e80054557146fc4d3d39a
parent 73154ff659b8bf22cba60ab651b1c3f9197a6682
author Engels Antonio <engels@majcms.org> 1277314208 +0800
committer Engels Antonio <engels@majcms.org> 1277314208 +0800
maj-1.0-20090112-bb.zip
diff --git a/edit.php b/edit.php
index 7caf5ca..944a671 100644
--- a/edit.php
+++ b/edit.php
@@ -94,11 +94,11 @@ function entry2date($f_entry) {
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';
+$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";
$max_image_size = 8000000;
$max_file_size = 8000000;
@@ -249,6 +249,10 @@ if (isset($_POST['category']) and !empty($_POST['category'])) {
if (($_POST['do'] == "unfile") and file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
rmdirr("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}");
+
+ if (count(glob("data/items/{$_REQUEST['entry']}/categories/*")) < 1) {
+ rmdirr("data/items/{$_REQUEST['entry']}/categories");
+ }
}
if (($_POST['do'] == "file") and !file_exists("data/items/{$_REQUEST['entry']}/categories/{$_REQUEST['category']}")) {
@@ -600,10 +604,22 @@ if ($count_unfiled_cat > 0) {
</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");
+
$title_write_content = ucfirst($_POST['title_input']);
$title_write_content = str_replace('<','<',$title_write_content);
$title_write_content = str_replace('>','>',$title_write_content);
@@ -696,7 +712,9 @@ $body_write_content = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_
$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);
@@ -886,46 +904,51 @@ if (isset($_FILES['file_input']) and !empty($_FILES['file_input'])) {
if (file_exists("data/wiki.txt")) {
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki");
- }
+ $old_title = file_get_contents("data/items/{$_REQUEST['entry']}/title.old");
+ $old_body = file_get_contents("data/items/{$_REQUEST['entry']}/body.old");
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta");
- }
+ if (($old_title != $title_write_content) or ($old_body != $body_write_content)) {
- if (file_exists("data/offset.txt")) {
- $offset = file_get_contents("data/offset.txt");
- }
- else {
- $offset = 0;
- }
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki");
+ }
- $ddate = date("YmdHis", time() + $offset);
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta");
+ }
- if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
- mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
- }
+ if (file_exists("data/offset.txt")) {
+ $offset = file_get_contents("data/offset.txt");
+ }
+ else {
+ $offset = 0;
+ }
- $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
- fwrite($new_body,$body_write_content);
- fclose($new_body);
+ $ddate = date("YmdHis", time() + $offset);
- $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
- fwrite($new_title,$title_write_content);
- fclose($new_title);
+ if (!file_exists("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate")) {
+ mkdir("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate");
+ }
- copy("data/items/{$_REQUEST['entry']}/body.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/prev.txt");
- copy("data/items/{$_REQUEST['entry']}/date.txt","data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/date.txt");
+ $new_body = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/body.txt","w");
+ fwrite($new_body,$body_write_content);
+ fclose($new_body);
- 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");
- }
+ $new_title = fopen("data/items/{$_REQUEST['entry']}/wiki/delta/$ddate/title.txt","w");
+ fwrite($new_title,$title_write_content);
+ fclose($new_title);
- $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);
+ 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_body_file = fopen($body_file,"w");
@@ -1173,22 +1196,25 @@ if ($_SESSION['logged_in'] == $login_username) {
}
}
-$default_ping_urls = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
-$ping_urls_file = "data/ping.txt";
+if (file_exists("data/items/{$_REQUEST['entry']}/title.old")) {
+ unlink("data/items/{$_REQUEST['entry']}/title.old");
+}
-if (!file_exists($ping_urls_file)) {
- $fp_default_ping_txt = fopen($ping_urls_file,"w");
- fwrite($fp_default_ping_txt, $default_ping_urls);
- fclose($fp_default_ping_txt);
+if (file_exists("data/items/{$_REQUEST['entry']}/body.old")) {
+ unlink("data/items/{$_REQUEST['entry']}/body.old");
}
-$fp_ping_urls = fopen($ping_urls_file, "r");
-$ping_urls = fread($fp_ping_urls, filesize($ping_urls_file));
-fclose($fp_ping_urls);
+$default_ping_url = "http://technorati.com/ping/http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
+
+if (!file_exists("data/ping.txt")) {
+ $fp_default_ping_txt = fopen("data/ping.txt","w");
+ fwrite($fp_default_ping_txt, $default_ping_url);
+ fclose($fp_default_ping_txt);
+}
-$get_ping_urls = explode("|", $ping_urls);
+$ping_urls = explode("|", file_get_contents("data/ping.txt"));
-foreach ($get_ping_urls as $ping_url) {
+foreach ($ping_urls as $ping_url) {
$ping = file_get_contents($ping_url);
unset($ping);
}
diff --git a/rel.txt b/rel.txt
index ae8828e..56d9d61 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-20081231
\ No newline at end of file
+20090112
\ No newline at end of file