[Fusionforge-commits] r9612 - in trunk: gforge/common/include gforge/plugins/mantis/include gforge/plugins/mediawiki/www gforge/plugins/projects_hierarchy/common gforge/www/account gforge/www/include gforge/www/scm/include tests/code/deprecations

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Apr 27 21:32:48 CEST 2010


Author: lolando
Date: 2010-04-27 21:32:48 +0200 (Tue, 27 Apr 2010)
New Revision: 9612

Modified:
   trunk/gforge/common/include/config-vars.php
   trunk/gforge/common/include/utils.php
   trunk/gforge/plugins/mantis/include/MantisPlugin.class.php
   trunk/gforge/plugins/mediawiki/www/LocalSettings.php
   trunk/gforge/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
   trunk/gforge/www/account/login.php
   trunk/gforge/www/account/logout.php
   trunk/gforge/www/include/html.php
   trunk/gforge/www/scm/include/viewvc_utils.php
   trunk/tests/code/deprecations/DeprecationsTest.php
Log:
Config API: URL-related variables

Modified: trunk/gforge/common/include/config-vars.php
===================================================================
--- trunk/gforge/common/include/config-vars.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/common/include/config-vars.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -86,6 +86,10 @@
 forge_define_config_item ('unix_cipher', 'core', $GLOBALS['unix_cipher']) ;
 forge_define_config_item ('homedir_prefix', 'core', $GLOBALS['homedir_prefix']) ;
 forge_define_config_item ('groupdir_prefix', 'core', $GLOBALS['groupdir_prefix']) ;
+forge_define_config_item ('url_root', 'core', $GLOBALS['sys_urlroot']) ;
+forge_define_config_item ('url_prefix', 'core', $GLOBALS['sys_urlprefix']) ;
+forge_define_config_item ('images_url', 'core', $GLOBALS['sys_images_url']) ;
+forge_define_config_item ('images_secure_url', 'core', $GLOBALS['sys_images_secure_url']) ;
 // forge_define_config_item ('', 'core', $GLOBALS['sys_']) ;
 
 /* Long-term:

Modified: trunk/gforge/common/include/utils.php
===================================================================
--- trunk/gforge/common/include/utils.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/common/include/utils.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -993,12 +993,12 @@
 }
 
 /**
- * Constructs the forge's URL prefix out of $GLOBALS['sys_urlprefix']
+ * Constructs the forge's URL prefix out of forge_get_config('url_prefix')
  * 
  * @return string
  */
 function normalized_urlprefix () {
-	$prefix = $GLOBALS['sys_urlprefix'] ;
+	$prefix = forge_get_config('url_prefix') ;
 	$prefix = ereg_replace ("^/", "", $prefix) ;
 	$prefix = ereg_replace ("/$", "", $prefix) ;
 	$prefix = "/$prefix/" ;

Modified: trunk/gforge/plugins/mantis/include/MantisPlugin.class.php
===================================================================
--- trunk/gforge/plugins/mantis/include/MantisPlugin.class.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/plugins/mantis/include/MantisPlugin.class.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -134,14 +134,14 @@
 			//check if the user has the plugin activated
 			if ($user->usesPlugin($this->name)) {
 				echo '	<p>
-					<a href="'.$GLOBALS['sys_urlprefix'].'/plugins/mantis/index.php?id=' . $userid . '&type=user&pluginname=' . $this->name . '">' . _('View Mantis') .'</a></p>';
+					<a href="'.forge_get_config('url_prefix').'/plugins/mantis/index.php?id=' . $userid . '&type=user&pluginname=' . $this->name . '">' . _('View Mantis') .'</a></p>';
 			}
 		} elseif ($hookname == "project_admin_plugins") {
 			// this displays the link in the project admin options page to it's  Mantis administration
 			$group_id = $params['group_id'];
 			$group = &group_get_object($group_id);
 			if ( $group->usesPlugin ( $this->name ) ) {
-				echo '<a href="'.$GLOBALS['sys_urlprefix'].'/plugins/mantis/index.php?id=' . $group->getID() . '&type=admin&pluginname=' . $this->name . '">' . _('Mantis admin') . '</a><br />';
+				echo '<a href="'.forge_get_config('url_prefix').'/plugins/mantis/index.php?id=' . $group->getID() . '&type=admin&pluginname=' . $this->name . '">' . _('Mantis admin') . '</a><br />';
 			}
 		}												    
 		elseif ($hookname == "blahblahblah") {

Modified: trunk/gforge/plugins/mediawiki/www/LocalSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/www/LocalSettings.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/plugins/mediawiki/www/LocalSettings.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -109,14 +109,14 @@
 $GLOBALS['sys_dbuser'] = $sys_dbuser ;
 $GLOBALS['sys_dbpasswd'] = $sys_dbpasswd ;
 $GLOBALS['sys_plugins_path'] = forge_get_config('plugins_path') ;
-$GLOBALS['sys_urlprefix'] = $sys_urlprefix ;
+$GLOBALS['sys_urlprefix'] = forge_get_config('url_prefix') ;
 $GLOBALS['sys_use_ssl'] = forge_get_config('use_ssl') ;
 $GLOBALS['sys_default_domain'] = forge_get_config('web_host') ;
 $GLOBALS['sys_custom_path'] = forge_get_config('custom_path') ;
 $GLOBALS['gfwww'] = $gfwww ;
 $GLOBALS['gfplugins'] = $gfplugins ;
 $GLOBALS['sys_lang'] = forge_get_config('default_language') ;
-$GLOBALS['sys_urlroot'] = $sys_urlroot;
+$GLOBALS['sys_urlroot'] = forge_get_config('url_root');
 $GLOBALS['sys_session_key'] = $sys_session_key;
 $GLOBALS['sys_session_expire'] = $sys_session_expire;
 $GLOBALS['REMOTE_ADDR'] = getStringFromServer('REMOTE_ADDR') ;

Modified: trunk/gforge/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php
===================================================================
--- trunk/gforge/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/plugins/projects_hierarchy/common/projects_hierarchyPlugin.class.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -143,7 +143,7 @@
 						       $group_id));
 			echo db_error();
 			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Parent project').': <a href="'.$GLOBALS['sys_urlprefix'].'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a><br/>';
