*
* This file is part of Gombe-MI.
*
* Gombe-MI is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Gombe-MI. If not, see File ' . $letter . ' cannot be compared by ';
switch ($dtype) {
case D_TABLE:
case D_WORD:
print 'word';
break;
case D_LINE:
print 'line';
break;
};
print " because it is not text. File $letter is: ";
print htmlentities($line, ENT_QUOTES);
print ' Unexpected failure trying to move uploaded files. ';
print "File A [Old File]: " . $filea . " Uh, the same file was uploaded twice.... The files are identical!';
print '(You should be so proud!) ';
print htmlentities($line);
print ' ';
$lineno = 1;
foreach ($result as $line) {
print str_repeat(' ', 5 - strlen($lineno))
. $lineno
. ': '
. str_replace($oldmarks
, $newmarks
, htmlentities($line, ENT_QUOTES))
. ' Color Key:
";
print "File B [New File]: " . $fileb;
print '
';
print '(Or you uploaded 2 files having identical names and content.)
';
} else {
print '
';
print '';
foreach ($result as $line) {
print "$line\n";
}
print '';
reset($result);
*/ // Debug
print '
';
// Go through the result and display it line by line
// in a fixed-width font, and colorize it.
print "\n";
$lineno = 1;
foreach ($result as $line) {
// Start a new row in the table.
print '
\n";
break;
case D_WORD:
print ' \n";
$lineno++;
}
print "Line'
. str_repeat(' ', 5 - strlen($lineno))
. "$lineno ";
if ($line != '') {
$td_close = '';
$words = preg_split('/[[:space:]]/'
, htmlentities($line, ENT_QUOTES));
// Go through the words of the line and pair
// the changes.
$paired_words = array();
$next_pwi = 0; // pwi is "paired_words index"
$max_pwi = $next_pwi;
$wtype = DF_SAME;
$next_wtype = $wtype;
foreach ($words as $word) {
// Look at the word and see if it begins
// an add or delete sequence.
// Strip off beginning of sequence marks.
$prefix = substr($word, 0, WD_DELETED_START_LEN);
if ($prefix == WD_DELETED_START) {
// Start of delete sequence.
$next_wtype = DF_DELETED;
$word = substr($word, WD_DELETED_START_LEN);
$pwi_saved = $next_pwi;
} elseif ($prefix == WD_ADDED_START) {
// Start of add sequence.
if ($wtype == DF_DELETED) {
// Add sequence follows delete sequence.
// Rewind to pair adds with deletes.
$next_pwi = $pwi_saved;
}
$word = substr($word, WD_ADDED_START_LEN);
$next_wtype = DF_ADDED;
}
// Remember characteristics of current word and
// prep for next iteration.
// We do this so early because when the word
// ends an add or delete sequence that affects
// both the markup of of the next word and it's
// column.
$pwi = $next_pwi;
$wtype = $next_wtype;
$next_pwi++;
if ($next_pwi > $max_pwi) {
// Remember how far we got before the adds
// "rewound" back over deletes.
$max_pwi = $next_pwi;
}
// See if the word ends an add or delete sequence.
// Remember seqeuence for future.
// Strip off end of sequence marks.
$suffix = substr($word, strlen($word)
- WD_DELETED_END_LEN);
if ($suffix == WD_DELETED_END) {
// Finish delete sequence.
$word = substr($word, 0, strlen($word)
- WD_DELETED_END_LEN);
$next_wtype = DF_SAME;
} elseif ($suffix == WD_ADDED_END) {
// Finish add sequence.
$word = substr($word
, 0
, strlen($word)
- WD_ADDED_END_LEN);
$next_wtype = DF_SAME;
// Make sure that ending an add resynronizes
// and regular data is not paired with deletes.
$next_pwi = $max_pwi;
}
// Put html markup on the word.
if ($wtype == DF_DELETED) {
// In a delete sequence.
$word = DELETED_MARKUP . $word . CLOSE_MARKUP;
} elseif ($wtype == DF_ADDED) {
// In a add sequence.
$word = ADDED_MARKUP . $word . CLOSE_MARKUP;
}
// Save the word.
if (array_key_exists($pwi, $paired_words)) {
// There's already something in the pair.
$paired_words[$pwi] .= " $word";
} else {
$paired_words[$pwi] = $word;
}
}
// Output the line.
foreach ($paired_words as $td) {
print "$td \n";
}
}
print "
';
print '
';
print "\n";
$lineno++;
}
print '
';
print '';
$colored = FALSE;
foreach ($result as $line) {
$c = substr($line, 0, 1);
switch ($c) {
case '+':
print '';
$colored = TRUE;
break;
case '-':
print '';
$colored = TRUE;
break;
default:
if ($colored) {
print '';
$colored = FALSE;
}
break;
}
print htmlentities($line, ENT_QUOTES);
print "\n";
}
print '';
break;
}
if ($dtype != D_FILE) {
?>
In File A [Old File] but not in File B.
In File B [New File] but not in File A.