diff --git a/setup/lang/phpgw_de.lang b/setup/lang/phpgw_de.lang index 4aa4403445..3dab22a500 100644 --- a/setup/lang/phpgw_de.lang +++ b/setup/lang/phpgw_de.lang @@ -1,5 +1,7 @@ +%1 '%2' does not exist, is not readable by the webserver or contains no egroupware installation! setup de %1 '%2' existiert NICHT, ist nicht vom Webserver lesbar oder enthält keine eGroupWare Installation! %1 does not exist !!! setup de %1 existiert nicht!!! %1 is %2%3 !!! setup de %1 ist %2%3!!! +%1, %2 or %3 the configuration file. setup de %1, %2 oder %3 der Konfigurationsdatei. (searching accounts and changing passwords) setup de Benutzerkonten suchen und Passwörter ändern) *** do not update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your db in an unrecoverable state (your data is lost) !!! setup de *** Updaten Sie NICHT Ihre Datenbank via Setup, da das Update von der max_execution_time (max. Ausführungszeit für Skripte) unterbrochen werden kann. Ihre Datenbank ist dann in einem nicht mehr wiederherstellbaren Zustand (Ihre Daten sind VERLOREN)!!! *** you have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get egw fully working !!! setup de *** Sie müssen die Änderungen manuell in Ihrer php.ini Datei (üblicherweise in /etc unter Linux) durchführen, um eGroupWare vollständig/fehlerfrei ausführen zu können!!! @@ -30,6 +32,7 @@ all users setup de Alle Benutzer allow authentication via cookie setup de Erlaube Benutzerauthentifizierung über ein Cookie allow password migration setup de Erlaube Password Migration allowed migration types (comma-separated) setup de Erlauber Migrationstypen (Komma separiert) +alternatively domains can be accessed by logging in with username@domain. setup de Auf Domains kann alternative auch durch Anmelden als benutzer@domain zugegriffen werden. analysis setup de Analyse and reload your webserver, so the above changes take effect !!! setup de UND reloaden Sie ihren Webserver, damit die obigen Änderungen in Kraft treten!!! app details setup de Details der Anwendung @@ -79,7 +82,7 @@ because the enable flag for this app is set to 0, or is undefined setup de weil bottom setup de unten but we highly recommend backing up your tables in case the script causes damage to your data.
these automated scripts can easily destroy your data. setup de Aber wir raten Ihnen dringend, eine Sicherungskopie anzulegen für den Fall, dass dieses Skript Ihre bestehenden Daten beschädigt!
Diese automatisierten Skripts können leicht Ihre Daten beschädigen!. cancel setup de Abbrechen -cannot create the header.inc.php due to file permission restrictions.
instead you can %1 the file. setup de Kann die Datei header.inc.php wegen unzureichenden Zugriffsrechten nicht erzeugen.
Stattdessen können Sie die Datei %1. +cannot create the header.inc.php due to file permission restrictions.
instead you can %1 or %2 the file. setup de Kann die Datei header.inc.php wegen unzureichenden Zugriffsrechten nicht erzeugen.
Stattdessen können Sie die Datei %1 oder %2. change system-charset setup de Systemzeichensatz wechseln charset setup de ISO-8859-1 charset to convert to setup de Zeichensatz in den konvertiert werden soll @@ -128,9 +131,9 @@ current system-charset setup de Aktueller Systemzeichensatz current system-charset is %1. setup de Aktueller Systemzeichensatz ist %1. current version setup de Gegenwärtige Version currently installed languages: %1
setup de Gegenwärtig installierte Sprachen: %1
+database setup de Datenbank database instance (egw domain) setup de Datenbankinstanz (eGW Domain) database successfully converted from '%1' to '%2' setup de Datenbank erfolgreich von "%1" nach "%2" konvertiert -datebase setup de Datenbank datetime port.
if using port 13, please set firewall rules appropriately before submitting this page.
(port: 13 / host: 129.6.15.28) setup de Port für Datum/Zeitabfragen
Wenn der Port 13 verwendet wird, bitte VOR dem Absenden die Firewallregeln dementsprechend setzen.
(Port 13/Host: 129.6.15.28) day setup de Tag day of week
(0-6, 0=sunday) setup de Wochentag
(0-6, 0=Sonntag) @@ -176,7 +179,9 @@ enable mcrypt setup de MCrypt einschalten enter some random text for app session encryption setup de Zufallstext zur Verschlüsselung der Anwendungssitzung enter some random text for app_session
encryption (requires mcrypt) setup de Zufallstext zur Verschlüsselung der Anwendungssitzung
(benötigt mcrypt) enter the full path for temporary files.
examples: /tmp, c:\temp setup de Vollständiger Pfad für temporäre Dateien.
Beispiel: /tmp, C:\TEMP +enter the full path for temporary files.
examples: /tmp, c:temp setup de Vollständiger Pfad für temporäre Dateien.
Beispiel: /tmp, C:\TEMP enter the full path for users and group files.
examples: /files, e:\files setup de Vollständiger Pfad für Benutzer- und Gruppendateien.
Beispiel: /files, E:\Files +enter the full path for users and group files.
examples: /files, e:files setup de Vollständiger Pfad für Benutzer- und Gruppendateien.
Beispiel: /files, E:\Files enter the full path to the backup directory.
if empty: files directory setup de Vollständiger Pfad für das Datensicherungsverzeichnis.
Wenn leer: Dateiverzeichnis enter the hostname of the machine on which this server is running setup de Hostname des Computers auf dem der Server läuft enter the location of egroupware's url.
example: http://www.domain.com/egroupware   or   /egroupware
no trailing slash setup de URL zur eGroupWare Installation.
Beispiel: http://www.domain.com/egroupware or /egroupware
keinen nachfolgenden Slash / @@ -233,7 +238,7 @@ import accounts from ldap to the egroupware accounts table (for a new install us import has been completed! setup de Import ist beendet! import ldap users/groups setup de LDAP-Benutzer/-Gruppen importieren importing old settings into the new format.... setup de Importiere alte Einstellung in das neue Format ... -include root (this should be the same as server root unless you know what you are doing) setup de Include-Root (sollte das gleiche Verzeichnis wie die Server-Root sein, außer Sie wissen was Sie tun) +include root setup de Include-Root include_path need to contain "." - the current directory setup de include_path muss "." - das aktuelle Verzeichnis - enthalten install setup de Installieren install all setup de Alle Installieren @@ -266,9 +271,12 @@ ldap modify setup de LDAP ldap root password setup de LDAP-Root-Passwort ldap rootdn setup de LDAP rootdn ldap search filter for accounts, default: "(uid=%user)", %domain=egw-domain setup de LDAP Suchfilter für Benutzerkonten, Vorgabe "(uid=%user)", %domain=eGW Domain +leave empty to keep current. setup de Leer lassen um das existierende Password zu behalten. +limit access setup de Zugang beschränken limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org) setup de Zugang zu Setup auf die folgenden IP Adressen, Netzwerke oder Hostnamen beschränken (z.B. 127.0.0.1,10.1.1,myhost.dnydns.org) login as user postgres, eg. by using su as root setup de Als Benutzer postgres einlogen, zB. durch benutzen von su als root login to mysql - setup de mysql aufrufen - +loginname needed for domain configuration setup de Benutzername für die Konfiguration der Domain logout setup de Abmelden mail domain (for virtual mail manager) setup de Mail Domain (für Virtual Mail Manager) mail server login type setup de Mail Server Login Typ @@ -326,9 +334,10 @@ or http://webdav.domain.com (webdav) setup de oder http://webdav.domain.com (f or we can attempt to create the database for you: setup de Oder wir können versuchen die Datenbank für Sie anzulegen: or you can install a previous backup. setup de Oder Sie können eine vorherige Datensicherung installieren. password for smtp-authentication setup de Passwort für SMTP Authentifizierung -password needed for configuration setup de Passwort wird für die Konfiguration benötgt +password needed for domain configuration. setup de Passwort für die Konfiguration der Domain. password of db user setup de Passwort des Datenbank Benutzers passwords did not match, please re-enter setup de Passworte stimmten nicht überein, bitte nocheinmal eingeben +path (not url!) to your egroupware installation. setup de Pfad (nicht Internetadresse/URL!) Ihrer eGroupWare Installation. path information setup de Pfadinformationen path to user and group files has to be outside of the webservers document-root!!! setup de Pfad zu Benutzer und Gruppen Dateien MUSS AUSSERHALB des Wurzelverzeichnisses (document root) des Webservers sein!!! pear is needed by syncml or the ical import+export of calendar. setup de PEAR wird von SyncML oder dem iCal Import+Export des Kalenders benötigt. @@ -416,6 +425,7 @@ setup demo accounts in ldap setup de Demo-Benutzer in LDAP einrichten setup main menu setup de Setup-Hauptmenü setup the database setup de Datenbank einzurichten setup/config admin login setup de Setup-/Konfigurationsadmin-Login +should be the same as server root unless you know what you are doing. setup de Sollte das gleiche Verzeichnis wie die Server-Root sein, außer Sie wissen was Sie tun. show 'powered by' logo on setup de Zeige "powered by" Logo size setup de Größe skip the installation tests (not recommended) setup de Installationstests überspringen (nicht empfohlen) @@ -493,6 +503,7 @@ user for smtp-authentication (leave it empty if no auth required) setup de Benut usernames are casesensitive setup de Benutzername mit Unterscheidung zwischen Groß- und Kleinschreibung users choice setup de Benutzerauswahl utf-8 (unicode) setup de utf-8 (Unicode) +validation errors setup de Fehler bei der Prüfung der Eingaben version setup de Version version mismatch setup de Versionen passen nicht zueinander view setup de Anzeigen @@ -510,7 +521,7 @@ would you like egroupware to cache the phpgw info array ? setup de Soll eGroupWa would you like egroupware to check for a new version
when admins login ? setup de Soll eGroupWare nach neuen Versionen suchen,
wenn sich ein Administrator anmeldet ? would you like to show each application's upgrade status ? setup de Soll der Upgrade-Status aller Anwendungen angezeigt werden ? writable by the webserver setup de schreibar durch den Webserver -write config setup de Konfiguration schreiben +write setup de Schreiben year setup de Jahr yes setup de Ja yes, with lowercase usernames setup de Ja, mit kleingeschriebenen Benutzernamen @@ -522,6 +533,7 @@ you appear to have %1 support. setup de Sie scheinen %1 Unterst you appear to have php session support. enabling php sessions. setup de Sie scheinen PHP Session Unterstützung zu haben. PHP Sessions eingeschaltet. you appear to have xml support enabled setup de Sie scheinen XML Unterstützung zu haben. you are ready for this stage, but this stage is not yet written.
setup de Sie sind bereit für diesen Schritt, aber dieser Abschnitt wurde noch nicht geschrieben.
+you are using php version %1. egroupware now requires %2 or later, recommended is php %3. setup de Sie benutzen die PHP Version %1. eGroupWare benötigt mindestens die Version %2, empfohlen ist PHP %3. you can install it by running: setup de Installation durch ausführen von: you didn't enter a config password for domain %1 setup de Sie haben kein Passwort für die Domain %1 angegeben you didn't enter a config username for domain %1 setup de Sie haben keinen Benutzernamen für die Domain %1 angegeben @@ -531,7 +543,7 @@ you do not have any languages installed. please install one now
setup de you have not created your header.inc.php yet!
you can create it now. setup de Sie haben bisher noch keine header.inc.php angelegt!
Sie können sie jetzt anlegen. you have successfully logged out setup de Sie haben sich erfolgreich abgemeldet. you must enter a username for the admin setup de Sie müssen einen Benutzernamen für den Administrator eingeben! -you need to add some domains to your header.inc.php. setup de Sie müssen mindestens eine Domain zu Ihrer header.inc.php hinzufügen. +you need to add at least one egroupware domain / database instance. setup de Sie müssen mindestens eine eGroupWare Domain / Datenbank Instanz hinzufügen. you need to select your current charset! setup de Sie müssen Ihren aktuellen Zeichensatz auswählen! you should either uninstall and then reinstall it, or attempt manual repairs setup de Sie sollten entweder de- und neuinstallieren, oder manuelle Reparaturen versuchen you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup de Sie müssen das notwendige phpgwAccounts Schema auf Ihrem LDAP Server installieren - siehe phpgwapi/doc/ldap/README. diff --git a/setup/lang/phpgw_en.lang b/setup/lang/phpgw_en.lang index fa44e9e366..202e3ae339 100644 --- a/setup/lang/phpgw_en.lang +++ b/setup/lang/phpgw_en.lang @@ -1,5 +1,7 @@ +%1 '%2' does not exist, is not readable by the webserver or contains no egroupware installation! setup en %1 '%2' does NOT exist, is not readable by the webserver or contains no eGroupWare installation! %1 does not exist !!! setup en %1 does not exist !!! %1 is %2%3 !!! setup en %1 is %2%3 !!! +%1, %2 or %3 the configuration file. setup en %1, %2 or %3 the configuration file. (searching accounts and changing passwords) setup en (searching accounts and changing passwords) *** do not update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your db in an unrecoverable state (your data is lost) !!! setup en *** Do NOT update your database via setup, as the update might be interrupted by the max_execution_time, which leaves your DB in an unrecoverable state (your data is lost) !!! *** you have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get egw fully working !!! setup en *** You have to do the changes manualy in your php.ini (usualy in /etc on linux) in order to get eGW fully working !!! @@ -30,6 +32,7 @@ all users setup en All Users allow authentication via cookie setup en Allow authentication via cookie allow password migration setup en Allow password migration allowed migration types (comma-separated) setup en Allowed migration types (comma-separated) +alternatively domains can be accessed by logging in with username@domain. setup en Alternatively domains can be accessed by logging in with username@domain. analysis setup en Analysis and reload your webserver, so the above changes take effect !!! setup en AND reload your webserver, so the above changes take effect !!! app details setup en App details @@ -79,7 +82,7 @@ because the enable flag for this app is set to 0, or is undefined setup en becau bottom setup en bottom but we highly recommend backing up your tables in case the script causes damage to your data.
these automated scripts can easily destroy your data. setup en but we highly recommend backing up your tables in case the script causes damage to your data.
These automated scripts can easily destroy your data. cancel setup en Cancel -cannot create the header.inc.php due to file permission restrictions.
instead you can %1 the file. setup en Cannot create the header.inc.php due to file permission restrictions.
Instead you can %1 the file. +cannot create the header.inc.php due to file permission restrictions.
instead you can %1 or %2 the file. setup en Cannot create the header.inc.php due to file permission restrictions.
Instead you can %1 or %2 the file. change system-charset setup en Change system-charset charset setup en ISO-8859-1 charset to convert to setup en Charset to convert to @@ -128,9 +131,9 @@ current system-charset setup en Current system-charset current system-charset is %1. setup en Current system-charset is %1. current version setup en Current Version currently installed languages: %1
setup en Currently installed languages: %1
+database setup en Database database instance (egw domain) setup en Database instance (eGW domain) database successfully converted from '%1' to '%2' setup en Database successfully converted from '%1' to '%2' -datebase setup en Datebase datetime port.
if using port 13, please set firewall rules appropriately before submitting this page.
(port: 13 / host: 129.6.15.28) setup en Datetime port.
If using port 13, please set firewall rules appropriately before submitting this page.
(Port: 13 / Host: 129.6.15.28) day setup en day day of week
(0-6, 0=sunday) setup en day of week
(0-6, 0=sunday) @@ -233,7 +236,7 @@ import accounts from ldap to the egroupware accounts table (for a new install us import has been completed! setup en Import has been completed! import ldap users/groups setup en Import LDAP users/groups importing old settings into the new format.... setup en Importing old settings into the new format.... -include root (this should be the same as server root unless you know what you are doing) setup en Include Root (this should be the same as Server Root unless you know what you are doing) +include root setup en Include root include_path need to contain "." - the current directory setup en include_path need to contain "." - the current directory install setup en Install install all setup en Install All @@ -266,9 +269,12 @@ ldap modify setup en LDAP Modify ldap root password setup en LDAP root password ldap rootdn setup en LDAP rootdn ldap search filter for accounts, default: "(uid=%user)", %domain=egw-domain setup en LDAP search filter for accounts, default: "(uid=%user)", %domain=eGW-domain +leave empty to keep current. setup en Leave empty to keep current. +limit access setup en Limit access limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org) setup en Limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org) login as user postgres, eg. by using su as root setup en Login as user postgres, eg. by using su as root login to mysql - setup en Login to mysql - +loginname needed for domain configuration setup en Loginname needed for domain configuration logout setup en Logout mail domain (for virtual mail manager) setup en Mail domain (for Virtual mail manager) mail server login type setup en Mail server login type @@ -326,9 +332,10 @@ or http://webdav.domain.com (webdav) setup en or http://webdav.domain.com (WebDA or we can attempt to create the database for you: setup en Or we can attempt to create the database for you: or you can install a previous backup. setup en Or you can install a previous backup. password for smtp-authentication setup en Password for SMTP-authentication -password needed for configuration setup en Password needed for configuration +password needed for domain configuration. setup en Password needed for domain configuration. password of db user setup en Password of db user passwords did not match, please re-enter setup en Passwords did not match, please re-enter +path (not url!) to your egroupware installation. setup en Path (not URL!) to your eGroupWare installation. path information setup en Path information path to user and group files has to be outside of the webservers document-root!!! setup en Path to user and group files HAS TO BE OUTSIDE of the webservers document-root!!! pear is needed by syncml or the ical import+export of calendar. setup en PEAR is needed by SyncML or the iCal import+export of calendar. @@ -416,6 +423,7 @@ setup demo accounts in ldap setup en Setup demo accounts in LDAP setup main menu setup en Setup Main Menu setup the database setup en Setup the database setup/config admin login setup en Setup/Config Admin Login +should be the same as server root unless you know what you are doing. setup en Should be the same as Server Root unless you know what you are doing. show 'powered by' logo on setup en Show 'powered by' logo on size setup en size skip the installation tests (not recommended) setup en Skip the installation tests (not recommended) @@ -493,6 +501,7 @@ user for smtp-authentication (leave it empty if no auth required) setup en User usernames are casesensitive setup en Usernames are casesensitive users choice setup en Users Choice utf-8 (unicode) setup en utf-8 (Unicode) +validation errors setup en Validation errors version setup en version version mismatch setup en Version Mismatch view setup en View @@ -510,7 +519,7 @@ would you like egroupware to cache the phpgw info array ? setup en Would you lik would you like egroupware to check for a new version
when admins login ? setup en Would you like eGroupWare to check for a new version
when admins login ? would you like to show each application's upgrade status ? setup en Would you like to show each application's upgrade status ? writable by the webserver setup en writable by the webserver -write config setup en Write config +write setup en Write year setup en year yes setup en Yes yes, with lowercase usernames setup en Yes, with lowercase usernames @@ -522,6 +531,7 @@ you appear to have %1 support. setup en You appear to have %1 support. you appear to have php session support. enabling php sessions. setup en You appear to have PHP session support. Enabling PHP sessions. you appear to have xml support enabled setup en You appear to have XML support enabled you are ready for this stage, but this stage is not yet written.
setup en You are ready for this stage, but this stage is not yet written.
+you are using php version %1. egroupware now requires %2 or later, recommended is php %3. setup en You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3. you can install it by running: setup en You can install it by running: you didn't enter a config password for domain %1 setup en You didn't enter a config password for domain %1 you didn't enter a config username for domain %1 setup en You didn't enter a config username for domain %1 @@ -531,7 +541,7 @@ you do not have any languages installed. please install one now
setup en you have not created your header.inc.php yet!
you can create it now. setup en You have not created your header.inc.php yet!
You can create it now. you have successfully logged out setup en You have successfully logged out you must enter a username for the admin setup en You must enter a username for the admin -you need to add some domains to your header.inc.php. setup en You need to add some domains to your header.inc.php. +you need to add at least one egroupware domain / database instance. setup en You need to add at least one eGroupWare domain / database instance. you need to select your current charset! setup en You need to select your current charset! 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 you will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/readme setup en You will need to load the proper schema into your ldap server - see phpgwapi/doc/ldap/README diff --git a/setup/manageheader.php b/setup/manageheader.php index 268aa4219c..3a2d89295e 100644 --- a/setup/manageheader.php +++ b/setup/manageheader.php @@ -1,231 +1,125 @@ array( - 'nocachecontrol' => True, - 'noheader' => True, - 'nonavbar' => True, - 'currentapp' => 'home', - 'noapi' => True - )); - include('./inc/functions.inc.php'); +$GLOBALS['egw_info'] = array( + 'flags' => array( + 'nocachecontrol' => True, + 'noheader' => True, + 'nonavbar' => True, + 'currentapp' => 'home', + 'noapi' => True +)); +include('./inc/functions.inc.php'); - // some constanst for pre php4.3 - if (!defined('PHP_SHLIB_SUFFIX')) - { - define('PHP_SHLIB_SUFFIX',strtoupper(substr(PHP_OS, 0,3)) == 'WIN' ? 'dll' : 'so'); - } - if (!defined('PHP_SHLIB_PREFIX')) - { - define('PHP_SHLIB_PREFIX',PHP_SHLIB_SUFFIX == 'dll' ? 'php_' : ''); - } - /** - * checks if a named extension is loaded or loadable - */ - function check_load_extension($extension) - { - return extension_loaded($extension) || - function_exists('dl') && @dl(PHP_SHLIB_PREFIX.$extension.'.'.PHP_SHLIB_SUFFIX); - } +require_once('./inc/class.setup_header.inc.php'); +$GLOBALS['egw_setup']->header =& new setup_header(); - $GLOBALS['egw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; - $GLOBALS['egw_info']['server']['versions']['phpgwapi'] = $setup_info['phpgwapi']['version']; - unset($setup_info); +/* necessary ? +$GLOBALS['egw_info']['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; +$GLOBALS['egw_info']['server']['versions']['phpgwapi'] = $setup_info['phpgwapi']['version']; +unset($setup_info); +*/ - /* Fetch the current real path. - * If this is in the server document root, then it is probably ok. - * Otherwise, don't guess, just show the usual instructive default. - */ - $realpath = realpath('..'); - if(!ereg('^' . $_SERVER['DOCUMENT_ROOT'],$realpath)) - { - if(strtoupper(substr(PHP_OS, 0,3)) == 'WIN') - { - $realpath = 'Drive:/Path/to/egroupware'; - } - else - { - $realpath = '/path/to/egroupware'; - } - } +$setup_tpl = CreateObject('setup.Template','./templates/default'); +$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_manage' => 'manageheader.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_manage','manageheader','manageheader'); +$setup_tpl->set_block('T_setup_manage','domain','domain'); - $adddomain = get_var('adddomain',Array('POST')); +// authentication phase +$GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); +if ($GLOBALS['egw_info']['setup']['stage']['header'] > 2 && !$GLOBALS['egw_setup']->auth('Header')) +{ + $GLOBALS['egw_setup']->html->show_header('Please login',True); + $GLOBALS['egw_setup']->html->login_form(); + $GLOBALS['egw_setup']->html->show_footer(); + exit; +} +// Detect current mode +switch($GLOBALS['egw_info']['setup']['stage']['header']) +{ + case '1': + $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php'); + $GLOBALS['egw_info']['setup']['PageMSG'] = lang('You have not created your header.inc.php yet!
You can create it now.'); + break; + case '2': + $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = $GLOBALS['egw_info']['setup']['PageMSG'] = + lang('Your header admin password is NOT set. Please set it now!'); + break; + case '3': + $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = $GLOBALS['egw_info']['setup']['PageMSG'] = + $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = + lang('You need to add at least one eGroupWare domain / database instance.'); + break; + case '4': + $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = + lang('Your header.inc.php needs upgrading.'); + $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.
WARNING!
MAKE BACKUPS!'); + break; + case '10': + $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Edit your header.inc.php'); + $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Edit your existing header.inc.php'); + break; +} - $db_fullnames = array( - 'pgsql' => 'PostgreSQL', - 'mysql' => 'MySQL', - 'mysqli' => 'MySQLi (php5)', - 'mssql' => 'MS SQL Server', - 'odbc_mssql' => 'MS SQL Server via ODBC', - 'oracle' => 'Oracle', - 'odbc_oracle' => 'Oracle via ODBC', - 'sapdb' => 'SAP/Max DB via ODBC', - ); +if (!file_exists('../header.inc.php') || !is_readable('../header.inc.php')) +{ + $GLOBALS['egw_setup']->header->defaults(); +} +else +{ + $GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT; + $GLOBALS['egw_info']['server']['include_root'] = EGW_INCLUDE_ROOT; +} +if (isset($_POST['setting'])) // Post of the header-form +{ + $validation_errors = check_header_form(); // validate the submitted form +} +if (!isset($_POST['action']) || $validation_errors) // generate form to edit the header +{ + show_header_form($validation_errors); +} +else +{ + $newheader = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain']); - $default_db_ports = array( - 'pgsql' => 5432, - 'mysql' => 3306, - 'mysqli' => 3306, - 'mssql' => 1433, - 'odbc_mssql' => '', - 'oracle' => 1521, - 'odbc_oracle' => '', - 'sapdb' => '', - ); - - function check_form_values() - { - // PHP will automatically replace any dots in incoming - // variable names with underscores. - - $errors = ''; - $domains = get_var('domains',Array('POST')); - @reset($domains); - while(list($k,$v) = @each($domains)) - { - $variableName = str_replace('.','_',$k); - $deletedomain = get_var('deletedomain',Array('POST')); - if(isset($deletedomain[$variableName])) - { - continue; - } - $dom = get_var('setting_'.$variableName,Array('POST')); - if(!$dom['config_pass'] && !$dom['config_password']) - { - $errors .= '
' . lang("You didn't enter a config password for domain %1",$v); - } - if(!$dom['config_user']) - { - $errors .= '
' . lang("You didn't enter a config username for domain %1",$v); - } - } - - $setting = get_var('setting',Array('POST')); - if(!$setting['HEADER_ADMIN_PASSWORD'] && !$setting['HEADER_ADMIN_PASS']) - { - $errors .= '
' . lang("You didn't enter a header admin password"); - } - if(!$setting['HEADER_ADMIN_USER']) - { - $errors .= '
' . lang("You didn't enter a header admin username"); - } - - if($errors) - { - $GLOBALS['egw_setup']->html->show_header('Error',True); - echo $errors; - echo '

'; - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - } - - /* authentication phase */ - $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); - - // added these to let the app work, need to templatize still - $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); - $setup_tpl = CreateObject('setup.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_manage' => 'manageheader.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_manage','manageheader','manageheader'); - $setup_tpl->set_block('T_setup_manage','domain','domain'); - - /* Detect current mode */ - switch($GLOBALS['egw_info']['setup']['stage']['header']) - { - case '1': - $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Create your header.inc.php'); - $GLOBALS['egw_info']['setup']['PageMSG'] = lang('You have not created your header.inc.php yet!
You can create it now.'); - break; - case '2': - $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header admin password is NOT set. Please set it now!'); - $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header admin password is NOT set. Please set it now!'); - break; - case '3': - $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('You need to add some domains to your header.inc.php.'); - $GLOBALS['egw_info']['setup']['PageMSG'] = lang('You need to add some domains to your header.inc.php.'); - $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = lang('You need to add some domains to your header.inc.php.'); - if(!$GLOBALS['egw_setup']->auth('Header')) - { - $GLOBALS['egw_setup']->html->show_header('Please login',True); - $GLOBALS['egw_setup']->html->login_form(); - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - break; - case '4': - $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Your header.inc.php needs upgrading.'); - $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Your header.inc.php needs upgrading.
WARNING!
MAKE BACKUPS!'); - $GLOBALS['egw_info']['setup']['HeaderLoginMSG'] = lang('Your header.inc.php needs upgrading.'); - if(!$GLOBALS['egw_setup']->auth('Header')) - { - $GLOBALS['egw_setup']->html->show_header('Please login',True); - $GLOBALS['egw_setup']->html->login_form(); - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - break; - case '10': - if(!$GLOBALS['egw_setup']->auth('Header')) - { - $GLOBALS['egw_setup']->html->show_header('Please login',True); - $GLOBALS['egw_setup']->html->login_form(); - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - $GLOBALS['egw_info']['setup']['HeaderFormMSG'] = lang('Edit your header.inc.php'); - $GLOBALS['egw_info']['setup']['PageMSG'] = lang('Edit your existing header.inc.php'); - break; - } - - $action = @get_var('action',Array('POST')); - list($action) = @each($action); + list($action) = @each($_POST['action']); switch($action) { case 'download': - check_form_values(); - $header_template = CreateObject('setup.Template','../'); - $b = CreateObject('phpgwapi.browser'); - $b->content_header('header.inc.php','application/octet-stream'); - /* - header('Content-disposition: attachment; filename="header.inc.php"'); - header('Content-type: application/octet-stream'); - header('Pragma: no-cache'); - header('Expires: 0'); - */ - $newheader = $GLOBALS['egw_setup']->html->generate_header(); + $browser = CreateObject('phpgwapi.browser'); + $browser->content_header('header.inc.php','application/octet-stream'); echo $newheader; break; + case 'view': - check_form_values(); - $header_template = CreateObject('setup.Template','../'); $GLOBALS['egw_setup']->html->show_header('Generated header.inc.php', False, 'header'); echo '
'; echo '
' . lang('Save this text as contents of your header.inc.php') . '

