phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api/class.setup.php, 1.1.1.1.2.17


From: nomail
Subject: [Phpgroupware-cvs] api/class.setup.php, 1.1.1.1.2.17
Date: Thu, 20 May 2004 17:59:56 -0000

Update of /api
Modified Files:
        Branch: proposal-branch
          class.setup.php

date: 2004/04/16 20:59:49;  author: seek3r;  state: Exp;  lines: +190 -147

Log Message:
bringing savannah cvs back up to date with what we were doing on our private 
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
Index: api/class.setup.php
diff -u api/class.setup.php:1.1.1.1.2.16 api/class.setup.php:1.1.1.1.2.17
--- api/class.setup.php:1.1.1.1.2.16    Wed Feb 25 18:31:42 2004
+++ api/class.setup.php Fri Apr 16 20:59:49 2004
@@ -28,63 +28,94 @@
        {
                var $sp;
                var $errors;
-               var $app_data = array();
+               var $apps_data = array();
                var $flow = array();
                var $install_log = array();
 
                function start()
                {
-                       //print_r($GLOBALS['phpgw_data']); exit;
                        $args = new safe_args();
                        $args->set('stage', '0', 'int');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args = $args->get(func_get_args());
                        $rawargs = func_get_args();
-                       if (!empty($rawargs['select_tab']))
+                       $this->install_log = array();
+                       $this->apps_data = array();
+                       if (!empty($rawargs[0]['select_tab']))
                        {
-                               $args['stage'] = $rawargs['select_tab'];
+                               $rawargs[0]['stage'] = 
$rawargs[0]['select_tab'];
+                               $args['stage'] = $rawargs[0]['stage'];
                        }
-                       if(!isset($GLOBALS['phpgw_data']['prefs']['api.skin']))
-                       {
-                               $GLOBALS['phpgw_data']['prefs']['api.skin'] = 
'default';
-                       }
-
-                       
$GLOBALS['phpgw_xml_apinode']->add_node('Setup','title');
                        $GLOBALS['phpgw']->add_xsl('api.setup');
                        $GLOBALS['phpgw']->add_xsl('api.widgets');
+
+                       /* Check to see if we need to force any stage due to 
being in a new install */
                        /* Make sure we have a sane config file. */
                        if(!isset($GLOBALS['phpgw_data']['server']['db_name']) 
||
                           !isset($GLOBALS['phpgw_data']['server']['db_user']) 
||
-                          !isset($GLOBALS['phpgw_data']['server']['db_type']))
+                          !isset($GLOBALS['phpgw_data']['server']['db_type']))
                        {
                                $args['stage'] = '1';
                                $this->install_log['message'] = 'Your config 
file appears to be missing or invalid.';
                        }
                        else
                        {
-                               switch($args['stage'])
+                               /* Check if the tables exist. */
+                               $old_level = error_reporting(0);
+                               $dbresult = 
$GLOBALS['phpgw']->db->Execute('select * from phpgw_acl');
+                               error_reporting($old_level);
+                               if (! $dbresult)
                                {
-                                       case 1:
-                                               
$this->configfile(func_get_args());
-                                               
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 1','subtitle');
-                                               break;
-                                       case 2:
-                                               
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 2','subtitle');
-                                               
$this->installer(func_get_args());
-                                               break;
-                                       case 3:
-                                               
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 3','subtitle');
-                                               //$this->config();
-                                               //$this->install_log['message'] 
= 'Config.';
-                                               break;
-                                       case 4:
-                                               
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 4','subtitle');
-                                               
$this->initial_accounts(func_get_args());
-                                               break;
-                                       default:
-                                               
$GLOBALS['phpgw_xml_apinode']->add_node('Welcome','subtitle');
-                                               $this->install_log['message'] = 
'Welcome to the setup program. Please choose the task you want to accomplish.';
-                               }                                               
+                                       $args['stage'] = '2';
+                               }
+                               /* and if so, see if we have any required 
records. */
+                               elseif ($dbresult->RecordCount() == 0)
+                               {
+                                       $args['stage'] = '4';
+                               }
+                       }
+
+                       if(!isset($GLOBALS['phpgw_data']['prefs']['api.skin']))
+                       {
+                               $GLOBALS['phpgw_data']['prefs']['api.skin'] = 
'default';
                        }
