[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] phpgwapi/inc/accounts class.accounts_ldap.inc.p...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] phpgwapi/inc/accounts class.accounts_ldap.inc.p... |
Date: |
Sat, 09 Sep 2006 11:38:24 +0000 |
CVSROOT: /cvsroot/phpgwapi
Module name: phpgwapi
Changes by: Dave Hall <skwashd> 06/09/09 11:38:24
Modified files:
inc/accounts : class.accounts_ldap.inc.php
class.accounts_sql.inc.php
Log message:
add id2lid support and fix some notices
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_ldap.inc.php?cvsroot=phpgwapi&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/inc/accounts/class.accounts_sql.inc.php?cvsroot=phpgwapi&r1=1.16&r2=1.17
Patches:
Index: class.accounts_ldap.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/accounts/class.accounts_ldap.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- class.accounts_ldap.inc.php 5 Sep 2006 11:44:38 -0000 1.11
+++ class.accounts_ldap.inc.php 9 Sep 2006 11:38:24 -0000 1.12
@@ -11,7 +11,7 @@
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage accounts
- * @version $Id: class.accounts_ldap.inc.php,v 1.11 2006/09/05 11:44:38
Caeies Exp $
+ * @version $Id: class.accounts_ldap.inc.php,v 1.12 2006/09/09 11:38:24
skwashd Exp $
*/
/**
@@ -421,6 +421,40 @@
}
/**
+ * Convert an id into its corresponding account login or group
name
+ *
+ * @param integer $id Account or group id
+ * @return string account login id or the group - empty string
means not found
+ */
+ function id2lid($id)
+ {
+ static $lid_list;
+ if(isset($lid_list[$id]))
+ {
+ return $id_list[$id];
+ }
+
+ $type = $this->get_type($id);
+
+ if ($type == 'g')
+ {
+ $group = $this->group_exists($id);
+ $name = $group['cn'][0];
+ }
+ elseif ($type == 'u')
+ {
+ $account = $this->account_exists($id);
+ $name = $account['uid'][0];
+ }
+ else
+ {
+ return '';
+ }
+ $lid_list[$id] = $name;
+ return $name;
+ }
+
+ /**
* Convert an id into its corresponding account or group name
*
* @param integer $id Account or group id
@@ -439,7 +473,7 @@
if ($type == 'g')
{
$group = $this->group_exists($id);
- $name = $group['cn'][0];
+ $name = lang('%1 group', $group['cn'][0]);
}
elseif ($type == 'u')
{
@@ -450,6 +484,7 @@
{
return '';
}
+ $id_list[$id] = $name;
return $name;
}
Index: class.accounts_sql.inc.php
===================================================================
RCS file: /cvsroot/phpgwapi/phpgwapi/inc/accounts/class.accounts_sql.inc.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- class.accounts_sql.inc.php 5 Sep 2006 11:44:38 -0000 1.16
+++ class.accounts_sql.inc.php 9 Sep 2006 11:38:24 -0000 1.17
@@ -8,7 +8,7 @@
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General
Public License
* @package phpgwapi
* @subpackage accounts
- * @version $Id: class.accounts_sql.inc.php,v 1.16 2006/09/05 11:44:38
Caeies Exp $
+ * @version $Id: class.accounts_sql.inc.php,v 1.17 2006/09/09 11:38:24
skwashd Exp $
*/
/**
@@ -232,6 +232,41 @@
return $name_list[$account_lid];
}
+ /**
+ * Convert an id into its corresponding account login or group
name
+ *
+ * @param integer $id Account or group id
+ * @return string account login id or the group - empty string
means not found
+ */
+ function id2lid($account_id)
+ {
+ static $lid_list;
+
+ (int)$account_id;
+
+ if (! $account_id)
+ {
+ return '';
+ }
+
+ if( isset($lid_list[$account_id]) &&
$id_list[$account_id] )
+ {
+ return $lid_list[$account_id];
+ }
+
+ $this->db->query("SELECT account_lid FROM
phpgw_accounts WHERE account_id={$account_id}",__LINE__,__FILE__);
+ if($this->db->num_rows())
+ {
+ $this->db->next_record();
+ $lid_list[$account_id] =
$this->db->f('account_lid');
+ }
+ else
+ {
+ $lid_list[$account_id] = '';
+ }
+ return $lid_list[$account_id];
+ }
+
function id2name($account_id)
{
static $id_list;