[Fusionforge-commits] r9545 - in trunk: gforge/common/include gforge/plugins/ldapextauth/etc/plugins/ldapextauth gforge/plugins/mediawiki/etc/plugins/mediawiki gforge/www/account gforge/www/include gforge/www/scm/include gforge/www/themes/gforge-simple-theme tests/code/deprecations

Roland Mas lolando at libremir.placard.fr.eu.org
Tue Apr 20 18:35:58 CEST 2010


Author: lolando
Date: 2010-04-20 18:35:58 +0200 (Tue, 20 Apr 2010)
New Revision: 9545

Modified:
   trunk/gforge/common/include/User.class.php
   trunk/gforge/common/include/config-vars.php
   trunk/gforge/common/include/gettext.php
   trunk/gforge/plugins/ldapextauth/etc/plugins/ldapextauth/mapping.php
   trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
   trunk/gforge/www/account/register.php
   trunk/gforge/www/include/Layout.class.php
   trunk/gforge/www/include/pre.php
   trunk/gforge/www/scm/include/viewvc_utils.php
   trunk/gforge/www/themes/gforge-simple-theme/Theme.class.php
   trunk/tests/code/deprecations/DeprecationsTest.php
Log:
Config API: migrated sys_theme, sys_lang, sys_default_timezone and sys_default_country_code

Modified: trunk/gforge/common/include/User.class.php
===================================================================
--- trunk/gforge/common/include/User.class.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/common/include/User.class.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -1496,7 +1496,7 @@
 		if (is_file($GLOBALS['sys_themeroot'].$this->theme.'/Theme.class.php')) {
 			$GLOBALS['sys_theme']=$this->theme;
 		} else {
-			$this->theme=$GLOBALS['sys_theme'];
+			$this->theme=forge_get_config('default_theme');
 		}
 		return $this->theme;
 	}

Modified: trunk/gforge/common/include/config-vars.php
===================================================================
--- trunk/gforge/common/include/config-vars.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/common/include/config-vars.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -27,6 +27,10 @@
 forge_define_config_item ('web_host', 'core', $GLOBALS['sys_default_domain']) ;
 forge_define_config_item ('scm_tarballs_path', 'core', $GLOBALS['sys_scm_tarballs_path']) ;
 forge_define_config_item ('scm_snapshots_path', 'core', $GLOBALS['sys_scm_snapshots_path']) ;
