phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] api class.admin.php,NONE,1.1.2.1


From: Dan Kuykendall <address@hidden>
Subject: [Phpgroupware-cvs] api class.admin.php,NONE,1.1.2.1
Date: Fri, 24 Oct 2003 06:23:07 +0000

Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv30874/api

Added Files:
      Tag: proposal-branch
        class.admin.php 
Log Message:
made main menu a little dynamic, moved admin class to the api and removed the 
admin app

--- NEW FILE: class.admin.php ---
<?php
        
/**************************************************************************\
        * phpGroupWare                                                          
   *
        * http://www.phpgroupware.org                                           
   *
        * This file written by Dan Kuykendall <address@hidden>                 *
        * Copyright (C) 2003 Dan Kuykendall                                     
   *
        * 
-------------------------------------------------------------------------*
        * This program 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.                                            
   *
        
\**************************************************************************/

        /* $Id: class.admin.php,v 1.1.2.1 2003/10/24 06:23:05 seek3r Exp $ */
        /* $Source: /cvsroot/phpgroupware/api/Attic/class.admin.php,v $ */

        class api_admin
        {
                function start()
                {
                        $result['text'] = '|| admin app ||';
                        $GLOBALS['phpgw']->add_xsl('api.admin');
                        
$GLOBALS['phpgw_xml_apinode']->add_node('Admin','title');
                        return $result;
                }
                function adduser ()
                {
                        $args = new safe_args();
                        $args->set('username');
                        $args->set('passwd', '');
                        $args->set('fname', '');
                        $args->set('lname', '');
                        $args->set('isadmin', False, 'bool');
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
                        
$GLOBALS['phpgw_xml_apinode']->add_node('Admin','title');
                        $GLOBALS['phpgw_xml_apinode']->add_node('Add 
User','subtitle');

                        if (isset($args['username']))
                        {
                                $account_info['account_lid']       = 
$args['username'];
                                $account_info['account_passwd']    = 
$args['passwd'];
                                $account_info['account_firstname'] = 
$args['fname'];
                                $account_info['account_lastname']  = 
$args['lname'];
                                $account_info['account_type']      = 'u';
                                $account_info['account_status']    = 'A';
                                $account_info['account_expires']   = mktime 
(0,0,0,12,31,2005);
                                $newid = 
$GLOBALS['phpgw']->accounts->create($account_info);
                                if($newid === False)
                                {
                                        $result['text'] = '';
                                        return $result;
                                }
                                $result['text'] = 'Created 
'.$args['username'].' which has id of '.$newid;

                                $acl = createobject('api_acl', 
array('account_id'=>$newid));
                                if($args['username'])
                                {
                                        $acl->add('.',63);
                                }
                                else
                                {
                                        $acl->add('api.base',1);
                                        $acl->add('skel.base',1);
                                        $acl->add('wcm.base',1);
                                        $acl->add('admin.base',1);
                                }
                        }
                        else
                        {
                                $result['text'] = 'Enter details';
                        }
                        $GLOBALS['phpgw']->add_xsl('api.admin_adduser');
                        return $result;
                }       
        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]