source: trunk/phpgwapi/inc/class.accounts.inc.php @ 2

Revision 2, 22.3 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * eGroupWare API - Accounts manager shared functions                       *
4        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
5        *        and Bettina Gille [ceb@phpgroupware.org]                          *
6        * shared functions for other account repository managers                   *
7        * Copyright (C) 2000 - 2002 Joseph Engo                                    *
8        * Copyright (C) 2003 Joseph Engo, Bettina Gille                            *
9        * -------------------------------------------------------------------------*
10        * This library is part of the eGroupWare API                               *
11        * http://www.egroupware.org                                                *
12        * ------------------------------------------------------------------------ *
13        * This library is free software; you can redistribute it and/or modify it  *
14        * under the terms of the GNU Lesser General Public License as published by *
15        * the Free Software Foundation; either version 2.1 of the License,         *
16        * or any later version.                                                    *
17        * This library is distributed in the hope that it will be useful, but      *
18        * WITHOUT ANY WARRANTY; without even the implied warranty of               *
19        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
20        * See the GNU Lesser General Public License for more details.              *
21        * You should have received a copy of the GNU Lesser General Public License *
22        * along with this library; if not, write to the Free Software Foundation,  *
23        * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
24        \**************************************************************************/
25
26        if (empty($GLOBALS['phpgw_info']['server']['account_repository']))
27        {
28                if (!empty($GLOBALS['phpgw_info']['server']['auth_type']))
29                {
30                        $GLOBALS['phpgw_info']['server']['account_repository'] = $GLOBALS['phpgw_info']['server']['auth_type'];
31                }
32                else
33                {
34                        $GLOBALS['phpgw_info']['server']['account_repository'] = 'sql';
35                }
36        }
37        include_once(PHPGW_API_INC . '/class.accounts_' . $GLOBALS['phpgw_info']['server']['account_repository'] . '.inc.php');
38
39        /*
40          Dont know where to put this (seek3r)
41          This is where it belongs (jengo)
42          This is where it ended up (milosch)
43          Moved again at least temporarily since sql and ldap use it.
44        */
45        $GLOBALS['phpgw_info']['server']['global_denied_users'] = array(
46                'root'     => True, 'bin'      => True, 'daemon'   => True,
47                'adm'      => True, 'lp'       => True, 'sync'     => True,
48                'shutdown' => True, 'halt'     => True, 'ldap'     => True,
49                'mail'     => True, 'news'     => True, 'uucp'     => True,
50                'operator' => True, 'games'    => True, 'gopher'   => True,
51                'nobody'   => True, 'xfs'      => True, 'pgsql'    => True,
52                'mysql'    => True, 'postgres' => True, 'oracle'   => True,
53                'ftp'      => True, 'gdm'      => True, 'named'    => True,
54                'alias'    => True, 'web'      => True, 'sweep'    => True,
55                'cvs'      => True, 'qmaild'   => True, 'qmaill'   => True,
56                'qmaillog' => True, 'qmailp'   => True, 'qmailq'   => True,
57                'qmailr'   => True, 'qmails'   => True, 'rpc'      => True,
58                'rpcuser'  => True, 'amanda'   => True, 'apache'   => True,
59                'pvm'      => True, 'squid'    => True, 'ident'    => True,
60                'nscd'     => True, 'mailnull' => True, 'cyrus'    => True,
61                'backup'    => True
62        );
63
64        $GLOBALS['phpgw_info']['server']['global_denied_groups'] = array(
65                'root'      => True, 'bin'       => True, 'daemon'    => True,
66                'sys'       => True, 'adm'       => True, 'tty'       => True,
67                'disk'      => True, 'lp'        => True, 'mem'       => True,
68                'kmem'      => True, 'wheel'     => True, 'mail'      => True,
69                'uucp'      => True, 'man'       => True, 'games'     => True,
70                'dip'       => True, 'ftp'       => True, 'nobody'    => True,
71                'floppy'    => True, 'xfs'       => True, 'console'   => True,
72                'utmp'      => True, 'pppusers'  => True, 'popusers'  => True,
73                'slipusers' => True, 'slocate'   => True, 'mysql'     => True,
74                'dnstools'  => True, 'web'       => True, 'named'     => True,
75                'dba'       => True, 'oinstall'  => True, 'oracle'    => True,
76                'gdm'       => True, 'sweep'     => True, 'cvs'       => True,
77                'postgres'  => True, 'qmail'     => True, 'nofiles'   => True,
78                'ldap'      => True, 'backup'    => True
79        );
80
81        /*!
82         @class_start accounts
83         @abstract Class for handling user and group accounts
84        */
85
86        class accounts extends accounts_
87        {
88                var $memberships    = array();
89                var $members        = array();
90                var $xmlrpc_methods = array();
91                // enables the session-cache
92                var $use_session_cache = True;
93
94                /**************************************************************************\
95                * Standard constructor for setting $this->account_id                       *
96                * This constructor sets the account id, if string is sent, converts to id  *
97                * I might move this to the accounts_shared if it stays around              *
98                \**************************************************************************/
99                function accounts($account_id = '', $account_type='')
100                {
101                        // enable the caching in the session onyl for ldap
102                        $this->use_session_cache = $GLOBALS['phpgw_info']['server']['account_repository'] == 'ldap';
103
104                        $this->db = $GLOBALS['phpgw']->db;
105
106                        if($account_id != '')
107                        {
108                                $this->account_id = get_account_id($account_id);
109                        }
110
111                        if($account_type != '')
112                        {
113                                $this->account_type = $account_type;
114                        }
115
116                        $this->query_types = array(
117                                'all' => 'all fields',
118                                'firstname' => 'firstname',
119                                'lastname' => 'lastname',
120                                'lid' => 'LoginID',
121                                'email' => 'email',     
122                                'start' => 'start with',
123                                'exact' => 'exact',
124                        );
125                        $this->accounts_();                     // call constructor of extended class
126
127                        $this->xmlrpc_methods[] = array(
128                                'name'        => 'get_list',
129                                'description' => 'Returns a list of accounts and/or groups'
130                        );
131                        $this->xmlrpc_methods[] = array(
132                                'name'        => 'name2id',
133                                'description' => 'Cross reference account_lid with account_id'
134                        );
135                        $this->xmlrpc_methods[] = array(
136                                'name'        => 'id2name',
137                                'description' => 'Cross reference account_id with account_lid'
138                        );
139                }
140
141                /**
142                * Sets up the account-data cache
143                *
144                * The cache is shared between all instances of the account-class and it can be save in the session,
145                * if use_session_cache is set to True
146                */
147                function setup_cache()
148                {
149                        if ($this->use_session_cache &&         // are we supposed to use a session-cache
150                                !@$GLOBALS['phpgw_info']['accounts']['session_cache_setup'] &&  // is it already setup
151                                // is the account-class ready (startup !)
152                                is_object($GLOBALS['phpgw']->session) && $GLOBALS['phpgw']->session->account_id)
153                        {
154                                // setting up the session-cache
155                                $GLOBALS['phpgw_info']['accounts']['cache'] = $GLOBALS['phpgw']->session->appsession('accounts_cache','phpgwapi');
156                                $GLOBALS['phpgw_info']['accounts']['session_cache_setup'] = True;
157                                //echo "accounts::setup_cache() cache=<pre>".print_r($GLOBALS['phpgw_info']['accounts']['cache'],True)."</pre>\n";
158                        }
159                        if (!isset($this->cache))
160                        {
161                                $this->cache = &$GLOBALS['phpgw_info']['accounts']['cache'];
162                        }
163                }
164
165                /**
166                * Saves the account-data cache in the session
167                *
168                * Gets called from common::phpgw_final()
169                */
170                function save_session_cache()
171                {
172                        if ($this->use_session_cache &&         // are we supposed to use a session-cache
173                                $GLOBALS['phpgw_info']['accounts']['session_cache_setup'] &&    // is it already setup
174                                // is the account-class ready (startup !)
175                                is_object($GLOBALS['phpgw']->session))
176                        {
177                                $GLOBALS['phpgw']->session->appsession('accounts_cache','phpgwapi',$GLOBALS['phpgw_info']['accounts']['cache']);
178                        }
179                }
180
181                /**
182                 * Searches / lists accounts: users and/or groups
183                 *
184                 * @param $param['type'] string/int 'accounts', 'groups', 'owngroups' (groups the user is a member of), 'both'
185                 *      or integer group-id for a list of members of that group
186                 * @param $param['start'] int first account to return (returns offset or max_matches entries) or all if not set
187                 * @param $param['sort'] string column to sort after, default account_lid if unset
188                 * @param $param['order'] string 'ASC' or 'DESC', default 'DESC' if not set
189                 * @param $param['query'] string to search for, no search if unset or empty
190                 * @param $param['query_type'] string:
191                 *      'all'   - query all fields for containing $param[query]
192                 *      'start' - query all fields starting with $param[query]
193                 *      'exact' - query all fields for exact $param[query]
194                 *      'lid','firstname','lastname','email' - query only the given field for containing $param[query]
195                 * @param $param['app'] string with an app-name, to limit result on accounts with run-right for that app
196                 * @param $param['offset'] int - number of matches to return if start given, default use the value in the prefs
197                 * @return array with uid / data pairs, data is an array with account_id, account_lid, account_firstname,
198                 *      account_lastname, person_id (id of the linked addressbook entry), account_status, account_expires, account_primary_group
199                 */
200                function search($param)
201                {
202                        //echo "<p>accounts::search(".print_r($param,True).")</p>\n";
203                        $this->setup_cache();
204                        $account_search = &$this->cache['account_search'];
205                       
206                        $serial = serialize($param);
207
208                        if (isset($account_search[$serial]))
209                        {
210                                $this->total = $account_search[$serial]['total'];
211                        }
212                        elseif (function_exists('accounts_::search'))   // implements its on search function ==> use it
213                        {
214                                $account_search[$serial]['data'] = accounts_::search($param);
215                                $account_search[$serial]['total'] = $this->total;
216                        }
217                        else
218                        {
219                                $serial2 = $serial;
220                                if (is_numeric($param['type']) || $param['app'] || $param['type'] == 'owngroups')       // do we need to limit the search on a group or app?
221                                {
222                                        $app = $param['app'];
223                                        unset($param['app']);
224                                        if (is_numeric($param['type']))
225                                        {
226                                                $group = (int) $param['type'];
227                                                $param['type'] = 'accounts';
228                                        }
229                                        elseif ($param['type'] == 'owngroups')
230                                        {
231                                                $group = -1;
232                                                $param['type'] = 'groups';
233                                        }
234                                        $start = $param['start'];
235                                        unset($param['start']);
236                                        $serial2 = serialize($param);
237                                }
238                                if (!isset($account_search[$serial2]))  // check if we already did this general search
239                                {
240                                        $account_search[$serial2]['data'] = array();
241                                        $accounts = accounts_::get_list($param['type'],$param['start'],$param['sort'],$param['order'],$param['query'],$param['offset'],$param['query_type']);
242                                        if (!$accounts) $accounts = array();
243                                        foreach($accounts as $data)
244                                        {
245                                                $account_search[$serial2]['data'][$data['account_id']] = $data;
246                                        }
247                                        $account_search[$serial2]['total'] = $this->total;
248                                }
249                                else
250                                {
251                                        $this->total = $account_search[$serial2]['total'];
252                                }
253                                //echo "accounts_::get_list($param[type],$param[start],$param[sort],$param[order],$param[query],$param[offset],$param[query_type]) returned<pre>".print_r($account_search[$serial2],True)."</pre>\n";
254                                if ($app || $group)     // limit the search on accounts with run-rights for app or a group
255                                {
256                                        $valid = array();
257                                        if ($app)
258                                        {
259                                                $valid = $this->split_accounts($app,$param['type'] == 'both' ? 'merge' : $param['type']);
260                                        }
261                                        if ($group)
262                                        {
263                                                $members = $group > 0 ? $GLOBALS['phpgw']->acl->get_ids_for_location($group, 1, 'phpgw_group') :
264                                                        $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1,$GLOBALS['phpgw_info']['user']['account_id']);
265                                                if (!$members) $members = array();
266                                                $valid = !$app ? $members : array_intersect($valid,$members);   // use the intersection
267                                        }
268                                        //echo "<p>limiting result to app='app' and/or group=$group valid-ids=".print_r($valid,true)."</p>\n";
269                                        $offset = $param['offset'] ? $param['offset'] : $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
270                                        $stop = $start + $offset;
271                                        $n = 0;
272                                        $account_search[$serial]['data'] = array();
273                                        foreach ($account_search[$serial2]['data'] as $id => $data)
274                                        {
275                                                if (!in_array($id,$valid))
276                                                {
277                                                        $this->total--;
278                                                        continue;
279                                                }
280                                                // now we have a valid entry
281                                                if (!is_int($start) || $start <= $n && $n < $stop)
282                                                {
283                                                        $account_search[$serial]['data'][$id] = $data;
284                                                }
285                                                $n++;
286                                        }
287                                        $account_search[$serial]['total'] = $this->total;
288                                }
289                        }
290                        //echo "<p>accounts::search('$serial')=<pre>".print_r($account_search[$serial]['data'],True).")</pre>\n";
291                        return $account_search[$serial]['data'];
292                }
293
294
295                function get_list($_type='both',$start = '',$sort = '', $order = '', $query = '', $offset = '',$query_type='')
296                {
297                        //echo "<p>accounts::get_list(".print_r($_type,True).",start='$start',sort='$sort',order='$order',query='$query',offset='$offset')</p>\n";
298                        $this->setup_cache();
299                        $account_list = &$this->cache['account_list'];
300
301                        // For XML-RPC
302                        if (is_array($_type))
303                        {
304                                $p      = $_type;
305                                $_type  = $p['type'];
306                                $start  = $p['start'];
307                                $order  = $p['order'];
308                                $query  = $p['query'];
309                                $offset = $p['offset'];
310                                $query_type = $p['query_type'];
311                        }
312                        else
313                        {
314                                $p = array(
315                                        'type' => $_type,
316                                        'start' => $start,
317                                        'order' => $order,
318                                        'query' => $query,
319                                        'offset' => $offset,
320                                        'query_type' => $query_type ,
321                                );
322                        }
323                        $serial = serialize($p);
324
325                        if (isset($account_list[$serial]))
326                        {
327                                $this->total = $account_list[$serial]['total'];
328                        }
329                        else
330                        {
331                                $account_list[$serial]['data'] = accounts_::get_list($_type,$start,$sort,$order,$query,$offset,$query_type);
332                                $account_list[$serial]['total'] = $this->total;
333                        }
334                        return $account_list[$serial]['data'];
335                }
336
337                function is_expired()
338                {
339                        if ($this->data['expires'] != -1 && $this->data['expires'] < time())
340                        {
341                                return True;
342                        }
343                        else
344                        {
345                                return False;
346                        }
347                }
348
349                /**
350                * Invalidate the cache (or parts of it) after change in $account_id
351                *
352                * Atm simplest approach - delete it all ;-)
353                */
354                function cache_invalidate($account_id)
355                {
356                        //echo "<p>accounts::cache_invalidate($account_id)</p>\n";
357                        $GLOBALS['phpgw_info']['accounts']['cache'] = array();
358                }
359
360                function save_repository()
361                {
362                        $this->cache_invalidate($this->account_id);
363                        accounts_::save_repository();
364                }
365
366                function delete($accountid)
367                {
368                        $this->cache_invalidate($accountid);
369                        accounts_::delete($accountid);
370                       
371                        // delete all acl_entries belonging to that user or group
372                        $GLOBALS['phpgw']->acl->delete_account($accountid);
373                }
374
375                function create($account_info,$default_prefs=True)
376                {
377                        $account_id = accounts_::create($account_info,$default_prefs);
378                        $this->cache_invalidate($account_id);
379
380                        return $account_id;
381                }
382
383                function read_repository()
384                {
385                        $this->setup_cache();
386                        $account_data = &$this->cache['account_data'];
387
388                        if (isset($account_data[$this->account_id]))
389                        {
390                                return $this->data = $account_data[$this->account_id];
391                        }
392                        return $account_data[$this->account_id] = accounts_::read_repository();
393                }
394
395                function read()
396                {
397                        if (count($this->data) == 0)
398                        {
399                                $this->read_repository();
400                        }
401
402                        reset($this->data);
403                        return $this->data;
404                }
405
406                function update_data($data)
407                {
408                        reset($data);
409                        $this->data = Array();
410                        $this->data = $data;
411
412                        reset($this->data);
413                        return $this->data;
414                }
415
416                function membership($accountid = '')
417                {
418                        $this->setup_cache();
419                        $membership_list = &$this->cache['membership_list'];
420
421                        $account_id = get_account_id($accountid);
422
423                        if (isset($membership_list[$account_id]))
424                        {
425                                return $membership_list[$account_id];
426                        }
427
428                        $security_equals = Array();
429                        $security_equals = $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1, $account_id);
430
431                        if ($security_equals == False)
432                        {
433                                return $membership_list[$account_id] = False;
434                        }
435
436                        $this->memberships = Array();
437
438                        for ($idx=0; $idx<count($security_equals); $idx++)
439                        {
440                                $groups = (int)$security_equals[$idx];
441                                $this->memberships[] = Array('account_id' => $groups, 'account_name' => $this->id2name($groups));
442                        }
443
444                        return $membership_list[$account_id] = $this->memberships;
445                }
446
447                function member($accountid = '')
448                {
449                        $account_id = get_account_id($accountid);
450
451                        $security_equals = Array();
452                        $acl = CreateObject('phpgwapi.acl');
453                        $security_equals = $acl->get_ids_for_location($account_id, 1, 'phpgw_group');
454                        unset($acl);
455
456                        if ($security_equals == False)
457                        {
458                                return False;
459                        }
460
461                        for ($idx=0; $idx<count($security_equals); $idx++)
462                        {
463                                $name = $this->id2name((int)$security_equals[$idx]);
464                                $this->members[] = Array('account_id' => (int)$security_equals[$idx], 'account_name' => $name);
465                        }
466
467                        return $this->members;
468                }
469
470                /*!
471                @function get_nextid
472                @abstract Using the common functions next_id and last_id, find the next available account_id
473                @param $account_type (optional, default to 'u')
474                */
475                // NOTE: to my knowledge this is not used any more RalfBecker 2004/06/15
476                function get_nextid($account_type='u')
477                {
478                        $min = $GLOBALS['phpgw_info']['server']['account_min_id'] ? $GLOBALS['phpgw_info']['server']['account_min_id'] : 0;
479                        $max = $GLOBALS['phpgw_info']['server']['account_max_id'] ? $GLOBALS['phpgw_info']['server']['account_max_id'] : 0;
480
481                        if ($account_type == 'g')
482                        {
483                                $type = 'groups';
484                        }
485                        else
486                        {
487                                $type = 'accounts';
488                        }
489                        $nextid = (int)$GLOBALS['phpgw']->common->last_id($type,$min,$max);
490
491                        /* Loop until we find a free id */
492                        $free = 0;
493                        while (!$free)
494                        {
495                                $account_lid = '';
496                                //echo '<br>calling search for id: '.$nextid;
497                                if ($this->exists($nextid))
498                                {
499                                        $nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
500                                }
501                                else
502                                {
503                                        $account_lid = $this->id2name($nextid);
504                                        /* echo '<br>calling search for lid: '.$account_lid . '(from account_id=' . $nextid . ')'; */
505                                        if ($this->exists($account_lid))
506                                        {
507                                                $nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
508                                        }
509                                        else
510                                        {
511                                                $free = True;
512                                        }
513                                }
514                        }
515                        if      ($GLOBALS['phpgw_info']['server']['account_max_id'] &&
516                                ($nextid > $GLOBALS['phpgw_info']['server']['account_max_id']))
517                        {
518                                return False;
519                        }
520                        /* echo '<br>using'.$nextid;exit; */
521                        return $nextid;
522                }
523
524
525                /**
526                * splits users and groups from a array of id's or the accounts with run-rights for a given app-name
527                *
528                * @param $app_users array of user-id's or app-name (if you use app-name the result gets cached!)
529                * @param $use string what should be returned only an array with id's of either 'accounts' or 'groups'.
530                *       Or an array with arrays for 'both' under the keys 'groups' and 'accounts' or 'merge' for accounts
531                *       and groups merged into one array
532                * @return see $use
533                */
534                function split_accounts($app_users,$use='both')
535                {
536                        if (!is_array($app_users))
537                        {
538                                $this->setup_cache();
539                                $cache = &$this->cache['account_split'][$app_user];
540
541                                if (is_array($cache))
542                                {
543                                        return $cache;
544                                }
545                                $app_users = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,$app_users);
546                        }
547                        $accounts = array(
548                                'accounts' => array(),
549                                'groups' => array(),
550                        );
551                        foreach($app_users as $id)
552                        {
553                                $type = $GLOBALS['phpgw']->accounts->get_type($id);
554                                if($type == 'g')
555                                {
556                                        $accounts['groups'][$id] = $id;
557                                        foreach((array)$GLOBALS['phpgw']->acl->get_ids_for_location($id,1,'phpgw_group') as $id)
558                                        {
559                                                $accounts['accounts'][$id] = $id;
560                                        }
561                                }
562                                else
563                                {
564                                        $accounts['accounts'][$id] = $id;
565                                }
566                        }
567
568                        // not sure why they need to be sorted, but we need to remove the keys anyway
569                        sort($accounts['groups']);
570                        sort($accounts['accounts']);
571
572                        if (isset($cache))
573                        {
574                                $cache = $accounts;
575                        }
576                        //echo "<p>accounts::split_accounts(".print_r($app_users,True).",'$use') = <pre>".print_r($accounts,True)."</pre>\n";
577
578                        switch($use)
579                        {
580                                case 'both':
581                                        return $accounts;
582                                case 'groups':
583                                        return $accounts['groups'];
584                                case 'accounts':
585                                        return $accounts['accounts'];
586                                case 'merge':
587                                        return array_merge($accounts['accounts'],$accounts['groups']);
588                        }
589                        return False;
590                }
591
592                /**
593                 * phpgw compatibility function, better use split_accounts
594                 */
595                function return_members($accounts)
596                {
597                        $arr = $this->split_accounts($accounts);
598
599                        return array(
600                                'users'  => $arr['accounts'],
601                                'groups' => $arr['groups'],
602                        );
603                }
604
605                function name2id($name,$which='account_lid')
606                {
607                        $this->setup_cache();
608                        $name_list = &$this->cache['name_list'];
609
610                        if(@isset($name_list[$which][$name]) && $name_list[$which][$name])
611                        {
612                                return $name_list[$which][$name];
613                        }
614
615                        /* Don't bother searching for empty account_lid */
616                        if(empty($name))
617                        {
618                                return False;
619                        }
620                        return $name_list[$which][$name] = accounts_::name2id($name,$which);
621                }
622
623                function id2name($account_id,$which='account_lid')
624                {
625                        $this->setup_cache();
626                        $id_list = &$this->cache['id_list'];
627
628                        if (! $account_id)
629                        {
630                                return False;
631                        }
632
633                        if($id_list[$account_id][$which])
634                        {
635                                return $id_list[$account_id][$which];
636                        }
637                        return $id_list[$account_id][$which] = accounts_::id2name($account_id,$which);
638                }
639
640                function get_type($accountid)
641                {
642                        $this->setup_cache();
643                        $account_type = &$this->cache['account_type'];
644
645                        $account_id = get_account_id($accountid);
646
647                        if (isset($this->account_type) && $account_id == $this->account_id)
648                        {
649                                return $this->account_type;
650                        }
651
652                        if(@isset($account_type[$account_id]) && @$account_type[$account_id])
653                        {
654                                return $account_type[$account_id];
655                        }
656                        elseif($account_id == '')
657                        {
658                                return False;
659                        }
660                        return $account_type[$account_id] = accounts_::get_type($account_id);
661                }
662
663                function get_account_name($accountid,&$lid,&$fname,&$lname)
664                {
665                        $this->setup_cache();
666                        $account_name = &$this->cache['account_name'];
667
668                        $account_id = get_account_id($accountid);
669                        if(isset($account_name[$account_id]))
670                        {
671                                $lid = $account_name[$account_id]['lid'];
672                                $fname = $account_name[$account_id]['fname'];
673                                $lname = $account_name[$account_id]['lname'];
674                                return $account_name[$account_id] !== False;
675                        }
676                        $Ok = accounts_::get_account_name($accountid,$lid,$fname,$lname);
677
678                        $account_name[$account_id] = array(
679                                'lid' => $lid,
680                                'fname' => $fname,
681                                'lname' => $lname,
682                        );
683                        return $Ok;
684                }
685
686                function get_account_data($account_id)
687                {
688                        $this->account_id = $account_id;
689                        $this->read_repository();
690
691                        $data[$this->data['account_id']]['lid']       = $this->data['account_lid'];
692                        $data[$this->data['account_id']]['firstname'] = $this->data['firstname'];
693                        $data[$this->data['account_id']]['lastname']  = $this->data['lastname'];
694                        $data[$this->data['account_id']]['fullname']  = $this->data['fullname'];
695                        $data[$this->data['account_id']]['type']      = $this->data['account_type'];
696
697                        return $data;
698                }
699        }
Note: See TracBrowser for help on using the repository browser.