</table> </form> <?php echo foot(); } elseif ($job == 'templates_file_compare') { echo head(); include 'classes/diff/class.diff.php'; include 'classes/diff/function.diff.php'; $old = $gpc->get('old', none); $new = $gpc->get('new', none); if (empty($old) || empty($new)) { error('javascript:history.back(-1);', $lang->phrase('admin_design_choose_an_old_and_new_version')); } $origText = file_get_contents($old); $finalText = file_get_contents($new); $diff = makeDiff(trim($origText), trim($finalText)); ?> <table cellspacing="0" cellpadding="0" border="0" width="100%" class="border"> <tr> <td width="50%" class="obox"><?php echo $lang->phrase('admin_design_old'); ?> </td> <td width="50%" class="obox"><?php echo $lang->phrase('admin_design_new'); ?> </td> </tr> <?php foreach ($diff['final'] as $idx => $undef) { if ($diff['orig'][$idx]['type'] == 'edit' && $diff['final'][$idx]['type'] == 'edit') {
function makeDiff(&$diff, $fileparsed, $parentKey, $fileNum) { foreach ($fileparsed as $key => $value) { $path = $parentKey . "/{$key}"; if (!is_array($value)) { $diff[$path][$fileNum] = $value; } else { makeDiff($diff, $value, $path, $fileNum); } } }