+
+                       switch($args['stage'])
+                       {
+                               case 1:
+                                       $this->configfile($rawargs[0]);
+                                       
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 1','subtitle');
+                                       break;
+                               case 2:
+                                       
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 2','subtitle');
+                                       $this->installer($rawargs[0]);
+                                       break;
+                               case 3:
+                                       
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 3','subtitle');
+                                       //$this->config();
+                                       //$this->install_log['message'] = 
'Config.';
+                                       break;
+                               case 4:
+                                       
$GLOBALS['phpgw_xml_apinode']->add_node('Stage 4','subtitle');
+                                       $this->initial_accounts($rawargs[0]);
+                                       break;
+                               /* something like this will be useful as part 
of the devapp we intend to build
+                               case 5:
+                                       require_once(PHPGW_API . SEP . 'db' . 
SEP . 'adodb.inc.php');
+                                       $tmpdb       = 
ADONewConnection($GLOBALS['phpgw_data']['server']['db_type']);
+                                       
$tmpdb->Connect("localhost","root","rootpass","yourdatabase");
+                                       $res = $tmpdb->Execute("show tables;");
+                                       
require_once(PHPGW_ROOT.SEP.'api'.SEP.'db'.SEP.'adodb-xmlschema.inc.php');
+                                       $schema = new adoSchema($tmpdb );
+                                       $schemaFile = 
PHPGW_ROOT.SEP.$data['name'].SEP.'setup'.SEP.'tables.xml';
+                                       echo $schema->ExtractSchema();
+                                       exit;
+                                       break;
+                               */
+                               default:
+                                       
$GLOBALS['phpgw_xml_apinode']->add_node('Welcome','subtitle');
+                                       $this->install_log['message'] = 
'Welcome to the setup program. Please choose the task you want to accomplish.';
+                       }                                               
+
                        $this->install_log['stage'] = $args['stage'];
 
                        $this->install_log['tab_widget'] = array(
@@ -112,42 +143,47 @@
 
                        if ($args['stage'])
                        {
-                               
$this->install_log['tab_widget'][($args['stage'] - 1)]['current'] = True;
+                               
$this->install_log['tab_widget'][($args['stage'] - 1)]['current'] = true;
                        }
                        else
                        {
-                               $this->install_log['tab_widget'][0]['current'] 
= True;
+                               $this->install_log['tab_widget'][0]['current'] 
= true;
                        }
-
                        return $this->install_log;
                }
 
                function configfile()
                {
                        $args = new safe_args();
-                       $args->set('action', '##NOTSET##', 'any');
-                       $args->set('db_host', '##NOTSET##');
-                       $args->set('db_name', '##NOTSET##');
-                       $args->set('db_user', '##NOTSET##');
-                       $args->set('db_pass', '##NOTSET##');
-                       $args->set('db_type', '##NOTSET##');
-                       $args->set('base_url', 'index.php', 'any');
+                       $args->set('action', NOTSET, 'any');
+                       $args->set('db_host', NOTSET);
+                       $args->set('db_name', NOTSET);
+                       $args->set('db_user', NOTSET);
+                       $args->set('db_pass', NOTSET);
+                       $args->set('db_type', NOTSET);
+                       $args->set('baseurl', 'index.php', 'any');
                        $args->set('default_anon_op', 'api.base.start', 'any');
-                       $args->set('session_type', '##NOTSET##');
-                       $args->set('session_method', '##NOTSET##');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args->set('session_type', NOTSET);
+                       $args->set('session_method', NOTSET);
+                       $args->set('err_report', 1015, 'int');
+                       $args->set('err_log', 0, 'int');
+                       $args->set('err_email', 0, 'int');
+                       $args->set('log_table', NOTSET);
+                       $args->set('log_file', NOTSET);
+                       $args->set('log_email', NOTSET);
+                       $args = $args->get(func_get_args());
 
                        if(isset($args['action']))
                        {
-                               if(empty($args['base_url']))
+                               if(empty($args['baseurl']))
                                {
-                                       $args['base_url'] = 'index.php';
+                                       $args['baseurl'] = 'index.php';
                                }
                                if(!isset($args['db_name']) ||
                                   !isset($args['db_user'])
                                  )
                                {
-                                       $GLOBALS['msgbox']->add('Not all 
required params were set!',__LINE__,__FILE__, 'warning');
+                                       $GLOBALS['msgbox']->add('Not all 
required params were set!', 'warning');
                                        return $this->editconfigfile();         
                
                                }
 
@@ -156,18 +192,25 @@
                                $config['server']['db_user'] = $args['db_user'];
                                $config['server']['db_pass'] = $args['db_pass'];
                                $config['server']['db_type'] = $args['db_type'];
-                               $config['server']['base_url'] = 
$args['base_url'];
+                               $config['server']['baseurl'] = $args['baseurl'];
                                $config['server']['default_anon_op'] = 
$args['default_anon_op'];
                                $config['server']['session_type'] = 
$args['session_type'];
                                $config['server']['session_method'] = 
$args['session_method'];
+                               $config['errconf']['err_report'] = 
$args['err_report'];
+                               $config['errconf']['err_log'] = 
$args['err_log'];
+                               $config['errconf']['err_email'] = 
$args['err_email'];
+                               $config['errconf']['log_table'] = 
$args['log_table'];
+                               $config['errconf']['log_file'] = 
$args['log_file'];
+                               $config['errconf']['log_email'] = 
$args['log_email'];
                                $filecontents = '<?php'."\n";
                                $filecontents .= '$phpgw_config = '."'";
-                               $filecontents .= var2xml(array('data'=>$config, 
'name'=>'config'));
+                               $filecontents .= var2xml($config, 'config');
                                $filecontents .= "';";
 
                                switch($args['action'])
                                {
                                        case 'download':
+                                               define('PHPGW_FINISHED', true);
                                                header('Content-disposition: 
attachment; filename="config.inc.php"');
                                                header('Content-type: 
application/octet-stream');
                                                header('Pragma: no-cache');
@@ -176,7 +219,7 @@
                                                exit;
                                                break;
                                        case 'view':
-                                                       
$GLOBALS['msgbox']->add('This is your config.',__LINE__,__FILE__, 'notice');
+                                                       
$GLOBALS['msgbox']->add('This is your config.', 'notice');
                                                        
$config['server']['text'] = $filecontents;
                                                        $config['configtext'] = 
$filecontents;
                                                 return $config;
@@ -187,16 +230,17 @@
                                                        $fsetup = 
fopen(PHPGW_ROOT.SEP.'config.inc.php','wb');
                                                        
fwrite($fsetup,$filecontents);
                                                        fclose($fsetup);
-                                                       
$GLOBALS['msgbox']->add('Config File Saved!',__LINE__,__FILE__, 'notice');
+                                                       
$GLOBALS['msgbox']->add('Config File Saved!', 'notice');
                                                        break;
                                                }
                                                else
                                                {
-                                                       
$GLOBALS['msgbox']->add('Could not save file!',__LINE__,__FILE__, 'warning');
+                                                       
$GLOBALS['msgbox']->add('Could not save file!', 'warning');
                                                        return 
$this->editconfigfile();                         
                                                }
                                                break;
                                }
+                               define('PHPGW_FINISHED', true);
                                echo $filecontents;
                                exit;
                        }
@@ -212,7 +256,7 @@
                        if(is_writeable(PHPGW_ROOT.SEP.'config.inc.php') ||
                          (!file_exists(PHPGW_ROOT.SEP.'config.inc.php') && 
is_writeable(PHPGW_ROOT)))
                        {
-                               $this->install_log['allow_write_file'] = True;
+                               $this->install_log['allow_write_file'] = true;
                        }
                        $this->install_log['stage'] = '1';
                        return $this->install_log;
@@ -222,7 +266,7 @@
                {
                        $args = new safe_args();
                        $args->set('action', 'View');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args = $args->get(func_get_args());
                        /* for now it will get the app list from the dir itself 
*/
                        if (is_dir(PHPGW_ROOT))
                        {
@@ -235,16 +279,7 @@
                                                        $setup_xml_file = 
PHPGW_ROOT.SEP.$dir.SEP.'setup'.SEP.'setup.xml';
                                                        
if(file_exists($setup_xml_file))
                                                        {
-                                                               
if(!function_exists('file_get_contents'))
-                                                               {
-                                                                       $file = 
fopen($setup_xml_file, 'r');
-                                                                       $xml = 
fread($file, filesize($setup_xml_file));
-                                                                       
fclose($file);
-                                                               }
-                                                               else
-                                                               {
-                                                                       $xml = 
file_get_contents ($setup_xml_file);
-                                                               }
+                                                               $xml = 
file_get_contents ($setup_xml_file);
                                                                
$this->apps_data[] = xml2var($xml);
                                                        }
                                                }
@@ -256,12 +291,13 @@
                        switch($args['action'])
                        {
                                case 'View':
-                                       $apps = createobject('api_apps');
+                                       $old_level = error_reporting(0);
+                                       $apps = createObject('api_apps');
                                        $this->install_log['install_app'] = 
array();
                                        foreach($this->apps_data as $val)
                                        {
                                                $current_version = 
$apps->get_version($val);
-                                               if ($current_version == False)
+                                               if ($current_version == false)
                                                {
                                                        
$this->install_log['install_app'][] = 
array('name'=>$val['title'].'('.$val['version'].')', 'status'=>'Not installed');
                                                }
@@ -278,13 +314,14 @@
                                                        
$this->install_log['install_app'][] = 
array('name'=>$val['title'].'('.$val['version'].')', 'status'=>'Installed');
                                                }                               
                        
                                        }                                       
+                                       error_reporting($old_level);
                                        break;
                                case 'Install': 
                                        $this->install_log['install_app'] = 
array();
-                                       $this->flow = 
array('more_depends'=>True,'activity'=>True, 'pass'=>0);
+                                       $this->flow = 
array('more_depends'=>true,'activity'=>true, 'pass'=>0);
                                        while($this->flow['more_depends'] && 
$this->flow['activity'])
                                        {
-                                               $this->flow = 
array('more_depends'=>False,'activity'=>False);
+                                               $this->flow = 
array('more_depends'=>false,'activity'=>false);
                                                reset ($this->apps_data);
                                                foreach($this->apps_data as 
$val)                               
                                                {
@@ -301,50 +338,41 @@
                                        break;
                                case 'Uninstall':
                                        $this->install_log['install_app'] = 
array();
-                                       $this->sp = 
CreateObject('api_schema_proc');
                                        reset ($this->apps_data);
-                                       foreach($this->apps_data as $val)       
                        
+                                       foreach($this->apps_data as $val)       
                                        {
-                                               
if(is_array($val['tables_current']))
-                                               {
-                                                       
foreach($val['tables_current'] as $tablename=>$fields)                          
-                                                       {
-                                                               $status = 
$this->sp->DropTable($tablename);
-                                                       }
-                                               }
+                                               
require_once(PHPGW_ROOT.SEP.'api'.SEP.'db'.SEP.'adodb-xmlschema.inc.php');
+                                               $schema = new 
adoSchema($GLOBALS['phpgw']->db );
+                                               $schemaFile = 
PHPGW_ROOT.SEP.$val['name'].SEP.'setup'.SEP.'tables.xml';
+                                               $schema->RemoveSchema( 
$schemaFile );
+                                               $schema->ExecuteSchema();
                                        }
+                                       
                                        $this->apps_data = array();
-                                       $this->installer();
+                                       $this->installer('View');
                                        break;
                        }
-
-                       $GLOBALS['phpgw']->db->cleanup();
                        return $this->install_log;
                }
 
                function process_install($data)
                {
-                       $apps = createobject('api_apps');
+                       $old_level = error_reporting(0);
+                       $apps = createObject('api_apps');
                        $current_version = $apps->get_version($data['name']);
-                       if ($current_version == False)
+                       if ($current_version == false)
                        {
-                               if(is_array($data['tables_current']))
-                               {
-                                       $this->sp = 
CreateObject('api_schema_proc');
-                                       foreach($data['tables_current'] as 
$tablename=>$fields)                         
-                                       {
-                                               //$GLOBALS['DEBUG'] = True;
-                                               $status = 
$this->sp->CreateTable($tablename,$fields);
-                                               
$this->install_log['install_table'][] = array('name'   => $tablename,
-                                                                              
'status' => ($status ? 'Success' : 'Failed')
-                                               );
-                                       }
-                               }
+                               
require_once(PHPGW_ROOT.SEP.'api'.SEP.'db'.SEP.'adodb-xmlschema.inc.php');
+                               $schema = new adoSchema($GLOBALS['phpgw']->db );
+                               $schemaFile = 
PHPGW_ROOT.SEP.$data['name'].SEP.'setup'.SEP.'tables.xml';
+                               $schema->ParseSchema( $schemaFile );
+                               $schema->ExecuteSchema();
+                               
                                $this->process_hooks($data['hooks']);
                                $this->process_prefs($data['prefs']);
                                if($apps->add($data['name'], $data['title'], 
$data['version']))
                                {
-                                       $this->flow['activity'] = True;
+                                       $this->flow['activity'] = true;
                                        $this->install_log['install_app'][] = 
array('name'   => $data['name'],
                                                                       'status' 
=> 'Installed'
                                        );
@@ -356,7 +384,7 @@
                                                        $al = $acl_location;
                                                        
$GLOBALS['phpgw']->db->query("insert into phpgw_acl_locations 
(loc_op,loc_title,loc_value) values ('"
                                                                . $al['op'] . 
"','" . addslashes($al['title']) . "','" . $al['value']
-                                                               . 
"')",__LINE__,__FILE__);
+                                                               . "')");
                                                }
                                                else
                                                {
@@ -366,21 +394,30 @@
                                                                $al = 
$acl_location[$i];
                                                                
$GLOBALS['phpgw']->db->query("insert into phpgw_acl_locations 
(loc_op,loc_title,loc_value) values ('"
                                                                        . 
$al['op'] . "','" . addslashes($al['title']) . "','" . $al['value']
-                                                                       . 
"')",__LINE__,__FILE__);
+                                                                       . "')");
                                                        }
                                                }
                                        }
+
+                                       foreach ($data['datamine_locations'] as 
$key => $datamine_location)
+                                       {
+                                               
$GLOBALS['phpgw']->db->execute("INSERT INTO phpgw_datamine_locations "
+                                                       . 
"(dml_type,dml_title,dml_op) VALUES ('-','"
+                                                       . 
$datamine_location['title'] . "','" . $datamine_location['op']
+                                                       . "')");
+                                       
+                                       }
                                }
                                else
                                {
-                                       $this->flow['more_depends'] = True;
+                                       $this->flow['more_depends'] = true;
                                }
                        }
                        elseif(alessthanb($current_version,$data['version']))
                        {
                                //$this->process_hooks($data['hooks']);
                                //$apps->add($data['name'], $data['title'], 
$data['version']);
-                               $this->flow['activity'] = True;
+                               $this->flow['activity'] = true;
                                $this->install_log['install_app'][] = 
array('name'   => $data['name'],
                                                               'status' => 
'Upgraded'
                                );
@@ -391,11 +428,12 @@
                                                               'status' => 'Up 
to Date'
                                );
                        }
+                       error_reporting($old_level);
                }
 