+forge_define_config_item ('default_theme', 'core', $GLOBALS['sys_theme']) ;
+forge_define_config_item ('default_language', 'core', $GLOBALS['sys_lang']) ;
+forge_define_config_item ('default_timezone', 'core', $GLOBALS['sys_default_timezone']) ;
+forge_define_config_item ('default_country_code', 'core', $GLOBALS['sys_default_country_code']) ;
 // forge_define_config_item ('', 'core', $GLOBALS['sys_']) ;
 
 /* Long-term:

Modified: trunk/gforge/common/include/gettext.php
===================================================================
--- trunk/gforge/common/include/gettext.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/common/include/gettext.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -94,8 +94,8 @@
 	}
 
 	// Okay, let's use the site-wide default language
-	if ($GLOBALS['sys_lang']) {
-		return $GLOBALS['sys_lang'] ;
+	if (forge_get_config('default_language')) {
+		return forge_get_config('default_language') ;
 	}
 	
 	// Still no match?  Really?
@@ -193,8 +193,8 @@
 function setup_gettext_from_sys_lang () {
 
 	$lang = "English";
-	if ($GLOBALS['sys_lang']) {
-		$lang = $GLOBALS['sys_lang'] ;
+	if (forge_get_config('default_language')) {
+		$lang = forge_get_config('default_language') ;
 	}
 
 	$locale = language_name_to_locale_code($lang).'.utf8';

Modified: trunk/gforge/plugins/ldapextauth/etc/plugins/ldapextauth/mapping.php
===================================================================
--- trunk/gforge/plugins/ldapextauth/etc/plugins/ldapextauth/mapping.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/plugins/ldapextauth/etc/plugins/ldapextauth/mapping.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -26,9 +26,9 @@
 	//$result['phone'] = $entry['telephonenumber'][0]; //AD
 	//$result['fax'] = '' ;
 	//$result['title'] = '' ;
-	//$result['ccode']=$GLOBALS['sys_default_country_code'];
+	//$result['ccode']=forge_get_config('default_country_code');
 	//$result['language_id'] = '' ;
-	//$result['timezone']=$GLOBALS['sys_default_timezone'];
+	//$result['timezone']=forge_get_config('default_timezone');
 	
 	return $result ;
 }

Modified: trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php
===================================================================
--- trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/plugins/mediawiki/etc/plugins/mediawiki/LocalSettings.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -92,7 +92,7 @@
 $GLOBALS['sys_custom_path'] = $sys_custom_path ;
 $GLOBALS['gfwww'] = $gfwww ;
 $GLOBALS['gfplugins'] = $gfplugins ;
-$GLOBALS['sys_lang'] = $sys_lang ;
+$GLOBALS['sys_lang'] = forge_get_config('default_language') ;
 $GLOBALS['sys_urlroot'] = $sys_urlroot;
 $GLOBALS['sys_session_key'] = $sys_session_key;
 $GLOBALS['sys_session_expire'] = $sys_session_expire;
@@ -270,7 +270,7 @@
 }
 
 // Override default wiki logo
-$wgLogo = "/themes/$sys_theme/images/wgLogo.png";
+$wgLogo = "/themes/".forge_get_config('default_theme')."/images/wgLogo.png";
 $wgFavicon = '/images/icon.png' ;
 $wgBreakFrames = false ;
 ini_set ('memory_limit', '50M') ;

Modified: trunk/gforge/www/account/register.php
===================================================================
--- trunk/gforge/www/account/register.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/www/account/register.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -58,7 +58,7 @@
 }
 
 if (!$theme_id || !is_numeric($theme_id)) {
-	$theme_id=$HTML->getThemeIdFromName($sys_theme);
+	$theme_id=$HTML->getThemeIdFromName(forge_get_config('default_theme'));
 }
 
 if (getStringFromRequest('submit')) {
@@ -102,10 +102,10 @@
 	print "</div>";
 } 
 if (!isset($timezone) || empty($timezone) || !preg_match('/^[-a-zA-Z0-9_\/\.+]+$/', $timezone)) {
-	$timezone = (isset($sys_default_timezone) ? $sys_default_timezone : 'GMT');
+	$timezone = forge_get_config('default_timezone') ? forge_get_config('default_timezone') : 'GMT' ;
 }
 if (!isset($ccode) || empty($ccode) || !preg_match('/^[a-zA-Z]{2}$/', $ccode)) {
-	$ccode = $sys_default_country_code;
+	$ccode = forge_get_config('default_country_code');
 }
 ?>
 

Modified: trunk/gforge/www/include/Layout.class.php
===================================================================
--- trunk/gforge/www/include/Layout.class.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/www/include/Layout.class.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -133,12 +133,12 @@
 		}
 
 		// determine theme{dir,url}
-		$this->themedir = $GLOBALS['sys_themeroot'] . $GLOBALS['sys_theme'] . '/';
+		$this->themedir = $GLOBALS['sys_themeroot'] . forge_get_config('default_theme') . '/';
 		if (!file_exists ($this->themedir)) {
 			html_error_top(_("Can't find theme directory!"));
 			return;
 		}
-		$this->themeurl = util_make_url('themes/' . $GLOBALS['sys_theme'] . '/');
+		$this->themeurl = util_make_url('themes/' . forge_get_config('default_theme') . '/');
                  
 		// determine {css,img,js}{url,dir}
 		if (file_exists ($this->themedir . 'css/')) {
@@ -171,7 +171,7 @@
 		/* check if a personalized css stylesheet exist, if yes include only
 		 this stylesheet. New stylesheets should use the <themename>.css file.
 		*/
