[Fusionforge-commits] FusionForge branch master updated. v6.0.5-1937-g96efb0a

Franck Villaume nerville at libremir.placard.fr.eu.org
Tue Jun 13 20:38:53 CEST 2017


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  96efb0a7cf9578619685851b9e40fbb1e227aa08 (commit)
       via  a513a33646ffb57e649143339bc1ebe584b5eb04 (commit)
       via  6e1f05ca67a8531e44bc6904110e85a36e5fcafa (commit)
       via  8e0a35d1b5f1faf03250088a0b85034aba6cbe0c (commit)
      from  9926c2af41fcf11fb4f33eea0a8dd70483e1bbcd (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=96efb0a7cf9578619685851b9e40fbb1e227aa08

commit 96efb0a7cf9578619685851b9e40fbb1e227aa08
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 13 20:38:29 2017 +0200

    mediawiki activity support: start

diff --git a/src/plugins/mediawiki/common/mediawikiPlugin.class.php b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
index 4a429b3..7deaae9 100644
--- a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
+++ b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
@@ -94,12 +94,12 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			}
 			if ($project->usesPlugin($this->name)) {
 				$params['TITLES'][] = $this->text;
-				$params['DIRS'][] = util_make_uri('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php');
+				$params['DIRS'][] = util_make_uri('/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/index.php');
 				if (session_loggedin()) {
 					$user = session_get_user();
 					$userperm = $project->getPermission();
 					if ($userperm->isAdmin()) {
-						$params['ADMIN'][] = util_make_uri('/plugins/mediawiki/plugin_admin.php?group_id='.$project->getID());
+						$params['ADMIN'][] = util_make_uri('/plugins/'.$this->name.'/plugin_admin.php?group_id='.$project->getID());
 					}
 				}
 				$params['TOOLTIPS'][] = _('Mediawiki Space');
@@ -115,8 +115,8 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			}
 			if ( $project->usesPlugin($this->name)) {
 				$params['result'] .= '<div class="public-area-box">';
-				$params['result'] .= util_make_link('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php',
-							html_abs_image(util_make_url('/plugins/mediawiki/wiki/'.$project->getUnixName().'/skins/monobook/wiki.png'),'20','20',array('alt'=>'Mediawiki')).
+				$params['result'] .= util_make_link('/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/index.php',
+							html_abs_image(util_make_url('/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/skins/monobook/wiki.png'),'20','20',array('alt'=>'Mediawiki')).
 							' '.'Mediawiki');
 				$params['result'] .= '</div>';
 			}
@@ -373,6 +373,41 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 				return false;
 			}
 			if (in_array($this->name, $params['show']) || (count($params['show']) < 1)) {
+				$protocol = forge_get_config('use_ssl') ? 'https://' : 'http://';
+				$script_url = $protocol.forge_get_config('web_host').'/plugins/'.$this->name.'/wiki/'.$project->getUnixName().'/api.php'
+							.'?action=query'
+							.'&list=recentchanges'
+							.'&rcstart='.$params['begin']
+							.'&rcend='.$params['end'];
+				$filename = tempnam('/tmp', 'mediawikilog');
+				$f = fopen($filename, 'w');
+				$ch = curl_init();
+				curl_setopt($ch, CURLOPT_URL, $script_url);
+				curl_setopt($ch, CURLOPT_FILE, $f);
+				curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+				curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+				curl_setopt($ch, CURLOPT_COOKIE, @$_SERVER['HTTP_COOKIE']);  // for session validation
+				curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);  // for session validation
+				curl_setopt($ch, CURLOPT_HTTPHEADER,
+							array('X-Forwarded-For: '.$_SERVER['REMOTE_ADDR']));  // for session validation
+				$body = curl_exec($ch);
+				if ($body === false) {
+					$this->setError(curl_error($ch));
+				}
+				curl_close($ch);
+				fclose($f); // flush buffer
+				$f = fopen($filename, 'r');
+				unlink($filename);
+				while (!feof($f) && $data = fgets($f)) {
+					$result = array();
+					$result['section'] = 'mediawiki';
+					$result['group_id'] = $group_id;
+					$result['ref_id'] = 'something';
+					$result['description'] = 'yeah';
+					$result['activity_date'] = 0;
+					$result['subref_id'] = '';
+					$params['results'][] = $result;
+				}
 			}
 			if (!in_array($this->name, $params['ids'])) {
 				$params['ids'][] = $this->name;
@@ -380,7 +415,6 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			}
 			return true;
 		}