-               function process_depends($data = '##NOTSET##')
+               function process_depends($data = NOTSET)
                {
-                       if($data != '##NOTSET##' && is_array($data))
+                       if($data != NOTSET && is_array($data))
                        {
                                if(array_key_exists(0,$data['on']))
                                {
@@ -411,23 +449,23 @@
                        }
                }
                
-               function process_depends_sub($data = '##NOTSET##')
+               function process_depends_sub($data = NOTSET)
                {
-                       if($data != '##NOTSET##' && is_array($data))
+                       if($data != NOTSET && is_array($data))
                        {
                                $dep_version = $apps->get_version($data['app']);
                                if($dep_version < $data['version'])
                                {
-                                       $this->flow['more_depends'] = True;
+                                       $this->flow['more_depends'] = true;
                                        return;
                                }
                        }
                }
 
-               function process_hooks($data = '##NOTSET##')
+               function process_hooks($data = NOTSET)
                {
-                       $hooks = createobject('api_hooks');
-                       if($data != '##NOTSET##' && is_array($data))
+                       $hooks = createObject('api_hooks');
+                       if($data != NOTSET && is_array($data))
                        {
                                foreach($data as $hook_type=>$hook_list)        
                        
                                {
@@ -463,10 +501,10 @@
                        }
                }
                
-               function process_prefs($data = '##NOTSET##')
+               function process_prefs($data = NOTSET)
                {
-                       $prefs = createobject('api_prefs', 
array('account_id'=>'phpgw_default'));
-                       if($data != '##NOTSET##' && 
is_array($data['prefs_item']))
+                       $prefs = createObject('api_prefs', 
array('account_id'=>'phpgw_default'));
+                       if($data != NOTSET && is_array($data['prefs_item']))
                        {
                                foreach($data['prefs_item'] as $val)            
                
                                {
@@ -478,12 +516,12 @@
                function initial_accounts ()
                {
                        $args = new safe_args();
-                       $args->set('admin_lid', '##NOTSET##', 'any');
+                       $args->set('admin_lid', NOTSET, 'any');
                        $args->set('admin_pass', '');
                        $args->set('admin_fname');
                        $args->set('admin_lname');
                        $args->set('create_anon');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
+                       $args = $args->get(func_get_args());
 
                        if (isset($args['admin_lid']))
                        {
@@ -499,29 +537,31 @@
                                $admin_account_info['account_status']    = 'A';
                                $admin_account_info['account_expires']   = 
mktime (0,0,0,12,31,2005);
                                $admin_id                                = 
$accounts->create($admin_account_info);
-                               $history_values = array(
-                                       'account_lid'       => 
$args['admin_lid'],
-                                       'account_firstname' => 
$args['admin_fname'],
-                                       'account_lastname'  => 
$args['admin_lname'],
-                                       'account_status'    => 'A'
-
-                               );
-                               $history->set('api.accounts.' . 
$admin_id,$history_values,array());
+                               if(!is_null($admin_id))
+                               {
+                                       $history_values = array(
+                                               'account_lid'       => 
$args['admin_lid'],
+                                               'account_firstname' => 
$args['admin_fname'],
+                                               'account_lastname'  => 
$args['admin_lname'],
+                                               'account_status'    => 'A'
+                                       );
+                                       $history->set('api.accounts.' . 
$admin_id,$history_values,array());
 
-                               $all_acl = createObject('api_acl', 
array('account_id' => 0));
-                               $all_acl->add('api',63,1);
-                               $all_acl->add('api.base.about',1);
-                               $all_acl->add('api.base.login',1);
+                                       $all_acl = createObject('api_acl', 
array('account_id' => 0));
+                                       $all_acl->add('api',63,1);
+                                       $all_acl->add('api.base.about',1);
+                                       $all_acl->add('api.base.login',1);
                                
-                               $admin_acl = createObject('api_acl', 
array('account_id' => $admin_id));
-                               $admin_acl->add('.',63);
-                               $admin_acl->add('api.base',63);
-                               $admin_acl->add('api.prefs.save',1);
-                               $admin_acl->add('api.setup',63);
-                               $admin_acl->add('api.admin',63);
-                               $admin_acl->add('api.account_mgr',63);
+                                       $admin_acl = createObject('api_acl', 
array('account_id' => $admin_id));
+                                       $admin_acl->add('.',63);
+                                       $admin_acl->add('api.base',63);
+                                       $admin_acl->add('api.prefs.save',1);
+                                       $admin_acl->add('api.setup',63);
+                                       $admin_acl->add('api.admin',63);
+                                       $admin_acl->add('api.account_mgr',63);
 
-                               $this->install_log['text'] = 'Admin account 
'.$args['admin_lid'].' was created.';
+                                       $this->install_log['text'] = 'Admin 
account '.$args['admin_lid'].' was created.';
+                               }
                                if($args['create_anon'] = 'yes')
                                {
                                        $anon_account_info['account_lid']       
= 'anonymous';
@@ -533,17 +573,20 @@
                                        $anon_account_info['account_expires']   
= mktime (0,0,0,12,31,2009);
                                        $anon_id                                
= $accounts->create($anon_account_info);
 
-                                       $history_values = array(
-                                               'account_lid'       => 
'anonymous',
-                                               'account_firstname' => 
'Anonymous',
-                                               'account_lastname'  => 'User',
-                                               'account_status'    => 'A'
-                                       );
-                                       $history->set('api.accounts.' . 
$anon_id,$history_values,array());
+                                       if(!is_null($admin_id))
+                                       {
+                                               $history_values = array(
+                                                       'account_lid'       => 
'anonymous',
+                                                       'account_firstname' => 
'Anonymous',
+                                                       'account_lastname'  => 
'User',
+                                                       'account_status'    => 
'A'
+                                               );
+                                               $history->set('api.accounts.' . 
$anon_id,$history_values,array());
 
-                                       $anon_acl = createObject('api_acl', 
array('account_id'=>$anon_id));
-                                       $anon_acl->add('wcm.base',1);
-                                       $this->install_log['text'] .= ' 
Anonymous account was created.';
+                                               $anon_acl = 
createObject('api_acl', array('account_id'=>$anon_id));
+                                               $anon_acl->add('wcm.base',1);
+                                               $this->install_log['text'] .= ' 
Anonymous account was created.';
+                                       }
                                }
                        }
                        else




reply via email to

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