[Fusionforge-commits] FusionForge branch Branch_5_3 updated. 63fc054a1434ecd3bd66ae33a8165d45c6701723

Franck Villaume nerville at fusionforge.org
Mon Apr 14 20:54:03 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, Branch_5_3 has been updated
       via  63fc054a1434ecd3bd66ae33a8165d45c6701723 (commit)
      from  d79f7233a7aaabd1ec7f0d0483943f6d6782af0e (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 63fc054a1434ecd3bd66ae33a8165d45c6701723
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Mon Apr 14 20:53:23 2014 +0200

    getThemeIdFromName: function needed in utils scripts or cronjobs. move it to utils.php

diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 0b60cdb..b7f8b88 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -1807,6 +1807,18 @@ function getselfhref($p = array(), $return_encoded = true) {
 	return util_gethref(false, $p, $return_encoded);
 }
 
+/**
+ * getThemeIdFromName()
+ *
+ * @param	string  $dirname	the dirname of the theme
+ * @return	int	the theme id
+ */
+function getThemeIdFromName($dirname) {
+	$res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
+			array ($dirname));
+	return db_result($res,0,'theme_id');
+}
+
 // Local Variables:
 // mode: php
 // c-file-style: "bsd"
diff --git a/src/plugins/authldap/include/AuthLDAPPlugin.class.php b/src/plugins/authldap/include/AuthLDAPPlugin.class.php
index 8013e68..717aae5 100644
--- a/src/plugins/authldap/include/AuthLDAPPlugin.class.php
+++ b/src/plugins/authldap/include/AuthLDAPPlugin.class.php
@@ -93,7 +93,7 @@ class AuthLDAPPlugin extends ForgeAuthPlugin {
 			$user_data['timezone'] = 'GMT';
 			$user_data['jabber_address'] = '';
 			$user_data['jabber_only'] = 0;
-			$user_data['theme_id'] = $HTML->getThemeIdFromName(forge_get_config('default_theme'));
+			$user_data['theme_id'] = getThemeIdFromName(forge_get_config('default_theme'));
 			$user_data['unix_box'] = '';
 			$user_data['address'] = '';
 			$user_data['address2'] = '';
diff --git a/src/plugins/projectimport/www/usersimport.php b/src/plugins/projectimport/www/usersimport.php
index 0c79f0e..09bdda8 100644
--- a/src/plugins/projectimport/www/usersimport.php
+++ b/src/plugins/projectimport/www/usersimport.php
@@ -202,7 +202,7 @@ class UsersImportPage extends FileManagerPage {
 					$firstname = $user_obj->getFirstname();
 					$lastname = $user_obj->getLastname();
 
-					$theme_id=$this->html_generator->getThemeIdFromName(forge_get_config('default_theme'));
+					$theme_id = getThemeIdFromName(forge_get_config('default_theme'));
 					$password1 = substr(md5($GLOBALS['session_ser'] . time() . util_randbytes()), 0, 8);
 					$password2 = $password1;
 					$language_id = language_name_to_lang_id (choose_language_from_context ());
diff --git a/src/utils/inject-users.php b/src/utils/inject-users.php
index 11e1b1c..7d269b6 100755
--- a/src/utils/inject-users.php
+++ b/src/utils/inject-users.php
@@ -22,6 +22,11 @@
 require (dirname (__FILE__).'/../common/include/env.inc.php');
 require_once $gfcommon.'include/pre.php';
 
+$themeId = getThemeIdFromName(forge_get_config('default_theme'));
+if (!$themeId) {
+	print "Error: missing theme id";
+	exit(1);
+}
 db_begin ();
 
 /*
@@ -45,7 +50,7 @@ while (! feof ($f)) {
 	$u = new GFUser () ;
 
 	$r = $u->create ($login, $fname, $lname, $password, $password, $email,
-			 1, 0, 1, 'UTC', '', '', 1,
+			 1, 0, 1, 'UTC', '', '', getThemeIdFromName(forge_get_config('default_theme')),
 			 'shell', '', '', '', '', '', 'US', false);
 
 	if (!$r) {
diff --git a/src/www/account/register.php b/src/www/account/register.php
index aebb136..b0a059e 100644
--- a/src/www/account/register.php
+++ b/src/www/account/register.php
@@ -58,7 +58,7 @@ if (forge_get_config('use_ssl') && !session_issecure()) {
 }
 
 if (!$theme_id || !is_numeric($theme_id)) {
-	$theme_id=$HTML->getThemeIdFromName(forge_get_config('default_theme'));
+	$theme_id = getThemeIdFromName(forge_get_config('default_theme'));
 }
 
 if (getStringFromRequest('submit')) {
diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index 9352ee2..e38c916 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -1017,18 +1017,6 @@ if (isset($params['group']) && $params['group']) {
 		}
 	}
 
-	/**
-	 * getThemeIdFromName()
-	 *
-	 * @param	string  $dirname	the dirname of the theme
-	 * @return	int	the theme id
-	 */
-	function getThemeIdFromName($dirname) {
-		$res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1',
-				array ($dirname));
-		return db_result($res,0,'theme_id');
-	}
-
 	function confirmBox($msg, $params, $buttons, $image='*none*') {
 		if ($image == '*none*') {
 			$image = html_image('stop.png','48','48',array());
diff --git a/src/www/themes/funky-wOw/Theme.class.php b/src/www/themes/funky-wOw/Theme.class.php
index 98eb8dd..fe3cba4 100644
--- a/src/www/themes/funky-wOw/Theme.class.php
+++ b/src/www/themes/funky-wOw/Theme.class.php
@@ -397,18 +397,6 @@ class Theme extends Layout {
 	}
 
 	/**
-	 * getThemeIdFromName()
-	 *
-	 * @param	string	$dirname	the dirname of the theme
-	 * @return	int		the theme id
-	 */
-	function getThemeIdFromName($dirname)
-	{
-		$res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
-		return db_result($res, 0, 'theme_id');
-	}
-
-	/**
 	 * headerJS() - creates the JS headers and calls the plugin javascript hook
 	 * @todo generalize this
 	 */
diff --git a/src/www/themes/funky/Theme.class.php b/src/www/themes/funky/Theme.class.php
index d13797d..9d11e51 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -413,18 +413,6 @@ class Theme extends Layout {
 	}
 
 	/**
-	 * getThemeIdFromName()
-	 *
-	 * @param	string	$dirname	the dirname of the theme
-	 * @return	int		the theme id
-	 */
-	function getThemeIdFromName($dirname)
-	{
-		$res = db_query_params ('SELECT theme_id FROM themes WHERE dirname=$1', array($dirname));
-		return db_result($res, 0, 'theme_id');
-	}
-
-	/**
 	 * headerJS() - creates the JS headers and calls the plugin javascript hook
 	 * @todo generalize this
 	 */

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

Summary of changes:
 src/common/include/utils.php                          |   12 ++++++++++++
 src/plugins/authldap/include/AuthLDAPPlugin.class.php |    2 +-
 src/plugins/projectimport/www/usersimport.php         |    2 +-
 src/utils/inject-users.php                            |    7 ++++++-
 src/www/account/register.php                          |    2 +-
 src/www/include/Layout.class.php                      |   12 ------------
 src/www/themes/funky-wOw/Theme.class.php              |   12 ------------
 src/www/themes/funky/Theme.class.php                  |   12 ------------
 8 files changed, 21 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list