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, 6.1 has been updated
       via  d4a1ada33fb2a3edb23aeaee0441bcf7b6666b8d (commit)
       via  aada1252b8989279f73504b9c83f87546213cc01 (commit)
       via  e003a0dd7d5390f6be446d1c5efd4e32dc60fb91 (commit)
      from  06a6d3b8bde3cbc61e0b26d702f49bf59470b53f (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 -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=d4a1ada33fb2a3edb23aeaee0441bcf7b6666b8d

commit d4a1ada33fb2a3edb23aeaee0441bcf7b6666b8d
Author: Franck Villaume <[email protected]>
Date:   Sat Jan 6 15:27:13 2018 +0100

    use util_make_url to get check_forwarded_session

diff --git a/src/plugins/scmgit/libexec/gitlog.php 
b/src/plugins/scmgit/libexec/gitlog.php
index e7026bb..b5a8a11 100644
--- a/src/plugins/scmgit/libexec/gitlog.php
+++ b/src/plugins/scmgit/libexec/gitlog.php
@@ -31,9 +31,8 @@ header('Content-type: text/plain');
 
 # Authentify request
 if (!preg_match(',^/anonscm/,', $_SERVER['REQUEST_URI'])) {
-       $web_host = forge_get_config('web_host');
        $ch = curl_init();
-       curl_setopt($ch, CURLOPT_URL, 'https://' . $web_host . 
'/account/check_forwarded_session.php');
+       curl_setopt($ch, CURLOPT_URL, 
util_make_url().'/account/check_forwarded_session.php');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
diff --git a/src/plugins/scmsvn/libexec/svnlog.php 
b/src/plugins/scmsvn/libexec/svnlog.php
index 3949b14..b979f24 100644
--- a/src/plugins/scmsvn/libexec/svnlog.php
+++ b/src/plugins/scmsvn/libexec/svnlog.php
@@ -31,10 +31,8 @@ header('Content-type: text/plain');
 
 # Authentify request
 if (!preg_match(',^/anonscm/,', $_SERVER['REQUEST_URI'])) {
-       $web_host = forge_get_config('web_host');
-       $protocol = forge_get_config('use_ssl', 'scmsvn') ? 'https://' : 
'http://';
        $ch = curl_init();
-       curl_setopt($ch, CURLOPT_URL, $protocol . $web_host . 
'/account/check_forwarded_session.php');
+       curl_setopt($ch, CURLOPT_URL, 
util_make_url().'/account/check_forwarded_session.php');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=aada1252b8989279f73504b9c83f87546213cc01

commit aada1252b8989279f73504b9c83f87546213cc01
Author: Franck Villaume <[email protected]>
Date:   Sat Jan 6 15:26:31 2018 +0100

    scmhg: fix php syntax

diff --git a/src/plugins/scmhg/libexec/hglog.php 
b/src/plugins/scmhg/libexec/hglog.php
index cc96cd9..4d1ab73 100644
--- a/src/plugins/scmhg/libexec/hglog.php
+++ b/src/plugins/scmhg/libexec/hglog.php
@@ -82,6 +82,6 @@ if ($mode == 'date_range') {
 
 $repo = forge_get_config('repos_path', 'scmhg') . '/' . $unix_group_name;
 if (chdir($repo.'/.hg/')) {
-       passthru("hg log --template '{date}||{author|email}||{desc}||{node}\n' 
"$options);
+       passthru("hg log --template '{date}||{author|email}||{desc}||{node}\n' 
".$options);
 }
  

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=e003a0dd7d5390f6be446d1c5efd4e32dc60fb91

commit e003a0dd7d5390f6be446d1c5efd4e32dc60fb91
Author: Franck Villaume <[email protected]>
Date:   Sat Jan 6 15:22:33 2018 +0100

    scmhg: rewrite the activity call

diff --git a/src/plugins/scmhg/common/HgPlugin.class.php 
b/src/plugins/scmhg/common/HgPlugin.class.php
index b3127c3..af32b19 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -678,31 +678,61 @@ Offer DAV or SSH access.");
                        return false;
                }
                if (in_array('scmhg', $params['show']) || 
(count($params['show']) < 1)) {
-                       $repo = forge_get_config('repos_path', 'scmhg') . '/' . 
$project->getUnixName();
-                       if (is_dir($repo) && is_dir($repo.'/.hg') && 
chdir($repo)) {
-                               $start_time = $params['begin'];
-                               $end_time = $params['end'];
-                               $pipe = popen("hg log --template 
'{date}||{author|email}||{desc}||{node}\n' -d '$start_time 0 to $end_time 0'", 
'r');
-                               while (!feof($pipe) && $data = fgets($pipe)) {
-                                       $line = trim($data);
-                                       $splitedLine = explode('||', $line);
-                                       if (sizeof($splitedLine) == 4) {
-                                               $result = array();
-                                               $result['section'] = 'scm';
-                                               $result['group_id'] = 
$project->getID();
-                                               $result['ref_id'] = 
'browser.php?group_id='.$project->getID().'&commit='.$splitedLine[3];
-                                               $result['description'] = 
htmlspecialchars($splitedLine[2]).' (changeset '.$splitedLine[3].')';
-                                               $userObject = 
user_get_object_by_email($splitedLine[1]);
-                                               if (is_a($userObject, 
'FFUser')) {
-                                                       $result['realname'] = 
util_display_user($userObject->getUnixName(), $userObject->getID(), 
$userObject->getRealName());
-                                               } else {
-                                                       $result['realname'] = 
'';
-                                               }
-                                               $splitedDate = explode('-', 
$splitedLine[0]);
-                                               $result['activity_date'] = 
$splitedDate[0];
-                                               $result['subref_id'] = '';
-                                               $params['results'][] = $result;
+                       if ($project->enableAnonSCM()) {
+                               $server_script = '/anonscm/hglog';
+                       } elseif (session_loggedin()) {
+                               $u = session_get_user();
+                               $server_script = 
'/authscm/'.$u->getUnixName().'/hglog';
+                       } else {
+                               return false;
+                       }
+                       // Grab commit log
+                       $protocol = forge_get_config('use_ssl', 'scmhg') ? 
'https://' : 'http://';
+                       $script_url = 
$protocol.$this->getBoxForProject($project)
+                               . $server_script
+                               .'?unix_group_name='.$project->getUnixName()
+                               .'&mode=date_range'
+                               .'&begin='.$params['begin']
+                               .'&end='.$params['end'];
+                       $filename = tempnam('/tmp', 'hglog');
+                       $f = fopen($filename, 'w');
+                       $ch = curl_init();
+                       curl_setopt($ch, CURLOPT_URL, $script_url);
+                       curl_setopt($ch, CURLOPT_FILE, $f);
+                       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+                       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+                       curl_setopt($ch, CURLOPT_COOKIE, 
@$_SERVER['HTTP_COOKIE']);  // for session validation
+                       curl_setopt($ch, CURLOPT_USERAGENT, 
$_SERVER['HTTP_USER_AGENT']);  // for session validation
+                       curl_setopt($ch, CURLOPT_HTTPHEADER,
+                                               array('X-Forwarded-For: 
'.$_SERVER['REMOTE_ADDR']));  // for session validation
+                       $body = curl_exec($ch);
+                       if ($body === false) {
+                               $this->setError(curl_error($ch));
+                       }
+                       curl_close($ch);
+                       fclose($f); // flush buffer
+                       $f = fopen($filename, 'r');
+                       unlink($filename);
+
+                       while (!feof($f) && $data = fgets($f)) {
+                       $line = trim($data);
+                               $splitedLine = explode('||', $line);
+                               if (sizeof($splitedLine) == 4) {
+                                       $result = array();
+                                       $result['section'] = 'scm';
+                                       $result['group_id'] = $project->getID();
+                                       $result['ref_id'] = 
'browser.php?group_id='.$project->getID().'&commit='.$splitedLine[3];
+                                       $result['description'] = 
htmlspecialchars($splitedLine[2]).' (changeset '.$splitedLine[3].')';
+                                       $userObject = 
user_get_object_by_email($splitedLine[1]);
+                                       if (is_a($userObject, 'FFUser')) {
+                                               $result['realname'] = 
util_display_user($userObject->getUnixName(), $userObject->getID(), 
$userObject->getRealName());
+                                       } else {
+                                               $result['realname'] = '';
                                        }
+                                       $splitedDate = explode('-', 
$splitedLine[0]);
+                                       $result['activity_date'] = 
$splitedDate[0];
+                                       $result['subref_id'] = '';
+                                       $params['results'][] = $result;
                                }
                        }
                }
diff --git a/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc 
b/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc
index 5a21d09..5cac4eb 100644
--- a/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc
+++ b/src/plugins/scmhg/etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc
@@ -21,3 +21,11 @@ ScriptAliasMatch ^/authscm/[^/]+/scmhg/cgi-bin/(.*) 
${FF__core__plugins_path}/sc
        #Header always set Access-Control-Allow-Origin "${FF__core__web_host}"
        #Header always set Access-Control-Allow-Credentials "true"
 </Directory>
+
+# Activity
+ScriptAliasMatch ^/authscm/[^/]+/hglog(.*) 
${FF__core__plugins_path}/scmhg/libexec/hglog.php$1
+# Authentified via cookie in hglog.php:
+<LocationMatch "^/authscm/[^/]+/hglog">
+  Satisfy Any
+</LocationMatch>
+ScriptAlias /anonscm/hglog ${FF__core__plugins_path}/scmhg/libexec/hglog.php
diff --git a/src/plugins/scmhg/libexec/hglog.php 
b/src/plugins/scmhg/libexec/hglog.php
new file mode 100644
index 0000000..cc96cd9
--- /dev/null
+++ b/src/plugins/scmhg/libexec/hglog.php
@@ -0,0 +1,87 @@
+<?php
+/**
+ * Returns commit log for inclusion in web frontend
+ *
+ * Copyright 2015  Inria (Sylvain Beucler)
+ * Copyright 2017, Franck Villaume - TrivialDev
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// Don't try to connect to the DB, just dumping SVN log
+putenv('FUSIONFORGE_NO_DB=true');
+
+require_once '../../../www/env.inc.php';
+require_once $gfcommon.'include/pre.php';
+
+header('Content-type: text/plain');
+
+# Authentify request
+if (!preg_match(',^/anonscm/,', $_SERVER['REQUEST_URI'])) {
+       $ch = curl_init();
+       curl_setopt($ch, CURLOPT_URL, 
util_make_url().'/account/check_forwarded_session.php');
+       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+       curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+       curl_setopt($ch, CURLOPT_COOKIE, $_SERVER['HTTP_COOKIE']);
+       curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
+       curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Forwarded-For: 
'.$_SERVER['HTTP_X_FORWARDED_FOR']));
+       //$info = curl_getinfo($ch);
+       $body = curl_exec($ch);
+       curl_close($ch);
+       if ($body != 'OK')  {
+               die($body);
+       }
+}
+
+
+$unix_group_name = $_GET['unix_group_name'];
+$mode = $_GET['mode'];
+if (!preg_match('/^(date_range|latest|latest_user)$/', $mode))
+       die('Invalid mode');
+if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $unix_group_name))
+       die('Invalid group name');
+
+if ($mode == 'date_range') {
+       $start_time = $_GET['begin'];
+       $end_time = $_GET['end'];
+       if (!ctype_digit($start_time))
+               die('Invalid start time');
+       if (!ctype_digit($end_time))
+               die('Invalid end time');
+       $d1 = date('Y-m-d', $start_time - 80000);
+       $d2 = date('Y-m-d', $end_time + 80000);
+       $options = "-d '$start_time 0 to $end_time 0'";
+// } elseif ($mode == 'latest' or $mode == 'latest_user') {
+//     $limit = $_GET['limit'];
+//     if (!ctype_digit($limit))
+//             die('Invalid limit');
+//     $options = "--limit $limit";
+// 
+//     if ($mode == 'latest_user') {
+//             $user_name = $_GET['user_name'];
+//             if (!preg_match('/^[a-z0-9][-a-z0-9_\.]+\z/', $user_name))
+//                     die('Invalid user name');
+//             $options .= " --search '$user_name'";
+//     }
+}
+
+$repo = forge_get_config('repos_path', 'scmhg') . '/' . $unix_group_name;
+if (chdir($repo.'/.hg/')) {
+       passthru("hg log --template '{date}||{author|email}||{desc}||{node}\n' 
"$options);
+}
+ 

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

Summary of changes:
 src/plugins/scmgit/libexec/gitlog.php              |  3 +-
 src/plugins/scmhg/common/HgPlugin.class.php        | 78 +++++++++++++++-------
 .../etc/httpd.conf.d/vhost-scm-plugin-scmhg.inc    |  8 +++
 .../libexec/svnlog.php => scmhg/libexec/hglog.php} | 38 +++++------
 src/plugins/scmsvn/libexec/svnlog.php              |  4 +-
 5 files changed, 83 insertions(+), 48 deletions(-)
 copy src/plugins/{scmsvn/libexec/svnlog.php => scmhg/libexec/hglog.php} (73%)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to