[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/common/include scm.php, NONE, 1.1 SCM.class, NO
From: |
lo-lan-do |
Subject: |
[Gforge-commits] gforge/common/include scm.php, NONE, 1.1 SCM.class, NONE, 1.1 session.php, 1.18, 1.19 User.class, 1.33, 1.34 PluginManager.class, 1.10, 1.11 |
Date: |
Sun, 16 May 2004 11:55:01 -0500 |
Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/tmp/cvs-serv19357/common/include
Modified Files:
session.php User.class PluginManager.class
Added Files:
scm.php SCM.class
Log Message:
The big SCM pluginification plugin: removed lots of code (moved it
into gforge-plugin-scmcvs), added hooks, added the SCMPlugin class,
various tweaks here and there.
--- NEW FILE: scm.php ---
<?php
$scm_list = array () ;
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
?>
--- NEW FILE: SCM.class ---
<?php
/**
* SCM object
*
* Provides an base class for an SCM plugin
*
* This file is copyright (c) Roland Mas <address@hidden>, 2004
*
* $Id: SCM.class,v 1.1 2004/05/16 16:54:59 lo-lan-do Exp $
*
* This file is part of GForge.
*
* GForge is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GForge; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
require_once('common/include/scm.php');
class SCM extends Plugin {
/**
* SCM() - constructor
*
*/
function SCM () {
$this->Plugin() ;
}
function register () {
global $scm_list ;
$scm_list[] = $this->name ;
}
}
// Local Variables:
// mode: php
// c-file-style: "bsd"
// End:
?>
Index: session.php
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/session.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- session.php 27 Apr 2004 21:12:17 -0000 1.18
+++ session.php 16 May 2004 16:54:58 -0000 1.19
@@ -133,6 +133,11 @@
$hook_params['passwd'] = $passwd ;
plugin_hook ("session_before_login", $hook_params) ;
+ return session_login_valid_dbonly ($loginname, $passwd, $allowpending)
;}
+
+function session_login_valid_dbonly ($loginname, $passwd, $allowpending) {
+ global $feedback,$Language;
+
// Try to get the users from the database using user_id and (MD5)
user_pw
$res = db_query("
SELECT user_id,status,unix_pw
@@ -167,7 +172,7 @@
$res = db_query ("UPDATE users
SET user_pw='" . md5($passwd) . "'
WHERE user_id='".$usr['user_id']."'");
- return session_login_valid($loginname, $passwd,
$allowpending) ;
+ return session_login_valid_dbonly($loginname, $passwd,
$allowpending) ;
}
} else {
// If we're here, then the user has typed a password matching
the (MD5) user_pw
@@ -183,7 +188,7 @@
$res = db_query ("UPDATE users
SET unix_pw='" .
account_genunixpw($passwd) . "'
WHERE user_id='".$usr['user_id']."'");
- return session_login_valid($loginname, $passwd,
$allowpending) ;
+ return session_login_valid_dbonly($loginname,
$passwd, $allowpending) ;
} else {
// Invalidate (MD5) user_pw, refuse
authentication
$res = db_query ("UPDATE users
Index: User.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/User.class,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- User.class 9 May 2004 18:15:37 -0000 1.33
+++ User.class 16 May 2004 16:54:58 -0000 1.34
@@ -213,12 +213,13 @@
* @param string The users fax.
* @param string The users title.
* @param char(2) The users ISO country_code.
+ * @param bool Whether to send an email or not
* @returns The newly created user ID
*
*/
function
create($unix_name,$firstname,$lastname,$password1,$password2,$email,
$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,
-
$unix_box='shell',$address='',$address2,$phone='',$fax='',$title='',$ccode='US')
{
+
$unix_box='shell',$address='',$address2='',$phone='',$fax='',$title='',$ccode='US',$send_mail=true)
{
global $Language;
if (!$theme_id) {
$this->setError($Language->getText('account_register','err_themeid'));
@@ -329,8 +330,10 @@
}
$Language->loadLanguageID($language_id);
-
- $this->sendRegistrationEmail();
+
+ if ($send_mail) {
+ $this->sendRegistrationEmail();
+ }
db_commit();
return $id;
Index: PluginManager.class
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/PluginManager.class,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- PluginManager.class 26 Feb 2004 21:26:33 -0000 1.10
+++ PluginManager.class 16 May 2004 16:54:59 -0000 1.11
@@ -61,6 +61,16 @@
}
/**
+ * GetPluginObject() - get a particular plugin object
+ *
+ * @param pluginname - name of plugin
+ * @return a plugin object
+ */
+ function GetPluginObject ($pluginname) {
+ return $this->plugins_objects [$pluginname] ;
+ }
+
+ /**
* PluginIsInstalled() - is a plugin installed?
*
* @param pluginname - name of plugin
@@ -82,7 +92,7 @@
*/
function LoadPlugins () {
$plugins_data = $this->GetPlugins() ;
- $include_path = "/usr/lib/gforge/plugins/" ;
+ $include_path = $GLOBALS['sys_plugins_path'] ;
foreach ($plugins_data as $p_id => $p_name) {
$filename = $include_path . $p_name .
"/include/".$p_name."-init.php" ;
if (file_exists ($filename)) {
@@ -139,6 +149,21 @@
}
return true ;
}
+
+ /**
+ * CountHookListeners() - number of listeners on a particular hook
+ *
+ * @param hookname - name of the hook
+ */
+ function CountHookListeners ($hookname) {
+ if (isset($this->hooks_to_plugins[$hookname])) {
+ $p_list = $this->hooks_to_plugins[$hookname];
+ return count ($p_list) ;
+ } else {
+ return 0 ;
+ }
+
+ }
}
/**
@@ -155,6 +180,17 @@
}
/**
+ * plugin_get_object() - get a particular Plugin object
+ *
+ * @param pluginname - a plugin name
+ * @return the Plugin object
+ */
+function &plugin_get_object ($pluginname) {
+ global $PLUGINMANAGER_OBJ;
+ return $PLUGINMANAGER_OBJ->Getpluginobject ($pluginname) ;
+}
+
+/**
* register_plugin () - register a plugin
*
* @param pluginobject - an object of a subclass of the Plugin class
@@ -176,6 +212,16 @@
}
/**
+ * plugin_hook_listeners () - count the number of listeners on a hook
+ *
+ * @param hookname - name of the hook
+ */
+function plugin_hook_listeners ($hookname, $params=false) {
+ $pm =& plugin_manager_get_object () ;
+ return $pm->CountHookListeners ($hookname) ;
+}
+
+/**
* setup_plugin_manager () - initialise the plugin ingrastructure
*
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/common/include scm.php, NONE, 1.1 SCM.class, NONE, 1.1 session.php, 1.18, 1.19 User.class, 1.33, 1.34 PluginManager.class, 1.10, 1.11,
lo-lan-do <=
- Prev by Date:
[Gforge-commits] gforge/utils/ldap sql2ldif.pl,1.11,1.12
- Next by Date:
[Gforge-commits] gforge/deb-specific sqlhelper.pm, NONE, 1.1 update-user-group-cvs.sh, 1.14, 1.15 sqlparser.pm, 1.2, 1.3 db-upgrade.pl, 1.53, 1.54 tarballs.sh, 1.3, NONE install-cvs.sh, 1.7, NONE
- Previous by thread:
[Gforge-commits] gforge/utils/ldap sql2ldif.pl,1.11,1.12
- Next by thread:
[Gforge-commits] gforge/deb-specific sqlhelper.pm, NONE, 1.1 update-user-group-cvs.sh, 1.14, 1.15 sqlparser.pm, 1.2, 1.3 db-upgrade.pl, 1.53, 1.54 tarballs.sh, 1.3, NONE install-cvs.sh, 1.7, NONE
- Index(es):