[chora] small bug
Mathieu Arnold
arn_mat@club-internet.fr
Tue, 27 Feb 2001 14:43:55 +0100
Mathieu Arnold wrote:
>
> Hi
>
> i just got a cvs snapshot of chora, and there's the file
> templates/hr_diff_empty.inc that's been deleted but it's still used in
> diff.php line 119...
and after using it a bit, i think that :
Index: diff.php
===================================================================
RCS file: /home/cvs/cvs/dup/horde/chora/diff.php,v
retrieving revision 1.21
diff -u -r1.21 diff.php
--- diff.php 2001/02/22 21:14:24 1.21
+++ diff.php 2001/02/27 13:42:18
@@ -104,18 +104,20 @@
case CVSLIB_DIFF_ADD:
foreach ($change['lines'] as $line) {
$line = htmlspecialchars($line);
+ $line = spaces($line);
include($conf['paths']['templates'].'/hr_diff_add.inc');
}
break;
case CVSLIB_DIFF_REMOVE:
foreach ($change['lines'] as $line) {
$line = htmlspecialchars($line);
+ $line = spaces($line);
include($conf['paths']['templates'].'/hr_diff_remove.inc');
}
break;
case CVSLIB_DIFF_EMPTY:
$line = htmlspecialchars($change['line']);
+ $line = spaces($line);
if (empty($line)) $line = ' ';
include($conf['paths']['templates'].'/hr_diff_empty.inc');
break;
case CVSLIB_DIFF_CHANGE:
@@ -123,9 +125,11 @@
while (sizeof($change['old']) ||
sizeof($change['new'])) {
if ($left = array_shift($change['old'])) {
$left = htmlspecialchars($left);
+ $left = spaces($left);
}
if ($right = array_shift($change['new'])) {
$right = htmlspecialchars($right);
+ $right = spaces($right);
}
include($conf['paths']['templates'].'/hr_diff_change.inc');
}
@@ -137,6 +141,12 @@
// print legend
include($conf['paths']['templates'].'/hr_diff_footer.inc');
include($conf['paths']['templates'].'/page_footer.inc');
+}
+
+function spaces($line) {
+ $line = str_replace("\t"," ",$line);
+ $line = str_replace(" ",' ',$line);
+ return $line;
}
?>
would render the diffs a bit better.
--
Mathieu Arnold