Exemple #1
0
 public function getTextRevisionChanges($moduleId, $moduleContentTypeId, $moduleContentId, $newText, $revision)
 {
     global $dbi;
     $result = $dbi->query("SELECT diff FROM " . revisionTableName . " WHERE moduleId=" . $dbi->quote($moduleId) . " AND moduleContentTypeId=" . $dbi->quote($moduleContentTypeId) . " AND moduleContentId=" . $moduleContentId . " AND revision>=" . $dbi->quote($revision) . " ORDER BY revision DESC");
     if ($result->rows()) {
         $diff = new Diff();
         $text = parseString($newText);
         for ($i = 0; list($diffText) = $result->fetchrow_array(); $i++) {
             $changes = unserialize(parseString($diffText));
             $text = $diff->renderChanges($changes, $text);
             $result = $diff->stringDiff($text, $newText);
             print_r($result);
             $diffString = $diff->renderDiff($result);
             return $diffString;
         }
     }
     return "";
 }