summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-10-19 12:49:17 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-10-19 12:49:17 +0200
commite1bd90ffd5d035cbb5d015914247d67db117d907 (patch)
tree02e5669e6184066c0d194592d469bbcd2526afc3
parentf7569b7b12d5a857ab43dd00c011eef4a280a0fd (diff)
downloadrpg-e1bd90ffd5d035cbb5d015914247d67db117d907.tar.gz
rpg-e1bd90ffd5d035cbb5d015914247d67db117d907.tar.bz2
fix diff view for new pages
darcs-hash:20061019104917-7ad00-c284fd3336850a18b633bbc3a49375f59edba3c7.gz
-rw-r--r--inc/html.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/inc/html.php b/inc/html.php
index 57bfd26d3..ae6e53729 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -814,9 +814,10 @@ function html_diff($text='',$intro=true){
global $REV;
global $lang;
global $conf;
+
if($text){
- $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,''))),
- split("\n",htmlspecialchars(cleanText($text))));
+ $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,''))),
+ explode("\n",htmlspecialchars(cleanText($text))));
$left = '<a class="wikilink1" href="'.wl($ID).'">'.
$ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a>'.
$lang['current'];
@@ -830,10 +831,17 @@ function html_diff($text='',$intro=true){
$r = $revs[0];
}
- $df = new Diff(split("\n",htmlspecialchars(rawWiki($ID,$r))),
- split("\n",htmlspecialchars(rawWiki($ID,''))));
- $left = '<a class="wikilink1" href="'.wl($ID,"rev=$r").'">'.
- $ID.' '.date($conf['dformat'],$r).'</a>';
+ if($r){
+ $df = new Diff(explode("\n",htmlspecialchars(rawWiki($ID,$r))),
+ explode("\n",htmlspecialchars(rawWiki($ID,''))));
+ $left = '<a class="wikilink1" href="'.wl($ID,"rev=$r").'">'.
+ $ID.' '.date($conf['dformat'],$r).'</a>';
+ }else{
+ $df = new Diff(array(''),
+ explode("\n",htmlspecialchars(rawWiki($ID,''))));
+ $left = '<a class="wikilink1" href="'.wl($ID).'">'.
+ $ID.'</a>';
+ }
$right = '<a class="wikilink1" href="'.wl($ID).'">'.
$ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '.
$lang['current'];