[Fusionforge-commits] FusionForge branch master updated. 406eb89612e591ae05f7d8c125806701e7e6a3a6

Sylvain Beucler beuc-inria at fusionforge.org
Tue May 6 15:27:24 CEST 2014


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

The branch, master has been updated
       via  406eb89612e591ae05f7d8c125806701e7e6a3a6 (commit)
      from  1b315813123376818c9a94b9c3aecb8ad1b392c4 (commit)

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

- Log -----------------------------------------------------------------
commit 406eb89612e591ae05f7d8c125806701e7e6a3a6
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Tue May 6 15:26:33 2014 +0200

    scmhook: properly filter parameters in admin webui (previously you could enable a 'commitEmail_dest' plugin)

diff --git a/src/plugins/scmhook/common/scmhookPlugin.class.php b/src/plugins/scmhook/common/scmhookPlugin.class.php
index 42e020f..aace100 100644
--- a/src/plugins/scmhook/common/scmhookPlugin.class.php
+++ b/src/plugins/scmhook/common/scmhookPlugin.class.php
@@ -107,20 +107,21 @@ class scmhookPlugin extends Plugin {
 		$group_id = $params['group_id'];
 		$hooksString = '';
 		$hooks = $this->getAvailableHooks($group_id);
+		$available_hooknames = array();
+		foreach ($hooks as $hook)
+			$available_hooknames[] = $hook->getClassname();
+
+		$enabled_hooknames = array();
 		foreach($params as $key => $value) {
-			if ($key == strstr($key, 'scm')) {
+			if ($value == 'on' && $key == strstr($key, 'scm')) {
 				$hookname = preg_replace('/scm[a-z][a-z]+_/','',$key);
-				if ($key != $hookname) {	//handle the case of scm_enable_anonymous
-					if (strlen($hooksString)) {
-						$hooksString .= '|'.$hookname;
-					} else {
-						$hooksString .= $hookname;
-					}
+				if (in_array($hookname, $available_hooknames) !== FALSE) {
+					$enabled_hooknames[] = $hookname;
 				}
 			}
 		}
 		$res = db_query_params('UPDATE plugin_scmhook set hooks = $1, need_update = 1 where id_group = $2',
-					array($hooksString, $group_id));
+				       array(implode('|', $enabled_hooknames), $group_id));
 
 		// Save parameters
 		foreach($hooks as $hook) {

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

Summary of changes:
 src/plugins/scmhook/common/scmhookPlugin.class.php |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list