diff --git a/htdocs/admin/webcalendar.php b/htdocs/admin/webcalendar.php
index b8c7df14f79..cda2caf89b1 100644
--- a/htdocs/admin/webcalendar.php
+++ b/htdocs/admin/webcalendar.php
@@ -25,7 +25,7 @@
require("./pre.inc.php");
if (!$user->admin)
- accessforbidden();
+accessforbidden();
llxHeader();
@@ -35,70 +35,48 @@ print '
';
$def = array();
-// positionne la variable pour le test d'affichage de l'icone
+$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"];
-if ($action == 'save')
+// Positionne la variable pour le test d'affichage de l'icone
+if ($actionsave)
{
- if(trim($phpwebcalendar_pass) == trim($phpwebcalendar_pass2))
- {
- $conf = new Conf();
- $conf->db->host = $phpwebcalendar_host;
- $conf->db->name = $phpwebcalendar_dbname;
- $conf->db->user = $phpwebcalendar_user;
- $conf->db->pass = $phpwebcalendar_pass;
+ 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";
- $webcal = new DoliDb();
-
- if ($webcal->connected == 1)
- {
- $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 = 1;
- }
- else
- print "
erreur d'enregistement dans la base de données $db !
le mot de passe n'est pas identique, veuillez le reintroduire
Les identifiants webcalendar ont été sauvegardés.
"; + } + } + else + { + $ok="Le mot de passe n'est pas identique, veuillez le saisir à nouveau
la connection à la base de données webcalendar $phpwebcalendar_dbname à réussi
La connection à la base de données '$phpwebcalendar_dbname' à réussi
La connection à la base de données '$phpwebcalendar_dbname' à échoué.
la connection à la base de données webcalendar $phpwebcalendar_dbname à - réussi
la connection à la base de données webcalendar $phpwebcalendar_dbname à - échoué