2000-12-18 21:09:56 +01:00
|
|
|
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare Application Development
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
Dan Kuykendall <dan@kuykendall.org>
|
|
|
|
|
|
|
|
v0.9 29 September 2000
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
This document explains eGroupWare's infrastructure and API,
|
|
|
|
along with what is required to integrate applications into
|
|
|
|
it.
|
|
|
|
|
|
|
|
Table of Contents
|
|
|
|
|
|
|
|
1 Introduction
|
|
|
|
1.1 Overview of application writing
|
|
|
|
1.2 What does the eGroupWare API provide?
|
|
|
|
2 Guidelines
|
|
|
|
2.1 Requirements
|
|
|
|
2.2 Writing/porting your application
|
|
|
|
3 Installing your application
|
|
|
|
3.1 Overview
|
|
|
|
3.2 Automatic features
|
|
|
|
3.3 Adding files, directories and icons.
|
|
|
|
3.4 Making eGroupWare aware of your application
|
|
|
|
3.5 Hooking into Administration page
|
|
|
|
3.6 Hooking into Preferences page
|
|
|
|
4 Infrastructure
|
|
|
|
4.1 Overview
|
|
|
|
4.2 Directory tree
|
|
|
|
4.3 Translations
|
|
|
|
5 The API
|
|
|
|
5.1 Introduction
|
|
|
|
5.2 Basic functions
|
|
|
|
5.3 Application Functions
|
|
|
|
5.4 File functions
|
|
|
|
5.5 Email/NNTP Functions
|
|
|
|
6 Configuration Variables
|
|
|
|
6.1 Introduction
|
|
|
|
6.2 User information
|
|
|
|
6.3 Group information
|
|
|
|
6.4 Server information
|
|
|
|
6.5 Database information
|
|
|
|
6.6 Mail information
|
|
|
|
6.7 NNTP information
|
|
|
|
6.8 Application information
|
|
|
|
7 Using Language Support
|
|
|
|
7.1 Overview
|
|
|
|
7.2 How to use lang support
|
|
|
|
7.3 Common return codes
|
|
|
|
8 Using Templates
|
|
|
|
8.1 Overview
|
|
|
|
8.2 How to use templates
|
|
|
|
9 About this document
|
|
|
|
9.1 New versions
|
|
|
|
9.2 Comments
|
|
|
|
9.3 History
|
|
|
|
9.4 Copyrights and Trademarks
|
|
|
|
9.5 Acknowledgments and Thanks
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 Introduction
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare is a web based groupware application framework
|
2001-01-10 10:59:20 +01:00
|
|
|
(API), for writing applications. Integrated applications
|
|
|
|
such as email, calendar, todo list, address book, and file
|
2003-12-28 17:32:24 +01:00
|
|
|
manager are included. eGroupWare is a fork of phpGroupWare,
|
|
|
|
for which the original version of this document was written.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
1.1 Overview of application writing
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
We have attempted to make writing applications for eGroupWare
|
2001-01-10 10:59:20 +01:00
|
|
|
as painless as possible. We hope any pain and suffering
|
2003-12-28 17:32:24 +01:00
|
|
|
is caused by making your application work, but not dealing
|
|
|
|
with eGroupWare itself.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
1.2 What does the eGroupWare API provide?
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
The eGroupWare API handles session management, user/group
|
|
|
|
management, has support for multiple databases, using either
|
|
|
|
PHPLIB or ADODB database abstraction methods, we support
|
|
|
|
templates using the PHPLIB Templates class, a file system
|
|
|
|
interface, and even a network i/o interface.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
On top of these standard functions, eGroupWare provides several
|
|
|
|
functions to give you the information you need about the
|
|
|
|
users environment, and to properly plug into eGroupWare.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
2 Guidelines
|
|
|
|
|
|
|
|
2.1 Requirements
|
|
|
|
|
|
|
|
These guidelines must be followed for any application that
|
2003-12-28 17:32:24 +01:00
|
|
|
wants considered for inclusion into eGroupWare:
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* It must run on PHP4 and PHP5.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* SQL statements must be compatible with both MySQL and PostgreSQL.
|
|
|
|
When in doubt it is best to stick with SQL92.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
* It must use our default header.inc.php include.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* It must use our $GLOBALS['phpgw']->link($url) for all links
|
|
|
|
(this is for session support).
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
* It must use "post" for
|
|
|
|
forms.
|
|
|
|
|
|
|
|
* It must respect phpGW group rights and phpGW user permissions.
|
|
|
|
|
|
|
|
* It must use our directory structure, template support and
|
|
|
|
lang (multi-language) support.
|
|
|
|
|
|
|
|
* Where possible it should run on both Unix and NT platforms.
|
|
|
|
|
|
|
|
* For applications that do not meet these requirements, they
|
2003-12-28 17:32:24 +01:00
|
|
|
can be made available to users however you decide. If
|
|
|
|
you need help converting your application to templates
|
|
|
|
and our lang support, we will try to connect you with
|
|
|
|
someone to help.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
2.2 Writing/porting your application
|
|
|
|
|
|
|
|
Include files
|
|
|
|
|
|
|
|
Each PHP page you write will need to include the header.inc.php
|
|
|
|
along with a few variables.
|
|
|
|
This is done by putting this at the top of each PHP page.
|
2003-12-28 17:32:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-01-10 10:59:20 +01:00
|
|
|
Of course change application name to fit.
|
|
|
|
This include will provide the following things:
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* The phpgwAPI - The eGroupWare API will be loaded.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
* The phpGW navbar will be loaded (by default, but can be
|
|
|
|
disabled until a later point.
|
|
|
|
|
|
|
|
* appname/inc/functions.inc.php - This file is loaded just
|
|
|
|
after the phpgwAPI and before any HTML code is generated.
|
|
|
|
This file should include all your application specific
|
|
|
|
functions.. You are welcome to include any additional
|
|
|
|
files you need from within this file.
|
|
|
|
|
|
|
|
* appname/inc/header.inc.php - This file is loaded just after
|
|
|
|
the system header/navbar, and allows developers to use
|
|
|
|
it for whatever they need to load.
|
|
|
|
|
|
|
|
* appname/inc/footer.inc.php - This file is loaded just before
|
|
|
|
the system footer, allowing developers to close connections
|
|
|
|
and whatever else they need.
|
|
|
|
|
|
|
|
* The phpGW footer will be loaded, which closes several connections.
|
|
|
|
|
|
|
|
3 Installing your application
|
|
|
|
|
|
|
|
3.1 Overview
|
|
|
|
|
|
|
|
It is fairly simple to add and delete applications to/from
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
3.2 Automatic features
|
|
|
|
|
|
|
|
To make things easy for developers we go ahead and load the
|
|
|
|
following files.
|
|
|
|
|
|
|
|
* appname/inc/functions.inc.php - This file should include
|
|
|
|
all your application specific functions.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* appname/inc/header.inc.php - This file is loaded by $GLOBALS['phpgw']->common->header
|
2001-01-10 10:59:20 +01:00
|
|
|
just after the system header/navbar, and allows developers
|
|
|
|
to use it for whatever they need to load.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
* appname/inc/footer.inc.php - This file is loaded by $GLOBALS['phpgw']->common->footer
|
2001-01-10 10:59:20 +01:00
|
|
|
just before the system footer, allowing developers to
|
|
|
|
close connections and whatever else they need.
|
|
|
|
|
|
|
|
3.3 Adding files, directories and icons.
|
|
|
|
|
|
|
|
You will need to create the following directories for your
|
|
|
|
code
|
|
|
|
(replace 'appname' with your application name)
|
|
|
|
|
|
|
|
|
|
|
|
`--appname
|
|
|
|
|
|
|
|
|--inc
|
|
|
|
|
|
|
|
| |--functions.inc.php
|
|
|
|
|
|
|
|
| |--header.inc.php
|
|
|
|
|
|
|
|
| |--hook_preferences.inc.php
|
|
|
|
|
|
|
|
| |--hook_admin.inc.php
|
|
|
|
|
|
|
|
| `--footer.inc.php
|
|
|
|
|
|
|
|
`--templates
|
|
|
|
|
|
|
|
| `--default
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
3.4 Making eGroupWare aware of your application
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
Please see the documentation in the setup/doc directory for
|
|
|
|
information on integrating into eGroupWare. This is very
|
|
|
|
important since the steps for database table setup and modification
|
|
|
|
discussed there must be followed.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
3.5 Hooking into Administration page
|
|
|
|
|
|
|
|
When a user goes to the Administration page, it starts appname/inc/hook_admin.inc.php
|
|
|
|
for each application that is enabled, in alphabetical order
|
|
|
|
of application title. If the file exists, it is include()d
|
|
|
|
in the hopes it will display a selection of links to configure
|
|
|
|
that application.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
Simple Example:
|
|
|
|
|
|
|
|
Look at headlines/inc/hook_admin.inc.php and admin/inc/hook_admin.inc.php
|
|
|
|
for more examples.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
Things to note:
|
|
|
|
|
|
|
|
* Links are relative to the admin/index.php file, not your
|
|
|
|
application's base directory. (so use $appname in your
|
|
|
|
link() calls)
|
|
|
|
|
|
|
|
* The file is brought in with include() so be careful to
|
|
|
|
not pollute the name-space too much
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
The standard $GLOBALS['phpgw'] and $GLOBALS['phpgw_info']
|
|
|
|
variables are in-scope, as is $appname which corresponds
|
|
|
|
to the application name in the path.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
There are 2 functions to coordinate the display of each application's
|
|
|
|
links, section_start() and section_end()
|
|
|
|
|
|
|
|
section_start
|
|
|
|
|
|
|
|
section_start($title,$icon_url) starts the section for your
|
|
|
|
application. $title is passed through lang() for you. $icon_url
|
|
|
|
should be page-relative to admin/index.php or an absolute
|
|
|
|
URL.
|
|
|
|
|
|
|
|
section_end
|
|
|
|
|
|
|
|
section_end() closes the section that was started with section_start().
|
|
|
|
|
|
|
|
3.6 Hooking into Preferences page
|
|
|
|
|
|
|
|
The mechanism to hook into the preferences page is identical
|
|
|
|
to the one used to hook into the administration page, however
|
|
|
|
it looks for appname/inc/hook_preferences.inc.php instead
|
|
|
|
of appname/inc/hook_admin.inc.php. The same functions and
|
|
|
|
variables are defined.
|
|
|
|
|
|
|
|
4 Infrastructure
|
|
|
|
|
|
|
|
4.1 Overview
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare attempts to provide developers with a sound directory
|
|
|
|
structure to work from.
|
2001-01-10 10:59:20 +01:00
|
|
|
The directory layout may seem complex at first, but after
|
|
|
|
some use, you will see that it is designed to accommodate
|
|
|
|
a large number of applications and functions.
|
|
|
|
|
|
|
|
4.2 Directory tree
|
|
|
|
|
|
|
|
.--appname
|
|
|
|
|
|
|
|
| |--inc
|
|
|
|
|
|
|
|
| | |--functions.inc.php
|
|
|
|
|
|
|
|
| | |--header.inc.php
|
|
|
|
|
|
|
|
| | |--hook_preferences.ini.php
|
|
|
|
|
|
|
|
| | |--hook_home.inc.php
|
|
|
|
|
|
|
|
| | `--footer.inc.php
|
|
|
|
|
|
|
|
| |--manual
|
|
|
|
|
|
|
|
| |--setup
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| | |--tables_baseline.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| | |--tables_current.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| | |--tables_update.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| | |--setup.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
| `--templates
|
|
|
|
|
|
|
|
| | `--default
|
|
|
|
|
|
|
|
| | `--images
|
|
|
|
|
|
|
|
| |
|
2003-12-28 17:32:24 +01:00
|
|
|
`--navbar.png
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
| |--preferences.php
|
|
|
|
|
|
|
|
|--docs (installation docs)
|
|
|
|
|
|
|
|
|--files
|
|
|
|
|
|
|
|
| |--groups
|
|
|
|
|
|
|
|
| `--users
|
|
|
|
|
|
|
|
`--phpgwapi
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
|--cron (egroupware's optional daemons)
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
|--doc (developer docs)
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
|--inc
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--class.phpgw.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--class.common.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
| `--etc..
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
|--manual
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
|--setup
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--tables_baseline.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--tables_current.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--tables_update.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
| |--setup.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
|--templates
|
|
|
|
|
|
|
|
| |--default
|
|
|
|
|
|
|
|
| | `--images
|
|
|
|
|
|
|
|
| | |--home.gif
|
|
|
|
|
|
|
|
| | `--preferences.gif
|
|
|
|
|
|
|
|
| `--verilak
|
|
|
|
|
|
|
|
| `--images
|
|
|
|
|
|
|
|
|--home.gif
|
|
|
|
|
|
|
|
`--preferences.gif
|
|
|
|
|
|
|
|
`--themes
|
|
|
|
|
|
|
|
`--default.theme
|
|
|
|
|
|
|
|
4.3 Translations
|
|
|
|
|
|
|
|
The translations are now being done thru the database, and
|
|
|
|
will be configurable to use other mechanisms.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
The application, developer_tools, provides developers/translators
|
|
|
|
a nice GUI for building and updating translations.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
5 The API
|
|
|
|
|
|
|
|
5.1 Introduction
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare attempts to provide developers with a useful API
|
|
|
|
to handle common tasks.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
To do this we have created a multi-dimensional class $GLOBALS['phpgw'].
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
This allows for terrific code organization, and help developers
|
|
|
|
easily identify the file that the function is in. All the
|
|
|
|
files that are part of this class are in the inc/core directory
|
|
|
|
and are named to match the sub-class.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
Example: $GLOBALS['phpgw']->send->msg() is in the inc/phpgwapi/phpgw_send.inc.php
|
2001-01-10 10:59:20 +01:00
|
|
|
file.
|
|
|
|
|
|
|
|
5.2 Basic functions
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->link
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->link($url)
|
2001-01-10 10:59:20 +01:00
|
|
|
Add support for session management. ALL links must use this,
|
|
|
|
that includes href's form actions and header location's.
|
|
|
|
|
|
|
|
If you are just doing a form action back to the same page,
|
|
|
|
you can use it without any parameters.
|
|
|
|
|
|
|
|
This function is right at the core of the class because it
|
|
|
|
is used so often, we wanted to save developers a few keystrokes.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
5.3 Application Functions
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->phpgw_header()
|
2001-01-10 10:59:20 +01:00
|
|
|
Print out the start of the HTML page, including the navigation
|
|
|
|
bar and includes appname/inc/header.php
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_footer();
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->phpgw_footer()
|
2001-01-10 10:59:20 +01:00
|
|
|
Prints the system footer, and includes appname/inc/footer.php
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->common->appsession();
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->common->appsession($data)
|
2001-01-10 10:59:20 +01:00
|
|
|
Store important information session information that your
|
|
|
|
application needs.
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->appsession will return the value of your
|
|
|
|
session data is you leave the parameter empty [i.e. $GLOBALS['phpgw']->appsession("")],
|
2001-01-10 10:59:20 +01:00
|
|
|
otherwise it will store whatever data you send to it.
|
|
|
|
You can also store a comma delimited string and use explode()
|
|
|
|
to turn it back into an array when you receive the value
|
|
|
|
back.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
5.4 File functions
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
Please also see the phpgwapi/doc/vfs directory for additional
|
|
|
|
VFS class documentation
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->vfs->read_file
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->read_file($file)
|
2001-01-10 10:59:20 +01:00
|
|
|
Returns the data from $file.
|
|
|
|
You must send the complete path to the file.
|
|
|
|
Example:
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->write_file
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->write_file($file, $contents)
|
2001-01-10 10:59:20 +01:00
|
|
|
Write data to $file.
|
|
|
|
You must send the complete path to the file.
|
|
|
|
Example:
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->read_userfile
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->read_userfile($file)
|
2001-01-10 10:59:20 +01:00
|
|
|
Returns the data from $file, which resides in the users
|
|
|
|
private dir.
|
|
|
|
Example:
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->write_userfile
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->write_userfile($file, $contents)
|
2001-01-10 10:59:20 +01:00
|
|
|
Writes data to $file, which resides in the users private
|
|
|
|
dir.
|
|
|
|
Example:
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->list_userfiles
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->vfs->list_userfiles()
|
2001-01-10 10:59:20 +01:00
|
|
|
Returns an array which has the list of files in the users
|
|
|
|
private dir.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
5.5 Email/NNTP Functions
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->send->msg
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw']->send->msg($service, $to, $subject, $body,
|
|
|
|
$msgtype, $cc, $bcc)
|
2001-01-10 10:59:20 +01:00
|
|
|
Send a message via email or NNTP and returns any error codes.
|
|
|
|
Example:
|
|
|
|
|
|
|
|
6 Configuration Variables
|
|
|
|
|
|
|
|
6.1 Introduction
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare attempts to provide developers with as much information
|
2001-01-10 10:59:20 +01:00
|
|
|
about the user, group, server, and application configuration
|
|
|
|
as possible.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
To do this we provide a multi-dimensional array called '$GLOBALS['phpgw_info'][]',
|
2001-01-10 10:59:20 +01:00
|
|
|
which includes all the information about your environment.
|
|
|
|
|
|
|
|
Due to the multi-dimensional array approach. getting these
|
|
|
|
values is easy.
|
|
|
|
|
|
|
|
Here are some examples:
|
|
|
|
|
|
|
|
6.2 User information
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["userid"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= The user ID.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["sessionid"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= The session ID
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["theme"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Selected theme
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["private_dir"]
|
|
|
|
= Users private dir. Use eGroupWare core functions for access
|
|
|
|
to the files.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["firstname"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Users first name
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["lastname"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Users last name
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["fullname"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Users Full Name
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["groups"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Groups the user is a member of
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["app_perms"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= If the user has access to the current application
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["lastlogin"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Last time the user logged in.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["lastloginfrom"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Where they logged in from the last time.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["lastpasswd_change"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Last time they changed their password.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["passwd"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Hashed password.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["status"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= If the user is enabled.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["logintime"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Time they logged into their current session.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["session_dla"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Last time they did anything in their current session
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["user"]["session_ip"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Current IP address
|
|
|
|
|
|
|
|
6.3 Group information
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["group"]["group_names"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= List of groups.
|
|
|
|
|
|
|
|
6.4 Server information
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["server_root"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Main installation directory
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["include_root"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Location of the 'inc' directory.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["temp_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Directory that can be used for temporarily storing files
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["files_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Directory er and group files are stored
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["common_include_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Location of the core/shared include files.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["template_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Active template files directory. This is defaulted by
|
|
|
|
the server, and changeable by the user.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["dir_separator"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Allows compatibility with WindowsNT directory format,
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["encrpytkey"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Key used for encryption functions
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["site_title"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Site Title will show in the title bar of each webpage.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["webserver_url"]
|
|
|
|
= URL to eGroupWare installation.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["hostname"]
|
|
|
|
= Name of the server eGroupWare is installed upon.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["charset"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= default charset, default:iso-8859-1
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["version"]
|
|
|
|
= eGroupWare version.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
6.5 Database information
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
It is unlikely you will need these, because $GLOBALS['phpgw_info']_db
|
2001-01-10 10:59:20 +01:00
|
|
|
will already be loaded as a database for you to use.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["db_host"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Address of the database server. Usually this is set to
|
|
|
|
localhost.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["db_name"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Database name.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["db_user"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= User name.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["db_pass"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Password
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["db_type"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Type of database. Currently MySQL and PostgreSQL are supported.
|
|
|
|
|
|
|
|
6.6 Mail information
|
|
|
|
|
|
|
|
It is unlikely you will need these, because most email needs
|
2003-12-28 17:32:24 +01:00
|
|
|
are services thru core eGroupWare functions.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["mail_server"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Address of the IMAP server. Usually this is set to localhost.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["mail_server_type"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= IMAP or POP3
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["imap_server_type"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Cyrus or Uwash
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["imap_port"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= This is usually 143, and should only be changed if there
|
|
|
|
is a good reason.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["mail_suffix]
|
2001-01-10 10:59:20 +01:00
|
|
|
= This is the domain name, used to add to email address
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["mail_login_type"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= This adds support for VMailMgr. Generally this should
|
|
|
|
be set to 'standard'.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["smtp_server"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Address of the SMTP server. Usually this is set to localhost.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["smtp_port"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= This is usually 25, and should only be changed if there
|
|
|
|
is a good reason
|
|
|
|
|
|
|
|
6.7 NNTP information
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["nntp_server"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Address of the NNTP server.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["nntp_port"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= This is usually XX, and should only be changed if there
|
|
|
|
is a good reason.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["nntp_sender"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Unknown
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["nntp_organization"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Unknown
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["nntp_admin"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Unknown
|
|
|
|
|
|
|
|
6.8 Application information
|
|
|
|
|
|
|
|
Each application has the following information available.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["apps"]["appname"]["title"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= The title of the application.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["apps"]["appname"]["enabled"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= If the application is enabled. True or False.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["app_include_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Location of the current application include files.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["app_template_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Location of the current application tpl files.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["app_lang_dir"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= Location of the current lang directory.
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["app_auth"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= If the server and current user have access to current
|
|
|
|
application
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
$GLOBALS['phpgw_info']["server"]["app_current"]
|
2001-01-10 10:59:20 +01:00
|
|
|
= name of the current application.
|
|
|
|
|
|
|
|
7 Using Language Support
|
|
|
|
|
|
|
|
7.1 Overview
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare is built using a multi-language support scheme.
|
2001-01-10 10:59:20 +01:00
|
|
|
This means the pages can be translated to other languages
|
|
|
|
very easily. Translations of text strings are stored in
|
2003-12-28 17:32:24 +01:00
|
|
|
the phpGroupWare database, and can be modified by the eGroupWare
|
|
|
|
administrator.
|
|
|
|
|
|
|
|
Please see the setup/doc directory for a document which contains
|
|
|
|
more complete documentation of the language system.
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
7.2 How to use lang support
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
The lang() function is your application's interface to eGroupWare's
|
2001-01-10 10:59:20 +01:00
|
|
|
internationalization support.
|
|
|
|
|
|
|
|
While developing your application, just wrap all your text
|
|
|
|
output with calls to lang(), as in the following code: This
|
|
|
|
will attempt to translate "The
|
|
|
|
counter is %1", and return a translated version
|
|
|
|
based on the current application and language in use. Note
|
|
|
|
how the position that $x will end up is controlled by the
|
|
|
|
format string, not by building up the string in your code.
|
|
|
|
This allows your application to be translated to languages
|
|
|
|
where the actual number is not placed at the end of the
|
|
|
|
string.
|
|
|
|
|
|
|
|
When a translation is not found, the original text will be
|
|
|
|
returned with a * after the string. This makes it easy to
|
|
|
|
develop your application, then go back and add missing translations
|
|
|
|
(identified by the *) later.
|
|
|
|
|
|
|
|
Without a specific translation in the lang table, the above
|
|
|
|
code will print: If the current user speaks Italian, they
|
|
|
|
string returned may instead be:
|
|
|
|
|
|
|
|
The lang function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$key
|
|
|
|
|
|
|
|
is the string to translate and may contain replacement
|
|
|
|
directives of the form %n.
|
|
|
|
|
|
|
|
|
|
|
|
$m1
|
|
|
|
|
|
|
|
is the first replacement value or may be an array of replacement
|
|
|
|
values (in which case $m2 and above are ignored).
|
|
|
|
|
|
|
|
$m2 - $m10
|
|
|
|
|
|
|
|
the 2nd through 10th replacement values if $m1 is not an
|
|
|
|
array.
|
|
|
|
|
|
|
|
The database is searched for rows with a lang.message_id
|
|
|
|
that matches $key. If a translation is not found, the original
|
|
|
|
$key is used. The translation engine then replaces all tokens
|
|
|
|
of the form %N with the Nth parameter (either $m1[N] or
|
|
|
|
$mN).
|
|
|
|
|
|
|
|
Adding translation data
|
|
|
|
|
|
|
|
An application called Transy is being developed to make this
|
|
|
|
easier, until then you can create the translation data manually.
|
|
|
|
|
|
|
|
The lang table
|
|
|
|
|
|
|
|
The translation class uses the lang table for all translations.
|
|
|
|
We are concerned with 4 of the columns to create a translation:
|
|
|
|
|
|
|
|
message_id
|
|
|
|
|
|
|
|
The key to identify the message (the $key passed to the
|
|
|
|
lang() function). This is written in English.
|
|
|
|
|
|
|
|
app_name
|
|
|
|
|
|
|
|
The application the translation applies to, or common if
|
|
|
|
it is common across multiple applications.
|
|
|
|
|
|
|
|
lang
|
|
|
|
|
|
|
|
The code for the language the translation is in.
|
|
|
|
|
|
|
|
content
|
|
|
|
|
|
|
|
The translated string.
|
|
|
|
|
|
|
|
7.3 Common return codes
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
If you browse through the eGroupWare sources, you may notice
|
2001-01-10 10:59:20 +01:00
|
|
|
a pattern to the return codes used in the higher-level functions.
|
|
|
|
The codes used are partially documented in the doc/developers/CODES
|
|
|
|
file.
|
|
|
|
|
|
|
|
Codes are used as a simple way to communicate common error
|
|
|
|
and progress conditions back to the user. They are mapped
|
|
|
|
to a text string through the check_code() function, which
|
|
|
|
passes the strings through lang() before returning.
|
|
|
|
|
|
|
|
For example, calling Would print translated into the current
|
|
|
|
language.
|
|
|
|
|
|
|
|
8 Using Templates
|
|
|
|
|
|
|
|
8.1 Overview
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
eGroupWare is built using a templates-based design. This
|
2001-01-10 10:59:20 +01:00
|
|
|
means the display pages, stored in tpl files, can be translated
|
|
|
|
to other languages, made to look completely different.
|
|
|
|
|
|
|
|
8.2 How to use templates
|
|
|
|
|
|
|
|
Some instructions on using templates:
|
|
|
|
|
|
|
|
For Further info read the PHPLIBs documentation for their
|
|
|
|
template class. [http://phplib.netuse.de]
|
|
|
|
|
|
|
|
9 About this document
|
|
|
|
|
|
|
|
9.1 New versions
|
|
|
|
|
|
|
|
The newest version of this document can be found on our website
|
|
|
|
as lyx source, HTML, and text.
|
|
|
|
|
|
|
|
9.2 Comments
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
Comments on this HOWTO should be directed to the eGroupWare
|
|
|
|
developers mailing list egroupware-developers@lists.sourceforge.net
|
2001-01-10 10:59:20 +01:00
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
To subscribe, go to {http://lists.sourceforge.net/lists/listinfo/egroupware-developers}
|
2001-01-10 10:59:20 +01:00
|
|
|
|
|
|
|
9.3 History
|
|
|
|
|
|
|
|
This document was written by Dan Kuykendall.
|
|
|
|
|
|
|
|
2000-09-25 documentation on lang(), codes, administration
|
|
|
|
and preferences extension added by Steve Brown.
|
|
|
|
|
|
|
|
2001-01-08 fixed directory structure, minor layout changes,
|
|
|
|
imported to lyx source - Darryl VanDorp
|
|
|
|
|
2003-12-28 17:32:24 +01:00
|
|
|
2003-12-29 adapted for eGroupWare and updated for setup and
|
|
|
|
use of GLOBALS - Miles Lott
|
|
|
|
|
2001-01-10 10:59:20 +01:00
|
|
|
9.4 Copyrights and Trademarks
|
|
|
|
|
|
|
|
Copyright (c) Dan Kuykendall. Permission is granted to copy,
|
|
|
|
distribute and/or modify this document under the terms of
|
|
|
|
the GNU Free Documentation License, Version 1.1 or any later
|
|
|
|
version published by the Free Software Foundation.
|
|
|
|
|
|
|
|
A copy of the license is available at [http://www.gnu.org/copyleft/gpl.html]
|
|
|
|
|
|
|
|
9.5 Acknowledgments and Thanks
|
|
|
|
|
|
|
|
Thanks to Joesph Engo for starting phpGroupWare (at the time
|
|
|
|
called webdistro). Thanks to all the developers and users
|
2003-12-28 17:32:24 +01:00
|
|
|
who contribute to making eGroupWare and phpGroupWare such
|
|
|
|
a success.
|