source: companies/serpro/phpgwapi/inc/class.accounts.inc.php @ 903

Revision 903, 22.4 KB checked in by niltonneto, 15 years ago (diff)

Importacao inicial do Expresso do Serpro

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='',$new_filter='')
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                                $new_filter = $p['new_filter'];
312                        }
313                        else
314                        {
315                                $p = array(
316                                        'type' => $_type,
317                                        'start' => $start,
318                                        'order' => $order,
319                                        'query' => $query,
320                                        'offset' => $offset,
321                                        'query_type' => $query_type ,
322                                        'new_filter' => $new_filter,
323                                );
324                        }
325                        $serial = serialize($p);
326
327                        if (isset($account_list[$serial]))
328                        {
329                                $this->total = $account_list[$serial]['total'];
330                        }
331                        else
332                        {
333                                $account_list[$serial]['data'] = accounts_::get_list($_type,$start,$sort,$order,$query,$offset,$query_type,$new_filter);
334                                $account_list[$serial]['total'] = $this->total;
335                        }
336                        return $account_list[$serial]['data'];
337                }
338
339                function is_expired()
340                {
341                        if ($this->data['expires'] != -1 && $this->data['expires'] < time())
342                        {
343                                return True;
344                        }
345                        else
346                        {
347                                return False;
348                        }
349                }
350
351                /**
352                * Invalidate the cache (or parts of it) after change in $account_id
353                *
354                * Atm simplest approach - delete it all ;-)
355                */
356                function cache_invalidate($account_id)
357                {
358                        //echo "<p>accounts::cache_invalidate($account_id)</p>\n";
359                        $GLOBALS['phpgw_info']['accounts']['cache'] = array();
360                }
361
362                function save_repository()
363                {
364                        $this->cache_invalidate($this->account_id);
365                        accounts_::save_repository();
366                }
367
368                function delete($accountid)
369                {
370                        $this->cache_invalidate($accountid);
371                        accounts_::delete($accountid);
372
373                        // delete all acl_entries belonging to that user or group
374                        $GLOBALS['phpgw']->acl->delete_account($accountid);
375                }
376
377                function create($account_info,$default_prefs=True)
378                {
379                        $account_id = accounts_::create($account_info,$default_prefs);
380                        $this->cache_invalidate($account_id);
381
382                        return $account_id;
383                }
384
385                function read_repository()
386                {
387                        $this->setup_cache();
388                        $account_data = &$this->cache['account_data'];
389
390                        if (isset($account_data[$this->account_id]))
391                        {
392                                return $this->data = $account_data[$this->account_id];
393                        }
394                        return $account_data[$this->account_id] = accounts_::read_repository();
395                }
396
397                function read()
398                {
399                        if (count($this->data) == 0)
400                        {
401                                $this->read_repository();
402                        }
403
404                        reset($this->data);
405                        return $this->data;
406                }
407
408                function update_data($data)
409                {
410                        reset($data);
411                        $this->data = Array();
412                        $this->data = $data;
413
414                        reset($this->data);
415                        return $this->data;
416                }
417
418                function membership($accountid = '')
419                {
420                        $this->setup_cache();
421                        $membership_list = &$this->cache['membership_list'];
422
423                        $account_id = get_account_id($accountid);
424
425                        if (isset($membership_list[$account_id]))
426                        {
427                                return $membership_list[$account_id];
428                        }
429
430                        $security_equals = Array();
431                        $security_equals = $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1, $account_id);
432
433                        if ($security_equals == False)
434                        {
435                                return $membership_list[$account_id] = False;
436                        }
437
438                        $this->memberships = Array();
439
440                        for ($idx=0; $idx<count($security_equals); $idx++)
441                        {
442                                $groups = (int)$security_equals[$idx];
443                                $this->memberships[] = Array('account_id' => $groups, 'account_name' => $this->id2name($groups));
444                        }
445
446                        return $membership_list[$account_id] = $this->memberships;
447                }
448
449                function member($accountid = '')
450                {
451                        $account_id = get_account_id($accountid);
452
453                        $security_equals = Array();
454                        $acl = CreateObject('phpgwapi.acl');
455                        $security_equals = $acl->get_ids_for_location($account_id, 1, 'phpgw_group');
456                        unset($acl);
457
458                        if ($security_equals == False)
459                        {
460                                return False;
461                        }
462
463                        for ($idx=0; $idx<count($security_equals); $idx++)
464                        {
465                                $name = $this->id2name((int)$security_equals[$idx]);
466                                $this->members[] = Array('account_id' => (int)$security_equals[$idx], 'account_name' => $name);
467                        }
468
469                        return $this->members;
470                }
471
472                /*!
473                @function get_nextid
474                @abstract Using the common functions next_id and last_id, find the next available account_id
475                @param $account_type (optional, default to 'u')
476                */
477                // NOTE: to my knowledge this is not used any more RalfBecker 2004/06/15
478                function get_nextid($account_type='u')
479                {
480                        $min = $GLOBALS['phpgw_info']['server']['account_min_id'] ? $GLOBALS['phpgw_info']['server']['account_min_id'] : 0;
481                        $max = $GLOBALS['phpgw_info']['server']['account_max_id'] ? $GLOBALS['phpgw_info']['server']['account_max_id'] : 0;
482
483                        if ($account_type == 'g')
484                        {
485                                $type = 'groups';
486                        }
487                        else
488                        {
489                                $type = 'accounts';
490                        }
491                        $nextid = (int)$GLOBALS['phpgw']->common->last_id($type,$min,$max);
492
493                        /* Loop until we find a free id */
494                        $free = 0;
495                        while (!$free)
496                        {
497                                $account_lid = '';
498                                //echo '<br>calling search for id: '.$nextid;
499                                if ($this->exists($nextid))
500                                {
501                                        $nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
502                                }
503                                else
504                                {
505                                        $account_lid = $this->id2name($nextid);
506                                        /* echo '<br>calling search for lid: '.$account_lid . '(from account_id=' . $nextid . ')'; */
507                                        if ($this->exists($account_lid))
508                                        {
509                                                $nextid = (int)$GLOBALS['phpgw']->common->next_id($type,$min,$max);
510                                        }
511                                        else
512                                        {
513                                                $free = True;
514                                        }
515                                }
516                        }
517                        if      ($GLOBALS['phpgw_info']['server']['account_max_id'] &&
518                                ($nextid > $GLOBALS['phpgw_info']['server']['account_max_id']))
519                        {
520                                return False;
521                        }
522                        /* echo '<br>using'.$nextid;exit; */
523                        return $nextid;
524                }
525
526
527                /**
528                * splits users and groups from a array of id's or the accounts with run-rights for a given app-name
529                *
530                * @param $app_users array of user-id's or app-name (if you use app-name the result gets cached!)
531                * @param $use string what should be returned only an array with id's of either 'accounts' or 'groups'.
532                *       Or an array with arrays for 'both' under the keys 'groups' and 'accounts' or 'merge' for accounts
533                *       and groups merged into one array
534                * @return see $use
535                */
536                function split_accounts($app_users,$use='both')
537                {
538                        if (!is_array($app_users))
539                        {
540                                $this->setup_cache();
541                                $cache = &$this->cache['account_split'][$app_user];
542
543                                if (is_array($cache))
544                                {
545                                        return $cache;
546                                }
547                                $app_users = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,$app_users);
548                        }
549                        $accounts = array(
550                                'accounts' => array(),
551                                'groups' => array(),
552                        );
553                        foreach($app_users as $id)
554                        {
555                                $type = $GLOBALS['phpgw']->accounts->get_type($id);
556                                if($type == 'g')
557                                {
558                                        $accounts['groups'][$id] = $id;
559                                        foreach((array)$GLOBALS['phpgw']->acl->get_ids_for_location($id,1,'phpgw_group') as $id)
560                                        {
561                                                $accounts['accounts'][$id] = $id;
562                                        }
563                                }
564                                else
565                                {
566                                        $accounts['accounts'][$id] = $id;
567                                }
568                        }
569
570                        // not sure why they need to be sorted, but we need to remove the keys anyway
571                        sort($accounts['groups']);
572                        sort($accounts['accounts']);
573
574                        if (isset($cache))
575                        {
576                                $cache = $accounts;
577                        }
578                        //echo "<p>accounts::split_accounts(".print_r($app_users,True).",'$use') = <pre>".print_r($accounts,True)."</pre>\n";
579
580                        switch($use)
581                        {
582                                case 'both':
583                                        return $accounts;
584                                case 'groups':
585                                        return $accounts['groups'];
586                                case 'accounts':
587                                        return $accounts['accounts'];
588                                case 'merge':
589                                        return array_merge($accounts['accounts'],$accounts['groups']);
590                        }
591                        return False;
592                }
593
594                /**
595                 * phpgw compatibility function, better use split_accounts
596                 */
597                function return_members($accounts)
598                {
599                        $arr = $this->split_accounts($accounts);
600
601                        return array(
602                                'users'  => $arr['accounts'],
603                                'groups' => $arr['groups'],
604                        );
605                }
606
607                function name2id($name,$which='account_lid')
608                {
609                        $this->setup_cache();
610                        $name_list = &$this->cache['name_list'];
611
612                        if(@isset($name_list[$which][$name]) && $name_list[$which][$name])
613                        {
614                                return $name_list[$which][$name];
615                        }
616
617                        /* Don't bother searching for empty account_lid */
618                        if(empty($name))
619                        {
620                                return False;
621                        }
622                        return $name_list[$which][$name] = accounts_::name2id($name,$which);
623                }
624
625                function id2name($account_id,$which='account_lid')
626                {
627                        $this->setup_cache();
628                        $id_list = &$this->cache['id_list'];
629
630                        if (! $account_id)
631                        {
632                                return False;
633                        }
634
635                        if($id_list[$account_id][$which])
636                        {
637                                return $id_list[$account_id][$which];
638                        }
639                        return $id_list[$account_id][$which] = accounts_::id2name($account_id,$which);
640                }
641
642                function get_type($accountid)
643                {
644                        $this->setup_cache();
645                        $account_type = &$this->cache['account_type'];
646
647                        $account_id = get_account_id($accountid);
648
649                        if (isset($this->account_type) && $account_id == $this->account_id)
650                        {
651                                return $this->account_type;
652                        }
653
654                        if(@isset($account_type[$account_id]) && @$account_type[$account_id])
655                        {
656                                return $account_type[$account_id];
657                        }
658                        elseif($account_id == '')
659                        {
660                                return False;
661                        }
662                        return $account_type[$account_id] = accounts_::get_type($account_id);
663                }
664
665                function get_account_name($accountid,&$lid,&$fname,&$lname)
666                {
667                        $this->setup_cache();
668                        $account_name = &$this->cache['account_name'];
669
670                        $account_id = get_account_id($accountid);
671                        if(isset($account_name[$account_id]))
672                        {
673                                $lid = $account_name[$account_id]['lid'];
674                                $fname = $account_name[$account_id]['fname'];
675                                $lname = $account_name[$account_id]['lname'];
676                                return $account_name[$account_id] !== False;
677                        }
678                        $Ok = accounts_::get_account_name($accountid,$lid,$fname,$lname);
679
680                        $account_name[$account_id] = array(
681                                'lid' => $lid,
682                                'fname' => $fname,
683                                'lname' => $lname,
684                        );
685                        return $Ok;
686                }
687
688                function get_account_data($account_id)
689                {
690                        $this->account_id = $account_id;
691                        $this->read_repository();
692
693                        $data[$this->data['account_id']]['lid']       = $this->data['account_lid'];
694                        $data[$this->data['account_id']]['firstname'] = $this->data['firstname'];
695                        $data[$this->data['account_id']]['lastname']  = $this->data['lastname'];
696                        $data[$this->data['account_id']]['fullname']  = $this->data['fullname'];
697                        $data[$this->data['account_id']]['type']      = $this->data['account_type'];
698
699                        return $data;
700                }
701        }
Note: See TracBrowser for help on using the repository browser.