-		$theme_cssfile = $GLOBALS['sys_theme'] . '.css';
+		$theme_cssfile = forge_get_config('default_theme') . '.css';
 		if (file_exists($this->cssdir . $theme_cssfile)) {
 			$this->cssurls[] = $this->cssbaseurl . $theme_cssfile;
 		} else {

Modified: trunk/gforge/www/include/pre.php
===================================================================
--- trunk/gforge/www/include/pre.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/www/include/pre.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -144,7 +144,7 @@
 //
 //	Include user Theme
 //
-require_once $sys_themeroot.$sys_theme.'/Theme.class.php';
+require_once $sys_themeroot.forge_get_config('default_theme').'/Theme.class.php';
 
 $HTML=new Theme();
 

Modified: trunk/gforge/www/scm/include/viewvc_utils.php
===================================================================
--- trunk/gforge/www/scm/include/viewvc_utils.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/www/scm/include/viewvc_utils.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -100,7 +100,7 @@
 		'REPOSITORY_TYPE="'.$repos_type.'" '.
 		'REPOSITORY_NAME="'.make_arg_cmd_safe($repos_name).'" '.
 		'HTTP_HOST="'.make_arg_cmd_safe(getStringFromServer('HTTP_HOST')).'" '.
-		'DOCROOT="/themes/'.$GLOBALS['sys_theme'].'/viewvc" '.
+		'DOCROOT="/themes/'.forge_get_config('default_theme').'/viewvc" '.
 		$viewcvs_path.'/bin/cgi/viewvc.cgi 2>&1';
 
 	ob_start();

Modified: trunk/gforge/www/themes/gforge-simple-theme/Theme.class.php
===================================================================
--- trunk/gforge/www/themes/gforge-simple-theme/Theme.class.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/gforge/www/themes/gforge-simple-theme/Theme.class.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -45,10 +45,10 @@
 	 */
 	function Layout() {
 
-		$this->themeroot=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'];
+		$this->themeroot=$GLOBALS['sys_themeroot'].forge_get_config('default_theme');
 		/* if images directory exists in theme, then use it as imgroot */
 		if (file_exists ($this->themeroot.'/images')){
-			$this->imgroot='/themes/'.$GLOBALS['sys_theme'].'/images/';
+			$this->imgroot='/themes/'.forge_get_config('default_theme').'/images/';
 		}
 		// Constructor for parent class...
 		if ( file_exists($GLOBALS['sys_custom_path'] . '/index_std.php') )
@@ -96,10 +96,10 @@
 		 this stylesheet
 		 new stylesheets should use the <themename>.css file
 		 */
-		$theme_cssfile=$GLOBALS['sys_themeroot'].$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css';
+		$theme_cssfile=$GLOBALS['sys_themeroot'].forge_get_config('default_theme').'/css/'.forge_get_config('default_theme').'.css';
 		if (file_exists($theme_cssfile)){
 			echo '
-<link rel="stylesheet" type="text/css" href="'.util_make_uri ('/themes/'.$GLOBALS['sys_theme'].'/css/'.$GLOBALS['sys_theme'].'.css').'"/>';
+<link rel="stylesheet" type="text/css" href="'.util_make_uri ('/themes/'.forge_get_config('default_theme').'/css/'.forge_get_config('default_theme').'.css').'"/>';
 		}
 		?>
 

Modified: trunk/tests/code/deprecations/DeprecationsTest.php
===================================================================
--- trunk/tests/code/deprecations/DeprecationsTest.php	2010-04-20 15:10:13 UTC (rev 9544)
+++ trunk/tests/code/deprecations/DeprecationsTest.php	2010-04-20 16:35:58 UTC (rev 9545)
@@ -35,7 +35,11 @@
 			       'sys_user_reg_restricted',
 			       'sys_default_domain',
 			       'sys_scm_tarballs_path',
-			       'sys_scm_snapshots_path') ;
+			       'sys_scm_snapshots_path',
+			       'sys_theme',
+			       'sys_lang',
+			       'sys_default_timezone',
+			       'sys_default_country_code') ;
 
 		$pattern = implode ('|', $vars) ;
 		




More information about the Fusionforge-commits mailing list