-		}
 	}
 
 	function groupisactivecheckboxpost(&$params) {

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

commit a513a33646ffb57e649143339bc1ebe584b5eb04
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 13 20:33:28 2017 +0200

    revert fix on received_begin and received_end

diff --git a/src/www/activity/index.php b/src/www/activity/index.php
index ea91019..05aed4a 100644
--- a/src/www/activity/index.php
+++ b/src/www/activity/index.php
@@ -33,17 +33,17 @@ require_once $gfcommon.'docman/DocumentGroup.class.php';
 
 global $HTML;
 
-$group_id = getIntFromRequest("group_id");
-$received_begin = getStringFromRequest("start_date");
-$received_end = getStringFromRequest("end_date");
-$show = getArrayFromRequest("show");
+$group_id = getIntFromRequest('group_id');
+$received_begin = getStringFromRequest('start_date');
+$received_end = getStringFromRequest('end_date');
+$show = getArrayFromRequest('show');
 
 session_require_perm('project_read', $group_id);
 
 $date_format = _('%Y-%m-%d');
 $date_format_js = _('yy-mm-dd');
 
-if (!$received_begin || $received_begin==0) {
+if (!$received_begin || $received_begin == 0) {
 	$begin = (time()-(30*86400));
 	$rendered_begin = strftime($date_format, $begin);
 } else {
@@ -53,7 +53,7 @@ if (!$received_begin || $received_begin==0) {
 		$rendered_begin = strftime($date_format, $begin);
 	} else {
 		$begin = mktime(0, 0, 0, $tmp['tm_mon']+1, $tmp['tm_mday'], $tmp['tm_year'] + 1900);
-		$rendered_begin = strftime($date_format, $received_begin);
+		$rendered_begin = $received_begin;
 	}
 }
 if ($begin < 0) {
@@ -71,7 +71,7 @@ if (!$received_end || $received_end == 0) {
 		$rendered_end = strftime($date_format, $end);
 	} else {
 		$end = mktime(23, 59, 59, $tmp['tm_mon']+1, $tmp['tm_mday'], $tmp['tm_year'] + 1900);
-		$rendered_end = strftime($date_format, $received_end);
+		$rendered_end = $received_end;
 	}
 }
 

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

commit 6e1f05ca67a8531e44bc6904110e85a36e5fcafa
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 13 19:48:52 2017 +0200

    more coding style

diff --git a/src/plugins/mediawiki/common/mediawikiPlugin.class.php b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
index 6239da8..4a429b3 100644
--- a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
+++ b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
@@ -92,9 +92,9 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			if ($project->isError()) {
 				return;
 			}
-			if ( $project->usesPlugin ( $this->name ) ) {
-				$params['TITLES'][]=$this->text;
-				$params['DIRS'][]=util_make_uri('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php');
+			if ($project->usesPlugin($this->name)) {
+				$params['TITLES'][] = $this->text;
+				$params['DIRS'][] = util_make_uri('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php');
 				if (session_loggedin()) {
 					$user = session_get_user();
 					$userperm = $project->getPermission();
@@ -104,7 +104,7 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 				}
 				$params['TOOLTIPS'][] = _('Mediawiki Space');
 			}
-			(($params['toptab'] == $this->name) ? $params['selected'] = count($params['TITLES'])-1) : '' );
+			(($params['toptab'] == $this->name) ? $params['selected'] = (count($params['TITLES'])-1) : '' );
 		} elseif ($hookname == 'project_public_area') {
 			$project = group_get_object($group_id);
 			if (!$project || !is_object($project)) {
@@ -113,7 +113,7 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			if ($project->isError()) {
 				return;
 			}
-			if ( $project->usesPlugin ( $this->name ) ) {
+			if ( $project->usesPlugin($this->name)) {
 				$params['result'] .= '<div class="public-area-box">';
 				$params['result'] .= util_make_link('/plugins/mediawiki/wiki/'.$project->getUnixName().'/index.php',
 							html_abs_image(util_make_url('/plugins/mediawiki/wiki/'.$project->getUnixName().'/skins/monobook/wiki.png'),'20','20',array('alt'=>'Mediawiki')).
@@ -214,9 +214,9 @@ _('This plugin allows each project to embed Mediawiki under a tab.');
 			$right->setValueDescriptions (array ('0' => _('No administrative access'),
 							     '1' => _('Edit interface, import XML dumps'))) ;
 		} elseif ($hookname == "role_get_setting") {
-			$role = $params['role'] ;
-			$reference = $params['reference'] ;
-			$value = $params['value'] ;
+			$role = $params['role'];
+			$reference = $params['reference'];
+			$value = $params['value'];
 
 			switch ($params['section']) {
 			case 'plugin_mediawiki_read':

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

commit 8e0a35d1b5f1faf03250088a0b85034aba6cbe0c
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Jun 13 19:44:02 2017 +0200

    mediawiki plugin: prepare activity & coding style

diff --git a/src/plugins/mediawiki/common/mediawikiPlugin.class.php b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
index 5432c55..6239da8 100644
--- a/src/plugins/mediawiki/common/mediawikiPlugin.class.php
+++ b/src/plugins/mediawiki/common/mediawikiPlugin.class.php
@@ -3,7 +3,7 @@
  * MediaWikiPlugin Class
  *
  * Copyright 2000-2011, Fusionforge Team
- * Copyright 2012,2014,2016, Franck Villaume - TrivialDev
+ * Copyright 2012,2014,2016-2017, Franck Villaume - TrivialDev
  * http://fusionforge.org
  *
  * This file is part of FusionForge.
@@ -42,28 +42,29 @@ class MediaWikiPlugin extends Plugin {
 
 	function __construct ($id=0) {
 		parent::__construct($id) ;
-		$this->name = "mediawiki" ;
-		$this->text = _("Mediawiki") ; // To show in the tabs, use...
+		$this->name = 'mediawiki' ;
+		$this->text = _('Mediawiki') ; // To show in the tabs, use...
 		$this->pkg_desc =
-_("This plugin allows each project to embed Mediawiki under a tab.");
-		$this->_addHook("groupmenu") ;	// To put into the project tabs
-		$this->_addHook("groupisactivecheckbox") ; // The "use ..." checkbox in editgroupinfo
-		$this->_addHook("groupisactivecheckboxpost") ; //
-		$this->_addHook("project_public_area");
-		$this->_addHook("role_get");
-		$this->_addHook("role_normalize");
-		$this->_addHook("role_unlink_project");
-		$this->_addHook("role_translate_strings");
-		$this->_addHook("role_has_permission");
-		$this->_addHook("role_get_setting");
-		$this->_addHook("list_roles_by_permission");
-		$this->_addHook("project_admin_plugins"); // to show up in the admin page for group
-		$this->_addHook("clone_project_from_template") ;
+_('This plugin allows each project to embed Mediawiki under a tab.');
+		$this->_addHook('groupmenu') ;	// To put into the project tabs
+		$this->_addHook('groupisactivecheckbox') ; // The "use ..." checkbox in editgroupinfo
+		$this->_addHook('groupisactivecheckboxpost'); //
+		$this->_addHook('project_public_area');
+		$this->_addHook('role_get');
+		$this->_addHook('role_normalize');
+		$this->_addHook('role_unlink_project');
+		$this->_addHook('role_translate_strings');
+		$this->_addHook('role_has_permission');
+		$this->_addHook('role_get_setting');
+		$this->_addHook('list_roles_by_permission');
+		$this->_addHook('project_admin_plugins'); // to show up in the admin page for group
+		$this->_addHook('clone_project_from_template');
 		$this->_addHook('group_delete');
+		$this->_addHook('activity');
 	}
 
 	function process() {
-		echo '<h1>Mediawiki</h1>';
+		echo html_e('h1', array(), 'Mediawiki');
 		echo $this->getPluginInfo()->getpropVal('answer');
 	}
 
@@ -83,7 +84,7 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 		} else {
 			$group_id=null;
 		}
-		if ($hookname == "groupmenu") {
+		if ($hookname == 'groupmenu') {
 			$project = group_get_object($group_id);
 			if (!$project || !is_object($project)) {
 				return;
@@ -103,8 +104,8 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 				}
 				$params['TOOLTIPS'][] = _('Mediawiki Space');
 			}
-			(($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' );
-		} elseif ($hookname == "project_public_area") {
+			(($params['toptab'] == $this->name) ? $params['selected'] = count($params['TITLES'])-1) : '' );
+		} elseif ($hookname == 'project_public_area') {
 			$project = group_get_object($group_id);
 			if (!$project || !is_object($project)) {
 				return;
@@ -119,63 +120,63 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 							' '.'Mediawiki');
 				$params['result'] .= '</div>';
 			}
-		} elseif ($hookname == "role_get") {
-			$role =& $params['role'] ;
+		} elseif ($hookname == 'role_get') {
+			$role =& $params['role'];
 
 			// Read access
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_read') ;
-			$right->SetAllowedValues (array ('0', '1')) ;
-			$right->SetDefaultValues (array ('Admin' => '1',
-							 'Senior Developer' => '1',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '1',
-							 'Support Tech' => '1')) ;
+			$right = new PluginSpecificRoleSetting($role,
+								'plugin_mediawiki_read');
+			$right->SetAllowedValues(array('0', '1'));
+			$right->SetDefaultValues(array('Admin' => '1',
+							'Senior Developer' => '1',
+							'Junior Developer' => '1',
+							'Doc Writer' => '1',
+							'Support Tech' => '1'));
 
 			// Edit privileges
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_edit') ;
-			$right->SetAllowedValues (array ('0', '1', '2', '3')) ;
-			$right->SetDefaultValues (array ('Admin' => '3',
-							 'Senior Developer' => '2',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '3',
-							 'Support Tech' => '0')) ;
+			$right = new PluginSpecificRoleSetting($role,
+								'plugin_mediawiki_edit');
+			$right->SetAllowedValues(array('0', '1', '2', '3'));
+			$right->SetDefaultValues(array('Admin' => '3',
+							'Senior Developer' => '2',
+							'Junior Developer' => '1',
+							'Doc Writer' => '3',
+							'Support Tech' => '0'));
 
 			// File upload privileges
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_upload') ;
-			$right->SetAllowedValues (array ('0', '1', '2')) ;
-			$right->SetDefaultValues (array ('Admin' => '2',
-							 'Senior Developer' => '2',
-							 'Junior Developer' => '1',
-							 'Doc Writer' => '2',
-							 'Support Tech' => '0')) ;
+			$right = new PluginSpecificRoleSetting($role,
+								'plugin_mediawiki_upload');
+			$right->SetAllowedValues(array('0', '1', '2')) ;
+			$right->SetDefaultValues(array('Admin' => '2',
+							'Senior Developer' => '2',
+							'Junior Developer' => '1',
+							'Doc Writer' => '2',
+							'Support Tech' => '0'));
 
 			// Administrative tasks
-			$right = new PluginSpecificRoleSetting ($role,
-								'plugin_mediawiki_admin') ;
-			$right->SetAllowedValues (array ('0', '1')) ;
-			$right->SetDefaultValues (array ('Admin' => '1',
-							 'Senior Developer' => '0',
-							 'Junior Developer' => '0',
-							 'Doc Writer' => '0',
-							 'Support Tech' => '0')) ;
+			$right = new PluginSpecificRoleSetting($role,
+								'plugin_mediawiki_admin');
+			$right->SetAllowedValues(array('0', '1'));
+			$right->SetDefaultValues(array('Admin' => '1',
+							'Senior Developer' => '0',
+							'Junior Developer' => '0',
+							'Doc Writer' => '0',
+							'Support Tech' => '0'));
 
-		} elseif ($hookname == "role_normalize") {
-			$role =& $params['role'] ;
-			$new_pa =& $params['new_pa'] ;
+		} elseif ($hookname == 'role_normalize') {
+			$role =& $params['role'];
+			$new_pa =& $params['new_pa'];
 
-			$projects = $role->getLinkedProjects() ;
+			$projects = $role->getLinkedProjects();
 			foreach ($projects as $p) {
-				$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_read', $p->getID()) ;
-				$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_edit', $p->getID()) ;
-				$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_upload', $p->getID()) ;
-				$role->normalizePermsForSection ($new_pa, 'plugin_mediawiki_admin', $p->getID()) ;
+				$role->normalizePermsForSection($new_pa, 'plugin_mediawiki_read', $p->getID());
+				$role->normalizePermsForSection($new_pa, 'plugin_mediawiki_edit', $p->getID());
+				$role->normalizePermsForSection($new_pa, 'plugin_mediawiki_upload', $p->getID());
+				$role->normalizePermsForSection($new_pa, 'plugin_mediawiki_admin', $p->getID());
 			}
-		} elseif ($hookname == "role_unlink_project") {
-			$role =& $params['role'] ;
-			$project =& $params['project'] ;
+		} elseif ($hookname == 'role_unlink_project') {
+			$role =& $params['role'];
+			$project =& $params['project'];
 
 			$settings = array('plugin_mediawiki_read', 'plugin_mediawiki_edit', 'plugin_mediawiki_upload', 'plugin_mediawiki_admin');
 
@@ -185,27 +186,27 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 						      $s,
 						      $project->getID()));
 			}
-		} elseif ($hookname == "role_translate_strings") {
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_read') ;
-			$right->setDescription (_('Mediawiki read access')) ;
-			$right->setValueDescriptions (array ('0' => _('No reading'),
-							     '1' => _('Read access'))) ;
+		} elseif ($hookname == 'role_translate_strings') {
+			$right = new PluginSpecificRoleSetting($role,
+							       'plugin_mediawiki_read');
+			$right->setDescription(_('Mediawiki read access'));
+			$right->setValueDescriptions(array('0' => _('No reading'),
+							   '1' => _('Read access')));
 
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_edit') ;
+			$right = new PluginSpecificRoleSetting($role,
+							       'plugin_mediawiki_edit');
 			$right->setDescription (_('Mediawiki write access')) ;
-			$right->setValueDescriptions (array ('0' => _('No editing'),
-							     '1' => _('Edit existing pages only'),
-							     '2' => _('Edit and create pages'),
-							     '3' => _('Edit, create, move, delete pages'))) ;
+			$right->setValueDescriptions(array('0' => _('No editing'),
+							   '1' => _('Edit existing pages only'),
+							   '2' => _('Edit and create pages'),
+							   '3' => _('Edit, create, move, delete pages')));
 
-			$right = new PluginSpecificRoleSetting ($role,
-							       'plugin_mediawiki_upload') ;
-			$right->setDescription (_('Mediawiki file upload')) ;
-			$right->setValueDescriptions (array ('0' => _('No uploading'),
-							     '1' => _('Upload permitted'),
-							     '2' => _('Upload and re-upload'))) ;
+			$right = new PluginSpecificRoleSetting($role,
+							       'plugin_mediawiki_upload');
+			$right->setDescription(_('Mediawiki file upload')) ;
+			$right->setValueDescriptions(array('0' => _('No uploading'),
+							   '1' => _('Upload permitted'),
+							   '2' => _('Upload and re-upload')));
 
 			$right = new PluginSpecificRoleSetting ($role,
 							       'plugin_mediawiki_admin') ;
@@ -220,30 +221,30 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 			switch ($params['section']) {
 			case 'plugin_mediawiki_read':
 				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 1 ;
+					$params['result'] = 1;
 				} else {
-					$params['result'] =  $value ;
+					$params['result'] =  $value;
 				}
 				break ;
 			case 'plugin_mediawiki_edit':
 				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 3 ;
+					$params['result'] = 3;
 				} else {
-					$params['result'] =  $value ;
+					$params['result'] =  $value;
 				}
 				break ;
 			case 'plugin_mediawiki_upload':
 				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 2 ;
+					$params['result'] = 2;
 				} else {
-					$params['result'] =  $value ;
+					$params['result'] =  $value;
 				}
 				break ;
 			case 'plugin_mediawiki_admin':
 				if ($role->hasPermission('project_admin', $reference)) {
-					$params['result'] = 1 ;
+					$params['result'] = 1;
 				} else {
-					$params['result'] =  $value ;
+					$params['result'] =  $value;
 				}
 				break ;
 			}
@@ -254,106 +255,103 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 				switch ($params['action']) {
 				case 'read':
 				default:
-					$params['result'] |= ($value >= 1) ;
-					break ;
+					$params['result'] |= ($value >= 1);
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_edit':
 				switch ($params['action']) {
 				case 'editexisting':
-					$params['result'] |= ($value >= 1) ;
-					break ;
+					$params['result'] |= ($value >= 1);
+					break;
 				case 'editnew':
-					$params['result'] |= ($value >= 2) ;
-					break ;
+					$params['result'] |= ($value >= 2);
+					break;
 				case 'editmove':
-					$params['result'] |= ($value >= 3) ;
-					break ;
+					$params['result'] |= ($value >= 3);
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_upload':
 				switch ($params['action']) {
 				case 'upload':
-					$params['result'] |= ($value >= 1) ;
-					break ;
+					$params['result'] |= ($value >= 1);
+					break;
 				case 'reupload':
-					$params['result'] |= ($value >= 2) ;
-					break ;
+					$params['result'] |= ($value >= 2);
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_admin':
 				switch ($params['action']) {
 				case 'admin':
 				default:
-					$params['result'] |= ($value >= 1) ;
-					break ;
+					$params['result'] |= ($value >= 1);
+					break;
 				}
 				break ;
 			}
-		} elseif ($hookname == "list_roles_by_permission") {
+		} elseif ($hookname == 'list_roles_by_permission') {
 			switch ($params['section']) {
 			case 'plugin_mediawiki_read':
 				switch ($params['action']) {
 				case 'read':
 				default:
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1');
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_edit':
 				switch ($params['action']) {
 				case 'editexisting':
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1');
+					break;
 				case 'editnew':
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 2') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 2');
+					break;
 				case 'editmove':
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 3') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 3');
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_upload':
 				switch ($params['action']) {
 				case 'upload':
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1');
+					break;
 				case 'reupload':
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 2') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 2');
+					break;
 				}
 				break ;
 			case 'plugin_mediawiki_admin':
 				switch ($params['action']) {
 				case 'admin':
 				default:
-					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1') ;
-					break ;
+					$params['qpa'] = db_construct_qpa($params['qpa'], ' AND perm_val >= 1');
+					break;
 				}
 				break ;
 			}
-		} elseif ($hookname == "project_admin_plugins") {
+		} elseif ($hookname == 'project_admin_plugins') {
 			$group_id = $params['group_id'];
 			$group = group_get_object($group_id);
 			if ($group->usesPlugin($this->name))
-				echo util_make_link(
-				    "/plugins/mediawiki/plugin_admin.php?group_id=" .
-				    $group->getID(), _("MediaWiki Plugin admin")) .
-				    "<br />";
-		} elseif ($hookname == "clone_project_from_template") {
-			$template = $params['template'] ;
-			$project = $params['project'] ;
-			$id_mappings = $params['id_mappings'] ;
+				echo util_make_link('/plugins/mediawiki/plugin_admin.php?group_id='. $group->getID(), _('MediaWiki Plugin admin')).'<br />';
+		} elseif ($hookname == 'clone_project_from_template') {
+			$template = $params['template'];
+			$project = $params['project'];
+			$id_mappings = $params['id_mappings'];
 
-			$sections = array ('plugin_mediawiki_read', 'plugin_mediawiki_edit', 'plugin_mediawiki_upload', 'plugin_mediawiki_admin') ;
+			$sections = array('plugin_mediawiki_read', 'plugin_mediawiki_edit', 'plugin_mediawiki_upload', 'plugin_mediawiki_admin');
 
 			foreach ($template->getRoles() as $oldrole) {
-				$newrole = RBACEngine::getInstance()->getRoleById ($id_mappings['role'][$oldrole->getID()]) ;
-				$oldsettings = $oldrole->getSettingsForProject ($template) ;
+				$newrole = RBACEngine::getInstance()->getRoleById ($id_mappings['role'][$oldrole->getID()]);
+				$oldsettings = $oldrole->getSettingsForProject ($template);
 
 				foreach ($sections as $section) {
 					if (isset ($oldsettings[$section][$template->getID()])) {
-						$newrole->setSetting ($section, $project->getID(), $oldsettings[$section][$template->getID()]) ;
+						$newrole->setSetting ($section, $project->getID(), $oldsettings[$section][$template->getID()]);
 					}
 				}
 			}
@@ -364,10 +362,24 @@ _("This plugin allows each project to embed Mediawiki under a tab.");
 				//delete the files and db schema
 				$schema = 'plugin_mediawiki_'.$projectObject->getUnixName();
 				// Sanitize schema name
-				$schema = strtr($schema, "-", "_");
+				$schema = strtr($schema, '-', '_');
 				db_query_params('drop schema $1 cascade', array($schema));
 				exec('/bin/rm -rf '.forge_get_config('projects_path', 'mediawiki').'/'.$projectObject->getUnixName());
 			}
+		} elseif ($hookname == 'activity') {
+			$group_id = $params['group'];
+			$project = group_get_object($group_id);
+			if (!$project->usesPlugin($this->name)) {
+				return false;
+			}
+			if (in_array($this->name, $params['show']) || (count($params['show']) < 1)) {
+			}
+			if (!in_array($this->name, $params['ids'])) {
+				$params['ids'][] = $this->name;
+				$params['texts'][] = _('Mediawiki Changes');
+			}
+			return true;
+		}
 		}
 	}
 

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

Summary of changes:
 .../mediawiki/common/mediawikiPlugin.class.php     | 336 ++++++++++++---------
 src/www/activity/index.php                         |  14 +-
 2 files changed, 198 insertions(+), 152 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list