This commit has been accessed 543 times via Git panel.
commit 13a084131b7d7c2b22226df912dc959b15434203
tree 6e96a2d8b6e2b86bf6e9a7e7d227d970485e85e2
parent d444a44393ca5985a031d7ef256732c751d63232
author Engels Antonio <engels@majcms.org> 1277492361 +0800
committer Engels Antonio <engels@majcms.org> 1277492361 +0800
Update wiki delta tracker
diff --git a/edit.php b/edit.php
index d3c95a1..268d2d6 100644
--- a/edit.php
+++ b/edit.php
@@ -883,10 +883,6 @@ $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);
-$open_title_file = fopen($title_file,"w");
-fwrite($open_title_file,$title_write_content);
-fclose($open_title_file);
-
function reformat_html($defang_html) {
$store_html=split("<html>",$defang_html);
$defang_html="";
@@ -1198,6 +1194,7 @@ if (file_exists("data/wiki.txt")) {
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");
@@ -1211,6 +1208,10 @@ if (file_exists("data/wiki.txt")) {
}
}
+$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);
diff --git a/rel.txt b/rel.txt
index 34f5e8c..1fa96fa 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201006260136
+201006260247
diff --git a/wiki.php b/wiki.php
index c8c576a..7307039 100644
--- a/wiki.php
+++ b/wiki.php
@@ -238,10 +238,11 @@ del {
if (!file_exists("data/items/$entry/wiki/delta/$ddate"))
{
mkdir("data/items/$entry/wiki/delta/$ddate");
- copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/title.txt");
+ copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/ptitle.txt");
copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/prev.txt");
copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/title.txt","data/items/$entry/title.txt");
- copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/body.txt","data/items/$entry/body.txt");
+ copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/prev.txt","data/items/$entry/body.txt");
+ copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/title.txt");
copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/body.txt");
if (file_exists("data/items/$entry/contrib.txt"))
{
@@ -273,6 +274,7 @@ del {
foreach ($show_delta as $item)
{
$title = file_get_contents("data/items/$entry/wiki/delta/$item/title.txt");
+ $ptitle = file_get_contents("data/items/$entry/wiki/delta/$item/ptitle.txt");
$body = file_get_contents("data/items/$entry/wiki/delta/$item/body.txt");
$author = file_get_contents("data/items/$entry/author.txt");
$editor = file_get_contents("data/items/$entry/wiki/delta/$item/editor.txt");
@@ -314,8 +316,39 @@ del {
}
$diff = str_replace("<br>", "<br>", $diff);
$diff = trim($diff);
+
+ $ptitle_array = explode(" ", $ptitle);
+ $title_array = explode(" ", $title);
+
+ if (count($ptitle_array) <= count($title_array))
+ {
+ $telements = count($title_array);
+ }
+ else
+ {
+ $telements = count($ptitle_array);
+ }
+ $tcount = "0";
+ $telements = $telements - 1;
+ $tdiff = "";
+ while ($tcount <= $telements)
+ {
+ if ($ptitle_array[$tcount] == $title_array[$tcount])
+ {
+ $tdiff .= $ptitle_array[$tcount] . " ";
+ }
+ else
+ {
+ $tdiff .= "<del>" . $ptitle_array[$tcount] . "</del> <ins>" . $title_array[$tcount] . " </ins> ";
+ }
+ $tcount = $tcount + 1;
+ }
+ //$tdiff = str_replace("<br>", "<br>", $tdiff);
+ $tdiff = trim($tdiff);
+
echo "<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCCC\"><tr><td width=\"525\">";
- echo "<div id=\"panel_title\">$title";
+ echo "<div id=\"panel_title\">$tdiff";
+
if ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))
{
echo "<a href=\"wiki.php?entry=$entry&del=$item\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"delete\"></a>";
tree 6e96a2d8b6e2b86bf6e9a7e7d227d970485e85e2
parent d444a44393ca5985a031d7ef256732c751d63232
author Engels Antonio <engels@majcms.org> 1277492361 +0800
committer Engels Antonio <engels@majcms.org> 1277492361 +0800
Update wiki delta tracker
diff --git a/edit.php b/edit.php
index d3c95a1..268d2d6 100644
--- a/edit.php
+++ b/edit.php
@@ -883,10 +883,6 @@ $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);
-$open_title_file = fopen($title_file,"w");
-fwrite($open_title_file,$title_write_content);
-fclose($open_title_file);
-
function reformat_html($defang_html) {
$store_html=split("<html>",$defang_html);
$defang_html="";
@@ -1198,6 +1194,7 @@ if (file_exists("data/wiki.txt")) {
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");
@@ -1211,6 +1208,10 @@ if (file_exists("data/wiki.txt")) {
}
}
+$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);
diff --git a/rel.txt b/rel.txt
index 34f5e8c..1fa96fa 100644
--- a/rel.txt
+++ b/rel.txt
@@ -1 +1 @@
-201006260136
+201006260247
diff --git a/wiki.php b/wiki.php
index c8c576a..7307039 100644
--- a/wiki.php
+++ b/wiki.php
@@ -238,10 +238,11 @@ del {
if (!file_exists("data/items/$entry/wiki/delta/$ddate"))
{
mkdir("data/items/$entry/wiki/delta/$ddate");
- copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/title.txt");
+ copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/ptitle.txt");
copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/prev.txt");
copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/title.txt","data/items/$entry/title.txt");
- copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/body.txt","data/items/$entry/body.txt");
+ copy("data/items/$entry/wiki/delta/{$_REQUEST['restore']}/prev.txt","data/items/$entry/body.txt");
+ copy("data/items/$entry/title.txt","data/items/$entry/wiki/delta/$ddate/title.txt");
copy("data/items/$entry/body.txt","data/items/$entry/wiki/delta/$ddate/body.txt");
if (file_exists("data/items/$entry/contrib.txt"))
{
@@ -273,6 +274,7 @@ del {
foreach ($show_delta as $item)
{
$title = file_get_contents("data/items/$entry/wiki/delta/$item/title.txt");
+ $ptitle = file_get_contents("data/items/$entry/wiki/delta/$item/ptitle.txt");
$body = file_get_contents("data/items/$entry/wiki/delta/$item/body.txt");
$author = file_get_contents("data/items/$entry/author.txt");
$editor = file_get_contents("data/items/$entry/wiki/delta/$item/editor.txt");
@@ -314,8 +316,39 @@ del {
}
$diff = str_replace("<br>", "<br>", $diff);
$diff = trim($diff);
+
+ $ptitle_array = explode(" ", $ptitle);
+ $title_array = explode(" ", $title);
+
+ if (count($ptitle_array) <= count($title_array))
+ {
+ $telements = count($title_array);
+ }
+ else
+ {
+ $telements = count($ptitle_array);
+ }
+ $tcount = "0";
+ $telements = $telements - 1;
+ $tdiff = "";
+ while ($tcount <= $telements)
+ {
+ if ($ptitle_array[$tcount] == $title_array[$tcount])
+ {
+ $tdiff .= $ptitle_array[$tcount] . " ";
+ }
+ else
+ {
+ $tdiff .= "<del>" . $ptitle_array[$tcount] . "</del> <ins>" . $title_array[$tcount] . " </ins> ";
+ }
+ $tcount = $tcount + 1;
+ }
+ //$tdiff = str_replace("<br>", "<br>", $tdiff);
+ $tdiff = trim($tdiff);
+
echo "<p><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#CCCCCC\"><tr><td width=\"525\">";
- echo "<div id=\"panel_title\">$title";
+ echo "<div id=\"panel_title\">$tdiff";
+
if ($_SESSION['logged_in'] == file_get_contents("data/username.txt"))
{
echo "<a href=\"wiki.php?entry=$entry&del=$item\"><img src=\"images/widget.del.png\" border=\"0\" width=\"11\" height=\"11\" align=\"right\" alt=\"delete\"></a>";