this is now setup3 code

This commit is contained in:
seek3r 2001-07-30 15:59:25 +00:00
parent cd3f5a90dc
commit 9218a82cbd
69 changed files with 16264 additions and 0 deletions

470
setup/applications.php Normal file
View File

@ -0,0 +1,470 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$DEBUG = False;
// TODO: We allow a user to hose their setup here, need to make use
// of dependencies so they are warned that they are pulling the rug
// out from under other apps. e.g. if they select to uninstall the api
// this will happen without further warning.
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include ('./inc/functions.inc.php');
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_main' => 'applications.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$setup_tpl->set_block('T_setup_main','header','header');
$setup_tpl->set_block('T_setup_main','app_header','app_header');
$setup_tpl->set_block('T_setup_main','apps','apps');
$setup_tpl->set_block('T_setup_main','detail','detail');
$setup_tpl->set_block('T_setup_main','table','table');
$setup_tpl->set_block('T_setup_main','hook','hook');
$setup_tpl->set_block('T_setup_main','dep','dep');
$setup_tpl->set_block('T_setup_main','app_footer','app_footer');
$setup_tpl->set_block('T_setup_main','submit','submit');
$setup_tpl->set_block('T_setup_main','footer','footer');
// Check header and authentication
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
if ($phpgw_info['setup']['stage']['header'] != '10')
{
Header("Location: manageheader.php");
exit;
}
elseif (!$phpgw_setup->auth('Config'))
{
$phpgw_setup->show_header(lang('Please login'),True);
$phpgw_setup->login_form();
$phpgw_setup->show_footer();
exit;
}
$bgcolor = array('DDDDDD','EEEEEE');
function parsedep($depends,$main=True)
{
$depstring = '(';
while (list($a,$b) = each ($depends))
{
while (list($c,$d) = each($b))
{
if (is_array($d))
{
$depstring .= $c . ': ' .implode(',',$d) . '; ';
$depver[] = $d;
}
else
{
$depstring .= $c . ': ' . $d . '; ';
$depapp[] = $d;
}
}
}
$depstring .= ')';
if ($main)
{
return $depstring;
}
else
{
return array($depapp,$depver);
}
}
$phpgw_setup->loaddb();
$phpgw_info['setup']['stage']['db'] = $phpgw_setup->check_db();
$setup_info = $phpgw_setup->get_versions();
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->get_db_versions($setup_info);
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->compare_versions($setup_info);
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->check_depends($setup_info);
//var_dump($setup_info);exit;
@ksort($setup_info);
if ($cancel)
{
Header("Location: index.php");
exit;
}
if ($submit)
{
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
$setup_tpl->set_var('description',lang('App install/remove/upgrade') . ':');
$setup_tpl->pparse('out','header');
while (list($appname,$key) = @each($remove))
{
$terror = array();
$terror[] = $setup_info[$appname];
if ($setup_info[$appname]['tables'])
{
$phpgw_setup->process_droptables($terror,$DEBUG);
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('tables dropped') . '.';
}
$phpgw_setup->deregister_app($setup_info[$appname]['name']);
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('deregistered') . '.';
if ($setup_info[$appname]['hooks'])
{
$phpgw_setup->deregister_hooks($setup_info[$appname]['name']);
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks deregistered') . '.';
}
}
while (list($appname,$key) = @each($install))
{
$terror = array();
$terror[] = $setup_info[$appname];
if ($setup_info[$appname]['tables'])
{
$terror = $phpgw_setup->process_current($terror,$DEBUG);
$terror = $phpgw_setup->process_default_records($terror,$DEBUG);
echo '<br>' . $setup_info[$appname]['title'] . ' '
. lang('tables installed, unless there are errors printed above') . '.';
}
else
{
if ($phpgw_setup->app_registered($setup_info[$appname]['name']))
{
$phpgw_setup->update_app($setup_info[$appname]['name']);
}
else
{
$phpgw_setup->register_app($setup_info[$appname]['name']);
}
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('registered') . '.';
if ($setup_info[$appname]['hooks'])
{
$phpgw_setup->register_hooks($setup_info[$appname]['name']);
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('hooks registered') . '.';
}
}
}
while (list($appname,$key) = @each($upgrade))
{
$terror = array();
$terror[] = $setup_info[$appname];
$phpgw_setup->process_upgrade($terror,$DEBUG);
if ($setup_info[$appname]['tables'])
{
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('tables upgraded') . '.';
// The process_upgrade() function also handles registration
}
else
{
echo '<br>' . $setup_info[$appname]['title'] . ' ' . lang('upgraded') . '.';
}
}
//$setup_tpl->set_var('goback',
echo '<br><a href="applications.php">' . lang('Go back') . '</a>';
//$setup_tpl->pparse('out','submit');
$setup_tpl->pparse('out','footer');
exit;
}
else
{
$phpgw_setup->show_header(lang('Application Management'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
}
if($detail)
{
@ksort($setup_info[$detail]);
@reset($setup_info[$detail]);
$setup_tpl->set_var('description',lang('App details') . ':');
$setup_tpl->pparse('out','header');
while (list($key,$val) = each($setup_info[$detail]))
{
if ($i) { $i = 0; }
else { $i = 1; }
//if(!$val) { $val = 'none'; }
if ($key == 'tables')
{
if(is_array($val))
{
$key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True">' . $key . '</a>' . "\n";
$val = implode(',',$val);
}
}
if ($key == 'hooks') { $val = implode(',',$val); }
if ($key == 'depends') { $val = parsedep($val); }
if (is_array($val)) { $val = implode(',',$val); }
$setup_tpl->set_var('bg_color',$bgcolor[$i]);
$setup_tpl->set_var('name',$key);
$setup_tpl->set_var('details',$val);
$setup_tpl->pparse('out','detail');
}
echo '<br><a href="applications.php">' . lang('Go back') . '</a>';
$setup_tpl->pparse('out','footer');
exit;
}
elseif ($resolve)
{
$setup_tpl->set_var('description',lang('Problem resolution'). ':');
$setup_tpl->pparse('out','header');
if ($badinstall)
{
echo $setup_info[$resolve]['title'] . ' ' . lang('is broken') . ' ';
echo lang('because of a failed upgrade or install') . '.';
echo '<br>';
echo lang('Some or all of its tables are missing') . '.';
echo '<br>';
echo lang('You should either uninstall and then reinstall it, or attempt manual repairs') . '.';
}
elseif (!$version)
{
if($setup_info[$resolve]['enabled'])
{
echo $setup_info[$resolve]['title'] . ' ' . lang('is broken') . ' ';
}
else
{
echo $setup_info[$resolve]['title'] . ' ' . lang('is disabled') . ' ';
}
if (!$notables)
{
if($setup_info[$resolve]['status'] == 'D')
{
echo lang('because it depends upon') . ':<br>' . "\n";
list($depapp,$depver) = parsedep($setup_info[$resolve]['depends'],False);
for ($i=0;$i<count($depapp);$i++)
{
echo '<br>' . $depapp[$i] . ': ';
$list = '';
while(list($x,$y) = @each($depver[$i]))
{
$list .= $y . ', ';
}
$list = substr($list,0,-2);
echo "$list\n";
}
echo '<br><br>' . lang('The table definition was correct, and the tables were installed') . '.';
}
else
{
echo lang('because it was manually disabled') . '.';
}
}
elseif($setup_info[$resolve]['enable'] == 2)
{
echo lang('because it is not a user application, or access is controlled via acl') . '.';
}
elseif($setup_info[$resolve]['enable'] == 0)
{
echo lang('because the enable flag for this app is set to 0, or is undefined') . '.';
}
else
{
echo lang('because it requires manual table installation, <br>or the table definition was incorrect') . ".\n"
. lang("Please check for sql scripts within the application's directory") . '.';
}
echo '<br>' . lang('However, the application is otherwise installed') . '.';
}
else
{
echo $setup_info[$resolve]['title'] . ' ' . lang('has a version mismatch') . ' ';
echo lang('because of a failed upgrade, or the database is newer than the installed version of this app') . '.';
echo '<br>';
echo lang('If the application has no defined tables, selecting upgrade should remedy the problem') . '.';
echo '<br>' . lang('However, the application is otherwise installed') . '.';
}
echo '<br><a href="applications.php">' . lang('Go back') . '</a>';
$setup_tpl->pparse('out','footer');
exit;
}
else
{
$setup_tpl->set_var('description',lang('Select the desired action(s) from the available choices'));
$setup_tpl->pparse('out','header');
$setup_tpl->set_var('appdata',lang('Application Data'));
$setup_tpl->set_var('actions',lang('Actions'));
$setup_tpl->set_var('action_url','applications.php');
$setup_tpl->set_var('app_info',lang('Application Name and Status Information'));
$setup_tpl->set_var('app_title',lang('Application Title'));
$setup_tpl->set_var('app_currentver',lang('Current Version'));
$setup_tpl->set_var('app_version',lang('Available Version'));
$setup_tpl->set_var('app_install',lang('Install'));
$setup_tpl->set_var('app_remove',lang('Remove'));
$setup_tpl->set_var('app_upgrade',lang('Upgrade'));
$setup_tpl->set_var('app_resolve',lang('Resolve'));
$setup_tpl->pparse('out','app_header');
@reset ($setup_info);
while (list ($key, $value) = each ($setup_info))
{
if($value['name'])
{
if ($i)
{
$i = 0;
}
else
{
$i = 1;
}
$setup_tpl->set_var('apptitle',$value['title']);
$setup_tpl->set_var('currentver',$value['currentver']);
$setup_tpl->set_var('version',$value['version']);
$setup_tpl->set_var('bg_color',$bgcolor[$i]);
switch($value['status'])
{
case 'C':
$setup_tpl->set_var('remove','<input type="checkbox" name="remove[' . $value['name'] . ']">');
$setup_tpl->set_var('upgrade','&nbsp;');
if (!$phpgw_setup->check_app_tables($value['name']))
{
// App installed and enabled, but some tables are missing
$setup_tpl->set_var('instimg','table.gif');
$setup_tpl->set_var('bg_color','FFCCAA');
$setup_tpl->set_var('instalt',lang('Not Completed'));
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
}
else
{
$setup_tpl->set_var('instimg','completed.gif');
$setup_tpl->set_var('instalt',lang('Completed'));
$setup_tpl->set_var('install','&nbsp;');
if($value['enabled'])
{
$setup_tpl->set_var('resolution','');
$status = lang('OK') . ' - ' . $value['status'];
}
else
{
if ($value['tables'][0] != '')
{
$notables = '&notables=True';
}
$setup_tpl->set_var('bg_color','CCCCFF');
$setup_tpl->set_var('resolution',
'<a href="applications.php?resolve=' . $value['name'] . $notables . '">' . lang('Possible Reasons') . '</a>'
);
$status = lang('Disabled') . ' - ' . $value['status'];
}
}
break;
case 'U':
$setup_tpl->set_var('instimg','incomplete.gif');
$setup_tpl->set_var('instalt',lang('Not Completed'));
if (!$value['currentver'])
{
if ($value['tables'] && $phpgw_setup->check_app_tables($value['name'],True))
{
// Some tables missing
$setup_tpl->set_var('remove','<input type="checkbox" name="remove[' . $value['name'] . ']">');
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&badinstall=True">' . lang('Potential Problem') . '</a>');
$status = lang('Requires reinstall or manual repair') . ' - ' . $value['status'];
}
else
{
$setup_tpl->set_var('remove','&nbsp;');
$setup_tpl->set_var('resolution','');
$status = lang('Requires upgrade') . ' - ' . $value['status'];
}
$setup_tpl->set_var('bg_color','CCFFCC');
$setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']">');
$setup_tpl->set_var('upgrade','&nbsp;');
$status = lang('Please install') . ' - ' . $value['status'];
}
else
{
$setup_tpl->set_var('bg_color','CCCCFF');
$setup_tpl->set_var('install','&nbsp;');
// TODO display some info about breakage if you mess with this app
$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']">');
$setup_tpl->set_var('remove','<input type="checkbox" name="remove[' . $value['name'] . ']">');
$setup_tpl->set_var('resolution','');
$status = lang('Requires upgrade') . ' - ' . $value['status'];
}
break;
case 'V':
$setup_tpl->set_var('instimg','incomplete.gif');
$setup_tpl->set_var('instalt',lang('Not Completed'));
$setup_tpl->set_var('install','&nbsp;');
$setup_tpl->set_var('remove','<input type="checkbox" name="remove[' . $value['name'] . ']">');
$setup_tpl->set_var('upgrade','<input type="checkbox" name="upgrade[' . $value['name'] . ']">');
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '&version=True">' . lang('Possible Solutions') . '</a>');
$status = lang('Version Mismatch') . ' - ' . $value['status'];
break;
case 'D':
$setup_tpl->set_var('bg_color','FFCCCC');
$depstring = parsedep($value['depends']);
$depstring .= ')';
$setup_tpl->set_var('instimg','dep.gif');
$setup_tpl->set_var('instalt',lang('Dependency Failure'));
$setup_tpl->set_var('install','&nbsp;');
$setup_tpl->set_var('remove','&nbsp;');
$setup_tpl->set_var('upgrade','&nbsp;');
$setup_tpl->set_var('resolution','<a href="applications.php?resolve=' . $value['name'] . '">' . lang('Possible Solutions') . '</a>');
$status = lang('Dependency Failure') . ':' . $depstring . $value['status'];
break;
default:
$setup_tpl->set_var('instimg','incomplete.gif');
$setup_tpl->set_var('instalt',lang('Not Completed'));
$setup_tpl->set_var('install','&nbsp;');
$setup_tpl->set_var('remove','&nbsp;');
$setup_tpl->set_var('upgrade','&nbsp;');
$setup_tpl->set_var('resolution','');
$status = '';
break;
}
//$setup_tpl->set_var('appname',$value['name'] . '-' . $status . ',' . $value['filename']);
$setup_tpl->set_var('appinfo',$value['name'] . '-' . $status);
$setup_tpl->set_var('appname',$value['name']);
$setup_tpl->pparse('out','apps',True);
}
}
$setup_tpl->set_var('submit',lang('Submit'));
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pparse('out','app_footer');
$setup_tpl->pparse('out','footer');
$phpgw_setup->show_footer();
}
?>

150
setup/config.php Normal file
View File

@ -0,0 +1,150 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => "home",
'noapi' => True
);
include('./inc/functions.inc.php');
include('../header.inc.php');
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_config_pre_script' => 'config_pre_script.tpl',
'T_config_post_script' => 'config_post_script.tpl'
));
/*
Authorize the user to use setup app and load the database
Does not return unless user is authorized
*/
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
$phpgw_setup->loaddb();
/* Guessing default paths. */
$current_config['files_dir'] = ereg_replace("/setup","/files",dirname($SCRIPT_FILENAME));
if (is_dir('/tmp'))
{
$current_config['temp_dir'] = '/tmp';
}
else
{
$current_config['temp_dir'] = '/path/to/temp/dir';
}
if ($cancel)
{
Header('Location: index.php');
exit;
}
/* Check api version, use correct table */
$setup_info = $phpgw_setup->get_db_versions();
if($phpgw_setup->alessthanb($setup_info['phpgwapi']['currentver'], '0.9.10pre7'))
{
$configtbl = 'config';
}
else
{
$configtbl = 'phpgw_config';
}
if ($submit && $newsettings)
{
$phpgw_setup->db->transaction_begin();
/* This is only temp: */
$phpgw_setup->db->query("DELETE FROM $configtbl WHERE config_name='useframes'");
$phpgw_setup->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) values ('phpgwapi','useframes','never')");
while (list($setting,$value) = @each($newsettings))
{
// echo '<br>Updating: ' . $setting . '=' . $value;
@$phpgw_setup->db->query("DELETE FROM $configtbl WHERE config_name='" . $setting . "'");
if($value)
{
$phpgw_setup->db->query("INSERT INTO $configtbl (config_app,config_name, config_value) VALUES ('phpgwapi','" . addslashes($setting)
. "','" . addslashes($value) . "')");
}
}
$phpgw_setup->db->transaction_commit();
/* Add cleaning of app_sessions per skeeter, but with a check for the table being there, just in case */
$tablenames = $phpgw_setup->db->table_names();
while(list($key,$val) = @each($tablenames))
{
$tables[] = $val['table_name'];
}
if ($phpgw_setup->isinarray('phpgw_app_sessions',$tables))
{
$phpgw_setup->db->lock(array('phpgw_app_sessions'));
@$phpgw_setup->db->query("DELETE FROM phpgw_app_sessions WHERE sessionid = '0' and loginid = '0' and app = 'phpgwapi' and location = 'config'",__LINE__,__FILE__);
@$phpgw_setup->db->query("DELETE FROM phpgw_app_sessions WHERE app = 'phpgwapi' and location = 'phpgw_info_cache'",__LINE__,__FILE__);
$phpgw_setup->db->unlock();
}
if ($newsettings['auth_type'] == 'ldap')
{
Header('Location: '.$newsettings['webserver_url'].'/setup/ldap.php');
exit;
}
else
{
Header('Location: index.php');
exit;
}
}
if ($newsettings['auth_type'] != 'ldap')
{
$phpgw_setup->show_header(lang('Configuration'),False,'config',$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
}
@$phpgw_setup->db->query("SELECT * FROM $configtbl");
while (@$phpgw_setup->db->next_record())
{
$current_config[$phpgw_setup->db->f('config_name')] = $phpgw_setup->db->f('config_value');
}
if ($current_config['files_dir'] == '/path/to/dir/phpgroupware/files')
{
$current_config['files_dir'] = $phpgw_info['server']['server_root'] . '/files';
}
if ($error == 'badldapconnection')
{
/* Please check the number and dial again :) */
$phpgw_setup->show_alert_msg('Error',
lang('There was a problem trying to connect to your LDAP server. <br>'
.'please check your LDAP server configuration') . '.');
}
$setup_tpl->pparse('out','T_config_pre_script');
$phpgw_setup->execute_script('config',array('phpgwapi','admin','preferences')); /* ;,'preferences','email','nntp')); */
$setup_tpl->set_var('more_configs',lang('Please login to phpgroupware and run the admin application for additional site configuration') . '.');
$setup_tpl->set_var('lang_submit',lang('submit'));
$setup_tpl->set_var('lang_cancel',lang('cancel'));
$setup_tpl->pparse('out','T_config_post_script');
$phpgw_setup->show_footer();
?>

340
setup/doc/copyright.gpl Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

804
setup/doc/setup3-1.html Normal file
View File

@ -0,0 +1,804 @@
<HTML
><HEAD
><TITLE
> Application setup files
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
REL="HOME"
TITLE=" phpGroupWare Setup III
"
HREF="setup3.html"><LINK
REL="PREVIOUS"
TITLE=" phpGroupWare Setup III
"
HREF="setup3.html"><LINK
REL="NEXT"
TITLE=" Developer Tools
"
HREF="setup3-2.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>phpGroupWare Setup III</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="setup3.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="setup3-2.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN22"
>Application setup files</A
></H1
><P
> The files in this section are contained within each application/setup directory. Every app will some of these files in order to operate with setup3.
</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN25"
>setup.inc.php (Required)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN27"
>Basic information</A
></H3
><P
> The values in this section must be used by all applications.
</P
><P
> The first section of setup.inc.php defines the very basic and yet critical information about the application. Take a look at the following section:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$setup_info['addressbook']['name'] = 'addressbook';
$setup_info['addressbook']['title'] = 'Addressbook';
$setup_info['addressbook']['version'] = '0.9.13.002';
$setup_info['addressbook']['app_order'] = 4;
$setup_info['addressbook']['enable'] = 1;
</PRE
></TD
></TR
></TABLE
><P
> 'name' is used throughout phpgroupware, typically in $phpgw_info flags such as 'currentapp' or as the 'app_name' almost everywhere else.
</P
><P
> 'title' would be used in the navbar, admin, preferences, as well as in the application itself.
</P
><P
> The 'version' string defines the version of the application and table code. This would be incremented whenever you create a new upgrade function, and typically only for table modifications. If the change is significant from the last code update, you could increment this here also. Incrementing this version string is not trivial, so please do read the rest of this document for more information about that.
</P
><P
> 'app_order' determines the order of applications in the navbar. If the number you set here is the same as is set for another app, the app whose 'name' is first in the English alphabet would appear first. Smaller numbers show closer to the top or left end of the navbar, depending upon the layout.
</P
><P
> The 'enable' string is used by the phpgroupware API to determine whether an application is disabled, enabled, or enabled but hidden from the navbar. Most applications will want this set to a value of 1 (enabled). The notifywindow app sets this to 2, which keeps it off the navbar. An enable of 0 would disable the app by default. There is one other special case, 3, which is used primarily by the API itself. From the perspective of setup3, the API is an application just like any other application. By setting the 'enable' flag to 3, the API is still enabled, but will not be assignable to a user as a real application. It will thereby be hidden from the admin for application and user/group editing.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN37"
>Table info</A
></H3
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN39"
>Only applications with database tables will use entries in this section.</A
></H4
><P
> The next section of $setup_info values is an array defining all of the application's database tables:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$setup_info['addressbook']['tables'] = array(
'phpgw_addressbook',
'phpgw_addressbook_extra'
);
</PRE
></TD
></TR
></TABLE
><P
> This is a simple array, and must list accurately the current table names you are using in your application. This list will match a much more complex array of table specifications, as you will see below.
</P
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN44"
>Hooks</A
></H3
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN46"
>Some applications will use this section.</A
></H4
><P
> The hooks array part of $setup_info contains a simple list of hooks the application will use:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$setup_info['addressbook']['hooks'][] = 'preferences';
$setup_info['addressbook']['hooks'][] = 'admin';
</PRE
></TD
></TR
></TABLE
><P
> Here we also note a different method of 'stuffing the array.' In any case, this list of hooks will be required soon in order for your hook_admin.inc.php and other files to work. This is being done to cut down on the manual directory listing and file_exists loops done currently to discover hook files. Other than 'preferences' and 'admin', 'home', 'manual', 'after_navbar' and 'navbar_end' are all valid hook entries.
</P
></DIV
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN51"
>Dependencies</A
></H3
><DIV
CLASS="SECT4"
><H4
CLASS="SECT4"
><A
NAME="AEN53"
>All applications will have at least one entry here.</A
></H4
><P
> The final section, or array of data, is a listing of the other applications your application requires in order to function:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$setup_info['addressbook']['depends'][] = array(
'appname' =&#62; 'phpgwapi',
'versions' =&#62; Array(
'0.9.10',
'0.9.11',
'0.9.12',
'0.9.13'
)
);
</PRE
></TD
></TR
></TABLE
><P
> This is the standard dependency array for all phpgroupware applications. It states that this application requires the phpgwapi, and lists the versions with which versions this app is compatible. This list would need to be appended upon each new API release, assuming your application is compatible with this new API version. You may list other applications here, e.g. your app might depend upon 'email' in order to work properly.
</P
><P
> Do NOT list applications here without considering this: If you do list an application here, and your app does not really require it, your application will not install unless that other application is already installed. This is handled normally within the install/upgrade process loops, which will install only applications whose dependencies are satisfied. Using a multipass function, the applications are installed in the correct order to ensure that dependencies are resolved. In all cases, the API would be installed first in every new install or upgrade, since all applications depend on the API.
</P
></DIV
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN59"
>tables_baseline.inc.php (Recommended)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN61"
>Any application that has at least one upgrade routine will have this file.</A
></H3
><P
> The tables_baseline file represents the earliest supported version of an application's tables. This file is used only in the upgrade process, and is critical to its success. It contains an array of database-independent table, field, key and index definitions.
</P
><P
> This array is formatted for use by the class.schema_proc_array.inc.php file in setup3. See the tables_update section below for more detail about schema_proc, but for now, here is a simple table definition in this format:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$phpgw_baseline = array(
'skel' =&#62; array(
'fd' =&#62; array(
'skel_id' =&#62; array('type' =&#62; 'auto','nullable' =&#62; false),
'skel_owner' =&#62; array('type' =&#62; 'varchar','precision' =&#62; 25),
'skel_access' =&#62; array('type' =&#62; 'varchar','precision' =&#62; 10),
'skel_cat' =&#62; array('type' =&#62; 'int','precision' =&#62; 4),
'skel_des' =&#62; array('type' =&#62; 'text'),
'skel_pri' =&#62; array('type' =&#62; 'int','precision' =&#62; 4)
),
'pk' =&#62; array('skel_id'),
'fk' =&#62; array(),
'ix' =&#62; array(),
'uc' =&#62; array()
)
);
</PRE
></TD
></TR
></TABLE
><P
> This multi-dimensional array contains 1 subarray with 5 subs of its own. The first array ('skel' above) defines the table name. Below that are 5 sections, 'fd' for field definitions, 'pk' to define primary keys, 'fk' to define foreign keys, 'ix' to define indexed fields, and 'uc' to define columns that require unique values. In the above example, the table 'skel' has 6 fields (skel_id, skel_owner, skel_access, skel_cat, skel_des, skel_pri), and 'skel_id' is defined also as the primary key for this table. More information on this array is below. But, this format was chosen as an available solution for defining tables and fields without having to maintain seperate files for different databases.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN67"
>tables_current.inc.php (Recommended)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN69"
>All applications with tables will need this file.</A
></H3
><P
> The tables_current file defines the current table definition that matches the 'version' string in $setup_info as well as the current code. This file is used only for new installs, or whenever the application is removed and reinstalled. The format and name of the array in this file is the same as for the tables_baseline file listed above. In fact, whenever it is required to change your table definitions, you would start by copying the current file over to become the tables_baseline file. After having created your upgrade routines, you would then recreate the current file to match the new table definitions.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN72"
>tables_update.inc.php (Recommended)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN74"
>Any application which requires an upgrade to a previous version's tables will need this file.</A
></H3
><P
> This file will be the most complex of all setup-oriented files with which you will be working. It will contain all upgrade functions capable of upgrading any possible version of your phpgroupware app. These upgrade routines roughly match the old setup program's upgrade functions, but the use of objects and the methods have changed dramatically. The simplest version upgrade routine would look like:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$test[] = "0.9.3pre10";
function addressbook_upgrade0_9_3pre10()
{
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.3';
return $setup_info['addressbook']['currentver'];
}
</PRE
></TD
></TR
></TABLE
><P
> This upgrade function merely updates the current version number. Note that there is not only an upgrade function, but also the setting of a value in the $test array. The name 'test' is a holdover from the old setup program, and is an arbitrary choice. However, this name must be used for the upgrade process to work. Prior to each of your upgrade functions, add the value of the previous version to $test.
</P
><P
> Now look at the function name. The name is important and should be structured as the application name and the version from which you are intending to upgrade. The '.'s in the version string are replaced with '_'.
</P
><P
> Inside the function, we global the $setup_info array. Next, we alter the version number in that array, for our application. Please be careful to specify YOUR application name here. The very last thing we do is to return this new version to the calling function. The upgrade process relies on the value returned, since it uses this directly to determine the new version. This may appear illogical on some level, but it does work. The reason for returning this value instead of a True or 1, etc. has to do with variable scope and lifetime. In this way, even the globaling of $setup_info inside the function may have little effect on the upgrade process. But, there may be values in this array you would want to use within the function. More on that later.
</P
><P
> There is one other variable you would need if doing any database operations here. If you global $phpgw_setup, you will then have access to db and schema_proc objects and functions. The objects of interest here are:
</P
><P
></P
><UL
><LI
><P
> $phpgw_setup-&gt;oProc
</P
></LI
><LI
><P
> $phpgw_setup-&gt;db.
</P
></LI
></UL
><P
> For most database work you should use the oProc object. This also has a db object that should be used for most standard phpgw API db class functions, including $db-&gt;query, next_record, num_rows, and f. The use of these for standard db operations is critical to the upgrade process. Schema_proc has a flag that can be set to determine what mode of upgrade we are in. This flag is set in the setup class during the upgrade process, and should not be altered locally.
</P
><P
> This flag is a decision on whether to alter the database or the schema_proc array. The tables_baseline file above is loaded by setup prior to running your upgrade routines. If the current installed version is greater than the current upgrade routine, we don't need to alter the database yet. But schema_proc instead alters the $phpgw_baseline array in memory. The maintenance of this array is done even when we do alter the database. Once our version number in the test array matches the currently installed version of an application, real work on the tables begins.
</P
><P
> 'Why bother modifying this array at all', you may ask. The array must be maintained in order to keep current table definition status. This is used in some schema_proc functions when altering columns and tables. This is especially critical for pgsql schema_proc functions.
</P
><P
> By using the $phpgw_setup-&gt;oProc object for basic inserts and queries, we acheive the ability to run all upgrade functions in every upgrade cycle without actually altering the database until we reach the current version we actually want to upgrade. For example:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='notes'";
$phpgw_setup-&#62;oProc-&#62;query($sql,__LINE__,__FILE__);
while($phpgw_setup-&#62;oProc-&#62;next_record()) {
</PRE
></TD
></TR
></TABLE
><P
> We could have used $phpgw_setup-&gt;db or even a copy for the above activity. However, using the above method ensures that an array only upgrade does just that. If the flag was set in setup telling schema_proc to alter the array only, we do not want to touch the tables for inserts or selects yet. In this case, $phpgw_setup-&gt;oProc-&gt;next_record() returns False, and the loop is skipped. The $phpgw_baseline array does not know about table content, only table and field definitions.
</P
><P
> If the upgrade function containing this method is actually working on the tables (currentver &lt;= the upgrade function), then next_record() is returned as the expected action of pulling the next row of data. Inside of this while loop, you can safely use $phpgw_setup-&gt;db, or preferably a copy, to do the insert/delete, etc you want to have happen here.
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
> $cid = $phpgw_setup-&#62;oProc-&#62;f('contact_id');
$cvalu = $phpgw_setup-&#62;oProc-&#62;f('contact_value');
$update = "UPDATE phpgw_addressbook set note='" . $cvalu . "' WHERE id=" . $cid;
$db1-&#62;query($update);
$delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='notes'";
$db1-&#62;query($delete);
}
</PRE
></TD
></TR
></TABLE
><P
> $db1 is a copy of $phpgw_setup-&gt;db, to avoid potential conflicts with the rest of setup's db activities.
</P
><P
> In addition to the basic API db class functions, schema_proc introduces the following special functions:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>function DropTable($sTableName)
function DropColumn($sTableName, $aTableDef, $sColumnName)
function RenameTable($sOldTableName, $sNewTableName)
function RenameColumn($sTableName, $sOldColumnName, $sNewColumnName)
function AlterColumn($sTableName, $sColumnName, $aColumnDef)
function AddColumn($sTableName, $sColumnName, $aColumnDef)
function CreateTable($sTableName, $aTableDef)
</PRE
></TD
></TR
></TABLE
><P
> Please use these functions where appropriate in place of standard SQL CREATE, DROP, and ALTER TABLE commands. This will ensure that your upgrade script works for all supported databases.
</P
><P
> Of these functions, DropTable, RenameTable, and RenameColumn are pretty straightforward. Pass these the table names you wish to Drop/Rename, and schema_proc will handle the rest, including indexes and sequences, where applicable.
</P
><P
> The remaining functions require some explanation:
</P
><P
></P
><UL
><LI
><P
> CreateTable:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$phpgw_setup-&#62;oProc-&#62;CreateTable(
'categories', array(
'fd' =&#62; array(
'cat_id' =&#62; array('type' =&#62; 'auto','nullable' =&#62; false),
'account_id' =&#62; array('type' =&#62; 'int','precision' =&#62; 4,'nullable' =&#62; false, 'default' =&#62; 0),
'app_name' =&#62; array('type' =&#62; 'varchar','precision' =&#62; 25,'nullable' =&#62; false),
'cat_name' =&#62; array('type' =&#62; 'varchar', 'precision' =&#62; 150, 'nullable' =&#62; false),
'cat_description' =&#62; array('type' =&#62; 'text', 'nullable' =&#62; false)
),
'pk' =&#62; array('cat_id'),
'ix' =&#62; array(),
'fk' =&#62; array(),
'uc' =&#62; array()
)
);
</PRE
></TD
></TR
></TABLE
><P
> Does this look familiar? The array passed to CreateTable is in the format used also in tables_baseline and tables_current. Note a slight difference where the table name is being passed as a seperate argument. The second argument to the function is the table definition array, starting with 'fd'.
</P
><P
></P
><UL
><LI
><P
> AddColumn:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$phpgw_setup-&#62;oProc-&#62;AddColumn('phpgw_categories','cat_access',array('type' =&#62; 'varchar', 'precision' =&#62; 25));
</PRE
></TD
></TR
></TABLE
><P
> Here we pass the table name of an existing table, the new column name, and a field definition. This definition is merely a slice of the table arrays found earlier in this document.
</P
><P
></P
><UL
><LI
><P
> AlterColumn:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$phpgw_setup-&#62;oProc-&#62;AlterColumn('phpgw_sessions','session_action',array('type' =&#62; 'varchar', 'precision' =&#62; '255'));
</PRE
></TD
></TR
></TABLE
><P
> The format of this function matches AddColumn. It is also a simple case of passing the table name, field name, and field definition.
</P
><P
></P
><UL
><LI
><P
> DropColumn:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$newtbldef = array(
"fd" =&#62; array(
'acl_appname' =&#62; array('type' =&#62; 'varchar', 'precision' =&#62; 50),
'acl_location' =&#62; array('type' =&#62; 'varchar', 'precision' =&#62; 255),
'acl_account' =&#62; array('type' =&#62; 'int', 'precision' =&#62; 4),
'acl_rights' =&#62; array('type' =&#62; 'int', 'precision' =&#62; 4)
),
'pk' =&#62; array(),
'ix' =&#62; array(),
'fk' =&#62; array(),
'uc' =&#62; array()
);
$phpgw_setup-&#62;oProc-&#62;DropColumn('phpgw_acl',$newtbldef,'acl_account_type');
</PRE
></TD
></TR
></TABLE
><P
> This is the most complicated function in schema_proc, from the user's perspective. Its complexity is necessitated by the requirement of some databases to recreate a table in the case of dropping a column. Note that the table definition array is being used yet again. The array defined here should match the table definition you want after this function has completed. Here, we are dropping the column 'acl_account_type' from the table 'phpgw_acl', and the table definition does not have this column defined. You could copy information from your tables_current file here and edit it to match the desired new table spec, less the column you wish to drop.
</P
><P
> There are additional functions within schema_proc, the majority of which are not to be called directly. They are used internally. If you do wish to investigate further, use class.schema_proc.inc.php as your guide. This master file includes the class.schema_proc_DBMS.inc.php and class.schema_proc_array.inc.php files. The DBMS files should not be used as a guide, since their functions are called from the master class, and the parameters are different from what you might expect relative to the master.
</P
><P
> PLEASE, DO NOT WRITE TO OR ALTER ANOTHER APPLICATION'S TABLES OR THE API TABLES IN YOUR APPLICATION UPGRADE FUNCTIONS!
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN123"
>default_records.inc.php (Optional)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN125"
>Any application with tables that wants to load some default data will need this file.</A
></H3
><P
> The default_records file consists of a list of SQL INSERTs using the $oProc object directly:
</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>$oProc-&#62;query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('available')");
$oProc-&#62;query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('no longer available')");
$oProc-&#62;query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('back order')");
</PRE
></TD
></TR
></TABLE
><P
> In this case, the developer wanted to insert some status information, which was then used in a select box on an html form. Using the default_records file, every new install will have this data included. This file should consist of queries applicable to the tables defined in setup.inc.php and tables_current.inc.php.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN130"
>test_data.inc.php (Optional)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN132"
>Any developer wanting to test the full list of upgrade routines can use this file.</A
></H3
><P
> test_data.inc.php is similar to default_records above. It is called only by schematoy.php and is never installed with a new install or upgrade. This is a developer-only file. The INSERTs here should be applicable to the tables_baseline table definitions.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN135"
>language files (Required)</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN137"
>All applications should have at least a file of English translations, used for their application lang() calls.</A
></H3
><P
></P
><UL
><LI
><P
> Format of a lang file:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>{phrase}{TAB}{appname}{TAB}{LANG_CODE}{TAB}{translation}
e.g:
first name common en First Name
first name common de Vorname
</PRE
></TD
></TR
></TABLE
><P
></P
><UL
><LI
><P
> Filenames:
</P
></LI
></UL
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>phpgw_{LANG_CODE}.lang
e.g.
English: phpgw_en.lang
German: phpgw_de.lang
</PRE
></TD
></TR
></TABLE
><P
> Please see the contents of the API 'languages' table for the correct setting of the LANG_CODE.
</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="setup3.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="setup3.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="setup3-2.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>phpGroupWare Setup III</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Developer Tools</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

223
setup/doc/setup3-2.html Normal file
View File

@ -0,0 +1,223 @@
<HTML
><HEAD
><TITLE
> Developer Tools
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
REL="HOME"
TITLE=" phpGroupWare Setup III
"
HREF="setup3.html"><LINK
REL="PREVIOUS"
TITLE=" Application setup files
"
HREF="setup3-1.html"><LINK
REL="NEXT"
TITLE=" The install/upgrade process
"
HREF="setup3-3.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>phpGroupWare Setup III</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="setup3-1.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="setup3-3.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN148"
>Developer Tools</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN150"
>sqltoarray.php</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN152"
>Displays the current schema_proc array defining an application's tables.</A
></H3
><P
> This web application reads the current table status live from the database. It then parses this information into a hopefully correct table definition array for schema_proc. Upon visiting this app, you are shown a list of currently installed applications with defined tables. You may then select one app or all apps, and then submit the form. From this form you may then download a tables_current file, suitable for commission to cvs. Please do check the format to make sure the definitions are correct.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN155"
>schematoy.php</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN157"
>Runs the full cycle of upgrades, including optional test_data.</A
></H3
><P
> This app is not beautiful, may bomb on you, and will definitely drop your application's tables. The display is similar to the user/admin tool, applications.php. You are shown a list of apps with tables. Select one app, and enter a target version. Upon submission of the form:
</P
><P
></P
><UL
><LI
><P
> All application tables are dropped.
</P
></LI
><LI
><P
> tables_baseline.inc.php is loaded.
</P
></LI
><LI
><P
> test_data.inc.php is loaded
</P
></LI
><LI
><P
> tables_update.inc.php is loaded.
</P
></LI
><LI
><P
> a full application upgrade test begins.
</P
></LI
></UL
><P
> This will give a LOT of debugging output. Depending on your database, the process may take quite awhile. This tool should be considered as a destructive test of the full upgrade cycle. If the upgrade process is successful, you can then check the loaded test_data to see that it is still in place as expected after all the table modifications, etc. If not, it should be clear where the error has occurred. Look for the usual INVALID SQL warnings, among others.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN172"
>tools subdirectory</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN174"
>some utilities for sql file conversion, etc.</A
></H3
><P
> In the tools directory under setup3, there should be at least a couple of hopefully handy perl or shell scripts. These are for running on the commandline only, and might apply to converting SQL files into lang files, etc. They are not expected to be perfect, but might offer some assistance or ideas for additional utilities. Use these at your own risk or benefit.
</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="setup3-1.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="setup3.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="setup3-3.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Application setup files</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The install/upgrade process</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

415
setup/doc/setup3-3.html Normal file
View File

@ -0,0 +1,415 @@
<HTML
><HEAD
><TITLE
> The install/upgrade process
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
REL="HOME"
TITLE=" phpGroupWare Setup III
"
HREF="setup3.html"><LINK
REL="PREVIOUS"
TITLE=" Developer Tools
"
HREF="setup3-2.html"><LINK
REL="NEXT"
TITLE=" Conclusion
"
HREF="setup3-4.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>phpGroupWare Setup III</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="setup3-2.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="setup3-4.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN177"
>The install/upgrade process</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN179"
>Overview</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN181"
>Setup internal upgrade functions</A
></H3
><P
> Setup uses a common set of functions for new installs and upgrades. These are implemented as multi-pass loops. For a single application install or upgrade, a single pass is done. For multiple application installs or upgrades, multiple passes are done automatically. The order of install in a mass install or upgrade is determined by application dependencies. The other determining factor is the order in which the application directories and setup.inc.php files are read from the filesystem.
</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN184"
>New installs</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN186"
>Detection</A
></H3
><P
> Each run of index.php or applications.php in setup3 first runs a set of detection routines. These read the data from each setup.inc.php file, and from the 'applications' or 'phpgw_applications' table as appropriate, and only if one of these tables exists. This data is parsed into the $setup_info array. In this case, this array contains information about all applications. Based on the information gathered, a status flag is set to one of the following values:
</P
><P
></P
><UL
><LI
><P
> U - Upgrade required/available
</P
></LI
><LI
><P
> R - upgrade in pRogress
</P
></LI
><LI
><P
> C - upgrade Completed successfully
</P
></LI
><LI
><P
> D - Dependency failure
</P
></LI
><LI
><P
> F - upgrade Failed
</P
></LI
><LI
><P
> V - Version mismatch at end of upgrade
</P
></LI
><LI
><P
> M - Missing files at start of upgrade (Not used, proposed only)
</P
></LI
></UL
><P
> Using this information, the setup logic in index.php determines what mode we are in. index.php is not capable of being selective about which application it found as being out of sync. It is designed only for 'Simple Application Management', which is Step 1 of the setup process. For more selective application manipulation, use applications.php. index.php then tells the user that 1) their applications are current 2) some of their applications are out of sync 3) no db exists, etc. For a new install, all applications will be out of sync, since there is not even an 'phpgw_applications' table in the database to tell setup what the status is for any application.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN205"
>Selection</A
></H3
><P
> There is no selection for application installs in 'new install' mode. All physically present applications will be installed, or at least attempted.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN208"
>Installation</A
></H3
><P
> Once the setup user clicks the magic button to install all applications, the following occurs:
</P
><P
></P
><UL
><LI
><P
> The setup_info array is passed to the process_pass() function, using a method='new'
</P
></LI
><LI
><P
> Applications whose status flag='U' (API on first pass) are then handed off to the process_current() function. This handles inclusion and installation of the application's tables_current.inc.php file.
</P
></LI
><LI
><P
> The application is registered as a new application in the 'phpgw_applications' table. If for some reason there is old data in this table for this application, it will be updated instead. Its hooks, if any, are registered in the 'phpgw_hooks' table.
</P
></LI
><LI
><P
> Next, this array is passed to the process_default_records() function. If this file is present in the current application's setup directory, the queries here are run to install the data to the application's table(s).
</P
></LI
><LI
><P
> The above is repeated until all application status flags equal 'C'. However, if an application install failed for some reason, it will then be skipped on the next pass. This keeps the loop from running away.
</P
></LI
></UL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN222"
>Upgrades</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN224"
>Detection</A
></H3
><P
> Only an API version mismatch will trigger an automated request for the user to upgrade their install. Once the api is current, they can move on to applications.php for more 'Advanced Application Management', which is Step 4 of the setup process. However, if the API is out of sync, clicking 'Upgrade' in index.php will also attempt to upgrade other applications which may be out of sync, as well. As the phpgwapi continues to stabilize, it is felt that this method of upgrading will become less and less common.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN227"
>Selection</A
></H3
><P
> Within applications.php, a color-coded matrix of application status and actions is displayed. Depending on the status flag of each application, certain actions will be either enabled or disabled. These actions include 'install', 'upgrade', 'remove'. If something is very wrong with previous attempts to install or upgrade an application, another column called 'resolution' will then display a link. This link will display additional information which would be helpful for determining how to resolve the problem. Assuming all is well, the user can select applications requiring upgrade from this list. Once selected, they submit the form. This runs the follow three routines in order:
</P
><P
></P
><UL
><LI
><P
> remove
</P
></LI
><LI
><P
> install
</P
></LI
><LI
><P
> upgrade
</P
></LI
></UL
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN237"
>Upgrade</A
></H3
><P
> The idea here is that multiple actions can be selected and run in order in one click. In any case, once they select an application for upgrade, the following occurs:
</P
><P
></P
><UL
><LI
><P
> A stripped down version of the setup_info array is passed to the process_upgrade() function. This array contains only the information for the selected application
</P
></LI
><LI
><P
> Within process_upgrade(), the tables_baseline.inc.php file for the application is loaded.
</P
></LI
><LI
><P
> The tables_update.inc.php file for the application is loaded
</P
></LI
><LI
><P
> The contents of the test array is used to loop through the entire list of upgrade functions for the application. The application's unique function names are rebuilt, then run.
</P
></LI
><LI
><P
> When the currentver (installed) matches the version (available), process_upgrade() exits, setting the status flag for the app to 'C'.
</P
></LI
><LI
><P
> Just prior to exiting, the application and its hooks are updated into the 'phpgw_applications' and 'phpgw_hooks' tables.
</P
></LI
></UL
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN253"
>Uninstallation/Removal</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN255"
>Selection</A
></H3
><P
> Selective removal of an application is done via applications.php, in a manner similar to the method above for upgrades.
</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN258"
>Uninstallation</A
></H3
><P
> Once an application is selected for removal:
</P
><P
></P
><UL
><LI
><P
> A stripped down version of the setup_info array is passed to the process_droptables() function. This function removes all of the application's defined tables, but only after first checking to see if the tables are there. In this way, we attempt to cut down on the number of errors sent to the browser.
</P
></LI
><LI
><P
> The application's hooks are deregistered (removed from 'phpgw_hooks').
</P
></LI
><LI
><P
> The application itself is deregistered (removed from 'phpgw_applications').
</P
></LI
></UL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="setup3-2.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="setup3.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="setup3-4.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Developer Tools</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Conclusion</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

136
setup/doc/setup3-4.html Normal file
View File

@ -0,0 +1,136 @@
<HTML
><HEAD
><TITLE
> Conclusion
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
REL="HOME"
TITLE=" phpGroupWare Setup III
"
HREF="setup3.html"><LINK
REL="PREVIOUS"
TITLE=" The install/upgrade process
"
HREF="setup3-3.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>phpGroupWare Setup III</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="setup3-3.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
>&nbsp;</TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN268"
>Conclusion</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN270"
>This document is not yet complete.</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN272"
>More to come...</A
></H3
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="setup3-3.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="setup3.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>The install/upgrade process</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>&nbsp;</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

BIN
setup/doc/setup3.dvi Normal file

Binary file not shown.

143
setup/doc/setup3.html Normal file
View File

@ -0,0 +1,143 @@
<HTML
><HEAD
><TITLE
> phpGroupWare Setup III
</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.59"><LINK
REL="NEXT"
TITLE=" Application setup files
"
HREF="setup3-1.html"></HEAD
><BODY
CLASS="ARTICLE"
><DIV
CLASS="ARTICLE"
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
><A
NAME="AEN2"
>phpGroupWare Setup III</A
></H1
><H3
CLASS="AUTHOR"
><A
NAME="AEN5"
>Miles Lott</A
></H3
><DIV
><DIV
CLASS="ABSTRACT"
><A
NAME="AEN8"
></A
><P
></P
><P
> A developer introduction to using the next generation setup application for phpgroupware.
</P
><P
></P
></DIV
></DIV
><HR></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN10"
>Introduction</A
></H1
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN12"
>Welcome</A
></H2
><P
> Thanks for taking the time to look over this document. If you are a developer who is new to phpgroupware, this document will be invaluable to your success during the life of your application. This is in addition to the other fine documentation available in the phpgwapi/doc directory in your install. Even long-time phpgw developers should benefit this document. Herein, I will attempt to outline the critical steps required in order to get along with setup3, setup-TNG, or whatever we end up calling it (Hey, how about 'setup'?)
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN15"
>Overview</A
></H2
><P
> With setup3, we introduce several new capabilities and technologies for the developer and end user alike. Michael Dean was kind enough to offer up schema_proc to form the core of an abstracted and database-independent upgrade process. This enables developers to write a single set of upgrades and table definitions, which should then work on MySQL and PostgreSQL, or any other database type we might add in the future.
</P
><P
> Adding to this to control the process was a good chunk of the old setup program, written by Dan Kuykendall (Seek3r). Dan had everything to do with the new dependencies support and with the format of the $setup_info array in setup3.
</P
><P
> Setup3 adds multi-language support for the setup application, a long missed feature, I would imagine.
</P
><P
> Setup3 gives each application developer control over their application install and upgrade processes, while giving them access to work within a realm formerly owned by only the former core phpgroupware applications. Yes, this is extra work for the developer. But it is hoped that setup3 is also viewed as a tool that can truly enhance the development process.
</P
><P
> OK. Let's dive right in...
</P
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="setup3-1.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Application setup files</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

1352
setup/doc/setup3.lyx Normal file

File diff suppressed because it is too large Load Diff

BIN
setup/doc/setup3.pdf Normal file

Binary file not shown.

1159
setup/doc/setup3.ps Normal file

File diff suppressed because it is too large Load Diff

109
setup/doc/setup3.rtf Normal file

File diff suppressed because one or more lines are too long

823
setup/doc/setup3.sgml Normal file
View File

@ -0,0 +1,823 @@
<!doctype article public "-//OASIS//DTD DocBook V3.1//EN"
[ <!entity header system "header.sgml">
]>
<article lang="en">
<!-- DocBook file was created by LyX 1.1
See http://www.lyx.org/ for more information -->
<artheader>
<title>
phpGroupWare Setup III
</title>
<date>
June 18, 2001
</date>
<author>
<firstname>Miles</firstname> <surname>Lott</surname>
</author>
<abstract>
<para>
A developer introduction to using the next generation setup application for phpgroupware.
</para>
</abstract>
</artheader>
<sect1>
<title>
Introduction
</title>
<sect2>
<title>
Welcome
</title>
<para>
Thanks for taking the time to look over this document. If you are a developer who is new to phpgroupware, this document will be invaluable to your success during the life of your application. This is in addition to the other fine documentation available in the phpgwapi/doc directory in your install. Even long-time phpgw developers should benefit this document. Herein, I will attempt to outline the critical steps required in order to get along with setup3, setup-TNG, or whatever we end up calling it (Hey, how about 'setup'?)
</para>
</sect2>
<sect2>
<title>
Overview
</title>
<para>
With setup3, we introduce several new capabilities and technologies for the developer and end user alike. Michael Dean was kind enough to offer up schema_proc to form the core of an abstracted and database-independent upgrade process. This enables developers to write a single set of upgrades and table definitions, which should then work on MySQL and PostgreSQL, or any other database type we might add in the future.
</para>
<para>
Adding to this to control the process was a good chunk of the old setup program, written by Dan Kuykendall (Seek3r). Dan had everything to do with the new dependencies support and with the format of the &dollar;setup_info array in setup3.
</para>
<para>
Setup3 adds multi-language support for the setup application, a long missed feature, I would imagine.
</para>
<para>
Setup3 gives each application developer control over their application install and upgrade processes, while giving them access to work within a realm formerly owned by only the former core phpgroupware applications. Yes, this is extra work for the developer. But it is hoped that setup3 is also viewed as a tool that can truly enhance the development process.
</para>
<para>
OK. Let's dive right in...
</para>
</sect2>
</sect1>
<sect1>
<title>
Application setup files
</title>
<para>
The files in this section are contained within each application/setup directory. Every app will some of these files in order to operate with setup3.
</para>
<sect2>
<title>
setup.inc.php (Required)
</title>
<sect3>
<title>
Basic information
</title>
<para>
The values in this section must be used by all applications.
</para>
<para>
The first section of setup.inc.php defines the very basic and yet critical information about the application. Take a look at the following section:
</para>
<programlisting>
<![ CDATA [$setup_info['addressbook']['name'] = 'addressbook';
]]><![ CDATA [$setup_info['addressbook']['title'] = 'Addressbook';
]]><![ CDATA [$setup_info['addressbook']['version'] = '0.9.13.002';
]]><![ CDATA [$setup_info['addressbook']['app_order'] = 4;
]]><![ CDATA [$setup_info['addressbook']['enable'] = 1;
]]> </programlisting>
<para>
'name' is used throughout phpgroupware, typically in &dollar;phpgw_info flags such as 'currentapp' or as the 'app_name' almost everywhere else.
</para>
<para>
'title' would be used in the navbar, admin, preferences, as well as in the application itself.
</para>
<para>
The 'version' string defines the version of the application and table code. This would be incremented whenever you create a new upgrade function, and typically only for table modifications. If the change is significant from the last code update, you could increment this here also. Incrementing this version string is not trivial, so please do read the rest of this document for more information about that.
</para>
<para>
'app_order' determines the order of applications in the navbar. If the number you set here is the same as is set for another app, the app whose 'name' is first in the English alphabet would appear first. Smaller numbers show closer to the top or left end of the navbar, depending upon the layout.
</para>
<para>
The 'enable' string is used by the phpgroupware API to determine whether an application is disabled, enabled, or enabled but hidden from the navbar. Most applications will want this set to a value of 1 (enabled). The notifywindow app sets this to 2, which keeps it off the navbar. An enable of 0 would disable the app by default. There is one other special case, 3, which is used primarily by the API itself. From the perspective of setup3, the API is an application just like any other application. By setting the 'enable' flag to 3, the API is still enabled, but will not be assignable to a user as a real application. It will thereby be hidden from the admin for application and user/group editing.
</para>
</sect3>
<sect3>
<title>
Table info
</title>
<sect4>
<title>
Only applications with database tables will use entries in this section.
</title>
<para>
The next section of &dollar;setup_info values is an array defining all of the application's database tables:
</para>
<programlisting>
<![ CDATA [$setup_info['addressbook']['tables'] = array(
]]><![ CDATA [ 'phpgw_addressbook',
]]><![ CDATA [ 'phpgw_addressbook_extra'
]]><![ CDATA [);
]]> </programlisting>
<para>
This is a simple array, and must list accurately the current table names you are using in your application. This list will match a much more complex array of table specifications, as you will see below.
</para>
</sect4>
</sect3>
<sect3>
<title>
Hooks
</title>
<sect4>
<title>
Some applications will use this section.
</title>
<para>
The hooks array part of &dollar;setup_info contains a simple list of hooks the application will use:
</para>
<programlisting>
<![ CDATA [$setup_info['addressbook']['hooks'][] = 'preferences';
]]><![ CDATA [$setup_info['addressbook']['hooks'][] = 'admin';
]]> </programlisting>
<para>
Here we also note a different method of 'stuffing the array.' In any case, this list of hooks will be required soon in order for your hook_admin.inc.php and other files to work. This is being done to cut down on the manual directory listing and file_exists loops done currently to discover hook files. Other than 'preferences' and 'admin', 'home', 'manual', 'after_navbar' and 'navbar_end' are all valid hook entries.
</para>
</sect4>
</sect3>
<sect3>
<title>
Dependencies
</title>
<sect4>
<title>
All applications will have at least one entry here.
</title>
<para>
The final section, or array of data, is a listing of the other applications your application requires in order to function:
</para>
<programlisting>
<![ CDATA [$setup_info['addressbook']['depends'][] = array(
]]><![ CDATA [ 'appname' => 'phpgwapi',
]]><![ CDATA [ 'versions' => Array(
]]><![ CDATA [ '0.9.10',
]]><![ CDATA [ '0.9.11',
]]><![ CDATA [ '0.9.12',
]]><![ CDATA [ '0.9.13'
]]><![ CDATA [ )
]]><![ CDATA [);
]]> </programlisting>
<para>
This is the standard dependency array for all phpgroupware applications. It states that this application requires the phpgwapi, and lists the versions with which versions this app is compatible. This list would need to be appended upon each new API release, assuming your application is compatible with this new API version. You may list other applications here, e.g. your app might depend upon 'email' in order to work properly.
</para>
<para>
Do NOT list applications here without considering this: If you do list an application here, and your app does not really require it, your application will not install unless that other application is already installed. This is handled normally within the install/upgrade process loops, which will install only applications whose dependencies are satisfied. Using a multipass function, the applications are installed in the correct order to ensure that dependencies are resolved. In all cases, the API would be installed first in every new install or upgrade, since all applications depend on the API.
</para>
</sect4>
</sect3>
</sect2>
<sect2>
<title>
tables_baseline.inc.php (Recommended)
</title>
<sect3>
<title>
Any application that has at least one upgrade routine will have this file.
</title>
<para>
The tables_baseline file represents the earliest supported version of an application's tables. This file is used only in the upgrade process, and is critical to its success. It contains an array of database-independent table, field, key and index definitions.
</para>
<para>
This array is formatted for use by the class.schema_proc_array.inc.php file in setup3. See the tables_update section below for more detail about schema_proc, but for now, here is a simple table definition in this format:
</para>
<programlisting>
<![ CDATA [$phpgw_baseline = array(
]]><![ CDATA [ 'skel' => array(
]]><![ CDATA [ 'fd' => array(
]]><![ CDATA [ 'skel_id' => array('type' => 'auto','nullable' => false),
]]><![ CDATA [ 'skel_owner' => array('type' => 'varchar','precision' => 25),
]]><![ CDATA [ 'skel_access' => array('type' => 'varchar','precision' => 10),
]]><![ CDATA [ 'skel_cat' => array('type' => 'int','precision' => 4),
]]><![ CDATA [ 'skel_des' => array('type' => 'text'),
]]><![ CDATA [ 'skel_pri' => array('type' => 'int','precision' => 4)
]]><![ CDATA [ ),
]]><![ CDATA [ 'pk' => array('skel_id'),
]]><![ CDATA [ 'fk' => array(),
]]><![ CDATA [ 'ix' => array(),
]]><![ CDATA [ 'uc' => array()
]]><![ CDATA [ )
]]><![ CDATA [);
]]> </programlisting>
<para>
This multi-dimensional array contains 1 subarray with 5 subs of its own. The first array ('skel' above) defines the table name. Below that are 5 sections, 'fd' for field definitions, 'pk' to define primary keys, 'fk' to define foreign keys, 'ix' to define indexed fields, and 'uc' to define columns that require unique values. In the above example, the table 'skel' has 6 fields (skel_id, skel_owner, skel_access, skel_cat, skel_des, skel_pri), and 'skel_id' is defined also as the primary key for this table. More information on this array is below. But, this format was chosen as an available solution for defining tables and fields without having to maintain seperate files for different databases.
</para>
</sect3>
</sect2>
<sect2>
<title>
tables_current.inc.php (Recommended)
</title>
<sect3>
<title>
All applications with tables will need this file.
</title>
<para>
The tables_current file defines the current table definition that matches the 'version' string in &dollar;setup_info as well as the current code. This file is used only for new installs, or whenever the application is removed and reinstalled. The format and name of the array in this file is the same as for the tables_baseline file listed above. In fact, whenever it is required to change your table definitions, you would start by copying the current file over to become the tables_baseline file. After having created your upgrade routines, you would then recreate the current file to match the new table definitions.
</para>
</sect3>
</sect2>
<sect2>
<title>
tables_update.inc.php (Recommended)
</title>
<sect3>
<title>
Any application which requires an upgrade to a previous version's tables will need this file.
</title>
<para>
This file will be the most complex of all setup-oriented files with which you will be working. It will contain all upgrade functions capable of upgrading any possible version of your phpgroupware app. These upgrade routines roughly match the old setup program's upgrade functions, but the use of objects and the methods have changed dramatically. The simplest version upgrade routine would look like:
</para>
<programlisting>
<![ CDATA [$test[] = "0.9.3pre10";
]]><![ CDATA [function addressbook_upgrade0_9_3pre10()
]]><![ CDATA [{
]]><![ CDATA [ global $setup_info;
]]><![ CDATA [ $setup_info['addressbook']['currentver'] = '0.9.3';
]]><![ CDATA [ return $setup_info['addressbook']['currentver'];
]]><![ CDATA [}
]]> </programlisting>
<para>
This upgrade function merely updates the current version number. Note that there is not only an upgrade function, but also the setting of a value in the &dollar;test array. The name 'test' is a holdover from the old setup program, and is an arbitrary choice. However, this name must be used for the upgrade process to work. Prior to each of your upgrade functions, add the value of the previous version to &dollar;test.
</para>
<para>
Now look at the function name. The name is important and should be structured as the application name and the version from which you are intending to upgrade. The '.'s in the version string are replaced with '_'.
</para>
<para>
Inside the function, we global the &dollar;setup_info array. Next, we alter the version number in that array, for our application. Please be careful to specify YOUR application name here. The very last thing we do is to return this new version to the calling function. The upgrade process relies on the value returned, since it uses this directly to determine the new version. This may appear illogical on some level, but it does work. The reason for returning this value instead of a True or 1, etc. has to do with variable scope and lifetime. In this way, even the globaling of &dollar;setup_info inside the function may have little effect on the upgrade process. But, there may be values in this array you would want to use within the function. More on that later.
</para>
<para>
There is one other variable you would need if doing any database operations here. If you global &dollar;phpgw_setup, you will then have access to db and schema_proc objects and functions. The objects of interest here are:
</para>
<itemizedlist>
<listitem>
<para>
&dollar;phpgw_setup-&gt;oProc
</para>
</listitem>
<listitem>
<para>
&dollar;phpgw_setup-&gt;db.
</para>
</listitem>
</itemizedlist>
<para>
For most database work you should use the oProc object. This also has a db object that should be used for most standard phpgw API db class functions, including &dollar;db-&gt;query, next_record, num_rows, and f. The use of these for standard db operations is critical to the upgrade process. Schema_proc has a flag that can be set to determine what mode of upgrade we are in. This flag is set in the setup class during the upgrade process, and should not be altered locally.
</para>
<para>
This flag is a decision on whether to alter the database or the schema_proc array. The tables_baseline file above is loaded by setup prior to running your upgrade routines. If the current installed version is greater than the current upgrade routine, we don't need to alter the database yet. But schema_proc instead alters the &dollar;phpgw_baseline array in memory. The maintenance of this array is done even when we do alter the database. Once our version number in the test array matches the currently installed version of an application, real work on the tables begins.
</para>
<para>
'Why bother modifying this array at all', you may ask. The array must be maintained in order to keep current table definition status. This is used in some schema_proc functions when altering columns and tables. This is especially critical for pgsql schema_proc functions.
</para>
<para>
By using the &dollar;phpgw_setup-&gt;oProc object for basic inserts and queries, we acheive the ability to run all upgrade functions in every upgrade cycle without actually altering the database until we reach the current version we actually want to upgrade. For example:
</para>
<programlisting>
<![ CDATA [$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='notes'";
]]><![ CDATA [$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
]]><![ CDATA [while($phpgw_setup->oProc->next_record()) {
]]> </programlisting>
<para>
We could have used &dollar;phpgw_setup-&gt;db or even a copy for the above activity. However, using the above method ensures that an array only upgrade does just that. If the flag was set in setup telling schema_proc to alter the array only, we do not want to touch the tables for inserts or selects yet. In this case, &dollar;phpgw_setup-&gt;oProc-&gt;next_record() returns False, and the loop is skipped. The &dollar;phpgw_baseline array does not know about table content, only table and field definitions.
</para>
<para>
If the upgrade function containing this method is actually working on the tables (currentver &lt;= the upgrade function), then next_record() is returned as the expected action of pulling the next row of data. Inside of this while loop, you can safely use &dollar;phpgw_setup-&gt;db, or preferably a copy, to do the insert/delete, etc you want to have happen here.
</para>
<programlisting>
<![ CDATA [ $cid = $phpgw_setup->oProc->f('contact_id');
]]><![ CDATA [ $cvalu = $phpgw_setup->oProc->f('contact_value');
]]><![ CDATA [ $update = "UPDATE phpgw_addressbook set note='" . $cvalu . "' WHERE id=" . $cid;
]]><![ CDATA [ $db1->query($update);
]]><![ CDATA [ $delete = "DELETE FROM phpgw_addressbook_extra WHERE contact_id=" . $cid . " AND contact_name='notes'";
]]><![ CDATA [ $db1->query($delete);
]]><![ CDATA [}
]]> </programlisting>
<para>
&dollar;db1 is a copy of &dollar;phpgw_setup-&gt;db, to avoid potential conflicts with the rest of setup's db activities.
</para>
<para>
In addition to the basic API db class functions, schema_proc introduces the following special functions:
</para>
<programlisting>
<![ CDATA [function DropTable($sTableName)
]]><![ CDATA [function DropColumn($sTableName, $aTableDef, $sColumnName)
]]><![ CDATA [function RenameTable($sOldTableName, $sNewTableName)
]]><![ CDATA [function RenameColumn($sTableName, $sOldColumnName, $sNewColumnName)
]]><![ CDATA [function AlterColumn($sTableName, $sColumnName, $aColumnDef)
]]><![ CDATA [function AddColumn($sTableName, $sColumnName, $aColumnDef)
]]><![ CDATA [function CreateTable($sTableName, $aTableDef)
]]> </programlisting>
<para>
Please use these functions where appropriate in place of standard SQL CREATE, DROP, and ALTER TABLE commands. This will ensure that your upgrade script works for all supported databases.
</para>
<para>
Of these functions, DropTable, RenameTable, and RenameColumn are pretty straightforward. Pass these the table names you wish to Drop/Rename, and schema_proc will handle the rest, including indexes and sequences, where applicable.
</para>
<para>
The remaining functions require some explanation:
</para>
<itemizedlist>
<listitem>
<para>
CreateTable:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [$phpgw_setup->oProc->CreateTable(
]]><![ CDATA [ 'categories', array(
]]><![ CDATA [ 'fd' => array(
]]><![ CDATA [ 'cat_id' => array('type' => 'auto','nullable' => false),
]]><![ CDATA [ 'account_id' => array('type' => 'int','precision' => 4,'nullable' => false, 'default' => 0),
]]><![ CDATA [ 'app_name' => array('type' => 'varchar','precision' => 25,'nullable' => false),
]]><![ CDATA [ 'cat_name' => array('type' => 'varchar', 'precision' => 150, 'nullable' => false),
]]><![ CDATA [ 'cat_description' => array('type' => 'text', 'nullable' => false)
]]><![ CDATA [ ),
]]><![ CDATA [ 'pk' => array('cat_id'),
]]><![ CDATA [ 'ix' => array(),
]]><![ CDATA [ 'fk' => array(),
]]><![ CDATA [ 'uc' => array()
]]><![ CDATA [ )
]]><![ CDATA [);
]]> </programlisting>
<para>
Does this look familiar? The array passed to CreateTable is in the format used also in tables_baseline and tables_current. Note a slight difference where the table name is being passed as a seperate argument. The second argument to the function is the table definition array, starting with 'fd'.
</para>
<itemizedlist>
<listitem>
<para>
AddColumn:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [$phpgw_setup->oProc->AddColumn('phpgw_categories','cat_access',array('type' => 'varchar', 'precision' => 25));
]]> </programlisting>
<para>
Here we pass the table name of an existing table, the new column name, and a field definition. This definition is merely a slice of the table arrays found earlier in this document.
</para>
<itemizedlist>
<listitem>
<para>
AlterColumn:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [$phpgw_setup->oProc->AlterColumn('phpgw_sessions','session_action',array('type' => 'varchar', 'precision' => '255'));
]]> </programlisting>
<para>
The format of this function matches AddColumn. It is also a simple case of passing the table name, field name, and field definition.
</para>
<itemizedlist>
<listitem>
<para>
DropColumn:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [$newtbldef = array(
]]><![ CDATA [ "fd" => array(
]]><![ CDATA [ 'acl_appname' => array('type' => 'varchar', 'precision' => 50),
]]><![ CDATA [ 'acl_location' => array('type' => 'varchar', 'precision' => 255),
]]><![ CDATA [ 'acl_account' => array('type' => 'int', 'precision' => 4),
]]><![ CDATA [ 'acl_rights' => array('type' => 'int', 'precision' => 4)
]]><![ CDATA [ ),
]]><![ CDATA [ 'pk' => array(),
]]><![ CDATA [ 'ix' => array(),
]]><![ CDATA [ 'fk' => array(),
]]><![ CDATA [ 'uc' => array()
]]><![ CDATA [);
]]><![ CDATA [$phpgw_setup->oProc->DropColumn('phpgw_acl',$newtbldef,'acl_account_type');
]]> </programlisting>
<para>
This is the most complicated function in schema_proc, from the user's perspective. Its complexity is necessitated by the requirement of some databases to recreate a table in the case of dropping a column. Note that the table definition array is being used yet again. The array defined here should match the table definition you want after this function has completed. Here, we are dropping the column 'acl_account_type' from the table 'phpgw_acl', and the table definition does not have this column defined. You could copy information from your tables_current file here and edit it to match the desired new table spec, less the column you wish to drop.
</para>
<para>
There are additional functions within schema_proc, the majority of which are not to be called directly. They are used internally. If you do wish to investigate further, use class.schema_proc.inc.php as your guide. This master file includes the class.schema_proc_DBMS.inc.php and class.schema_proc_array.inc.php files. The DBMS files should not be used as a guide, since their functions are called from the master class, and the parameters are different from what you might expect relative to the master.
</para>
<para>
PLEASE, DO NOT WRITE TO OR ALTER ANOTHER APPLICATION'S TABLES OR THE API TABLES IN YOUR APPLICATION UPGRADE FUNCTIONS!
</para>
</sect3>
</sect2>
<sect2>
<title>
default_records.inc.php (Optional)
</title>
<sect3>
<title>
Any application with tables that wants to load some default data will need this file.
</title>
<para>
The default_records file consists of a list of SQL INSERTs using the &dollar;oProc object directly:
</para>
<programlisting>
<![ CDATA [$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('available')");
]]><![ CDATA [$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('no longer available')");
]]><![ CDATA [$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name) VALUES ('back order')");
]]> </programlisting>
<para>
In this case, the developer wanted to insert some status information, which was then used in a select box on an html form. Using the default_records file, every new install will have this data included. This file should consist of queries applicable to the tables defined in setup.inc.php and tables_current.inc.php.
</para>
</sect3>
</sect2>
<sect2>
<title>
test_data.inc.php (Optional)
</title>
<sect3>
<title>
Any developer wanting to test the full list of upgrade routines can use this file.
</title>
<para>
test_data.inc.php is similar to default_records above. It is called only by schematoy.php and is never installed with a new install or upgrade. This is a developer-only file. The INSERTs here should be applicable to the tables_baseline table definitions.
</para>
</sect3>
</sect2>
<sect2>
<title>
language files (Required)
</title>
<sect3>
<title>
All applications should have at least a file of English translations, used for their application lang() calls.
</title>
<itemizedlist>
<listitem>
<para>
Format of a lang file:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [{phrase}{TAB}{appname}{TAB}{LANG_CODE}{TAB}{translation}
]]><![ CDATA [ e.g:
]]><![ CDATA [first name common en First Name
]]><![ CDATA [first name common de Vorname
]]> </programlisting>
<itemizedlist>
<listitem>
<para>
Filenames:
</para>
</listitem>
</itemizedlist>
<programlisting>
<![ CDATA [phpgw_{LANG_CODE}.lang
]]><![ CDATA [ e.g.
]]><![ CDATA [English: phpgw_en.lang
]]><![ CDATA [German: phpgw_de.lang
]]> </programlisting>
<para>
Please see the contents of the API 'languages' table for the correct setting of the LANG_CODE.
</para>
</sect3>
</sect2>
</sect1>
<sect1>
<title>
Developer Tools
</title>
<sect2>
<title>
sqltoarray.php
</title>
<sect3>
<title>
Displays the current schema_proc array defining an application's tables.
</title>
<para>
This web application reads the current table status live from the database. It then parses this information into a hopefully correct table definition array for schema_proc. Upon visiting this app, you are shown a list of currently installed applications with defined tables. You may then select one app or all apps, and then submit the form. From this form you may then download a tables_current file, suitable for commission to cvs. Please do check the format to make sure the definitions are correct.
</para>
</sect3>
</sect2>
<sect2>
<title>
schematoy.php
</title>
<sect3>
<title>
Runs the full cycle of upgrades, including optional test_data.
</title>
<para>
This app is not beautiful, may bomb on you, and will definitely drop your application's tables. The display is similar to the user/admin tool, applications.php. You are shown a list of apps with tables. Select one app, and enter a target version. Upon submission of the form:
</para>
<itemizedlist>
<listitem>
<para>
All application tables are dropped.
</para>
</listitem>
<listitem>
<para>
tables_baseline.inc.php is loaded.
</para>
</listitem>
<listitem>
<para>
test_data.inc.php is loaded
</para>
</listitem>
<listitem>
<para>
tables_update.inc.php is loaded.
</para>
</listitem>
<listitem>
<para>
a full application upgrade test begins.
</para>
</listitem>
</itemizedlist>
<para>
This will give a LOT of debugging output. Depending on your database, the process may take quite awhile. This tool should be considered as a destructive test of the full upgrade cycle. If the upgrade process is successful, you can then check the loaded test_data to see that it is still in place as expected after all the table modifications, etc. If not, it should be clear where the error has occurred. Look for the usual INVALID SQL warnings, among others.
</para>
</sect3>
</sect2>
<sect2>
<title>
tools subdirectory
</title>
<sect3>
<title>
some utilities for sql file conversion, etc.
</title>
<para>
In the tools directory under setup3, there should be at least a couple of hopefully handy perl or shell scripts. These are for running on the commandline only, and might apply to converting SQL files into lang files, etc. They are not expected to be perfect, but might offer some assistance or ideas for additional utilities. Use these at your own risk or benefit.
</para>
</sect3>
</sect2>
</sect1>
<sect1>
<title>
The install/upgrade process
</title>
<sect2>
<title>
Overview
</title>
<sect3>
<title>
Setup internal upgrade functions
</title>
<para>
Setup uses a common set of functions for new installs and upgrades. These are implemented as multi-pass loops. For a single application install or upgrade, a single pass is done. For multiple application installs or upgrades, multiple passes are done automatically. The order of install in a mass install or upgrade is determined by application dependencies. The other determining factor is the order in which the application directories and setup.inc.php files are read from the filesystem.
</para>
</sect3>
</sect2>
<sect2>
<title>
New installs
</title>
<sect3>
<title>
Detection
</title>
<para>
Each run of index.php or applications.php in setup3 first runs a set of detection routines. These read the data from each setup.inc.php file, and from the 'applications' or 'phpgw_applications' table as appropriate, and only if one of these tables exists. This data is parsed into the &dollar;setup_info array. In this case, this array contains information about all applications. Based on the information gathered, a status flag is set to one of the following values:
</para>
<itemizedlist>
<listitem>
<para>
U - Upgrade required/available
</para>
</listitem>
<listitem>
<para>
R - upgrade in pRogress
</para>
</listitem>
<listitem>
<para>
C - upgrade Completed successfully
</para>
</listitem>
<listitem>
<para>
D - Dependency failure
</para>
</listitem>
<listitem>
<para>
F - upgrade Failed
</para>
</listitem>
<listitem>
<para>
V - Version mismatch at end of upgrade
</para>
</listitem>
<listitem>
<para>
M - Missing files at start of upgrade (Not used, proposed only)
</para>
</listitem>
</itemizedlist>
<para>
Using this information, the setup logic in index.php determines what mode we are in. index.php is not capable of being selective about which application it found as being out of sync. It is designed only for 'Simple Application Management', which is Step 1 of the setup process. For more selective application manipulation, use applications.php. index.php then tells the user that 1) their applications are current 2) some of their applications are out of sync 3) no db exists, etc. For a new install, all applications will be out of sync, since there is not even an 'phpgw_applications' table in the database to tell setup what the status is for any application.
</para>
</sect3>
<sect3>
<title>
Selection
</title>
<para>
There is no selection for application installs in 'new install' mode. All physically present applications will be installed, or at least attempted.
</para>
</sect3>
<sect3>
<title>
Installation
</title>
<para>
Once the setup user clicks the magic button to install all applications, the following occurs:
</para>
<itemizedlist>
<listitem>
<para>
The setup_info array is passed to the process_pass() function, using a method='new'
</para>
</listitem>
<listitem>
<para>
Applications whose status flag='U' (API on first pass) are then handed off to the process_current() function. This handles inclusion and installation of the application's tables_current.inc.php file.
</para>
</listitem>
<listitem>
<para>
The application is registered as a new application in the 'phpgw_applications' table. If for some reason there is old data in this table for this application, it will be updated instead. Its hooks, if any, are registered in the 'phpgw_hooks' table.
</para>
</listitem>
<listitem>
<para>
Next, this array is passed to the process_default_records() function. If this file is present in the current application's setup directory, the queries here are run to install the data to the application's table(s).
</para>
</listitem>
<listitem>
<para>
The above is repeated until all application status flags equal 'C'. However, if an application install failed for some reason, it will then be skipped on the next pass. This keeps the loop from running away.
</para>
</listitem>
</itemizedlist>
</sect3>
</sect2>
<sect2>
<title>
Upgrades
</title>
<sect3>
<title>
Detection
</title>
<para>
Only an API version mismatch will trigger an automated request for the user to upgrade their install. Once the api is current, they can move on to applications.php for more 'Advanced Application Management', which is Step 4 of the setup process. However, if the API is out of sync, clicking 'Upgrade' in index.php will also attempt to upgrade other applications which may be out of sync, as well. As the phpgwapi continues to stabilize, it is felt that this method of upgrading will become less and less common.
</para>
</sect3>
<sect3>
<title>
Selection
</title>
<para>
Within applications.php, a color-coded matrix of application status and actions is displayed. Depending on the status flag of each application, certain actions will be either enabled or disabled. These actions include 'install', 'upgrade', 'remove'. If something is very wrong with previous attempts to install or upgrade an application, another column called 'resolution' will then display a link. This link will display additional information which would be helpful for determining how to resolve the problem. Assuming all is well, the user can select applications requiring upgrade from this list. Once selected, they submit the form. This runs the follow three routines in order:
</para>
<itemizedlist>
<listitem>
<para>
remove
</para>
</listitem>
<listitem>
<para>
install
</para>
</listitem>
<listitem>
<para>
upgrade
</para>
</listitem>
</itemizedlist>
</sect3>
<sect3>
<title>
Upgrade
</title>
<para>
The idea here is that multiple actions can be selected and run in order in one click. In any case, once they select an application for upgrade, the following occurs:
</para>
<itemizedlist>
<listitem>
<para>
A stripped down version of the setup_info array is passed to the process_upgrade() function. This array contains only the information for the selected application
</para>
</listitem>
<listitem>
<para>
Within process_upgrade(), the tables_baseline.inc.php file for the application is loaded.
</para>
</listitem>
<listitem>
<para>
The tables_update.inc.php file for the application is loaded
</para>
</listitem>
<listitem>
<para>
The contents of the test array is used to loop through the entire list of upgrade functions for the application. The application's unique function names are rebuilt, then run.
</para>
</listitem>
<listitem>
<para>
When the currentver (installed) matches the version (available), process_upgrade() exits, setting the status flag for the app to 'C'.
</para>
</listitem>
<listitem>
<para>
Just prior to exiting, the application and its hooks are updated into the 'phpgw_applications' and 'phpgw_hooks' tables.
</para>
</listitem>
</itemizedlist>
</sect3>
</sect2>
<sect2>
<title>
Uninstallation/Removal
</title>
<sect3>
<title>
Selection
</title>
<para>
Selective removal of an application is done via applications.php, in a manner similar to the method above for upgrades.
</para>
</sect3>
<sect3>
<title>
Uninstallation
</title>
<para>
Once an application is selected for removal:
</para>
<itemizedlist>
<listitem>
<para>
A stripped down version of the setup_info array is passed to the process_droptables() function. This function removes all of the application's defined tables, but only after first checking to see if the tables are there. In this way, we attempt to cut down on the number of errors sent to the browser.
</para>
</listitem>
<listitem>
<para>
The application's hooks are deregistered (removed from 'phpgw_hooks').
</para>
</listitem>
<listitem>
<para>
The application itself is deregistered (removed from 'phpgw_applications').
</para>
</listitem>
</itemizedlist>
</sect3>
</sect2>
</sect1>
<sect1>
<title>
Caveats
</title>
<sect2>
<title>
Must see info
</title>
<sect3>
<title>
Auto fields
</title>
<para>
For auto type fields, schema_proc creates a sequence automatically based on the table name for databases that require sequences. In the case of postgresql, the limit for this name based on our tests is 31 characters. The schema_proc format is:
</para>
<programlisting>
<![ CDATA [$sSequenceSQL = sprintf("CREATE SEQUENCE seq_%s", $sTableName);
]]> </programlisting>
<para>
This limits the maximum length for a tablename to 27 characters. Based on the tablename standard in phpgw of 'phpgw_tablename', you are further limited to 21 characters in which to describe your table. You will need to be less descriptive in some cases, e.g. use 'phpgw_widget_cats' instead of 'phpgw_widget_info_categories'.
</para>
</sect3>
<sect3>
<title>
Default 0
</title>
<para>
For int fields, a default of 0 is not assumed. Only some databases will set this default for you, MySQL being one. You will need to explicitly define this default in the table definition. Also, for auto fields, do not enter a default, since the resulting SQL query would fail on many RDBMS.
</para>
</sect3>
</sect2>
</sect1>
</article>

891
setup/doc/setup3.txt Normal file
View File

@ -0,0 +1,891 @@
phpGroupWare Setup III
June 18, 2001
Abstract
A developer introduction to using the next generation setup
application for phpgroupware.
1 Introduction
1.1 Welcome
Thanks for taking the time to look over this document. If
you are a developer who is new to phpgroupware, this document
will be invaluable to your success during the life of your
application. This is in addition to the other fine documentation
available in the phpgwapi/doc directory in your install.
Even long-time phpgw developers should benefit this document.
Herein, I will attempt to outline the critical steps required
in order to get along with setup3, setup-TNG, or whatever
we end up calling it (Hey, how about 'setup'?)
1.2 Overview
With setup3, we introduce several new capabilities and technologies
for the developer and end user alike. Michael Dean was kind
enough to offer up schema_proc to form the core of an abstracted
and database-independent upgrade process. This enables developers
to write a single set of upgrades and table definitions,
which should then work on MySQL and PostgreSQL, or any other
database type we might add in the future.
Adding to this to control the process was a good chunk of
the old setup program, written by Dan Kuykendall (Seek3r).
Dan had everything to do with the new dependencies support
and with the format of the $setup_info array in setup3.
Setup3 adds multi-language support for the setup application,
a long missed feature, I would imagine.
Setup3 gives each application developer control over their
application install and upgrade processes, while giving
them access to work within a realm formerly owned by only
the former core phpgroupware applications. Yes, this is
extra work for the developer. But it is hoped that setup3
is also viewed as a tool that can truly enhance the development
process.
OK. Let's dive right in...
2 Application setup files
The files in this section are contained within each application/setup
directory. Every app will some of these files in order to
operate with setup3.
2.1 setup.inc.php (Required)
2.1.1 Basic information
The values in this section must be used by all applications.
The first section of setup.inc.php defines the very basic
and yet critical information about the application. Take
a look at the following section:
$setup_info['addressbook']['name'] = 'addressbook';
$setup_info['addressbook']['title'] = 'Addressbook';
$setup_info['addressbook']['version'] = '0.9.13.002';
$setup_info['addressbook']['app_order'] = 4;
$setup_info['addressbook']['enable'] = 1;
'name' is used throughout phpgroupware, typically in $phpgw_info
flags such as 'currentapp' or as the 'app_name' almost everywhere
else.
'title' would be used in the navbar, admin, preferences,
as well as in the application itself.
The 'version' string defines the version of the application
and table code. This would be incremented whenever you create
a new upgrade function, and typically only for table modifications.
If the change is significant from the last code update,
you could increment this here also. Incrementing this version
string is not trivial, so please do read the rest of this
document for more information about that.
'app_order' determines the order of applications in the navbar.
If the number you set here is the same as is set for another
app, the app whose 'name' is first in the English alphabet
would appear first. Smaller numbers show closer to the top
or left end of the navbar, depending upon the layout.
The 'enable' string is used by the phpgroupware API to determine
whether an application is disabled, enabled, or enabled
but hidden from the navbar. Most applications will want
this set to a value of 1 (enabled). The notifywindow app
sets this to 2, which keeps it off the navbar. An enable
of 0 would disable the app by default. There is one other
special case, 3, which is used primarily by the API itself.
From the perspective of setup3, the API is an application
just like any other application. By setting the 'enable'
flag to 3, the API is still enabled, but will not be assignable
to a user as a real application. It will thereby be hidden
from the admin for application and user/group editing.
2.1.2 Table info
Only applications with database tables will use entries
in this section.
The next section of $setup_info values is an array defining
all of the application's database tables:
$setup_info['addressbook']['tables'] = array(
'phpgw_addressbook',
'phpgw_addressbook_extra'
);
This is a simple array, and must list accurately the current
table names you are using in your application. This list
will match a much more complex array of table specifications,
as you will see below.
2.1.3 Hooks
Some applications will use this section.
The hooks array part of $setup_info contains a simple list
of hooks the application will use:
$setup_info['addressbook']['hooks'][] = 'preferences';
$setup_info['addressbook']['hooks'][] = 'admin';
Here we also note a different method of 'stuffing the array.'
In any case, this list of hooks will be required soon in
order for your hook_admin.inc.php and other files to work.
This is being done to cut down on the manual directory listing
and file_exists loops done currently to discover hook files.
Other than 'preferences' and 'admin', 'home', 'manual',
'after_navbar' and 'navbar_end' are all valid hook entries.
2.1.4 Dependencies
All applications will have at least one entry here.
The final section, or array of data, is a listing of the
other applications your application requires in order to
function:
$setup_info['addressbook']['depends'][] = array(
'appname' => 'phpgwapi',
'versions' => Array(
'0.9.10',
'0.9.11',
'0.9.12',
'0.9.13'
)
);
This is the standard dependency array for all phpgroupware
applications. It states that this application requires the
phpgwapi, and lists the versions with which versions this
app is compatible. This list would need to be appended upon
each new API release, assuming your application is compatible
with this new API version. You may list other applications
here, e.g. your app might depend upon 'email' in order to
work properly.
Do NOT list applications here without considering this: If
you do list an application here, and your app does not really
require it, your application will not install unless that
other application is already installed. This is handled
normally within the install/upgrade process loops, which
will install only applications whose dependencies are satisfied.
Using a multipass function, the applications are installed
in the correct order to ensure that dependencies are resolved.
In all cases, the API would be installed first in every
new install or upgrade, since all applications depend on
the API.
2.2 tables_baseline.inc.php (Recommended)
2.2.1 Any application that has at least one upgrade routine will
have this file.
The tables_baseline file represents the earliest supported
version of an application's tables. This file is used only
in the upgrade process, and is critical to its success.
It contains an array of database-independent table, field,
key and index definitions.
This array is formatted for use by the class.schema_proc_array.inc.php
file in setup3. See the tables_update section below for
more detail about schema_proc, but for now, here is a simple
table definition in this format:
$phpgw_baseline = array(
'skel' => array(
'fd' => array(
'skel_id' => array('type' => 'auto','nullable'
=> false),
'skel_owner' => array('type' => 'varchar','precision'
=> 25),
'skel_access' => array('type' => 'varchar','precision'
=> 10),
'skel_cat' => array('type' => 'int','precision'
=> 4),
'skel_des' => array('type' => 'text'),
'skel_pri' => array('type' => 'int','precision'
=> 4)
),
'pk' => array('skel_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
This multi-dimensional array contains 1 subarray with 5 subs
of its own. The first array ('skel' above) defines the table
name. Below that are 5 sections, 'fd' for field definitions,
'pk' to define primary keys, 'fk' to define foreign keys,
'ix' to define indexed fields, and 'uc' to define columns
that require unique values. In the above example, the table
'skel' has 6 fields (skel_id, skel_owner, skel_access, skel_cat,
skel_des, skel_pri), and 'skel_id' is defined also as the
primary key for this table. More information on this array
is below. But, this format was chosen as an available solution
for defining tables and fields without having to maintain
seperate files for different databases.
2.3 tables_current.inc.php (Recommended)
2.3.1 All applications with tables will need this file.
The tables_current file defines the current table definition
that matches the 'version' string in $setup_info as well
as the current code. This file is used only for new installs,
or whenever the application is removed and reinstalled.
The format and name of the array in this file is the same
as for the tables_baseline file listed above. In fact, whenever
it is required to change your table definitions, you would
start by copying the current file over to become the tables_baseline
file. After having created your upgrade routines, you would
then recreate the current file to match the new table definitions.
2.4 tables_update.inc.php (Recommended)
2.4.1 Any application which requires an upgrade to a previous
version's tables will need this file.
This file will be the most complex of all setup-oriented
files with which you will be working. It will contain all
upgrade functions capable of upgrading any possible version
of your phpgroupware app. These upgrade routines roughly
match the old setup program's upgrade functions, but the
use of objects and the methods have changed dramatically.
The simplest version upgrade routine would look like:
$test[] = "0.9.3pre10";
function addressbook_upgrade0_9_3pre10()
{
global $setup_info;
$setup_info['addressbook']['currentver'] = '0.9.3';
return $setup_info['addressbook']['currentver'];
}
This upgrade function merely updates the current version
number. Note that there is not only an upgrade function,
but also the setting of a value in the $test array. The
name 'test' is a holdover from the old setup program, and
is an arbitrary choice. However, this name must be used
for the upgrade process to work. Prior to each of your upgrade
functions, add the value of the previous version to $test.
Now look at the function name. The name is important and
should be structured as the application name and the version
from which you are intending to upgrade. The '.'s in the
version string are replaced with '_'.
Inside the function, we global the $setup_info array. Next,
we alter the version number in that array, for our application.
Please be careful to specify YOUR application name here.
The very last thing we do is to return this new version
to the calling function. The upgrade process relies on the
value returned, since it uses this directly to determine
the new version. This may appear illogical on some level,
but it does work. The reason for returning this value instead
of a True or 1, etc. has to do with variable scope and lifetime.
In this way, even the globaling of $setup_info inside the
function may have little effect on the upgrade process.
But, there may be values in this array you would want to
use within the function. More on that later.
There is one other variable you would need if doing any database
operations here. If you global $phpgw_setup, you will then
have access to db and schema_proc objects and functions.
The objects of interest here are:
* $phpgw_setup->oProc
* $phpgw_setup->db.
For most database work you should use the oProc object. This
also has a db object that should be used for most standard
phpgw API db class functions, including $db->query, next_record,
num_rows, and f. The use of these for standard db operations
is critical to the upgrade process. Schema_proc has a flag
that can be set to determine what mode of upgrade we are
in. This flag is set in the setup class during the upgrade
process, and should not be altered locally.
This flag is a decision on whether to alter the database
or the schema_proc array. The tables_baseline file above
is loaded by setup prior to running your upgrade routines.
If the current installed version is greater than the current
upgrade routine, we don't need to alter the database yet.
But schema_proc instead alters the $phpgw_baseline array
in memory. The maintenance of this array is done even when
we do alter the database. Once our version number in the
test array matches the currently installed version of an
application, real work on the tables begins.
'Why bother modifying this array at all', you may ask. The
array must be maintained in order to keep current table
definition status. This is used in some schema_proc functions
when altering columns and tables. This is especially critical
for pgsql schema_proc functions.
By using the $phpgw_setup->oProc object for basic inserts
and queries, we acheive the ability to run all upgrade functions
in every upgrade cycle without actually altering the database
until we reach the current version we actually want to upgrade.
For example:
$sql = "SELECT * FROM phpgw_addressbook_extra WHERE contact_name='notes'";
$phpgw_setup->oProc->query($sql,__LINE__,__FILE__);
while($phpgw_setup->oProc->next_record()) {
We could have used $phpgw_setup->db or even a copy for the
above activity. However, using the above method ensures
that an array only upgrade does just that. If the flag was
set in setup telling schema_proc to alter the array only,
we do not want to touch the tables for inserts or selects
yet. In this case, $phpgw_setup->oProc->next_record() returns
False, and the loop is skipped. The $phpgw_baseline array
does not know about table content, only table and field
definitions.
If the upgrade function containing this method is actually
working on the tables (currentver <= the upgrade function),
then next_record() is returned as the expected action of
pulling the next row of data. Inside of this while loop,
you can safely use $phpgw_setup->db, or preferably a copy,
to do the insert/delete, etc you want to have happen here.
$cid = $phpgw_setup->oProc->f('contact_id');
$cvalu = $phpgw_setup->oProc->f('contact_value');
$update = "UPDATE phpgw_addressbook set note='" . $cvalu
. "' WHERE id=" . $cid;
$db1->query($update);
$delete = "DELETE FROM phpgw_addressbook_extra WHERE
contact_id=" . $cid . " AND contact_name='notes'";
$db1->query($delete);
}
$db1 is a copy of $phpgw_setup->db, to avoid potential conflicts
with the rest of setup's db activities.
In addition to the basic API db class functions, schema_proc
introduces the following special functions:
function DropTable($sTableName)
function DropColumn($sTableName, $aTableDef, $sColumnName)
function RenameTable($sOldTableName, $sNewTableName)
function RenameColumn($sTableName, $sOldColumnName, $sNewColumnName)
function AlterColumn($sTableName, $sColumnName, $aColumnDef)
function AddColumn($sTableName, $sColumnName, $aColumnDef)
function CreateTable($sTableName, $aTableDef)
Please use these functions where appropriate in place of
standard SQL CREATE, DROP, and ALTER TABLE commands. This
will ensure that your upgrade script works for all supported
databases.
Of these functions, DropTable, RenameTable, and RenameColumn
are pretty straightforward. Pass these the table names you
wish to Drop/Rename, and schema_proc will handle the rest,
including indexes and sequences, where applicable.
The remaining functions require some explanation:
* CreateTable:
$phpgw_setup->oProc->CreateTable(
'categories', array(
'fd' => array(
'cat_id' => array('type' => 'auto','nullable'
=> false),
'account_id' => array('type' => 'int','precision'
=> 4,'nullable' => false, 'default' => 0),
'app_name' => array('type' => 'varchar','precision'
=> 25,'nullable' => false),
'cat_name' => array('type' => 'varchar', 'precision'
=> 150, 'nullable' => false),
'cat_description' => array('type' => 'text',
'nullable' => false)
),
'pk' => array('cat_id'),
'ix' => array(),
'fk' => array(),
'uc' => array()
)
);
Does this look familiar? The array passed to CreateTable
is in the format used also in tables_baseline and tables_current.
Note a slight difference where the table name is being passed
as a seperate argument. The second argument to the function
is the table definition array, starting with 'fd'.
* AddColumn:
$phpgw_setup->oProc->AddColumn('phpgw_categories','cat_access',array('type'
=> 'varchar', 'precision' => 25));
Here we pass the table name of an existing table, the new
column name, and a field definition. This definition is
merely a slice of the table arrays found earlier in this
document.
* AlterColumn:
$phpgw_setup->oProc->AlterColumn('phpgw_sessions','session_action',array('type'
=> 'varchar', 'precision' => '255'));
The format of this function matches AddColumn. It is also
a simple case of passing the table name, field name, and
field definition.
* DropColumn:
$newtbldef = array(
"fd" => array(
'acl_appname' => array('type' => 'varchar', 'precision'
=> 50),
'acl_location' => array('type' => 'varchar', 'precision'
=> 255),
'acl_account' => array('type' => 'int', 'precision'
=> 4),
'acl_rights' => array('type' => 'int', 'precision'
=> 4)
),
'pk' => array(),
'ix' => array(),
'fk' => array(),
'uc' => array()
);
$phpgw_setup->oProc->DropColumn('phpgw_acl',$newtbldef,'acl_account_type');
This is the most complicated function in schema_proc, from
the user's perspective. Its complexity is necessitated by
the requirement of some databases to recreate a table in
the case of dropping a column. Note that the table definition
array is being used yet again. The array defined here should
match the table definition you want after this function
has completed. Here, we are dropping the column 'acl_account_type'
from the table 'phpgw_acl', and the table definition does
not have this column defined. You could copy information
from your tables_current file here and edit it to match
the desired new table spec, less the column you wish to
drop.
There are additional functions within schema_proc, the majority
of which are not to be called directly. They are used internally.
If you do wish to investigate further, use class.schema_proc.inc.php
as your guide. This master file includes the class.schema_proc_DBMS.inc.php
and class.schema_proc_array.inc.php files. The DBMS files
should not be used as a guide, since their functions are
called from the master class, and the parameters are different
from what you might expect relative to the master.
PLEASE, DO NOT WRITE TO OR ALTER ANOTHER APPLICATION'S TABLES
OR THE API TABLES IN YOUR APPLICATION UPGRADE FUNCTIONS!
2.5 default_records.inc.php (Optional)
2.5.1 Any application with tables that wants to load some default
data will need this file.
The default_records file consists of a list of SQL INSERTs
using the $oProc object directly:
$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name)
VALUES ('available')");
$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name)
VALUES ('no longer available')");
$oProc->query("INSERT INTO phpgw_inv_statuslist (status_name)
VALUES ('back order')");
In this case, the developer wanted to insert some status
information, which was then used in a select box on an html
form. Using the default_records file, every new install
will have this data included. This file should consist of
queries applicable to the tables defined in setup.inc.php
and tables_current.inc.php.
2.6 test_data.inc.php (Optional)
2.6.1 Any developer wanting to test the full list of upgrade
routines can use this file.
test_data.inc.php is similar to default_records above. It
is called only by schematoy.php and is never installed with
a new install or upgrade. This is a developer-only file.
The INSERTs here should be applicable to the tables_baseline
table definitions.
2.7 language files (Required)
2.7.1 All applications should have at least a file of English
translations, used for their application lang() calls.
* Format of a lang file:
{phrase}{TAB}{appname}{TAB}{LANG_CODE}{TAB}{translation}
e.g:
first name common en First Name
first name common de Vorname
* Filenames:
phpgw_{LANG_CODE}.lang
e.g.
English: phpgw_en.lang
German: phpgw_de.lang
Please see the contents of the API 'languages' table for
the correct setting of the LANG_CODE.
3 Developer Tools
3.1 sqltoarray.php
3.1.1 Displays the current schema_proc array defining an application's
tables.
This web application reads the current table status live
from the database. It then parses this information into
a hopefully correct table definition array for schema_proc.
Upon visiting this app, you are shown a list of currently
installed applications with defined tables. You may then
select one app or all apps, and then submit the form. From
this form you may then download a tables_current file, suitable
for commission to cvs. Please do check the format to make
sure the definitions are correct.
3.2 schematoy.php
3.2.1 Runs the full cycle of upgrades, including optional test_data.
This app is not beautiful, may bomb on you, and will definitely
drop your application's tables. The display is similar to
the user/admin tool, applications.php. You are shown a list
of apps with tables. Select one app, and enter a target
version. Upon submission of the form:
* All application tables are dropped.
* tables_baseline.inc.php is loaded.
* test_data.inc.php is loaded
* tables_update.inc.php is loaded.
* a full application upgrade test begins.
This will give a LOT of debugging output. Depending on your
database, the process may take quite awhile. This tool should
be considered as a destructive test of the full upgrade
cycle. If the upgrade process is successful, you can then
check the loaded test_data to see that it is still in place
as expected after all the table modifications, etc. If not,
it should be clear where the error has occurred. Look for
the usual INVALID SQL warnings, among others.
3.3 tools subdirectory
3.3.1 some utilities for sql file conversion, etc.
In the tools directory under setup3, there should be at least
a couple of hopefully handy perl or shell scripts. These
are for running on the commandline only, and might apply
to converting SQL files into lang files, etc. They are not
expected to be perfect, but might offer some assistance
or ideas for additional utilities. Use these at your own
risk or benefit.
4 The install/upgrade process
4.1 Overview
4.1.1 Setup internal upgrade functions
Setup uses a common set of functions for new installs and
upgrades. These are implemented as multi-pass loops. For
a single application install or upgrade, a single pass is
done. For multiple application installs or upgrades, multiple
passes are done automatically. The order of install in a
mass install or upgrade is determined by application dependencies.
The other determining factor is the order in which the application
directories and setup.inc.php files are read from the filesystem.
4.2 New installs
4.2.1 Detection
Each run of index.php or applications.php in setup3 first
runs a set of detection routines. These read the data from
each setup.inc.php file, and from the 'applications' or
'phpgw_applications' table as appropriate, and only if one
of these tables exists. This data is parsed into the $setup_info
array. In this case, this array contains information about
all applications. Based on the information gathered, a status
flag is set to one of the following values:
* U - Upgrade required/available
* R - upgrade in pRogress
* C - upgrade Completed successfully
* D - Dependency failure
* F - upgrade Failed
* V - Version mismatch at end of upgrade
* M - Missing files at start of upgrade (Not used, proposed
only)
Using this information, the setup logic in index.php determines
what mode we are in. index.php is not capable of being selective
about which application it found as being out of sync. It
is designed only for 'Simple Application Management', which
is Step 1 of the setup process. For more selective application
manipulation, use applications.php. index.php then tells
the user that 1) their applications are current 2) some
of their applications are out of sync 3) no db exists, etc.
For a new install, all applications will be out of sync,
since there is not even an 'phpgw_applications' table in
the database to tell setup what the status is for any application.
4.2.2 Selection
There is no selection for application installs in 'new install'
mode. All physically present applications will be installed,
or at least attempted.
4.2.3 Installation
Once the setup user clicks the magic button to install all
applications, the following occurs:
* The setup_info array is passed to the process_pass() function,
using a method='new'
* Applications whose status flag='U' (API on first pass)
are then handed off to the process_current() function.
This handles inclusion and installation of the application's
tables_current.inc.php file.
* The application is registered as a new application in the
'phpgw_applications' table. If for some reason there is
old data in this table for this application, it will be
updated instead. Its hooks, if any, are registered in
the 'phpgw_hooks' table.
* Next, this array is passed to the process_default_records()
function. If this file is present in the current application's
setup directory, the queries here are run to install the
data to the application's table(s).
* The above is repeated until all application status flags
equal 'C'. However, if an application install failed for
some reason, it will then be skipped on the next pass.
This keeps the loop from running away.
4.3 Upgrades
4.3.1 Detection
Only an API version mismatch will trigger an automated request
for the user to upgrade their install. Once the api is current,
they can move on to applications.php for more 'Advanced
Application Management', which is Step 4 of the setup process.
However, if the API is out of sync, clicking 'Upgrade' in
index.php will also attempt to upgrade other applications
which may be out of sync, as well. As the phpgwapi continues
to stabilize, it is felt that this method of upgrading will
become less and less common.
4.3.2 Selection
Within applications.php, a color-coded matrix of application
status and actions is displayed. Depending on the status
flag of each application, certain actions will be either
enabled or disabled. These actions include 'install', 'upgrade',
'remove'. If something is very wrong with previous attempts
to install or upgrade an application, another column called
'resolution' will then display a link. This link will display
additional information which would be helpful for determining
how to resolve the problem. Assuming all is well, the user
can select applications requiring upgrade from this list.
Once selected, they submit the form. This runs the follow
three routines in order:
* remove
* install
* upgrade
4.3.3 Upgrade
The idea here is that multiple actions can be selected and
run in order in one click. In any case, once they select
an application for upgrade, the following occurs:
* A stripped down version of the setup_info array is passed
to the process_upgrade() function. This array contains
only the information for the selected application
* Within process_upgrade(), the tables_baseline.inc.php file
for the application is loaded.
* The tables_update.inc.php file for the application is loaded
* The contents of the test array is used to loop through
the entire list of upgrade functions for the application.
The application's unique function names are rebuilt, then
run.
* When the currentver (installed) matches the version (available),
process_upgrade() exits, setting the status flag for the
app to 'C'.
* Just prior to exiting, the application and its hooks are
updated into the 'phpgw_applications' and 'phpgw_hooks'
tables.
4.4 Uninstallation/Removal
4.4.1 Selection
Selective removal of an application is done via applications.php,
in a manner similar to the method above for upgrades.
4.4.2 Uninstallation
Once an application is selected for removal:
* A stripped down version of the setup_info array is passed
to the process_droptables() function. This function removes
all of the application's defined tables, but only after
first checking to see if the tables are there. In this
way, we attempt to cut down on the number of errors sent
to the browser.
* The application's hooks are deregistered (removed from
'phpgw_hooks').
* The application itself is deregistered (removed from 'phpgw_applications').
5 Caveats
5.1 Must see info
5.1.1 Auto fields
For auto type fields, schema_proc creates a sequence automatically
based on the table name for databases that require sequences.
In the case of postgresql, the limit for this name based
on our tests is 31 characters. The schema_proc format is:
$sSequenceSQL = sprintf("CREATE SEQUENCE seq_%s", $sTableName);
This limits the maximum length for a tablename to 27 characters.
Based on the tablename standard in phpgw of 'phpgw_tablename',
you are further limited to 21 characters in which to describe
your table. You will need to be less descriptive in some
cases, e.g. use 'phpgw_widget_cats' instead of 'phpgw_widget_info_categories'.
5.1.2 Default 0
For int fields, a default of 0 is not assumed. Only some
databases will set this default for you, MySQL being one.
You will need to explicitly define this default in the table
definition. Also, for auto fields, do not enter a default,
since the resulting SQL query would fail on many RDBMS.

26
setup/inc/README Normal file
View File

@ -0,0 +1,26 @@
phpGroupWare setup May 2001
Class logical (?) organization map:
class.setup.inc.php Global setup functions app/hook/login
|
class.setup_detection.inc.php Detection of header, file and db versions
|
class.setup_lang.inc.php Multi-lang functions for display
|
class.setup_html.inc.php HTML/template output functions
| |
| class.template.inc.php HTML template class
|
class.setup_process.inc.php db processing functions/upgrade/install
|
class.schema_proc.inc.php DB array <--> SQL and abstraction class
|
class.schema_proc_array.inc.php Array input parser
|
class.schema_proc_mysql.inc.php SQL functions for MySQL
|
class.schema_proc_pgsql.inc.php SQL functions for Postgresql
|
... other db support...

View File

@ -0,0 +1,455 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 schema_proc
{
var $m_oTranslator;
var $m_oDeltaProc;
var $m_odb;
var $m_aTables;
var $m_bDeltaOnly;
function schema_proc($dbms)
{
include('./inc/class.schema_proc_' . $dbms . '.inc.php');
eval("\$this->m_oTranslator = new schema_proc_$dbms;");
include('./inc/class.schema_proc_array.inc.php');
$this->m_oDeltaProc = new schema_proc_array;
$this->m_aTables = array();
$this->m_bDeltaOnly = false; // Default to false here in case it's just a CreateTable script
}
function GenerateScripts($aTables, $bOutputHTML = false)
{
if (!is_array($aTables))
{
return false;
}
$this->m_aTables = $aTables;
reset($this->m_aTables);
$sAllTableSQL = "";
while (list($sTableName, $aTableDef) = each($this->m_aTables))
{
$sSequenceSQL = "";
if ($this->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{
$sTableSQL = "CREATE TABLE $sTableName (\n$sTableSQL\n)"
. $this->m_oTranslator->m_sStatementTerminator;
if ($sSequenceSQL != "")
{
$sAllTableSQL .= $sSequenceSQL . "\n";
}
$sAllTableSQL .= $sTableSQL . "\n\n";
}
else
{
if ($bOutputHTML)
{
print('<br>Failed generating script for <b>' . $sTableName . '</b><br>');
}
return false;
}
}
if ($bOutputHTML)
{
print('<pre>' . $sAllTableSQL . '</pre><br><br>');
}
return true;
}
function ExecuteScripts($aTables, $bOutputHTML = false)
{
if (!is_array($aTables) || !IsSet($this->m_odb))
{
return false;
}
reset($aTables);
$this->m_aTables = $aTables;
while (list($sTableName, $aTableDef) = each($aTables))
{
if ($this->CreateTable($sTableName, $aTableDef))
{
if ($bOutputHTML)
{
echo '<br>Create Table <b>' . $sTableName . '</b>';
}
}
else
{
if ($bOutputHTML)
{
echo '<br>Create Table Failed For <b>' . $sTableName . '</b>';
}
return false;
}
}
return true;
}
function DropAllTables($aTables, $bOutputHTML = false)
{
if (!is_array($aTables) || !IsSet($this->m_odb))
{
return false;
}
$this->m_aTables = $aTables;
reset($this->m_aTables);
while (list($sTableName, $aTableDef) = each($this->m_aTables))
{
if ($this->DropTable($sTableName))
{
if ($bOutputHTML)
{
echo '<br>Drop Table <b>' . $sTableSQL . '</b>';
}
}
else
{
return false;
}
}
return true;
}
function DropTable($sTableName)
{
$retVal = $this->m_oDeltaProc->DropTable($this, $this->m_aTables, $sTableName);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->DropTable($this, $this->m_aTables, $sTableName);
}
function DropColumn($sTableName, $aTableDef, $sColumnName, $bCopyData = true)
{
$retVal = $this->m_oDeltaProc->DropColumn($this, $this->m_aTables, $sTableName, $aTableDef, $sColumnName, $bCopyData);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->DropColumn($this, $this->m_aTables, $sTableName, $aTableDef, $sColumnName, $bCopyData);
}
function RenameTable($sOldTableName, $sNewTableName)
{
$retVal = $this->m_oDeltaProc->RenameTable($this, $this->m_aTables, $sOldTableName, $sNewTableName);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->RenameTable($this, $this->m_aTables, $sOldTableName, $sNewTableName);
}
function RenameColumn($sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
$retVal = $this->m_oDeltaProc->RenameColumn($this, $this->m_aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->RenameColumn($this, $this->m_aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData);
}
function AlterColumn($sTableName, $sColumnName, $aColumnDef, $bCopyData = true)
{
$retVal = $this->m_oDeltaProc->AlterColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef, $bCopyData);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->AlterColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef, $bCopyData);
}
function AddColumn($sTableName, $sColumnName, $aColumnDef)
{
$retVal = $this->m_oDeltaProc->AddColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->AddColumn($this, $this->m_aTables, $sTableName, $sColumnName, $aColumnDef);
}
function CreateTable($sTableName, $aTableDef)
{
$retVal = $this->m_oDeltaProc->CreateTable($this, $this->m_aTables, $sTableName, $aTableDef);
if ($this->m_bDeltaOnly)
{
return $retVal;
}
return $retVal && $this->m_oTranslator->CreateTable($this, $this->m_aTables, $sTableName, $aTableDef);
}
function f($value)
{
if ($this->m_bDeltaOnly)
{
// Don't care, since we are processing deltas only
return False;
}
return $this->m_odb->f($value);
}
function num_rows()
{
if ($this->m_bDeltaOnly)
{
// If not False, we will cause while loops calling us to hang
return False;
}
return $this->m_odb->num_rows();
}
function next_record()
{
if ($this->m_bDeltaOnly)
{
// If not False, we will cause while loops calling us to hang
return False;
}
return $this->m_odb->next_record();
}
function query($sQuery, $line = '', $file = '')
{
if ($this->m_bDeltaOnly)
{
// Don't run this query, since we are processing deltas only
return True;
}
return $this->m_odb->query($sQuery, $line, $file);
}
function _GetTableSQL($sTableName, $aTableDef, &$sTableSQL, &$sSequenceSQL)
{
global $DEBUG;
if (!is_array($aTableDef))
{
return false;
}
$sTableSQL = '';
reset($aTableDef['fd']);
while (list($sFieldName, $aFieldAttr) = each($aTableDef['fd']))
{
$sFieldSQL = "";
if ($this->_GetFieldSQL($aFieldAttr, $sFieldSQL))
{
if ($sTableSQL != '')
{
$sTableSQL .= ",\n";
}
$sTableSQL .= "$sFieldName $sFieldSQL";
if ($aFieldAttr['type'] == 'auto')
{
$this->m_oTranslator->GetSequenceSQL($sTableName, $sSequenceSQL);
if ($sSequenceSQL != "")
{
$sTableSQL .= sprintf(" DEFAULT nextval('seq_%s')", $sTableName);
}
}
}
else
{
if ($DEBUG) { echo 'GetFieldSQL failed for ' . $sFieldName; }
return false;
}
}
$sUCSQL = "";
$sPKSQL = "";
if (count($aTableDef['pk']) > 0)
{
if (!$this->_GetPK($aTableDef['pk'], $sPKSQL))
{
if ($bOutputHTML)
{
print('<br>Failed getting primary key<br>');
}
return false;
}
}
if (count($aTableDef['uc']) > 0)
{
if (!$this->_GetUC($aTableDef['uc'], $sUCSQL))
{
if ($bOutputHTML)
{
print('<br>Failed getting unique constraint<br>');
}
return false;
}
}
if ($sPKSQL != '')
{
$sTableSQL .= ",\n" . $sPKSQL;
}
if ($sUCSQL != '')
{
$sTableSQL .= ",\n" . $sUCSQL;
}
return true;
}
// Get field DDL
function _GetFieldSQL($aField, &$sFieldSQL)
{
global $DEBUG;
if ($DEBUG) { echo'<br>_GetFieldSQL(): Incoming ARRAY: '; print_r($aField); }
if (!is_array($aField))
{
return false;
}
$sType = '';
$iPrecision = 0;
$iScale = 0;
$sDefault = '';
$bNullable = true;
reset($aField);
while (list($sAttr, $vAttrVal) = each($aField))
{
switch ($sAttr)
{
case 'type':
$sType = $vAttrVal;
break;
case 'precision':
$iPrecision = (int)$vAttrVal;
break;
case 'scale':
$iScale = (int)$vAttrVal;
break;
case 'default':
$sDefault = $vAttrVal;
if ($DEBUG) { echo'<br>_GetFieldSQL(): Default="' . $sDefault . '"'; }
break;
case 'nullable':
$bNullable = $vAttrVal;
break;
}
}
// Translate the type for the DBMS
if ($this->m_oTranslator->TranslateType($sType, $iPrecision, $iScale, $sFieldSQL))
{
if ($bNullable == false)
{
$sFieldSQL .= ' NOT NULL';
}
if ($sDefault != '')
{
if ($DEBUG) { echo'<br>_GetFieldSQL(): Calling TranslateDefault for "' . $sDefault . '"'; }
// Get default DDL - useful for differences in date defaults (eg, now() vs. getdate())
$sTranslatedDefault = $this->m_oTranslator->TranslateDefault($sDefault);
$sFieldSQL .= " DEFAULT '$sTranslatedDefault'";
}
elseif($sDefault == '0')
{
$sFieldSQL .= " DEFAULT '0'";
}
if ($DEBUG) { echo'<br>_GetFieldSQL(): Outgoing SQL: ' . $sFieldSQL; }
return true;
}
if ($DEBUG) { echo '<br>Failed to translate field: type[' . $sType . '] precision[' . $iPrecision . '] scale[' . $iScale . ']<br>'; }
return false;
}
function _GetPK($aFields, &$sPKSQL)
{
$sPKSQL = '';
if (count($aFields) < 1)
{
return true;
}
$sFields = '';
reset($aFields);
while (list($key, $sField) = each($aFields))
{
if ($sFields != '')
{
$sFields .= ',';
}
$sFields .= $sField;
}
$sPKSQL = $this->m_oTranslator->GetPKSQL($sFields);
return true;
}
function _GetUC($aFields, &$sUCSQL)
{
$sUCSQL = '';
if (count($aFields) < 1)
{
return true;
}
$sFields = '';
reset($aFields);
while (list($key, $sField) = each($aFields))
{
if ($sFields != '')
{
$sFields .= ',';
}
$sFields .= $sField;
}
$sUCSQL = $this->m_oTranslator->GetUCSQL($sFields);
return true;
}
}
?>

View File

@ -0,0 +1,181 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 schema_proc_array
{
var $m_sStatementTerminator;
function schema_proc_array()
{
$this->m_sStatementTerminator = ";";
}
// Return a type suitable for DDL abstracted array
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = $sType;
return (strlen($sTranslated) > 0);
}
function TranslateDefault($sDefault)
{
return $sDefault;
}
function GetPKSQL($sFields)
{
return "";
}
function GetUCSQL($sFields)
{
return "";
}
function _GetColumns($oProc, &$aTables, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
while (list($sName, $aJunk) = each($aTables[$sTableName]["fd"]))
{
if ($sColumns != "")
{
$sColumns .= ",";
}
$sColumns .= $sName;
}
return true;
}
function DropTable($oProc, &$aTables, $sTableName)
{
if (IsSet($aTables[$sTableName]))
{
UnSet($aTables[$sTableName]);
}
return true;
}
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
if (IsSet($aTables[$sTableName]))
{
if (IsSet($aTables[$sTableName]["fd"][$sColumnName]))
{
UnSet($aTables[$sTableName]["fd"][$sColumnName]);
}
}
return true;
}
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
$aNewTables = array();
while (list($sTableName, $aTableDef) = each($aTables))
{
if ($sTableName == $sOldTableName)
{
$aNewTables[$sNewTableName] = $aTableDef;
}
else
{
$aNewTables[$sTableName] = $aTableDef;
}
}
$aTables = $aNewTables;
return true;
}
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
if (IsSet($aTables[$sTableName]))
{
$aNewTableDef = array();
reset($aTables[$sTableName]["fd"]);
while (list($sColumnName, $aColumnDef) = each($aTables[$sTableName]["fd"]))
{
if ($sColumnName == $sOldColumnName)
{
$aNewTableDef[$sNewColumnName] = $aColumnDef;
}
else
{
$aNewTableDef[$sColumnName] = $aColumnDef;
}
}
$aTables[$sTableName]["fd"] = $aNewTableDef;
reset($aTables[$sTableName]["pk"]);
while (list($key, $sColumnName) = each($aTables[$sTableName]["pk"]))
{
if ($sColumnName == $sOldColumnName)
{
$aTables[$sTableName]["pk"][$key] = $sNewColumnName;
}
}
reset($aTables[$sTableName]["uc"]);
while (list($key, $sColumnName) = each($aTables[$sTableName]["uc"]))
{
if ($sColumnName == $sOldColumnName)
{
$aTables[$sTableName]["uc"][$key] = $sNewColumnName;
}
}
}
return true;
}
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
if (IsSet($aTables[$sTableName]))
{
if (IsSet($aTables[$sTableName]["fd"][$sColumnName]))
{
$aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
}
}
return true;
}
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
if (IsSet($aTables[$sTableName]))
{
if (!IsSet($aTables[$sTableName]["fd"][$sColumnName]))
{
$aTables[$sTableName]["fd"][$sColumnName] = $aColumnDef;
}
}
return true;
}
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
{
if (!IsSet($aTables[$sTableName]))
{
$aTables[$sTableName] = $aTableDef;
}
return true;
}
}
?>

View File

@ -0,0 +1,342 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 schema_proc_mssql
{
var $m_sStatementTerminator;
// Following added to convert sql to array
var $sCol = array();
var $pk = array();
var $fk = array();
var $ix = array();
var $uc = array();
function schema_proc_mssql()
{
$this->m_sStatementTerminator = ";";
}
// Return a type suitable for DDL
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = "";
switch($sType)
{
case "auto":
$sTranslated = "int identity(1,1)";
break;
case "blob":
$sTranslated = "image"; // wonder how well PHP will support this???
break;
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("char(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
case "date":
$sTranslated = "smalldatetime";
break;
case "decimal":
$sTranslated = sprintf("decimal(%d,%d)", $iPrecision, $iScale);
break;
case "float":
switch ($iPrecision)
{
case 4:
$sTranslated = "float";
break;
case 8:
$sTranslated = "real";
break;
}
break;
case "int":
switch ($iPrecision)
{
case 2:
$sTranslated = "smallint";
break;
case 4:
case 8:
$sTranslated = "int";
break;
}
break;
case "longtext":
$sTranslated = "longtext";
break;
case "text":
$sTranslated = "text";
break;
case "timestamp":
$sTranslated = "datetime";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("varchar(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
}
return (strlen($sTranslated) > 0);
}
function TranslateDefault($sDefault)
{
switch ($sDefault)
{
case "current_date":
case "current_timestamp":
return "GetDate()";
}
return $sDefault;
}
// Inverse of above, convert sql column types to array info
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = '';
if ($sType == 'int' || $sType == 'tinyint' || $sType == 'smallint')
{
if ($iPrecision > 8)
{
$iPrecision = 8;
}
elseif($iPrecision > 4)
{
$iPrecision = 4;
}
else
{
$iPrecision = 2;
}
}
switch($sType)
{
case "tinyint":
case "smallint":
$sTranslated = "'type' => 'int', 'precision' => 2";
break;
case "int":
$sTranslated = "'type' => 'int', 'precision' => 4";
break;
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'char', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "decimal":
$sTranslated = "'type' => 'decimal', 'precision' => $iPrecision, 'scale' => $iScale";
break;
case "float":
case "double":
$sTranslated = "'type' => 'float', 'precision' => $iPrecision";
break;
case "smalldatetime":
$sTranslated = "'type' => 'date'";
break;
case "datetime":
$sTranslated = "'type' => 'timestamp'";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'varchar', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "image":
$sTranslated = "'type' => 'blob'";
break;
case "text":
$sTranslated = "'type' => '$sType'";
break;
}
return (strlen($sTranslated) > 0);
}
function GetPKSQL($sFields)
{
return "PRIMARY KEY($sFields)";
}
function GetUCSQL($sFields)
{
return "UNIQUE($sFields)";
}
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
$this->pk = array();
$this->fk = array();
$this->ix = array();
$this->uc = array();
// Field, Type, Null, Key, Default, Extra
$oProc->m_odb->query("exec sp_columns '$sTableName'");
while ($oProc->m_odb->next_record())
{
$type = $default = $null = $nullcomma = $prec = $scale = $ret = $colinfo = $scales = '';
if ($sColumns != "")
{
$sColumns .= ",";
}
$sColumns .= $oProc->m_odb->f(0);
// The rest of this is used only for SQL->array
$colinfo = explode('(',$oProc->m_odb->f(1));
$prec = ereg_replace(')','',$colinfo[1]);
$scales = explode(',',$prec);
if ($scales[1])
{
$prec = $scales[0];
$scale = $scales[1];
}
$this->rTranslateType($colinfo[0], $prec, $scale, &$type);
if ($oProc->m_odb->f(2) == 'YES')
{
$null = "'nullable' => True";
}
else
{
$null = "'nullable' => False";
}
if ($oProc->m_odb->f(4))
{
$default = "'default' => '".$oProc->m_odb->f(4)."'";
$nullcomma = ',';
}
else
{
$default = '';
$nullcomma = '';
}
if ($oProc->m_odb->f(5))
{
$type = "'type' => 'auto'";
}
$this->sCol[] = "\t\t\t\t'" . $oProc->m_odb->f(0)."' => array(" . $type . ',' . $null . $nullcomma . $default . '),' . "\n";
if ($oProc->m_odb->f(3) == 'PRI')
{
$this->pk[] = $oProc->m_odb->f(0);
}
if ($oProc->m_odb->f(3) == 'UNI')
{
$this->uc[] = $oProc->m_odb->f(0);
}
// Hmmm, MUL could also mean unique, or not...
if ($oProc->m_odb->f(3) == 'MUL')
{
$this->ix[] = $oProc->m_odb->f(0);
}
}
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
return false;
}
function DropTable($oProc, &$aTables, $sTableName)
{
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
}
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName"));
}
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
return !!($oProc->m_odb->query("EXEC sp_rename '$sOldTableName', '$sNewTableName'"));
}
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
// This really needs testing - it can affect primary keys, and other table-related objects
// like sequences and such
global $DEBUG;
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
{
return !!($oProc->m_odb->query("EXEC sp_rename '$sTableName.$sOldColumnName', '$sNewColumnName'"));
}
return false;
}
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
global $DEBUG;
if ($DEBUG) { echo '<br>AlterColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName ALTER COLUMN $sColumnName " . $sNewColumnSQL));
}
return false;
}
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
return !!($oProc->m_odb->query($query));
}
function GetSequenceSQL($sTableName, &$sSequenceSQL)
{
$sSequenceSQL = "";
return true;
}
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
{
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{
// create sequence first since it will be needed for default
if ($sSequenceSQL != "")
{
$oProc->m_odb->query($sSequenceSQL);
}
$query = "CREATE TABLE $sTableName ($sTableSQL)";
return !!($oProc->m_odb->query($query));
}
return false;
}
}
?>

View File

@ -0,0 +1,347 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 schema_proc_mysql
{
var $m_sStatementTerminator;
// Following added to convert sql to array
var $sCol = array();
var $pk = array();
var $fk = array();
var $ix = array();
var $uc = array();
function schema_proc_mysql()
{
$this->m_sStatementTerminator = ";";
}
// Return a type suitable for DDL
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = "";
switch($sType)
{
case "auto":
$sTranslated = "int(11) auto_increment";
break;
case "blob":
$sTranslated = "blob";
break;
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("char(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
case "date":
$sTranslated = "date";
break;
case "decimal":
$sTranslated = sprintf("decimal(%d,%d)", $iPrecision, $iScale);
break;
case "float":
switch ($iPrecision)
{
case 4:
$sTranslated = "float";
break;
case 8:
$sTranslated = "double";
break;
}
break;
case "int":
switch ($iPrecision)
{
case 2:
$sTranslated = "smallint";
break;
case 4:
$sTranslated = "int";
break;
case 8:
$sTranslated = "bigint";
break;
}
break;
case "longtext":
$sTranslated = "longtext";
break;
case "text":
$sTranslated = "text";
break;
case "timestamp":
$sTranslated = "datetime";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("varchar(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
}
return (strlen($sTranslated) > 0);
}
function TranslateDefault($sDefault)
{
switch ($sDefault)
{
case "current_date":
case "current_timestamp":
return "now";
}
return $sDefault;
}
// Inverse of above, convert sql column types to array info
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = '';
if ($sType == 'int' || $sType == 'tinyint' || $sType == 'smallint' || $sType == 'bigint')
{
if ($iPrecision > 8)
{
$iPrecision = 8;
}
elseif($iPrecision > 4)
{
$iPrecision = 4;
}
else
{
$iPrecision = 2;
}
}
switch($sType)
{
case "tinyint":
case "smallint":
$sTranslated = "'type' => 'int', 'precision' => 2";
break;
case "int":
$sTranslated = "'type' => 'int', 'precision' => 4";
break;
case "bigint":
$sTranslated = "'type' => 'int', 'precision' => 8";
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'char', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "decimal":
$sTranslated = "'type' => 'decimal', 'precision' => $iPrecision, 'scale' => $iScale";
break;
case "float":
case "double":
$sTranslated = "'type' => 'float', 'precision' => $iPrecision";
break;
case "datetime":
$sTranslated = "'type' => 'timestamp'";
break;
case "enum":
// Here comes a nasty assumption
$sTranslated = "'type' => 'varchar', 'precision' => 255";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'varchar', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "longtext":
case "text":
case "blob":
case "date":
$sTranslated = "'type' => '$sType'";
break;
}
return (strlen($sTranslated) > 0);
}
function GetPKSQL($sFields)
{
return "PRIMARY KEY($sFields)";
}
function GetUCSQL($sFields)
{
return "UNIQUE($sFields)";
}
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = "")
{
$sColumns = "";
$this->pk = array();
$this->fk = array();
$this->ix = array();
$this->uc = array();
// Field, Type, Null, Key, Default, Extra
$oProc->m_odb->query("describe $sTableName");
while ($oProc->m_odb->next_record())
{
$type = $default = $null = $nullcomma = $prec = $scale = $ret = $colinfo = $scales = '';
if ($sColumns != "")
{
$sColumns .= ",";
}
$sColumns .= $oProc->m_odb->f(0);
// The rest of this is used only for SQL->array
$colinfo = explode('(',$oProc->m_odb->f(1));
$prec = ereg_replace(')','',$colinfo[1]);
$scales = explode(',',$prec);
if ($scales[1])
{
$prec = $scales[0];
$scale = $scales[1];
}
$this->rTranslateType($colinfo[0], $prec, $scale, &$type);
if ($oProc->m_odb->f(2) == 'YES')
{
$null = "'nullable' => True";
}
else
{
$null = "'nullable' => False";
}
if ($oProc->m_odb->f(4))
{
$default = "'default' => '".$oProc->m_odb->f(4)."'";
$nullcomma = ',';
}
else
{
$default = '';
$nullcomma = '';
}
if ($oProc->m_odb->f(5))
{
$type = "'type' => 'auto'";
}
$this->sCol[] = "\t\t\t\t'" . $oProc->m_odb->f(0)."' => array(" . $type . ',' . $null . $nullcomma . $default . '),' . "\n";
if ($oProc->m_odb->f(3) == 'PRI')
{
$this->pk[] = $oProc->m_odb->f(0);
}
if ($oProc->m_odb->f(3) == 'UNI')
{
$this->uc[] = $oProc->m_odb->f(0);
}
// Hmmm, MUL could also mean unique, or not...
if ($oProc->m_odb->f(3) == 'MUL')
{
$this->ix[] = $oProc->m_odb->f(0);
}
}
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
return false;
}
function DropTable($oProc, &$aTables, $sTableName)
{
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
}
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName DROP COLUMN $sColumnName"));
}
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName"));
}
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
// This really needs testing - it can affect primary keys, and other table-related objects
// like sequences and such
global $DEBUG;
if ($DEBUG) { echo '<br>RenameColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sNewColumnName], $sNewColumnSQL))
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName CHANGE $sOldColumnName $sNewColumnName " . $sNewColumnSQL));
}
return false;
}
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
global $DEBUG;
if ($DEBUG) { echo '<br>AlterColumn: calling _GetFieldSQL for ' . $sNewColumnName; }
if ($oProc->_GetFieldSQL($aTables[$sTableName]["fd"][$sColumnName], $sNewColumnSQL))
{
return !!($oProc->m_odb->query("ALTER TABLE $sTableName MODIFY $sColumnName " . $sNewColumnSQL));
}
return false;
}
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
return !!($oProc->m_odb->query($query));
}
function GetSequenceSQL($sTableName, &$sSequenceSQL)
{
$sSequenceSQL = "";
return true;
}
function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
{
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{
// create sequence first since it will be needed for default
if ($sSequenceSQL != "")
{
$oProc->m_odb->query($sSequenceSQL);
}
$query = "CREATE TABLE $sTableName ($sTableSQL)";
return !!($oProc->m_odb->query($query));
}
return false;
}
}
?>

View File

@ -0,0 +1,599 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* SQL for table properties taken from phpPgAdmin Version 2.2.1 *
* http://www.greatbridge.org/project/phppgadmin *
* Copyright (C) 1999-2000 Dan Wilson <phpPgAdmin@acucore.com> *
* Copyright (C) 1998-1999 Tobias Ratschiller <tobias@dnet.it> *
* -------------------------------------------- *
* 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 schema_proc_pgsql
{
var $m_sStatementTerminator;
// Following added to convert sql to array
var $sCol = array();
var $pk = array();
var $fk = array();
var $ix = array();
var $uc = array();
function schema_proc_pgsql()
{
$this->m_sStatementTerminator = ";";
}
// Return a type suitable for DDL
function TranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
switch($sType)
{
case "auto":
$sTranslated = "int4";
break;
case "blob":
$sTranslated = "text";
break;
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("char(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
case "date":
$sTranslated = "date";
break;
case "decimal":
$sTranslated = sprintf("decimal(%d,%d)", $iPrecision, $iScale);
break;
case "float":
if ($iPrecision == 4 || $iPrecision == 8)
{
$sTranslated = sprintf("float%d", $iPrecision);
}
break;
case "int":
if ($iPrecision == 2 || $iPrecision == 4 || $iPrecision == 8)
{
$sTranslated = sprintf("int%d", $iPrecision);
}
break;
case "longtext":
$sTranslated = "text";
break;
case "text":
$sTranslated = "text";
break;
case "timestamp":
$sTranslated = "timestamp";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = sprintf("varchar(%d)", $iPrecision);
}
if ($iPrecision > 255)
{
$sTranslated = "text";
}
break;
}
return (strlen($sTranslated) > 0);
}
function TranslateDefault($sDefault)
{
switch ($sDefault)
{
case "current_date":
case "current_timestamp":
return "now";
}
return $sDefault;
}
// Inverse of above, convert sql column types to array info
function rTranslateType($sType, $iPrecision = 0, $iScale = 0, &$sTranslated)
{
$sTranslated = "";
switch($sType)
{
case "serial":
$sTranslated = "'type' => 'auto'";
break;
case "int2":
$sTranslated = "'type' => 'int', 'precision' => 2";
break;
case "int4":
$sTranslated = "'type' => 'int', 'precision' => 4";
break;
case "int8":
$sTranslated = "'type' => 'int', 'precision' => 8";
break;
case "bpchar":
case "char":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'char', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "numeric":
/* Borrowed from phpPgAdmin */
$iPrecision = ($iScale >> 16) & 0xffff;
$iScale = ($iScale - 4) & 0xffff;
$sTranslated = "'type' => 'decimal', 'precision' => $iPrecision, 'scale' => $iScale";
break;
case "float":
case "double":
$sTranslated = "'type' => 'float', 'precision' => $iPrecision";
break;
case "datetime":
$sTranslated = "'type' => 'timestamp'";
break;
case "varchar":
if ($iPrecision > 0 && $iPrecision < 256)
{
$sTranslated = "'type' => 'varchar', 'precision' => $iPrecision";
}
if ($iPrecision > 255)
{
$sTranslated = "'type' => 'text'";
}
break;
case "text":
case "blob":
case "date":
$sTranslated = "'type' => '$sType'";
break;
}
return (strlen($sTranslated) > 0);
}
function GetPKSQL($sFields)
{
return "PRIMARY KEY($sFields)";
}
function GetUCSQL($sFields)
{
return "UNIQUE($sFields)";
}
function _GetColumns($oProc, $sTableName, &$sColumns, $sDropColumn = '', $sAlteredColumn = '', $sAlteredColumnType = '')
{
$sdb = $oProc->m_odb;
$sdc = $oProc->m_odb;
$sColumns = "";
$this->pk = array();
$this->fk = array();
$this->ix = array();
$this->uc = array();
$query = "SELECT a.attname,a.attnum FROM pg_attribute a,pg_class b WHERE ";
$query .= "b.oid=a.attrelid AND a.attnum>0 and b.relname='$sTableName'";
if ($sDropColumn != "")
{
$query .= " AND a.attname != '$sDropColumn'";
}
$query .= " ORDER BY a.attnum";
$oProc->m_odb->query($query);
while ($oProc->m_odb->next_record())
{
if ($sColumns != "")
{
$sColumns .= ",";
}
$sFieldName = $oProc->m_odb->f(0);
$sColumns .= $sFieldName;
if ($sAlteredColumn == $sFieldName && $sAlteredColumnType != '')
{
$sColumns .= '::' . $sAlteredColumnType;
}
}
//$qdefault = "SELECT substring(d.adsrc for 128) FROM pg_attrdef d, pg_class c "
// . "WHERE c.relname = $sTableName AND c.oid = d.adrelid AND d.adnum =" . $oProc->m_odb->f(1);
$sql_get_fields = "
SELECT
a.attnum,
a.attname AS field,
t.typname AS type,
a.attlen AS length,
a.atttypmod AS lengthvar,
a.attnotnull AS notnull
FROM
pg_class c,
pg_attribute a,
pg_type t
WHERE
c.relname = '$sTableName'
and a.attnum > 0
and a.attrelid = c.oid
and a.atttypid = t.oid
ORDER BY a.attnum";
// attnum field type length lengthvar notnull(Yes/No)
$sdb->query($sql_get_fields);
while ($sdb->next_record())
{
$colnum = $sdb->f(0);
$colname = $sdb->f(1);
if ($sdb->f(5) == 'Yes')
{
$null = "'nullable' => True";
}
else
{
$null = "'nullable' => False";
}
if ($sdb->f(2) == 'numeric')
{
$prec = $sdb->f(3);
$scale = $sdb->f(4);
}
elseif ($sdb->f(3) > 0)
{
$prec = $sdb->f(3);
$scale = 0;
}
elseif ($sdb->f(4) > 0)
{
$prec = $sdb->f(4) - 4;
$scale = 0;
}
else
{
$prec = 0;
$scale = 0;
}
$this->rTranslateType($sdb->f(2),$prec,$scale,$type);
$sql_get_default = "
SELECT d.adsrc AS rowdefault
FROM pg_attrdef d, pg_class c
WHERE
c.relname = '$sTableName' AND
c.oid = d.adrelid AND
d.adnum = $colnum
";
$sdc->query($sql_get_default);
$sdc->next_record();
if ($sdc->f(0))
{
if (ereg('nextval',$sdc->f(0)))
{
$default = '';
$nullcomma = '';
}
else
{
$default = "'default' => '".$sdc->f(0)."'";
$nullcomma = ',';
}
}
else
{
$default = '';
$nullcomma = '';
}
$this->sCol[] = "\t\t\t\t'" . $colname . "' => array(" . $type . ',' . $null . $nullcomma . $default . '),' . "\n";
}
$sql_pri_keys = "
SELECT
ic.relname AS index_name,
bc.relname AS tab_name,
ta.attname AS column_name,
i.indisunique AS unique_key,
i.indisprimary AS primary_key
FROM
pg_class bc,
pg_class ic,
pg_index i,
pg_attribute ta,
pg_attribute ia
WHERE
bc.oid = i.indrelid
AND ic.oid = i.indexrelid
AND ia.attrelid = i.indexrelid
AND ta.attrelid = bc.oid
AND bc.relname = '$sTableName'
AND ta.attrelid = i.indrelid
AND ta.attnum = i.indkey[ia.attnum-1]
ORDER BY
index_name, tab_name, column_name";
$sdc->query($sql_pri_keys);
while ($sdc->next_record())
{
//echo '<br> checking: ' . $sdc->f(4);
if ($sdc->f(4) == 't')
{
$this->pk[] = $sdc->f(2);
}
if ($sdc->f(3) == 't')
{
$this->uc[] = $sdc->f(2);
}
}
// ugly as heck, but is here to chop the trailing comma on the last element (for php3)
$this->sCol[count($this->sCol) - 1] = substr($this->sCol[count($this->sCol) - 1],0,-2) . "\n";
return false;
}
function _CopyAlteredTable($oProc, &$aTables, $sSource, $sDest)
{
$oDB = $oProc->m_odb;
$oProc->m_odb->query("select * from $sSource");
while ($oProc->m_odb->next_record())
{
$sSQL = "INSERT INTO $sDest (";
$i=0;
@reset($aTables[$sDest]['fd']);
while (list($name,$arraydef) = each($aTables[$sDest]['fd']))
{
if ($i > 0)
{
$sSQL .= ',';
}
$sSQL .= $name;
$i++;
}
$sSQL .= ') VALUES (';
@reset($aTables[$sDest]['fd']);
$i=0;
while (list($name,$arraydef) = each($aTables[$sDest]['fd']))
{
if ($i > 0)
{
$sSQL .= ',';
}
if ($oProc->m_odb->f($i) != null)
{
switch ($arraydef['type'])
{
case "blob":
case "char":
case "date":
case "text":
case "timestamp":
case "varchar":
$sSQL .= "'" . $oProc->m_odb->f($i) . "'";
break;
default:
$sSQL .= $oProc->m_odb->f($i);
}
}
else
{
$sSQL .= 'null';
}
$i++;
}
$sSQL .= ')';
$oDB->query($sSQL);
}
return true;
}
function GetSequenceForTable($oProc,$table,&$sSequenceName)
{
global $DEBUG;
if($DEBUG) { echo '<br>GetSequenceForTable: You rang?'; }
$oProc->m_odb->query("SELECT relname FROM pg_class WHERE NOT relname ~ 'pg_.*' AND relname LIKE 'seq_$table' AND relkind='S' ORDER BY relname",__LINE__,__FILE__);
$oProc->m_odb->next_record();
if ($oProc->m_odb->f('relname'))
{
$sSequenceName = $oProc->m_odb->f('relname');
}
return True;
}
function GetSequenceFieldForTable($oProc,$table,&$sField)
{
global $DEBUG;
if($DEBUG) { echo '<br>GetSequenceFieldForTable: You rang?'; }
$oProc->m_odb->query("SELECT a.attname FROM pg_attribute a, pg_class c, pg_attrdef d WHERE c.relname='$table' AND c.oid=d.adrelid AND d.adsrc LIKE '%seq_$table%' AND a.attrelid=c.oid AND d.adnum=a.attnum");
$oProc->m_odb->next_record();
if ($oProc->m_odb->f('attname'))
{
$sField = $oProc->m_odb->f('attname');
}
return True;
}
function DropSequenceForTable($oProc,$table)
{
global $DEBUG;
if($DEBUG) { echo '<br>DropSequenceForTable: ' . $table; }
$this->GetSequenceForTable($oProc,$table,$sSequenceName);
if ($sSequenceName)
{
$oProc->m_odb->query("DROP SEQUENCE " . $sSequenceName,__LINE__,__FILE__);
}
return True;
}
function DropTable($oProc, &$aTables, $sTableName)
{
$this->DropSequenceForTable($oProc,$sTableName);
return !!($oProc->m_odb->query("DROP TABLE " . $sTableName));
}
function DropColumn($oProc, &$aTables, $sTableName, $aNewTableDef, $sColumnName, $bCopyData = true)
{
if ($bCopyData)
{
$oProc->m_odb->query("SELECT * INTO $sTableName" . "_tmp FROM $sTableName");
}
$this->DropTable($oProc, $aTables, $sTableName);
$oProc->_GetTableSQL($sTableName, $aNewTableDef, $sTableSQL, $sSequenceSQL);
if($sSequenceSQL)
{
$oProc->m_odb->query($sSequenceSQL);
}
$query = "CREATE TABLE $sTableName ($sTableSQL)";
if (!$bCopyData)
{
return !!($oProc->m_odb->query($query));
}
$oProc->m_odb->query($query);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns, $sColumnName);
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
$bRet = !!($oProc->m_odb->query($query));
return ($bRet && $this->DropTable($oProc, $aTables, $sTableName . "_tmp"));
}
function RenameTable($oProc, &$aTables, $sOldTableName, $sNewTableName)
{
global $DEBUG;
if ($DEBUG) { echo '<br>RenameTable(): Fetching old sequence for: ' . $sOldTableName; }
$this->GetSequenceForTable($oProc,$sOldTableName,$sSequenceName);
if ($DEBUG) { echo ' - ' . $sSequenceName; }
if ($DEBUG) { echo '<br>RenameTable(): Fetching sequence field for: ' . $sOldTableName; }
$this->GetSequenceFieldForTable($oProc,$sOldTableName,$sField);
if ($DEBUG) { echo ' - ' . $sField; }
if ($sSequenceName)
{
$oProc->m_odb->query("SELECT last_value FROM seq_$sOldTableName",__LINE__,__FILE__);
$oProc->m_odb->next_record();
$lastval = $oProc->m_odb->f(0);
if ($DEBUG) { echo '<br>RenameTable(): dropping old sequence: ' . $sSequenceName . ' used on field: ' . $sField; }
$this->DropSequenceForTable($oProc,$sOldTableName);
if ($lastval)
{
$lastval = ' start ' . $lastval;
}
$this->GetSequenceSQL($sNewTableName,$sSequenceSQL);
if ($DEBUG) { echo '<br>RenameTable(): Making new sequence using: ' . $sSequenceSQL . $lastval; }
$oProc->m_odb->query($sSequenceSQL . $lastval,__LINE__,__FILE__);
if ($DEBUG) { echo '<br>RenameTable(): Altering column default for: ' . $sField; }
$oProc->m_odb->query("ALTER TABLE $sOldTableName ALTER $sField SET DEFAULT nextval('seq_" . $sNewTableName . "')",__LINE__,__FILE__);
}
$oProc->m_odb->query("DROP INDEX " . $sOldTableName . "_pkey",__LINE__,__FILE__);
return !!($oProc->m_odb->query("ALTER TABLE $sOldTableName RENAME TO $sNewTableName"));
}
function RenameColumn($oProc, &$aTables, $sTableName, $sOldColumnName, $sNewColumnName, $bCopyData = true)
{
// This really needs testing - it can affect primary keys, and other table-related objects
// like sequences and such
if ($bCopyData)
{
$oProc->m_odb->query("SELECT * INTO $sTableName" . "_tmp FROM $sTableName");
}
$this->DropTable($oProc, $aTables, $sTableName);
if (!$bCopyData)
{
return $this->CreateTable($oProc, $aTables, $sTableName, $oProc->m_aTables[$sTableName], false);
}
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], True);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns);
$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
$bRet = !!($oProc->m_odb->query($query));
return ($bRet && $this->DropTable($oProc, $aTables, $sTableName . "_tmp"));
}
function AlterColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef, $bCopyData = true)
{
if ($bCopyData)
{
$oProc->m_odb->query("SELECT * INTO $sTableName" . "_tmp FROM $sTableName");
}
$this->DropTable($oProc, $aTables, $sTableName);
if (!$bCopyData)
{
return $this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], True);
}
$this->CreateTable($oProc, $aTables, $sTableName, $aTables[$sTableName], True);
$this->_GetColumns($oProc, $sTableName . "_tmp", $sColumns, '', $sColumnName, $aColumnDef['type'] == 'auto' ? 'int4' : $aColumnDef['type']);
// TODO: analyze the type of change and determine if this is used or _CopyAlteredTable
// this is a performance consideration only, _CopyAlteredTable should be safe
//$query = "INSERT INTO $sTableName SELECT $sColumns FROM $sTableName" . "_tmp";
//$bRet = !!($oProc->m_odb->query($query));
$bRet = $this->_CopyAlteredTable($oProc, $aTables, $sTableName . '_tmp', $sTableName);
return ($bRet && $this->DropTable($oProc, $aTables, $sTableName . "_tmp"));
}
function AddColumn($oProc, &$aTables, $sTableName, $sColumnName, &$aColumnDef)
{
$oProc->_GetFieldSQL($aColumnDef, $sFieldSQL);
$query = "ALTER TABLE $sTableName ADD COLUMN $sColumnName $sFieldSQL";
return !!($oProc->m_odb->query($query));
}
function GetSequenceSQL($sTableName, &$sSequenceSQL)
{
$sSequenceSQL = sprintf("CREATE SEQUENCE seq_%s", $sTableName);
return true;
}
function CreateTable($oProc, $aTables, $sTableName, $aTableDef, $bCreateSequence = true)
{
global $DEBUG;
if ($oProc->_GetTableSQL($sTableName, $aTableDef, $sTableSQL, $sSequenceSQL))
{
// create sequence first since it will be needed for default
if ($bCreateSequence && $sSequenceSQL != "")
{
if ($DEBUG) { echo '<br>Making sequence using: ' . $sSequenceSQL; }
$oProc->m_odb->query($sSequenceSQL);
}
$query = "CREATE TABLE $sTableName ($sTableSQL)";
return !!($oProc->m_odb->query($query));
}
return false;
}
}
?>

View File

@ -0,0 +1,695 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
include('./inc/class.setup_detection.inc.php');
include('./inc/class.setup_process.inc.php');
include('./inc/class.setup_lang.inc.php');
include('./inc/class.setup_html.inc.php');
class phpgw_setup extends phpgw_setup_html
{
var $db;
var $oProc;
var $tables;
/*!
@function loaddb
@abstract include api db class for the ConfigDomain and connect to the db
*/
function loaddb()
{
global $phpgw_info, $phpgw_domain, $ConfigDomain;
/* Database setup */
if (!isset($phpgw_info["server"]["api_inc"]))
{
$phpgw_info["server"]["api_inc"] = PHPGW_SERVER_ROOT . "/phpgwapi/inc";
}
include($phpgw_info["server"]["api_inc"] . "/class.db_".$phpgw_domain[$ConfigDomain]["db_type"].".inc.php");
$this->db = new db;
$this->db->Host = $phpgw_domain[$ConfigDomain]["db_host"];
$this->db->Type = $phpgw_domain[$ConfigDomain]["db_type"];
$this->db->Database = $phpgw_domain[$ConfigDomain]["db_name"];
$this->db->User = $phpgw_domain[$ConfigDomain]["db_user"];
$this->db->Password = $phpgw_domain[$ConfigDomain]["db_pass"];
//$phpgw_schema_proc = new phpgw_schema_proc($phpgw_domain[$ConfigDomain]["db_type"]);
}
/*!
@function auth
@abstract authenticate the setup user
@param $auth_type ???
*/
function auth($auth_type = "Config")
{
global $phpgw_domain, $phpgw_info, $HTTP_POST_VARS, $FormLogout, $ConfigLogin, $HeaderLogin, $FormDomain, $FormPW, $ConfigDomain, $ConfigPW, $HeaderPW, $ConfigLang;
if (isset($FormLogout))
{
if ($FormLogout == 'config' ||
$FormLogout == 'ldap' ||
$FormLogout == 'ldapexport' ||
$FormLogout == 'ldapimport' ||
$FormLogout == 'sqltoarray')
{
setcookie("ConfigPW"); // scrub the old one
setcookie("ConfigDomain"); // scrub the old one
setcookie("ConfigLang");
$phpgw_info["setup"]["ConfigLoginMSG"] = "You have successfully logged out";
return False;
}
elseif($FormLogout == "header")
{
setcookie("HeaderPW"); // scrub the old one
$phpgw_info["setup"]["HeaderLoginMSG"] = "You have successfully logged out";
return False;
}
}
elseif (isset($ConfigPW))
{
if ($ConfigPW != $phpgw_domain[$ConfigDomain]["config_passwd"] && $auth_type == "Config")
{
setcookie("ConfigPW"); // scrub the old one
setcookie("ConfigDomain"); // scrub the old one
setcookie("ConfigLang");
$phpgw_info["setup"]["ConfigLoginMSG"] = "Invalid session cookie (cookies must be enabled)";
return False;
}
else
{
return True;
}
}
elseif (isset($FormPW))
{
if (isset($ConfigLogin))
{
if ($FormPW == $phpgw_domain[$FormDomain]["config_passwd"] && $auth_type == "Config")
{
setcookie("HeaderPW"); // scrub the old one
setcookie("ConfigPW",$FormPW);
setcookie("ConfigDomain",$FormDomain);
setcookie("ConfigLang",$ConfigLang);
$ConfigDomain = $FormDomain;
return True;
}
else
{
$phpgw_info["setup"]["ConfigLoginMSG"] = "Invalid password";
return False;
}
}
elseif (isset($HeaderLogin))
{
if ($FormPW == $phpgw_info["server"]["header_admin_password"] && $auth_type == "Header")
{
setcookie("HeaderPW",$FormPW);
return True;
}
else
{
$phpgw_info["setup"]["HeaderLoginMSG"] = "Invalid password";
return False;
}
}
}
elseif (isset($HeaderPW))
{
if ($HeaderPW != $phpgw_info["server"]["header_admin_password"] && $auth_type == "Header")
{
setcookie("HeaderPW"); // scrub the old one
$phpgw_info["setup"]["HeaderLoginMSG"] = "Invalid session cookie (cookies must be enabled)";
return False;
}
else
{
return True;
}
}
else
{
return False;
}
}
/*!
@function isinarray
@abstract php3/4 compliant in_array()
@param $needle String to search for
@param $haystack Array to search
*/
function isinarray($needle,$haystack='')
{
if($haystack == '')
{
settype($haystack,'array');
$haystack = Array();
}
for($i=0;$i<count($haystack) && $haystack[$i] !=$needle;$i++);
return ($i!=count($haystack));
}
/*!
@function get_major
@abstract Return X.X.X major version from X.X.X.X versionstring
@param $
*/
function get_major($versionstring)
{
if (!$versionstring)
{
return False;
}
$version = ereg_replace('pre','.',$versionstring);
$varray = explode('.',$version);
$major = implode('.',array($varray[0],$varray[1],$varray[2]));
return $major;
}
/*!
@function register_app
@abstract Add an application to the phpgw_applications table
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enable optional, set to True/False to override setup.inc.php setting
*/
function register_app($appname,$enable=99)
{
global $setup_info,$DEBUG;
if(!$appname)
{
return False;
}
if ($enable==99)
{
$enable = $setup_info[$appname]['enable'];
}
$enable = intval($enable);
// Use old applications table if the currentver is less than 0.9.10pre8,
// but not if the currentver = '', which probably means new install.
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
{
$appstbl = 'applications';
}
else
{
$appstbl = 'phpgw_applications';
}
if($DEBUG)
{
echo '<br>register_app(): ' . $appname . ', version: ' . $setup_info[$appname]['version'] . ', table: ' . $appstbl . '<br>';
//var_dump($setup_info[$appname]);
}
if ($setup_info[$appname]['version'])
{
if ($setup_info[$appname]['tables'])
{
$tables = implode(',',$setup_info[$appname]['tables']);
}
$this->db->query("INSERT INTO $appstbl "
. "(app_name,app_title,app_enabled,app_order,app_tables,app_version) "
. "VALUES ("
. "'" . $setup_info[$appname]['name'] . "',"
. "'" . $setup_info[$appname]['title'] . "',"
. $enable . ","
. intval($setup_info[$appname]['app_order']) . ","
. "'" . $tables . "',"
. "'" . $setup_info[$appname]['version'] . "');"
);
}
}
/*!
@function app_registered
@abstract Check if an application has info in the db
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enabled optional, set to False to not enable this app
*/
function app_registered($appname)
{
global $setup_info,$DEBUG;
if(!$appname)
{
return False;
}
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
{
$appstbl = 'applications';
}
else
{
$appstbl = 'phpgw_applications';
}
if($DEBUG)
{
echo '<br>app_registered(): checking ' . $appname . ', table: ' . $appstbl;
//var_dump($setup_info[$appname]);
}
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
$this->db->next_record();
if ($this->db->f(0))
{
if($DEBUG)
{
echo '... app previously registered.';
}
return True;
}
if($DEBUG)
{
echo '... app not registered';
}
return False;
}
/*!
@function update_app
@abstract Update application info in the db
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $enabled optional, set to False to not enable this app
*/
function update_app($appname)
{
global $setup_info,$DEBUG;
if(!$appname)
{
return False;
}
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
{
$appstbl = 'applications';
}
else
{
$appstbl = 'phpgw_applications';
}
if($DEBUG)
{
echo '<br>update_app(): ' . $appname . ', version: ' . $setup_info[$appname]['currentver'] . ', table: ' . $appstbl . '<br>';
//var_dump($setup_info[$appname]);
}
$this->db->query("SELECT COUNT(app_name) FROM $appstbl WHERE app_name='".$appname."'");
$this->db->next_record();
if (!$this->db->f(0))
{
return False;
}
if ($setup_info[$appname]['version'])
{
//echo '<br>' . $setup_info[$appname]['version'];
if ($setup_info[$appname]['tables'])
{
$tables = implode(',',$setup_info[$appname]['tables']);
}
$sql = "UPDATE $appstbl "
. "SET app_name='" . $setup_info[$appname]['name'] . "',"
. " app_title='" . $setup_info[$appname]['title'] . "',"
. " app_enabled=" . intval($setup_info[$appname]['enable']) . ","
. " app_order=" . intval($setup_info[$appname]['app_order']) . ","
. " app_tables='" . $tables . "',"
. " app_version='" . $setup_info[$appname]['version'] . "'"
. " WHERE app_name='" . $appname . "'";
//echo $sql; exit;
$this->db->query($sql);
}
}
/*!
@function update_app_version
@abstract Update application version in applications table, post upgrade
@param $setup_info Array of application information (multiple apps or single)
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
@param $tableschanged ???
*/
function update_app_version($setup_info, $appname, $tableschanged = True)
{
if(!$appname)
{
return False;
}
global $phpgw_info,$setup_info;
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
{
$appstbl = 'applications';
}
else
{
$appstbl = 'phpgw_applications';
}
if ($tableschanged == True)
{
$phpgw_info['setup']['tableschanged'] = True;
}
if ($setup_info[$appname]['currentver'])
{
$this->db->query("UPDATE $appstbl SET app_version='" . $setup_info[$appname]['currentver'] . "' WHERE app_name='".$appname."'");
}
return $setup_info;
}
/*!
@function deregister_app
@abstract de-Register an application
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function deregister_app($appname)
{
if(!$appname)
{
return False;
}
global $setup_info;
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && ($setup_info['phpgwapi']['currentver'] != ''))
{
$appstbl = 'applications';
}
else
{
$appstbl = 'phpgw_applications';
}
//echo 'DELETING application: ' . $appname;
$this->db->query("DELETE FROM $appstbl WHERE app_name='". $appname ."'");
}
/*!
@function register_hooks
@abstract Register an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function register_hooks($appname)
{
global $setup_info;
if(!$appname)
{
return False;
}
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5') && ($setup_info['phpgwapi']['currentver'] != ''))
{
// No phpgw_hooks table yet.
return False;
}
$this->db->query("SELECT COUNT(hook_appname) FROM phpgw_hooks WHERE hook_appname='".$appname."'");
$this->db->next_record();
if ($this->db->f(0))
{
$this->deregister_hooks($appname);
}
//echo "ADDING hooks for: " . $setup_info[$appname]['name'];
if (is_array($setup_info[$appname]['hooks']))
{
while (list($key,$hook) = each($setup_info[$appname]['hooks']))
{
$this->db->query("INSERT INTO phpgw_hooks "
. "(hook_appname,hook_location,hook_filename) "
. "VALUES ("
. "'" . $setup_info[$appname]['name'] . "',"
. "'" . $hook . "',"
. "'" . "hook_" . $hook . ".inc.php" . "');"
);
}
}
}
/*!
@function update_hooks
@abstract Update an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function update_hooks($appname)
{
global $setup_info;
if(!$appname)
{
return False;
}
if ($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.8pre5'))
{
// No phpgw_hooks table yet.
return False;
}
$this->db->query("SELECT COUNT(*) FROM phpgw_hooks WHERE hook_appname='".$appname."'");
$this->db->next_record();
if (!$this->db->f(0))
{
return False;
}
if ($setup_info[$appname]['version'])
{
if (is_array($setup_info[$appname]['hooks']))
{
$this->deregister_hooks($appname);
$this->register_hooks($appname);
}
}
}
/*!
@function deregister_hooks
@abstract de-Register an application's hooks
@param $appname Application 'name' with a matching $setup_info[$appname] array slice
*/
function deregister_hooks($appname)
{
if(!$appname)
{
return False;
}
//echo "DELETING hooks for: " . $setup_info[$appname]['name'];
$this->db->query("DELETE FROM phpgw_hooks WHERE hook_appname='". $appname ."'");
}
/* The following function is only used by config.php */
/*!
@function execute_script
@abstract Run scripts (form sections) per application for a particular setup screen
@param $script Name of script to run, e.g. 'config' == 'config.inc.php'
@param $order optional, set to a sorting array to run scripts in a
particular order
*/
function execute_script($script, $order = '')
{
global $phpgw_info, $phpgw_domain, $current_config, $newsetting, $phpgw_setup, $SERVER_NAME;
if ($order != '' && gettype($order) != 'array'){ $order = array($order); }
if ($order == '') { $order = array(); }
/* First include the ordered setup script file */
reset ($order);
while (list (, $appname) = each ($order))
{
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/setup/' . $script . '.inc.php';
if (file_exists($f)) { include($f); }
$completed_scripts[$appname] = True;
}
/* Then add the rest */
/*
$d = dir(PHPGW_SERVER_ROOT);
while ($entry=$d->read())
{
if ($entry != "" && $completed_scripts[$entry] != True)
{
$f = PHPGW_SERVER_ROOT . '/' . $entry . '/setup/' . $script . '.inc.php';
if (file_exists($f)) { include($f); }
}
}
*/
}
/*!
@function alessthanb
@abstract phpgw version checking, is param 1 < param 2 in phpgw versionspeak?
@param $a phpgw version number to check if less than $b
@param $b phpgw version number to check $a against
#return True if $a < $b
*/
function alessthanb($a,$b,$DEBUG=False)
{
$num = array('1st','2nd','3rd','4th');
if ($DEBUG)
{
echo'<br>Input values: '
. 'A="'.$a.'", B="'.$b.'"';
}
$newa = ereg_replace('pre','.',$a);
$newb = ereg_replace('pre','.',$b);
$testa = explode('.',$newa);
if($testa[3] == '')
{
$testa[3] = 0;
}
$testb = explode('.',$newb);
if($testa[3] == '')
{
$testa[3] = 0;
}
$less = 0;
for ($i=0;$i<count($testa);$i++)
{
if ($DEBUG) { echo'<br>Checking if '. intval($testa[$i]) . ' is less than ' . intval($testb[$i]) . ' ...'; }
if (intval($testa[$i]) < intval($testb[$i]))
{
if ($DEBUG) { echo ' yes.'; }
$less++;
if ($i<3)
{
// Ensure that this is definitely smaller
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
$less = 5;
break;
}
}
elseif(intval($testa[$i]) > intval($testb[$i]))
{
if ($DEBUG) { echo ' no.'; }
$less--;
if ($i<2)
{
// Ensure that this is definitely greater
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
$less = -5;
break;
}
}
else
{
if ($DEBUG) { echo ' no, they are equal.'; }
$less = 0;
}
}
if ($DEBUG) { echo '<br>Check value is: "'.$less.'"'; }
if ($less>0)
{
if ($DEBUG) { echo '<br>A is less than B'; }
return True;
}
elseif($less<0)
{
if ($DEBUG) { echo '<br>A is greater than B'; }
return False;
}
else
{
if ($DEBUG) { echo '<br>A is equal to B'; }
return False;
}
}
/*!
@function amorethanb
@abstract phpgw version checking, is param 1 > param 2 in phpgw versionspeak?
@param $a phpgw version number to check if more than $b
@param $b phpgw version number to check $a against
#return True if $a < $b
*/
function amorethanb($a,$b,$DEBUG=False)
{
$num = array('1st','2nd','3rd','4th');
if ($DEBUG)
{
echo'<br>Input values: '
. 'A="'.$a.'", B="'.$b.'"';
}
$newa = ereg_replace('pre','.',$a);
$newb = ereg_replace('pre','.',$b);
$testa = explode('.',$newa);
if($testa[3] == '')
{
$testa[3] = 0;
}
$testb = explode('.',$newb);
if($testa[3] == '')
{
$testa[3] = 0;
}
$less = 0;
for ($i=0;$i<count($testa);$i++)
{
if ($DEBUG) { echo'<br>Checking if '. intval($testa[$i]) . ' is more than ' . intval($testb[$i]) . ' ...'; }
if (intval($testa[$i]) > intval($testb[$i]))
{
if ($DEBUG) { echo ' yes.'; }
$less++;
if ($i<3)
{
// Ensure that this is definitely greater
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely greater than B."; }
$less = 5;
break;
}
}
elseif(intval($testa[$i]) < intval($testb[$i]))
{
if ($DEBUG) { echo ' no.'; }
$less--;
if ($i<2)
{
// Ensure that this is definitely smaller
if ($DEBUG) { echo" This is the $num[$i] octet, so A is definitely less than B."; }
$less = -5;
break;
}
}
else
{
if ($DEBUG) { echo ' no, they are equal.'; }
$less = 0;
}
}
if ($DEBUG) { echo '<br>Check value is: "'.$less.'"'; }
if ($less>0)
{
if ($DEBUG) { echo '<br>A is greater than B'; }
return True;
}
elseif($less<0)
{
if ($DEBUG) { echo '<br>A is less than B'; }
return False;
}
else
{
if ($DEBUG) { echo '<br>A is equal to B'; }
return False;
}
}
}
?>

View File

@ -0,0 +1,380 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 phpgw_setup_detection
{
var $db;
var $oProc;
var $tables;
function get_versions()
{
global $phpgw_info, $phpgw_domain, $current_config, $newsetting, $SERVER_NAME;
$d = dir(PHPGW_SERVER_ROOT);
while($entry=$d->read())
{
if (!ereg("setup",$entry))
{
$f = PHPGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
if (file_exists ($f))
{
include($f);
$setup_info[$entry]['filename'] = $f;
}
}
}
$d->close();
// echo "<pre>"; echo var_dump($setup_info); echo "</pre>"; exit;
return $setup_info;
}
function get_db_versions($setup_info = "")
{
global $phpgw_info;
$this->db->Halt_On_Error = "no";
$tables = $this->db->table_names();
while(list($key,$val) = @each($tables))
{
$tname[] = $val['table_name'];
}
$newapps = $this->isinarray('phpgw_applications',$tname);
$oldapps = $this->isinarray('applications',$tname);
if ( ( is_array($tables) ) && ( count($tables) > 0 ) && ( $newapps || $oldapps ) )
{
/* one of these tables exists. checking for post/pre beta version */
if ($newapps)
{
$this->db->query("select * from phpgw_applications");
while (@$this->db->next_record())
{
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
$setup_info[$this->db->f('app_name')]['enabled'] = $this->db->f('app_enabled');
}
// This is to catch old setup installs that did not have phpgwapi listed as an app
if (!$setup_info['phpgwapi']['currentver'])
{
$setup_info['phpgwapi']['currentver'] = $setup_info['admin']['currentver'];
$setup_info['phpgwapi']['enabled'] = $setup_info['admin']['enabled'];
//var_dump($setup_info['phpgwapi']);exit;
$this->register_app('phpgwapi');
}
}
elseif ($oldapps)
{
$this->db->query('select * from applications');
while (@$this->db->next_record())
{
if ($this->db->f('app_name') == 'admin')
{
$setup_info['phpgwapi']['currentver'] = $this->db->f('app_version');
}
$setup_info[$this->db->f('app_name')]['currentver'] = $this->db->f('app_version');
}
}
}
//echo print_r($setup_info);exit;
return $setup_info;
}
/* app status values:
U Upgrade required/available
R upgrade in pRogress
C upgrade Completed successfully
D Dependency failure
F upgrade Failed
V Version mismatch at end of upgrade (Not used, proposed only)
M Missing files at start of upgrade (Not used, proposed only)
*/
function compare_versions($setup_info)
{
global $phpgw_info, $phpgw_domain, $current_config, $newsetting, $SERVER_NAME;
reset ($setup_info);
while (list ($key, $value) = each ($setup_info))
{
//echo '<br>'.$setup_info[$key]['name'].'STATUS: '.$setup_info[$key]['status'];
// Only set this if it has not already failed to upgrade - Milosch
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
{
//if ($setup_info[$key]['currentver'] > $setup_info[$key]['version'])
if ($this->amorethanb($setup_info[$key]['currentver'],$setup_info[$key]['version']))
{
$setup_info[$key]['status'] = 'V';
}
elseif ($setup_info[$key]['currentver'] == $setup_info[$key]['version'])
{
$setup_info[$key]['status'] = 'C';
}
//elseif ($setup_info[$key]['currentver'] < $setup_info[$key]['version'])
elseif ($this->alessthanb($setup_info[$key]['currentver'],$setup_info[$key]['version']))
{
$setup_info[$key]['status'] = 'U';
}
else
{
$setup_info[$key]['status'] = 'U';
}
}
}
//echo "<pre>"; echo var_dump($setup_info); echo "</pre>";
return $setup_info;
}
function check_depends($setup_info)
{
global $phpgw_info, $phpgw_domain, $current_config, $newsetting, $SERVER_NAME;
reset ($setup_info);
/* Run the list of apps */
while (list ($key, $value) = each ($setup_info))
{
/* Does this app have any depends */
if (isset($value['depends']))
{
/* If so find out which apps it depends on */
while (list ($depkey, $depvalue) = each ($value['depends']))
{
/* I set this to False until we find a compatible version of this app */
$setup_info['depends'][$depkey]['status'] = False;
/* Now we loop thru the versions looking for a compatible version */
while (list ($depskey, $depsvalue) = each ($value['depends'][$depkey]['versions']))
{
$major = $this->get_major($setup_info[$value['depends'][$depkey]['appname']]['currentver']);
//echo $major;
if ($major == $depsvalue)
//if ($setup_info[$value['depends'][$depkey]['appname']]['currentver'] == $depsvalue )
{
$setup_info['depends'][$depkey]['status'] = True;
}
else
{
}
}
}
/* Finally I will loop thru the dependencies again look for apps that still have a failure status */
/* If we find one we set the apps overall status as a dependency failure */
reset ($value['depends']);
while (list ($depkey, $depvalue) = each ($value['depends']))
{
if ($setup_info['depends'][$depkey]['status'] == False)
{
// Only set this if it has not already failed to upgrade - Milosch
if (!( ($setup_info[$key]['status'] == 'F') || ($setup_info[$key]['status'] == 'C') ))
{
$setup_info[$key]['status'] = 'D';
}
}
}
}
}
return $setup_info;
}
function check_header()
{
global $phpgw_domain, $phpgw_info;
if(!file_exists("../header.inc.php"))
{
$phpgw_info["setup"]["header_msg"] = "Stage One";
return "1";
}
else
{
if (!isset($phpgw_info["server"]["header_admin_password"]))
{
$phpgw_info["setup"]["header_msg"] = "Stage One (No header admin password set)";
return "2";
}
elseif (!isset($phpgw_domain))
{
$phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)";
return "3";
}
elseif ($phpgw_info["server"]["versions"]["header"] != $phpgw_info["server"]["versions"]["current_header"])
{
$phpgw_info["setup"]["header_msg"] = "Stage One (Upgrade your header.inc.php)";
return "3";
}
}
/* header.inc.php part settled. Moving to authentication */
$phpgw_info["setup"]["header_msg"] = "Stage One (Completed)";
return "10";
}
function check_db()
{
global $phpgw_info,$setup_info;
$this->db->Halt_On_Error = "no";
//echo '<pre>'.var_dump($setup_info).'</pre>';exit;
if (isset($setup_info['phpgwapi']['currentver']))
{
$setup_info = $this->get_db_versions($setup_info);
}
//echo '<pre>'.var_dump($setup_info).'</pre>';exit;
if (isset($setup_info['phpgwapi']['currentver']))
{
if ($setup_info['phpgwapi']['currentver'] == $setup_info['phpgwapi']['version'])
{
$phpgw_info['setup']['header_msg'] = 'Stage 1 (Tables Complete)';
return 10;
}
else
{
$phpgw_info['setup']['header_msg'] = 'Stage 1 (Tables need upgrading)';
return 4;
}
}
else
{
/* no tables, so checking if we can create them */
$this->db->query('CREATE TABLE phpgw_testrights ( testfield varchar(5) NOT NULL )');
if (! $this->db->Errno)
{
//if (isset($isdb)){
$this->db->query('DROP TABLE phpgw_testrights');
$phpgw_info['setup']['header_msg'] = 'Stage 3 (Install Applications)';
return 3;
}
else
{
$phpgw_info['setup']['header_msg'] = 'Stage 1 (Create Database)';
return 1;
}
}
}
function check_config()
{
global $phpgw_info;
$this->db->Halt_On_Error = "no";
if ($phpgw_info['setup']['stage']['db'] != 10){return '';}
// Since 0.9.10pre6 config table is named as phpgw_config
$config_table = 'config';
$ver = explode('.',$phpgw_info['server']['versions']['phpgwapi']);
if(ereg("([0-9]+)(pre)([0-9]+)",$ver[2],$regs))
{
if(($regs[1] == '10') && ($regs[3] >= '6'))
{
$config_table = 'phpgw_config';
}
}
@$this->db->query("select config_value from $config_table where config_name='freshinstall'");
$this->db->next_record();
$configed = $this->db->f('config_value');
if ($configed)
{
$phpgw_info['setup']['header_msg'] = 'Stage 2 (Needs Configuration)';
return 1;
}
else
{
$phpgw_info['setup']['header_msg'] = 'Stage 2 (Configuration OK)';
return 10;
}
}
function check_lang()
{
global $phpgw_info;
$this->db->Halt_On_Error = "no";
if ($phpgw_info["setup"]["stage"]["db"] != 10){return "";}
$this->db->query("select distinct lang from lang;");
if ($this->db->num_rows() == 0)
{
$phpgw_info["setup"]["header_msg"] = "Stage 3 (No languages installed)";
return 1;
}
else
{
while (@$this->db->next_record())
{
$phpgw_info["setup"]["installed_langs"][$this->db->f("lang")] = $this->db->f("lang");
}
reset ($phpgw_info["setup"]["installed_langs"]);
while (list ($key, $value) = each ($phpgw_info["setup"]["installed_langs"]))
{
$sql = "select lang_name from languages where lang_id = '".$value."';";
$this->db->query($sql);
$this->db->next_record();
$phpgw_info["setup"]["installed_langs"][$value] = $this->db->f("lang_name");
}
$phpgw_info["setup"]["header_msg"] = "Stage 3 (Completed)";
return 10;
}
}
/*
@function check_app_tables
@abstract Verify that all of an app's tables exist in the db
@param $appname
@param $any optional, set to True to see if any of the apps tables are installed
*/
function check_app_tables($appname,$any=False)
{
global $setup_info,$DEBUG;
if($setup_info[$appname]['tables'])
{
// Make a copy, else we send some callers into an infinite loop
$copy = $setup_info;
$this->db->Halt_On_Error = "no";
$tablenames = $this->db->table_names();
while(list($key,$val) = @each($tablenames))
{
$tables[] = $val['table_name'];
}
while(list($key,$val) = @each($copy[$appname]['tables']))
{
if ($DEBUG) { echo '<br>check_app_tables(): Checking: ' . $appname . ',table: ' . $val; }
if(!$this->isinarray($val,$tables))
{
if ($DEBUG) { echo '<br>check_app_tables(): ' . $val . ' missing!'; }
if (!$any)
{
return False;
}
else
{
$none++;
}
}
else
{
if ($any)
{
if ($DEBUG) { echo '<br>check_app_tables(): Some tables installed'; }
return True;
}
}
}
}
if ($none && $any)
{
if ($DEBUG) { echo '<br>check_app_tables(): No tables installed'; }
return False;
}
else
{
if ($DEBUG) { echo '<br>check_app_tables(): All tables installed'; }
return True;
}
}
}
?>

View File

@ -0,0 +1,218 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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 phpgw_setup_html extends phpgw_setup_lang
{
var $db;
/*!
@function generate_header
@abstract generate header.inc.php file output - NOT a generic html header function
*/
function generate_header()
{
global $setting, $phpgw_setup, $phpgw_info, $header_template;
$header_template->set_file(array('header' => 'header.inc.php.template'));
while(list($k,$v) = each($setting))
{
$header_template->set_var(strtoupper($k),$v);
}
return $header_template->parse('out','header');
}
function setup_tpl_dir($app_name='setup')
{
global $phpgw_info;
// hack to get tpl dir
if (is_dir(PHPGW_SERVER_ROOT))
{
$srv_root = PHPGW_SERVER_ROOT . SEP . "$app_name" . SEP;
}
else
{
$srv_root = '';
}
$tpl_typical = 'templates' . SEP . 'default';
$tpl_root = "$srv_root" ."$tpl_typical";
return $tpl_root;
}
function show_header($title = '',$nologoutbutton = False, $logoutfrom = 'config', $configdomain = '')
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
$setup_tpl->set_var('lang_charset',lang('charset'));
if ($nologoutbutton)
{
$btn_logout = '&nbsp;';
}
else
{
$btn_logout = '<a href="'.$PHP_SELF.'?FormLogout='.$logoutfrom.'" class="link">'.lang('Logout').'</a>';
}
$setup_tpl->set_var('lang_setup', lang('setup'));
$setup_tpl->set_var('page_title',$title);
if ($configdomain == '')
{
$setup_tpl->set_var('configdomain',"");
}
else
{
$setup_tpl->set_var('configdomain',' - ' . lang('Domain') . ': '.$configdomain);
}
$setup_tpl->set_var('pgw_ver',$phpgw_info['server']['versions']['phpgwapi']);
$setup_tpl->set_var('logoutbutton',$btn_logout);
$setup_tpl->pparse('out','T_head');
//$setup_tpl->set_var('T_head','');
}
function show_footer()
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
$setup_tpl->pparse('out','T_footer');
unset($setup_tpl);
}
function show_alert_msg($alert_word='Setup alert',$alert_msg='setup alert (generic)')
{
global $phpgw_info, $setup_tpl, $PHP_SELF;
$setup_tpl->set_var('V_alert_word',$alert_word);
$setup_tpl->set_var('V_alert_msg',$alert_msg);
$setup_tpl->pparse('out','T_alert_msg');
}
function make_frm_btn_simple($pre_frm_blurb='',$frm_method='POST',$frm_action='',$input_type='submit',$input_value='',$post_frm_blurb='')
{
// are these golbals necessary?
global $phpgw_info, $setup_tpl, $PHP_SELF;
// a simple form has simple components
$simple_form =
$pre_frm_blurb ."\n"
.'<form method="'.$frm_method.'" action="'.$frm_action.'">' ."\n"
.'<input type="'.$input_type.'" value="'.$input_value.'">' ."\n"
.'</form>' ."\n"
.$post_frm_blurb ."\n";
return $simple_form;
}
function make_href_link_simple($pre_link_blurb='',$href_link='',$href_text='default text',$post_link_blurb='')
{
// are these golbals necessary?
global $phpgw_info, $setup_tpl, $PHP_SELF;
// a simple href link has simple components
$simple_link =
$pre_link_blurb
.'<a href="' .$href_link .'">' .$href_text .'</a> '
.$post_link_blurb ."\n";
return $simple_link;
}
function login_form()
{
global $phpgw_info, $phpgw_domain, $setup_tpl, $PHP_SELF;
// begin use TEMPLATE login_main.tpl
$setup_tpl->set_var('ConfigLoginMSG',$phpgw_info['setup']['ConfigLoginMSG']);
$setup_tpl->set_var('HeaderLoginMSG',$phpgw_info['setup']['HeaderLoginMSG']);
if ($phpgw_info['setup']['stage']['header'] == '10')
{
// begin use SUB-TEMPLATE login_stage_header,
// fills V_login_stage_header used inside of login_main.tpl
$setup_tpl->set_var('lang_select',lang_select());
if (count($phpgw_domain) > 1)
{
// use BLOCK B_multi_domain inside of login_stage_header
$setup_tpl->parse('V_multi_domain','B_multi_domain');
// in this case, the single domain block needs to be nothing
$setup_tpl->set_var('V_single_domain','');
}
else
{
reset($phpgw_domain);
$default_domain = each($phpgw_domain);
$setup_tpl->set_var('default_domain_zero',$default_domain[0]);
// use BLOCK B_single_domain inside of login_stage_header
$setup_tpl->parse('V_single_domain','B_single_domain');
// // in this case, the multi domain block needs to be nothing
$setup_tpl->set_var('V_multi_domain','');
}
// end use SUB-TEMPLATE login_stage_header
// put all this into V_login_stage_header for use inside login_main
$setup_tpl->parse('V_login_stage_header','T_login_stage_header');
}
else
{
// begin SKIP SUB-TEMPLATE login_stage_header
$setup_tpl->set_var('V_multi_domain','');
$setup_tpl->set_var('V_single_domain','');
$setup_tpl->set_var('V_login_stage_header','');
}
// end use TEMPLATE login_main.tpl
// now out the login_main template
$setup_tpl->pparse('out','T_login_main');
}
function get_template_list()
{
global $phpgw_info;
$d = dir(PHPGW_SERVER_ROOT . '/phpgwapi/templates');
//$list['user_choice']['name'] = 'user_choice';
//$list['user_choice']['title'] = 'Users Choice';
while($entry=$d->read())
{
if ($entry != 'CVS' && $entry != '.' && $entry != '..')
{
$list[$entry]['name'] = $entry;
$f = PHPGW_SERVER_ROOT . '/phpgwapi/templates/' . $entry . '/details.inc.php';
if (file_exists ($f))
{
include($f);
$list[$entry]['title'] = 'Use ' . $phpgw_info['template'][$entry]['title'] . 'interface';
}
else
{
$list[$entry]['title'] = $entry;
}
}
}
$d->close();
reset ($list);
return $list;
}
function list_themes()
{
$dh = dir(PHPGW_SERVER_ROOT . '/phpgwapi/themes');
while ($file = $dh->read())
{
if (eregi("\.theme$", $file))
{
$list[] = substr($file,0,strpos($file,'.'));
}
}
$dh->close();
reset ($list);
return $list;
}
}
?>

View File

@ -0,0 +1,109 @@
<?php
/**************************************************************************\
* phpGroupWare API - Translation class for phpgw lang files *
* This file written by Miles Lott <milosch@phpgroupware.org> *
* and Dan Kuykendall <seek3r@phpgroupware.org> *
* Handles multi-language support using flat files *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
class phpgw_setup_lang extends phpgw_setup_process
{
var $langarray;
/*!
@function setup_lang
@abstract constructor for the class, loads all phrases into langarray
@param $lang user lang variable (defaults to en)
*/
function phpgw_setup_lang()
{
global $ConfigLang;
if(!$ConfigLang)
{
$lang = 'en';
}
else
{
$lang = $ConfigLang;
}
$fn = '.' . SEP . 'lang' . SEP . 'phpgw_' . $lang . '.lang';
if (!file_exists($fn))
{
$fn = '.' . SEP . 'lang' . SEP . 'phpgw_en.lang';
}
if (file_exists($fn))
{
$fp = fopen($fn,'r');
while ($data = fgets($fp,8000))
{
list($message_id,$app_name,$null,$content) = explode("\t",$data);
if ($app_name == 'setup' || $app_name == 'common' || $app_name == 'all')
{
$this->langarray[] = array(
'message_id' => $message_id,
'content' => trim($content)
);
}
}
fclose($fp);
}
}
/*!
@function translate
@abstract Translate phrase to user selected lang
@param $key phrase to translate
@param $vars vars sent to lang function, passed to us
*/
function translate($key, $vars=False)
{
if (!$vars)
{
$vars = array();
}
$ret = $key;
@reset($this->langarray);
while(list($null,$data) = @each($this->langarray))
{
$lang[strtolower($data['message_id'])] = $data['content'];
}
if (isset($lang[strtolower ($key)]) && $lang[strtolower ($key)])
{
$ret = $lang[strtolower ($key)];
}
else
{
$ret = $key."*";
}
$ndx = 1;
while( list($key,$val) = each( $vars ) )
{
$ret = preg_replace( "/%$ndx/", $val, $ret );
++$ndx;
}
return $ret;
}
}
?>

View File

@ -0,0 +1,706 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
/* app status values:
U Upgrade required/available
R upgrade in pRogress
C upgrade Completed successfully
D Dependency failure
F upgrade Failed
V Version mismatch at end of upgrade (Not used, proposed only)
M Missing files at start of upgrade (Not used, proposed only)
*/
class phpgw_setup_process extends phpgw_setup_detection
{
var $db;
var $oProc;
var $tables;
/*!
@function init_process
@abstract create schema_proc object
@param none
*/
function init_process()
{
global $phpgw_domain,$ConfigDomain;
$this->oProc = CreateObject('setup.schema_proc',$phpgw_domain[$ConfigDomain]['db_type']);
//$this->oProc = CreateObject('setup.schema_proc','pgsql');
$this->oProc->m_odb = $this->db;
$this->oProc->m_odb->Host = $phpgw_domain[$ConfigDomain]['db_host'];
$this->oProc->m_odb->Database = $phpgw_domain[$ConfigDomain]['db_name'];
$this->oProc->m_odb->User = $phpgw_domain[$ConfigDomain]['db_user'];
$this->oProc->m_odb->Password = $phpgw_domain[$ConfigDomain]['db_pass'];
$this->oProc->m_odb->Halt_On_Error = 'report';
$this->oProc->m_odb->connect();
}
/*!
@function process_pass
@abstract the mother of all multipass upgrade parental loop functions
@param $setup_info array of application info from setup.inc.php files
@param $type optional, defaults to new(install), could also be 'upgrade'
*/
function process_pass($setup_info,$method='new',$DEBUG=False)
{
if (!$method)
{
return False;
}
// Place api first
$pass['phpgwapi'] = $setup_info['phpgwapi'];
@reset($setup_info);
$setup_info = $this->get_versions($setup_info);
@reset($setup_info);
$i = 1;
$passed = array();
$passing = array();
$pass_string = implode (":", $pass);
$passing_string = implode (":", $passing);
while ($pass_string != $passing_string)
{
$passing = array();
if ($DEBUG) { echo '<br>process_pass(): #' . $i . " for " . $method . " processing\n"; }
// Check current versions and dependencies
$setup_info = $this->get_db_versions($setup_info);
$setup_info = $this->compare_versions($setup_info);
//var_dump($setup_info);exit;
$setup_info = $this->check_depends($setup_info);
//if($i==2) { var_dump($passed);exit; }
// stuff the rest of the apps, but only those with available upgrades
while(list($key,$value) = each($setup_info))
{
if (($value['name'] != 'phpgwapi') && ($value['status'] == 'U'))
{
if ( ($passed[$value['name']]['status'] != 'F') && ($passed[$value['name']]['status'] != 'C') )
{
$pass[$value['name']] = $setup_info[$value['name']];
}
}
// Now if we are on the 2nd or more passes, add api in
//if (!$pass['phpgwapi'])
//{
// $pass['phpgwapi'] = $setup_info['phpgwapi'];
//}
}
switch ($method)
{
case "new":
// Create tables and insert new records for each app in this list
$passing = $this->process_current($pass,$DEBUG);
$passing = $this->process_default_records($passing,$DEBUG);
break;
case "upgrade":
// Run upgrade scripts on each app in the list
$passing = $this->process_upgrade($pass,$DEBUG);
//echo var_dump($pass);exit;
break;
default:
// What the heck are you doing?
return False;
break;
}
$pass = array();
reset($passing);
while(list($key,$value) = each($passing))
{
if($value['status'] == 'C')
{
$passed[$value['name']] = $passing[$value['name']];
if ($DEBUG) { echo '<br>process_pass(): '.$passed[$value['name']]['name'] . ' install completed'."\n"; }
}
elseif($value['status'] == 'F')
{
$setup_info[$value['name']] = $passing[$value['name']];
if ($DEBUG) { echo '<br>process_pass(): '.$setup_info[$value['name']]['name'] . ' install failed'."\n"; }
}
elseif($value['status'] == 'D')
{
$pass[$value['name']] = $setup_info[$value['name']];
if ($DEBUG) { echo '<br>process_pass(): '.$pass[$value['name']]['name'] . ' fails dependency check on this pass'."\n"; }
}
else
{
$tmp = $passing[$value['name']]['name'];
if ($DEBUG) { echo '<br>process_pass(): '.$tmp . ' skipped on this pass'."\n"; }
}
}
$i++;
if ($i == 20) // Then oops it broke
{
echo '<br>Setup failure: excess looping in process_pass():'."\n";
echo '<br>Pass:<br><pre>'."\n";
echo var_dump($pass);
echo '</pre><br>Passed:<br><pre>'."\n";
echo var_dump($passed);
echo "</pre>";
exit;
}
$pass_string = implode (":", $pass);
$passing_string = implode (":", $passing);
}
// now return the list
@reset($passed);
while(list($key,$value) = each($passed))
{
$setup_info[$value['name']] = $passed[$value['name']];
}
return ($setup_info);
}
/*!
@function process_droptables
@abstract drop tables per application, check that they are in the db first
@param $setup_info array of application info from setup.inc.php files, etc.
*/
function process_droptables($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_bDeltaOnly = False;
// The following is built so below we won't try to drop a table that isn't there
$tablenames = $this->db->table_names();
while(list($key,$val) = @each($tablenames))
{
$tables[] = $val['table_name'];
}
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
if ($setup_info[$key]['tables'])
{
while (list($a,$table) = @each($setup_info[$key]['tables']))
{
//echo $table;
if ($this->isinarray($table,$tables))
{
if ($DEBUG){ echo '<br>process_droptables(): Dropping :'. $setup_info[$key]['name'] . ' table: ' . $table; }
$this->oProc->DropTable($table);
// Update the array values for return below
$setup_info[$key]['status'] = 'U';
}
}
}
}
// Done, return current status
return ($setup_info);
}
// NOTE: This duplicates the old newtables behavior, using schema_proc
/*!
@function process_current
@abstract process current table setup in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
*/
function process_current($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_bDeltaOnly = False;
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
$enabled = False;
$appname = $setup_info[$key]['name'];
$apptitle = $setup_info[$key]['title'];
if($DEBUG) { echo "<br>process_current(): Incoming status: " . $appname . ',status: '. $setup_info[$key]['status']; }
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if ($setup_info[$key]['tables'] && file_exists($appdir.'tables_current.inc.php'))
{
if($DEBUG) { echo "<br>process_current(): Including: " . $appdir.'tables_current.inc.php'; }
include ($appdir.'tables_current.inc.php');
$ret = $this->post_process($phpgw_baseline,$DEBUG);
if($ret)
{
if ($this->app_registered($appname))
{
$this->update_app($appname);
$this->update_hooks($appname);
}
else
{
$this->register_app($appname);
$this->register_hooks($appname);
}
// Update the array values for return below
$setup_info[$key]['status'] = 'C';
}
else
{
// script processing failed
if($DEBUG) { echo "<br>process_current(): Failed for " . $appname . ',status: '. $setup_info[$key]['status']; }
$setup_info[$key]['status'] = 'F';
}
}
else
{
if($DEBUG) { echo '<br>process_current(): No current tables for ' . $apptitle . "\n"; }
// add the app, but disable it if it has tables defined
// a manual sql script install is needed, but we do add the hooks
$enabled = 99;
if ($setup_info[$key]['tables'][0] != '')
{
$enabled = False;
}
if ($this->app_registered($appname))
{
$this->update_app($appname);
$this->update_hooks($appname);
}
else
{
$this->register_app($appname,$enabled);
$this->register_hooks($appname);
}
$setup_info[$key]['status'] = 'C';
}
if($DEBUG) { echo "<br>process_current(): Outgoing status: " . $appname . ',status: '. $setup_info[$key]['status']; }
}
// Done, return current status
return ($setup_info);
}
/*!
@function process_default_records
@abstract process default_records.inc.php in each application/setup dir
@param $setup_info array of application info from setup.inc.php files, etc.
*/
function process_default_records($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_bDeltaOnly = False;
$oProc = $this->oProc;
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if ($setup_info[$key]['tables'] && file_exists($appdir.'default_records.inc.php'))
{
if ($DEBUG)
{
echo '<br>process_default_records(): Including default records for ' . $appname . "\n";
}
$this->oProc->m_odb->transaction_begin();
include ($appdir.'default_records.inc.php');
$this->oProc->m_odb->transaction_commit();
}
//$setup_info[$key]['status'] = 'C';
}
// Done, return current status
return ($setup_info);
}
/*!
@function process_test_data
@abstract process test_data.inc.php in each application/setup dir for developer tests
This data should work with the baseline tables
@param $setup_info array of application info from setup.inc.php files, etc.
*/
function process_test_data($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_bDeltaOnly = False;
$oProc = $this->oProc;
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if (file_exists($appdir.'test_data.inc.php'))
{
if ($DEBUG)
{
echo '<br>process_test_data(): Including baseline test data for ' . $appname . "\n";
}
$this->oProc->m_odb->transaction_begin();
include ($appdir.'test_data.inc.php');
$this->oProc->m_odb->transaction_commit();
}
}
// Done, return current status
return ($setup_info);
}
/*!
@function process_baseline
@abstract process baseline table setup in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
*/
function process_baseline($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
$appname = $setup_info[$key]['name'];
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
if (file_exists($appdir.'tables_baseline.inc.php'))
{
if ($DEBUG)
{
echo '<br>process_baseline(): Including baseline tables for ' . $appname . "\n";
}
include ($appdir.'tables_baseline.inc.php');
$this->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
$this->post_process($phpgw_baseline,$DEBUG);
// Update the array values for return below
//$setup_info[$key]['status'] = 'R';
}
else
{
if ($DEBUG)
{
echo '<br>process_baseline(): No baseline tables for ' . $appname . "\n";
}
//$setup_info[$key]['status'] = 'C';
}
}
// Done, return current status
return ($setup_info);
}
/*!
@function process_upgrade
@abstract process available upgrades in each application/setup dir
@param $appinfo array of application info from setup.inc.php files, etc.
*/
function process_upgrade($setup_info,$DEBUG=False)
{
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_odb->HaltOnError = "no";
$this->oProc->m_bDeltaOnly = True;
@reset($setup_info);
while (list($key,$null) = each($setup_info))
{
// if upgrade required, or if we are running again after an upgrade or dependency failure
if ($DEBUG) { echo '<br>process_upgrade(): Incoming : appname: '.$setup_info[$key]['name'] . ' status: ' . $setup_info[$key]['status']; }
if ($setup_info[$key]['status'] == 'U' ||
$setup_info[$key]['status'] == 'D' ||
$setup_info[$key]['status'] == 'V' ||
$setup_info[$key]['status'] == '') // TODO this is not getting set for api upgrade, sometimes ???
{
$appname = $setup_info[$key]['name'];
$apptitle = $setup_info[$key]['title'];
$currentver = $setup_info[$key]['currentver'];
$targetver = $setup_info[$key]['version']; // The version we need to match when done
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
$test = array();
$this->oProc->m_aTables = $phpgw_baseline = array();
/*
$phpgw_baseline = array();
$tmpapp = array();
$tmpapp[] = $setup_info[$key];
$this->process_baseline($tmpapp,$DEBUG);
$this->oProc->m_aTables = $phpgw_baseline;
// So far, including the baseline file is not helping.
// Only AlterColumn/RenameColumn seem to be failing silently.
// This is because we are not keeping up with table changes, so a table in baseline
// either does not exist anymore, or the baseline is being lost.
*/
if ($setup_info[$key]['tables'] && file_exists($appdir.'tables_baseline.inc.php'))
{
if ($DEBUG)
{
echo '<br>process_baseline(): Including baseline tables for ' . $appname . "\n";
}
include ($appdir.'tables_baseline.inc.php');
$this->oProc->m_aTables = $phpgw_baseline;
//$this->oProc->GenerateScripts($phpgw_baseline, $DEBUG);
}
else
{
if ($DEBUG)
{
echo '<br>process_baseline(): No baseline tables for ' . $appname . "\n";
}
// This should be a break with a status setting, or not at all
//break;
}
if (file_exists($appdir . 'tables_update.inc.php') && !$setup_info[$key]['updateincluded'])
{
include ($appdir . 'tables_update.inc.php');
$setup_info[$key]['updateincluded'] = True;
// $test array comes from update file, it is a list of available upgrade functions
@reset($test);
while (list($x,$value) = @each($test))
{
$currentver = $setup_info[$key]['currentver'];
// build upgrade function name
$function = $appname . "_upgrade" . ereg_replace("\.", "_", $value);
if ($DEBUG)
{
echo '<br>process_upgrade(): appname: ' . $appname;
echo '<br>process_upgrade(): currentver: ' . $currentver;
echo '<br>process_upgrade(): targetver: ' . $targetver;
echo '<br>process_upgrade(): status: ' . $setup_info[$key]['status'];
echo '<br>process_upgrade(): checking: ' . $value;
echo '<br>process_upgrade(): function: ' . $function;
}
if ($value == $targetver)
{
$this->oProc->m_bDeltaOnly = False;
// Done upgrading
if($DEBUG)
{
echo '<br>process_upgrade(): Upgrade of ' . $appname . ' to ' . $targetver . ' is completed.' . "\n";
}
$appstatus = 'C';
$setup_info[$key]['status'] = $appstatus;
$setup_info[$key]['currentver'] = $targetver;
if ($this->app_registered($appname))
{
$this->update_app($appname);
$this->update_hooks($appname);
}
else
{
$this->register_app($appname);
$this->register_hooks($appname);
}
//break;
}
elseif (($value == $currentver) || !$currentver)
//elseif ($this->alessthanb($value,$targetver,True) &&
// $this->alessthanb($currentver,$value,True))
{
// start upgrading db in addition to baseline
$this->oProc->m_bDeltaOnly = False;
if ($DEBUG) { echo '<br>process_upgrade(): running ' . $function; }
// run upgrade function
$success = $function();
if ($success != False)
{
$setup_info[$key]['currentver'] = $success;
if ($DEBUG)
{
echo '<br>process_upgrade(): Upgrade of ' . $appname
. ' from ' . $value
. ' to ' . $setup_info[$key]['currentver']
. ' is completed.' . "\n";
}
$appstatus = 'R';
$setup_info[$key]['status'] = $appstatus;
if ($this->app_registered($appname))
{
if($DEBUG)
{
echo '<br>process_upgrade(): Updating registration of ' . $appname . ', new version: ' . $setup_info[$key]['currentver'];
}
$this->update_app($appname);
$this->update_hooks($appname);
}
else
{
if($DEBUG)
{
echo '<br>process_upgrade(): Registering ' . $appname . ', version: ' . $setup_info[$key]['currentver'];
}
$this->register_app($appname);
$this->register_hooks($appname);
}
}
else
{
if($DEBUG)
{
echo '<br>process_upgrade(): Upgrade of ' . $appname
. ' from ' . $currentver
. ' to ' . $value
. ' failed!!!' . "\n";
}
$appstatus = 'F';
break;
}
}
elseif ($this->alessthanb($value,$currentver))
{
if ($DEBUG) { echo '<br>process_upgrade(): running baseline delta only: ' . $function . '...'; }
$this->oProc->m_bDeltaOnly = True;
$success = $function();
}
else
{
break;
}
}
}
else
{
if ($setup_info[$appname]['tables'])
{
$appstatus = 'F';
if ($DEBUG)
{
echo '<br>process_upgrade(): No table upgrade available for ' . $appname . "\n";
}
}
else
{
$setup_info[$key]['currentver'] == $targetver;
$appstatus = 'C';
if ($this->app_registered($appname))
{
$this->update_app($appname);
$this->update_hooks($appname);
}
else
{
$this->register_app($appname);
$this->register_hooks($appname);
}
if ($DEBUG)
{
echo '<br>process_upgrade(): No table upgrade required for ' . $appname . "\n";
}
}
}
}
else
{
$appstatus = 'C';
if ($DEBUG)
{
echo '<br>process_upgrade(): No upgrade required for ' . $appname . "\n";
}
}
// Done with this app, update status
$setup_info[$key]['status'] = $appstatus;
if ($DEBUG)
{
echo '<br>process_upgrade(): Outgoing : appname: '.$setup_info[$key]['name'] . ' status: ' . $setup_info[$key]['status'];
}
}
// Done, return current status
return ($setup_info);
}
/*!
@function post_process
@abstract commit above processing to the db
*/
function post_process($tables,$DEBUG)
{
if (!$tables)
{
return False;
}
$ret = $this->oProc->GenerateScripts($tables,$DEBUG);
if ($ret)
{
$oret = $this->oProc->ExecuteScripts($tables,$DEBUG);
if ($oret)
{
return True;
}
else
{
return False;
}
}
else
{
return False;
}
}
/*!
@function sql_to_array
@abstract send this a table name, returns printable column spec and keys for the table from
schema_proc
@param $tablename table whose array you want to see
*/
function sql_to_array($tablename = '')
{
if (!$tablename)
{
return False;
}
if (!$this->oProc)
{
$this->init_process();
}
$this->oProc->m_oTranslator->_GetColumns($this->oProc, $tablename, $sColumns, $sColumnName);
while (list($key,$tbldata) = each ($this->oProc->m_oTranslator->sCol))
{
$arr .= $tbldata;
}
$pk = $this->oProc->m_oTranslator->pk;
$fk = $this->oProc->m_oTranslator->fk;
$ix = $this->oProc->m_oTranslator->ix;
$uc = $this->oProc->m_oTranslator->uc;
return array($arr,$pk,$fk,$ix,$uc);
}
}
?>

View File

@ -0,0 +1,351 @@
<?php
/**************************************************************************\
* phpGroupWare API - Template class *
* (C) Copyright 1999-2000 NetUSE GmbH Kristian Koehntopp *
* ------------------------------------------------------------------------ *
* This is not part of phpGroupWare, but is used by phpGroupWare. *
* http://www.phpgroupware.org/ *
* ------------------------------------------------------------------------ *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation; either version 2.1 of the License, or *
* any later version. *
\**************************************************************************/
/* $Id$ */
class Template {
var $classname = "Template";
/* if set, echo assignments */
var $debug = false;
/* $file[handle] = "filename"; */
var $file = array();
/* relative filenames are relative to this pathname */
var $root = "";
/* $varkeys[key] = "key"; $varvals[key] = "value"; */
var $varkeys = array();
var $varvals = array();
/* "remove" => remove undefined variables
* "comment" => replace undefined variables with comments
* "keep" => keep undefined variables
*/
var $unknowns = "remove";
/* "yes" => halt, "report" => report error, continue, "no" => ignore error quietly */
var $halt_on_error = "yes";
/* last error message is retained here */
var $last_error = "";
/***************************************************************************/
/* public: Constructor.
* root: template directory.
* unknowns: how to handle unknown variables.
*/
function Template($root = ".", $unknowns = "remove") {
$this->set_root($root);
$this->set_unknowns($unknowns);
}
/* public: setroot(pathname $root)
* root: new template directory.
*/
function set_root($root) {
if (!is_dir($root)) {
$this->halt("set_root: $root is not a directory.");
return false;
}
$this->root = $root;
return true;
}
/* public: set_unknowns(enum $unknowns)
* unknowns: "remove", "comment", "keep"
*
*/
function set_unknowns($unknowns = "keep") {
$this->unknowns = $unknowns;
}
/* public: set_file(array $filelist)
* filelist: array of handle, filename pairs.
*
* public: set_file(string $handle, string $filename)
* handle: handle for a filename,
* filename: name of template file
*/
function set_file($handle, $filename = "") {
if (!is_array($handle)) {
if ($filename == "") {
$this->halt("set_file: For handle $handle filename is empty.");
return false;
}
$this->file[$handle] = $this->filename($filename);
} else {
reset($handle);
while(list($h, $f) = each($handle)) {
$this->file[$h] = $this->filename($f);
}
}
}
/* public: set_block(string $parent, string $handle, string $name = "")
* extract the template $handle from $parent,
* place variable {$name} instead.
*/
function set_block($parent, $handle, $name = "") {
if (!$this->loadfile($parent)) {
$this->halt("subst: unable to load $parent.");
return false;
}
if ($name == "")
$name = $handle;
$str = $this->get_var($parent);
$reg = "/<!--\s+BEGIN $handle\s+-->(.*)\n\s*<!--\s+END $handle\s+-->/sm";
preg_match_all($reg, $str, $m);
$str = preg_replace($reg, "{" . "$name}", $str);
$this->set_var($handle, $m[1][0]);
$this->set_var($parent, $str);
}
/* public: set_var(array $values)
* values: array of variable name, value pairs.
*
* public: set_var(string $varname, string $value)
* varname: name of a variable that is to be defined
* value: value of that variable
*/
function set_var($varname, $value = "") {
if (!is_array($varname)) {
if (!empty($varname))
if ($this->debug) print "scalar: set *$varname* to *$value*<br>\n";
$this->varkeys[$varname] = "/".$this->varname($varname)."/";
$this->varvals[$varname] = $value;
} else {
reset($varname);
while(list($k, $v) = each($varname)) {
if (!empty($k))
if ($this->debug) print "array: set *$k* to *$v*<br>\n";
$this->varkeys[$k] = "/".$this->varname($k)."/";
$this->varvals[$k] = $v;
}
}
}
/* public: subst(string $handle)
* handle: handle of template where variables are to be substituted.
*/
function subst($handle) {
if (!$this->loadfile($handle)) {
$this->halt("subst: unable to load $handle.");
return false;
}
$str = $this->get_var($handle);
$str = @preg_replace($this->varkeys, $this->varvals, $str);
return $str;
}
/* public: psubst(string $handle)
* handle: handle of template where variables are to be substituted.
*/
function psubst($handle) {
print $this->subst($handle);
return false;
}
/* public: parse(string $target, string $handle, boolean append)
* public: parse(string $target, array $handle, boolean append)
* target: handle of variable to generate
* handle: handle of template to substitute
* append: append to target handle
*/
function parse($target, $handle, $append = false) {
if (!is_array($handle)) {
$str = $this->subst($handle);
if ($append) {
$this->set_var($target, $this->get_var($target) . $str);
} else {
$this->set_var($target, $str);
}
} else {
reset($handle);
while(list($i, $h) = each($handle)) {
$str = $this->subst($h);
$this->set_var($target, $str);
}
}
return $str;
}
function pparse($target, $handle, $append = false) {
print $this->parse($target, $handle, $append);
return false;
}
/* public: get_vars()
*/
function get_vars() {
reset($this->varkeys);
while(list($k, $v) = each($this->varkeys)) {
$result[$k] = $this->varvals[$k];
}
return $result;
}
/* public: get_var(string varname)
* varname: name of variable.
*
* public: get_var(array varname)
* varname: array of variable names
*/
function get_var($varname) {
if (!is_array($varname)) {
return $this->varvals[$varname];
} else {
reset($varname);
while(list($k, $v) = each($varname)) {
$result[$k] = $this->varvals[$k];
}
return $result;
}
}
/* public: get_undefined($handle)
* handle: handle of a template.
*/
function get_undefined($handle) {
if (!$this->loadfile($handle)) {
$this->halt("get_undefined: unable to load $handle.");
return false;
}
preg_match_all("/\{([^}]+)\}/", $this->get_var($handle), $m);
$m = $m[1];
if (!is_array($m))
return false;
reset($m);
while(list($k, $v) = each($m)) {
if (!isset($this->varkeys[$v]))
$result[$v] = $v;
}
if (count($result))
return $result;
else
return false;
}
/* public: finish(string $str)
* str: string to finish.
*/
function finish($str) {
switch ($this->unknowns) {
case "keep":
break;
case "remove":
$str = preg_replace('/{[^ \t\r\n}]+}/', "", $str);
break;
case "comment":
$str = preg_replace('/{([^ \t\r\n}]+)}/', "<!-- Template $handle: Variable \\1 undefined -->", $str);
break;
}
return $str;
}
/* public: p(string $varname)
* varname: name of variable to print.
*/
function p($varname) {
print $this->finish($this->get_var($varname));
}
function get($varname) {
return $this->finish($this->get_var($varname));
}
/***************************************************************************/
/* private: filename($filename)
* filename: name to be completed.
*/
function filename($filename) {
if (substr($filename, 0, 1) != "/") {
$filename = $this->root."/".$filename;
}
if (!file_exists($filename))
$this->halt("filename: file $filename does not exist.");
return $filename;
}
/* private: varname($varname)
* varname: name of a replacement variable to be protected.
*/
function varname($varname) {
return preg_quote("{".$varname."}");
}
/* private: loadfile(string $handle)
* handle: load file defined by handle, if it is not loaded yet.
*/
function loadfile($handle) {
if (isset($this->varkeys[$handle]) and !empty($this->varvals[$handle]))
return true;
if (!isset($this->file[$handle])) {
$this->halt("loadfile: $handle is not a valid handle.");
return false;
}
$filename = $this->file[$handle];
$str = implode("", @file($filename));
if (empty($str)) {
$this->halt("loadfile: While loading $handle, $filename does not exist or is empty.");
return false;
}
$this->set_var($handle, $str);
return true;
}
/***************************************************************************/
/* public: halt(string $msg)
* msg: error message to show.
*/
function halt($msg) {
$this->last_error = $msg;
if ($this->halt_on_error != "no")
$this->haltmsg($msg);
if ($this->halt_on_error == "yes")
die("<b>Halted.</b>");
return false;
}
/* public, override: haltmsg($msg)
* msg: error message to show.
*/
function haltmsg($msg) {
printf("<b>Template Error:</b> %s<br>\n", $msg);
}
}

198
setup/inc/functions.inc.php Normal file
View File

@ -0,0 +1,198 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
/* ######## Start security check ########## */
$d1 = strtolower(substr($phpgw_info['server']['api_inc'],0,3));
$d2 = strtolower(substr($phpgw_info['server']['server_root'],0,3));
$d3 = strtolower(substr($phpgw_info['server']['app_inc'],0,3));
if($d1 == 'htt' || $d1 == 'ftp' || $d2 == 'htt' || $d2 == 'ftp' || $d3 == 'htt' || $d3 == 'ftp')
{
echo 'Failed attempt to break in via an old Security Hole!<br>';
exit;
}
unset($d1);unset($d2);unset($d3);
/* ######## End security check ########## */
if(file_exists('../header.inc.php'))
{
include('../header.inc.php');
}
else
{
define('PHPGW_SERVER_ROOT','..');
define('PHPGW_INCLUDE_ROOT','..');
}
function CreateObject($classname, $constructor_param = "")
{
global $phpgw, $phpgw_info, $phpgw_domain;
$classpart = explode (".", $classname);
$appname = $classpart[0];
$classname = $classpart[1];
if (!$phpgw_info["flags"]["included_classes"][$classname])
{
$phpgw_info["flags"]["included_classes"][$classname] = True;
include(PHPGW_INCLUDE_ROOT."/".$appname."/inc/class.".$classname.".inc.php");
// include("/var/www/phpgroupware/".$appname."/inc/class.".$classname.".inc.php");
}
if ($constructor_param == "")
{
$obj = new $classname;
}
else
{
$obj = new $classname($constructor_param);
}
return $obj;
}
// This is needed is some parts of setup, until we include the API directly
function filesystem_separator()
{
if (PHP_OS == 'Windows' || PHP_OS == 'OS/2')
{
return '\\';
}
else
{
return '/';
}
}
define('SEP',filesystem_separator());
function get_account_id($account_id = '',$default_id = '')
{
global $phpgw, $phpgw_info;
if (gettype($account_id) == 'integer')
{
return $account_id;
}
elseif ($account_id == '')
{
if ($default_id == '')
{
return $phpgw_info['user']['account_id'];
}
elseif (gettype($default_id) == 'string')
{
return $phpgw->accounts->name2id($default_id);
}
return intval($default_id);
}
elseif (gettype($account_id) == 'string')
{
if($phpgw->accounts->exists(intval($account_id)) == True)
{
return intval($account_id);
}
else
{
return $phpgw->accounts->name2id($account_id);
}
}
}
/*!
@function lang
@abstract function to deal with multilanguage support
*/
function lang($key, $m1="", $m2="", $m3="", $m4="", $m5="", $m6="", $m7="", $m8="", $m9="", $m10="" )
{
global $phpgw_setup;
// # TODO: check if $m1 is of type array.
// If so, use it instead of $m2-$mN (Stephan)
$vars = array( $m1, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10 );
$value = $phpgw_setup->translate("$key", $vars );
return $value;
}
/*!
@function get_langs
@abstract returns array of languages we support, with enabled set
to True if the lang file exists
*/
function get_langs()
{
$f = fopen('./lang/languages','r');
while ($line = fgets($f,200))
{
list($x,$y) = split("\t",$line);
$languages[$x]['lang'] = trim($x);
$languages[$x]['descr'] = trim($y);
$languages[$x]['available'] = False;
}
fclose($f);
$d = dir('./lang');
while($entry=$d->read())
{
if (ereg("phpgw_",$entry))
{
$z = substr($entry,6,2);
$languages[$z]['available'] = True;
}
}
$d->close();
//print_r($languages);
return $languages;
}
function lang_select()
{
global $ConfigLang;
$select = '<select name="ConfigLang">' . "\n";
$languages = get_langs();
while (list($null,$data) = each($languages))
{
if ($data['available'])
{
$selected = '';
$short = substr($data['lang'],0,2);
if ($short == $ConfigLang)
{
$selected = ' selected';
}
$select .= '<option value="' . $data['lang'] . '"' . $selected . '>' . $data['descr'] . '</option>' . "\n";
}
}
$select .= '</select>' . "\n";
return $select;
}
// Include to check user authorization against the
// password in ../header.inc.php to protect all of the setup
// pages from unauthorized use.
if(file_exists(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'))
{
include(PHPGW_SERVER_ROOT.'/phpgwapi/setup/setup.inc.php'); // To set the current core version
// This will change to just use setup_info
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
}
else
{
$phpgw_info['server']['versions']['phpgwapi'] = 'Undetected';
}
$phpgw_info['server']['app_images'] = 'templates/default/images';
include('./inc/class.setup.inc.php');
$phpgw_setup = new phpgw_setup;
//include('./inc/class.schema_proc.inc.php');
//$phpgw_lang = CreateObject('setup.setup_lang',$lang);
?>

402
setup/index.php Normal file
View File

@ -0,0 +1,402 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
// Idea: This is so I don't forget. When they are preforming a new install, after config,
// forward them right to index.php. Create a session for them and have a nice little intro
// page explaining what to do from there (ie, create there own account)
$DEBUG = False;
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('./inc/functions.inc.php');
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_main' => 'setup_main.tpl',
'T_setup_db_blocks' => 'setup_db_blocks.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_1','V_db_stage_1');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_2','V_db_stage_2');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_3','V_db_stage_3');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_4','V_db_stage_4');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_5_pre','V_db_stage_5_pre');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_5_post','V_db_stage_5_post');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_10','V_db_stage_10');
$setup_tpl->set_block('T_setup_db_blocks','B_db_stage_default','V_db_stage_default');
// Check header and authentication
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
if ($phpgw_info['setup']['stage']['header'] != '10')
{
Header("Location: manageheader.php");
exit;
}
elseif (!$phpgw_setup->auth('Config'))
{
$phpgw_setup->show_header(lang('Please login'),True);
$phpgw_setup->login_form();
$phpgw_setup->show_footer();
exit;
}
// Database actions
$phpgw_setup->loaddb();
$setup_info = $phpgw_setup->get_versions();
$phpgw_info['setup']['stage']['db'] = $phpgw_setup->check_db();
if ($phpgw_info['setup']['stage']['db'] != 1)
{
$setup_info = $phpgw_setup->get_versions();
$setup_info = $phpgw_setup->get_db_versions($setup_info);
$phpgw_info['setup']['stage']['db'] = $phpgw_setup->check_db();
}
if ($DEBUG) { echo 'Stage: ' . $phpgw_info['setup']['stage']['db']; }
// begin DEBUG code
//$phpgw_info['setup']['stage']['db'] = 0;
//$action = 'Upgrade';
// end DEBUG code
switch($action)
{
case 'Create Database':
$subtitle = lang('Create Database');
$submsg = lang('At your request, this script is going to attempt to create the database and assign the db user rights to it');
$subaction = 'created';
$phpgw_info['setup']['currentver']['phpgwapi'] = 'dbcreate';
$phpgw_info['setup']['stage']['db'] = 5;
break;
case 'Uninstall all applications':
$subtitle = lang('Deleting Tables');
$submsg = lang('At your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data') . '.';
$subaction = 'uninstalled';
$phpgw_info['setup']['currentver']['phpgwapi'] = 'drop';
$phpgw_info['setup']['stage']['db'] = 5;
break;
case 'Upgrade':
$subtitle = lang('Upgrading Tables');
$submsg = lang('At your request, this script is going to attempt to upgrade your old applications to the current versions').'.';
$subaction = 'upgraded';
$phpgw_info['setup']['currentver']['phpgwapi'] = 'oldversion';
$phpgw_info['setup']['stage']['db'] = 5;
break;
case 'Install':
$subtitle = lang('Creating Tables');
$submsg = lang('At your request, this script is going to attempt to install all the applications for you').'.';
$subaction = 'installed';
$phpgw_info['setup']['currentver']['phpgwapi'] = 'new';
$phpgw_info['setup']['stage']['db'] = 5;
break;
}
$setup_tpl->set_var('subtitle',$subtitle);
$setup_tpl->set_var('submsg',$submsg);
$setup_tpl->set_var('subaction',lang($subaction));
// Old PHP
if (phpversion() < '3.0.16')
{
$phpgw_setup->show_header($phpgw_info['setup']['header_msg'],True);
$phpgw_setup->show_alert_msg('Error',
lang('You appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16'));
$phpgw_setup->show_footer();
exit;
}
// BEGIN setup page
//$phpgw_setup->app_status();
$phpgw_info['server']['app_images'] = 'templates/default/images';
$incomplete = $phpgw_info['server']['app_images'] . '/incomplete.gif';
$completed = $phpgw_info['server']['app_images'] . '/completed.gif';
$setup_tpl->set_var('img_incomplete',$incomplete);
$setup_tpl->set_var('img_completed',$completed);
$setup_tpl->set_var('db_step_text',lang('Step 1 - Simple Application Management'));
switch($phpgw_info['setup']['stage']['db'])
{
case 1:
$setup_tpl->set_var('dbnotexist',lang('Your Database is not working!'));
$setup_tpl->set_var('makesure',lang('makesure'));
$setup_tpl->set_var('notcomplete',lang('not complete'));
$setup_tpl->set_var('oncesetup',lang('Once the database is setup correctly'));
$setup_tpl->set_var('createdb',lang('Or we can attempt to create the database for you:'));
switch ($phpgw_domain[$ConfigDomain]["db_type"])
{
case 'mysql':
$setup_tpl->set_var('instr',lang('mysqlinstr'));
break;
case 'pgsql':
$setup_tpl->set_var('instr',lang('pgsqlinstr'));
break;
}
$setup_tpl->parse('V_db_stage_1','B_db_stage_1');
$db_filled_block = $setup_tpl->get_var('V_db_stage_1');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
case 2:
$setup_tpl->set_var('prebeta',lang('You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version.'));
$setup_tpl->set_var('notcomplete',lang('not complete'));
$setup_tpl->parse('V_db_stage_2','B_db_stage_2');
$db_filled_block = $setup_tpl->get_var('V_db_stage_2');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
case 3:
$setup_tpl->set_var('dbexists',lang('Your database is working, but you dont have any applications installed'));
$setup_tpl->set_var('install',lang('Install'));
$setup_tpl->set_var('proceed',lang('We can proceed'));
$setup_tpl->set_var('allapps',lang('all applications'));
$setup_tpl->parse('V_db_stage_3','B_db_stage_3');
$db_filled_block = $setup_tpl->get_var('V_db_stage_3');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
case 4:
$setup_tpl->set_var('oldver',lang('You appear to be running version x of phpGroupWare',$setup_info['phpgwapi']['currentver']));
$setup_tpl->set_var('automatic',lang('We will automatically update your tables/records to x',$setup_info['phpgwapi']['version']));
$setup_tpl->set_var('backupwarn',lang('backupwarn'));
$setup_tpl->set_var('upgrade',lang('Upgrade'));
$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
$setup_tpl->set_var('dont_touch_my_data',lang('Dont touch my data'));
$setup_tpl->set_var('dropwarn',lang('Your tables may be altered and you may lose data'));
$setup_tpl->parse('V_db_stage_4','B_db_stage_4');
$db_filled_block = $setup_tpl->get_var('V_db_stage_4');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
case 5:
$setup_tpl->set_var('status',lang('Status'));
$setup_tpl->set_var('notcomplete',lang('not complete'));
$setup_tpl->set_var('tblchange',lang('Table Change Messages'));
$setup_tpl->parse('V_db_stage_5_pre','B_db_stage_5_pre');
$db_filled_block = $setup_tpl->get_var('V_db_stage_5_pre');
// FIXME : CAPTURE THIS OUTPUT
$phpgw_setup->db->Halt_On_Error = 'report';
switch ($phpgw_info["setup"]["currentver"]["phpgwapi"])
{
case "dbcreate":
$phpgw_setup->db->create_database($db_root, $db_pass);
break;
case "drop":
$setup_info = $phpgw_setup->get_versions($setup_info);
$setup_info = $phpgw_setup->process_droptables($setup_info);
break;
case "new":
$setup_info = $phpgw_setup->process_pass($setup_info,'new',$DEBUG);
$included = True;
include('lang.php');
$phpgw_info["setup"]["currentver"]["phpgwapi"] = "oldversion";
break;
case "oldversion":
$setup_info = $phpgw_setup->process_pass($setup_info,'upgrade',$DEBUG);
$phpgw_info["setup"]["currentver"]["phpgwapi"] = "oldversion";
break;
}
$phpgw_setup->db->Halt_On_Error = 'no';
$setup_tpl->set_var('tableshave',lang('If you did not receive any errors, your applications have been'));
$setup_tpl->set_var('re-check_my_installation',lang('Re-Check My Installation'));
$setup_tpl->parse('V_db_stage_5_post','B_db_stage_5_post');
$db_filled_block = $db_filled_block . $setup_tpl->get_var('V_db_stage_5_post');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
case 10:
$setup_tpl->set_var('tablescurrent',lang('Your applications are current'));
$setup_tpl->set_var('uninstall_all_applications',lang('Uninstall all applications'));
$setup_tpl->set_var('insanity',lang('Insanity'));
$setup_tpl->set_var('dropwarn',lang('Your tables will be dropped and you will lose data'));
$setup_tpl->set_var('deletetables',lang('Uninstall all applications'));
$setup_tpl->parse('V_db_stage_10','B_db_stage_10');
$db_filled_block = $setup_tpl->get_var('V_db_stage_10');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
default:
$setup_tpl->set_var('dbnotexist',lang('Your database does not exist'));
$setup_tpl->parse('V_db_stage_default','B_db_stage_default');
$db_filled_block = $setup_tpl->get_var('V_db_stage_default');
$setup_tpl->set_var('V_db_filled_block',$db_filled_block);
break;
}
// Config Section
$setup_tpl->set_var('config_step_text',lang('Step 2 - Configuration'));
$phpgw_info["setup"]["stage"]["config"] = $phpgw_setup->check_config();
// begin DEBUG code
//$phpgw_info['setup']['stage']['config'] = 10;
// end DEBUG code
switch($phpgw_info['setup']['stage']['config'])
{
case 1:
$setup_tpl->set_var('config_status_img',$incomplete);
$setup_tpl->set_var('config_status_alt',lang('not completed'));
$btn_config_now = $phpgw_setup->make_frm_btn_simple(
lang('Please configure phpGroupWare for your environment'),
'POST','config.php',
'submit',lang('Configure Now'),
'');
$setup_tpl->set_var('config_table_data',$btn_config_now);
$setup_tpl->set_var('ldap_table_data','&nbsp;');
break;
case 10:
$setup_tpl->set_var('config_status_img',$completed);
$setup_tpl->set_var('config_status_alt',lang('completed'));
$btn_edit_config = $phpgw_setup->make_frm_btn_simple(
lang('Configuration completed'),
'POST','config.php',
'submit',lang('Edit Current Configuration'),
''
);
$phpgw_setup->db->query("select config_value FROM phpgw_config WHERE config_name='auth_type'");
$phpgw_setup->db->next_record();
if ($phpgw_setup->db->f(0) == 'ldap')
{
$phpgw_setup->db->query("select config_value FROM phpgw_config WHERE config_name='ldap_host'");
$phpgw_setup->db->next_record();
if ($phpgw_setup->db->f(0) != '')
{
$btn_config_ldap = $phpgw_setup->make_frm_btn_simple(
lang('LDAP account import/export'),
'POST','ldap.php',
'submit',lang('Configure Now'),
'');
$link_make_accts = '&nbsp';
}
else
{
$btn_config_ldap = '';
$link_make_accts = $phpgw_setup->make_href_link_simple(
'<br>',
'setup_demo.php',
lang('Click Here'),
lang('to setup 1 admin account and 3 demo accounts.<br><b>This will delete all existing accounts</b>')
);
}
}
else
{
$btn_config_ldap = '';
$link_make_accts = $phpgw_setup->make_href_link_simple(
'<br>',
'setup_demo.php',
lang('Click Here'),
lang('to setup 1 admin account and 3 demo accounts.<br><b>This will delete all existing accounts</b>')
);
}
$config_td = "$btn_edit_config" ."$link_make_accts";
$setup_tpl->set_var('config_table_data',$config_td);
$setup_tpl->set_var('ldap_table_data',$btn_config_ldap);
break;
default:
$setup_tpl->set_var('config_status_img',$incomplete);
$setup_tpl->set_var('config_status_alt',lang('not completed'));
$setup_tpl->set_var('config_table_data',lang('Not ready for this stage yet'));
$setup_tpl->set_var('ldap_table_data','&nbsp;');
break;
}
// Lang Section
$setup_tpl->set_var('lang_step_text',lang('Step 3 - Language Management'));
$phpgw_info['setup']['stage']['lang'] = $phpgw_setup->check_lang();
// begin DEBUG code
//$phpgw_info['setup']['stage']['lang'] = 0;
// end DEBUG code
switch($phpgw_info['setup']['stage']['lang'])
{
case 1:
$setup_tpl->set_var('lang_status_img',$incomplete);
$setup_tpl->set_var('lang_status_alt','not completed');
$btn_install_lang = $phpgw_setup->make_frm_btn_simple(
lang('You do not have any languages installed. Please install one now <br>'),
'POST','lang.php',
'submit',lang('Install Language'),
'');
$setup_tpl->set_var('lang_table_data',$btn_install_lang);
break;
case 10:
$langs_list = '';
reset ($phpgw_info['setup']['installed_langs']);
while (list ($key, $value) = each ($phpgw_info['setup']['installed_langs']))
{
if (!$notfirst)
{
$langs_list = $value;
}
else
{
$langs_list = $langs_list .', ' .$value;
}
$notfirst = True;
}
$setup_tpl->set_var('lang_status_img',$completed);
$setup_tpl->set_var('lang_status_alt','completed');
$btn_manage_lang = $phpgw_setup->make_frm_btn_simple(
lang('This stage is completed<br>'). lang('Currently installed languages: x <br>',$langs_list),
'POST','lang.php',
'submit',lang('Manage Languages'),
'');
$setup_tpl->set_var('lang_table_data',$btn_manage_lang);
break;
default:
$setup_tpl->set_var('lang_status_img',$incomplete);
$setup_tpl->set_var('lang_status_alt',lang('not completed'));
$setup_tpl->set_var('lang_table_data',lang('Not ready for this stage yet'));
break;
}
$setup_tpl->set_var('apps_step_text',lang('Step 4 - Advanced Application Management'));
// $phpgw_info['setup']['stage']['apps'] = $phpgw_setup->check_apps();
switch($phpgw_info['setup']['stage']['db'])
{
case 1:
case 10:
$setup_tpl->set_var('apps_status_img',$completed);
$setup_tpl->set_var('apps_status_alt',lang('completed'));
$btn_manage_apps = $phpgw_setup->make_frm_btn_simple(
lang('This stage is completed<br>'),
'','applications.php',
'submit',lang('Manage Applications'),
'');
$setup_tpl->set_var('apps_table_data',$btn_manage_apps);
break;
default:
$setup_tpl->set_var('apps_status_img',$incomplete);
$setup_tpl->set_var('apps_status_alt',lang('not completed'));
$setup_tpl->set_var('apps_table_data',lang('Not ready for this stage yet'));
break;
}
$phpgw_setup->show_header($phpgw_info['setup']['header_msg'],False,"config",$ConfigDomain . '(' . $phpgw_domain[$ConfigDomain]["db_type"] . ')');
$setup_tpl->pparse('out','T_setup_main');
$phpgw_setup->show_footer();
?>

14
setup/lang/README Normal file
View File

@ -0,0 +1,14 @@
Files in this dir are for setup only. Please see each app/setup dir
for app-specific and phpgwap/setup for global langs.
These files MUST be tab-delimited:
phrase{TAB}application{TAB}langcode{TAB}Output Phrase
e.g.
hello common en Hello
The languages file is a list of the languages we would support.
This is loaded and a dir listing is done to see what is then
available. The results are shown in the login page.

15
setup/lang/languages Normal file
View File

@ -0,0 +1,15 @@
en English
de Deutsch
es Español
fr Français
it Italiano
ja Japanese
ko Korean
cs Chinese
zt Chinese(Taiwan)
br ...
hu ...
da ...
nl ...
no ...
sv ...

144
setup/lang/phpgw_de.lang Normal file
View File

@ -0,0 +1,144 @@
actions setup de Aktionen
admin first name setup de Admin Vorname
admin last name setup de Admin Nachname
admin password setup de Admin Passwort
admin username setup de Admin Username
all applications setup de Alle Applikationen
app details setup de App Details
app install/remove/upgrade setup de Applikation installierenn/entfernen/aktualisieren
application data setup de Applikations Daten
application management setup de Applikation Management
application name and status setup de Applikation Name und Status
application name and status information setup de Applikation Name und Status Information
application title setup de Applikation Titel
at your request, this script is going to attempt to create the database and assign the db user rights to it setup de Auf Ihre Anforderung hin wird dieses Script nun versuchen, die Datendank zu erstellen und die Benutzerrechte zuzuordnen
at your request, this script is going to attempt to install all the applications for you setup de Auf Ihre Anforderung hin wird dieses Script nun versuchen, alle Applikationen f&uuml;r Sie zu installieren
at your request, this script is going to attempt to upgrade your old applications to the current versions setup de Auf Ihre Anforderung wird dieses Script versuchen, Ihre Applikationen auf die gegenw&auml;rtige Version zu aktualisieren
at your request, this script is going to attempt to upgrade your old tables to the new format setup de Auf Ihre Anforderung wird dieses Script versuchen, Ihre Tabellen auf das neue Format zu aktualisieren
at your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format setup de auf Ihre Anforderung wird dieses Script die &uuml;ble Aktion auf sich nehmen, Ihre existierenden Tabellen zu l&ouml;schen und sie im neuen Format wieder herzustellen !
at your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data setup de Auf Ihre Anforderung wird dieses Script die &uuml;ble Aktion auf sich nehmen, alle Ihre Applikationen zu deinstallieren, was ebenfalls Ihre existierenden Tabellen und Daten l&ouml;schen wird !
available version setup de Verf&uuml;gbare Version
backupwarn setup de Aber wir <u>raten Ihnen dringend, eine Sicherungskopie</u> anzulegen f&uuml;r den Fall, da&szlig; dieses Script Ihre bestehenden Daten besch&auml;digt !<br><strong>Diese automatisierten Scripts k&ouml;nnen leicht Ihre Daten besch&auml;digen !.</strong><br><em>Bitte legen Sie ein Sicherungskopie an, befor Sie weiters unternehmen !</em>
because it depends upon setup de weil es abh&auml;ngt von
because it is not a user application, or access is controlled via acl setup de weil es keine Benutzer-Applikation ist, oder der Zugriff &uuml;ber ACL kontrolliert wird
because it requires manual table installation, <br>or the table definition was incorrect setup de weil es manuelle Installation der Tabelle erfordert, <br>oder die Tabellen-definition war nicht korrekt
because of a failed upgrade or install setup de weil eine Aktualisierung oder eine Installation fehlgeschlug
because of a failed upgrade, or the database is newer than the installed version of this app setup de weil eine Aktualisierung fehlschlug, oder die Datenbank ist neuer als die installierte Version dieser Applikation
because the enable flag for this app is set to 0, or is undefined setup de weil der verf&uuml;gbar-Eintrag f&uuml;r diese Applikation auf 0 gesetzt oder undefiniert ist
cancel setup de Abbrechen
charset setup de ISO-8859-1
click here setup de Hier clicken
configuration completed setup de Konfiguration abgeschlossen
configuration setup de Konfiguration
configure now setup de Jetzt konfigurieren
create one now setup de Jetzt erstellen
create setup de erstellen
creating tables setup de erstelle Tabellen
currently installed languages: x <br> setup de Gegenw&auml;rtig installierte Sprachen: %1 <br>
current version setup de Gegenw&auml;rtige Version
delete all my tables and data setup de Alle meine Tabellen und Daten l&ouml;schen
delete all old languages and install new ones setup de Alle installierten Sprachen l&ouml;schen und neu installieren
deleting tables setup de l&ouml;sche Tabellen
demo server setup setup de Demo Server Setup
deregistered setup de nicht registriert
details for admin account setup de Details des Admin Accounts
domain setup de Domain
edit current configuration setup de Gegenw&auml;rtige Konfiguration &uuml;berarbeiten
export sql users to ldap setup de SQL-Benutzer in LDAP exportieren
for a new install, select import. to convert existing sql accounts to ldap, select export setup de F&uuml;r eine Neuinstallation, w&auml;hlen sie importieren. Um existierende SQL-Accounts zu LDAP zu konvertieren, w&auml;hlen Sie exportieren.
go back setup de Zur&uuml;ck gehen
has a version mismatch setup de hat eine falsche Versionsanpassung
hooks deregistered setup de Haken nicht mehr aktiv
hooks registered setup de Haken registriert
however, the application is otherwise installed setup de Wie auch immer, die Applikation ist ansonsten installiert
if the application has no defined tables, selecting upgrade should remedy the problem setup de Wenn die Applikation keine definierten Tabellen hat, w&auml;hlen Sie &uuml;berarbeiten. Das Problem sollte damit behoben werden.
if you did not receive any errors, your applications have been setup de Wenn Sie keine Fehlermeldungen erhalten, wurden Ihre Applikationen
if you did not receive any errors, your tables have been setup de Wenn sie keine Fehlermeldungen erhalten, wurden Ihre Tabellen
import ldap users/groups setup de LDAP Benutzer/Gruppen importieren
insanity setup de Irrsinn
install Applications setup de Applikationen installieren
install language setup de Sprachen installieren
install setup de Installieren
is broken setup de ist kaputt
is disabled setup de ist nicht aktiv
ldap account import/export setup de LDAP Account importieren/exportieren
ldap export users setup de LDAP-Benutzer exportieren
ldap import users setup de LDAP-Benutzer importieren
logout setup de Logout
makesure setup de Stellen Sie sicher, da&szlig; Ihre Datenbank erstellt und die Benutzerrechte gesetzt wurden
manage applications setup de Applikationen verwalten
manage languages setup de Sprachen verwalten
multi-language support setup setup de Mehr-Sprachen Unterst&uuml;tzung einrichten
mysqlinstr setup de Hinweise zum erstellen der Datenbank in MySQL:<br>Login zu mysql -<br><i>[user@server user]# mysql -u root -p</i><br>Erstellen Sie die leere Datenbank und bewilligen Sie Benutzer Erlaubnis -<br><i>mysql&gt; create database phpgroupware;</i><br><i>mysql&gt; grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i>
not complete setup de nicht komplett
note: you will be able to customize this later setup de Notiz: Sie k&ouml;nnen dies sp&auml;ter anpassen
not ready for this stage yet setup de Noch nicht fertig f&uuml;r diesen Schritt
ok setup de OK
once the database is setup correctly setup de Wenn die Datenbank einmal korrekt eingerichtet ist
only add languages that are not in the database already setup de Nur Sprachen hinzuf&uuml;gen, die noch nicht in der Datenbank sind
only add new phrases setup de Nur neue Begriffe hinzuf&uuml;gen
passwords did not match, please re-enter setup de Passworte stimmten nicht &uuml;berein, bitte nocheinmal eingeben
pgsqlinstr setup de Hinweise zum erstellen der Datenbank in PostgreSQL:<br>Starten des postmaster<br><i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>Erstellen Sie die leere Datenbank -<br><i>[user@server user]# createdb phpgroupware</i>
please check for sql scripts within the application's directory setup de Bitte schauen Sie nach sql-Scripten im Applikations-Ordner
please configure phpGroupWare for your environment setup de Bitte konfigurieren Sie phpGroupWare f&uuml;r Ihre Umgebung
please install setup de Bitte installieren
possible solutions setup de M&ouml;gliche L&ouml;sungen
potential problem setup de Potentielles Problem
problem resolution setup de Problem L&ouml;sung
process setup de Prozess
re-enter password setup de Passworteingabe wiederholen
registered setup de registriert
remove setup de Entfernen
requires reinstall or manual repair setup de Erfordert Neuinstallation oder manuelle Reparatur
requires upgrade setup de Erfordert Aktualisierung
resolve setup de L&ouml;sen
select the default applications to which your users will have access setup de W&auml;hlen Sie die voreingestellten Applikationen, zu denen Ihre Benutzer Zugriff haben werden
select the desired action(s) from the available choices setup de W&auml;hlen Sie die verlangten Aktion(en) aus der verf&uuml;gbaren Auswahl
select which group(s) will be exported (group membership will be maintained) setup de W&auml;hlen Sie die zu exportierende(n) Gruppe(n) (Gruppenmitgliedschaft wird erhalten)
select which group(s) will be imported (group membership will be maintained) setup de W&auml;hlen Sie die zu importierende(n) Gruppe(n) (Gruppenmitgliedschaft wird erhalten)
select which languages you would like to use setup de W&auml;hlen Sie die Sprachen, die Sie benutzen m&ouml;chten
select which method of upgrade you would like to do setup de W&auml;hlen Sie die Methode der Aktualisierung, die Sie durchf&uuml;hren m&ouml;chten
select which user(s) will be exported setup de W&auml;hlen Sie den/die zu exportierenden Benutzer
select which user(s) will be imported setup de W&auml;hlen Sie den/die zu importierenden Benutzer
select which user(s) will have admin privileges setup de W&auml;hlen Sie den/die Benutzer, der/die Administrationsrechte hat/haben
select your old version setup de W&auml;hlen Sie Ihre alte Version
setup setup de Einrichtung
some or all of its tables are missing setup de Einige oder alle Tabellen fehlen
status setup de Status
step 1 - simple application management setup de Schritt 1 - Einfache Applikations Verwaltung
step 2 - configuration setup de Schritt 2 - Konfiguration
step 3 - language management setup de Schritt 3 - Sprach Verwaltung
step 4 - advanced application management setup de Step 4 - Erweiterte Applikations Verwaltung
submit setup de erm&ouml;glichen
table change messages setup de Tabellen &Auml;nderungs Meldungen
tables dropped setup de Tabellen wurden gel&ouml;scht
tables installed, unless there are errors printed above setup de Tabellen wurden installiert, au&szlig; oben sind Fehlermelungen zu sehen
tables upgraded setup de Tabellen wurden aktualisiert
target version setup de Ziel Version
there was a problem tring to connect to your ldap server. <br>please check your LDAP server configuration setup de Es gab ein Problem bei dem Versuch, eine Verbindung mit Ihrem LDAP Server aufzubauen. <br>Bitte &uuml;berpr&uuml;fen Sie die Konfiguration Ihres LDAP Servers.
the tables setup de die Tabellen
this program will help you upgrade or install different languages for phpGroupWare setup en Dieses Programm wird Ihnen bei der Aktualisierung oder Installation verschiedender Sprachen f&uuml;r phpGroupWare behilflich sein
this section will help you export users and groups from phpgroupWare's account tables into your ldap tree setup de Dieser Abschnitt wird Ihnen beim exportieren von Benutzern/Gruppen aus phpGroupWare's Account Tabellen in Ihren LDAP Baum behilflich sein
this section will help you import users and groups from your ldap tree into phpGroupWare's account tables setup de Dieser Abschnitt wird Ihnen beim importieren von Benutzern/Gruppen aus Ihrem LDAP Baum in phpGroupWare's Account Tabellen behilflich sein
this stage is completed<br> setup de Dieser Schritt ist abgeschlossen<br>
this will create 1 admin account and 3 demo accounts<br>the username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br> setup de Dies wird 1 Admin- und 3 Demo Benutzerkonten erstellen<br>Die Benutzernamen/Passworte sind: demo/guest, demo2/guest and demo3/guest.<br><b>!!!DIES WIRD ALLE EXISTIERENDEN BENUTZERKONTEN L&Ouml;SCHEN!!!</b><br>
Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink> setup de W&auml;hlen Sie eine Applikation, geben Sie eine Zielversion ein, dann best&auml;tigen Sie den Vorgang.<br>Wenn Sie keine Version angeben, werden nur die Basis-Tabellen der Applikation installiert werden.<br><blink>DIES WIRD ZUERST ALLE TABELLEN DER APPLIKATION L&Ouml;SCHEN!!!</blink>
to setup 1 admin account and 3 demo accounts.<br><b>this will delete all existing accounts</b> setup de zum einrichten von 1 Admin- und 3 Demo-Benutzerkonten.<br><b>Dies wird alle existierenden Benutzerkonten l&ouml;schen!</b>
upgraded setup de Aktualisiert
upgrade setup de Aktualisieren
upgrading tables setup de aktualisiere Tabellen
version mismatch setup de Falsche Versionsanpassung
we will automatically update your tables/records to x setup de Wir werden Ihre Tabellen/Eintr&auml;ge automatisch zu %1 aktualisieren
you appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16 setup de Es sieht so aus als ob Sie eine alte PHP-Version benutzen<br>Es ist notwendig auf eine neue Version zu aktualisieren.<br>&Auml;ltere PHP-Versionen k&ouml;nnten phpGroupWare nicht korrekt laufen lassen, wenn &uuml;berhaupt. <br><br>Biite aktualisieren Sie auf mindestens Version 3.0.16
You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version. setup de Es sieht so aus, als ob Sie eine vor-beta Version von phpGroupWare benutzen.<br>Diese Versionen werden nicht l&auml;nger unterst&uuml;tzt, und es gibt keinen Aktualisierungs-Pfad f&uuml;r sie im Einrichtung-Programm.<br>Sie m&ouml;chten vieleicht erst auf 0.9.10 (die letzte Version mit vor-beta Unterst&uuml;tzung) aktualisieren<br>und danach auf die aktuelle Version.
you appear to be running version x of phpGroupWare setup de Es sieht so aus als benutzen Sie Version %1 von phpGroupWare
you are ready for this stage, but this stage is not yet written.<br> setup de Sie sind bereit f&uuml;r diesen Schritt, aber dieser Abschnitt wurde noch nicht geschrieben.<br>
you do not have any languages installed. please install one now <br> setup de sie installierten noch keine Sprache. bitte installieren Sie nun eine. <br>
you must enter a username for the admin setup de sie m&uuml;ssen einen Benutzernamen f&uuml;r den Admin eingeben !
your applications are current setup de Ihre Applikationen sind aktuell
your database does not exist setup de Ihre Datenbank existiert nicht !
your database is working, but you dont have any applications installed setup de Ihre Datenbank arbeitet, aber Sie haben keine Applikationen installiert !
your tables are current setup de Ihre Tabellen sind aktuell
your tables may be altered and you may lose data setup de Ihre Tabellen k&ouml;nnten ver&auml;ndert werden, und Sie k&ouml;nnten Daten verlieren !
your tables will be dropped and you will lose data setup de Ihre Tabellen werden gel&ouml;scht werden, und Sie werden Daten verlieren !
you should either uninstall and then reinstall it, or attempt manual repairs setup de Sie sollten entweder de- und neuinstallieren, oder manuelle Reparaturen versuchen

157
setup/lang/phpgw_en.lang Normal file
View File

@ -0,0 +1,157 @@
<br><center>Import has been completed! Click <a href="index.php">here</a> to return to setup </center> setup en <br><center>Import has been completed! Click <a href="index.php">here</a> to return to setup </center>
actions setup en Actions
admin first name setup en Admin first name
admin last name setup en Admin last name
admin password setup en Admin password
admin username setup en Admin username
all applications setup en all applications
app details setup en App details
app install/remove/upgrade setup en App install/remove/upgrade
application data setup en Application Data
application management setup en Application Management
application name and status setup en Application Name and Status
application name and status information setup en Application Name and Status Information
application title setup en Application Title
at your request, this script is going to attempt to create the database and assign the db user rights to it setup en At your request, this script is going to attempt to create the database and assign the db user rights to it
at your request, this script is going to attempt to install all the applications for you setup en At your request, this script is going to attempt to install all the applications for you
at your request, this script is going to attempt to upgrade your old applications to the current versions setup en At your request, this script is going to attempt to upgrade your old applications to the current versions
at your request, this script is going to attempt to upgrade your old tables to the new format setup en At your request, this script is going to attempt to upgrade your old tables to the new format
at your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format setup en At your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format
at your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data setup en At your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data
available version setup en Available Version
backupwarn setup en but we <u>highly recommend backing up</u> your tables in case the script causes damage to your data.<br><strong>These automated scripts can easily destroy your data.</strong><br><em>Please backup before going any further!</em>
because it depends upon setup en because it depends upon
because it is not a user application, or access is controlled via acl setup en because it is not a user application, or access is controlled via acl
because it requires manual table installation, <br>or the table definition was incorrect setup en because it requires manual table installation, <br>or the table definition was incorrect
because it was manually disabled setup en because it was manually disabled
because of a failed upgrade or install setup en because of a failed upgrade or install
because of a failed upgrade, or the database is newer than the installed version of this app setup en because of a failed upgrade, or the database is newer than the installed version of this app
because the enable flag for this app is set to 0, or is undefined setup en because the enable flag for this app is set to 0, or is undefined
cancel setup en Cancel
charset setup en ISO-8859-1
click here setup en Click Here
configuration completed setup en Configuration completed
configuration setup en Configuration
configure now setup en Configure Now
create database setup en Create Database
create one now setup en Create one now
create setup en Create
creating tables setup en Creating Tables
currently installed languages: x <br> setup en Currently installed languages: %1 <br>
current version setup en Current Version
db root password setup en DB root password
db root username setup en DB root username
delete all my tables and data setup en Delete all my tables and data
delete all old languages and install new ones setup en Delete all old languages and install new ones
deleting tables setup en Deleting Tables
demo server setup setup en Demo Server Setup
deregistered setup en deregistered
details for admin account setup en Details for Admin account
domain setup en Domain
dont touch my data setup en Dont touch my data
edit current configuration setup en Edit Current Configuration
export sql users to ldap setup en Export SQL users to LDAP
for a new install, select import. to convert existing sql accounts to ldap, select export setup en For a new install, select import. To convert existing SQL accounts to LDAP, select export
go back setup en Go back
has a version mismatch setup en has a version mismatch
hooks deregistered setup en hooks deregistered
hooks registered setup en hooks registered
however, the application is otherwise installed setup en However, the application is otherwise installed
if the application has no defined tables, selecting upgrade should remedy the problem setup en If the application has no defined tables, selecting upgrade should remedy the problem
if you did not receive any errors, your applications have been setup en If you did not receive any errors, your applications have been
if you did not receive any errors, your tables have been setup en If you did not receive any errors, your tables have been
import ldap users/groups setup en Import LDAP users/groups
insanity setup en Insanity
install Applications setup en Install Applications
install language setup en Install Language
install setup en Install
installed setup en installed
is broken setup en is broken
is disabled setup en is disabled
ldap account import/export setup en LDAP account import/export
ldap export users setup en LDAP export users
ldap import users setup en LDAP import users
logout setup en Logout
makesure setup en Make sure that your database is created and the account permissions are set
manage applications setup en Manage Applications
manage languages setup en Manage Languages
multi-language support setup setup en Multi-Language support setup
mysqlinstr setup en Instructions for creating the database in MySQL:<br>Login to mysql -<br><i>[user@server user]# mysql -u root -p</i><br>Create the empty database and grant user permissions -<br><i>mysql> create database phpgroupware;</i><br><i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i>
not complete setup en not complete
note: you will be able to customize this later setup en Note: You will be able to customize this later
not ready for this stage yet setup en Not ready for this stage yet
ok setup en OK
once the database is setup correctly setup en Once the database is setup correctly
only add languages that are not in the database already setup en Only add languages that are not in the database already
only add new phrases setup en Only add new phrases
passwords did not match, please re-enter setup en Passwords did not match, please re-enter
pgsqlinstr setup en Instructions for creating the database in PostgreSQL:<br>Start the postmaster<br><i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>Create the empty database -<br><i>[user@server user]# createdb phpgroupware</i>
please check for sql scripts within the application's directory setup en Please check for sql scripts within the application's directory
please configure phpGroupWare for your environment setup en Please configure phpGroupWare for your environment
please install setup en Please install
please login to phpgroupware and run the admin application for additional site configuration setup en Please login to phpgroupware and run the admin application for additional site configuration
possible solutions setup en Possible Solutions
potential problem setup en Potential Problem
problem resolution setup en Problem resolution
process setup en Process
re-check my database setup en Re-Check my database
re-check my installation setup en Re-Check My Installation
re-enter password setup en Re-enter password
registered setup en registered
remove setup en Remove
requires reinstall or manual repair setup en Requires reinstall or manual repair
requires upgrade setup en Requires upgrade
resolve setup en Resolve
select the default applications to which your users will have access setup en Select the default applications to which your users will have access
select the desired action(s) from the available choices setup en Select the desired action(s) from the available choices
select which group(s) will be exported (group membership will be maintained) setup en Select which group(s) will be exported (group membership will be maintained)
select which group(s) will be imported (group membership will be maintained) setup en Select which group(s) will be imported (group membership will be maintained)
select which languages you would like to use setup en Select which languages you would like to use
select which method of upgrade you would like to do setup en Select which method of upgrade you would like to do
select which user(s) will be exported setup en Select which user(s) will be exported
select which user(s) will be imported setup en Select which user(s) will be imported
select which user(s) will have admin privileges setup en Select which user(s) will have admin privileges
select your old version setup en Select your old version
setup setup en Setup
some or all of its tables are missing setup en Some or all of its tables are missing
status setup en Status
step 1 - simple application management setup en Step 1 - Simple Application Management
step 2 - configuration setup en Step 2 - Configuration
step 3 - language management setup en Step 3 - Language Management
step 4 - advanced application management setup en Step 4 - Advanced Application Management
submit setup en Submit
table change messages setup en Table Change Messages
tables dropped setup en tables dropped
tables installed, unless there are errors printed above setup en tables installed, unless there are errors printed above
tables upgraded setup en tables upgraded
target version setup en Target Version
there was a problem tring to connect to your ldap server. <br>please check your LDAP server configuration setup en There was a problem tring to connect to your LDAP server. <br>please check your LDAP server configuration
the tables setup en the tables
the table definition was correct, and the tables were installed setup en The table definition was correct, and the tables were installed
this program will help you upgrade or install different languages for phpGroupWare setup en This program will help you upgrade or install different languages for phpGroupWare
this section will help you export users and groups from phpgroupWare's account tables into your ldap tree setup en This section will help you export users and groups from phpGroupWare's account tables into your LDAP tree
this section will help you import users and groups from your ldap tree into phpGroupWare's account tables setup en This section will help you import users and groups from your LDAP tree into phpGroupWare's account tables
this stage is completed<br> setup en This stage is completed<br>
this will create 1 admin account and 3 demo accounts<br>the username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br> setup en This will create 1 admin account and 3 demo accounts<br>The username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br>
Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink> setup en Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>
to setup 1 admin account and 3 demo accounts.<br><b>this will delete all existing accounts</b> setup en to setup 1 admin account and 3 demo accounts.<br><b>This will delete all existing accounts</b>
uninstall all applications setup en Uninstall all applications
uninstalled setup en uninstalled
upgraded setup en upgraded
upgrade setup en Upgrade
upgrading tables setup en Upgrading Tables
version mismatch setup en Version Mismatch
we will automatically update your tables/records to x setup en We will automatically update your tables/records to %1
you appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16 setup en You appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16
You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version. setup en You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version.
you appear to be running version x of phpGroupWare setup en You appear to be running version %1 of phpGroupWare
you are ready for this stage, but this stage is not yet written.<br> setup en You are ready for this stage, but this stage is not yet written.<br>
you do not have any languages installed. please install one now <br> setup en You do not have any languages installed. Please install one now <br>
you must enter a username for the admin setup en You must enter a username for the admin
your applications are current setup en Your applications are current
your database does not exist setup en Your database does not exist
your database is working, but you dont have any applications installed setup en Your database is working, but you dont have any applications installed
your tables are current setup en Your tables are current
your tables may be altered and you may lose data setup en Your tables may be altered and you may lose data
your tables will be dropped and you will lose data setup en Your tables will be dropped and you will lose data
you should either uninstall and then reinstall it, or attempt manual repairs setup en You should either uninstall and then reinstall it, or attempt manual repairs

147
setup/lang/phpgw_es.lang Normal file
View File

@ -0,0 +1,147 @@
actions setup es Acciones
admin first name setup es Nombre del Administrador
admin last name setup es Apellido del Administrador
admin password setup es Contraseña del Administrador
admin username setup es Nombre de usuario del Administrador
all applications setup es Todas las aplicaciones
app details setup es Detalles de la Apliación
app install/remove/upgrade setup es Instalación/Eliminación/Actualización de la Aplicación
application data setup es Datos de la Aplicación
application management setup es Administración de Aplicaciones
application name and status information setup es Nombre de la aplicación e Información de estado
application name and status setup es Nombre de la Aplicación y estado
application title setup es Título de la Aplicación
at your request, this script is going to attempt to create the database and assign the db user rights to it setup es Por petición suya, este guión intentará crear la base de datos y asignar permisos al usuario de la base de datos para ella
at your request, this script is going to attempt to install all the applications for you setup es Por petición suya, este guión intentará instalar todas las aplicaciones por usted
at your request, this script is going to attempt to upgrade your old applications to the current versions setup es Por petición suya, este guión intentará actualizar sus antigüas apliaciones a las versiones actuales
at your request, this script is going to attempt to upgrade your old tables to the new format setup es A petición suya, este guión intentará actualizar sus viejas tablas al nuevo formato
at your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format setup es A petición suya, este guión ejecutara la "demoniaca" acción de eliminar sus tablas actuales y volverlas a crear en el nuevo formato
at your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data setup es A petición suya, este guión ejecutará la "demoniaca" acción de desinstalar todas sus aplicaciones, lo que eliminará todas sus tablas y datos actuales
available version setup es Version Disponible
backupwarn setup es pero le <u>recomendamos encarecidamente que haga copia de seguridad</u> de sus tablas en caso de que el guión cause daños a su información.<br><strong>Estos guiones automáticos pueden facilmente destruir su información.</strong><br><em>¡Por favor haga copia de seguridad de su información antes de continuar!</em>
because it depends upon setup es porque depende de
because it is not a user application, or access is controlled via acl setup es porque no es una aplicación de usuario, o el acceso a la misma no es controlado via ACL
because it requires manual table installation, <br>or the table definition was incorrect setup es porque requiere de instalación manual de las tablas,<br> o la definición de las misma fué incorrecta
because of a failed upgrade or install setup es porque ocurrió un fallo al actualizar o instalar
because of a failed upgrade, or the database is newer than the installed version of this app setup es porque falló la actualización, o la base de datos es mas reciente que la versión instalada de esta aplicación
because the enable flag for this app is set to 0, or is undefined setup es porque el indicador de "habilitada" de esta aplicación está a 0, o no está definido
cancel setup es Cancelar
charset setup es ISO-8859-1
click here setup es Pulse aquí
configuration completed setup es Configuración completada
configuration setup es Configuración
configure now setup es Configure Ahora
create one now setup es Cree una ahora
create setup es Crear
creating tables setup es Creando Tablas
currently installed languages: x <br> setup es Idiomas actualmente instalados: %1 <br>
current version setup es Version Actual
delete all my tables and data setup es Elimine todas mis tablas e información
delete all old languages and install new ones setup es Elimine todos los idiomas antigüos e instale los nuevos
deleting tables setup es Eliminando Tablas
demo server setup setup es Configuración de Servidor de Demostración
deregistered setup es desregistrada
details for admin account setup es Detalles para la cuenta de Administrador
domain setup es Dominio
edit current configuration setup es Editar Configuración Actual
export sql users to ldap setup es Exportar usuarios SQL a LDAP
for a new install, select import. to convert existing sql accounts to ldap, select export setup es Para una instalación nueva, seleccione importar. Para convertir las cuentas SQL existentes a LDAP, seleccione exportar
go back setup es Ir Atrás
has a version mismatch setup es No coinciden las versiones
hooks deregistered setup es hooks deregistradas
hooks registered setup es hooks registradas
however, the application is otherwise installed setup es De todas formas, la aplicación fué instalada
if the application has no defined tables, selecting upgrade should remedy the problem setup es Si la aplicación no ha definido tablas, seleccionando actualizar debería de remediar el problemas
if you did not receive any errors, your applications have been setup es Si no ha recibido ningún eror, sus aplicaciones han sido
if you did not receive any errors, your tables have been setup es Si no ha recibido ningún error, sus tablas han sido
import ldap users/groups setup es Importar usuarios/grupos LDAP
insanity setup es Insanity
install Applications setup es Instalar Aplicaciones
install language setup es Instalar Idiomas
install setup es Instalar
is broken setup es esta roto
is disabled setup es esta desabilitado
ldap account import/export setup es Importación/Exportación de cuentas LDAP
ldap export users setup es Exportar usuarios LDAP
ldap import users setup es Importar usuarios LDAP
logout setup es Salir
makesure setup es Asegurese que su base de datos está creada y que los permisos está configurados
manage applications setup es Administrar Aplicaciones
manage languages setup es Administrar Idiomas
multi-language support setup setup es Configuración del soporte Multi-Idioma
mysqlinstr setup es Instrucciones para crear la base de datos en MySQL:<br>Autentifiquese en mysql -<br><i>[usuario@servidor usuario]# mysql -u root -p</i><br>Cree la base de datos vacia y conceda permisos al usuario -<br><i>mysql> create database phpgroupware;</i><br><i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i>
not complete setup es no completado
note: you will be able to customize this later setup es Nota: Usted tendrá que personalizar esto luego
not ready for this stage yet setup es No está listo para esta fase todabía
ok setup es OK
once the database is setup correctly setup es Una vez que la base de datos esté configurada correctamente
only add languages that are not in the database already setup es Sólo añade los nuevos idiomas que no están ya en la base de datos
only add new phrases setup es Sólo añade las nuevas frases
passwords did not match, please re-enter setup es Las contreñas no coinciden, por favor vuelvalas a introducir
pgsqlinstr setup es Instrucciones para cræar la base de datos en PostgreSQL:<br>Inicie el postmaster<br><i>[usuario@servidor usuario]# postmaster -i -D /home/[usuario]/[dataDir]</i><br>Crear la base de datos vacia -<br><i>[usuario@servidor usuario]# createdb phpgroupware</i>
please check for sql scripts within the application's directory setup es Por favor comprueve los guiones sql en el directorio de la aplicación
please configure phpGroupWare for your environment setup es Por favor configure phpGroupware para su entorno
please install setup es Por favor Instale
possible solutions setup es Posibles Soluciones
potential problem setup es Problema Potencial
problem resolution setup es Resolución del problema
process setup es Procesar
re-enter password setup es Reintroduzca la contraseña
registered setup es registrado
remove setup es Eliminar
requires reinstall or manual repair setup es Requiere reinstalación o reparación manual
requires upgrade setup es Requiere actualización
resolve setup es Resolver
Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink> setup es Seleccione una aplicación, elija una versión objetivo, luego elija "Enviar" para realizar el proceso de actualización hasta dicha versión.<br>Si no selecciona una versión, solo la tablas de la versión base será instaladas.<br><blink>¡ESTO ELIMINARÁ TODAS LAS TABLAS DE LAS APLICACIONES PRIMERO!</blink>
select the default applications to which your users will have access setup es Selecciones las aplicaciones a las que sus usuarios tendrán acceso por defecto
select the desired action(s) from the available choices setup es Seleccione las accion(es) deseadas de la lista de opciones disponibles
select which group(s) will be exported (group membership will be maintained) setup es Seleccione que grupo(s) serán exportados (los componentes de un grupo serán mantenidos)
select which languages you would like to use setup es Seleccione que idiomas prefiere usted usar
select which method of upgrade you would like to do setup es Seleccione que método de actualización prefiere utilizar usted
select which user(s) will be exported setup es Seleccione que usuario(s) serán exportados
select which user(s) will be imported setup es Seleccione que usuario(s) serán importados
select which user(s) will have admin privileges setup es Seleccione que usuario(s) tendrán privilegios de administrador
select your old version setup es Seleccione su versión antigüa
setup setup es Configuración
some or all of its tables are missing setup es Algunas o todas de sus tablas no se encuentran
status setup es Estado
step 1 - simple application management setup es Paso 1 - Administración Simple de Aplicaciones
step 2 - configuration setup es Paso 2 - Configuración
step 3 - language management setup es Paso 3 - Administración de Idiomas
step 4 - advanced application management setup es Paso 4 - Administración Avanzada de Aplicaciones
submit setup es Enviar
table change messages setup es Mensages de Cambios en las Tablas
tables dropped setup es tablas eliminadas
tables installed, unless there are errors printed above setup es tablas instaladas, a no ser que haya errores impresos sobre estas lineas
tables upgraded setup es tablas actualizadas
target version setup es Versión Objetivo
there was a problem tring to connect to your ldap server. <br>please check your LDAP server configuration setup es Hubo un problema intentando conectar con su servidor LDAP.<br>Por favor comprueve la configuración de su servidor LDAP
the tables setup es las tablas
this program will help you upgrade or install different languages for phpGroupWare setup es Este programa le ayudará a actualizar o instalar diferentes idiomas para phpGroupWare
this section will help you import users and groups from your ldap tree into phpGroupWare's account tables setup es Esta sección le ayudará a importar usuarios y grupos desde su arbol LDAP a las tablas de cuentas de usuarios/grupos de phpGroupWare
this stage is completed<br> setup es Esta fase está completada<br>
this will create 1 admin account and 3 demo accounts<br>the username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br> setup es Esto creará 1 cuenta de administrador y 3 cuentas de demostración<br>Los nombres de usuario/contraseñas son: demo/guest, demo2/guest and demo3/guest.<br><b>!!!ESTO ELIMINARÁ TODAS LAS CUENTAS EXISTENTES!!!</b><br>
to setup 1 admin account and 3 demo accounts.<br><b>this will delete all existing accounts</b> setup es para configurar 1 cuenta de administrador y 3 cuentas de demonstración.<br><b>Esto eliminará todas las cuentas existentes</b>
upgraded setup es actualizado
upgrade setup es Actualizar
upgrading tables setup es Actualizando Tablas
version mismatch setup es Dispariad de Versiones
we will automatically update your tables/records to x setup es Actualizaremos automáticamente sus tablas/registros a %1
you appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16 setup es Parece que está ejecutando una versión antigüa de PHP<br>Le recomedamos que actulice a una versión mas nueva.<br>Algunas versiones antigüas de PHP pueden no ejecutar phpGroupWare correctamente, o simplemente no ejecutarlo. <br><br>Por favor actualize su versión de php por lo menos a la 3.0.16
You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version. setup es Parece que está usted ejecutando una versión pre-beta de phpGroupware.<br>Esas versiones no dispondran mas de soporte, y no hay forma de actualizarlas con esta utilidad.<br> Puede que usted desee primero actualizar a la versión 0.9.10 (la última versión que soportó actualizaciones desde las versiones pre-beta) <br>y luego actulizar desde esta a la versión actual.
you appear to be running version x of phpGroupWare setup es Parece que está ejecutando la versión %1 de phpGroupWare
you are ready for this stage, but this stage is not yet written.<br> setup es Está preparado para esta fase, pero esta fase no ha sido escrita todabía.<br>
you do not have any languages installed. please install one now <br> setup es No tiene soporte para ningún idioma instalado. Por favor instale uno ahora <br>
you must enter a username for the admin setup es Debe de introducir una nombre de usuario para el administrador
your applications are current setup es Sus apliaciones están actualizadas
your database does not exist setup es Su base de datos no existe
your database is working, but you dont have any applications installed setup es Su base de datos está funcionando, pero usted no tiene ninguna aplicación instalada
your tables are current setup es Sus tablas están actualizadas
your tables may be altered and you may lose data setup es Sus tablas pueden ser alteradas y usted puede perder información
your tables will be dropped and you will lose data setup es Sus tablas serán eliminadas y usted perderá la información que hubiese en ellas
you should either uninstall and then reinstall it, or attempt manual repairs setup es Usted puede desintalarla y volverla a instalar, o puede intentar una repación manual
uninstall all applications setup en Desinstalar todas las apliaciones
possible reasons setup es Posibles Razones
the table definition was correct, and the tables were installed. setup es La definición de las tablas fué correcta, y las tablas fueron instaladas
dont touch my data setup es No tocar mi información
re-check my installation setup en Comprobar Mi Instalación

158
setup/lang/phpgw_it.lang Normal file
View File

@ -0,0 +1,158 @@
<br><center>Import has been completed! Click <a href="index.php">here</a> to return to setup </center> setup it <br><center>L'importazione &egrave; stata completata! Cliccare <a href="index.php">qui</a> per titornare al setup </center>
actions setup it Azioni
admin first name setup it Nome amministratore
admin last name setup it Cognome amministratore
admin password setup it Password amministratore
admin username setup it Nome-utente amministratore
all applications setup it tutte le applicazioni
app details setup it Dettagli applicazione
app install/remove/upgrade setup it installa/rimuovi/aggiorna applicazione
application data setup it Dati Applicazione
application management setup it Gestione Applicazioni
application name and status setup it Nome Applicazione e Stato
application name and status information setup it Nome Applicazione e Informazioni di Stato
application title setup it Titolo Applicazione
at your request, this script is going to attempt to create the database and assign the db user rights to it setup it In base alla tua richiesta, questa procedura cercher&agrave; di creare il database e di assegnare i privilegi corretti al suo utente
at your request, this script is going to attempt to install all the applications for you setup it In base alla tua richiesta, questa procedura cercher&agrave; di installare tutte le tue applicazioni
at your request, this script is going to attempt to upgrade your old applications to the current versions setup it In base alla tua richiesta, questa procedura cercher&agrave; di aggiornare le tue vecchie applicazioni alla versione corrente
at your request, this script is going to attempt to upgrade your old tables to the new format setup it In base alla tua richiesta, questa procedura cercher&agrave; di aggiornare le tue vecchie tabelle al nuovo formato
at your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format setup it In base alla tua richiesta, questa procedura cercher&agrave; di cancellare le tabelle esistenti e di ricrearle nel nuovo formato
at your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data setup it In base alla tua richiesta, questa procedura cercher&agrave; di disinstallare tutte le tue applicazioni, cosa che canceller&agrave; tutte le tue tabelle e dati esistenti
available version setup it Versione Disponibile
backupwarn setup it ma noi <u>consigliamo vivamente di salvare</u> le tue tabelle nel caso in cui la procedura causidanni ai tuoi dati.<br><strong>Queste procedure automatizzate possono distruggere molto facilmente i tuoi dati.</strong><br><em>Per favore esegui un salvataggio prima di proseguire oltre!</em>
because it depends upon setup it poich&acute; dipende da
because it is not a user application, or access is controlled via acl setup it poich&eacute; non si tratta di un'applicazione dell'utente, o l'accesso &egrave; controlalto tramite acl
because it requires manual table installation, <br>or the table definition was incorrect setup it poich&eacute; richiede un'installazione manuale delle tabelle, <br>o la definizione delle tabelle &egrave: sbagliata
because of a failed upgrade or install setup it poich&eacute; &egrave; avvenuto un aggiornamento o installazione non corretti
because of a failed upgrade, or the database is newer than the installed version of this app setup it poich&eacute; &egrave; avvenuto un aggiornamento non corretto, o il database &egrave; pi&ugrave; recente della versione installata di questa applicazione
because the enable flag for this app is set to 0, or is undefined setup it poich&eacute; il valore di abilitazione di questa applicazione &egrave; impostato a 0, o &egrave; non definito
cancel setup it Cancella
charset setup it ISO-8859-1
click here setup it Clicca qui
configuration completed setup it Configurazione completata
configuration setup it Configurazione
configure now setup it Configura adesso
create database setup it crea database
create one now setup it Creane una adesso
create setup it Crea
creating tables setup it Creazione Tabelle
currently installed languages: x <br> setup it Lingue attualmente installate: %1 <br>
current version setup it Versione Installata
db root password setup it DB root password
db root username setup it DB root username
delete all my tables and data setup it Cancella tutte le mie tabelle e i dati
delete all old languages and install new ones setup it Cancella tutte le lingue gi&agrave; presenti e installa quelle nuove
deleting tables setup it Cancella Tabelle
demo server setup setup it Setup del server dimostrativo
deregistered setup it deregistrato
details for admin account setup it Dettagli per l'utente amministratore
domain setup it Dominio
dont touch my data setup it non toccare i miei dati
edit current configuration setup it Modifica la Configurazione Esistente
export sql users to ldap setup it Esporta utenti SQL verso LDAP
for a new install, select import. to convert existing sql accounts to ldap, select export setup it Per una nuova installazione, seleziona importa. Per convertire gli utenti SQL verso utenti LDAP, seleziona esporta
go back setup it Torna indietro
has a version mismatch setup it ha un conflitto di versione
hooks deregistered setup it collegamenti deregistrati
hooks registered setup it collegamenti registrati
however, the application is otherwise installed setup it Tuttavia, l'applicazione &egrave; altrimenti installata
if the application has no defined tables, selecting upgrade should remedy the problem setup it Se l'applicazione non ha tabelle definite, selezionando aggiorna il problema dovrebbe risolversi
if you did not receive any errors, your applications have been setup it Se non hai ricevuto alcun errore, allora le tue applicazioni sono state
if you did not receive any errors, your tables have been setup it Se non hai ricevuto alcun errore, allora le tue tabelle sono state
import ldap users/groups setup it Importa utenti/gruppi LDAP
insanity setup it Follia
install Applications setup it Installa Applicazioni
install language setup it Installa Lingue
install setup it Installa
installed setup it installato
is broken setup it non funziona
is disabled setup it &egrave; disabilitato
ldap account import/export setup it importa/esporta utenti LDAP
ldap export users setup it esporta utenti LDAP
ldap import users setup it importa utenti LDAP
logout setup it Esci
makesure setup it Controlla che il tuo database sia stato creato e che i permessi dell'utente siano corretti
manage applications setup it Gestione Applicazioni
manage languages setup it Gestione Lingue
multi-language support setup setup it Configurazione del supporto multi-lingua
mysqlinstr setup it Istruzioni per creare il database usando MySQL:<br>Entra in mysql -<br><i>[utente@server utente]# mysql -u root -p</i><br>Crea il database vuoto e assegna i permessi all'utente -<br><i>mysql> create database phpgroupware;</i><br><i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i>
not complete setup it non completo
note: you will be able to customize this later setup it Nota: Potrai personalizzarlo dopo
not ready for this stage yet setup it Non ancora pronto per questo passaggio
ok setup it OK
once the database is setup correctly setup it Una volta che il database sar&agrave; impostato correttamente
only add languages that are not in the database already setup it Aggiungi solo le lingue che non sono gi&agrave; presenti nel database
only add new phrases setup it Aggiungi solo le nuove frasi
passwords did not match, please re-enter setup it Le password non corrispondono, per favore reinseriscile
pgsqlinstr setup it Istruzioni per creare il database in usando PostgreSQL:<br>Fai partire postmaster<br><i>[utente@server utente]# postmaster -i -D /home/[username]/[dataDir]</i><br>Crea il database vuoto -<br><i>[utente@server utente]# createdb phpgroupware</i>
please check for sql scripts within the application's directory setup it Per favore controlla gli script sql nella cartella dell'applicazione
please configure phpGroupWare for your environment setup it Per favore configura phpGroupWare per il tuo Sistema
please install setup it Per favore installa
please login to phpgroupware and run the admin application for additional site configuration setup it Accedi a phpgroupware ed esegui l'applicazione 'admin' per una ulteriore configurazione del sito
possible solutions setup it Soluzioni possibili
potential problem setup it Problema Potenziale
problem resolution setup it Risoluzione del problemq
process setup it Processo
re-check my database setup it ricontrolla il mio database
re-check my installation setup it ricontrolla la mia installazione
re-enter password setup it Reinserisci la password
registered setup it registrata
remove setup it Rimuovi
requires reinstall or manual repair setup it Richiede reinstallazione o riparazione manuale
requires upgrade setup it Richiede aggiornamento
resolve setup it Risolvi
select the default applications to which your users will have access setup it Seleziona l'applicazione predefinita alla quale i tuoi utenti avranno accesso
select the desired action(s) from the available choices setup it Seleziona, dalle scelte disponibili, le azioni desiderate
select which group(s) will be exported (group membership will be maintained) setup it Seleziona quale gruppo/i esportare (le appartenenze ai gruppi rimarranno impostate)
select which group(s) will be imported (group membership will be maintained) setup it Seleziona quale gruppo/i importare (le appartenenze ai gruppi rimarranno impostate)
select which languages you would like to use setup it Seleziona quali lingue desideri usare
select which method of upgrade you would like to do setup it Seleziona quale metodo di aggiornamento desideri usare
select which user(s) will be exported setup it Seleziona quale utente/i esportare
select which user(s) will be imported setup it Seleziona quale utente/i importare
select which user(s) will have admin privileges setup it Seleziona quale utente/i privilegi da amministratore
select your old version setup it Seleziona la tua vecchia versione
setup setup it Setup
some or all of its tables are missing setup it Alcune o tutte delle sue tabelle sono mancanti
status setup it Stato
step 1 - simple application management setup it Passaggio 1 - Gestione Applicazioni Semplice
step 2 - configuration setup it Passaggio 2 - Configurazione
step 3 - language management setup it Passaggio 3 - Gestione Lingue
step 4 - advanced application management setup it Passaggio 4 - Gestione Applicazioni Avanzata
submit setup it Invia
table change messages setup it Messaggi dalle modifiche alle tabelle
tables dropped setup it tabelle cancellate
tables installed, unless there are errors printed above setup it tabelle installate, a meno che non vi siano errori qui sopra
tables upgraded setup it tabelle aggiornate
target version setup it Versione di destinazione
there was a problem tring to connect to your ldap server. <br>please check your LDAP server configuration setup it Si &egrave; verificato un problema nel contattare il tuo server LDAP. <br>Per favore controlla la configurazione del tuo server LDAP
the tables setup it le tabelle
this program will help you upgrade or install different languages for phpGroupWare setup it Questo programma ti aiuter&agrave; ad aggiornare o ad installare lingue differenti per phpGroupWare
this section will help you export users and groups from phpgroupWare's account tables into your ldap tree setup it Questa sezione ti aiuter&agrave; ad esportare utenti e gruppi dalle relative tabelle di phpGroupWare nel tuo LDAP tree
this section will help you import users and groups from your ldap tree into phpGroupWare's account tables setup it Questa sezione ti aiuter&agrave; ad importare utenti e gruppi dalle relative tabelle di phpGroupWare nel tuo LDAP tree
this stage is completed<br> setup it Questo passaggio &egrave; stato completato<br>
this will create 1 admin account and 3 demo accounts<br>the username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br> setup it Questo creer&agrave; 1 utente amministratore e 3 utenti di esempio<br>I nome utente/password sono: demo/guest, demo2/guest and demo3/guest.<br><b>!!!QUESTO CANCELLER&Agrave; TUTTI GLI UTENTI PREESISTENTI!!!</b><br>
select an app, enter a target version, then submit to process to that version.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink> setup it Seleziona una'applicazione, inserisci una versione di destinazione, quindi invia per processare verso quella versione.<br><blink>QUESTO CANGELLERA' PRIMA TUTTE LE TABELLE DELL'APPLICAZIONE</blink>
to setup 1 admin account and 3 demo accounts.<br><b>this will delete all existing accounts</b> setup it per predisporre 1 account amministratore e 3 account dimostrativi.<br><b>Questa operazione canceller&agrave; tutti gli account esistenti</b>
uninstall all applications setup it disinstalla tutte le applicazioni
uninstalled setup it disinstallato
upgraded setup it aggiornato
upgrade setup it Aggiorna
upgrading tables setup it Aggiornamento Tabelle
version mismatch setup it Version Mismatch
we will automatically update your tables/records to x setup it Aggiorner&ograve; automaticamente le tue tabelle/dati alla %1
you appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16 setup it Sembra che tu stia usando una vecchia versione di PHP <br>&Egrave raccomandabile che tu esegua un aggiornamento ad una versione recente. <br>Vecchie versioni di PHP potrebbero non far funzionare correttamenterun phpGroupWare, o potrebbero non farlo funzionare per nulla. <br><br>Per favore aggiorna almeno alla versione 3.0.16
You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version. setup it Sembra che tu stia usando una versione pre-beta di phpGroupWare.<br>Queste versioni non sono pi&ugrave; supportate, e non esiste un modo di aggiornarle direttamente con questo setup.<br> Puoi provare ad effettuare prima l'aggiornamento alla versione 0.9.10 (l'ultima versione a supportare gli aggiornamenti dalle pre-beta) <br>e poi aggiornare da l&igrave; usando questa versione.
you appear to be running version x of phpGroupWare setup it Sembra che tu sta utilizzando la versione %1 di phpGroupWare
you are ready for this stage, but this stage is not yet written.<br> setup it Sei pronto per questo passaggio, ma questa procedura non &egrave; ancora stata scritta.<br>
you do not have any languages installed. please install one now <br> setup it Non hai nessuna lingua installata. Per favore installane una adesso.<br>
you must enter a username for the admin setup it Devi inserire un nome utente per l'amministratore
your applications are current setup it Le tue applicazioni sono aggiornate
your database does not exist setup it Il tuo database non esiste
your database is working, but you dont have any applications installed setup it Il tuo database funziona correttamente, ma non hai nessuna applicazione installata
your tables are current setup it Le tue tabelle sono aggiornate
your tables may be altered and you may lose data setup it Le tue tabelle potranno essere modificate e perdere dati
your tables will be dropped and you will lose data setup it Le tue tabelle verranno cancellate e perderai tutti i tuoi dati
you should either uninstall and then reinstall it, or attempt manual repairs setup it Dovresti disinstallare e poi reinstallare, oppure tentare riparazioni manuali

152
setup/lang/phpgw_ja.lang Normal file
View File

@ -0,0 +1,152 @@
actions setup ja 動作
admin first name setup ja 姓
admin last name setup ja 名
admin password setup ja パスワード
admin username setup ja ユーザID
all applications setup ja で、すべてのアプリケーションテーブルを作成します。
app details setup ja アプリケーションの詳細
app install/remove/upgrade setup ja アプリケーションの追加/更新/削除
application data setup ja アプリケーション情報
application management setup ja アプリケーション設定
application name and status information setup ja <center>アプリケーション名<BR>状態</center>
application title setup ja タイトル名
at your request, this script is going to attempt to create the database and assign the db user rights to it setup ja データベースの作成、およびユーザをアサインしました。
at your request, this script is going to attempt to install all the applications for you setup ja すべてのアプリケーションテーブルを作成しました
at your request, this script is going to attempt to the tables for you setup ja At your request, this script is going to attempt to the tables for you
at your request, this script is going to attempt to upgrade your old applications to the current versions setup ja 古いアプリケーションを現在のバージョンにアップグレードしました。
at your request, this script is going to attempt to upgrade your old tables to the new format setup ja 古いテーブルを現在のフォーマットにアップグレードしました。
at your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format setup ja At your request, this script is going to take the evil action of deleting your existing tables and re-creating them in the new format
at your request, this script is going to take the evil action of uninstalling all your apps, which delete your existing tables and data setup ja アプリケーションアンインストールで、テーブルとデータを削除しました
available version setup ja 最新の<BR>バージョン
backupwarn setup ja <br>しかし、この処理が、あなたのデータを破壊してしまった場合に備えて、<u>データバックアップをお勧めします。<br></u><em>先に進む前に、データのバックアップを行って下さい。</em>
because it depends upon setup ja 理由は次のとおりです
because it is not a user application, or access is controlled via acl setup ja ユーザのアプリケーションでないか、ACL によってアクセス制限しています。
because it requires manual table installation, <br>or the table definition was incorrect setup ja 手動でテーブルをインストールする必要があるか、<br>テーブル定義が正しくありません。
because of a failed upgrade or install setup ja 追加もしくは更新に失敗しました。
because of a failed upgrade, or the database is newer than the installed version of this app setup ja データベースのバージョンがこのアプリケーションの動作可能バージョンよりも新しいため、更新に失敗しました。
because the enable flag for this app is set to 0, or is undefined setup ja このアプリケーションが利用可能となっていません。
cancel setup ja キャンセル
charset setup ja EUC-JP
click here setup ja ここをクリックする
configuration completed setup ja 環境設定は完了しました。
configuration setup ja 環境設定
configure now setup ja 環境設定
create one now setup ja 作成
create setup ja 作成
create database setup ja データベースを作成しました
created setup ja 作成
creating tables setup ja テーブルを作成しました。
currently installed languages: x <br> setup ja 現在の言語: %1 <br>
current version setup ja 現在の<BR>バージョン
delete all my tables and data setup ja すべてのテーブルとデータを削除します
delete all old languages and install new ones setup ja 現在の言語をすべて削除して、選択した言語をインストールする
deleting tables setup ja テーブルを削除しました
demo server setup setup ja デモサーバセットアップ
deregistered setup ja 登録解除しました
details for admin account setup ja 管理者アカウントの詳細情報
domain setup ja ドメイン
edit current configuration setup ja 環境設定
export sql users to ldap setup ja LDAP へ SQLのユーザをエクスポートします
for a new install, select import. to convert existing sql accounts to ldap, select export setup ja 新規インストールの場合は、インポートを選択して下さい。既存の SQL アカウントを LDAP に変換する場合は、エクスポートを選択して下さい。
go back setup ja 戻る
has a version mismatch setup ja バージョンが異なります
hooks deregistered setup ja フックを登録解除しました。
hooks registered setup ja フックを登録しました。
however, the application is otherwise installed setup ja このアプリケーションの他の部分はインストールしました。
if the application has no defined tables, selecting upgrade should remedy the problem setup ja アプリケーションテーブルが存在しない場合、更新を選択して問題を解決してください。
if you did not receive any errors, your applications have been setup ja エラーは見つかりませんでした。
if you did not receive any errors, your tables have been setup ja エラーは見つかりませんでした。
import ldap users/groups setup ja LDAP ユーザ/グループ インポート
insanity setup ja アンインストール
install Applications setup ja アプリケーション追加
install language setup ja 言語追加
install setup ja インストール
installed setup ja インストール
is broken setup ja 壊れています
is disabled setup ja 使用できません
ldap account import/export setup ja LDAP アカウント インポート/エクスポート
ldap accounts configuration setup ja LDAP アカウント設定
ldap export users setup ja LDAP エクスポートユーザ
ldap import users setup ja LDAP インポートユーザ
logout setup ja ログアウト
makesure setup ja データベースの作成とアカウントに権限を与えます
manage applications setup ja アプリケーション設定
manage languages setup ja 言語環境設定
multi-language support setup setup ja 言語環境設定
mysqlinstr setup ja MySQLでデータベースを作成するには:<br>mysql にログイン -<br><i>[user@server user]# mysql -u root -p</i><br>空のデータベースを作成し、アカウントに権限を付与する -<br><i>mysql> create database phpgroupware;</i><br><i>mysql> grant all on phpgroupware.* to phpgroupware@localhost identified by 'password';</i>
not complete setup ja 完了していません。
note: you will be able to customize this later setup ja 備考: 後でカスタマイズすることが可能です
not ready for this stage yet setup ja 実行できません。
ok setup ja OK
once the database is setup correctly setup ja Once the database is setup correctly
only add languages that are not in the database already setup ja 新しい言語すべてを追加(初めて追加する場合)
only add new phrases setup ja 新しいフレーズの追加
or we can attempt to create the database for you: setup ja または、この処理でデータベースを作成することが可能です
passwords did not match, please re-enter setup ja パスワードに誤りがあります。再度入力して下さい
pgsqlinstr setup ja PostgreSQLでデータベースを作成するには:<br>postmaster の起動<br><i>[user@server user]# postmaster -i -D /home/[username]/[dataDir]</i><br>空のデータベース作成 -<br><i>[user@server user]# createdb phpgroupware</i>
please check for sql scripts within the application's directory setup ja Please check for sql scripts within the application's directory
please configure phpGroupWare for your environment setup ja Please configure phpGroupWare for your environment
please install setup ja Please install
please login setup ja ログイン
please login to phpgroupware and run the admin application for additional site configuration setup ja phpGroupWare にログインして、admin アプリケーション内の各アプリケーションサイト環境設定を実行して下さい
possible solutions setup ja Possible Solutions
potential problem setup ja Potential Problem
problem resolution setup ja 解決方法
re-check my installation setup ja インストール確認
re-enter password setup ja パスワード再入力
registered setup ja registered
remove setup ja 削除
requires reinstall or manual repair setup ja Requires reinstall or manual repair
requires upgrade setup ja Requires upgrade
resolve setup ja 確認
select the default applications to which your users will have access setup ja Select the default applications to which your users will have access
select the desired action(s) from the available choices setup ja アプリケーションの設定動作を選択してください。
select which group(s) will be exported (group membership will be maintained) setup ja Select which group(s) will be exported (group membership will be maintained)
select which group(s) will be imported (group membership will be maintained) setup ja Select which group(s) will be imported (group membership will be maintained)
select which languages you would like to use setup ja 言語を選択してください。
select which method of upgrade you would like to do setup ja 言語環境設定の方法を選択してください。
select which user(s) will be exported setup ja Select which user(s) will be exported
select which user(s) will be imported setup ja Select which user(s) will be imported
select which user(s) will have admin privileges setup ja Select which user(s) will have admin privileges
select your old version setup ja Select your old version
setup setup ja セットアップ
some or all of its tables are missing setup ja 必要なテーブルが存在しません。
status setup ja 状態表示
step 1 - simple application management setup ja Step 1 - テーブル作成
step 2 - configuration setup ja Step 2 - 環境設定
step 3 - language management setup ja Step 3 - 言語環境設定
step 4 - advanced application management setup ja Step 4 - アプリケーション設定
submit setup ja 実行
table change messages setup ja テーブル変更メッセージ
tables dropped setup ja テーブルを削除しました
tables installed, unless there are errors printed above setup ja をインストールしました。エラー表示がなければ完了です。
tables upgraded setup ja テーブルを更新しました
there was a problem tring to connect to your ldap server. <br>please check your LDAP server configuration setup ja There was a problem tring to connect to your LDAP server. <br>please check your LDAP server configuration
the tables setup ja the tables
this program will help you upgrade or install different languages for phpGroupWare setup ja phpGroupWare での、言語環境を設定します。
this section will help you export users and groups from phpgroupWare's account tables into your ldap tree setup ja This section will help you export users and groups from phpGroupWare's account tables into your LDAP tree
this section will help you import users and groups from your ldap tree into phpGroupWare's account tables setup ja This section will help you import users and groups from your LDAP tree into phpGroupWare's account tables
this stage is completed<br> setup ja この段階は完了しました。<br>
this will create 1 admin account and 3 demo accounts<br>the username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br> setup ja 1つの管理者アカウントと3つのデモアカウントをセットアップします。<br>デモアカウントのユーザ名とパスワードは demo/guest, demo2/guest, demo3/guest です。<br><b>現在のアカウントをすべて削除しますので注意してください。</b><br>
to setup 1 admin account and 3 demo accounts.<br><b>this will delete all existing accounts</b> setup ja と、1つの管理者アカウントと3つのデモアカウントをセットアップします。<br><b>現在のアカウントをすべて削除しますので注意してください。</b>
uninstall all applications setup ja アプリケーションのアンインストール
uninstalled setup ja アンインストール
upgraded setup ja アップグレード
upgrade setup ja 更新
upgrading tables setup ja Upgrading Tables
version mismatch setup ja Version Mismatch
we will automatically update your tables/records to x setup ja セットアップは、%1 用のテーブルやデータに自動アップグレードします。
you appear to be running an old version of PHP <br>It its recommend that you upgrade to a new version. <br>Older version of PHP might not run phpGroupWare correctly, if at all. <br><br>Please upgrade to at least version 3.0.16 setup ja PHPのバージョンが古いようです。<br>バージョンアップをお勧めします。<br>古いバージョンの PHP では、phpGroupWare のすべての機能が正確に動作しません。<br><br>Ver 3.0.16 以降にバージョンアップしてください。
You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version. setup ja You appear to be running a pre-beta version of phpGroupWare.<br>These versions are no longer supported, and there is no upgrade path for them in setup.<br> You may wish to first upgrade to 0.9.10 (the last version to support pre-beta upgrades) <br>and then upgrade from there with the current version.
you appear to be running version x of phpGroupWare setup ja 現在、phpGroupWare Ver. %1 が動作していると思われます。
you are ready for this stage, but this stage is not yet written.<br> setup ja You are ready for this stage, but this stage is not yet written.<br>
you do not have any languages installed. please install one now <br> setup ja どの言語環境もありません。最低1つの言語環境をインストールして下さい。<br>
you must enter a username for the admin setup ja ユーザIDを入力して下さい。
your applications are current setup ja アプリケーションのインストールは完了しました。
your database does not exist setup ja データベースが存在しません。
your database is not working! setup ja データベースが存在しません。
your database is working, but you dont have any applications installed setup ja データベースは存在していますが、各アプリケーションテーブルが未作成です。
your tables are current setup ja Your tables are current
your tables may be altered and you may lose data setup ja テーブルを変更します。データが失われるかもしれません
your tables will be dropped and you will lose data setup ja テーブルを削除します。データは復旧できません
you should either uninstall and then reinstall it, or attempt manual repairs setup ja アンインストールした後再インストールするか、手動でインストールして下さい。

76
setup/ldap.php Normal file
View File

@ -0,0 +1,76 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info["flags"] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('../header.inc.php');
include('./inc/functions.inc.php');
// Authorize the user to use setup app and load the database
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
// Does not return unless user is authorized
if ($cancel)
{
Header("Location: index.php");
exit;
}
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'ldap' => 'ldap.tpl',
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl'
));
$phpgw_setup->show_header(lang('LDAP Config'),'','ldap',$ConfigDomain);
if ($error)
{
//echo '<br><center><b>Error:</b> '.$error.'</center>';
$phpgw_setup->show_alert_msg('Error',$error);
}
$setup_tpl->set_block('ldap','header','header');
$setup_tpl->set_block('ldap','jump','jump');
$setup_tpl->set_block('ldap','cancel_only','cancel_only');
$setup_tpl->set_block('ldap','footer','footer');
$setup_tpl->set_var('description',lang('LDAP Accounts Configuration'));
$setup_tpl->set_var('lang_ldapmodify',lang('Modify an existing LDAP account store for use with phpGroupWare (for a new install using LDAP accounts)'));
$setup_tpl->set_var('lang_ldapimport',lang('Import accounts from LDAP to the phpGroupware accounts table (for a new install using SQL accounts)'));
$setup_tpl->set_var('lang_ldapexport',lang('Export phpGroupware accounts from SQL to LDAP'));
$setup_tpl->set_var('ldapmodify','ldapmodify.php');
$setup_tpl->set_var('ldapimport','ldapimport.php');
$setup_tpl->set_var('ldapexport','ldapexport.php');
$setup_tpl->set_var('action_url','index.php');
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pfp('out','header');
$setup_tpl->pfp('out','jump');
$setup_tpl->pfp('out','cancel_only');
$setup_tpl->pfp('out','footer');
$phpgw_setup->show_footer();
?>

304
setup/ldapexport.php Normal file
View File

@ -0,0 +1,304 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info["flags"] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('../header.inc.php');
include('./inc/functions.inc.php');
// Authorize the user to use setup app and load the database
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
// Does not return unless user is authorized
class phpgw
{
var $common;
var $accounts;
var $applications;
var $db;
}
$phpgw = new phpgw;
$phpgw->common = CreateObject('phpgwapi.common');
$common = $phpgw->common;
$phpgw_setup->loaddb();
$phpgw->db = $phpgw_setup->db;
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'ldap' => 'ldap.tpl',
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl'
));
$phpgw_info['server']['account_repository'] = 'ldap';
$phpgw->accounts = CreateObject('phpgwapi.accounts');
$acct = $phpgw->accounts;
$phpgw_setup->db->query("select config_name,config_value from phpgw_config where config_name like 'ldap%'",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record())
{
$config[$phpgw_setup->db->f('config_name')] = $phpgw_setup->db->f('config_value');
}
$phpgw_info['server']['ldap_host'] = $config['ldap_host'];
$phpgw_info['server']['ldap_context'] = $config['ldap_context'];
$phpgw_info['server']['ldap_group_context'] = $config['ldap_group_context'];
$phpgw_info['server']['ldap_root_dn'] = $config['ldap_root_dn'];
$phpgw_info['server']['ldap_root_pw'] = $config['ldap_root_pw'];
$phpgw_info["server"]['ldap_account_home'] = $config['ldap_account_home'];
$phpgw_info["server"]['ldap_account_shell'] = $config['ldap_account_shell'];
$phpgw_info['server']['ldap_extra_attributes'] = $config['ldap_extra_attributes'];
// First, see if we can connect to the LDAP server, if not send `em back to config.php with an
// error message.
// connect to ldap server
if (! $ldap = $common->ldapConnect())
{
$noldapconnection = True;
}
if ($noldapconnection)
{
Header('Location: config.php?error=badldapconnection');
exit;
}
$sql = "SELECT * FROM phpgw_accounts WHERE account_type='u'";
$phpgw_setup->db->query($sql,__LINE__,__FILE__);
while($phpgw_setup->db->next_record())
{
$i = $phpgw_setup->db->f('account_id');
$account_info[$i]['account_id'] = $phpgw_setup->db->f('account_id');
$account_info[$i]['account_lid'] = $phpgw_setup->db->f('account_lid');
$account_info[$i]['account_firstname'] = $phpgw_setup->db->f('account_firstname');
$account_info[$i]['account_lastname'] = $phpgw_setup->db->f('account_lastname');
$account_info[$i]['account_status'] = $phpgw_setup->db->f('account_status');
$account_info[$i]['account_expires'] = $phpgw_setup->db->f('account_expires');
}
while (list($key,$data) = @each($account_info))
{
$tmp = $data['account_id'];
$newaccount[$tmp] = $data;
}
$account_info = $newaccount;
$sql = "SELECT * FROM phpgw_accounts WHERE account_type='g'";
$phpgw_setup->db->query($sql,__LINE__,__FILE__);
while($phpgw_setup->db->next_record())
{
$i = $phpgw_setup->db->f('account_id');
$group_info[$i]['account_id'] = $phpgw_setup->db->f('account_id');
$group_info[$i]['account_lid'] = $phpgw_setup->db->f('account_lid');
$group_info[$i]['account_firstname'] = $phpgw_setup->db->f('account_firstname');
$group_info[$i]['account_lastname'] = $phpgw_setup->db->f('account_lastname');
$group_info[$i]['account_status'] = $phpgw_setup->db->f('account_status');
$group_info[$i]['account_expires'] = $phpgw_setup->db->f('account_expires');
}
while (list($key,$data) = @each($group_info))
{
$tmp = $data['account_id'][0];
$newgroup[$tmp] = $data;
}
$group_info = $newgroup;
if ($cancel)
{
Header("Location: ldap.php");
exit;
}
if ($submit)
{
if ($ldapgroups)
{
while (list($key,$groupid) = each($ldapgroups))
{
$id_exist = 0;
$thisacctid = $group_info[$groupid]['account_id'];
$thisacctlid = $group_info[$groupid]['account_lid'];
$thisfirstname = $group_info[$groupid]['account_firstname'];
$thislastname = $group_info[$groupid]['account_lastname'];
$thismembers = $group_info[$groupid]['members'];
// Do some checks before we try to import the data to LDAP.
if (!empty($thisacctid) && !empty($thisacctlid))
{
$groups = CreateObject('phpgwapi.accounts',intval($thisacctid));
$groups->db = $phpgw_setup->db;
// Check if the account is already there.
// If so, we won't try to create it again.
$acct_exist = $acct->name2id($thisacctlid);
if ($acct_exist)
{
$thisacctid = $acct_exist;
}
$id_exist = $groups->exists(intval($thisacctid));
echo '<br>accountid: ' . $thisacctid;
echo '<br>accountlid: ' . $thisacctlid;
echo '<br>exists: ' . $id_exist;
/* If not, create it now. */
if(!$id_exist)
{
$thisaccount_info = array(
'account_type' => 'g',
'account_id' => $thisacctid,
'account_lid' => $thisacctlid,
'account_passwd' => 'x',
'account_firstname' => $thisfirstname,
'account_lastname' => $thislastname,
'account_status' => 'A',
'account_expires' => -1
);
$groups->create($thisaccount_info);
}
}
}
}
if ($users)
{
while (list($key,$accountid) = each($users))
{
$id_exist = 0; $acct_exist = 0;
$thisacctid = $account_info[$accountid]['account_id'];
$thisacctlid = $account_info[$accountid]['account_lid'];
$thisfirstname = $account_info[$accountid]['account_firstname'];
$thislastname = $account_info[$accountid]['account_lastname'];
// Do some checks before we try to import the data.
if (!empty($thisacctid) && !empty($thisacctlid))
{
$accounts = CreateObject('phpgwapi.accounts',intval($thisacctid));
$accounts->db = $phpgw_setup->db;
// Check if the account is already there.
// If so, we won't try to create it again.
$acct_exist = $acct->name2id($thisacctlid);
if ($acct_exist)
{
$thisacctid = $acct_exist;
}
$id_exist = $accounts->exists(intval($thisacctid));
// If not, create it now.
if(!$id_exist)
{
echo '<br>Adding' . $thisacctid;
$thisaccount_info = array(
'account_type' => 'u',
'account_id' => $thisacctid,
'account_lid' => $thisacctlid,
'account_passwd' => 'x',
'account_firstname' => $thisfirstname,
'account_lastname' => $thislastname,
'account_status' => 'A',
'account_expires' => -1,
'homedirectory' => $config['ldap_account_home'] . '/' . $thisacctlid,
'loginshell' => $config['ldap_account_shell']
);
$accounts->create($thisaccount_info);
}
}
}
}
$setup_complete = True;
}
$phpgw_setup->show_header('LDAP Export','','ldapexport',$ConfigDomain);
if ($error)
{
//echo '<br><center><b>Error:</b> '.$error.'</center>';
$phpgw_setup->show_alert_msg('Error',$error);
}
if ($setup_complete)
{
echo lang('<br><center>Export has been completed! You will need to set the user passwords manually.</center>');
echo lang('<br><center>Click <a href="index.php">here</a> to return to setup </center>');
$phpgw_setup->show_footer();
exit;
}
$setup_tpl->set_block('ldap','header','header');
$setup_tpl->set_block('ldap','user_list','user_list');
$setup_tpl->set_block('ldap','admin_list','admin_list');
$setup_tpl->set_block('ldap','group_list','group_list');
$setup_tpl->set_block('ldap','app_list','app_list');
$setup_tpl->set_block('ldap','submit','submit');
$setup_tpl->set_block('ldap','footer','footer');
while (list($key,$account) = @each($account_info))
{
$user_list .= '<option value="' . $account['account_id'] . '">'
. $common->display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname'])
. '</option>';
}
@reset($account_info);
while (list($key,$account) = @each($account_info))
{
$admin_list .= '<option value="' . $account['account_id'] . '">'
. $common->display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname'])
. '</option>';
}
while (list($key,$group) = @each($group_info))
{
$group_list .= '<option value="' . $group['account_id'] . '">'
. $group['account_lid']
. '</option>';
}
$setup_tpl->set_var('action_url','ldapexport.php');
$setup_tpl->set_var('users',$user_list);
$setup_tpl->set_var('admins',$admin_list);
$setup_tpl->set_var('ldapgroups',$group_list);
$setup_tpl->set_var('s_apps',$app_list);
$setup_tpl->set_var('ldap_import',lang('LDAP export users'));
$setup_tpl->set_var('description',lang("This section will help you export users and groups from phpGroupWare's account tables into your LDAP tree").'.');
$setup_tpl->set_var('select_users',lang('Select which user(s) will be exported'));
$setup_tpl->set_var('select_groups',lang('Select which group(s) will be exported (group membership will be maintained)'));
$setup_tpl->set_var('form_submit','export');
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pfp('out','header');
if($account_info)
{
$setup_tpl->pfp('out','user_list');
}
if ($group_info)
{
$setup_tpl->pfp('out','group_list');
}
$setup_tpl->pfp('out','submit');
$setup_tpl->pfp('out','footer');
$phpgw_setup->show_footer();
?>

466
setup/ldapimport.php Normal file
View File

@ -0,0 +1,466 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info["flags"] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('../header.inc.php');
include('./inc/functions.inc.php');
// Authorize the user to use setup app and load the database
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
// Does not return unless user is authorized
class phpgw
{
var $common;
var $accounts;
var $applications;
var $db;
}
$phpgw = new phpgw;
$phpgw->common = CreateObject('phpgwapi.common');
$common = $phpgw->common;
$phpgw_setup->loaddb();
$phpgw->db = $phpgw_setup->db;
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'ldap' => 'ldap.tpl',
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl'
));
$phpgw_info['server']['auth_type'] = 'ldap';
$phpgw->applications = CreateObject('phpgwapi.applications');
$applications = $phpgw->applications;
$phpgw_setup->db->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name LIKE 'ldap%' OR config_name='account_repository'",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record())
{
$config[$phpgw_setup->db->f('config_name')] = $phpgw_setup->db->f('config_value');
}
$phpgw_info['server']['ldap_host'] = $config['ldap_host'];
$phpgw_info['server']['ldap_context'] = $config['ldap_context'];
$phpgw_info['server']['ldap_group_context'] = $config['ldap_group_context'];
$phpgw_info['server']['ldap_root_dn'] = $config['ldap_root_dn'];
$phpgw_info['server']['ldap_root_pw'] = $config['ldap_root_pw'];
$phpgw_info['server']['account_repository'] = $config['account_repository'];
$phpgw->accounts = CreateObject('phpgwapi.accounts');
$acct = $phpgw->accounts;
// First, see if we can connect to the LDAP server, if not send `em back to config.php with an
// error message.
// connect to ldap server
if (! $ldap = $common->ldapConnect())
{
$noldapconnection = True;
}
if ($noldapconnection)
{
Header('Location: config.php?error=badldapconnection');
exit;
}
$sr = ldap_search($ldap,$config['ldap_context'],'(|(uid=*))',array('sn','givenname','uid','uidnumber'));
$info = ldap_get_entries($ldap, $sr);
$tmp = '';
for ($i=0; $i<$info['count']; $i++)
{
if (! $phpgw_info['server']['global_denied_users'][$info[$i]['uid'][0]])
{
$tmp = $info[$i]['uidnumber'][0];
$account_info[$tmp]['account_id'] = $info[$i]['uidnumber'][0];
$account_info[$tmp]['account_lid'] = $info[$i]['uid'][0];
$account_info[$tmp]['account_firstname'] = $info[$i]['givenname'][0];
$account_info[$tmp]['account_lastname'] = $info[$i]['sn'][0];
$account_info[$tmp]['account_passwd'] = $info[$i]['userpassword'][0];
}
}
if ($phpgw_info['server']['ldap_group_context'])
{
$srg = ldap_search($ldap,$config['ldap_group_context'],'(|(cn=*))',array('gidnumber','cn','memberuid'));
$info = ldap_get_entries($ldap, $srg);
$tmp = '';
for ($i=0; $i<$info['count']; $i++)
{
if (! $phpgw_info['server']['global_denied_groups'][$info[$i]['cn'][0]] &&
! $account_info[$i][$info[$i]['cn'][0]])
{
$tmp = $info[$i]['gidnumber'][0];
$group_info[$tmp]['account_id'] = $info[$i]['gidnumber'][0];
$group_info[$tmp]['account_lid'] = $info[$i]['cn'][0];
$group_info[$tmp]['members'] = $info[$i]['memberuid'];
$group_info[$tmp]['account_firstname'] = $info[$i]['cn'][0];
$group_info[$tmp]['account_lastname'] = 'Group';
}
}
}
else
{
$group_info = array();
}
$phpgw_setup->db->query("SELECT app_name,app_title FROM phpgw_applications WHERE app_enabled != '0' AND app_enabled != '3' AND "
. "app_name != 'administration' ORDER BY app_title",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record())
{
$apps[$phpgw_setup->db->f('app_name')] = $phpgw_setup->db->f('app_title');
}
if ($cancel)
{
Header("Location: ldap.php");
exit;
}
if ($submit)
{
if (!count($admins))
{
$error = '<br>You must select at least 1 admin';
}
if (!count($s_apps))
{
$error .= '<br>You must select at least 1 application';
}
if (!$error)
{
if($users)
{
while (list($key,$id) = each($users))
{
$id_exist = 0;
$thisacctid = $account_info[$id]['account_id'];
$thisacctlid = $account_info[$id]['account_lid'];
$thisfirstname = $account_info[$id]['account_firstname'];
$thislastname = $account_info[$id]['account_lastname'];
$thispasswd = $account_info[$id]['account_passwd'];
// Do some checks before we try to import the data.
if (!empty($thisacctid) && !empty($thisacctlid))
{
$accounts = CreateObject('phpgwapi.accounts',intval($thisacctid));
$accounts->db = $phpgw_setup->db;
// Check if the account is already there.
// If so, we won't try to create it again.
$acct_exist = $acct->name2id($thisacctlid);
if ($acct_exist)
{
$thisacctid = $acct_exist;
}
$id_exist = $accounts->exists($thisacctlid);
// If not, create it now.
if(!$id_exist)
{
$thisaccount_info = array(
'account_type' => 'u',
'account_lid' => $thisacctlid,
'account_passwd' => 'x',
/* 'account_passwd' => $thispasswd, */
'account_firstname' => $thisfirstname,
'account_lastname' => $thislastname,
'account_status' => 'A',
'account_expires' => -1
);
$accounts->create($thisaccount_info);
$thisacctid = $acct->name2id($thisacctlid);
}
// Insert default acls for this user.
// Since the group has app rights, we don't need to give users
// these rights. Instead, we make the user a member of the Default group
// below.
$acl = CreateObject('phpgwapi.acl',intval($thisacctid));
$acl->db = $phpgw_setup->db;
$acl->read_repository();
// Only give them admin if we asked for them to have it.
// This is typically an exception to apps for run rights
// as a group member.
for ($a=0;$a<count($admins);$a++)
{
if ($admins[$a] == $thisacctlid)
{
$acl->delete('admin','run',1);
$acl->add('admin','run',1);
}
}
// Now make them a member of the 'Default' group.
// But, only if the current user is not the group itself.
if (!$defaultgroupid)
{
$defaultgroupid = $accounts->name2id('Default');
}
if($defaultgroupid)
{
$acl->delete('phpgw_group',$defaultgroupid,1);
$acl->add('phpgw_group',$defaultgroupid,1);
}
// Save these new acls.
$acl->save_repository();
}
}
}
if ($ldapgroups)
{
while (list($key,$groupid) = each($ldapgroups))
{
$id_exist = 0;
$thisacctid = $group_info[$groupid]['account_id'];
$thisacctlid = $group_info[$groupid]['account_lid'];
$thisfirstname = $group_info[$groupid]['account_firstname'];
$thislastname = $group_info[$groupid]['account_lastname'];
$thismembers = $group_info[$groupid]['members'];
// Do some checks before we try to import the data.
if (!empty($thisacctid) && !empty($thisacctlid))
{
$groups = CreateObject('phpgwapi.accounts',intval($thisacctid));
$groups->db = $phpgw_setup->db;
// Check if the account is already there.
// If so, we won't try to create it again.
$acct_exist = $groups->name2id($thisacctlid);
/* echo '<br<group: ' . $acct_exist; */
if ($acct_exist)
{
$thisacctid = $acct_exist;
}
$id_exist = $groups->exists(intval($thisacctid));
// If not, create it now.
if(!$id_exist)
{
$thisgroup_info = array(
'account_type' => 'g',
'account_lid' => $thisacctlid,
'account_passwd' => $passwd,
'account_firstname' => $thisfirstname,
'account_lastname' => $thislastname,
'account_status' => 'A',
'account_expires' => -1
);
$groups->create($thisgroup_info);
$thisacctid = $acct->name2id($thisacctlid);
}
// Now make them a member of this group in phpgw.
while (list($key,$members) = each($thismembers))
{
if ($key == 'count')
{
continue;
}
/* echo '<br>members: ' . $members; */
$tmpid = 0;
@reset($account_info);
while(list($x,$y) = each($account_info))
{
/* echo '<br>checking: '.$y['account_lid']; */
if ($members == $y['account_lid'])
{
$tmpid = $acct->name2id($y['account_lid']);
}
}
/*
Insert acls for this group based on memberuid field.
Since the group has app rights, we don't need to give users
these rights. Instead, we maintain group membership here.
*/
if($tmpid)
{
$acl = CreateObject('phpgwapi.acl',$tmpid);
$acl->db = $phpgw_setup->db;
$acl->account_id = intval($tmpid);
$acl->read_repository();
$acl->delete('phpgw_group',$thisacctid,1);
$acl->add('phpgw_group',$thisacctid,1);
// Now add the acl to let them change their password
$acl->delete('preferences','changepassword',1);
$acl->add('preferences','changepassword',1);
$acl->save_repository();
}
}
/* Now give this group some rights */
$phpgw_info['user']['account_id'] = $thisacctid;
$acl = CreateObject('phpgwapi.acl');
$acl->db = $phpgw_setup->db;
$acl->account_id = intval($thisacctid);
$acl->read_repository();
@reset($s_apps);
while (list($key,$app) = each($s_apps))
{
$acl->delete($app,'run',1);
$acl->add($app,'run',1);
}
$acl->save_repository();
$defaultgroupid = $thisacctid;
}
}
}
else
{
/* Create the 'Default' group */
$groups = CreateObject('phpgwapi.accounts',$defaultgroupid);
$groups->db = $phpgw_setup->db;
// Check if the group account is already there.
// If so, set our group_id to that account's id for use below.
$acct_exist = $groups->name2id('Default');
if ($acct_exist)
{
$defaultgroupid = $acct_exist;
}
$id_exist = $groups->exists(intval($defaultgroupid));
// if not, create it, using our original groupid.
if($id_exist)
{
$groups->delete($defaultgroupid);
}
$thisgroup_info = array(
'account_type' => 'g',
'account_lid' => 'Default',
'account_passwd' => $passwd,
'account_firstname' => 'Default',
'account_lastname' => 'Group',
'account_status' => 'A',
'account_expires' => -1
);
$acct->create($thisgroup_info);
$defaultgroupid = $acct->name2id('Default');
$acl = CreateObject('phpgwapi.acl',$defaultgroupid);
$acl->db = $phpgw_setup->db;
$acl->account_id = intval($defaultgroupid);
$acl->read_repository();
@reset($s_apps);
while (list($key,$app) = each($s_apps))
{
$acl->delete($app,'run',1);
$acl->add($app,'run',1);
}
$acl->save_repository();
} //end default group creation
}
$setup_complete = True;
}
$phpgw_setup->show_header('LDAP Import','','ldapimport',$ConfigDomain);
if ($error)
{
//echo '<br><center><b>Error:</b> '.$error.'</center>';
$phpgw_setup->show_alert_msg('Error',$error);
}
if ($setup_complete)
{
echo lang('<br><center>Import has been completed! Click <a href="index.php">here</a> to return to setup </center>');
$phpgw_setup->show_footer();
exit;
}
$setup_tpl->set_block('ldap','header','header');
$setup_tpl->set_block('ldap','user_list','user_list');
$setup_tpl->set_block('ldap','admin_list','admin_list');
$setup_tpl->set_block('ldap','group_list','group_list');
$setup_tpl->set_block('ldap','app_list','app_list');
$setup_tpl->set_block('ldap','submit','submit');
$setup_tpl->set_block('ldap','footer','footer');
while (list($key,$account) = each($account_info))
{
$user_list .= '<option value="' . $account['account_id'] . '">'
. $common->display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname'])
. '</option>';
}
@reset($account_info);
while (list($key,$account) = each($account_info))
{
$admin_list .= '<option value="' . $account['account_lid'] . '">'
. $common->display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname'])
. '</option>';
}
while (list($key,$group) = each($group_info))
{
$group_list .= '<option value="' . $group['account_id'] . '">'
. $group['account_lid']
. '</option>';
}
while (list($apptitle,$appname) = each($apps))
{
if ($apptitle != 'admin')
{
$app_list .= '<option value="' . $apptitle . '" selected>' . $appname . '</option>';
}
else
{
$app_list .= '<option value="' . $apptitle . '">' . $appname . '</option>';
}
}
$setup_tpl->set_var('action_url','ldapimport.php');
$setup_tpl->set_var('users',$user_list);
$setup_tpl->set_var('admins',$admin_list);
$setup_tpl->set_var('ldapgroups',$group_list);
$setup_tpl->set_var('s_apps',$app_list);
$setup_tpl->set_var('ldap_import',lang('LDAP import users'));
$setup_tpl->set_var('description',lang("This section will help you import users and groups from your LDAP tree into phpGroupWare's account tables").'.');
$setup_tpl->set_var('select_users',lang('Select which user(s) will be imported'));
$setup_tpl->set_var('select_admins',lang('Select which user(s) will have admin privileges'));
$setup_tpl->set_var('select_groups',lang('Select which group(s) will be imported (group membership will be maintained)'));
$setup_tpl->set_var('select_apps',lang('Select the default applications to which your users will have access').'.');
$setup_tpl->set_var('note',lang('Note: You will be able to customize this later').'.');
$setup_tpl->set_var('form_submit','import');
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pfp('out','header');
$setup_tpl->pfp('out','user_list');
$setup_tpl->pfp('out','admin_list');
$setup_tpl->pfp('out','group_list');
$setup_tpl->pfp('out','app_list');
$setup_tpl->pfp('out','submit');
$setup_tpl->pfp('out','footer');
$phpgw_setup->show_footer();
?>

402
setup/ldapmodify.php Normal file
View File

@ -0,0 +1,402 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info["flags"] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include('../header.inc.php');
include('./inc/functions.inc.php');
/* Authorize the user to use setup app and load the database */
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
/* Does not return unless user is authorized */
class phpgw
{
var $common;
var $accounts;
var $applications;
var $db;
}
$phpgw = new phpgw;
$phpgw->common = CreateObject('phpgwapi.common');
$common = $phpgw->common;
$phpgw_setup->loaddb();
$phpgw->db = $phpgw_setup->db;
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'ldap' => 'ldap.tpl',
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl'
));
$phpgw_setup->db->query("SELECT config_name,config_value FROM phpgw_config WHERE config_name LIKE 'ldap%' OR config_name='account_repository'",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record())
{
$config[$phpgw_setup->db->f('config_name')] = $phpgw_setup->db->f('config_value');
}
$phpgw_info['server']['ldap_host'] = $config['ldap_host'];
$phpgw_info['server']['ldap_context'] = $config['ldap_context'];
$phpgw_info['server']['ldap_group_context'] = $config['ldap_group_context'];
$phpgw_info['server']['ldap_root_dn'] = $config['ldap_root_dn'];
$phpgw_info['server']['ldap_root_pw'] = $config['ldap_root_pw'];
$phpgw_info['server']['account_repository'] = $config['account_repository'];
$phpgw->accounts = CreateObject('phpgwapi.accounts');
$acct = $phpgw->accounts;
/* connect to ldap server */
if (! $ldap = $common->ldapConnect())
{
$noldapconnection = True;
}
if ($noldapconnection)
{
Header('Location: config.php?error=badldapconnection');
exit;
}
$sr = ldap_search($ldap,$config['ldap_context'],'(|(uid=*))',array('cn','givenname','uid','uidnumber'));
$info = ldap_get_entries($ldap, $sr);
$tmp = '';
for ($i=0; $i<$info['count']; $i++)
{
if (! $phpgw_info['server']['global_denied_users'][$info[$i]['uid'][0]])
{
$account_info[$info[$i]['uidnumber'][0]] = $info[$i];
}
}
if ($phpgw_info['server']['ldap_group_context'])
{
$srg = ldap_search($ldap,$config['ldap_group_context'],'(|(cn=*))',array('gidnumber','cn','memberuid'));
$info = ldap_get_entries($ldap, $srg);
$tmp = '';
for ($i=0; $i<$info['count']; $i++)
{
if (! $phpgw_info['server']['global_denied_groups'][$info[$i]['cn'][0]] &&
! $account_info[$i][$info[$i]['cn'][0]])
{
$group_info[$info[$i]['gidnumber'][0]] = $info[$i];
}
}
}
else
{
$group_info = array();
}
$phpgw_setup->db->query("SELECT app_name,app_title FROM phpgw_applications WHERE app_enabled != '0' AND app_enabled != '3' AND "
. "app_name != 'administration' ORDER BY app_title",__LINE__,__FILE__);
while ($phpgw_setup->db->next_record())
{
$apps[$phpgw_setup->db->f('app_name')] = $phpgw_setup->db->f('app_title');
}
if ($cancel)
{
Header("Location: ldap.php");
exit;
}
$phpgw_setup->show_header('LDAP Modify','','ldapmodify',$ConfigDomain);
if ($submit)
{
$acl = CreateObject('phpgwapi.acl');
$acl->db = $phpgw_setup->db;
if ($ldapgroups)
{
$groups = CreateObject('phpgwapi.accounts');
$groups->db = $phpgw_setup->db;
while (list($key,$groupid) = each($ldapgroups))
{
$id_exist = 0;
$entry = array();
$thisacctid = $group_info[$groupid]['gidnumber'][0];
$thisacctlid = $group_info[$groupid]['cn'][0];
/* echo "Updating GROUPID : ".$thisacctlid."<br>\n"; */
$thisfirstname = $group_info[$groupid]['cn'][0];
$thismembers = $group_info[$groupid]['memberuid'];
$thisdn = $group_info[$groupid]['dn'];
/* Do some checks before we try to import the data. */
if (!empty($thisacctid) && !empty($thisacctlid))
{
$groups->account_id = intval($thisacctid);
$sr = ldap_search($ldap,$config['ldap_group_context'],'cn='.$thisacctlid);
$entry = ldap_get_entries($ldap, $sr);
reset($entry[0]['objectclass']);
$addclass = True;
while(list($key,$value) = each($entry[0]['objectclass']))
{
if(strtolower($value) == 'phpgwaccount')
{
$addclass = False;
}
}
if($addclass)
{
reset($entry[0]['objectclass']);
$replace['objectclass'] = $entry[0]['objectclass'];
$replace['objectclass'][] = 'phpgwAccount';
ldap_mod_replace($ldap,$thisdn,$replace);
unset($replace);
unset($addclass);
}
unset($add);
if(!@isset($entry[0]['phpgwaccountstatus']))
{
$add['phpgwaccountstatus'][] = 'A';
}
if(!@isset($entry[0]['phpgwaccounttype']))
{
$add['phpgwaccounttype'][] = 'g';
}
if(!@isset($entry[0]['phpgwaccountexpires']))
{
$add['phpgwaccountexpires'][] = -1;
}
if(@isset($add))
{
ldap_mod_add($ldap,$thisdn,$add);
}
/* Now make the members a member of this group in phpgw. */
while (list($key,$members) = each($thismembers))
{
if ($key == 'count')
{
continue;
}
/* echo '<br>members: ' . $members; */
$tmpid = 0;
@reset($account_info);
while(list($x,$y) = each($account_info))
{
/* echo '<br>checking: '.$y['account_lid']; */
if ($members == $y['account_lid'])
{
$tmpid = $y['account_id'];
}
}
// Insert acls for this group based on memberuid field.
// Since the group has app rights, we don't need to give users
// these rights. Instead, we maintain group membership here.
if($tmpid)
{
$acl->account_id = intval($tmpid);
$acl->read_repository();
$acl->delete('phpgw_group',$thisacctid,1);
$acl->add('phpgw_group',$thisacctid,1);
// Now add the acl to let them change their password
$acl->delete('preferences','changepassword',1);
$acl->add('preferences','changepassword',1);
$acl->save_repository();
}
}
/* Now give this group some rights */
$phpgw_info['user']['account_id'] = $thisacctid;
$acl->account_id = intval($thisacctid);
$acl->read_repository();
@reset($s_apps);
while (list($key,$app) = @each($s_apps))
{
$acl->delete($app,'run',1);
$acl->add($app,'run',1);
}
$acl->save_repository();
$defaultgroupid = $thisacctid;
}
}
}
if($users)
{
$accounts = CreateObject('phpgwapi.accounts');
$accounts->db = $phpgw_setup->db;
while (list($key,$id) = each($users))
{
$id_exist = 0;
$thisacctid = $account_info[$id]['uidnumber'][0];
$thisacctlid = $account_info[$id]['uid'][0];
/* echo "Updating USERID : ".$thisacctlid."<br>\n"; */
$thisdn = $account_info[$id]['dn'];
/* Do some checks before we try to import the data. */
if (!empty($thisacctid) && !empty($thisacctlid))
{
$accounts->account_id = intval($thisacctid);
$sr = ldap_search($ldap,$config['ldap_context'],'uid='.$thisacctlid);
$entry = ldap_get_entries($ldap, $sr);
reset($entry[0]['objectclass']);
$addclass = True;
while(list($key,$value) = each($entry[0]['objectclass']))
{
if(strtolower($value) == 'phpgwaccount')
{
$addclass = False;
}
}
if($addclass)
{
reset($entry[0]['objectclass']);
$replace['objectclass'] = $entry[0]['objectclass'];
$replace['objectclass'][] = 'phpgwAccount';
ldap_mod_replace($ldap,$thisdn,$replace);
unset($replace);
unset($addclass);
}
unset($add);
if(!@isset($entry[0]['phpgwaccountstatus']))
{
$add['phpgwaccountstatus'][] = 'A';
}
if(!@isset($entry[0]['phpgwaccounttype']))
{
$add['phpgwaccounttype'][] = 'g';
}
if(!@isset($entry[0]['phpgwaccountexpires']))
{
$add['phpgwaccountexpires'][] = -1;
}
if(@isset($add))
{
ldap_mod_add($ldap,$thisdn,$add);
}
/*
Insert default acls for this user.
Since the group has app rights, we don't need to give users
these rights.
*/
$acl->account_id = intval($thisacctid);
$acl->read_repository();
// Now add the acl to let them change their password
$acl->delete('preferences','changepassword',1);
$acl->add('preferences','changepassword',1);
/*
Only give them admin if we asked for them to have it.
This is typically an exception to apps for run rights
as a group member.
*/
for ($a=0;$a<count($admins);$a++)
{
if ($admins[$a] == $thisacctid)
{
$acl->delete('admin','run',1);
$acl->add('admin','run',1);
}
}
/* Save these new acls. */
$acl->save_repository();
}
}
}
$setup_complete = True;
}
if ($error)
{
/* echo '<br><center><b>Error:</b> '.$error.'</center>'; */
$phpgw_setup->show_alert_msg('Error',$error);
}
if ($setup_complete)
{
echo lang('<br><center>Modifications have been completed! Click <a href="index.php">here</a> to return to setup </center>');
$phpgw_setup->show_footer();
exit;
}
$setup_tpl->set_block('ldap','header','header');
$setup_tpl->set_block('ldap','user_list','user_list');
$setup_tpl->set_block('ldap','admin_list','admin_list');
$setup_tpl->set_block('ldap','group_list','group_list');
$setup_tpl->set_block('ldap','app_list','app_list');
$setup_tpl->set_block('ldap','submit','submit');
$setup_tpl->set_block('ldap','footer','footer');
while (list($key,$account) = @each($account_info))
{
$user_list .= '<option value="' . $account['uidnumber'][0] . '">' . $account['cn'][0] . '(' . $account['uid'][0] . ')</option>';
}
@reset($account_info);
while (list($key,$account) = @each($account_info))
{
$admin_list .= '<option value="' . $account['uidnumber'][0] . '">' . $account['cn'][0] . '(' . $account['uid'][0] . ')</option>';
}
while (list($key,$group) = @each($group_info))
{
$group_list .= '<option value="' . $group['gidnumber'][0] . '">' . $group['cn'][0] . '</option>';
}
while (list($apptitle,$appname) = each($apps))
{
if ($apptitle != 'admin')
{
$app_list .= '<option value="' . $apptitle . '" selected>' . $appname . '</option>';
}
else
{
$app_list .= '<option value="' . $apptitle . '">' . $appname . '</option>';
}
}
$setup_tpl->set_var('action_url','ldapmodify.php');
$setup_tpl->set_var('users',$user_list);
$setup_tpl->set_var('admins',$admin_list);
$setup_tpl->set_var('ldapgroups',$group_list);
$setup_tpl->set_var('s_apps',$app_list);
$setup_tpl->set_var('ldap_import',lang('LDAP Modify'));
$setup_tpl->set_var('description',lang("This section will help you setup your LDAP accounts for use with phpGroupWare").'.');
$setup_tpl->set_var('select_users',lang('Select which user(s) will be modified'));
$setup_tpl->set_var('select_admins',lang('Select which user(s) will also have admin privileges'));
$setup_tpl->set_var('select_groups',lang('Select which group(s) will be modified (group membership will be maintained)'));
$setup_tpl->set_var('select_apps',lang('Select the default applications to which your users will have access').'.');
$setup_tpl->set_var('form_submit',lang('Modify'));
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pfp('out','header');
$setup_tpl->pfp('out','user_list');
$setup_tpl->pfp('out','admin_list');
$setup_tpl->pfp('out','group_list');
$setup_tpl->pfp('out','app_list');
$setup_tpl->pfp('out','submit');
$setup_tpl->pfp('out','footer');
$phpgw_setup->show_footer();
?>

388
setup/manageheader.php Normal file
View File

@ -0,0 +1,388 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => "home",
'noapi' => True
);
include('./inc/functions.inc.php');
include('../phpgwapi/setup/setup.inc.php');
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info);
#include("../version.inc.php");
function check_form_values()
{
global $setting, $phpgw_setup;
if (! $setting['config_pass'])
{
$errors .= "<br>You didn't enter a config password";
}
if (! $setting['HEADER_ADMIN_PASSWORD'])
{
$errors .= "<br>You didn't enter a header admin password";
}
if ($errors)
{
$phpgw_setup->show_header('Error',True);
echo $errors;
exit;
}
}
/* authentication phase */
$phpgw_info["setup"]["stage"]["header"] = $phpgw_setup->check_header();
// added these to let the app work, need to templatize still
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_main' => 'setup_main.tpl',
'T_setup_db_blocks' => 'setup_db_blocks.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
switch($phpgw_info['setup']['stage']['header'])
{
case '1':
$phpgw_info['setup']['HeaderFormMSG'] = 'Create your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'You have not created your header.inc.php yet!<br> You can create it now.';
break;
case '2':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header admin password is NOT set. Please set it now!';
$phpgw_info['setup']['PageMSG'] = 'Your header admin password is NOT set. Please set it now!';
break;
case '3':
$phpgw_info['setup']['HeaderFormMSG'] = 'Your header.inc.php needs upgrading.';
$phpgw_info['setup']['PageMSG'] = 'Your header.inc.php needs upgrading.<br><blink><font color=CC0000><b>WARNING!</b></font></blink><br>If you are using virtual domain support, this will <b>NOT</b> copy those domains over. You will need to do this manually, <b>MAKE BACKUPS!</b>';
$phpgw_info['setup']['HeaderLoginMSG'] = 'Your header.inc.php needs upgrading.';
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
break;
case '10':
if (!$phpgw_setup->auth('Header'))
{
$phpgw_setup->show_header('Please login',True);
$phpgw_setup->login_form();
exit;
}
$phpgw_info['setup']['HeaderFormMSG'] = 'Edit your header.inc.php';
$phpgw_info['setup']['PageMSG'] = 'Edit your existing header.inc.php';
break;
}
switch($action)
{
case 'download':
check_form_values();
$header_template = new Template('../');
header('Content-disposition: attachment; filename="header.inc.php"');
header('Content-type: application/octet-stream');
header('Pragma: no-cache');
header('Expires: 0');
$newheader = $phpgw_setup->generate_header();
echo $newheader;
break;
case 'view':
check_form_values();
$header_template = new Template('../');
$phpgw_setup->show_header('Generated header.inc.php', False, 'header');
echo '<br>Save this text as contents of your header.inc.php<br><hr>';
$newheader = $phpgw_setup->generate_header();
echo '<pre>';
echo htmlentities($newheader);
echo '</pre><hr>';
echo '<form action="index.php" method=post>';
echo '<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo '<input type=hidden name="FormLogout" value="header">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body></html>';
break;
case 'write config':
check_form_values();
$header_template = new Template('../');
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
{
$newheader = $phpgw_setup->generate_header();
$fsetup = fopen('../header.inc.php','wb');
fwrite($fsetup,$newheader);
fclose($fsetup);
$phpgw_setup->show_header('Saved header.inc.php', False, 'header');
echo '<form action="index.php" method=post>';
echo '<br>Created header.inc.php! ';
echo '<input type=hidden name="FormLogout" value="header">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body></html>';
break;
}
else
{
$phpgw_setup->show_header('Error generating header.inc.php', False, 'header');
echo 'Could not open header.inc.php for writing!<br>' . "\n";
echo 'Please check read/write permissions on directories or back up and use another option.<br>';
echo '</td></tr></table></body></html>';
}
break;
default:
$phpgw_setup->show_header($phpgw_info['setup']['HeaderFormMSG'], False, 'header');
echo $phpgw_info['setup']['PageMSG'];
/*
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
echo ' <tr><td align="center" WIDTH="20%" bgcolor="486591" colspan=2><font color="fefefe">Analysis</td></tr>';
echo '</table>';
*/
echo '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
echo '<tr bgcolor="486591"><td align="center" colspan=2><font color="fefefe"> Analysis </font></td></tr><tr><td colspan=2>';
// Hardly try to find what DB-support is compiled in
// this dont work with PHP 3.0.10 and lower !
$supported_db = array();
if (extension_loaded('mysql') || function_exists('mysql_connect'))
{
echo 'You appear to have MySQL support enabled<br>' . "\n";
$supported_db[] = 'mysql';
}
else
{
echo 'No MySQL support found. Disabling<br>' . "\n";
}
if (extension_loaded('pgsql') || function_exists('pg_connect'))
{
echo 'You appear to have Postgres-DB support enabled<br>' . "\n";
$supported_db[] = 'pgsql';
}
else
{
echo 'No Postgres-DB support found. Disabling<br>' . "\n";
}
if (extension_loaded('mssql') || function_exists('mssql_connect'))
{
echo 'You appear to have Microsoft SQL Server support enabled<br>' . "\n";
$supported_db[] = 'mssql';
}
else
{
echo 'No Microsoft SQL Server support found. Disabling<br>' . "\n";
}
if (extension_loaded('oci8'))
{
echo 'You appear to have Oracle V8 (OCI) support enabled<br>' . "\n";
$supported_db[] = 'oracle';
}
else
{
if(extension_loaded('oracle'))
{
echo 'You appear to have Oracle support enabled<br>' . "\n";
$supported_db[] = 'oracle';
}
else
{
echo 'No Oracle-DB support found. Disabling<br>' . "\n";
}
}
if(!count($supported_db))
{
echo '<b><p align=center><font size=+2 color=red>did not found any valid DB support !<br>try to configure your php to support one of the above mentioned dbs or install phpgroupware by hand </font></p></b><td></tr></table></body></html>';
exit;
}
$no_guess = false;
if(file_exists('../header.inc.php') && is_file('../header.inc.php'))
{
echo 'Found existing configuration file. Loading settings from the file...<br>' . "\n";
$phpgw_info['flags']['noapi'] = True;
include('../header.inc.php');
$no_guess = true;
/* This code makes sure the newer multi-domain supporting header.inc.php is being used */
if (!isset($phpgw_domain))
{
echo 'Your using an old configuration file format...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
}
else
{
if ($phpgw_info['server']['header_version'] != $phpgw_info['server']['current_header_version'])
{
echo 'Your using an old header.inc.php version...<br>' . "\n";
echo 'Importing old settings into the new format....<br>' . "\n";
}
reset($phpgw_domain);
$default_domain = each($phpgw_domain);
$phpgw_info['server']['default_domain'] = $default_domain[0];
unset ($default_domain); // we kill this for security reasons
$phpgw_info['server']['db_host'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_host'];
$phpgw_info['server']['db_name'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_name'];
$phpgw_info['server']['db_user'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_user'];
$phpgw_info['server']['db_pass'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_pass'];
$phpgw_info['server']['db_type'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['db_type'];
$phpgw_info['server']['config_passwd'] = $phpgw_domain[$phpgw_info['server']['default_domain']]['config_passwd'];
}
if (defined('PHPGW_SERVER_ROOT'))
{
$phpgw_info['server']['server_root'] = PHPGW_SERVER_ROOT;
$phpgw_info['server']['include_root'] = PHPGW_INCLUDE_ROOT;
}
elseif (!isset($phpgw_info['server']['include_root']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
elseif (!isset($phpgw_info['server']['header_version']) && $phpgw_info['server']['header_version'] <= 1.6)
{
$phpgw_info['server']['include_root'] = $phpgw_info['server']['server_root'];
}
}
else
{
echo 'sample configuration not found. using built in defaults<br>' . "\n";
$phpgw_info['server']['server_root'] = '/path/to/phpgroupware';
$phpgw_info['server']['include_root'] = '/path/to/phpgroupware';
/* This is the basic include needed on each page for phpGroupWare application compliance */
$phpgw_info['flags']['htmlcompliant'] = True;
/* These are the settings for the database system */
$phpgw_info['server']['db_host'] = 'localhost';
$phpgw_info['server']['db_name'] = 'phpgroupware';
$phpgw_info['server']['db_user'] = 'phpgroupware';
$phpgw_info['server']['db_pass'] = 'your_password';
$phpgw_info['server']['db_type'] = 'mysql'; //mysql, pgsql (for postgresql), or oracle
/* These are a few of the advanced settings */
$phpgw_info['server']['config_passwd'] = 'changeme';
$phpgw_info['server']['mcrypt_enabled'] = False;
$phpgw_info['server']['mcrypt_version'] = '2.6.3';
srand((double)microtime()*1000000);
$random_char = array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
for ($i=0; $i<30; $i++)
{
$phpgw_info['server']['mcrypt_iv'] .= $random_char[rand(1,count($random_char))];
}
}
// now guessing better settings then the default ones
if(!$no_guess)
{
echo 'Now guessing better values for defaults <br>' . "\n";
$this_dir = dirname($SCRIPT_FILENAME);
$updir = ereg_replace("/setup",'',$this_dir);
$phpgw_info['server']['server_root'] = $updir;
$phpgw_info['server']['include_root'] = $updir;
}
?>
</td></tr>
<tr bgcolor=486591><th colspan=2><font color="fefefe">Settings</font></th></tr>
<form action="<?php echo $PHP_SELF ?>" method=post>
<input type=hidden name="setting[write_config]" value=true>
<tr><td colspan=2><b>Server Root</b><br><input type=text name="setting[server_root]" size=80 value="<?php echo $phpgw_info["server"]["server_root"] ?>"></td></tr>
<tr><td colspan=2><b>Include Root (this should be the same as Server Root unless you know what you are doing)</b><br><input type=text name="setting[include_root]" size=80 value="<?php echo $phpgw_info["server"]["include_root"] ?>"></td></tr>
<tr><td colspan=2><b>Admin password to header manager </b><br><input type=text name="setting[HEADER_ADMIN_PASSWORD]" size=80 value="<?php echo $phpgw_info["server"]["header_admin_password"] ?>"></td></tr>
<br><br>
<tr><td><b>DB Host</b><br><input type=text name="setting[db_host]" value="<?php echo $phpgw_info["server"]["db_host"] ?>"></td><td>Hostname/IP of Databaseserver</td></tr>
<tr><td><b>DB Name</b><br><input type=text name="setting[db_name]" value="<?php echo $phpgw_info["server"]["db_name"] ?>"></td><td>Name of Database</td></tr>
<tr><td><b>DB User</b><br><input type=text name="setting[db_user]" value="<?php echo $phpgw_info["server"]["db_user"] ?>"></td><td>Name of DB User as phpgroupware has to connect as</td></tr>
<tr><td><b>DB Password</b><br><input type=text name="setting[db_pass]" value="<?php echo $phpgw_info["server"]["db_pass"] ?>"></td><td>Password of DB User</td></tr>
<tr><td><b>DB Type</b><br><select name="setting[db_type]">
<?php
$selected = "";
$found_dbtype = false;
while(list($k,$v) = each($supported_db))
{
if($v == $phpgw_info["server"]["db_type"])
{
$selected = " selected ";
$found_dbtype = true;
}
else
{
$selected = "";
}
print "<option $selected value=\"$v\">$v\n";
}
?>
</select>
</td><td>What Database do you want to use with PHPGroupWare?
<tr><td><b>Configuration Password</b><br><input type=text name="setting[config_pass]" value="<?php echo $phpgw_info["server"]["config_passwd"] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td colspan=2><b>Enable MCrypt</b><br>
<select name="setting[enable_mcrypt]">
<?php if($phpgw_info["server"]["mcrypt_enabled"] == True) { ?>
<option value=True selected>True
<option value=False>False
<?php } else { ?>
<option value=True>True
<option value=False selected>False
<?php } ?>
</select>
</td></tr>
<tr><td><b>MCrypt version</b><br><input type=text name="setting[mcrypt_version]" value="<?php echo $phpgw_info["server"]["versions"]["mcrypt"] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type=text name="setting[mcrypt_iv]" value="<?php echo $phpgw_info["server"]["mcrypt_iv"] ?>" size="30"></td><td>It should be around 30 bytes in length.<br>Note: The default has been randomly generated.</td></tr>
<tr><td><b>Domain select box on login</b><br>
<select name="setting[domain_selectbox]">
<option value="True"<?php echo ($phpgw_info["server"]["domain_selectbox"]?" selected":""); ?>>True</option>
<option value="False"<?php echo (! $phpgw_info["server"]["domain_selectbox"]?" selected":""); ?>>False</option>
</select></td><td></td>
</tr>
</table>
<?php
if(!$found_dbtype)
{
echo '<br><font color=red>Warning!<br>The db_type in defaults ('.$phpgw_info['server']['db_type'].') is not supported on this server. using first supported type.</font>';
}
echo "<br>";
if(is_writeable ('../header.inc.php')|| (!file_exists ('../header.inc.php') && is_writeable ('../')))
{
echo '<input type=submit name="action" value="write config">';
echo ' or <input type=submit name="action" value="download"> or <input type=submit name="action" value="view"> the file.</form>';
}
else
{
echo 'Cannot create the header.inc.php due to file permission restrictions.<br> Instead you can ';
echo '<input type=submit name="action" value="download">or <input type=submit name="action" value="view"> the file.</form>';
}
echo '<form action="index.php" method=post>';
echo '<br> After retrieving the file put it into place as the header.inc.php, then click continue.<br>';
echo '<input type=hidden name="FormLogout" value="header">';
//echo '<input type=hidden name="FormLogout" value="config">';
//echo '<input type=hidden name="ConfigLogin" value="Login">';
//echo '<input type=hidden name="FormPW" value="'.$phpgw_domain[$phpgw_info["server"]["default_domain"]]["config_passwd"].'">';
//echo '<input type=hidden name="FormDomain" value="'.$phpgw_info["server"]["default_domain"].'">';
echo '<input type=submit name="junk" value="continue">';
echo '</form>';
echo '</body>';
echo '</html>';
break; // ending the switch default
}
?>

257
setup/schematoy.php Normal file
View File

@ -0,0 +1,257 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup - Developer tools *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$DEBUG = True;
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include ('./inc/functions.inc.php');
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_main' => 'schema.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$setup_tpl->set_block('T_setup_main','header','header');
$setup_tpl->set_block('T_setup_main','app_header','app_header');
$setup_tpl->set_block('T_setup_main','apps','apps');
$setup_tpl->set_block('T_setup_main','detail','detail');
$setup_tpl->set_block('T_setup_main','table','table');
$setup_tpl->set_block('T_setup_main','hook','hook');
$setup_tpl->set_block('T_setup_main','dep','dep');
$setup_tpl->set_block('T_setup_main','app_footer','app_footer');
$setup_tpl->set_block('T_setup_main','submit','submit');
$setup_tpl->set_block('T_setup_main','footer','footer');
// Check header and authentication
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
if ($phpgw_info['setup']['stage']['header'] != '10')
{
Header("Location: manageheader.php");
exit;
}
elseif (!$phpgw_setup->auth('Config'))
{
$phpgw_setup->show_header(lang('Please login'),True);
$phpgw_setup->login_form();
$phpgw_setup->show_footer();
exit;
}
$bgcolor = array('DDDDDD','EEEEEE');
function parsedep($depends,$main=True)
{
$depstring = '(';
while (list($a,$b) = each ($depends))
{
while (list($c,$d) = each($b))
{
if (is_array($d))
{
$depstring .= $c . ': ' .implode(',',$d) . '; ';
$depver[] = $d;
}
else
{
$depstring .= $c . ': ' . $d . '; ';
$depapp[] = $d;
}
}
}
$depstring .= ')';
if ($main)
{
return $depstring;
}
else
{
return array($depapp,$depver);
}
}
$phpgw_setup->loaddb();
$phpgw_info['setup']['stage']['db'] = $phpgw_setup->check_db();
$setup_info = $phpgw_setup->get_versions();
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->get_db_versions($setup_info);
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->compare_versions($setup_info);
//var_dump($setup_info);exit;
$setup_info = $phpgw_setup->check_depends($setup_info);
//var_dump($setup_info);exit;
@ksort($setup_info);
if ($cancel)
{
Header("Location: index.php");
exit;
}
$phpgw_setup->show_header(lang("Developers' Table Schema Toy"),False,'config',$ConfigDomain);
if ($submit)
{
$setup_tpl->set_var('description',lang('App process') . ':');
$setup_tpl->pparse('out','header');
while (list($appname,$key) = @each($install))
{
$terror = array();
$terror[$appname]['name'] = $appname;
$terror[$appname]['version'] = $version[$appname];
$terror[$appname]['status'] = 'U';
$appdir = PHPGW_SERVER_ROOT . SEP . $appname . SEP . 'setup' . SEP;
// Drop newest tables
$terror[$appname]['tables'] = $setup_info[$appname]['tables'];
$phpgw_setup->process_droptables($terror,$DEBUG);
$terror[$appname]['tables'] = array();
// Reset tables field to baseline table names
if (file_exists($appdir.'tables_baseline.inc.php'))
{
include($appdir.'tables_baseline.inc.php');
while(list($table,$null) = @each($phpgw_baseline))
{
$terror[$appname]['tables'][] = $table;
echo '<br>Adding app table: ' . $table;
}
}
if($version[$appname])
{
echo '<br>Processing ' . $terror[$appname]['name'] . ' to ' . $version[$appname];
$terror = $phpgw_setup->process_droptables($terror,$DEBUG);
$phpgw_setup->deregister_app($terror[$appname]['name']);
$terror = $phpgw_setup->process_baseline($terror,$DEBUG);
$terror = $phpgw_setup->process_test_data($terror,$DEBUG);
$terror = $phpgw_setup->process_upgrade($terror,$DEBUG);
}
else
{
echo '<br>Baseline-only completed for ' . $terror[$appname]['name'];
}
echo '<br>' . $setup_info[$appname]['title'] . ' '
. lang('tables installed, unless there are errors printed above') . '.';
$setup_info[$appname]['version'] = $terror[$appname]['version'];
$phpgw_setup->register_app($terror[$appname]['name']);
echo '<br>' . $terror[$appname]['title'] . ' ' . lang('registered') . '.';
}
echo '<br><a href="schematoy.php">' . lang('Go back') . '</a>';
$setup_tpl->pparse('out','footer');
exit;
}
if($detail)
{
@ksort($setup_info[$detail]);
@reset($setup_info[$detail]);
$setup_tpl->set_var('description',lang('App details') . ':');
$setup_tpl->pparse('out','header');
while (list($key,$val) = each($setup_info[$detail]))
{
if ($i) { $i = 0; }
else { $i = 1; }
//if(!$val) { $val = 'none'; }
if ($key == 'tables')
{
if(is_array($val))
{
$key = '<a href="sqltoarray.php?appname=' . $detail . '&submit=True">' . $key . '</a>' . "\n";
$val = implode(',',$val);
}
}
if ($key == 'hooks') { $val = implode(',',$val); }
if ($key == 'depends') { $val = parsedep($val); }
if (is_array($val)) { $val = implode(',',$val); }
$setup_tpl->set_var('bg_color',$bgcolor[$i]);
$setup_tpl->set_var('name',$key);
$setup_tpl->set_var('details',$val);
$setup_tpl->pparse('out','detail');
}
echo '<br><a href="schematoy.php">' . lang('Go back') . '</a>';
$setup_tpl->pparse('out','footer');
exit;
}
else
{
$setup_tpl->set_var('description',lang("Select an app, enter a target version, then submit to process to that version.<br>If you do not enter a version, only the baseline tables will be installed for the app.<br><blink>THIS WILL DROP ALL OF THE APPS' TABLES FIRST!</blink>"));
$setup_tpl->pparse('out','header');
$setup_tpl->set_var('appdata',lang('Application Data'));
$setup_tpl->set_var('actions',lang('Actions'));
$setup_tpl->set_var('action_url','schematoy.php');
$setup_tpl->set_var('app_info',lang('Application Name and Status'));
$setup_tpl->set_var('app_title',lang('Application Title'));
$setup_tpl->set_var('app_version',lang('Target Version'));
$setup_tpl->set_var('app_install',lang('Process'));
$setup_tpl->pparse('out','app_header');
@reset ($setup_info);
while (list ($key, $value) = each ($setup_info))
{
if($value['name'])
{
if ($i)
{
$i = 0;
}
else
{
$i = 1;
}
$setup_tpl->set_var('apptitle',$value['title']);
$setup_tpl->set_var('currentver',$value['currentver']);
$setup_tpl->set_var('bg_color',$bgcolor[$i]);
$setup_tpl->set_var('instimg','completed.gif');
$setup_tpl->set_var('instalt',lang('Completed'));
$setup_tpl->set_var('install','<input type="checkbox" name="install[' . $value['name'] . ']">');
$status = lang('OK') . ' - ' . $value['status'];
$setup_tpl->set_var('appinfo',$value['name'] . '-' . $status);
$setup_tpl->set_var('appname',$value['name']);
$setup_tpl->pparse('out','apps',True);
}
}
}
$setup_tpl->set_var('submit',lang('Submit'));
$setup_tpl->set_var('cancel',lang('Cancel'));
$setup_tpl->pparse('out','app_footer');
$setup_tpl->pparse('out','footer');
$phpgw_setup->show_footer();
?>

169
setup/setup_demo.php Normal file
View File

@ -0,0 +1,169 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
// Little file to setup a demo install
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => "home",
'noapi' => True
);
include('./inc/functions.inc.php');
include('../header.inc.php');
// Authorize the user to use setup app and load the database
// Does not return unless user is authorized
if (!$phpgw_setup->auth('Config'))
{
Header('Location: index.php');
exit;
}
if (!$submit)
{
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_demo' => 'setup_demo.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$phpgw_setup->show_header(lang('Demo Server Setup'));
$setup_tpl->set_var('action_url','setup_demo.php');
$setup_tpl->set_var('description',lang('This will create 1 admin account and 3 demo accounts<br>The username/passwords are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING ACCOUNTS!!!</b><br>'));
$setup_tpl->set_var('detailadmin',lang('Details for Admin account'));
$setup_tpl->set_var('adminusername',lang('Admin username'));
$setup_tpl->set_var('adminfirstname',lang('Admin first name'));
$setup_tpl->set_var('adminlastname',lang('Admin last name'));
$setup_tpl->set_var('adminpassword',lang('Admin password'));
$setup_tpl->set_var('adminpassword2',lang('Re-enter password'));
$setup_tpl->set_var('lang_submit',lang('submit'));
$setup_tpl->pparse('out','T_setup_demo');
$phpgw_setup->show_footer();
}
else
{
if ($passwd != $passwd2)
{
echo lang('Passwords did not match, please re-enter') . '.';
exit;
}
if (!$username)
{
echo lang('You must enter a username for the admin') . '.';
exit;
}
$phpgw_setup->loaddb();
$phpgw_setup->db->transaction_begin();
/* First clear out existing tables */
$phpgw_setup->db->query("delete from phpgw_accounts");
$phpgw_setup->db->query("delete from phpgw_preferences");
$phpgw_setup->db->query("delete from phpgw_acl");
$defaultprefs = 'a:5:{s:6:"common";a:10:{s:9:"maxmatchs";s:2:"15";s:12:"template_set";s:8:"verdilak";s:5:"theme";s:6:"purple";s:13:"navbar_format";s:5:"icons";s:9:"tz_offset";N;s:10:"dateformat";s:5:"m/d/Y";s:10:"timeformat";s:2:"12";s:4:"lang";s:2:"en";s:11:"default_app";N;s:8:"currency";s:1:"$";}s:11:"addressbook";a:1:{s:0:"";s:4:"True";}:s:8:"calendar";a:4:{s:13:"workdaystarts";s:1:"7";s:11:"workdayends";s:2:"15";s:13:"weekdaystarts";s:6:"Monday";s:15:"defaultcalendar";s:9:"month.php";}}';
$defaultgroupid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$defaultgroupid.", 'Default', 'g', '".md5($passwd)."', 'Default', 'Group', ".time().", 'A')";
$phpgw_setup->db->query($sql);
$admingroupid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$admingroupid.", 'Admins', 'g', '".md5($passwd)."', 'Admin', 'Group', ".time().", 'A')";
$phpgw_setup->db->query($sql);
/* Create records for demo accounts */
$accountid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$accountid.", 'demo', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo', 'Account', ".time().", 'A')";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)");
$accountid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$accountid.", 'demo2', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo2', 'Account', ".time().", 'A')";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_account, acl_location, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)");
$accountid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$accountid.", 'demo3', 'u', '084e0343a0486ff05530df6c705c8bb4', 'Demo3', 'Account', ".time().", 'A')";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 0)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)");
/* Create records for administrator account */
$accountid = mt_rand (100, 600000);
$sql = "insert into phpgw_accounts";
$sql .= "(account_id, account_lid, account_type, account_pwd, account_firstname, account_lastname, account_lastpwd_change, account_status)";
$sql .= "values (".$accountid.", '$username', 'u', '".md5($passwd)."', '$fname', '$lname', ".time().", 'A')";
$phpgw_setup->db->query($sql);
$phpgw_setup->db->query("insert into phpgw_preferences (preference_owner, preference_value) values ('$accountid', '$defaultprefs')");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$defaultgroupid."', $accountid, 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('phpgw_group', '".$admingroupid."', $accountid, 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights)values('preferences', 'changepassword', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('admin', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('addressbook', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('filemanager', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('calendar', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('email', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('notes', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('nntp', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('todo', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("insert into phpgw_acl (acl_appname, acl_location, acl_account, acl_rights) values('manual', 'run', ".$accountid.", 1)");
$phpgw_setup->db->query("update phpgw_accounts set account_expires='-1'",__LINE__,__FILE__);
$phpgw_setup->db->transaction_commit();
Header("Location: index.php");
exit;
}
?>

261
setup/sqltoarray.php Normal file
View File

@ -0,0 +1,261 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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$ */
$phpgw_info['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'home',
'noapi' => True
);
include ('./inc/functions.inc.php');
$tpl_root = $phpgw_setup->setup_tpl_dir('setup');
$setup_tpl = CreateObject('phpgwapi.Template',$tpl_root);
if ($download)
{
$setup_tpl->set_file(array(
'sqlarr' => 'arraydl.tpl'
));
$setup_tpl->set_var('idstring',"/* \$Id" . ": tables_current.inc.php" . ",v 1.0" . " 2001/05/28 08:42:04 username " . "Exp \$ */");
$setup_tpl->set_block('sqlarr','sqlheader','sqlheader');
$setup_tpl->set_block('sqlarr','sqlbody','sqlbody');
$setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter');
}
else
{
$setup_tpl->set_file(array(
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl',
'T_alert_msg' => 'msg_alert_msg.tpl',
'T_login_main' => 'login_main.tpl',
'T_login_stage_header' => 'login_stage_header.tpl',
'T_setup_main' => 'schema.tpl',
'applist' => 'applist.tpl',
'sqlarr' => 'sqltoarray.tpl',
'T_head' => 'head.tpl',
'T_footer' => 'footer.tpl'
));
$setup_tpl->set_block('T_login_stage_header','B_multi_domain','V_multi_domain');
$setup_tpl->set_block('T_login_stage_header','B_single_domain','V_single_domain');
$setup_tpl->set_block('T_setup_main','header','header');
$setup_tpl->set_block('applist','appheader','appheader');
$setup_tpl->set_block('applist','appitem','appitem');
$setup_tpl->set_block('applist','appfooter','appfooter');
$setup_tpl->set_block('sqlarr','sqlheader','sqlheader');
$setup_tpl->set_block('sqlarr','sqlbody','sqlbody');
$setup_tpl->set_block('sqlarr','sqlfooter','sqlfooter');
}
// Check header and authentication
$phpgw_info['setup']['stage']['header'] = $phpgw_setup->check_header();
if ($phpgw_info['setup']['stage']['header'] != '10')
{
Header("Location: manageheader.php");
exit;
}
elseif (!$phpgw_setup->auth('Config'))
{
$phpgw_setup->show_header(lang('Please login'),True);
$phpgw_setup->login_form();
$phpgw_setup->show_footer();
exit;
}
$phpgw_setup->loaddb();
function parse_vars($table,$term)
{
global $phpgw_setup,$setup_tpl;
$setup_tpl->set_var('table', $table);
$setup_tpl->set_var('term',$term);
list($arr,$pk,$fk,$ix,$uc) = $phpgw_setup->sql_to_array($table);
$setup_tpl->set_var('arr',$arr);
if (count($pk) > 1)
{
$setup_tpl->set_var('pks', "'".implode("','",$pk)."'");
}
elseif($pk && !empty($pk))
{
$setup_tpl->set_var('pks', "'" . $pk[0] . "'");
}
else
{
$setup_tpl->set_var('pks','');
}
if (count($fk) > 1)
{
$setup_tpl->set_var('fks', "'" . implode("','",$fk) . "'");
}
elseif($fk && !empty($fk))
{
$setup_tpl->set_var('fks', "'" . $fk[0] . "'");
}
else
{
$setup_tpl->set_var('fks','');
}
if (count($ix) > 1)
{
$setup_tpl->set_var('ixs', "'" . implode("','",$ix) . "'");
}
elseif($ix && !empty($ix))
{
$setup_tpl->set_var('ixs', "'" . $ix[0] . "'");
}
else
{
$setup_tpl->set_var('ixs','');
}
if (count($uc) > 1)
{
$setup_tpl->set_var('ucs', "'" . implode("','",$uc) . "'");
}
elseif($uc && !empty($uc))
{
$setup_tpl->set_var('ucs', "'" . $uc[0] . "'");
}
else
{
$setup_tpl->set_var('ucs','');
}
}
function printout($template)
{
global $download,$setup_tpl,$appname,$table,$showall;
if ($download)
{
$setup_tpl->set_var('appname',$appname);
$string = $setup_tpl->parse('out',$template);
}
else
{
$setup_tpl->set_var('appname',$appname);
$setup_tpl->set_var('table',$table);
$setup_tpl->set_var('lang_download','Download');
$setup_tpl->set_var('showall',$showall);
$setup_tpl->set_var('action_url','sqltoarray.php');
$setup_tpl->pfp('out',$template);
}
return $string;
}
function download_handler($dlstring,$fn='tables_current.inc.php')
{
//include( PHPGW_SERVER_ROOT . '/phpgwapi/inc/class.browser.inc.php');
$b = CreateObject('phpgwapi.browser');
$b->content_header($fn);
echo $dlstring;
exit;
}
if ($submit || $showall)
{
$dlstring = '';
if (!$download)
{
$phpgw_setup->show_header();
}
if ($showall)
{
$table = $appname = '';
}
if(!$table && !$appname)
{
$term = ',';
$dlstring .= printout('sqlheader');
$db = $phpgw_setup->db;
$db->query("SHOW TABLES");
while($db->next_record())
{
$table = $db->f(0);
parse_vars($table,$term);
$dlstring .= printout('sqlbody');
}
$dlstring .= printout('sqlfooter');
}
elseif($appname)
{
$dlstring .= printout('sqlheader');
$term = ',';
if(!$setup_info[$appname]['tables'])
{
$f = PHPGW_SERVER_ROOT . '/' . $appname . '/setup/setup.inc.php';
if (file_exists ($f)) { include($f); }
}
//$tables = explode(',',$setup_info[$appname]['tables']);
$tables = $setup_info[$appname]['tables'];
while(list($key,$table) = @each($tables))
{
parse_vars($table,$term);
$dlstring .= printout('sqlbody');
}
$dlstring .= printout('sqlfooter');
}
elseif($table)
{
$term = ';';
parse_vars($table,$term);
$dlstring .= printout('sqlheader');
$dlstring .= printout('sqlbody');
$dlstring .= printout('sqlfooter');
}
if ($download)
{
download_handler($dlstring);
}
}
else
{
$phpgw_setup->show_header();
$setup_tpl->set_var('action_url','sqltoarray.php');
$setup_tpl->set_var('lang_submit','Show selected');
$setup_tpl->set_var('lang_showall','Show all');
$setup_tpl->set_var('title','SQL to schema_proc array util');
$setup_tpl->set_var('lang_applist','Applications');
$setup_tpl->pfp('out','appheader');
$d = dir(PHPGW_SERVER_ROOT);
while($entry=$d->read())
{
$f = PHPGW_SERVER_ROOT . '/' . $entry . '/setup/setup.inc.php';
if (file_exists ($f)) { include($f); }
}
while (list($key,$data) = @each($setup_info))
{
if ($data['tables'] && $data['title'])
{
$setup_tpl->set_var('appname',$data['name']);
$setup_tpl->set_var('apptitle',$data['title']);
$setup_tpl->pfp('out','appitem');
}
}
$setup_tpl->pfp('out','appfooter');
}
?>

View File

@ -0,0 +1,94 @@
<!-- BEGIN header -->
<br>
<div align="center">
<table border="0" width="70%" cellspacing="0" cellpadding="2">
<tr>
<td align="center">{description}</td>
</tr>
</table>
<table border="0" width="70%">
<!-- END header -->
<!-- BEGIN app_header -->
<form method="POST" action="{action_url}">
<tr>
<td colspan="5" bgcolor="486591"><center><font color="fefefe">{appdata}</font></center></td>
<td colspan="4" bgcolor="486591"><center><font color="fefefe">{actions}</font></center></td>
</tr>
<tr bgcolor="99cccc">
<td colspan="2">{app_info}</td>
<td align="center">{app_title}</td>
<td align="center">{app_currentver}</td>
<td align="center">{app_version}</td>
<td align="center">{app_install}</td>
<td align="center">{app_upgrade}</td>
<td align="center">{app_resolve}</td>
<td align="center">{app_remove}</td>
</tr>
<!-- END app_header -->
<!-- BEGIN apps -->
<tr bgcolor="{bg_color}">
<td><a href="applications.php?detail={appname}"><img src="templates/default/images/{instimg}" alt="{instalt}" border="0"></a></td>
<td>{appinfo}&nbsp;</td>
<td>{apptitle}&nbsp;</td>
<td>{currentver}&nbsp;</td>
<td>{version}&nbsp;</td>
<td bgcolor="CCFFCC" align="center">{install}</td>
<td bgcolor="CCCCFF" align="center">{upgrade}</td>
<td align="center">{resolution}&nbsp;</td>
<td bgcolor="CCAAAA" align="center">{remove}</td>
</tr>
<!-- END apps -->
<!-- BEGIN detail -->
<tr bgcolor="{bg_color}">
<td>{name}&nbsp;</td><td>{details}&nbsp;</td>
</tr>
<!-- END detail -->
<!-- BEGIN table -->
<tr bgcolor="{bg_color}">
<td>{tables}</td>
</tr>
<!-- END table -->
<!-- BEGIN hook -->
<tr bgcolor="{bg_color}">
<td>{hooks}</td>
</tr>
<!-- END hook -->
<!-- BEGIN dep -->
<tr bgcolor="{bg_color}">
<td>{deps}</td>
</tr>
<!-- END dep -->
<!-- BEGIN resolve -->
<tr bgcolor="{bg_color}">
<td>{resolution}</td>
</tr>
<!-- END resolve -->
<!-- BEGIN submit -->
{goback]
<!-- END submit -->
<!-- BEGIN app_footer -->
</table>
<table border="0" width="70%" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="{submit}">
<input type="submit" name="cancel" value="{cancel}">
</td>
</tr>
</table>
</form>
<!-- END app_footer -->
<!-- BEGIN footer -->
</table>
</div>
<!-- END footer -->

View File

@ -0,0 +1,41 @@
<!-- BEGIN appheader -->
<p><b>{lang_applist}:</b><hr><p>
<table width="60%" border="0" align="center" cellspacing="1" cellpadding="1">
<tr>
<td align="center">Select an application/module, or click 'Show all' to convert all tables.</td>
</tr>
<tr>
<td align="center">The following apps have tables:</td>
</tr>
</table>
<table width="60%" border="0" align="center" cellspacing="1" cellpadding="1">
<form method="POST" action="{action_url}">
<tr bgcolor="DDDDDD">
<td>&nbsp;</td>
<td>Name</td>
<td colspan="2">Title</td>
</tr>
<!-- END appheader -->
<!-- BEGIN appitem -->
<tr bgcolor="EEEEEE">
<td><input type="radio" name="appname" value="{appname}"></td>
<td>{appname}&nbsp;</td>
<td colspan="2">{apptitle}&nbsp;</td>
</tr>
<!-- END appitem -->
<!-- BEGIN appfooter -->
</table>
<table width="60%" border="0" align="center" cellspacing="1" cellpadding="1">
<tr>
<td align="left" width="7%">
<input type="submit" name="submit" value="{lang_submit}"></td>
<td align="left" width="7%">
<input type="submit" name="showall" value="{lang_showall}">
</td>
<td><input type="checkbox" name="download" value="1">Select to download file</td>
</tr>
</form>
</table>
<!-- END appfooter -->

View File

@ -0,0 +1,34 @@
<!-- BEGIN sqlheader --><?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.phpgroupware.org *
* -------------------------------------------- *
* 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. *
\**************************************************************************/
/**************************************************************************\
* This file should be generated for you. It should never be edited by hand *
\**************************************************************************/
{idstring}
// table array for {appname}
$phpgw_baseline = array(
<!-- END sqlheader -->
<!-- BEGIN sqlbody -->
'{table}' => array(
'fd' => array(
{arr} ){term}
'pk' => array({pks}),
'fk' => array({fks}),
'ix' => array({ixs}),
'uc' => array({ucs})
){term}
<!-- END sqlbody -->
<!-- BEGIN sqlfooter -->
);
?>
<!-- END sqlfooter -->

View File

@ -0,0 +1,20 @@
<!-- begin config_post_script.tpl -->
<tr bgcolor="FFFFFF">
<td colspan="2" align="center">
&nbsp;
</td>
</tr>
<tr bgcolor="FFFFFF">
<td colspan="2" align="center">
{more_configs}
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="{lang_submit}">
<input type="submit" name="cancel" value="{lang_cancel}">
</td>
</tr>
</table>
</form>
<!-- end config_post_script.tpl -->

View File

@ -0,0 +1,4 @@
<!-- begin config_pre_script.tpl -->
<form method="POST" action="config.php">
<table border="0" align="center">
<!-- end config_pre_script.tpl -->

View File

@ -0,0 +1,3 @@
<!-- footer.tpl -->
</body>
</html>

View File

@ -0,0 +1,30 @@
<html>
<head>
<META name="AUTHOR" content="phpGroupWare http://www.phpgroupware.org">
<META NAME="description" CONTENT="phpGroupWare">
<META NAME="keywords" CONTENT="phpGroupWare">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-control" CONTENT="no-cache">
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset={lang_charset}">
<style type="text/css">
<!--
.link { color: #FFFFFF; }
-->
</style>
<title>phpGroupWare {lang_setup} III {page_title}</title>
</head>
<body bgcolor="#ffffff" margintop="0" marginleft="0" marginright="0" marginbottom="0">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="left" bgcolor="4865F1">
&nbsp;<font color="fefefe">phpGroupWare version {pgw_ver} {lang_setup} III{configdomain}</font>
</td>
<td align="right" bgcolor="4865F1">
{logoutbutton}
</tr>
</table>
<!-- end head.tpl -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,45 @@
<!-- begin lang_main.tpl -->
<p>&nbsp;</p>
<table border="0" align="center" width="{tbl_width}">
<tr bgcolor="486591">
<td colspan="{td_colspan}">
&nbsp;<font color="fefefe">{stage_title}</font>
</td>
</tr>
<tr bgcolor="e6e6e6">
<td colspan="{td_colspan}">
{stage_desc}
</td>
</tr>
<tr bgcolor="e6e6e6">
<td {td_align}>
{select_box_desc}
<form action="lang.php">
{hidden_var1}
<select name="lang_selected[]" multiple size="10">
{select_box_langs}
</select>
</td>
<!-- BEGIN B_choose_method -->
<td valign="top">
{meth_desc}
<br><br>
<input type="radio" name="upgrademethod" value="addonlynew" checked>
&nbsp;{blurb_addonlynew}
<br>
<input type="radio" name="upgrademethod" value="addmissing">
&nbsp;{blurb_addmissing}
<br>
<input type="radio" name="upgrademethod" value="dumpold">
&nbsp;{blurb_dumpold}
</td>
<!-- END B_choose_method -->
</tr>
</table>
<div align="center">
<input type="submit" name="submit" value="{lang_install}">
<input type="submit" name="cancel" value="{lang_cancel}">
</div>
<!-- end lang_main.tpl -->

View File

@ -0,0 +1,101 @@
<!-- BEGIN header -->
<form action="{action_url}" method="POST">
<table border="0" align="center" width="70%">
<tr bgcolor="486591">
<td colspan="2">&nbsp;<font color="fefefe">{ldapimport}</font></td>
</tr>
<tr bgcolor="e6e6e6">
<td colspan="2">&nbsp;{description}<br>&nbsp;</td>
</tr>
<!-- END header -->
<!-- BEGIN jump -->
<table border="0" align="center" width="70%">
<tr bgcolor="486591">
<td colspan="2">&nbsp;<font color="fefefe">{description}</font><br>&nbsp;</td>
</tr>
<tr bgcolor="e6e6e6">
<td colspan="2"><a href="{ldapmodify}">{lang_ldapmodify}</a></td>
</tr>
<tr bgcolor="e6e6e6">
<td colspan="2"><a href="{ldapimport}">{lang_ldapimport}</a></td>
</tr>
<tr bgcolor="e6e6e6">
<td colspan="2"><a href="{ldapexport}">{lang_ldapexport}</a></td>
</tr>
<!-- END jump -->
<!-- BEGIN user_list -->
<tr bgcolor="e6e6e6">
<td align="left" valign="top">
&nbsp;{select_users}
</td>
<td align="center">
<select name="users[]" multiple size="8">
{users}
</select>
</td>
</tr>
<!-- END user_list -->
<!-- BEGIN admin_list -->
<tr bgcolor="e6e6e6">
<td align="left" valign="top">
&nbsp;{select_admins}
</td>
<td align="center">
<select name="admins[]" multiple size="8">
{admins}
</select>
</td>
</tr>
<!-- END admin_list -->
<!-- BEGIN group_list -->
<tr bgcolor="e6e6e6">
<td align="left" valign="top">
&nbsp;{select_groups}
</td>
<td align="center">
<select name="ldapgroups[]" multiple size="5">
{ldapgroups}
</select>
</td>
</tr>
<!-- END group_list -->
<!-- BEGIN app_list -->
<tr bgcolor="e6e6e6">
<td align="left" valign="top">
&nbsp;{select_apps}
<br>&nbsp;{note}
</td>
<td>
<select name="s_apps[]" multiple size="10">
{s_apps}
</select>
</td>
</tr>
<!-- END app_list -->
<!-- BEGIN submit -->
<tr bgcolor="e6e6e6">
<td colspan="2" align="center">
<input type="submit" name="submit" value="{form_submit}">
<input type="submit" name="cancel" value="{cancel}">
</td>
</tr>
<!-- END submit -->
<!-- BEGIN cancel_only -->
<tr bgcolor="e6e6e6">
<td colspan="2" align="center">
<input type="submit" name="cancel" value="{cancel}">
</td>
</tr>
<!-- END cancel_only -->
<!-- BEGIN footer -->
</table>
</form>
<!-- END footer -->

View File

@ -0,0 +1,27 @@
<!-- begin login_main.tpl -->
<p>&nbsp;</p>
<table border="0" align="center">
{V_login_stage_header}
<tr bgcolor="#486591">
<td colspan="2">
<font color="#fefefe">&nbsp;<b>Header Admin Login</b></font>
</td>
</tr>
<tr bgcolor="#e6e6e6">
<td colspan="2">
<font color="#ff0000">{HeaderLoginMSG}</font>
</td>
</tr>
<tr bgcolor="#e6e6e6">
<td>
<form action="manageheader.php" method="POST" name="admin">
<input type="password" name="FormPW" value="">
<input type="submit" name="HeaderLogin" value="Login">
</form>
</td>
</tr>
</table>
<!-- end login_main.tpl -->

View File

@ -0,0 +1,47 @@
<!-- begin login_stage_header.tpl -->
<tr bgcolor="#486591">
<td colspan="2">
<font color="#fefefe">&nbsp;<b>Setup/Config Admin Login</b></font>
</td>
</tr>
<tr bgcolor="#e6e6e6">
<td colspan="2">
<font color="#ff0000">{ConfigLoginMSG}</font>
</td>
</tr>
<tr bgcolor="#e6e6e6">
<td>
<form action="index.php" method="POST" name="config">
<!-- BEGIN B_multi_domain -->
<table>
<tr>
<td>
Domain:
</td>
<td>
<input type="text" name="FormDomain" value="">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="FormPW" value="">
</td>
</tr>
</table>
<!-- END B_multi_domain -->
<!-- &nbsp; stupid seperator -->
<!-- BEGIN B_single_domain -->
<input type="password" name="FormPW" value="">
<input type="hidden" name="FormDomain" value="{default_domain_zero}">
<!-- END B_single_domain -->
{lang_select}
<input type="submit" name="ConfigLogin" value="Login">
</form>
</td>
</tr>
<!-- end login_stage_header.tpl -->

View File

@ -0,0 +1,6 @@
<!-- begin msg_alert_msg.tpl -->
<div align="center">
<h2>{V_alert_word}:</h2>
<h3>{V_alert_msg}</h3>
</div>
<!-- end msg_alert_msg.tpl -->

View File

@ -0,0 +1,86 @@
<!-- BEGIN header -->
<br>
<div align="center">
<table border="0" width="70%" cellspacing="0" cellpadding="2">
<tr>
<td align="center">{description}</td>
</tr>
</table>
<table border="0" width="70%">
<!-- END header -->
<!-- BEGIN app_header -->
<form method="POST" action="{action_url}">
<tr>
<td colspan="4" bgcolor="486591"><center><font color="fefefe">{appdata}</font></center></td>
<td colspan="1" bgcolor="486591"><center><font color="fefefe">{actions}</font></center></td>
</tr>
<tr bgcolor="99cccc">
<td colspan="2">{app_info}</td>
<td align="center">{app_title}</td>
<td align="center">{app_version}</td>
<td align="center">{app_install}</td>
</tr>
<!-- END app_header -->
<!-- BEGIN apps -->
<tr bgcolor="{bg_color}">
<td><a href="schematoy.php?detail={appname}"><img src="templates/default/images/{instimg}" alt="{instalt}" border="0"></a></td>
<td>{appinfo}&nbsp;</td>
<td>{apptitle}&nbsp;</td>
<td align="center"><input name="version[{appname}]"></td>
<td bgcolor="CCFFCC" align="center">{install}</td>
</tr>
<!-- END apps -->
<!-- BEGIN detail -->
<tr bgcolor="{bg_color}">
<td>{name}&nbsp;</td><td>{details}&nbsp;</td>
</tr>
<!-- END detail -->
<!-- BEGIN table -->
<tr bgcolor="{bg_color}">
<td>{tables}</td>
</tr>
<!-- END table -->
<!-- BEGIN hook -->
<tr bgcolor="{bg_color}">
<td>{hooks}</td>
</tr>
<!-- END hook -->
<!-- BEGIN dep -->
<tr bgcolor="{bg_color}">
<td>{deps}</td>
</tr>
<!-- END dep -->
<!-- BEGIN resolve -->
<tr bgcolor="{bg_color}">
<td>{resolution}</td>
</tr>
<!-- END resolve -->
<!-- BEGIN submit -->
{goback]
<!-- END submit -->
<!-- BEGIN app_footer -->
</table>
<table border="0" width="70%" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" align="center">
<input type="submit" name="submit" value="{submit}">
<input type="submit" name="cancel" value="{cancel}">
</td>
</tr>
</table>
</form>
<!-- END app_footer -->
<!-- BEGIN footer -->
</table>
</div>
<!-- END footer -->

View File

@ -0,0 +1,179 @@
<!-- begin setup_db_blocks.tpl -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_1 -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="{notcomplete}" border="0">
</td>
<td>
{dbnotexist}<br>
{makesure}.<br>
<br>
{instr}<br>
<form action="index.php" method="post">
{createdb}<br>
DB root username: <input type="text" name="db_root" value="root">
DB root password: <input type="password" name="db_pass">
<input type="hidden" name="action" value="Create Database">
<input type="submit" name="label" value="{create_database}">
</form>
<form method="POST" action="index.php"> <br>
<input type="submit" value="Re-Check my database">
</form>
</td>
</tr>
<!-- END B_db_stage_1 -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_2 -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="{notcomplete}" border="0">
</td>
<td>
{prebeta}
</td>
</tr>
<!-- END B_db_stage_2 -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_3 -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="{Complete}" border="0">
</td>
<td>
<form action="index.php" method="post">
<input type="hidden" name="oldversion" value="new">
{dbexists}<br>
<input type="hidden" name="action" value="Install">
<input type="submit" name="label" value="{install}"> {allapps}
</form>
</td>
</tr>
<!-- END B_db_stage_3 -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_4 -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="not complete" border="0">
</td>
<td>
{oldver}.<br>
{automatic}
{backupwarn}<br>
<form method="POST" action="index.php">
<input type="hidden" name="oldversion" value="{oldver}">
<input type="hidden" name="useglobalconfigsettings">
<input type="hidden" name="action" value="Upgrade">
<input type="submit" name="label" value="{upgrade}"><br>
</form>
<form method="POST" action="index.php">
<input type="hidden" name="oldversion" value="{oldver}">
<input type="hidden" name="useglobalconfigsettings">
<input type="hidden" name="action" value="Uninstall all applications">
<input type="submit" name="label" value="{uninstall_all_applications}"><br>({dropwarn})
</form>
<form method="POST" action="config.php">
<input type="hidden" name="action" value="Dont touch my data">
<input type="submit" name="label" value="{dont_touch_my_data}">
</form>
</td>
</tr>
<!-- END B_db_stage_4 -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_5_pre -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="{notcomplete}" border="0">
</td>
<td>
<table width="100%">
<tr bgcolor="486591">
<td>
<font color="fefefe">&nbsp;<b>{subtitle}</b></font>
</td>
</tr>
<tr bgcolor="e6e6e6">
<td>
{submsg}
</td>
</tr>
<tr bgcolor="486591">
<td>
<font color="fefefe">&nbsp;<b>{tblchange}</b></font>
</td>
</tr>
<!-- END B_db_stage_5_pre -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_5_post -->
<tr bgcolor="486591">
<td>
<font color="fefefe">&nbsp;<b>{status}</b></font>
</td>
</tr>
<tr bgcolor="e6e6e6">
<td>{tableshave} {subaction}</td>
</tr>
</table>
<form method="POST" action="index.php"> <br>
<input type="submit" value="{re-check_my_installation}">
</form>
</td>
</tr>
<!-- END B_db_stage_5_post -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_10 -->
<tr>
<td align="center">
<img src="{img_completed}" alt="completed" border="0">
</td>
<td>
{tablescurrent}
<form method="POST" action="index.php">
<input type="hidden" name="oldversion" value="new"> <br>
{insanity}:
<input type="hidden" name="action" value="Uninstall all applications">
<input type="submit" name="label" value="{uninstall_all_applications}"><br>({dropwarn})
</form>
</td>
</tr>
<!-- END B_db_stage_10 -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- BEGIN B_db_stage_default -->
<tr>
<td align="center">
<img src="{img_incomplete}" alt="not complete" border="0">
</td>
<td>
<form action="index.php" method="post">
{dbnotexist}.<br>
<input type="submit" value="{create_one_now}">
</form>
</td>
</tr>
<!-- END B_db_stage_default -->
&nbsp; <!-- ================================== --> &nbsp;
<!-- end setup_db_blocks.tpl -->

View File

@ -0,0 +1,42 @@
<!-- BEGIN setup_demo -->
<table border="1" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td>{description}</td>
</tr>
<tr>
<td align="left" bgcolor="486591"><font color="fefefe">{detailadmin}</td><td align="right" bgcolor="486591">&nbsp;
</td>
</tr>
<tr>
<td>
<form method="POST" action="{action_url}">
<table border="0">
<tr>
<td>{adminusername}</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>{adminfirstname}</td>
<td><input type="text" name="fname"></td>
</tr>
<tr>
<td>{adminlastname}</td>
<td><input type="text" name="lname"></td>
</tr>
<tr>
<td>{adminpassword}</td>
<td><input type="password" name="passwd"></td>
</tr>
<tr>
<td>{adminpassword2}</td>
<td><input type="password" name="passwd2"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" value="{lang_submit}"> </td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<!-- END setup_demo -->

View File

@ -0,0 +1,78 @@
<!-- begin setup_main.tpl -->
<!-- begin the db section -->
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="left" bgcolor="486591">
<font color="fefefe">{db_step_text}</font>
</td>
<td align="right" bgcolor="486591">
&nbsp;
</td>
</tr>
{V_db_filled_block}
<!-- end the db section -->
<!-- begin the config section -->
<tr>
<td align="left" bgcolor="486591">
<font color="fefefe">{config_step_text}</font>
</td>
<td align="right" bgcolor="486591">
&nbsp;
</td>
</tr>
<tr>
<td align="center">
<img src="{config_status_img}" alt="{config_status_alt}" border="0">
</td>
<td>
{config_table_data}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
{ldap_table_data}
</td>
</tr>
<!-- end the config section -->
<!-- begin the lang section -->
<tr>
<td align="left" bgcolor="486591">
<font color="fefefe">{lang_step_text}</font>
</td>
<td align="right" bgcolor="486591">
&nbsp;
</td>
</tr>
<tr>
<td align="center">
<img src="{lang_status_img}" alt="{lang_status_alt}" border="0">
</td>
<td>
{lang_table_data}
</td>
</tr>
<!-- end the lang section -->
<!-- begin the apps section -->
<tr>
<td align="left" bgcolor="486591">
<font color="fefefe">{apps_step_text}</font>
</td>
<td align="right" bgcolor="486591">
&nbsp;
</td>
</tr>
<tr>
<td align="center">
<img src="{apps_status_img}" alt="{apps_status_alt}" border="0">
</td>
<td>
{apps_table_data}
</td>
</tr>
<!-- end the apps section -->
</table>
<!-- end setup_main.tpl -->

View File

@ -0,0 +1,36 @@
<!-- BEGIN sqlheader -->
<table colspan="6">
<tr bgcolor="e6e6e6">
<td>
<pre>
$phpgw_baseline = array(
<!-- END sqlheader -->
<!-- BEGIN sqlbody -->
'{table}' => array(
'fd' => array(
{arr} ){term}
'pk' => array({pks}),
'fk' => array({fks}),
'ix' => array({ixs}),
'uc' => array({ucs})
){term}
<!-- END sqlbody -->
<!-- BEGIN sqlfooter -->
);
</pre>
</td>
</tr>
<form method="GET" action="{action_url}">
<tr>
<td align="left" width="7%">
<input type="submit" name="download" value="{lang_download}">
<input type="hidden" name="appname" value="{appname}">
<input type="hidden" name="table" value="{table}">
<input type="hidden" name="showall" value="{showall}">
<input type="hidden" name="submit" value="True">
</td>
</tr>
</form>
</table>
</table>
<!-- END sqlfooter -->

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
#**************************************************************************#
# phpGroupWare #
# http://www.phpgroupware.org #
# -------------------------------------------- #
# 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$ #
# splitlang.pl (c) 2001 Miles Lott
# split common phpgw_LANG.lang files into seperate files for each app
# and language. Requires perl and the source lang files and a dir named
# 'tmp' in the current working dir. May only work in bash also. Makes
# system calls to mkdir and cat.
$dir = opendir(DIR,'.');
#@files = grep { /^phpgw_/ && -f "$dir/$_" } readdir(DIR);
@files = grep { /phpgw/ } readdir(DIR);
closedir(DIR);
for $i (0..$#files)
{
# Run through each lang file
$_ = $files[$i];
print "Working on: " . $_ . "\n";
open(FILE,$_);
while (<FILE>)
{
chomp $_;
($key,$appname,$lang,$content) = split("\t",$_);
if(!stat("tmp/$appname/setup"))
{
my $mkdir = "mkdir -p tmp/$appname/setup";
system($mkdir);
}
my $cmd = 'echo "'. $_ . '" >> tmp/' . $appname . "/setup/phpgw_" . $lang . ".lang";
system($cmd);
#print $appname . "\n";
}
close(FILE);
}

67
setup/tools/sqltolang.pl.txt Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/perl
#**************************************************************************#
# phpGroupWare #
# http://www.phpgroupware.org #
# -------------------------------------------- #
# 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$ #
# sqltolang.pl (c) 2001 Miles Lott
# Take a file of sql commands for lang, create lang files from it
# Requires perl and the source sql file.
# May only work in bash also. Makes system calls to mkdir and cat.
# Takes one arg, the sql filename
# Adjust to taste, this is not intended to be perfect
sub trim
{
my @out = @_;
for (@out)
{
s/^\s+//;
s/\s+$//;
}
return wantarray ? @out : $out[0];
}
print "Working on: " . $ARGV[0] . "\n";
open(FILE,$ARGV[0]);
while (<FILE>)
{
# INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'common items','eldaptir','de','Common Items');
chomp $_;
if (/DELETE/)
{
next;
}
$line = $_;
$line =~ s/REPLACE INTO lang \(//g;
$line =~ s/INSERT INTO lang \(//g;
$line =~ s/VALUES\( \'//g;
$line =~ s/message_id\,//g;
$line =~ s/app_name,//g;
$line =~ s/lang,//g;
$line =~ s/content\)//g;
$line =~ s/','/\t/g;
$line =~ s/'\);//g;
($key,$appname,$lang,$content) = split("\t",$line);
$key = &trim($key);
$appname = &trim($appname);
$lang = &trim($lang);
$content = &trim($content);
if ($lang ne '')
{
$newline = $key . "\t" . $appname . "\t" . $lang . "\t" . $content;
my $cmd = 'echo "'. $newline . '" >> phpgw_' . $lang . ".lang";
system($cmd);
}
}
close(FILE);

106
setup/tools/versions.pl.txt Normal file
View File

@ -0,0 +1,106 @@
#!/usr/bin/perl
#**************************************************************************#
# phpGroupWare #
# http://www.phpgroupware.org #
# -------------------------------------------- #
# 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$ #
# versions.pl (c) 2001 Miles Lott
# Extract and print all app versions, and create a versions.inc.php file.
# This would be run at each release to generate a tab-delimited listing
# of appnames and current versions.
$installdir = '/usr/local/apache/htdocs/phpgroupware/';
$count = $nover = $ver = $i = 0;
@info = @versions = ();
sub get_versions()
{
$d = opendir(DIR,$installdir);
while($entry = readdir(DIR))
{
$found = 0;
$_ = $entry;
if (/\A.\Z/)
{
next;
}
if (!(/setup/ || /tmp/))
{
$setupdir = $installdir . $entry . '/setup/';
my $f = $setupdir . 'setup.inc.php';
if (stat($f))
{
open(FILE,$f);
while(<FILE>)
{
$_ =~ s/"/'/g;
if (/((.*?)version')(.*?)=(.*?)'(.*?)';/)
{
$info[$i] = $entry . "\t" . $5 . "\n";
$found = 1;
$ver++;
$count++;
}
}
close FILE;
}
if (!$found && stat($setupdir))
{
$info[$i] = $entry . "\t0.0.0\n";
$nover++;
$count++;
}
}
$i++;
}
close DIR;
}
get_versions();
if(@info)
{
@versions = sort @info;
reset(@versions);
open(OUT,'>' . $installdir. '/setup/versions.inc.php');
for $i (0..$#versions)
{
print $versions[$i];
print OUT $versions[$i];
}
close OUT;
printf('Found %s applications',$count);
print "\n";
}
if ($ver)
{
if ($ver != $count)
{
printf('%s of these had a valid version string.',$ver);
}
else
{
print 'All had a valid version string.';
}
print "\n";
}
if ($nover)
{
if ($nover != $count)
{
printf('%s of these had no version string.',$nover);
}
else
{
print 'None had a valid version string.';
}
print "\n";
}

39
setup/versions.inc.php Normal file
View File

@ -0,0 +1,39 @@
addressbook 0.9.13.002
admin 0.9.13.002
bookkeeping 0.4
bookmarks 0.8.1
calendar 0.9.13.002
cart 0.8.1
ccs 0.0.0
chat 0.0.0
chora 0.0.4
comic 0.0.1
dj 0.0.3
eldaptir 0.0.4
email 0.9.11
filemanager 0.9.11
forum 0.8.1
ftp 0.8.1
headlines 0.8.1
hr 0.8.1
infolog 0.9.11
inv 0.8.3.009
manual 0.0.0
mediadb 0.0.3
messenger 0.8.1
news_admin 0.0.1
nntp 0.9.11
notes 0.9.13.002
phpgwapi 0.9.13.002
phpwebhosting 0.9.13.001
polls 0.8.1
preferences 0.9.13.002
projects 0.8.5.001
skel 0.0.1.000
squirrelmail 0.8.1
stocks 0.8.1
timetrack 0.9.11
todo 0.9.13.002
transy 0.9.11
tts 0.0.1
weather 0.0.0