+				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Parent project').': <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a><br/>';
 				$cpt_project ++;
 			}
 			
@@ -158,7 +158,7 @@
 						       $group_id));
 			echo db_error();
 			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Child project').' : <a href="'.$GLOBALS['sys_urlprefix'].'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a> : '.$row['com'].'<br/>';
+				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Child project').' : <a href="'.forge_get_config('url_prefix').'/projects/'.$row['unix_group_name'].'/">' . $row['group_name'] . '</a> : '.$row['com'].'<br/>';
 				$cpt_project ++;
 			}
 			
@@ -175,7 +175,7 @@
 						       $group_id));
 			echo db_error();
 			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".$GLOBALS['sys_urlprefix']."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a> :  ".$row['com']."<br/>";
+				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a> :  ".$row['com']."<br/>";
 				$cpt_project ++;
 			}
 			// links if project is son
@@ -185,7 +185,7 @@
 						       $group_id));
 			echo db_error();
 			while ($row = db_fetch_array($res)) {
-				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".$GLOBALS['sys_urlprefix']."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a><br/>";
+				echo html_image('ic/forum20g.png','20','20',array('alt'=>_('Link'))).'&nbsp;'._('Links')." : <a href=\"".forge_get_config('url_prefix')."/projects/".$row['unix_group_name']."/\">" . $row['group_name'] . "</a><br/>";
 				$cpt_project ++;
 			}
 			

Modified: trunk/gforge/www/account/login.php
===================================================================
--- trunk/gforge/www/account/login.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/www/account/login.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -43,7 +43,7 @@
 //
 if ($return_to) {
 	$tmpreturn=explode('?',$return_to);
-	if (!@is_file($sys_urlroot.$tmpreturn[0]) && !@is_dir($sys_urlroot.$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'mediawiki') == 1)) {
+	if (!@is_file(forge_get_config('url_root').$tmpreturn[0]) && !@is_dir(forge_get_config('url_root').$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'mediawiki') == 1)) {
 		$return_to='';
 	}
 }

Modified: trunk/gforge/www/account/logout.php
===================================================================
--- trunk/gforge/www/account/logout.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/www/account/logout.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -35,7 +35,7 @@
 //
 if ($return_to) {
         $tmpreturn=explode('?',$return_to);
-        if (!@is_file($sys_urlroot.$tmpreturn[0]) && !@is_dir($sys_urlroot.$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'mediawiki') == 1)) {
+        if (!@is_file(forge_get_config('url_root').$tmpreturn[0]) && !@is_dir(forge_get_config('url_root').$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'mediawiki') == 1)) {
 	$return_to='';
 }				        }
 

Modified: trunk/gforge/www/include/html.php
===================================================================
--- trunk/gforge/www/include/html.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/www/include/html.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -132,8 +132,8 @@
  * @param		bool	DEPRECATED
  */
 function html_image($src,$width,$height,$args,$display=1) {
-	global $sys_images_url,$sys_images_secure_url,$HTML;
-	$s = ((session_issecure()) ? $sys_images_secure_url : $sys_images_url );
+	global $HTML;
+	$s = ((session_issecure()) ? forge_get_config('images_secure_url') : forge_get_config('images_url') );
 	return html_abs_image($s.$HTML->imgroot.$src, $width, $height, $args);
 }
 

Modified: trunk/gforge/www/scm/include/viewvc_utils.php
===================================================================
--- trunk/gforge/www/scm/include/viewvc_utils.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/gforge/www/scm/include/viewvc_utils.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -52,7 +52,7 @@
 	$request_uri = getStringFromServer('REQUEST_URI');
 	$query_string = getStringFromServer('QUERY_STRING');
 	
-	$viewcvs_path = $GLOBALS['sys_urlroot'].'/scm/viewvc';
+	$viewcvs_path = forge_get_config('url_root').'/scm/viewvc';
 	
 	// this is very important ...
 	$path = getStringFromServer('PATH_INFO');

Modified: trunk/tests/code/deprecations/DeprecationsTest.php
===================================================================
--- trunk/tests/code/deprecations/DeprecationsTest.php	2010-04-27 19:27:56 UTC (rev 9611)
+++ trunk/tests/code/deprecations/DeprecationsTest.php	2010-04-27 19:32:48 UTC (rev 9612)
@@ -103,6 +103,10 @@
 			       'unix_cipher',
 			       'homedir_prefix',
 			       'groupdir_prefix',
+			       'sys_urlroot',
+			       'sys_urlprefix',
+			       'sys_images_url',
+			       'sys_images_secure_url',
 			) ;
 
 		$pattern = implode ('|', $vars) ;




More information about the Fusionforge-commits mailing list