ajout du systme de syndication de sites webs externes et de la configuration du calendrier ...
This commit is contained in:
parent
5d55e52038
commit
c1055c4292
115
htdocs/admin/external_rss.php
Normal file
115
htdocs/admin/external_rss.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
*
|
||||
* 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");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if (!$user->admin)
|
||||
{
|
||||
print "Forbidden";
|
||||
llxfooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = new Db();
|
||||
|
||||
$def = array();
|
||||
|
||||
// positionne la variable pour le test d'affichage de l'icone
|
||||
|
||||
$phpwiki_url = EXTERNAL_RSS;
|
||||
|
||||
if ($action == 'save')
|
||||
{
|
||||
$sql = "REPLACE INTO llx_const SET name = 'EXTERNAL_RSS_URL_0', value='".$external_rss_url_0."', visible=0";
|
||||
$sql1 = "REPLACE INTO llx_const SET name = 'EXTERNAL_RSS_TITLE_0', value='".$external_rss_title_0."', visible=0";
|
||||
$sql2 = "REPLACE INTO llx_const SET name = 'EXTERNAL_RSS_URLRSS_0', value='".$external_rss_urlrss_0."', visible=0";
|
||||
|
||||
if ($db->query($sql) && $db->query($sql1) && $db->query($sql2))
|
||||
{
|
||||
// la constante qui a été lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage cohérent
|
||||
print "ok bien enregistré";
|
||||
}
|
||||
else
|
||||
print "erreur d'enregistement !";
|
||||
}
|
||||
else {
|
||||
|
||||
/*
|
||||
* Affichage du formulaire de saisie
|
||||
*/
|
||||
|
||||
print_titre("Configuration du lien vers un site syndiqué");
|
||||
|
||||
print "\n<p align=\"justify\">Attention, pour la récupération des données au format RSS, les urls en https ne marchent pas pour l'instant. </p>
|
||||
<p>Exemples:
|
||||
<ul>
|
||||
<li>WikiApril / http://wiki.april.org / http://wiki.april.org/RecentChanges?format=rss (et tous les sites phpwiki)</li>
|
||||
<li>LinuxFR / http://linuxfr.org / http://www.linuxfr.org/backend.rss</li>
|
||||
<li>WikiInterneRycks / ../wiki / ../wiki/RecentChanges?format=rss (ne marche pas, je suis en https et en plus y a un apache_auth)</li>
|
||||
<li>LoLix / http://back.fr.lolix.org/ /(ha ben non, ne marche pas, pfffff à faire chez lolix !)</li>
|
||||
<li>Parinux / http://parinux.org/ / http://parinux.org/backend.rss</li>
|
||||
<li>Docs d'AbulÉdu / http://docs.abuledu.org / http://docs.abuledu.org/backend.php3 (et tous les sites spip)</li>
|
||||
</ul>
|
||||
</p>
|
||||
<form name=\"externalrssconfig\" action=\"" . $_SERVER['SCRIPT_NAME'] . "\" method=\"post\">
|
||||
<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\">\n";
|
||||
|
||||
// Pour l'instant on fait un seul RSS externe, mais c'est sans soucis qu'on passe à plus !
|
||||
// ptet définir une variable pour NBMAX_RSS_EXTERNE ... modifier en fonction le fichier
|
||||
// ../pre.inc.php3
|
||||
for($i = 0; $i < 1; $i++) {
|
||||
print "<tr>
|
||||
<td>Titre</td>
|
||||
<td><input type=\"text\" name=\"external_rss_title_" . $i . "\" value=\"" . @constant("EXTERNAL_RSS_TITLE_" . $i) . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL du site</td>
|
||||
<td><input type=\"text\" name=\"external_rss_url_0\" value=\"". @constant("EXTERNAL_RSS_URL_" . $i) . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>URL du RSS</td>
|
||||
<td><input type=\"text\" name=\"external_rss_urlrss_0\" value=\"" . @constant("EXTERNAL_RSS_URLRSS_" . $i) . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=\"2\"><input type=\"submit\" name=\"envoyer\" value=\"Enregistrer\"></td>
|
||||
</tr>\n";
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
|
||||
print "</table>
|
||||
<input type=\"hidden\" name=\"action\" value=\"save\"></td>
|
||||
</form>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -104,6 +104,16 @@ $modules["MAIN_MODULE_POSTNUKE"][1] = "MAIN_MODULE_POSTNUKE";
|
||||
$modules["MAIN_MODULE_POSTNUKE"][2] = MAIN_MODULE_POSTNUKE;
|
||||
$modules["MAIN_MODULE_POSTNUKE"][3] = "Module de gestion de postnuke";
|
||||
|
||||
$modules["MAIN_MODULE_WEBCALENDAR"][0] = "Module Webcalendar";
|
||||
$modules["MAIN_MODULE_WEBCALENDAR"][1] = "MAIN_MODULE_WEBCALENDAR";
|
||||
$modules["MAIN_MODULE_WEBCALENDAR"][2] = MAIN_MODULE_WEBCALENDAR;
|
||||
$modules["MAIN_MODULE_WEBCALENDAR"][3] = "Module de gestion du calendrier";
|
||||
|
||||
$modules["MAIN_MODULE_EXTERNAL_RSS"][0] = "Module de syndication externe";
|
||||
$modules["MAIN_MODULE_EXTERNAL_RSS"][1] = "MAIN_MODULE_EXTERNAL_RSS";
|
||||
$modules["MAIN_MODULE_EXTERNAL_RSS"][2] = MAIN_MODULE_EXTERNAL_RSS;
|
||||
$modules["MAIN_MODULE_EXTERNAL_RSS"][3] = "Module de gestion de syndication de sites externes";
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$sql = "REPLACE INTO llx_const SET name = '".$value."', value='1', visible = 0";
|
||||
|
||||
@ -49,6 +49,16 @@ function llxHeader($head = "", $urlp = "") {
|
||||
$menu->add_submenu("fichinter.php", "Fiches d'intervention");
|
||||
}
|
||||
|
||||
if(defined("MAIN_MODULE_WEBCALENDAR") && MAIN_MODULE_WEBCALENDAR)
|
||||
{
|
||||
$menu->add_submenu("webcalendar.php", "Calendrier");
|
||||
}
|
||||
|
||||
if(defined("MAIN_MODULE_EXTERNAL_RSS") && MAIN_MODULE_EXTERNAL_RSS)
|
||||
{
|
||||
$menu->add_submenu("external_rss.php", "Syndication");
|
||||
}
|
||||
|
||||
|
||||
$menu->add("boxes.php", "Boites");
|
||||
|
||||
|
||||
118
htdocs/admin/webcalendar.php
Normal file
118
htdocs/admin/webcalendar.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Éric Seigne <erics@rycks.com>
|
||||
*
|
||||
* 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");
|
||||
|
||||
llxHeader();
|
||||
|
||||
if (!$user->admin)
|
||||
{
|
||||
print "Forbidden";
|
||||
llxfooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$db = new Db();
|
||||
|
||||
$def = array();
|
||||
|
||||
// positionne la variable pour le test d'affichage de l'icone
|
||||
if ($action == 'save')
|
||||
{
|
||||
if(trim($phpwebcalendar_pass) == trim($phpwebcalendar_pass2)) {
|
||||
$sql = "REPLACE INTO llx_const SET name = 'PHPWEBCALENDAR_URL', value='".$phpwebcalendar_url."', visible=0";
|
||||
|
||||
$sql1 = "REPLACE INTO llx_const SET name = 'PHPWEBCALENDAR_HOST', value='".$phpwebcalendar_host."', visible=0";
|
||||
$sql2 = "REPLACE INTO llx_const SET name = 'PHPWEBCALENDAR_DBNAME', value='".$phpwebcalendar_dbname."', visible=0";
|
||||
$sql3 = "REPLACE INTO llx_const SET name = 'PHPWEBCALENDAR_USER', value='".$phpwebcalendar_user."', visible=0";
|
||||
$sql4 = "REPLACE INTO llx_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
|
||||
print "<p>ok bien enregistré</p>\n";
|
||||
print "<p>dans quelques jours je rajoute un test de connexion à la base de données de webcal pour être certain que tout est OK</p>\n";
|
||||
define("PHPWEBCALENDAR_URL", $phpwebcalendar_url);
|
||||
}
|
||||
else
|
||||
print "erreur d'enregistement !";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<p>erreur, votre mot de passe n'est pas vérifié, merci de <a href=\"javascript:back()\">retourner à la page de saisie</a> pour corriger votre erreur</p>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Affichage du formulaire de saisie
|
||||
*/
|
||||
|
||||
print_titre("Configuration du lien vers le calendrier");
|
||||
|
||||
print "\n<form name=\"phpwebcalendarconfig\" action=\"" . $_SERVER['SCRIPT_NAME'] . "\" method=\"post\">
|
||||
<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\">
|
||||
<tr>
|
||||
<td>Adresse URL d'accès au calendrier</td>
|
||||
<td><input type=\"text\" name=\"phpwebcalendar_url\" value=\"". PHPWEBCALENDAR_URL . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Serveur où la base du calendrier est hébergée</td>
|
||||
<td><input type=\"text\" name=\"phpwebcalendar_host\" value=\"". PHPWEBCALENDAR_HOST . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Nom de la base de données</td>
|
||||
<td><input type=\"text\" name=\"phpwebcalendar_dbname\" value=\"". PHPWEBCALENDAR_DBNAME . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Identifiant d'accès à la base</td>
|
||||
<td><input type=\"text\" name=\"phpwebcalendar_user\" value=\"". PHPWEBCALENDAR_USER . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mot de passe d'accès à la base</td>
|
||||
<td><input type=\"password\" name=\"phpwebcalendar_pass\" value=\"" . PHPWEBCALENDAR_PASS . "\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mot de passe (vérification)</td>
|
||||
<td><input type=\"password\" name=\"phpwebcalendar_pass2\" value=\"" . PHPWEBCALENDAR_PASS ."\" size=\"45\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=\"2\"><input type=\"submit\" name=\"envoyer\" value=\"Enregistrer\"></td>
|
||||
</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
print "</table>
|
||||
<input type=\"hidden\" name=\"action\" value=\"save\"></td>
|
||||
</form>\n";
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
@ -105,11 +105,13 @@ class WebcalConf
|
||||
{
|
||||
$this->enabled = 1;
|
||||
|
||||
$this->url = "http://webcalendar.lafrere.lan/";
|
||||
$this->url = PHPWEBCALENDAR_URL;
|
||||
|
||||
$this->db = new DbConf();
|
||||
$this->db->user = "webcal";
|
||||
$this->db->name = "webcal";
|
||||
$this->db->host = PHPWEBCALENDAR_HOST;
|
||||
$this->db->user = PHPWEBCALENDAR_USER;
|
||||
$this->db->pass = PHPWEBCALENDAR_PASS;
|
||||
$this->db->name = PHPWEBCALENDAR_DBNAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -82,11 +82,11 @@ else
|
||||
print '-';
|
||||
}
|
||||
print '</td><td width="15%" class="menu" align="center">';
|
||||
if ($conf->webcal->enabled)
|
||||
|
||||
if(defined("MAIN_MODULE_WEBCALENDAR") && MAIN_MODULE_WEBCALENDAR)
|
||||
{
|
||||
print '<a class="menu" href="'.$conf->webcal->url.'">Calendrier</a>';
|
||||
print '<a class="menu" href="'. PHPWEBCALENDAR_URL .'">Calendrier</a>';
|
||||
};
|
||||
print ' </TD>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@ -94,3 +94,4 @@ class Webcal {
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@ -127,6 +127,20 @@ function llxHeader($head = "") {
|
||||
$menu->add(DOL_URL_ROOT."/postnuke/articles/", "Editorial");
|
||||
}
|
||||
|
||||
// à modifier si on a plus d'un module RSS externe !
|
||||
if (defined("MAIN_MODULE_EXTERNAL_RSS") && MAIN_MODULE_EXTERNAL_RSS)
|
||||
{
|
||||
$menu->add(EXTERNAL_RSS_URL_0, EXTERNAL_RSS_TITLE_0);
|
||||
require_once("includes/magpierss/rss_fetch.inc");
|
||||
$rss = fetch_rss( EXTERNAL_RSS_URLRSS_0 );
|
||||
|
||||
foreach ($rss->items as $item) {
|
||||
$href = $item['link'];
|
||||
$title = $item['title'];
|
||||
$menu->add_submenu("$href","$title");
|
||||
}
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/user/", "Utilisateurs");
|
||||
|
||||
if ($user->admin)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user