[Fusionforge-commits] FusionForge branch master updated. b166598addd660c06a6b4910c87c02e0e851430d

Franck Villaume nerville at fusionforge.org
Thu Sep 11 12:07:46 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  b166598addd660c06a6b4910c87c02e0e851430d (commit)
      from  225cdc24bc1722e74cbf6901ca4bdc99eb73a0f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b166598addd660c06a6b4910c87c02e0e851430d
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Thu Sep 11 12:05:41 2014 +0200

    viewvc: use view, support patch

diff --git a/src/www/scm/viewvc.php b/src/www/scm/viewvc.php
index 44224d0..5a6632e 100644
--- a/src/www/scm/viewvc.php
+++ b/src/www/scm/viewvc.php
@@ -85,10 +85,6 @@ if (!forge_check_perm('scm', $Group->getID(), 'read')) {
 	exit_permission_denied('scm');
 }
 
-if (isset($_GET['view']) && ($_GET['view'] == 'tar' || $_GET['view'] == 'co')) {
-	$sysdebug_enable = false;
-}
-
 if ($external_scm) {
 	//$server_script = "/cgi-bin/viewcvs.cgi";
 	$server_script = $GLOBALS["sys_path_to_scmweb"]."/viewcvs.cgi";
@@ -154,22 +150,46 @@ if (count($exploded_content) > 1) {
 	$body = $content;
 }
 
-if (isset($content_type) && strpos($content_type, 'text/html') === 0) {
-	// If we output html and we found the mbstring extension, we
-	// should try to encode the output of ViewCVS in UTF-8
-	if ($charset != 'UTF-8' && extension_loaded('mbstring'))
-		$content = mb_convert_encoding($content, 'UTF-8', $encoding);
-	scm_header(array('title'=>_("SCM Repository"),
-		'group'=>$Group->getID()));
-	echo $body;
-	scm_footer();
-} elseif (isset($content_type)) {
-	echo $body;
-} else {
-	scm_header(array('title'=>_("SCM Repository"),
-		'group'=>$Group->getID()));
-	echo $body;
-	scm_footer();
+
+
+
+if (!isset($_GET['view'])) {
+	$_GET['view'] = 'none';
+}
+
+switch ($_GET['view']) {
+	case 'tar':
+	case 'co':
+	case 'patch': {
+		$sysdebug_enable = false;
+		if (isset($content_type)) {
+			switch ($content_type) {
+				case 'text/html':
+				case 'application/javascript': {
+					echo htmlentities($body);
+					break;
+				}
+				default: {
+					echo $body;
+					break;
+				}
+			}
+		} else {
+			echo $body;
+		}
+		break;
+	}
+	default: {
+		// If we output html and we found the mbstring extension, we
+		// should try to encode the output of ViewCVS in UTF-8
+		if ($charset != 'UTF-8' && extension_loaded('mbstring'))
+			$body = mb_convert_encoding($body, 'UTF-8', $encoding);
+		scm_header(array('title'=>_("SCM Repository"),
+			'group'=>$Group->getID()));
+		echo $body;
+		scm_footer();
+		break;
+	}
 }
 
 // Local Variables:

-----------------------------------------------------------------------

Summary of changes:
 src/www/scm/viewvc.php |   60 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list