[Fusionforge-commits] r11573 - trunk/src/plugins/oslc/www

Sabri LABBENE labbenes at libremir.placard.fr.eu.org
Fri Nov 19 01:01:39 CET 2010


Author: labbenes
Date: 2010-11-19 01:01:39 +0100 (Fri, 19 Nov 2010)
New Revision: 11573

Modified:
   trunk/src/plugins/oslc/www/index.php
Log:
remove User Interface of fusionforge from oslc plugin output.

Modified: trunk/src/plugins/oslc/www/index.php
===================================================================
--- trunk/src/plugins/oslc/www/index.php	2010-11-18 20:46:29 UTC (rev 11572)
+++ trunk/src/plugins/oslc/www/index.php	2010-11-19 00:01:39 UTC (rev 11573)
@@ -5,117 +5,23 @@
  *
  * Sabri LABBENE <sabri.labbene at gmail.com>
  *
- * This is an example to watch things in action. You can obviously modify things and logic as you see fit
  */
 
 require_once '../../../www/env.inc.php';
 require_once $gfwww.'include/pre.php';
 require_once $gfconfig.'plugins/oslc/config.php';
 
-// the header that displays for the user portion of the plugin
-function oslc_Project_Header($params) {                                                                                                                                         
-	global $DOCUMENT_ROOT,$HTML,$id;
-	$params['toptab']='oslc'; 
-	$params['group']=$id;
-	/*                                                                                                                                                              
-		Show horizontal links                                                                                                                                   
-	*/                                                                                                                                                              
-	site_project_header($params);														
-}
+// Run OSLC Zend application
+/** Zend_Application */
+require_once 'Zend/Application.php';  
 
-// the header that displays for the project portion of the plugin
-function oslc_User_Header($params) {
-	global $DOCUMENT_ROOT,$HTML,$user_id;
-	$params['toptab']='oslc'; 
-	$params['user']=$user_id;
-	/*                                                                                                                                                              
-	 Show horizontal links                                                                                                                                   
-	 */                                                                                                                                                              
-	site_user_header($params);    
-}
+// Create application, bootstrap, and run
+$application = new Zend_Application(APPLICATION_ENV,APPLICATION_PATH . '/configs/application.ini');
 
+// The next stop is in application/Bootstrap.php
+$application->bootstrap()->run();
 
-	$user = session_get_user(); // get the session user
 
-	if (!$user || !is_object($user) || $user->isError() || !$user->isActive()) {
-		exit_error("Invalid User", "Cannot Process your request for this user.");
-	}
-
-	$type = getStringFromRequest('type');
-	$id = getStringFromRequest('id');
-	$pluginname = getStringFromRequest('pluginname');
-	
-	if (!$type) {
-		exit_error("Cannot Process your request","No TYPE specified"); // you can create items in Base.tab and customize this messages
-	} elseif (!$id) {
-		exit_error("Cannot Process your request","No ID specified");
-	} else {
-		if ($type == 'group') {
-			$group = group_get_object($id);
-			if ( !$group) {
-				exit_error("Invalid Project", "Inexistent Project");
-			}
-			if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the oslc plugin active
-				exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");			
-			}
-			$userperm = $group->getPermission($user);//we'll check if the user belongs to the group (optional)
-			if ( !$userperm->IsMember()) {
-				exit_error("Access Denied", "You are not a member of this project");
-			}
-			// other perms checks here...
-			oslc_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));    
-			// DO THE STUFF FOR THE PROJECT PART HERE
-			//echo "We are in the Project oslc plugin <br>";
-			//echo "Greetings from planet " . $world . "<br>"; // $world comes from the config file in /etc
-						
-			// Run OSLC Zend application
-			/** Zend_Application */
-			require_once 'Zend/Application.php';  
-
-			// Create application, bootstrap, and run
-			$application = new Zend_Application(APPLICATION_ENV,APPLICATION_PATH . '/configs/application.ini');
-
-			// The next stop is in application/Bootstrap.php
-			$application->bootstrap()->run();
-			
-		} elseif ($type == 'user') {
-			$realuser = user_get_object($id);// 
-			if (!($realuser) || !($realuser->usesPlugin($pluginname))) {
-				exit_error("Error", "First activate the User's $pluginname plugin through Account Manteinance Page");
-			}
-			if ( (!$user) || ($user->getID() != $id)) { // if someone else tried to access the private oslc part of this user
-				exit_error("Access Denied", "You cannot access other user's personal $pluginname");
-			}
-			oslc_User_Header(array('title'=>'My '.$pluginname,'pagename'=>"$pluginname",'sectionvals'=>array($realuser->getUnixName())));    
-			// DO THE STUFF FOR THE USER PART HERE
-			echo "We are in the User oslc plugin <br>";
-			echo "Greetings from planet " . $world; // $world comes from the config file in /etc
-		} elseif ($type == 'admin') {
-			$group = group_get_object($id);
-			if ( !$group) {
-				exit_error("Invalid Project", "Inexistent Project");
-			}
-			if ( ! ($group->usesPlugin ( $pluginname )) ) {//check if the group has the oslc plugin active
-				exit_error("Error", "First activate the $pluginname plugin through the Project's Admin Interface");			
-			}
-			$userperm = $group->getPermission($user);//we'll check if the user belongs to the group
-			if ( !$userperm->IsMember()) {
-				exit_error("Access Denied", "You are not a member of this project");
-			}
-			//only project admin can access here
-			if ( $userperm->isAdmin() ) {
-				oslc_Project_Header(array('title'=>$pluginname . ' Project Plugin!','pagename'=>"$pluginname",'sectionvals'=>array(group_getname($id))));    
-				// DO THE STUFF FOR THE PROJECT ADMINISTRATION PART HERE
-				echo "We are in the Project oslc plugin <font color=\"#ff0000\">ADMINISTRATION</font> <br>";
-				echo "Greetings from planet " . $world; // $world comes from the config file in /etc
-			} else {
-				exit_error("Access Denied", "You are not a project Admin");
-			}
-		}
-	}	 
-	
-	site_project_footer(array());
-
 // Local Variables:
 // mode: php
 // c-file-style: "bsd"




More information about the Fusionforge-commits mailing list