Merge branch 'master' of ssh://apples.lambdacomplex.org/git/disclosr
Former-commit-id: e34af745d596c65efcacd66cb0d338a275cd3f8c
--- /dev/null
+++ b/admin/conflicts.php
@@ -1,1 +1,48 @@
+<?php
+include_once('../include/common.inc.php');
+include_header();
+ require_once '../lib/php-diff/lib/Diff.php';
+ require_once '../lib/php-diff/lib/Diff/Renderer/Html/SideBySide.php';
+
+$db = $server->get_db('disclosr-agencies');
+
+try {
+ $rows = $db->get_view("app", "getConflicts", null, true)->rows;
+ //print_r($rows);
+ foreach ($rows as $row) {
+echo "<h2>".$row->id."</h2>";
+$request = Requests::get($serverAddr."disclosr-agencies/".$row->id);
+$origSort = object_to_array(json_decode($request->body));
+ksort($origSort);
+ $origDoc = explode(",",json_encode($origSort));
+ foreach($row->value as $conflictRev) {
+$conflictURL = $serverAddr."disclosr-agencies/".$row->id."?rev=".$conflictRev;
+$request = Requests::get($conflictURL);
+$conflictSort = object_to_array(json_decode($request->body));
+ksort($conflictSort);
+ $conflictDoc = explode(",",json_encode($conflictSort));
+echo "curl -X DELETE ".$conflictURL."<br>".PHP_EOL;
+ // Options for generating the diff
+ $options = array(
+ //'ignoreWhitespace' => true,
+ //'ignoreCase' => true,
+ );
+
+ // Initialize the diff class
+ $diff = new Diff($conflictDoc, $origDoc, $options);
+
+ // Generate a side by side diff
+ $renderer = new Diff_Renderer_Html_SideBySide;
+ echo $diff->Render($renderer);
+}
+die();
+
+ }
+} catch (SetteeRestClientException $e) {
+ setteErrorHandler($e);
+}
+
+include_footer();
+?>
+