* Copyright (C) 2003 Éric Seigne * Copyright (C) 2004 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ require("./pre.inc.php"); if (!$user->admin) accessforbidden(); llxHeader(); print_titre("Configuration du lien vers le calendrier partagé"); print '
'; $def = array(); $phpwebcalendar_url=$_POST["phpwebcalendar_url"]; $phpwebcalendar_host=$_POST["phpwebcalendar_host"]; $phpwebcalendar_dbname=$_POST["phpwebcalendar_dbname"]; $phpwebcalendar_user=$_POST["phpwebcalendar_user"]; $phpwebcalendar_pass=$_POST["phpwebcalendar_pass"]; $phpwebcalendar_pass2=$_POST["phpwebcalendar_pass2"]; $actionsave=$_POST["save"]; $actiontest=$_POST["test"]; // Positionne la variable pour le test d'affichage de l'icone if ($actionsave) { if (trim($phpwebcalendar_pass) == trim($phpwebcalendar_pass2)) { $sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PHPWEBCALENDAR_URL',value='".$phpwebcalendar_url."', visible=0"; $sql1 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PHPWEBCALENDAR_HOST',value='".$phpwebcalendar_host."', visible=0"; $sql2 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PHPWEBCALENDAR_DBNAME', value='".$phpwebcalendar_dbname."', visible=0"; $sql3 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PHPWEBCALENDAR_USER', value='".$phpwebcalendar_user."', visible=0"; $sql4 = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'PHPWEBCALENDAR_PASS', value='".$phpwebcalendar_pass."', visible=0"; if ($db->query($sql) && $db->query($sql1) && $db->query($sql2) && $db->query($sql3) && $db->query($sql4)) { // la constante qui a été lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage cohérent define("PHPWEBCALENDAR_URL", $phpwebcalendar_url); define("PHPWEBCALENDAR_HOST", $phpwebcalendar_host); define("PHPWEBCALENDAR_DBNAME",$phpwebcalendar_dbname); define("PHPWEBCALENDAR_USER", $phpwebcalendar_user); define("PHPWEBCALENDAR_PASS", $phpwebcalendar_pass); $ok = "

Les identifiants webcalendar ont été sauvegardés.

"; } } else { $ok="

Le mot de passe n'est pas identique, veuillez le saisir à nouveau


\n"; } } /** * Affichage du formulaire de saisie */ print "\n
\n"; clearstatcache(); print "
Paramètre Valeur
Adresse URL d'accès au calendrier
Serveur où la base du calendrier est hébergée
Nom de la base de données
Identifiant d'accès à la base
Mot de passe d'accès à la base
Mot de passe (vérification)
\n"; /** * Test de la connection a la database webcalendar * */ if ($ok) print "$ok
"; if ($actiontest) { $conf = new Conf(); $conf->db->host = $phpwebcalendar_host; $conf->db->name = $phpwebcalendar_dbname; $conf->db->user = $phpwebcalendar_user; $conf->db->pass = $phpwebcalendar_pass; $webcal = new DoliDb(); if ($webcal->connected == 1) { print "

La connection à la base de données '$phpwebcalendar_dbname' à réussi


"; $webcal->close(); } else print "

La connection à la base de données '$phpwebcalendar_dbname' à échoué.


"; } llxFooter(); ?>