'; - $newheader = $GLOBALS['egw_setup']->html->generate_header(); - echo '
';
+			echo "
\n";
 			echo htmlentities($newheader);
-			echo '

'; + echo "\n

\n"; echo '
'; echo '
' . lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".') . '
'; echo ''; @@ -234,18 +128,16 @@ echo '
'; $GLOBALS['egw_setup']->html->show_footer(); break; + case 'write': - check_form_values(); - $header_template = CreateObject('setup.Template','../'); - if(is_writeable('../header.inc.php') || (!file_exists('../header.inc.php') && is_writeable('../'))) + if ((is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) && + ($f = fopen('../header.inc.php','wb'))) { - $newheader = $GLOBALS['egw_setup']->html->generate_header(); - $fsetup = fopen('../header.inc.php','wb'); - fwrite($fsetup,$newheader); - fclose($fsetup); + fwrite($f,$newheader); + fclose($f); $GLOBALS['egw_setup']->html->show_header('Saved header.inc.php', False, 'header'); echo ''; - echo '
' . lang('Created header.inc.php!'); + echo '
' . lang('Created header.inc.php!'); echo ''; echo ''; echo ''; @@ -260,422 +152,283 @@ $GLOBALS['egw_setup']->html->show_footer(); } break; - default: - $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header'); - - if(!get_var('ConfigLang',array('POST','COOKIE'))) - { - $setup_tpl->set_var('lang_select','
Please Select your language '.lang_select(True,'en')."
"); - } - - $setup_tpl->set_var('pagemsg',$GLOBALS['egw_info']['setup']['PageMSG']); - $setup_tpl->set_var('lang_analysis',lang('Analysis')); - - //$detected = ''; - //$detected .= '

' . $GLOBALS['egw_info']['setup']['PageMSG'] . '
 

'; - - //$detected .= '' . lang('Analysis') . ''."\n".''. "\n"; - - $supported_db = array(); - foreach(array( - // short => array(extension,func_to_check,supported_db(s)) - 'mysql' => array('mysql','mysql_connect','mysql'), - 'mysqli' => array('mysql','mysql_iconnect','mysqli'), - 'pgsql' => array('pgsql','pg_connect','pgsql'), - 'mssql' => array('mssql','mssql_connect','mssql'), - 'odbc' => array('odbc',false,'sapdb','odbc_mssql','odbc_oracle'), - 'oracle' => array('oci8',false,'oracle'), - ) as $db => $data) - { - $ext = array_shift($data); - $func_to_check = array_shift($data); - $name = isset($db_fullnames[$db]) ? $db_fullnames[$db] : strtoupper($db); - if (check_load_extension($ext) || $func_to_check && function_exists($func_to_check)) - { - $detected .= lang('You appear to have %1 support.',$name) . "
\n"; - $supported_db = array_merge($supported_db,$data); - } - else - { - $detected .= lang('No %1 support found. Disabling',$name) . "
\n"; - } - } - if(!count($supported_db)) - { - $detected .= '

' - . lang('Did not find any valid DB support!') - . "
\n" - . lang('Try to configure your php to support one of the above mentioned DBMS, or install eGroupWare by hand.') - . '

'; - echo $detected; - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - - if(!function_exists('version_compare')) - { - $detected .= '

' - . lang('You appear to be using PHP earlier than 4.1.0. eGroupWare now requires 4.1.0 or later'). "\n" - . '

'; - echo $detected; - $GLOBALS['egw_setup']->html->show_footer(); - exit; - } - if (check_load_extension('session')) - { - $detected .= lang('You appear to have PHP session support. Enabling PHP sessions.') . '
' . "\n"; - $supported_sessions_type['php4'] = 'PHP'; // makeing php sessions the default - $supported_sessions_type['php4-restore'] = lang('PHP plus restore'); // php-sessions with restore of egw_info array and egw object from the session - } - $supported_sessions_type['db'] = lang('Datebase'); - - @reset($default_db_ports); - $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; - while(list($k,$v) = @each($default_db_ports)) - { - $js_default_db_ports .= ' default_db_ports["'.$k.'"]="'.$v.'";'."\n"; - } - $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); - - /* - if(check_load_extension('xml') || function_exists('xml_parser_create')) - { - $detected .= lang('You appear to have XML support enabled') . '
' . "\n"; - $xml_enabled = 'True'; - } - else - { - $detected .= lang('No XML support found. Disabling') . '
' . "\n"; - } - */ - - $no_guess = False; - if(file_exists('../header.inc.php') && is_file('../header.inc.php') && is_readable('../header.inc.php')) - { - $detected .= lang('Found existing configuration file. Loading settings from the file...') . '
' . "\n"; - $GLOBALS['egw_info']['flags']['noapi'] = True; - $no_guess = true; - /* This code makes sure the newer multi-domain supporting header.inc.php is being used */ - if(!isset($GLOBALS['egw_domain'])) - { - $detected .= lang('You need to add some domains to your header.inc.php.') . '
' . "\n"; - $GLOBALS['egw_domain']['default'] = array(); - $setup_tpl->set_var('lang_domain',lang('Database instance (eGW domain)')); - $setup_tpl->set_var('lang_delete',lang('Delete')); - $setup_tpl->set_var('db_domain','default'); - $setup_tpl->set_var('db_host','localhost'); - $setup_tpl->set_var('db_name','egroupware'); - $setup_tpl->set_var('db_user','egroupware'); - $setup_tpl->set_var('db_pass',''); - $setup_tpl->set_var('config_user','changeme'); - $setup_tpl->set_var('config_pass',''); - while(list($k,$v) = @each($supported_db)) - { - $dbtype_options .= '\n"; - if (!isset($default_port)) - $default_port = $default_db_ports[$v]; - } - $setup_tpl->set_var('dbtype_options',$dbtype_options); - $setup_tpl->set_var('db_port',$default_port); - $setup_tpl->parse('domains','domain',True); - } - else - { - if(@$GLOBALS['egw_info']['server']['header_version'] != @$GLOBALS['egw_info']['server']['current_header_version']) - { - $detected .= lang("You're using an old header.inc.php version...") . '
' . "\n"; - $detected .= lang('Importing old settings into the new format....') . '
' . "\n"; - } - reset($GLOBALS['egw_domain']); - list($default_domain) = each($GLOBALS['egw_domain']); - $GLOBALS['egw_info']['server']['default_domain'] = $default_domain; - unset($default_domain); // we kill this for security reasons - $GLOBALS['egw_info']['server']['config_passwd'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['config_passwd']; - $GLOBALS['egw_info']['server']['config_user'] = $GLOBALS['egw_domain'][$GLOBALS['egw_info']['server']['default_domain']]['config_user']; - - if(@$adddomain) - { - $GLOBALS['egw_domain'][lang('new')] = array(); - } - - foreach($GLOBALS['egw_domain'] as $key => $val) - { - $setup_tpl->set_var('lang_domain',lang('Database instance (eGW domain)')); - $setup_tpl->set_var('lang_delete',lang('Delete')); - $setup_tpl->set_var('db_domain',$key); - $setup_tpl->set_var('db_host',$GLOBALS['egw_domain'][$key]['db_host']); - /* Set default here if the admin didn't set a port yet */ - $setup_tpl->set_var('db_port',$GLOBALS['egw_domain'][$key]['db_port'] - ? $GLOBALS['egw_domain'][$key]['db_port'] - : @$default_db_ports[$GLOBALS['egw_domain'][$key]['db_type']] - ); - $setup_tpl->set_var('db_name',$GLOBALS['egw_domain'][$key]['db_name']); - $setup_tpl->set_var('db_user',$GLOBALS['egw_domain'][$key]['db_user']); - $setup_tpl->set_var('db_pass',$GLOBALS['egw_domain'][$key]['db_pass']); - $setup_tpl->set_var('db_type',$GLOBALS['egw_domain'][$key]['db_type']); - if(!@isset($GLOBALS['egw_domain'][$key]['config_user'])) - { - $setup_tpl->set_var('config_user','admin'); - } - else - { - $setup_tpl->set_var('config_user',$GLOBALS['egw_domain'][$key]['config_user']); - } - $setup_tpl->set_var('config_pass',''); - $setup_tpl->set_var('config_password',$GLOBALS['egw_domain'][$key]['config_passwd']); - - $selected = ''; - $dbtype_options = ''; - $found_dbtype = False; - @reset($supported_db); - while(list($k,$v) = @each($supported_db)) - { - if($v == $GLOBALS['egw_domain'][$key]['db_type']) - { - $selected = ' selected="selected" '; - $found_dbtype = true; - } - else - { - $selected = ''; - } - $dbtype_options .= '\n"; - } - $setup_tpl->set_var('dbtype_options',$dbtype_options); - - $setup_tpl->parse('domains','domain',True); - } - $setup_tpl->set_var('domain',''); - } - if(defined('PHPGW_SERVER_ROOT')) - { - $GLOBALS['egw_info']['server']['server_root'] = (PHPGW_SERVER_ROOT == '..') ? $realpath : PHPGW_SERVER_ROOT; - $GLOBALS['egw_info']['server']['include_root'] = (PHPGW_INCLUDE_ROOT == '..') ? $realpath : PHPGW_SERVER_ROOT; - } - elseif(!@isset($GLOBALS['egw_info']['server']['include_root']) && @$GLOBALS['egw_info']['server']['header_version'] <= 1.6) - { - $GLOBALS['egw_info']['server']['include_root'] = @$GLOBALS['egw_info']['server']['server_root']; - } - elseif(!@isset($GLOBALS['egw_info']['server']['header_version']) && @$GLOBALS['egw_info']['server']['header_version'] <= 1.6) - { - $GLOBALS['egw_info']['server']['include_root'] = @$GLOBALS['egw_info']['server']['server_root']; - } - } - else - { - $detected .= lang('Sample configuration not found. using built in defaults') . '
' . "\n"; - $GLOBALS['egw_info']['server']['server_root'] = $realpath; - $GLOBALS['egw_info']['server']['include_root'] = $realpath; - /* This is the basic include needed on each page for eGroupWare application compliance */ - $GLOBALS['egw_info']['flags']['htmlcompliant'] = True; - - /* These are the settings for the database system */ - $setup_tpl->set_var('lang_domain',lang('Domain')); - $setup_tpl->set_var('lang_delete',lang('Delete')); - $setup_tpl->set_var('db_domain','default'); - $setup_tpl->set_var('db_host','localhost'); - $setup_tpl->set_var('db_name','egroupware'); - $setup_tpl->set_var('db_user','egroupware'); - $setup_tpl->set_var('db_pass',''); - $setup_tpl->set_var('config_user','changeme'); - $setup_tpl->set_var('config_pass',''); - - while(list($k,$v) = each($supported_db)) - { - $dbtype_options .= '\n"; - if (!isset($default_port)) - $default_port = $default_db_ports[$v]; - } - $setup_tpl->set_var('db_port',$default_port); - $setup_tpl->set_var('dbtype_options',$dbtype_options); - - $setup_tpl->parse('domains','domain',True); - $setup_tpl->set_var('domain',''); - - $setup_tpl->set_var('comment_l',''); - - /* These are a few of the advanced settings */ - $GLOBALS['egw_info']['server']['db_persistent'] = True; - $GLOBALS['egw_info']['server']['mcrypt_enabled'] = false; // default off, as there are too many problems with buggy mcrypt implementations (was check_load_extension('mcrypt');) - $GLOBALS['egw_info']['server']['versions']['mcrypt'] = ''; - - 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++) - { - $GLOBALS['egw_info']['server']['mcrypt_iv'] .= $random_char[rand(1,count($random_char))]; - } - } - - // now guessing better settings then the default ones - if(!$no_guess) - { - $detected .= lang('Now guessing better values for defaults...') . '
' . "\n"; - $this_dir = dirname($_SERVER['SCRIPT_FILENAME']); - $updir = str_replace('/setup','',$this_dir); - $GLOBALS['egw_info']['server']['server_root'] = $updir; - $GLOBALS['egw_info']['server']['include_root'] = $updir; - } - - - $setup_tpl->set_var('detected',$detected); - /* End of detected settings, now display the form with the detected or prior values */ - - $setup_tpl->set_var('server_root',@$GLOBALS['egw_info']['server']['server_root']); - $setup_tpl->set_var('include_root',@$GLOBALS['egw_info']['server']['include_root']); - if(!@isset($GLOBALS['egw_info']['server']['header_admin_user'])) - { - $setup_tpl->set_var('header_admin_user','admin'); - } - else - { - $setup_tpl->set_var('header_admin_user',@$GLOBALS['egw_info']['server']['header_admin_user']); - } - $setup_tpl->set_var('header_admin_pass',@$GLOBALS['egw_info']['server']['header_admin_password']); - $setup_tpl->set_var('header_admin_password',''); - - - if(@$GLOBALS['egw_info']['server']['db_persistent']) - { - $setup_tpl->set_var('db_persistent_yes',' selected="selected"'); - } - else - { - $setup_tpl->set_var('db_persistent_no',' selected="selected"'); - } - - $selected = ''; - $session_options = ''; - foreach($supported_sessions_type as $k => $v) - { - if($k == @$GLOBALS['egw_info']['server']['sessions_type']) - { - $selected = ' selected="selected" '; - } - else - { - $selected = ''; - } - $session_options .= '\n"; - } - $setup_tpl->set_var('session_options',$session_options); - - if(@$GLOBALS['egw_info']['server']['mcrypt_enabled']) - { - $setup_tpl->set_var('mcrypt_enabled_yes',' selected="selected"'); - } - else - { - $setup_tpl->set_var('mcrypt_enabled_no',' selected="selected"'); - } - - $setup_tpl->set_var('mcrypt',$GLOBALS['egw_info']['server']['versions']['mcrypt']); - $setup_tpl->set_var('mcrypt_iv',$GLOBALS['egw_info']['server']['mcrypt_iv']); - - $setup_tpl->set_var('lang_setup_acl',lang('Limit access')); - $setup_tpl->set_var('lang_setup_acl_descr',lang('Limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org)')); - $setup_tpl->set_var('setup_acl',$GLOBALS['egw_info']['server']['setup_acl']); - - if(@$GLOBALS['egw_info']['server']['show_domain_selectbox']) - { - $setup_tpl->set_var('domain_selectbox_yes',' selected="selected"'); - } - else - { - $setup_tpl->set_var('domain_selectbox_no',' selected="selected"'); - } - - $errors = ''; - if(!$found_dbtype) - { - /* - $errors .= '
' . lang('Warning!') . '
' - . lang('The db_type in defaults (%1) is not supported on this server. using first supported type.',$GLOBALS['egw_info']['server']['db_type']) - . '
'; - */ - } - - if(is_writeable('../header.inc.php') || - (!file_exists('../header.inc.php') && is_writeable('../'))) - { - $errors .= '
 ' - . lang('or') . '  ' - . lang('or') . '  '.lang('the file').'.'; - } - else - { - $errors .= '
' - . lang('Cannot create the header.inc.php due to file permission restrictions.
Instead you can %1 the file.', - '' . lang('or') . ' '); - } - // set domain and password for the continue button - @reset($GLOBALS['egw_domain']); - list($firstDomain) = @each($GLOBALS['egw_domain']); - $setup_tpl->set_var(array( - 'FormDomain' => $firstDomain, - 'FormUser' => $GLOBALS['egw_domain'][$firstDomain]['config_user'], - 'FormPW' => $GLOBALS['egw_domain'][$firstDomain]['config_passwd'] - )); - $setup_tpl->set_var('errors',$errors); - - $setup_tpl->set_var('lang_settings',lang('Settings')); - $setup_tpl->set_var('lang_adddomain',lang('Add new database instance (eGW domain)')); - $setup_tpl->set_var('lang_serverroot',lang('Server Root')); - $setup_tpl->set_var('lang_includeroot',lang('Include Root (this should be the same as Server Root unless you know what you are doing)')); - $setup_tpl->set_var('lang_adminuser',lang('Header loginname')); - $setup_tpl->set_var('lang_adminuser_descr',lang('Admin user for header manager')); - $setup_tpl->set_var('lang_adminpass',lang('Header password')); - $setup_tpl->set_var('lang_adminpass_descr',lang('Admin password to header manager.')); - $setup_tpl->set_var('lang_leave_empty',lang('Leave empty to keep current.')); - $setup_tpl->set_var('lang_dbhost',lang('DB Host')); - $setup_tpl->set_var('lang_dbhostdescr',lang('Hostname/IP of database server').'
'. - lang('Postgres: Leave it empty to use the prefered unix domain sockets instead of a tcp/ip connection').'
'. - lang('ODBC / MaxDB: DSN (data source name) to use')); - $setup_tpl->set_var('lang_dbport',lang('DB Port')); - $setup_tpl->set_var('lang_dbportdescr',lang('TCP port number of database server')); - $setup_tpl->set_var('lang_dbname',lang('DB Name')); - $setup_tpl->set_var('lang_dbnamedescr',lang('Name of database')); - $setup_tpl->set_var('lang_dbuser',lang('DB User')); - $setup_tpl->set_var('lang_dbuserdescr',lang('Name of db user eGroupWare uses to connect')); - $setup_tpl->set_var('lang_dbpass',lang('DB Password')); - $setup_tpl->set_var('lang_dbpassdescr',lang('Password of db user')); - $setup_tpl->set_var('lang_dbtype',lang('DB Type')); - $setup_tpl->set_var('lang_whichdb',lang('Which database type do you want to use with eGroupWare?')); - $setup_tpl->set_var('lang_configuser',lang('Configuration User')); - $setup_tpl->set_var('lang_configuser_descr',lang('Loginname needed for domain configuration')); - $setup_tpl->set_var('lang_configpass',lang('Configuration Password')); - $setup_tpl->set_var('lang_passforconfig',lang('Password needed for domain configuration.')); - $setup_tpl->set_var('lang_persist',lang('Persistent connections')); - $setup_tpl->set_var('lang_persistdescr',lang('Do you want persistent connections (higher performance, but consumes more resources)')); - $setup_tpl->set_var('lang_sesstype',lang('Sessions Type')); - $setup_tpl->set_var('lang_sesstypedescr',lang('What type of sessions management do you want to use (PHP session management may perform better)?'). - ' '.lang('PHP plus restore gives by far the best performance, as it stores the eGW enviroment completly in the session.'). - ' '.lang('Unfortunally some PHP/Apache packages have problems with it (Apache dies and you cant login anymore).')); - $setup_tpl->set_var('lang_enablemcrypt',lang('Enable MCrypt')); - $setup_tpl->set_var('lang_mcrypt_warning',lang('Not all mcrypt algorithms and modes work with eGroupWare. If you experience problems try switching it off.')); - $setup_tpl->set_var('lang_mcryptversion',lang('MCrypt version')); - $setup_tpl->set_var('lang_mcryptversiondescr',lang('Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use.')); - $setup_tpl->set_var('lang_mcryptiv',lang('MCrypt initialization vector')); - $setup_tpl->set_var('lang_mcryptivdescr',lang('This should be around 30 bytes in length.
Note: The default has been randomly generated.')); - $setup_tpl->set_var('lang_domselect',lang('Domain select box on login')); - $setup_tpl->set_var('lang_domselect_descr',lang('Alternatively domains can be accessed by logging in with username@domain.')); - $setup_tpl->set_var('lang_finaldescr',lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".')); - $setup_tpl->set_var('lang_continue',lang('Continue')); - $setup_tpl->set_var('lang_Yes',lang('Yes')); - $setup_tpl->set_var('lang_No',lang('No')); - - - $setup_tpl->pfp('out','manageheader'); - - $GLOBALS['egw_setup']->html->show_footer(); - - break; // ending the switch default } -?> +} + +/** + * Validate the posted form and place the content again in $GLOBALS['egw_info'] and $GLOBALS['egw_domain'] + * + * @return array with validation errors, see setup_header::validation_errors + */ +function check_header_form() +{ + // setting the non-domain settings from the posted content + foreach($_POST['setting'] as $name => $value) + { + if (get_magic_quotes_gpc()) $value = stripslashes($value); + + switch($name) + { + case 'show_domain_selectbox': + case 'mcrypt_enabled': + case 'db_persistent': + $GLOBALS['egw_info']['server'][$name] = $value == 'True'; + break; + case 'new_admin_password': + if ($value) $GLOBALS['egw_info']['server']['header_admin_password'] = md5($value); + break; + case 'mcrypt_version': + $GLOBALS['egw_info']['server']['versions']['mcrypt'] = $value; + default: + $GLOBALS['egw_info']['server'][$name] = $value; + break; + } + } + + // setting the domain settings from the posted content + foreach($_POST['domains'] as $key => $domain) + { + if ($_POST['deletedomain'][$key]) continue; // domain deleted + + foreach($_POST['setting_'.$key] as $name => $value) + { + if (get_magic_quotes_gpc()) $value = stripslashes($value); + + if ($name == 'new_config_passwd') + { + if ($value) $GLOBALS['egw_domain'][$domain]['config_passwd'] = md5($value); + continue; + } + $GLOBALS['egw_domain'][$domain][$name] = $value; + } + } + + // validate the input and return errors + $validation_errors = $GLOBALS['egw_setup']->header->validation_errors( + $GLOBALS['egw_info']['server']['server_root'], + $GLOBALS['egw_info']['server']['include_root']); + + //echo "egw_info[server]=
".print_r($GLOBALS['egw_info']['server'],true)."
\n"; + //echo "egw_domain=
".print_r($GLOBALS['egw_domain'],true)."
\n"; + if ($validation_errors) echo "validation_errors=
".print_r($validation_errors,true)."
\n"; + + return $validation_errors; +} + +/** + * Display the form to edit the configuration + * + * @param array $validation_errors to display + */ +function show_header_form($validation_errors) +{ + global $setup_tpl; + + $GLOBALS['egw_setup']->html->show_header($GLOBALS['egw_info']['setup']['HeaderFormMSG'], False, 'header'); + + if(!get_var('ConfigLang',array('POST','COOKIE'))) + { + $setup_tpl->set_var('lang_select','
Please Select your language '.lang_select(True,'en')."
"); + } + + $setup_tpl->set_var('pagemsg',$GLOBALS['egw_info']['setup']['PageMSG']); + + // checking required PHP version 4.3+ + if((float) PHP_VERSION < '4.3') + { + echo '

' + . lang('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.',PHP_VERSION,'4.3','5'). "\n" + . '

'; + $GLOBALS['egw_setup']->html->show_footer(); + exit; + } + $supported_db = $GLOBALS['egw_setup']->header->check_db_support($detected); + + if (!count($supported_db)) + { + echo '

' + . lang('Did not find any valid DB support!') + . "
\n" + . lang('Try to configure your php to support one of the above mentioned DBMS, or install eGroupWare by hand.') + . '

'; + $GLOBALS['egw_setup']->html->show_footer(); + exit; + } + $js_default_db_ports = 'var default_db_ports = new Array();'."\n"; + foreach($GLOBALS['egw_setup']->header->default_db_ports as $db => $port) + { + $js_default_db_ports .= ' default_db_ports["'.$db.'"]="'.$port.'";'."\n"; + } + $setup_tpl->set_var('js_default_db_ports',$js_default_db_ports); + + // checking PHP session support + if ($GLOBALS['egw_setup']->header->check_load_extension('session')) + { + $detected[] = lang('You appear to have PHP session support. Enabling PHP sessions.'); + $supported_sessions_type['php4'] = 'PHP'; // makeing php sessions the default + $supported_sessions_type['php4-restore'] = lang('PHP plus restore'); // php-sessions with restore of egw_info array and egw object from the session + } + $supported_sessions_type['db'] = lang('Database'); + + if (file_exists('../header.inc.php') && is_file('../header.inc.php') && is_readable('../header.inc.php')) + { + $detected[] = lang('Found existing configuration file. Loading settings from the file...'); + + // This code makes sure the newer multi-domain supporting header.inc.php is being used + if(!isset($GLOBALS['egw_domain'])) + { + $detected[] = lang('You need to add some domains to your header.inc.php.'); + + $GLOBALS['egw_domain']['default'] = $GLOBALS['egw_setup']->header->domain_defaults( + $GLOBALS['egw_info']['server']['header_admin_user'], + $GLOBALS['egw_info']['server']['header_admin_password'],$supported_db); + } + elseif(@$GLOBALS['egw_info']['server']['header_version'] != @$GLOBALS['egw_info']['server']['current_header_version']) + { + $detected[] = lang("You're using an old header.inc.php version..."); + $detected[] = lang('Importing old settings into the new format....'); + } + } + else // no config file found => using or detecting the defaults + { + $detected[] = lang('Sample configuration not found. Using built in defaults'); + } + if ($validation_errors) $detected = $validation_errors; + $setup_tpl->set_var('detected','\n"); + + if ($_POST['adddomain']) + { + $GLOBALS['egw_domain'][lang('new')] = $GLOBALS['egw_setup']->header->domain_defaults( + $GLOBALS['egw_info']['server']['header_admin_user'], + $GLOBALS['egw_info']['server']['header_admin_password'],$supported_db); + } + // show the non-domain settings + //echo "
".print_r($GLOBALS['egw_info']['server'],true)."
\n"; + foreach($GLOBALS['egw_info']['server'] as $name => $value) + { + switch($name) + { + case 'db_persistent': + case 'show_domain_selectbox': + case 'mcrypt_enabled': + $setup_tpl->set_var($name.($GLOBALS['egw_info']['server'][$name] ? '_yes' : '_no'),' selected="selected"'); + break; + case 'versions': + $setup_tpl->set_var('mcrypt_version',htmlspecialchars($GLOBALS['egw_info']['server']['versions']['mcrypt'])); + break; + default: + $setup_tpl->set_var($name,htmlspecialchars($value)); + break; + } + } + $options = array(); + foreach($supported_sessions_type as $type => $label) + { + $options[] = ''; + } + $setup_tpl->set_var('session_options',implode("\n",$options)); + + // showing the settings of all domains + foreach($GLOBALS['egw_domain'] as $domain => $data) + { + $setup_tpl->set_var('db_domain',htmlspecialchars($domain)); + foreach($data as $name => $value) + { + if ($name == 'db_port' && !$value) // Set default here if the admin didn't set a port yet + { + $value = $GLOBALS['egw_setup']->header->default_db_ports[$data['db_type']]; + } + $setup_tpl->set_var($name,htmlspecialchars($value)); + } + $dbtype_options = ''; + foreach($supported_db as $db) + { + $dbtype_options .= '\n"; + } + $setup_tpl->set_var('dbtype_options',$dbtype_options); + + $setup_tpl->parse('domains','domain',True); + } + if(is_writeable('../header.inc.php') || !file_exists('../header.inc.php') && is_writeable('../')) + { + $setup_tpl->set_var('actions',lang('%1, %2 or %3 the configuration file.', + '', + '', + '')); + } + else + { + $setup_tpl->set_var('actions',lang('Cannot create the header.inc.php due to file permission restrictions.
Instead you can %1 or %2 the file.', + '', + '')); + } + // set domain and password for the continue button + @reset($GLOBALS['egw_domain']); + list($firstDomain) = @each($GLOBALS['egw_domain']); + + $setup_tpl->set_var(array( + 'FormDomain' => $firstDomain, + 'FormUser' => $GLOBALS['egw_domain'][$firstDomain]['config_user'], + 'FormPW' => $GLOBALS['egw_domain'][$firstDomain]['config_passwd'] + )); + + $setup_tpl->set_var(array( + 'lang_analysis' => $validation_errors ? lang('Validation errors') : lang('Analysis'), + 'lang_settings' => lang('Settings'), + 'lang_domain' => lang('Database instance (eGW domain)'), + 'lang_delete' => lang('Delete'), + 'lang_adddomain' => lang('Add new database instance (eGW domain)'), + 'lang_serverroot' => lang('Server Root'), + 'lang_serverroot_descr'=> lang('Path (not URL!) to your eGroupWare installation.'), + 'lang_includeroot' => lang('Include Root'), + 'lang_includeroot_descr'=>lang('Should be the same as Server Root unless you know what you are doing.'), + 'lang_adminuser' => lang('Header username'), + 'lang_adminuser_descr' => lang('Admin user for header manager'), + 'lang_adminpass' => lang('Header password'), + 'lang_adminpass_descr' => lang('Admin password to header manager').'.', + 'lang_leave_empty' => lang('Leave empty to keep current.'), + 'lang_setup_acl' => lang('Limit access'), + 'lang_setup_acl_descr' => lang('Limit access to setup to the following addresses, networks or hostnames (e.g. 127.0.0.1,10.1.1,myhost.dnydns.org)'), + 'lang_dbhost' => lang('DB Host'), + 'lang_dbhostdescr' => lang('Hostname/IP of database server').'
'. + lang('Postgres: Leave it empty to use the prefered unix domain sockets instead of a tcp/ip connection').'
'. + lang('ODBC / MaxDB: DSN (data source name) to use'), + 'lang_dbport' => lang('DB Port'), + 'lang_dbportdescr' => lang('TCP port number of database server'), + 'lang_dbname' => lang('DB Name'), + 'lang_dbnamedescr' => lang('Name of database'), + 'lang_dbuser' => lang('DB User'), + 'lang_dbuserdescr' => lang('Name of db user eGroupWare uses to connect'), + 'lang_dbpass' => lang('DB Password'), + 'lang_dbpassdescr' => lang('Password of db user'), + 'lang_dbtype' => lang('DB Type'), + 'lang_whichdb' => lang('Which database type do you want to use with eGroupWare?'), + 'lang_configuser' => lang('Configuration User'), + 'lang_configuser_descr'=> lang('Loginname needed for domain configuration'), + 'lang_configpass' => lang('Configuration Password'), + 'lang_passforconfig' => lang('Password needed for domain configuration.'), + 'lang_persist' => lang('Persistent connections'), + 'lang_persistdescr' => lang('Do you want persistent connections (higher performance, but consumes more resources)'), + 'lang_sesstype' => lang('Sessions Type'), + 'lang_sesstypedescr' => lang('What type of sessions management do you want to use (PHP session management may perform better)?'). + ' '.lang('PHP plus restore gives by far the best performance, as it stores the eGW enviroment completly in the session.'). + ' '.lang('Unfortunally some PHP/Apache packages have problems with it (Apache dies and you cant login anymore).'), + 'lang_enablemcrypt' => lang('Enable MCrypt'), + 'lang_mcrypt_warning' => lang('Not all mcrypt algorithms and modes work with eGroupWare. If you experience problems try switching it off.'), + 'lang_mcryptversion' => lang('MCrypt version'), + 'lang_mcryptversiondescr' => lang('Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use.'), + 'lang_mcryptiv' => lang('MCrypt initialization vector'), + 'lang_mcryptivdescr' => lang('This should be around 30 bytes in length.
Note: The default has been randomly generated.'), + 'lang_domselect' => lang('Domain select box on login'), + 'lang_domselect_descr' => lang('Alternatively domains can be accessed by logging in with username@domain.'), + 'lang_finaldescr' => lang('After retrieving the file, put it into place as the header.inc.php. Then, click "continue".'), + 'lang_continue' => lang('Continue'), + 'lang_Yes' => lang('Yes'), + 'lang_No' => lang('No') + )); + $setup_tpl->pfp('out','manageheader'); + + $GLOBALS['egw_setup']->html->show_footer(); +} diff --git a/setup/setup-cli.php b/setup/setup-cli.php new file mode 100755 index 0000000000..4f487ebf38 --- /dev/null +++ b/setup/setup-cli.php @@ -0,0 +1,419 @@ +#!/usr/bin/php + * +* ------------------------------------------------------------------------ * +* 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.socontacts_sql.inc.php 21634 2006-05-24 02:28:57Z ralfbecker $ */ + +/** + * Command line interface for setup + * + * @package addressbook + * @author Ralf Becker + * @copyright (c) 2006 by Ralf Becker + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + */ + +chdir(dirname(__FILE__)); // to enable our relative pathes to work, if we are called with a path + +if ($_SERVER['argc'] > 1) +{ + $arguments = $_SERVER['argv']; + array_shift($arguments); + $action = array_shift($arguments); +} +else +{ + $action = '--version'; +} + +if ((float) PHP_VERSION < '4.3') +{ + fail(98,lang2('You are using PHP version %1. eGroupWare now requires %2 or later, recommended is PHP %3.',PHP_VERSION,'4.3','5+')); +} + +switch($action) +{ + case '--show-languages': + case '--show-lang': + echo html_entity_decode(file_get_contents('lang/languages'),ENT_COMPAT,'utf-8'); + break; + + case '--version': + case '--check': + do_check(); + break; + + case '--create-header': + case '--edit-header': + case '--update-header': + do_header($action == '--create-header',$arguments); + break; + + case '--exit-codes': + list_exit_codes(); + break; + + default: + fail(20,lang2("Unknows option '%1' !!!",$action)); + + case '--help': + case '--usage': + do_usage(); + break; +} +exit(0); + +/** + * Dummy translation function, if we ever want to translate the command line interface + * + * @param string $message the message with %# replacements + * @param string $arg variable number of arguments + * @return string + */ +function lang2($message,$arg=null) +{ + $args = func_get_args(); + array_shift($args); + + return str_replace(array('%1','%2','%3','%4','%5'),$args,$message); +} + +/** + * Echos usage message + */ +function do_usage() +{ + echo lang2('Usage: %1 {--version|--create-header|--edit-header|--install|--update} [additional options]',basename($_SERVER['argv'][0]))."\n\n"; + + echo '--install '.lang2('[comma-separated languages(en)],[charset(default depending on languages default)],[backup to install]')."\n"; + echo '--show-languages '.lang2('get a list of availible languages')."\n"; + echo '--update '.lang2('run a database schema update (if necessary)')."\n"; + echo '--check '.lang2('checks eGroupWare\'s installed, it\'s versions and necessary upgrads (exits 0: eGW is up to date, 1: no header.inc.php exists, 2: header update necessary, 3: database schema update necessary)')."\n"; + echo '--exit-codes '.lang2('list all exist codes of the command line interface, 0 means Ok')."\n"; + + echo "\n".lang2('Create or edit the eGroupWare configuration file: header.inc.php:')."\n"; + echo '--create-header '.lang2('header-password[,header-user(admin)]')."\n"; + echo '--edit-header '.lang2('[header-password],[header-user],[new-password],[new-user]')."\n"; + + echo "\n".lang2('Additional options and there defaults (int brackets)')."\n"; + echo '--server-root '.lang2('path of eGroupWare install directory (default auto-detected)')."\n"; + echo '--session-type '.lang2('{db|php(default)|php-restore}')."\n"; + echo '--limit-access '.lang2('comma separated ip-addresses or host-names, default access to setup from everywhere')."\n"; + echo '--mcrypt '.lang2('use mcrypt to crypt session-data: {off(default)|on},[mcrypt-init-vector(default randomly generated)],[mcrypt-version(default empty = recent)]')."\n"; + echo '--db-persistent '.lang2('use persistent db connections: {on(default)|off}')."\n"; + echo '--domain-selectbox '.lang2('{off(default)|on}')."\n"; + + echo "\n".lang2('Adding, editing or deleting an eGroupWare domain / database instance:')."\n"; + echo '--domain '.lang2('add or edit a domain: [domain-name(default)],[db-name(egroupware)],[db-user(egroupware)],db-password,[db-type(mysql)],[db-host(localhost)],[db-port(db specific)],[config-user(as header)],[config-passwd(as header)]')."\n"; + echo '--delete-domain '.lang2('domain-name')."\n"; +} + +/** + * detect eGW versions + * + * @return array array with versions (keys phpgwapi, current_header and header) + */ +function detect_versions() +{ + $versions = null; + $GLOBALS['egw_info']['flags']['noapi'] = true; + if (!@include('../header.inc.php')) + { + if (!@include('../phpgwapi/setup/setup.inc.php')) + { + fail(99,lang2("eGroupWare sources in '%1' are not complete, file '%2' missing !!!",realpath('..'),'phpgwapi/setup/setup.inc.php')); // should not happen ;-) + } + return array( + 'phpgwapi' => $setup_info['phpgwapi']['version'], + 'current_header' => $setup_info['phpgwapi']['versions']['current_header'], + ); + } + return $GLOBALS['egw_info']['server']['versions']; +} + +/** + * Check if eGW is installed, which versions and if an update is needed + */ +function do_check() +{ + $versions = detect_versions(); + echo lang2('eGroupWare API version %1 found.',$versions['phpgwapi'])."\n"; + + if (isset($versions['header'])) // header.inc.php exists + { + echo lang2("eGroupWare configuration file (header.inc.php) version %1 exists%2",$versions['header'], + ($versions['header'] == $versions['current_header'] ? ' '.lang2('and is up to date') : '')).".\n"; + + if ($versions['header'] != $versions['current_header']) + { + // exit-code 2: header.inc.php needs upgrading + fail(2,lang2('You need to upgrade your header to the new version %1 (using --edit-header)!',$versions['current_header'])); + } + } + else + { + // exit-code 1: no header.inc.php + $this->check_fail_header_exists(); + } + // ToDo: check if eGW needs a schema upgrade and exit(3) if so +} + +function fail($exit_code,$message) +{ + echo $message."\n"; + exit($exit_code); +} + +/** + * List all exit codes used by the command line interface + * + */ +function list_exit_codes() +{ + error_reporting(error_reporting() & ~E_NOTICE); + + $codes = array(); + foreach(file(__FILE__) as $line) + { + if (preg_match('/fail\(([0-9]+),(.*)\);/',$line,$matches)) + { + eval('$codes['.$matches[1].'] = '.$matches[2].';'); + } + } + ksort($codes,SORT_NUMERIC); + foreach($codes as $num => $msg) + { + echo $num."\t".str_replace("\n","\n\t",$msg)."\n"; + } +} + +/** + * Check if we have a header.inc.php and fail with exit(10) if not + * + */ +function check_fail_header_exists() +{ + if (!file_exists('../header.inc.php')) + { + fail(1,lang2('eGroupWare configuration file (header.inc.php) does NOT exist.')."\n".lang2('Use --create-header to create the configuration file (--usage gives more options).')); + } +} +/** + * Create, edit or update the header.inc.php + * + * @param boolean $create true = create new header, false = edit (or update) existing header + * @param array $arguments + * @return int + */ +function do_header($create,&$arguments) +{ + // setting up the $GLOBALS['egw_setup'] object AND including the header.inc.php if it exists + $GLOBALS['egw_info'] = array( + 'flags' => array( + 'currentapp' => 'home', + 'noapi' => true, + )); + include('inc/functions.inc.php'); + + require_once('inc/class.setup_header.inc.php'); + $GLOBALS['egw_setup']->header =& new setup_header(); + + if (!file_exists('../header.inc.php')) + { + if (!$create) $this->check_fail_header_exists(); + + $GLOBALS['egw_setup']->header->defaults(false); + } + else + { + if ($create) fail(11,lang2('eGroupWare configuration file header.inc.php already exists, you need to use --edit-header or delete it first!')); + + // header.inc.php is already include by include('inc/functions.inc.php')! + unset($GLOBALS['egw_info']['flags']); + + // check header-admin-user and -password + @list($password,$user) = explode(',',@$arguments[0]); + if (!$user) $user = 'admin'; + require_once('inc/class.setup.inc.php'); + if (!setup::check_auth($user,$password,$GLOBALS['egw_info']['server']['header_admin_user'], + $GLOBALS['egw_info']['server']['header_admin_password'])) + { + fail(12,lang2('Access denied: wrong username or password for manage-header !!!')); + } + $GLOBALS['egw_info']['server']['server_root'] = EGW_SERVER_ROOT; + $GLOBALS['egw_info']['server']['include_root'] = EGW_INCLUDE_ROOT; + } + + $options = array( + '--create-header' => array( + 'header_admin_password' => 'egw_info/server/', + 'header_admin_user' => 'egw_info/server/', + ), + '--edit-header' => array( + 'header_admin_password' => 'egw_info/server/', + 'header_admin_user' => 'egw_info/server/', + 'new_admin_password' => 'egw_info/server/header_admin_password', + 'new_admin_user' => 'egw_info/server/header_admin_user', + ), + '--server-root' => 'egw_info/server/server_root', + '--include-root' => 'egw_info/server/include_root', + '--session-type' => array( + 'sessions_type' => array( + 'type' => 'egw_info/server/', + 'allowed' => array('php'=>'php4','php4'=>'php4','php-restore'=>'php4-restore','php4-restore'=>'php4-restore','db'=>'db'), + ), + ), + '--limit-access' => 'egw_info/server/setup_acl', // name used in setup + '--setup-acl' => 'egw_info/server/setup_acl', // alias to match the real name + '--mcrypt' => array( + 'mcrypt_enabled' => array( + 'type' => 'egw_info/server/', + 'allowed' => array('on' => true,'off' => false), + ), + 'mcrypt_iv' => 'egw_info/server/', + 'mcrypt' => 'egw_info/versions/mcrypt', + ), + '--domain-selectbox' => array( + 'show_domain_selectbox' => array( + 'type' => 'egw_info/server/', + 'allowed' => array('on' => true,'off' => false), + ), + ), + '--db-persistent' => array( + 'db_persistent' => array( + 'type' => 'egw_info/server/', + 'allowed' => array('on' => true,'off' => false), + ), + ), + '--domain' => array( + 'domain' => '@', + 'db_name' => 'egw_domain/@/', + 'db_user' => 'egw_domain/@/', + 'db_pass' => 'egw_domain/@/', + 'db_type' => 'egw_domain/@/', + 'db_host' => 'egw_domain/@/', + 'db_port' => 'egw_domain/@/', + 'config_user' => 'egw_domain/@/', + 'config_passwd' => 'egw_domain/@/', + ), + '--delete-domain' => true, + ); + array_unshift($arguments,$create ? '--create-header' : '--edit-header'); + while(($arg = array_shift($arguments))) + { + $values = count($arguments) && substr($arguments[0],0,2) !== '--' ? array_shift($arguments) : 'on'; + + if ($arg == '--delete-domain') + { + if (!isset($GLOBALS['egw_domain'][$values])) fail(22,lang2("Domain '%1' does NOT exist !!!",$values)); + unset($GLOBALS['egw_domain'][$values]); + continue; + } + + if (!isset($options[$arg])) fail(20,lang2("Unknow option '%1' !!!",$arg)); + + $option = $options[$arg]; + $values = !is_array($option) ? array($values) : explode(',',$values); + if (!is_array($option)) $option = array($option => $option); + $n = 0; + foreach($option as $name => $data) + { + if ($n >= count($values)) break; + + if (!is_array($data)) $data = array('type' => $data); + $type = $data['type']; + + $value = $values[$n]; + if (isset($data['allowed'])) + { + if (!isset($data['allowed'][$value])) + { + fail(21,lang2("'%1' is not allowed as %2. arguments of option %3 !!!",$value,1+$n,$arg)); + } + $value = $data['allowed'][$value]; + } + if ($type == '@') + { + $remember = $arg == '--domain' && !$value ? 'default' : $value; + if ($arg == '--domain' && (!isset($GLOBALS['egw_domain'][$remember]) || $create)) + { + $GLOBALS['egw_domain'][$remember] = $GLOBALS['egw_setup']->header->domain_defaults($GLOBALS['egw_info']['server']['header_admin_user'],$GLOBALS['egw_info']['server']['header_admin_password']); + } + } + elseif ($value !== '') + { + set_value($GLOBALS,str_replace('@',$remember,$type),$name,$value); + if ($name == 'egw_info/server/server_root') + { + set_value($GLOBALS,'egw_info/server/include_root',$name,$value); + } + } + ++$n; + } + } + if (($errors = $GLOBALS['egw_setup']->header->validation_errors($GLOBALS['egw_info']['server']['server_root'],$GLOBALS['egw_info']['server']['include_root']))) + { + echo '$GLOBALS[egw_info] = '; print_r($GLOBALS['egw_info']); + echo '$GLOBALS[egw_domain] = '; print_r($GLOBALS['egw_domain']); + echo "\n".lang2('Configuration errors:')."\n- ".implode("\n- ",$errors)."\n"; + fail(23,lang2("You need to fix the above errors, before the configuration file header.inc.php can be written!")); + } + $header = $GLOBALS['egw_setup']->header->generate($GLOBALS['egw_info'],$GLOBALS['egw_domain'], + $GLOBALS['egw_info']['server']['server_root'],$GLOBALS['egw_info']['server']['include_root']); + + echo $header; + + if (file_exists('../header.inc.php') && is_writable('../header.inc.php') || is_writable('../')) + { + if (is_writable('../') && file_exists('../header.inc.php')) unlink('../header.inc.php'); + if (($f = fopen('../header.inc.php','wb')) && fwrite($f,$header)) + { + fclose($f); + echo "\n".lang2('header.inc.php successful written.')."\n\n"; + exit(0); + } + } + fail(24,lang2("Failed writing configuration file header.inc.php, check the permissions !!!")); +} + +function set_value($arr,$index,$name,$value) +{ + if (substr($index,-1) == '/') $index .= $name; + + $var =& $arr; + foreach(explode('/',$index) as $name) + { + $var =& $var[$name]; + } + $var = strstr($name,'passw') ? md5($value) : $value; +} + +if (!function_exists('generate_mcyrpt_iv')) +{ + function generate_mcyrpt_iv() + { + 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' + ); + + $iv = ''; + for($i=0; $i<30; $i++) + { + $iv .= $random_char[rand(1,count($random_char))]; + } + return $iv; + } +} diff --git a/setup/templates/default/manageheader.tpl b/setup/templates/default/manageheader.tpl index 30b183f83e..a167b40028 100644 --- a/setup/templates/default/manageheader.tpl +++ b/setup/templates/default/manageheader.tpl @@ -30,25 +30,32 @@ function setDefaultDBPort(selectBox,portField)
- {lang_settings} - {lang_serverroot}
+ + {lang_serverroot} {lang_serverroot_descr}
+ + - {lang_includeroot}
+ + {lang_includeroot} {lang_includeroot_descr}
+ + - {lang_adminuser}
+ {lang_adminuser}
{lang_adminuser_descr} - {lang_adminpass}
- {lang_adminpass_descr} {lang_leave_empty} + {lang_adminpass}
+ + + {lang_adminpass_descr}
{lang_leave_empty} {lang_setup_acl}
@@ -73,7 +80,7 @@ function setDefaultDBPort(selectBox,portField) {lang_enablemcrypt}
- @@ -81,7 +88,7 @@ function setDefaultDBPort(selectBox,portField) {lang_mcrypt_warning} - {lang_mcryptversion}
+ {lang_mcryptversion}
{lang_mcryptversiondescr} @@ -90,7 +97,7 @@ function setDefaultDBPort(selectBox,portField) {lang_domselect}
- @@ -107,7 +114,7 @@ function setDefaultDBPort(selectBox,portField) {comment_r} - {errors} + {actions} @@ -173,8 +180,10 @@ function setDefaultDBPort(selectBox,portField) {lang_configuser_descr} - {lang_configpass}
- {lang_passforconfig} {lang_leave_empty} + {lang_configpass}
+ + + {lang_passforconfig}
{lang_leave_empty}