Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / diff.php
index 1341da46dac6874b8ed871cdc88b218987a223b5..71de17d1a3512fd893fe351a9a30d058b2aa884f 100644 (file)
--- a/diff.php
+++ b/diff.php
@@ -2,7 +2,7 @@
 /*=====================================================================*\
 || ###################################################################
 || # ViewSVN [#]version[#]
-|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
+|| # Copyright ©2002-[#]year[#] Blue Static
 || #
 || # This program is free software; you can redistribute it and/or modify
 || # it under the terms of the GNU General Public License as published by
@@ -41,7 +41,7 @@ $link['log'] = ConstructLink('log', $input->in['repos'], $input->in['path'], $in
 
 // ###################################################################
 
-$show['fullchangeset'] = ($input->in['path'] == '' OR $input->in['path'] == '/');
+$show['fullchangeset'] = !($input->in['path'] == '' OR $input->in['path'] == '/');
 if ($show['fullchangeset'])
 {
        $link['changeset'] = ConstructLink('diff', $input->in['repos'], null, $input->in['rev']);
@@ -67,25 +67,24 @@ foreach ($diff->fetch() AS $filename => $file)
                continue;
        }
        
-       $props = $file['props'];
-       $show['props'] = (bool)$props;
-       unset($file['props']);
-       
-       foreach ($file AS $hunk)
+       if (is_array($file['lines']))
        {
-               $lines = '';
-               foreach ($hunk AS $key => $line)
+               foreach ($file['lines'] AS $hunk)
                {
-                       $show['hunk'] = false;
-                       if ($key == 'hunk' AND isset($line['old']))
-                       {
-                               $filepath = ($isdir ? $controller->path . $filename : $controller->path);
-                               // $rlow = $controller->href_struct('view.php' . Paths::fetch_rev_str(false, $low), $filepath);
-                               // $rhigh = $controller->href_struct('view.php' . Paths::fetch_rev_str(false, $high), $filepath);
-                               $show['hunk'] = true;
-                       }
-                       else
+                       $lines = '';
+
+                       $show['hunk'] = true;
+                       $low = $file['revision']['low'];
+                       $high = $file['revision']['high'];
+
+                       $filename = (preg_match('/' . preg_quote($filename, '/') . '$/', $input->in['path']) ? $input->in['path'] : BSFunctions::FetchSourcePath($input->in['path']) . $filename);
+                       $rlow = ConstructLink('view', $input->in['repos'], $filename, $low);
+                       $rhigh = ConstructLink('view', $input->in['repos'], $filename, $high);
+                       eval('$lines .= "' . $template->fetch('diff_line') . '";');
+
+                       foreach ($hunk AS $key => $line)
                        {
+                               $show['hunk'] = false;
                                if ($line['act'] == '+')
                                {
                                        $class = 'diff_add';
@@ -98,18 +97,19 @@ foreach ($diff->fetch() AS $filename => $file)
                                {
                                        $class = 'diff_norm';
                                }
-                               
+
                                $line['line_clean'] = FormatCode($line['line']);
+
+                               eval('$lines .= "' . $template->fetch('diff_line') . '";');
                        }
-                       
-                       eval('$lines .= "' . $template->fetch('diff_line') . '";');
+                       eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
                }
-               eval('$hunktpl .= "' . $template->fetch('diff_hunk') . '";');
        }
        
-       if (is_array($props))
+       if (is_array($file['props']))
        {
-               foreach ($props AS $name => $values)
+               $show['props'] = true;
+               foreach ($file['props'] AS $name => $values)
                {
                        // modified
                        if (isset($values['add']) AND isset($values['del']))
@@ -143,4 +143,4 @@ eval('$template->flush("' . $template->fetch('diff') . '");');
 || # $Id$
 || ###################################################################
 \*=====================================================================*/
-?>
+?>
\ No newline at end of file