Profile
MAJ is an Open Source, PHP-based content management system (CMS) that can be deployed as a blog, bulletin or message board, Internet forum, and wiki. It is extensible via PHP panels and is HTML5 and CSS3 ready.
Git
This commit has been accessed 934 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("&lt;br&gt;", "<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("&lt;br&gt;", "<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>";
 
Credits
Sunday, Sep 18, 2005, 12:00 AM (Revision 11 - Thursday, Jul 14, 2011, 7:30 PM)
Open Source enables software developers to stand on the shoulders of giants instead of reinventing the wheel, so to speak. Kudos and many thanks to the folks who made their work freely available for reuse in MAJ.

read more
Bugs and Exploits
Friday, Aug 26, 2005, 12:00 AM (Revision 23 - Wednesday, May 29, 2013, 5:25 AM)
Although MAJ started as a family project, care has been taken to make it as "safe" as possible. With more people now working on MAJ, bugs and exploitable code may sometimes slip in. We invite you to poke around and see if you can find any. Generally, there are two things you can do when you find a MAJ or PHP-related bug or exploit:

1. Take advantage of it. But hey, what's so exciting about messing up someone's blog? Ho-hum, right?
2. Report it here so that we can work on a fix and make MAJ better.

read more
Search
Download
MAJ 2.0
75 files
35361 downloads
MAJ 1.0
26 files
14145 downloads
MAJ 0.14
45 files
36697 downloads