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  04ab68bdda64640799bb7e4a43f186e7b0ae3c37 (commit)
       via  fd71fa3e210b10d0214cdcedf0a4ebf3ff1b83c8 (commit)
       via  107c9dcf28024613b1e072b522bd9e33411da2ee (commit)
       via  c28b8e61f658d66997fe925fa2a05e6fc940366e (commit)
       via  e7b679d4e59a16a3f139c9966bb0d404199f8895 (commit)
       via  064d4efbf33ea33bd589cfe1e3994d1c5960e90c (commit)
       via  d80ef28725ef5245cee0be7bd69e0cacc8a9eae9 (commit)
       via  3c89a9342d52c818b1c1470f3ff9c25c3caf2c42 (commit)
       via  267fa71b5a1fec91ef596c95d5e5a088e2d4afc1 (commit)
       via  73867f9a6dc06c2bdaf53f874af77d2930d8627f (commit)
       via  cc7c60a2a4c31c592b2e48ca3d550592963b2f52 (commit)
       via  4a2631f94e9c11f091c20e93d60732f4dcc80e35 (commit)
       via  5a783a31e0a294766b8bbd9ec1396358a49c790e (commit)
      from  6101a9ab073cf638a4e9635987015b7c0512aab3 (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=04ab68bdda64640799bb7e4a43f186e7b0ae3c37

commit 04ab68bdda64640799bb7e4a43f186e7b0ae3c37
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:33:04 2017 +0200

    scmhg: massive clean-up. use getBoxForProject function. use HTML helpers. 
prepare multirepo support

diff --git a/src/plugins/scmhg/common/HgPlugin.class.php 
b/src/plugins/scmhg/common/HgPlugin.class.php
index a0019cd..af7c6ef 100644
--- a/src/plugins/scmhg/common/HgPlugin.class.php
+++ b/src/plugins/scmhg/common/HgPlugin.class.php
@@ -76,7 +76,7 @@ Offer DAV or SSH access.");
                if (forge_get_config('use_dav', 'scmhg')) {
                        $protocol = forge_get_config('use_ssl', 'scmhg')? 
'https' : 'http';
                        $b .= html_e('p', array(), _("This project's Mercurial 
repository can be checked out through anonymous access with the following 
command")._(':'));
-                       $b .= html_e('p', array(), html_e('kbd', array(), 'hg 
clone 
'.$protocol.'://'.forge_get_config('scm_host').'/anonscm/'.'hg'.'/'.$project->getUnixName()));
+                       $b .= html_e('p', array(), html_e('kbd', array(), 'hg 
clone 
'.$protocol.'://'.$this->getBoxForProject($project).'/anonscm/'.'hg'.'/'.$project->getUnixName()));
                } else {
                        $b .= $HTML->warning_msg(_('Please contact forge 
administrator, scmhg plugin is not correctly configured'));
                }
@@ -84,16 +84,8 @@ Offer DAV or SSH access.");
        }
 
        function getInstructionsForRW($project) {
-               $repo_list = array($project->getUnixName());
+               $repo_list = $this->getRepositories($project);
 
-               $result = db_query_params('SELECT repo_name FROM 
scm_secondary_repos WHERE group_id=$1 AND next_action = $2 AND plugin_id=$3 
ORDER BY repo_name',
-                                          array($project->getID(),
-                                                 SCM_EXTRA_REPO_ACTION_UPDATE,
-                                                 $this->getID()));
-               $rows = db_numrows($result);
-               for ($i=0; $i<$rows; $i++) {
-                       $repo_list[] = db_result($result, $i, 'repo_name');
-               }
                $b = '';
                $b .= html_e('h2', array(), _('Developer Access'));
                $b .= html_e('p', array(),
@@ -101,19 +93,23 @@ Offer DAV or SSH access.");
                                'Only project developers can access the Hg 
repositories via this method.',
                                count($repo_list)));
                $b .= '<div id="tabber-hg">';
-               $b .= '<ul>';
+               $liElements = array();
                if (forge_get_config('use_ssh', 'scmhg')) {
-                       $b .= '<li><a href="#tabber-hgssh">'._('via 
SSH').'</a></li>';
+                       $liElements[]['content'] = '<a 
href="#tabber-hgssh">'._('via SSH').'</a>';
                        $configuration = 1;
                }
                if (forge_get_config('use_dav', 'scmhg')) {
-                       $b .= '<li><a href="#tabber-hgdav">'._('via 
"DAV"').'</a></li>';
+                       $liElements[]['content'] = '<a 
href="#tabber-hgdav">'._('via "DAV"').'</a>';
                        $configuration = 1;
                }
-               $b .= '</ul>';
+               $b .= $HTML->html_list($liElements);
                if (!isset($configuration)) {
                        return $HTML->error_msg(_('Error')._(': ')._('No access 
protocol has been allowed for the Hg plugin in scmhg.ini: use_ssh and use_dav 
are disabled'));
                }
+               $ssh_port = '';
+               if (forge_get_config('ssh_port') != 22) {
+                       $ssh_port = ':'.forge_get_config('ssh_port');
+               }
                if (session_loggedin()) {
                        $u = user_get_object(user_getid());
                        $d = $u->getUnixName();
@@ -124,7 +120,7 @@ Offer DAV or SSH access.");
                                foreach ($repo_list as $repo_name) {
                                        // Warning : the ssh uri MUST be this 
form : ssh://username@scmbox//path/reponame
                                        //           HAVE YOU SEEN THE // 
starting the path ? Keep in mind the double /
-                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone 
ssh://'.$d.'@'.forge_get_config('scm_host').'/'.forge_get_config('repos_path', 
'scmhg').'/'.$project->getUnixName()).html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone 
ssh://'.$d.'@'.$this->getBoxForProject($project).$ssh_port.'/'.forge_get_config('repos_path',
 'scmhg').'/'.$project->getUnixName()).html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -135,7 +131,7 @@ Offer DAV or SSH access.");
                                $htmlRepo = '';
                                $protocol = forge_get_config('use_ssl', 
'scmhg') ? 'https' : 'http';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone 
'.$protocol.'://<i>'.$d.'</i>@'.forge_get_config('scm_host').'/authscm/'.$d.'/hg/'.
 $project->getUnixName()).html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone 
'.$protocol.'://<i>'.$d.'</i>@'.$this->getBoxForProject($project).'/authscm/'.$d.'/hg/'.
 $project->getUnixName()).html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -153,7 +149,7 @@ Offer DAV or SSH access.");
                                foreach ($repo_list as $repo_name) {
                                        // Warning : the ssh uri MUST be this 
form : ssh://username@scmbox//path/reponame
                                        //           HAVE YOU SEEN THE // 
starting the path ? Keep in mind the double /
-                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone ssh://'.html_e('i', array(), _('developername'), true, 
false).'@'.forge_get_config('scm_host').'/'.forge_get_config('repos_path', 
'scmhg').'/'.$project->getUnixName()).html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone ssh://'.html_e('i', array(), _('developername'), true, 
false).'@'.$this->getBoxForProject($project).$ssh_port.'/'.forge_get_config('repos_path',
 'scmhg').'/'.$project->getUnixName()).html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -168,7 +164,7 @@ Offer DAV or SSH access.");
                                        ' '. _('Enter your site password when 
prompted.'));
                                $htmlRepo = '';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone '.$protocol.'://'.html_e('i', array(), _('developername'), true, 
false).'@'.forge_get_config('scm_host').'/authscm/'.html_e('i', array(), 
_('developername'), true, false).'/hg/'.$project->getUnixName()).html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 'hg 
clone '.$protocol.'://'.html_e('i', array(), _('developername'), true, 
false).'@'.$this->getBoxForProject($project).'/authscm/'.html_e('i', array(), 
_('developername'), true, false).'/hg/'.$project->getUnixName()).html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -260,7 +256,7 @@ Offer DAV or SSH access.");
                if ($project->usesPlugin($this->name)) {
                        if ($this->browserDisplayable($project)) {
                                $protocol = forge_get_config('use_ssl', 
'scmhg')? 'https' : 'http';
-                               $box = forge_get_config('scm_host');
+                               $box = $this->getBoxForProject($project);
 
                                if ($project->enableAnonSCM()) {
                                        $iframesrc = 
$protocol.'://'.$box.'/anonscm/scmhg/cgi-bin/'.$project->getUnixName();
@@ -504,174 +500,179 @@ Offer DAV or SSH access.");
                if (!$project) {
                        return false;
                }
-               if (!$project->usesPlugin($this->name)) {
-                       return false;
-               }
 
-                // since cronjobs are running as root, we need to trust apache 
user
-                if (!is_file('/root/.hgrc')) {
-                        echo 'creation fichier'."\n";
-                        $trustdata = '[trusted]'.PHP_EOL.'users = 
'.forge_get_config('apache_user').PHP_EOL;
-                        $f = fopen('/root/.hgrc', 'w');
-                        fwrite($f, $trustdata);
-                        fclose($f);
-                }
+               // since cronjobs are running as root, we need to trust apache 
user
+               if (!is_file('/root/.hgrc')) {
+                       echo 'creation fichier'."\n";
+                       $trustdata = '[trusted]'.PHP_EOL.'users = 
'.forge_get_config('apache_user').PHP_EOL;
+                       $f = fopen('/root/.hgrc', 'w');
+                       fwrite($f, $trustdata);
+                       fclose($f);
+               }
 
                if ($params['mode'] == 'day') {
-                       db_begin();
                        $year = $params['year'];
                        $month = $params['month'];
                        $day = $params['day'];
                        $month_string = sprintf("%04d%02d", $year, $month);
                        $start_time = gmmktime(0, 0, 0, $month, $day, $year);
                        $end_time = $start_time + 86400;
-                       $usr_adds    = array();
-                       $usr_updates = array();
-                       $usr_deletes = array();
-                       $usr_commits = array();
-                       $adds    = 0;
-                       $updates = 0;
-                       $deletes = 0;
-                       $commits = 0;
-                       $repo = forge_get_config('repos_path', 'scmhg') . '/' . 
$project->getUnixName();
-                       if (!is_dir($repo) || !is_dir("$repo/.hg")) {
-                               // echo "No repository\n";
-                               db_rollback();
-                               return false;
+
+                       $repolist = $this->getRepositories($project);
+                       foreach ($repolist as $repo_name) {
+                               $this->gatherStatsRepo($project, $repo_name, 
$year, $month, $day);
+                       }
+               }
+
+       function gatherStatsRepo($project, $repo_name, $year, $month, $day) {
+               $month_string = sprintf("%04d%02d", $year, $month);
+               $start_time = gmmktime(0, 0, 0, $month, $day, $year);
+               $end_time = $start_time + 86400;
+               $usr_adds    = array();
+               $usr_updates = array();
+               $usr_deletes = array();
+               $usr_commits = array();
+               $adds    = 0;
+               $updates = 0;
+               $deletes = 0;
+               $commits = 0;
+               $repo = forge_get_config('repos_path', 'scmhg') . '/' . 
$project->getUnixName();
+               if (!is_dir($repo) || !is_dir("$repo/.hg")) {
+                       // echo "No repository\n";
+                       db_rollback();
+                       return false;
+               }
+               // cleaning stats_cvs_* table for the current day
+               $res = db_query_params('DELETE FROM stats_cvs_group WHERE month 
= $1 AND day = $2 AND group_id = $3 AND reponame = $4',
+                                       array($month_string,
+                                               $day,
+                                               $project->getID(),
+                                               $repo_name));
+               if(!$res) {
+                       echo "Error while cleaning stats_cvs_group\n";
+                       db_rollback();
+                       return false;
+               }
+
+               $res = db_query_params('DELETE FROM stats_cvs_user WHERE month 
= $1 AND day = $2 AND group_id = $3 AND reponame = $4',
+                                       array($month_string,
+                                               $day,
+                                               $project->getID(),
+                                               $repo_name));
+               if(!$res) {
+                       echo "Error while cleaning stats_cvs_user\n" ;
+                       db_rollback () ;
+                       return false ;
+               }
+
+               //switch into scm_repository and take a look at the log 
informations
+               $cdir = chdir($repo);
+               if ($cdir) {
+                       //show customised log informations
+                       $pipe = popen("hg log --style fflog.tmpl -d 
'$start_time 0 to $end_time 0'", 'r');
+                       $last_user = "";
+                       while (!feof($pipe) && $line = fgets ($pipe)) {
+                               //determine between author line and file 
informations
+                               if (preg_match("/(\A[AMD]) .*/", $line, 
$matches)) {
+                                       if ($last_user == "") continue;
+                                       switch ($matches[1]) {
+                                               case 'A':
+                                                       $usr_adds[$last_user]++;
+                                                       $adds++;
+                                                       break;
+                                               case 'M':
+                                                       
$usr_updates[$last_user]++;
+                                                       $updates++;
+                                                       break;
+                                               case 'D':
+                                                       
$usr_deletes[$last_user]++;
+                                                       break;
+                                       }
+                               } else {
+                                       $result = preg_match("/^(?P<name>.+) 
<(?P<mail>.+)>/", $line, $matches);
+                                       if ($result) {
+                                               // Author line
+                                               $last_user = $matches['name'];
+                                               $user2email[$last_user] = 
strtolower($matches['mail']);
+                                               if 
(!isset($usr_adds[$last_user])) {
+                                                       $usr_adds[$last_user] = 
0;
+                                                       
$usr_updates[$last_user] = 0;
+                                                       
$usr_deletes[$last_user] = 0;
+                                                       
$usr_commits[$last_user] = 0;
+                                               }
+                                               $commits++;
+                                               $usr_commits[$last_user]++;
+                                       }
+                               }
                        }
-                       // cleaning stats_cvs_* table for the current day
-                       $res = db_query_params('DELETE FROM stats_cvs_group 
WHERE month = $1 AND day = $2 AND group_id = $3 AND reponame = $4',
+                       pclose($pipe);
+               }
+
+               // inserting group results in stats_cvs_groups
+               if ($updates > 0 || $adds > 0 || $deletes > 0 || $commits > 0) {
+                       if (!db_query_params('INSERT INTO stats_cvs_group 
(month, day, group_id, checkouts, commits, adds, updates, deletes, reponame)
+                                                       VALUES ($1, $2, $3, $4, 
$5, $6, $7, $8, $9)',
                                                array($month_string,
                                                        $day,
                                                        $project->getID(),
-                                                       
$project->getUnixName()));
-                       if(!$res) {
-                               echo "Error while cleaning stats_cvs_group\n";
+                                                       0,
+                                                       $commits,
+                                                       $adds,
+                                                       $updates,
+                                                       $deletes,
+                                                       $repo_name))) {
+                               echo "Error while inserting into 
stats_cvs_group\n";
                                db_rollback();
                                return false;
                        }
+               }
 
-                       $res = db_query_params('DELETE FROM stats_cvs_user 
WHERE month = $1 AND day = $2 AND group_id = $3 AND reponame = $4',
-                                               array($month_string,
-                                                       $day,
-                                                       $project->getID(),
-                                                       
$project->getUnixName()));
-                       if(!$res) {
-                               echo "Error while cleaning stats_cvs_user\n" ;
-                               db_rollback () ;
-                               return false ;
-                       }
+               // building the user list
+               $user_list = array_unique(array_merge(array_keys($usr_adds), 
array_keys($usr_updates), array_keys($usr_deletes), array_keys($usr_commits)));
 
-                       //switch into scm_repository and take a look at the log 
informations
-                       $cdir = chdir($repo);
-                       if ($cdir) {
-                               //show customised log informations
-                               $pipe = popen("hg log --style fflog.tmpl -d 
'$start_time 0 to $end_time 0'", 'r');
-                               $last_user = "";
-                               while (!feof($pipe) && $line = fgets ($pipe)) {
-                                       //determine between author line and 
file informations
-                                       if (preg_match("/(\A[AMD]) .*/", $line, 
$matches)) {
-                                               if ($last_user == "") continue;
-                                               switch ($matches[1]) {
-                                                       case 'A':
-                                                               
$usr_adds[$last_user]++;
-                                                               $adds++;
-                                                               break;
-                                                       case 'M':
-                                                               
$usr_updates[$last_user]++;
-                                                               $updates++;
-                                                               break;
-                                                       case 'D':
-                                                               
$usr_deletes[$last_user]++;
-                                                               break;
-                                               }
-                                       } else {
-                                               $result = 
preg_match("/^(?P<name>.+) <(?P<mail>.+)>/", $line, $matches);
-                                               if ($result) {
-                                                       // Author line
-                                                       $last_user = 
$matches['name'];
-                                                       $user2email[$last_user] 
= strtolower($matches['mail']);
-                                                       if 
(!isset($usr_adds[$last_user])) {
-                                                               
$usr_adds[$last_user] = 0;
-                                                               
$usr_updates[$last_user] = 0;
-                                                               
$usr_deletes[$last_user] = 0;
-                                                               
$usr_commits[$last_user] = 0;
-                                                       }
-                                                       $commits++;
-                                                       
$usr_commits[$last_user]++;
-                                               }
-                                       }
+               foreach ($user_list as $user) {
+                       // Trying to get user id from user name or email
+                       $u = user_get_object_by_name($user);
+                       if ($u) {
+                               $user_id = $u->getID();
+                       } else {
+                               $res=db_query_params('SELECT user_id FROM users 
WHERE lower(realname)=$1 OR email=$2',
+                                       array(strtolower($user), 
$user2email[$user]));
+                               if ($res && db_numrows($res) > 0) {
+                                       $user_id = db_result($res,0,'user_id');
+                               } else {
+                                       continue;
                                }
-                               pclose($pipe);
                        }
 
-                       // inserting group results in stats_cvs_groups
-                       if ($updates > 0 || $adds > 0 || $deletes > 0 || 
$commits > 0) {
-                               if (!db_query_params('INSERT INTO 
stats_cvs_group (month, day, group_id, checkouts, commits, adds, updates, 
deletes, reponame)
+                       $uc = isset($usr_commits[$user]) ? $usr_commits[$user] 
: 0;
+                       $uu = isset($usr_updates[$user]) ? $usr_updates[$user] 
: 0;
+                       $ua = isset($usr_adds[$user]) ? $usr_adds[$user] : 0;
+                       $ud = isset($usr_deletes[$user]) ? $usr_deletes[$user] 
: 0;
+                       if ($uu > 0 || $ua > 0 || $uc > 0 || $ud > 0) {
+                               if (!db_query_params('INSERT INTO 
stats_cvs_user (month, day, group_id, user_id, commits, adds, updates, deletes, 
reponame)
                                                                VALUES ($1, $2, 
$3, $4, $5, $6, $7, $8, $9)',
-                                                     array($month_string,
-                                                            $day,
-                                                            $project->getID(),
-                                                            0,
-                                                            $commits,
-                                                            $adds,
-                                                            $updates,
-                                                            $deletes,
-                                                               
$project->getUnixName()))) {
-                                       echo "Error while inserting into 
stats_cvs_group\n";
+                                                       array($month_string,
+                                                               $day,
+                                                               
$project->getID(),
+                                                               $user_id,
+                                                               $uc,
+                                                               $ua,
+                                                               $uu,
+                                                               $ud,
+                                                               $repo_name))) {
+                                       echo "Error while inserting into 
stats_cvs_user\n";
                                        db_rollback();
                                        return false;
                                }
                        }
-
-                       // building the user list
-                       $user_list = 
array_unique(array_merge(array_keys($usr_adds), array_keys($usr_updates), 
array_keys($usr_deletes), array_keys($usr_commits)));
-
-                       foreach ($user_list as $user) {
-                               // Trying to get user id from user name or email
-                               $u = user_get_object_by_name($user);
-                               if ($u) {
-                                       $user_id = $u->getID();
-                               } else {
-                                       $res=db_query_params('SELECT user_id 
FROM users WHERE lower(realname)=$1 OR email=$2',
-                                               array(strtolower($user), 
$user2email[$user]));
-                                       if ($res && db_numrows($res) > 0) {
-                                               $user_id = 
db_result($res,0,'user_id');
-                                       } else {
-                                               continue;
-                                       }
-                               }
-
-                               $uc = isset($usr_commits[$user]) ? 
$usr_commits[$user] : 0;
-                               $uu = isset($usr_updates[$user]) ? 
$usr_updates[$user] : 0;
-                               $ua = isset($usr_adds[$user]) ? 
$usr_adds[$user] : 0;
-                               $ud = isset($usr_deletes[$user]) ? 
$usr_deletes[$user] : 0;
-                               if ($uu > 0 || $ua > 0 || $uc > 0 || $ud > 0) {
-                                       if (!db_query_params('INSERT INTO 
stats_cvs_user (month, day, group_id, user_id, commits, adds, updates, deletes, 
reponame)
-                                                                       VALUES 
($1, $2, $3, $4, $5, $6, $7, $8, $9)',
-                                                             
array($month_string,
-                                                                    $day,
-                                                                    
$project->getID(),
-                                                                    $user_id,
-                                                                    $uc,
-                                                                    $ua,
-                                                                    $uu,
-                                                                    $ud,
-                                                                       
$project->getUnixName()))) {
-                                               echo "Error while inserting 
into stats_cvs_user\n";
-                                               db_rollback();
-                                               return false;
-                                       }
-                               }
-                       }
                }
                db_commit();
        }
 
        function activity($params) {
-               $group_id = $params['group'];
-               $project = group_get_object($group_id);
-               if (!$project->usesPlugin($this->name)) {
+               $project = $this->checkParams($params);
+               if (!$project) {
                        return false;
                }
                if (in_array('scmhg', $params['show']) || 
(count($params['show']) < 1)) {
@@ -686,8 +687,8 @@ Offer DAV or SSH access.");
                                        if (sizeof($splitedLine) == 4) {
                                                $result = array();
                                                $result['section'] = 'scm';
-                                               $result['group_id'] = $group_id;
-                                               $result['ref_id'] = 
'browser.php?group_id='.$group_id.'&commit='.$splitedLine[3];
+                                               $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')) {
@@ -715,9 +716,6 @@ Offer DAV or SSH access.");
 //             if (!$project) {
 //                     return false;
 //             }
-//             if (!$project->usesPlugin($this->name)) {
-//                     return false;
-//             }
 //
 //             if (!isset($params['repo_name'])) {
 //                     return false;
@@ -803,9 +801,6 @@ Offer DAV or SSH access.");
 //             if (!$project) {
 //                     return false;
 //             }
-//             if (!$project->usesPlugin($this->name)) {
-//                     return false;
-//             }
 //
 //             session_require_perm('project_admin', $params['group_id']);
 //
@@ -866,6 +861,19 @@ Offer DAV or SSH access.");
 //             echo $HTML->closeForm();
 //     }
 
+       function getRepositories($group, $autoinclude = true) {
+               if ($autoinclude) {
+                       $repoarr = array($group->getUnixName());
+               }
+               $result = db_query_params('SELECT repo_name FROM 
scm_secondary_repos WHERE group_id = $1 AND next_action = $2 AND plugin_id = $3 
ORDER BY repo_name',
+                                                  array($group->getID(),
+                                                         
SCM_EXTRA_REPO_ACTION_UPDATE,
+                                                         $this->getID()));
+               while ($arr = db_fetch_array($result)) {
+                       $repoarr[] = $arr['repo_name'];
+               }
+               return $repoarr;
+       }
 }
 
 // Local Variables:

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

commit fd71fa3e210b10d0214cdcedf0a4ebf3ff1b83c8
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:31:34 2017 +0200

    scmgit: use getBoxForProject function

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php 
b/src/plugins/scmgit/common/GitPlugin.class.php
index e3c8527..730f7b3 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -99,7 +99,7 @@ control over it to the project's administrator.");
                $clone_commands = array();
                foreach ($repo_list as $repo_name) {
                        if (forge_get_config('use_smarthttp', 'scmgit')) {
-                               $clone_commands[] = 'git clone 
'.$protocol.'://'.forge_get_config('scm_host').'/anonscm/git/'.$project->getUnixName().'/'.$repo_name.'.git';
+                               $clone_commands[] = 'git clone 
'.$protocol.'://'.$this->getBoxForProject($project).'/anonscm/git/'.$project->getUnixName().'/'.$repo_name.'.git';
                        }
                }
 
@@ -136,7 +136,7 @@ control over it to the project's administrator.");
                                $user_id = db_result($result, $i, 'user_id');
                                $user_name = db_result($result, $i, 
'user_name');
                                $real_name = db_result($result, $i, 'realname');
-                               $htmlRepo .= html_e('kbd', array(), 'git clone 
'.$protocol.'://'.forge_get_config('scm_host').'/anonscm/git/'.$project->getUnixName().'/users/'.$user_name.'.git')
+                               $htmlRepo .= html_e('kbd', array(), 'git clone 
'.$protocol.'://'.$this->getBoxForProject($project).'/anonscm/git/'.$project->getUnixName().'/users/'.$user_name.'.git')
                                        . ' ('.util_make_link_u($user_name, 
$user_id, $real_name).')'
                                        . html_e('br');
                        }
@@ -181,7 +181,7 @@ control over it to the project's administrator.");
                                $b .= html_e('p', array(), _('SSH must be 
installed on your client machine.'));
                                $htmlRepo = '';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= html_e('kbd', array(), 
'git clone 
git+ssh://'.$d.'@'.forge_get_config('scm_host').$ssh_port.forge_get_config('repos_path',
 'scmgit').'/'.$project->getUnixName().'/'.$repo_name.'.git').html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 
'git clone 
git+ssh://'.$d.'@'.$this->getBoxForProject($project).$ssh_port.forge_get_config('repos_path',
 'scmgit').'/'.$project->getUnixName().'/'.$repo_name.'.git').html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -192,7 +192,7 @@ control over it to the project's administrator.");
                                $htmlRepo = '';
                                $protocol = forge_get_config('use_ssl', 
'scmgit') ? 'https' : 'http';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= html_e('kbd', array(), 
'git clone '.$protocol.'://'.$d.'@' . 
forge_get_config('scm_host').'/authscm/'.$d.'/git/'.$project->getUnixName() 
.'/'. $repo_name .'.git').html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 
'git clone 
'.$protocol.'://'.$d.'@'.$this->getBoxForProject($project).'/authscm/'.$d.'/git/'.$project->getUnixName()
 .'/'. $repo_name .'.git').html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -208,7 +208,7 @@ control over it to the project's administrator.");
                                        ' '. _('Substitute 
<em>developername</em> with the proper value.'));
                                $htmlRepo = '';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= html_e('kbd', array(), 
'git clone git+ssh://'.html_e('i', array(), _('developername'), true, 
false).'@'.forge_get_config('scm_host').$ssh_port.forge_get_config('repos_path',
 'scmgit').'/'.$project->getUnixName().'/'.$repo_name.'.git').html_e('br');
+                                       $htmlRepo .= html_e('kbd', array(), 
'git clone git+ssh://'.html_e('i', array(), _('developername'), true, 
false).'@'.$this->getBoxForProject($project).$ssh_port.forge_get_config('repos_path',
 'scmgit').'/'.$project->getUnixName().'/'.$repo_name.'.git').html_e('br');
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -223,7 +223,7 @@ control over it to the project's administrator.");
                                        ' '. _('Enter your site password when 
prompted.'));
                                $htmlRepo = '';
                                foreach ($repo_list as $repo_name) {
-                                       $htmlRepo .= '<tt>git clone 
'.$protocol.'://<i>'._('developername').'</i>@' . 
forge_get_config('scm_host').'/authscm/<i>'._('developername').'</i>/git/'.$project->getUnixName()
 .'/'. $repo_name .'.git</tt><br />';
+                                       $htmlRepo .= '<tt>git clone 
'.$protocol.'://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).'/authscm/<i>'._('developername').'</i>/git/'.$project->getUnixName()
 .'/'. $repo_name .'.git</tt><br />';
                                }
                                $b .= html_e('p', array(), $htmlRepo);
                                $b .= '</div>';
@@ -241,10 +241,10 @@ control over it to the project's administrator.");
                                        $b .= html_e('h3', array(), _('Access 
to your personal repository'));
                                        $b .= html_e('p', array(), _('You have 
a personal repository for this project, accessible through the following 
methods. Enter your site password when prompted.'));
                                        if (forge_get_config('use_ssh', 
'scmgit')) {
-                                               $b .= html_e('kbd', array(), 
'git clone 
git+ssh://'.$u->getUnixName().'@'.forge_get_config('scm_host').$ssh_port.forge_get_config('repos_path',
 
'scmgit').'/'.$project->getUnixName().'/users/'.$u->getUnixName().'.git').html_e('br');
+                                               $b .= html_e('kbd', array(), 
'git clone 
git+ssh://'.$u->getUnixName().'@'.$this->getBoxForProject($project).$ssh_port.forge_get_config('repos_path',
 
'scmgit').'/'.$project->getUnixName().'/users/'.$u->getUnixName().'.git').html_e('br');
                                        }
                                        if (forge_get_config('use_smarthttp', 
'scmgit')) {
-                                               $b .= html_e('kbd', array(), 
'git clone '.$protocol.'://'.$u->getUnixName().'@' . 
forge_get_config('scm_host').'/authscm/'.$u->getUnixName().'/git/'.$project->getUnixName()
 .'/users/'. $u->getUnixName() .'.git').html_e('br');
+                                               $b .= html_e('kbd', array(), 
'git clone 
'.$protocol.'://'.$u->getUnixName().'@'.$this->getBoxForProject($project).'/authscm/'.$u->getUnixName().'/git/'.$project->getUnixName()
 .'/users/'. $u->getUnixName() .'.git').html_e('br');
                                        }
                                } else {
                                        $glist = $u->getGroups();

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

commit 107c9dcf28024613b1e072b522bd9e33411da2ee
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:31:05 2017 +0200

    scmsvn: use getBoxForProject function

diff --git a/src/plugins/scmsvn/common/SVNPlugin.class.php 
b/src/plugins/scmsvn/common/SVNPlugin.class.php
index a98281e..fb8ee5b 100644
--- a/src/plugins/scmsvn/common/SVNPlugin.class.php
+++ b/src/plugins/scmsvn/common/SVNPlugin.class.php
@@ -27,7 +27,7 @@
 
 require_once $gfcommon.'include/plugins_utils.php';
 
-forge_define_config_item('default_server', 'scmsvn', forge_get_config 
('scm_host'));
+forge_define_config_item('default_server', 'scmsvn', 
forge_get_config('scm_host'));
 forge_define_config_item('repos_path', 'scmsvn', 
forge_get_config('chroot').'/scmrepos/svn');
 forge_define_config_item('serve_path', 'scmsvn', 
forge_get_config('repos_path'));
 forge_define_config_item('use_ssh', 'scmsvn', false);
@@ -125,10 +125,10 @@ some control over it to the project's administrator.");
                        if (forge_get_config('ssh_port') != 22) {
                                $ssh_port = 
'--config-option="config:tunnels:ssh=ssh -p '.forge_get_config('ssh_port').'"';
                        }
-                       $b .= '<span class="tt">svn '.$ssh_port.' checkout 
svn://'.forge_get_config('scm_host').$this->svn_root_fs.'/'.$project->getUnixName().$module.'</span><br
 />';
+                       $b .= '<span class="tt">svn '.$ssh_port.' checkout 
svn://'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$project->getUnixName().$module.'</span><br
 />';
                }
                if (forge_get_config('use_dav', 'scmsvn')) {
-                       $b .= '<p><span class="tt">svn checkout 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : '').'://'. 
forge_get_config('scm_host'). 
'/anonscm/svn/'.$project->getUnixName().$module.'</span></p>' ;
+                       $b .= '<p><span class="tt">svn checkout 
http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : 
'').'://'.$this->getBoxForProject($project).'/anonscm/svn/'.$project->getUnixName().$module.'</span></p>'
 ;
                }
                $b .= '</p>';
                return $b;
@@ -165,7 +165,7 @@ some control over it to the project's administrator.");
                                if (forge_get_config('ssh_port') != 22) {
                                        $ssh_port = 
'--config-option="config:tunnels:ssh=ssh -p '.forge_get_config('ssh_port').'" ';
                                }
-                               $b .= '<p><span class="tt">svn 
'.$ssh_port.'checkout svn+ssh://'.$d.'@' . forge_get_config('scm_host') . 
$this->svn_root_fs .'/'. $project->getUnixName().$module.'</span></p>' ;
+                               $b .= '<p><span class="tt">svn 
'.$ssh_port.'checkout 
svn+ssh://'.$d.'@'.$this->getBoxForProject($project).$this->svn_root_fs .'/'. 
$project->getUnixName().$module.'</span></p>' ;
                                $b .= '</div>';
                        }
                        if (forge_get_config('use_dav', 'scmsvn')) {
@@ -173,7 +173,7 @@ some control over it to the project's administrator.");
                                $b .= '<p>';
                                $b .= _('Enter your site password when 
prompted.');
                                $b .= '</p>';
-                               $b .= '<p><span class="tt">svn checkout 
--username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : 
'').'://'. forge_get_config('scm_host'). 
'/authscm/'.$d.'/svn/'.$project->getUnixName().$module.'</span></p>' ;
+                               $b .= '<p><span class="tt">svn checkout 
--username '.$d.' http'.((forge_get_config('use_ssl', 'scmsvn')) ? 's' : 
'').'://'.$this->getBoxForProject($project).'/authscm/'.$d.'/svn/'.$project->getUnixName().$module.'</span></p>'
 ;
                                $b .= '</div>';
                        }
                } else {
@@ -190,7 +190,8 @@ some control over it to the project's administrator.");
                                if (forge_get_config('ssh_port') != 22) {
                                        $ssh_port = 
'--config-option="config:tunnels:ssh=ssh -p '.forge_get_config('ssh_port').'" ';
                                }
-                               $b .= '<p><span class="tt">svn 
'.$ssh_port.'checkout svn+ssh://<i>'._('developername').'</i>@' . 
forge_get_config('scm_host') . $this->svn_root_fs .'/'. 
$project->getUnixName().$module.'</span></p>' ; $b .= '</div>';
+                               $b .= '<p><span class="tt">svn 
'.$ssh_port.'checkout 
svn+ssh://<i>'._('developername').'</i>@'.$this->getBoxForProject($project).$this->svn_root_fs
 .'/'.$project->getUnixName().$module.'</span></p>';
+                               $b .= '</div>';
                        }
                        if (forge_get_config('use_dav', 'scmsvn')) {
                                $b .= '<div id="tabber-svndav" 
class="tabbertab" >';
@@ -199,7 +200,7 @@ some control over it to the project's administrator.");
                                $b .= ' ';
                                $b .= _('Enter your site password when 
prompted.');
                                $b .= '</p>';
-                               $b .= '<p><span class="tt">svn checkout 
--username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 
'scmsvn')) ? 's' : '').'://'. forge_get_config('scm_host'). 
'/authscm/<i>'._('developername').'</i>/svn/'.$project->getUnixName().$module.'</span></p>'
 ;
+                               $b .= '<p><span class="tt">svn checkout 
--username <i>'._('developername').'</i> http'.((forge_get_config('use_ssl', 
'scmsvn')) ? 's' : 
'').'://'.$this->getBoxForProject($project).'/authscm/<i>'._('developername').'</i>/svn/'.$project->getUnixName().$module.'</span></p>'
 ;
                                $b .= '</div>';
                        }
                }
@@ -607,7 +608,7 @@ some control over it to the project's administrator.");
                                        return false;
                                }
                        }
-                       $script_url = $protocol . forge_get_config('scm_host')
+                       $script_url = 
$protocol.$this->getBoxForProject($project)
                                . $server_script
                                .'?unix_group_name='.$project->getUnixName()
                                .'&mode=date_range'
@@ -697,7 +698,7 @@ some control over it to the project's administrator.");
                        } else {
                                $params = '&mode=latest';
                        }
-                       $script_url = $protocol . forge_get_config('scm_host')
+                       $script_url = 
$protocol.$this->getBoxForProject($project)
                                . $server_script
                                .'?unix_group_name='.$project->getUnixName()
                                . $params
@@ -775,17 +776,17 @@ some control over it to the project's administrator.");
                        }
                        $urls = array();
                        if (forge_get_config('use_dav', 'scmsvn')) {
-                               $urls[] = 
$protocol.'://'.forge_get_config('scm_host').'/anonscm/svn/'.$arr['unix_group_name'];
+                               $urls[] = 
$protocol.'://'.$this->getBoxForProject($project).'/anonscm/svn/'.$arr['unix_group_name'];
                        }
                        if (forge_get_config('use_ssh', 'scmsvn')) {
-                               $urls[] = 
'svn://'.forge_get_config('scm_host').$this->svn_root_fs.'/'.$arr['unix_group_name'];
+                               $urls[] = 
'svn://'.$this->getBoxForProject($project).$this->svn_root_fs.'/'.$arr['unix_group_name'];
                        }
                        if (session_loggedin()) {
                                if (forge_get_config('use_dav', 'scmsvn')) {
-                                       $urls[] = 
$protocol.'://'.forge_get_config('scm_host').'/authscm/'.$d.'/svn/'.$arr['unix_group_name'];
+                                       $urls[] = 
$protocol.'://'.$this->getBoxForProject($project).'/authscm/'.$d.'/svn/'.$arr['unix_group_name'];
                                }
                                if (forge_get_config('use_ssh', 'scmsvn')) {
-                                       $urls[] = 'svn+ssh://'.$d.'@' . 
forge_get_config('scm_host') . $this->svn_root_fs .'/'. $arr['unix_group_name'];
+                                       $urls[] = 
'svn+ssh://'.$d.'@'.$this->getBoxForProject($project).$this->svn_root_fs .'/'. 
$arr['unix_group_name'];
                                }
                        }
                        $results[] = array('group_id' => $arr['group_id'],

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

commit c28b8e61f658d66997fe925fa2a05e6fc940366e
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:30:14 2017 +0200

    scmdarcs: use checkParams.

diff --git a/src/plugins/scmdarcs/common/DarcsPlugin.class.php 
b/src/plugins/scmdarcs/common/DarcsPlugin.class.php
index c16cd68..e1ebb86 100644
--- a/src/plugins/scmdarcs/common/DarcsPlugin.class.php
+++ b/src/plugins/scmdarcs/common/DarcsPlugin.class.php
@@ -73,7 +73,7 @@ over it to the project's administrator.");
                        return;
                }
 
-               if ($project->usesPlugin($this->name) && 
forge_check_perm('scm', $project->getID(), 'read')) {
+               if (forge_check_perm('scm', $project->getID(), 'read')) {
                        $result = db_query_params('SELECT sum(commits) AS 
commits, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
                                                  array($project->getID()));
                        $commit_num = db_result($result, 0, 'commits');
@@ -219,10 +219,8 @@ over it to the project's administrator.");
                        return;
                }
 
-               if ($project->usesPlugin($this->name)) {
-                       if ($this->browserDisplayable($project)) {
-                                       
htmlIframe('/plugins/scmdarcs/cgi-bin/darcsweb.cgi?r='.$project->getUnixName().'/'.$params['repo_name'],array('id'=>'scmdarcs_iframe'));
-                       }
+               if ($this->browserDisplayable($project)) {
+                       
htmlIframe('/plugins/scmdarcs/cgi-bin/darcsweb.cgi?r='.$project->getUnixName().'/'.$params['repo_name'],array('id'=>'scmdarcs_iframe'));
                }
        }
 
@@ -232,10 +230,6 @@ over it to the project's administrator.");
                        return false;
                }
 
-               if (! $project->usesPlugin($this->name)) {
-                       return false;
-               }
-
                $toprepo = $this->getRootRepositories($project);
                $unix_group = 'scm_'.$project->getUnixName();
 
@@ -359,10 +353,6 @@ over it to the project's administrator.");
                $snapshot = 
forge_get_config('scm_snapshots_path').'/'.$group_name.'-scm-latest.tar'.util_get_compressed_file_extension();
                $tarball = 
forge_get_config('scm_tarballs_path').'/'.$group_name.'-scmroot.tar'.util_get_compressed_file_extension();
 
-               if (! $project->usesPlugin($this->name)) {
-                       return false;
-               }
-
                if (! $project->enableAnonSCM()) {
                        if (file_exists($tarball)) unlink($tarball);
                        return false;
@@ -411,10 +401,6 @@ over it to the project's administrator.");
                        return false;
                }
 
-               if (! $project->usesPlugin($this->name)) {
-                       return false;
-               }
-
                if ($params['mode'] == 'day') {
                        $year = $params['year'];
                        $month = $params['month'];
@@ -570,30 +556,27 @@ over it to the project's administrator.");
                        return false;
                }
 
-               if ($project->usesPlugin($this->name)) {
-                       $result = db_query_params(
-                               "SELECT repo_name FROM 
plugin_scmdarcs_create_repos WHERE group_id=$1",
+               $result = db_query_params('SELECT repo_name FROM 
plugin_scmdarcs_create_repos WHERE group_id=$1',
                                array($project->getID()));
-                       if ($result && db_numrows($result) > 0) {
-                               $nm = array();
-                               while ($res = db_fetch_array($result)) {
-                                       array_push($nm, $res['repo_name']);
-                               }
-                               print '<p><strong>'._('Repository to be 
created')._(': ').'</strong>'.
-                                       implode(_(', '), $nm) . '</p>';
+               if ($result && db_numrows($result) > 0) {
+                       $nm = array();
+                       while ($res = db_fetch_array($result)) {
+                               array_push($nm, $res['repo_name']);
                        }
+                       print '<p><strong>'._('Repository to be created')._(': 
').'</strong>'.
+                               implode(_(', '), $nm) . '</p>';
+               }
 
-                       print '<p><strong>'._('Create new repository')._(': 
').'</strong></p>';
-                       print '<p>'._('Repository name')._(': ');
-                       print '<input type="string" name="scm_create_repo_name" 
size=16 maxlength=128 /></p>';
-                       print '<p>'._('Clone')._(': ').
+               print '<p><strong>'._('Create new repository')._(': 
').'</strong></p>';
+               print '<p>'._('Repository name')._(': ');
+               print '<input type="string" name="scm_create_repo_name" size=16 
maxlength=128 /></p>';
+               print '<p>'._('Clone')._(': ').
                                '<select name="scm_clone_repo_name">';
-                       print '<option value="">&lt;none&gt;</option>';
-                       foreach ($this->getRepositories($project) as 
$repo_name) {
-                               print '<option 
value="'.$repo_name.'">'.$repo_name.'</option>';
-                       }
-                       print '</select></p>';
+               print '<option value="">&lt;none&gt;</option>';
+               foreach ($this->getRepositories($project) as $repo_name) {
+                       print '<option 
value="'.$repo_name.'">'.$repo_name.'</option>';
                }
+               print '</select></p>';
        }
 
        function adminUpdate($params) {

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

commit e7b679d4e59a16a3f139c9966bb0d404199f8895
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:29:32 2017 +0200

    space

diff --git a/src/plugins/scmcvs/common/CVSPlugin.class.php 
b/src/plugins/scmcvs/common/CVSPlugin.class.php
index 6a2ba1d..b68ecfa 100644
--- a/src/plugins/scmcvs/common/CVSPlugin.class.php
+++ b/src/plugins/scmcvs/common/CVSPlugin.class.php
@@ -22,8 +22,8 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-forge_define_config_item ('default_server', 'scmcvs', forge_get_config 
('scm_host')) ;
-forge_define_config_item ('repos_path', 'scmcvs', 
forge_get_config('chroot').'/scmrepos/cvs') ;
+forge_define_config_item('default_server', 'scmcvs', 
forge_get_config('scm_host')) ;
+forge_define_config_item('repos_path', 'scmcvs', 
forge_get_config('chroot').'/scmrepos/cvs') ;
 
 class CVSPlugin extends SCMPlugin {
        function __construct () {
@@ -38,12 +38,12 @@ _("This plugin contains the CVS subsystem of FusionForge. 
It allows each
 FusionForge project to have its own CVS repository, and gives some control
 over it to the project's administrator.");
                $this->hooks[] = 'scm_browser_page';
-               $this->hooks[] = 'scm_generate_snapshots' ;
-               $this->hooks[] = 'scm_gather_stats' ;
+               $this->hooks[] = 'scm_generate_snapshots';
+               $this->hooks[] = 'scm_gather_stats';
 
                $this->provides['cvs'] = true;
 
-               $this->register () ;
+               $this->register();
        }
 
        function getDefaultServer() {

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

commit 064d4efbf33ea33bd589cfe1e3994d1c5960e90c
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 14:29:14 2017 +0200

    scmbzr: use checkParams. space

diff --git a/src/plugins/scmbzr/common/BzrPlugin.class.php 
b/src/plugins/scmbzr/common/BzrPlugin.class.php
index a8e0caa..ab1912b 100644
--- a/src/plugins/scmbzr/common/BzrPlugin.class.php
+++ b/src/plugins/scmbzr/common/BzrPlugin.class.php
@@ -3,7 +3,7 @@
  * FusionForge Bazaar plugin
  *
  * Copyright 2009, Roland Mas
- * Copyright 2013-2014,2017 Franck Villaume - TrivialDev
+ * Copyright 2013-2014,2017, Franck Villaume - TrivialDev
  *
  * This file is part of FusionForge.
  *
@@ -24,8 +24,8 @@
 
 require_once $gfcommon.'include/plugins_utils.php';
 
-forge_define_config_item ('default_server', 'scmbzr', forge_get_config 
('scm_host')) ;
-forge_define_config_item ('repos_path', 'scmbzr', 
forge_get_config('chroot').'/scmrepos/bzr') ;
+forge_define_config_item('default_server', 'scmbzr', 
forge_get_config('scm_host'));
+forge_define_config_item('repos_path', 'scmbzr', 
forge_get_config('chroot').'/scmrepos/bzr');
 
 class BzrPlugin extends SCMPlugin {
        function __construct() {
@@ -37,32 +37,32 @@ class BzrPlugin extends SCMPlugin {
 _("This plugin contains the Bazaar subsystem of FusionForge. It allows each
 FusionForge project to have its own Bazaar repository, and gives some control
 over it to the project's administrator.");
-               $this->hooks[] = 'scm_generate_snapshots' ;
+               $this->hooks[] = 'scm_generate_snapshots';
                $this->hooks[] = 'scm_browser_page';
-               $this->hooks[] = 'scm_update_repolist' ;
-               $this->hooks[] = 'scm_gather_stats' ;
+               $this->hooks[] = 'scm_update_repolist';
+               $this->hooks[] = 'scm_gather_stats';
 
-               $this->main_branch_names = array () ;
-               $this->main_branch_names[] = 'trunk' ;
-               $this->main_branch_names[] = 'master' ;
-               $this->main_branch_names[] = 'main' ;
-               $this->main_branch_names[] = 'head' ;
-               $this->main_branch_names[] = 'HEAD' ;
+               $this->main_branch_names = array();
+               $this->main_branch_names[] = 'trunk';
+               $this->main_branch_names[] = 'master';
+               $this->main_branch_names[] = 'main';
+               $this->main_branch_names[] = 'head';
+               $this->main_branch_names[] = 'HEAD';
 
                $this->register () ;
        }
 
        function getDefaultServer() {
-               return forge_get_config('default_server', 'scmbzr') ;
+               return forge_get_config('default_server', 'scmbzr');
        }
 
-       function printShortStats ($params) {
-               $project = $this->checkParams ($params) ;
+       function printShortStats($params) {
+               $project = $this->checkParams($params);
                if (!$project) {
                        return;
                }
 
-               if ($project->usesPlugin($this->name) && 
forge_check_perm('scm', $project->getID(), 'read')) {
+               if (forge_check_perm('scm', $project->getID(), 'read')) {
                        $result = db_query_params('SELECT sum(updates) AS 
updates, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
                                                  array ($project->getID())) ;
                        $commit_num = db_result($result,0,'updates');
@@ -77,7 +77,7 @@ over it to the project's administrator.");
                }
        }
 
-       function getBlurb () {
+       function getBlurb() {
                return '<p>'
                                . sprintf(_('Documentation for %1$s is 
available at <a href="%2$s">%2$s</a>.'),
                                                        'Bazaar (“bzr”)',
@@ -85,7 +85,7 @@ over it to the project's administrator.");
                                . '</p>';
        }
 
-       function getInstructionsForAnon ($project) {
+       function getInstructionsForAnon($project) {
                $b = '<h2>';
                $b .=  _('Anonymous Bazaar Access');
                $b = '</h2>';
@@ -98,7 +98,7 @@ over it to the project's administrator.");
                return $b ;
        }
 
-       function getInstructionsForRW ($project) {
+       function getInstructionsForRW($project) {
                $b = '' ;
                if (session_loggedin()) {
                        $u = user_get_object(user_getid()) ;
@@ -151,21 +151,19 @@ over it to the project's administrator.");
                return $b ;
        }
 
-       function getStatsBlock ($project) {
+       function getStatsBlock($project) {
                return;
        }
 
-       function printBrowserPage ($params) {
+       function printBrowserPage($params) {
                global $HTML;
-               $project = $this->checkParams ($params) ;
+               $project = $this->checkParams($params);
                if (!$project) {
                        return;
                }
 
-               if ($project->usesPlugin ($this->name)) {
-                       if ($this->browserDisplayable ($project)) {
-                                       
htmlIframe('/scm/loggerhead/'.$project->getUnixName(),array('id'=>'scmbzr_iframe'));
-                       }
+               if ($this->browserDisplayable ($project)) {
+                       
htmlIframe('/scm/loggerhead/'.$project->getUnixName(),array('id'=>'scmbzr_iframe'));
                }
        }
 
@@ -175,10 +173,6 @@ over it to the project's administrator.");
                        return false ;
                }
 
-               if (! $project->usesPlugin ($this->name)) {
-                       return false;
-               }
-
                $project_name = $project->getUnixName();
 
                $repo = forge_get_config('repos_path', 'scmbzr') . '/' . 
$project->getUnixName() ;
@@ -202,27 +196,27 @@ over it to the project's administrator.");
                                return false;
                        }
 
-                       system ("bzr init-repo --no-trees $tmp_repo 
>/dev/null") ;
-                       system ("find $tmp_repo/.bzr -type d | xargs chmod 
g+s") ;
-                       system ("chmod -R g+rwX,o+rX-w $tmp_repo/.bzr") ;
-                       system ("chgrp -R $unix_group $tmp_repo/.bzr") ;
+                       system("bzr init-repo --no-trees $tmp_repo >/dev/null") 
;
+                       system("find $tmp_repo/.bzr -type d | xargs chmod g+s") 
;
+                       system("chmod -R g+rwX,o+rX-w $tmp_repo/.bzr") ;
+                       system("chgrp -R $unix_group $tmp_repo/.bzr") ;
 
-                       system ("mkdir -p $repo") ;
-                       system ("chgrp $unix_group $repo") ;
-                       system ("chmod g+ws $repo") ;
-                       system ("mv $tmp_repo/.bzr $repo/.bzr");
-                       rmdir ($tmp_repo);
+                       system("mkdir -p $repo") ;
+                       system("chgrp $unix_group $repo") ;
+                       system("chmod g+ws $repo") ;
+                       system("mv $tmp_repo/.bzr $repo/.bzr");
+                       rmdir($tmp_repo);
                }
 
                if ($project->enableAnonSCM()) {
-                       system ("chmod o+rX-w $repo") ;
+                       system("chmod o+rX-w $repo") ;
                } else {
-                       system ("chmod o-rwx $repo") ;
+                       system("chmod o-rwx $repo") ;
                }
        }
 
-       function updateRepositoryList ($params) {
-               $groups = $this->getGroups () ;
+       function updateRepositoryList($params) {
+               $groups = $this->getGroups();
 
                $dir = 
forge_get_config('data_path').'/plugins/scmbzr/public-repositories' ;
 
@@ -275,15 +269,11 @@ over it to the project's administrator.");
        }
 
        function gatherStats($params) {
-                $project = $this->checkParams ($params) ;
+                $project = $this->checkParams($params);
                 if (!$project) {
                         return false ;
                 }
 
-                if (! $project->usesPlugin ($this->name)) {
-                        return false;
-                }
-
                 if ($params['mode'] == 'day') {
                         db_begin();
 
@@ -453,35 +443,35 @@ over it to the project's administrator.");
                                                return false ;
                                        }
                                }
-                        }
-                }
-                db_commit();
+                       }
+               }
+               db_commit();
        }
 
-       function findMainBranch ($project) {
+       function findMainBranch($project) {
                $toprepo = forge_get_config('repos_path', 'scmbzr') ;
                $repo = $toprepo . '/' . $project->getUnixName() ;
 
-               $branch = '' ;
+               $branch = '';
 
                foreach ($this->main_branch_names as $bname) {
                        system ("bzr ls file://$repo/$bname > /dev/null 2>&1", 
$code) ;
                        if ($code == 0) {
                                $branch = $bname ;
-                               break ;
+                               break;
                        }
                }
                return $branch;
        }
 
-       function generateSnapshots ($params) {
+       function generateSnapshots($params) {
                $us = forge_get_config('use_scm_snapshots') ;
                $ut = forge_get_config('use_scm_tarballs') ;
                if (!$us && !$ut) {
-                       return false ;
+                       return false;
                }
 
-               $project = $this->checkParams ($params) ;
+               $project = $this->checkParams($params);
                if (!$project) {
                        return false ;
                }
@@ -536,7 +526,7 @@ over it to the project's administrator.");
                        system ("rm -rf $tmp") ;
                }
        }
-  }
+}
 
 // Local Variables:
 // mode: php

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

commit d80ef28725ef5245cee0be7bd69e0cacc8a9eae9
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:40:07 2017 +0200

    scmsvn: use checkParams

diff --git a/src/plugins/scmsvn/common/SVNPlugin.class.php 
b/src/plugins/scmsvn/common/SVNPlugin.class.php
index 48f36a1..a98281e 100644
--- a/src/plugins/scmsvn/common/SVNPlugin.class.php
+++ b/src/plugins/scmsvn/common/SVNPlugin.class.php
@@ -77,7 +77,7 @@ some control over it to the project's administrator.");
                        return;
                }
 
-               if ($project->usesPlugin($this->name) && 
forge_check_perm('scm', $project->getID(), 'read')) {
+               if (forge_check_perm('scm', $project->getID(), 'read')) {
                        $result = db_query_params('SELECT sum(updates) AS 
updates, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
                                                array($project->getID()));
                        $commit_num = db_result($result,0,'updates');
@@ -208,7 +208,7 @@ some control over it to the project's administrator.");
        }
 
        function getSnapshotPara($project) {
-               return ;
+               return;
        }
 
        function getBrowserLinkBlock($project) {
@@ -275,20 +275,17 @@ some control over it to the project's administrator.");
                        return;
                }
 
-               if ($project->usesPlugin($this->name)) {
-                       $iframe_src = 
'/scm/viewvc.php?root='.$project->getUnixName();
-                       if ($params['commit']) {
-                               $iframe_src .= 
'&view=rev&revision='.$params['commit'];
-                       }
-                       htmlIframe($iframe_src, array('id'=>'scmsvn_iframe'));
+               $iframe_src = '/scm/viewvc.php?root='.$project->getUnixName();
+               if ($params['commit']) {
+                       $iframe_src .= '&view=rev&revision='.$params['commit'];
                }
+               htmlIframe($iframe_src, array('id'=>'scmsvn_iframe'));
        }
 
        function createOrUpdateRepo($params) {
                $project = $this->checkParams($params);
                if (!$project) return false;
                if (!$project->isActive()) return false;
-               if (!$project->usesPlugin($this->name)) return false;
 
                $repo_prefix = forge_get_config('repos_path', 'scmsvn');
                if (!is_dir($repo_prefix) && !mkdir($repo_prefix, 0755, true)) {
@@ -364,10 +361,6 @@ some control over it to the project's administrator.");
                        return false;
                }
 
-               if (!$project->usesPlugin($this->name)) {
-                       return false;
-               }
-
                if ($params['mode'] == 'day') {
                        db_begin();
 
@@ -589,9 +582,8 @@ some control over it to the project's administrator.");
                $times = array();
                $revisions = array();
 
-               $group_id = $params['group'];
-               $project = group_get_object($group_id);
-               if (!$project->usesPlugin($this->name)) {
+               $project = $this->checkParams($params);
+               if (!$project) {
                        return false;
                }
 
@@ -648,8 +640,8 @@ some control over it to the project's administrator.");
                                foreach ($messages as $message) {
                                        $result = array();
                                        $result['section'] = 'scm';
-                                       $result['group_id'] = $group_id;
-                                       $result['ref_id'] = 
'browser.php?group_id='.$group_id;
+                                       $result['group_id'] = $project->getID();
+                                       $result['ref_id'] = 
'browser.php?group_id='.$project->getID();
                                        $result['description'] = 
htmlspecialchars($message).' (r'.$revisions[$i].')';
                                        $userObject = 
user_get_object_by_name($users[$i]);
                                        if (is_a($userObject, 'FFUser')) {

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

commit 3c89a9342d52c818b1c1470f3ff9c25c3caf2c42
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:39:48 2017 +0200

    scmgit: use checkParams

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php 
b/src/plugins/scmgit/common/GitPlugin.class.php
index 4d22296..e3c8527 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -72,7 +72,7 @@ control over it to the project's administrator.");
                        return;
                }
 
-               if ($project->usesPlugin($this->name) && 
forge_check_perm('scm', $project->getID(), 'read')) {
+               if (forge_check_perm('scm', $project->getID(), 'read')) {
                        $result = db_query_params('SELECT sum(updates) AS 
updates, sum(adds) AS adds FROM stats_cvs_group WHERE group_id=$1',
                                                array($project->getID()));
                        $commit_num = db_result($result,0,'updates');
@@ -417,7 +417,6 @@ control over it to the project's administrator.");
                $project = $this->checkParams($params);
                if (!$project) return false;
                if (!$project->isActive()) return false;
-               if (!$project->usesPlugin($this->name)) return false;
 
                $project_name = $project->getUnixName();
                $unix_group_ro = $project_name . '_scmro';
@@ -660,10 +659,6 @@ control over it to the project's administrator.");
                        return false;
                }
 
-               if (!$project->usesPlugin($this->name)) {
-                       return false;
-               }
-
                if ($params['mode'] == 'day') {
                        $year = $params['year'];
                        $month = $params['month'];
@@ -680,7 +675,6 @@ control over it to the project's administrator.");
        }
 
        function gatherStatsRepo($group, $project_reponame, $year, $month, 
$day) {
-
                $month_string = sprintf("%04d%02d", $year, $month);
                $start_time = gmmktime(0, 0, 0, $month, $day, $year);
                $end_time = $start_time + 86400;
@@ -973,11 +967,11 @@ control over it to the project's administrator.");
        }
 
        function activity($params) {
-               $group_id = $params['group'];
-               $project = group_get_object($group_id);
-               if (!$project->usesPlugin($this->name)) {
+               $project = $this->checkParams($params);
+               if (!$project) {
                        return false;
                }
+
                if (in_array('scmgit', $params['show']) || 
(count($params['show']) < 1)) {
                        if ($project->enableAnonSCM()) {
                                $server_script = '/anonscm/gitlog';
@@ -1021,8 +1015,8 @@ control over it to the project's administrator.");
                                if (sizeof($splitedLine) == 4) {
                                        $result = array();
                                        $result['section'] = 'scm';
-                                       $result['group_id'] = $group_id;
-                                       $result['ref_id'] = 
'browser.php?group_id='.$group_id.'&commit='.$splitedLine[3];
+                                       $result['group_id'] = $project->getID();
+                                       $result['ref_id'] = 
'browser.php?group_id='.$project->getID().'&commit='.$splitedLine[3];
                                        $result['description'] = 
htmlspecialchars($splitedLine[2]).' (commit '.$splitedLine[3].')';
                                        $userObject = 
user_get_object_by_email($splitedLine[1]);
                                        if (is_a($userObject, 'FFUser')) {
@@ -1049,9 +1043,6 @@ control over it to the project's administrator.");
                if (!$project) {
                        return false;
                }
-               if (!$project->usesPlugin($this->name)) {
-                       return false;
-               }
 
                if (!isset($params['repo_name'])) {
                        return false;
@@ -1138,9 +1129,6 @@ control over it to the project's administrator.");
                if (!$project) {
                        return false;
                }
-               if (!$project->usesPlugin($this->name)) {
-                       return false;
-               }
 
                session_require_perm('project_admin', $params['group_id']);
 

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

commit 267fa71b5a1fec91ef596c95d5e5a088e2d4afc1
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:39:22 2017 +0200

    activity hook: group -> group_id

diff --git a/src/plugins/mediawiki/common/mediawikiPlugin.class.php 
b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
index 4cdc04e..4c11d54 100644
--- a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
+++ b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
@@ -40,7 +40,7 @@ class MediaWikiPlugin extends Plugin {
                'MEDIAWIKI_CREATE_IMAGEDIR' => 'create-imagedirs.php'
        );
 
-       function __construct ($id=0) {
+       function __construct($id = 0) {
                parent::__construct($id) ;
                $this->name = 'mediawiki' ;
                $this->text = _('Mediawiki') ; // To show in the tabs, use...
@@ -367,7 +367,7 @@ _('This plugin allows each project to embed Mediawiki under 
a tab.');
                                exec('/bin/rm -rf 
'.forge_get_config('projects_path', 
'mediawiki').'/'.$projectObject->getUnixName());
                        }
                } elseif ($hookname == 'activity') {
-                       $group_id = $params['group'];
+                       $group_id = $params['group_id'];
                        $project = group_get_object($group_id);
                        if (!$project->usesPlugin($this->name)) {
                                return false;
diff --git a/src/plugins/wiki/common/WikiPlugin.class.php 
b/src/plugins/wiki/common/WikiPlugin.class.php
index 0a9ca61..097a973 100644
--- a/src/plugins/wiki/common/WikiPlugin.class.php
+++ b/src/plugins/wiki/common/WikiPlugin.class.php
@@ -141,7 +141,7 @@ page edits displayed on activity tab, and multi-project 
wiki preferences.");
                                $params['result'] .= '</div>';
                        }
                } elseif ($hookname == 'activity') {
-                       $group = group_get_object($params['group']);
+                       $group = group_get_object($params['group_id']);
                        if (!$group || !is_object($group)) {
                                return;
                        }
diff --git a/src/www/activity/index.php b/src/www/activity/index.php
index 2492cd7..a782bfb 100644
--- a/src/www/activity/index.php
+++ b/src/www/activity/index.php
@@ -158,7 +158,7 @@ if ($results === false) {
        exit_error(_('Unable to get 
activities')._(':').$ffactivity->getErrorMessage(), 'home');
 }
 // If plugins wants to add activities.
-$hookParams['group'] = $group_id;
+$hookParams['group_id'] = $group_id;
 $hookParams['results'] = &$results;
 $hookParams['show'] = &$show;
 $hookParams['begin'] = $begin;

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

commit 73867f9a6dc06c2bdaf53f874af77d2930d8627f
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:38:05 2017 +0200

    space

diff --git a/src/common/include/SCMPlugin.class.php 
b/src/common/include/SCMPlugin.class.php
index 68f60fb..63acfe8 100644
--- a/src/common/include/SCMPlugin.class.php
+++ b/src/common/include/SCMPlugin.class.php
@@ -321,7 +321,7 @@ abstract class SCMPlugin extends Plugin {
        }
 
        function checkParams($params) {
-               $group_id = $params['group_id'] ;
+               $group_id = $params['group_id'];
                $project = group_get_object($group_id);
                if (!$project || !is_object($project)) {
                        return false;

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

commit cc7c60a2a4c31c592b2e48ca3d550592963b2f52
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:10:16 2017 +0200

    improve checkParams. Less code. Space.

diff --git a/src/common/include/SCMPlugin.class.php 
b/src/common/include/SCMPlugin.class.php
index 1a8bc5b..68f60fb 100644
--- a/src/common/include/SCMPlugin.class.php
+++ b/src/common/include/SCMPlugin.class.php
@@ -4,7 +4,7 @@
  *
  * Copyright 2004-2009, Roland Mas
  * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
- * Copyright 2012,2014 Franck Villaume - TrivialDev
+ * Copyright 2012,2014,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
@@ -146,47 +146,45 @@ abstract class SCMPlugin extends Plugin {
                        return;
                }
 
-               if ($project->usesPlugin($this->name)) {
-                       echo ' ('.$this->text.')' ;
-               }
+               echo ' ('.$this->text.')';
        }
 
-       function getBlurb () {
+       function getBlurb() {
                return html_e('p', array(), _('Unimplemented SCM plugin.'));
        }
 
-       function getInstructionsForAnon ($project) {
+       function getInstructionsForAnon($project) {
                return html_e('p', array(), _('Instructions for anonymous 
access for unimplemented SCM plugin.'));
        }
 
-       function getInstructionsForRW ($project) {
+       function getInstructionsForRW($project) {
                return html_e('p', array(), _('Instructions for read-write 
access for unimplemented SCM plugin.'));
        }
 
-       function getSnapshotPara ($project) {
+       function getSnapshotPara($project) {
                return html_e('p', array(), _('Instructions for snapshot access 
for unimplemented SCM plugin.'));
        }
 
        function getBrowserLinkBlock($project) {
-               global $HTML ;
+               global $HTML;
                $b = $HTML->boxMiddle(_('Repository Browser'));
                $b .= html_e('p', array(), _('Browsing the SCM tree is not yet 
implemented for this SCM plugin.'));
                $b .= html_e('p', array(), 
'['.util_make_link('/scm/?group_id='.$project->getID(), _('Not implemented 
yet')).']');
-               return $b ;
+               return $b;
        }
 
        function getBrowserBlock($project) {
-               global $HTML ;
+               global $HTML;
                $b = $HTML->boxMiddle(_('Repository Browser'));
                $b .= html_e('p', array(), _('Browsing the SCM tree is not yet 
implemented for this SCM plugin.'));
-               return $b ;
+               return $b;
        }
 
        function getStatsBlock($project) {
-               global $HTML ;
+               global $HTML;
                $b = $HTML->boxMiddle(_('Repository Statistics'));
                $b .= html_e('p', array(), _('Not implemented for this SCM 
plugin yet.'));
-               return $b ;
+               return $b;
        }
 
        function printPage($params) {
@@ -197,45 +195,42 @@ abstract class SCMPlugin extends Plugin {
                        return;
                }
 
-               if ($project->usesPlugin($this->name)) {
-
-                       session_require_perm('scm', $project->getID(), 'read');
-                       // Table for summary info
-                       echo $HTML->listTableTop();
-                       $cells = array();
-                       $cellContent = $this->getBlurb();
-
-                       // Instructions for anonymous access
-                       if ($project->enableAnonSCM()) {
-                               $cellContent .= 
$this->getInstructionsForAnon($project);
-                       }
+               session_require_perm('scm', $project->getID(), 'read');
+               // Table for summary info
+               echo $HTML->listTableTop();
+               $cells = array();
+               $cellContent = $this->getBlurb();
 
-                       // Instructions for developer access
-                       $cellContent .= $this->getInstructionsForRW($project);
+               // Instructions for anonymous access
+               if ($project->enableAnonSCM()) {
+                       $cellContent .= $this->getInstructionsForAnon($project);
+               }
 
-                       // Browsing
-                       if ($this->browserDisplayable($project)) {
-                               $cellContent .= 
$this->getBrowserLinkBlock($project);
-                       }
+               // Instructions for developer access
+               $cellContent .= $this->getInstructionsForRW($project);
 
-                       // Snapshot
-                       if ($this->browserDisplayable($project)) {
-                               $cellContent .= 
$this->getSnapshotPara($project);
-                       }
-                       $cells[] = array($cellContent, 'style' => 'width:65%');
+               // Browsing
+               if ($this->browserDisplayable($project)) {
+                       $cellContent .= $this->getBrowserLinkBlock($project);
+               }
 
-                       $cellContent =  $HTML->boxTop(_('Repository History'));
-                       // Stats
-                       $cellContent .=  _('Data about current and past states 
of the repository.');
-                       if ($this->browserDisplayable($project)) {
-                               $cellContent .= $this->getStatsBlock($project);
-                       }
+               // Snapshot
+               if ($this->browserDisplayable($project)) {
+                       $cellContent .= $this->getSnapshotPara($project);
+               }
+               $cells[] = array($cellContent, 'style' => 'width:65%');
 
-                       $cellContent .= $HTML->boxBottom();
-                       $cells[] = array($cellContent, 'style' => 'width:35%', 
'class' => 'top');
-                       echo $HTML->multiTableRow(array('class' => 'top'), 
$cells);
-                       echo $HTML->listTableBottom();
+               $cellContent =  $HTML->boxTop(_('Repository History'));
+               // Stats
+               $cellContent .=  _('Data about current and past states of the 
repository.');
+               if ($this->browserDisplayable($project)) {
+                       $cellContent .= $this->getStatsBlock($project);
                }
+
+               $cellContent .= $HTML->boxBottom();
+               $cells[] = array($cellContent, 'style' => 'width:35%', 'class' 
=> 'top');
+               echo $HTML->multiTableRow(array('class' => 'top'), $cells);
+               echo $HTML->listTableBottom();
        }
 
        function printBrowserPage($params) {
@@ -244,18 +239,19 @@ abstract class SCMPlugin extends Plugin {
                        return;
                }
 
-               if ($project->usesPlugin ($this->name)) {
-                       if ($this->browserDisplayable ($project)) {
-                               // print '<iframe 
src="'.util_make_url('/scm/browser.php?title='.$group->getUnixName()).'" 
frameborder="0" width=100% height=700></iframe>' ;
-                       }
+               if ($this->browserDisplayable($project)) {
+                       // print '<iframe 
src="'.util_make_url('/scm/browser.php?title='.$group->getUnixName()).'" 
frameborder="0" width=100% height=700></iframe>' ;
                }
        }
 
        function printAdminPage($params) {
-               $group = group_get_object($params['group_id']);
-               $ra = RoleAnonymous::getInstance() ;
+               $group = $this->checkParams($params);
+               if (!$project) {
+                       return;
+               }
 
-               if ( $group->usesPlugin ( $this->name ) && 
$ra->hasPermission('project_read', $group->getID())) {
+               $ra = RoleAnonymous::getInstance();
+               if ($ra->hasPermission('project_read', $group->getID())) {
                        $inputAttr = array('type' => 'checkbox', 'name' => 
'scm_enable_anonymous', 'value' => 1);
                        if ($group->enableAnonSCM()) {
                                $inputAttr['checked'] = 'checked';
@@ -269,13 +265,10 @@ abstract class SCMPlugin extends Plugin {
                if (!$project) {
                        return;
                }
-
-               if ($project->usesPlugin($this->name) ) {
-                       if (isset($params['scm_enable_anonymous']) && 
$params['scm_enable_anonymous']) {
-                               $project->SetUsesAnonSCM(true);
-                       } else {
-                               $project->SetUsesAnonSCM(false);
-                       }
+               if (isset($params['scm_enable_anonymous']) && 
$params['scm_enable_anonymous']) {
+                       $project->SetUsesAnonSCM(true);
+               } else {
+                       $project->SetUsesAnonSCM(false);
                }
        }
 
@@ -293,9 +286,6 @@ abstract class SCMPlugin extends Plugin {
        function scm_delete_repo(&$params) {
                $project = $this->checkParams($params);
                if (!$project) {
-                       return false ;
-               }
-               if (! $project->usesPlugin ($this->name)) {
                        return false;
                }
 
@@ -307,7 +297,7 @@ abstract class SCMPlugin extends Plugin {
                                          array ($params['group_id'],
                                                 $params['repo_name'],
                                                 $this->getID()));
-               if (! $result) {
+               if (!$result) {
                        $params['error_msg'] = db_error();
                        return false;
                }
@@ -321,25 +311,29 @@ abstract class SCMPlugin extends Plugin {
                                                  $params['group_id'],
                                                  $params['repo_name'],
                                                  $this->getID()));
-               if (! $result) {
+               if (!$result) {
                        $params['error_msg'] = db_error();
                        return false;
                }
 
-               plugin_hook ("scm_admin_update", $params);
+               plugin_hook("scm_admin_update", $params);
                return true;
        }
 
-       function checkParams ($params) {
+       function checkParams($params) {
                $group_id = $params['group_id'] ;
                $project = group_get_object($group_id);
                if (!$project || !is_object($project)) {
                        return false;
                } elseif ($project->isError()) {
                        return false;
+               } elseif (!$project->usesSCM()) {
+                       return false;
+               } elseif (!$project->usesPlugin($this->name)) {
+                       return false;
                }
 
-               return $project ;
+               return $project;
        }
 }
 

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

commit 4a2631f94e9c11f091c20e93d60732f4dcc80e35
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:09:26 2017 +0200

    use HTML theming function. less code

diff --git a/src/plugins/scmgit/common/GitPlugin.class.php 
b/src/plugins/scmgit/common/GitPlugin.class.php
index 888e3fe..4d22296 100644
--- a/src/plugins/scmgit/common/GitPlugin.class.php
+++ b/src/plugins/scmgit/common/GitPlugin.class.php
@@ -150,23 +150,22 @@ control over it to the project's administrator.");
                global $HTML;
                $repo_list = $this->getRepositories($project);
 
-               $b = '';
-               $b .= html_e('h2', array(), _('Developer Access'));
+               $b = html_e('h2', array(), _('Developer Access'));
                $b .= html_e('p', array(),
                                ngettext('Only project developers can access 
the Git repository via this method.',
                                'Only project developers can access the Git 
repositories via this method.',
                                count($repo_list)));
                $b .= '<div id="tabber-git">';
-               $b .= '<ul>';
+               $liElements = array();
                if (forge_get_config('use_ssh', 'scmgit')) {
-                       $b .= '<li><a href="#tabber-gitssh">'._('via 
SSH').'</a></li>';
+                       $liElements[]['content'] = '<a 
href="#tabber-gitssh">'._('via SSH').'</a>';
                        $configuration = 1;
                }
                if (forge_get_config('use_smarthttp', 'scmgit')) {
-                       $b .= '<li><a href="#tabber-gitsmarthttp">'._('via 
"smart HTTP"').'</a></li>';
+                       $liElements[]['content'] = '<a 
href="#tabber-gitsmarthttp">'._('via "smart HTTP"').'</a>';
                        $configuration = 1;
                }
-               $b .= '</ul>';
+               $b .= $HTML->html_list($liElements);
                if (!isset($configuration)) {
                        return $HTML->error_msg(_('Error')._(': ')._('No access 
protocol has been allowed for the Git plugin in scmgit.ini: use_ssh and 
use_smarthttp are disabled'));
                }
@@ -312,15 +311,7 @@ control over it to the project's administrator.");
                $b .= html_e('p', array(), 
'['.util_make_link('/scm/browser.php?group_id='.$project->getID(), _('Browse 
main git repository')).']');
 
                # Extra repos
-               $result = db_query_params('SELECT repo_name FROM 
scm_secondary_repos WHERE group_id=$1 AND next_action = $2 AND plugin_id=$3 
ORDER BY repo_name',
-                                                                 
array($project->getID(),
-                                                                               
SCM_EXTRA_REPO_ACTION_UPDATE,
-                                                                               
$this->getID()));
-               $rows = db_numrows($result);
-               $repo_list = array();
-               for ($i=0; $i<$rows; $i++) {
-                       $repo_list[] = db_result($result,$i,'repo_name');
-               }
+               $repo_list = $this->getRepositories($project, false);
                foreach ($repo_list as $repo_name) {
                        if (forge_get_config('use_smarthttp', 'scmgit')) {
                                $protocol = forge_get_config('use_ssl', 
'scmgit')? 'https' : 'http';
@@ -1137,7 +1128,7 @@ control over it to the project's administrator.");
                        return false;
                }
 
-               plugin_hook ("scm_admin_update", $params);
+               plugin_hook('scm_admin_update', $params);
                return true;
        }
 
@@ -1183,11 +1174,11 @@ control over it to the project's administrator.");
                                $cells[][] = $repo['description'];
                                $cells[][] = $repo['clone_url'];
                                $deleteForm = $HTML->openForm(array('name' => 
'form_delete_repo_'.$repo['repo_name'], 'action' => 
getStringFromServer('PHP_SELF'), 'method' => 'post'));
-                               $deleteForm .= html_e('input', array('type' => 
'hidden', 'name' => 'group_id', 'value' => $params['group_id']));
-                               $deleteForm .= html_e('input', array('type' => 
'hidden', 'name' => 'delete_repository', 'value' => 1));
-                               $deleteForm .= html_e('input', array('type' => 
'hidden', 'name' => 'repo_name', 'value' => $repo['repo_name']));
-                               $deleteForm .= html_e('input', array('type' => 
'hidden', 'name' => 'scm_enable_anonymous', 'value' => 
($project->enableAnonSCM()? 1 : 0)));
-                               $deleteForm .= html_e('input', array('type' => 
'submit', 'name' => 'submit', 'value' => _('Delete')));
+                               $deleteForm .= $HTML->html_input('group_id', 
'', '', 'hidden', $params['group_id']);
+                               $deleteForm .= 
$HTML->html_input('delete_repository', '', '', 'hidden', 1);
+                               $deleteForm .= $HTML->html_input('repo_name', 
'', '', 'hidden', $repo['repo_name']);
+                               $deleteForm .= 
$HTML->html_input('scm_enable_anonymous', '', '', 'hidden', 
($project->enableAnonSCM()? 1 : 0));
+                               $deleteForm .= $HTML->html_input('submit', '', 
'', 'submit', _('Delete'));
                                $deleteForm .= $HTML->closeForm();
                                $cells[][] = $deleteForm;
                                echo $HTML->multiTableRow(array(), $cells);
@@ -1197,17 +1188,17 @@ control over it to the project's administrator.");
 
                echo html_e('h2', array(), _('Create new Git repository for 
project').' '.$project_name);
                echo $HTML->openForm(array('name' => 'form_create_repo', 
'action' => getStringFromServer('PHP_SELF'), 'method' => 'post'));
-               echo html_e('input', array('type' => 'hidden', 'name' => 
'group_id', 'value' => $params['group_id']));
-               echo html_e('input', array('type' => 'hidden', 'name' => 
'create_repository', 'value' => 1));
+               echo $HTML->html_input('group_id', '', '', 'hidden', 
$params['group_id']);
+               echo $HTML->html_input('create_repository', '', '', 'hidden', 
1);
                echo html_e('p', array(), html_e('strong', array(), 
_('Repository name')._(':')).utils_requiredField().html_e('br').
-                               html_e('input', array('type' => 'text', 
'required' => 'required', 'size' => 20, 'name' => 'repo_name', 'value' => '')));
+                               $HTML->html_input('repo_name', '', '', 'text', 
'', array('required' => 'required', 'size' => 20));
                echo html_e('p', array(), html_e('strong', array(), 
_('Description')._(':')).html_e('br').
-                               html_e('input', array('type' => 'text', 'size' 
=> 60, 'name' => 'description', 'value' => '')));
+                               $HTML->html_input('description', '', '', 
'text', '', array('size' => 60));
                echo html_e('p', array(), html_e('strong', array(), _('Initial 
clone URL (or name of an existing repository in this project; leave empty to 
start with an empty repository)')._(':')).html_e('br').
-                               html_e('input', array('type' => 'text', 'size' 
=> 60, 'name' => 'clone', 'value' => $project_name)));
-               echo html_e('input', array('type' => 'hidden', 'name' => 
'scm_enable_anonymous', 'value' => ($project->enableAnonSCM()? 1 : 0)));
-               echo html_e('input', array('type' => 'submit', 'name' => 
'cancel', 'value' => _('Cancel')));
-               echo html_e('input', array('type' => 'submit', 'name' => 
'submit', 'value' => _('Submit')));
+                               $HTML->html_input('clone', '', '', 'text', 
$project_name, array('size' => 60));
+               echo $HTML->html_input('scm_enable_anonymous', '', '', 
'hidden', ($project->enableAnonSCM()? 1 : 0));
+               echo $HTML->html_input('cancel', '', '', 'submit', _('Cancel'));
+               echo $HTML->html_input('submit', '', '', 'submit', _('Submit'));
                echo $HTML->closeForm();
        }
 
@@ -1496,8 +1487,10 @@ control over it to the project's administrator.");
                }
        }
 
-       function getRepositories($group) {
-               $repoarr = array($group->getUnixName());
+       function getRepositories($group, $autoinclude = true) {
+               if ($autoinclude) {
+                       $repoarr = array($group->getUnixName());
+               }
                $result = db_query_params('SELECT repo_name FROM 
scm_secondary_repos WHERE group_id = $1 AND next_action = $2 AND plugin_id = $3 
ORDER BY repo_name',
                                                   array($group->getID(),
                                                          
SCM_EXTRA_REPO_ACTION_UPDATE,

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

commit 5a783a31e0a294766b8bbd9ec1396358a49c790e
Author: Franck Villaume <[email protected]>
Date:   Sun Sep 10 13:08:33 2017 +0200

    use HTML theming function

diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index fcd9b59..18a93e9 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -735,7 +735,7 @@ abstract class Layout extends FFError {
                }
        }
 
-       function confirmBox($msg, $params, $buttons, $image='*none*') {
+       function confirmBox($msg, $params, $buttons, $image = '*none*') {
                global $HTML;
                if ($image == '*none*') {
                        $image = html_image('stop.png', 48, 48);
@@ -1287,7 +1287,7 @@ abstract class Layout extends FFError {
                        $html_content .= sprintf(_('Displaying results %1$s out 
of %2$d total.'), ($start + 1).'-'.$maxElements, $totalElements);
                        if (session_loggedin()) {
                                $html_content .= sprintf(' ' . _('Displaying %s 
results.'), html_build_select_box_from_array(array('10', '25', '50', '100', 
'1000'), 'nres', $paging, 1));
-                               $html_content .= html_e('input', array('type' 
=> 'submit', 'name' => 'setpaging', 'value' => _('Change')));
+                               $html_content .= $this->html_input('setpaging', 
'', '', 'submit', _('Change'));
                                $html_content .= $this->closeForm();
                        }
                }

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

Summary of changes:
 src/common/include/SCMPlugin.class.php             | 134 ++++----
 .../mediawiki/common/mediawikiPlugin.class.php     |   4 +-
 src/plugins/scmbzr/common/BzrPlugin.class.php      | 106 +++----
 src/plugins/scmcvs/common/CVSPlugin.class.php      |  10 +-
 src/plugins/scmdarcs/common/DarcsPlugin.class.php  |  55 ++--
 src/plugins/scmgit/common/GitPlugin.class.php      |  95 +++---
 src/plugins/scmhg/common/HgPlugin.class.php        | 336 +++++++++++----------
 src/plugins/scmsvn/common/SVNPlugin.class.php      |  55 ++--
 src/plugins/wiki/common/WikiPlugin.class.php       |   2 +-
 src/www/activity/index.php                         |   2 +-
 src/www/include/Layout.class.php                   |   4 +-
 11 files changed, 376 insertions(+), 427 deletions(-)


hooks/post-receive
-- 
FusionForge

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

Reply via email to