[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wiki/lib/ -> diff.php (source)

   1  <?php
   2  // $Id: diff.php 20295 2006-02-15 12:31:25Z  $
   3  
   4  // Compute the difference between two sets of text.
   5  function diff_compute($text1, $text2)
   6  {
   7      global $TempDir, $DiffCmd, $ErrorCreatingTemp, $ErrorWritingTemp;
   8  
   9      $num = strncmp(PHP_OS,'WIN',3) ? posix_getpid() : rand();
  10  
  11      $temp1 = $TempDir . '/wiki_' . $num . '_1.txt';
  12      $temp2 = $TempDir . '/wiki_' . $num . '_2.txt';
  13  
  14      if(!($h1 = fopen($temp1, 'w')) || !($h2 = fopen($temp2, 'w')))
  15          { die($ErrorCreatingTemp); }
  16  
  17      if(fwrite($h1, $text1) < 0 || fwrite($h2, $text2) < 0)
  18          { die($ErrorWritingTemp); }
  19  
  20      fclose($h1);
  21      fclose($h2);
  22  
  23      $diff = `$DiffCmd $temp1 $temp2`;
  24  
  25      unlink($temp1);
  26      unlink($temp2);
  27  
  28      return $diff;
  29  }
  30  
  31  // Parse diff output into nice HTML.
  32  function diff_parse($text)
  33  {
  34      global $DiffEngine;
  35  
  36      return parseText($text, $DiffEngine, '');
  37  }
  38  
  39  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7