2003-08-12 18:44:18 +02:00
< ? PHP
/* Copyright ( C ) 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2003-08-19 18:15:31 +02:00
* Copyright ( C ) 2003 Jean - Louis Bergamo < jlb @ j1b . org >
2003-08-12 18:44:18 +02:00
*
* 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 )
{
print " Forbidden " ;
llxfooter ();
exit ;
}
// positionne la variable pour le test d'affichage de l'icone
2003-09-01 01:04:04 +02:00
$main_use_mailman = ADHERENT_USE_MAILMAN ;
$main_use_glasnost = ADHERENT_USE_GLASNOST ;
$main_use_glasnost_auto = ADHERENT_USE_GLASNOST_AUTO ;
$main_use_spip = ADHERENT_USE_SPIP ;
$main_use_spip_auto = ADHERENT_USE_SPIP_AUTO ;
2003-08-12 18:44:18 +02:00
2003-08-28 17:41:56 +02:00
$typeconst = array ( 'yesno' , 'texte' , 'chaine' );
$var = True ;
if ( $HTTP_POST_VARS [ " action " ] == 'update' || $HTTP_POST_VARS [ " action " ] == 'add' )
{
if ( isset ( $HTTP_POST_VARS [ " consttype " ]) && $HTTP_POST_VARS [ " consttype " ] != '' ){
2004-02-01 01:55:46 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name=' " . $_POST [ " constname " ] . " ', value = ' " . $HTTP_POST_VARS [ " constvalue " ] . " ',note=' " . $HTTP_POST_VARS [ " constnote " ] . " ', type=' " . $typeconst [ $HTTP_POST_VARS [ " consttype " ]] . " ',visible=0 " ;
2003-08-28 17:41:56 +02:00
} else {
2004-02-01 01:55:46 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name=' " . $_POST [ " constname " ] . " ', value = ' " . $HTTP_POST_VARS [ " constvalue " ] . " ',note=' " . $HTTP_POST_VARS [ " constnote " ] . " ',visible=0 " ;
2003-08-28 17:41:56 +02:00
}
if ( $db -> query ( $sql ))
{
Header ( " Location: adherent.php " );
}
/*
$result = $db -> query ( $sql );
if ( ! $result )
{
print $db -> error ();
}
*/
}
2003-08-12 18:44:18 +02:00
2003-08-12 19:23:50 +02:00
if ( $action == 'set' )
2003-08-12 18:44:18 +02:00
{
2004-02-01 01:55:46 +01:00
$sql = " REPLACE INTO " . MAIN_DB_PREFIX . " const SET name = ' $name ', value=' " . $value . " ', visible=0 " ;
2003-08-12 18:44:18 +02:00
if ( $db -> query ( $sql ))
{
2003-08-12 19:23:50 +02:00
Header ( " Location: adherent.php " );
2003-08-12 18:44:18 +02:00
}
}
2003-08-12 19:23:50 +02:00
if ( $action == 'unset' )
2003-08-12 18:44:18 +02:00
{
2004-02-01 01:55:46 +01:00
$sql = " DELETE FROM " . MAIN_DB_PREFIX . " const WHERE name = ' $name ' " ;
2003-08-12 18:44:18 +02:00
if ( $db -> query ( $sql ))
{
2003-08-12 19:23:50 +02:00
Header ( " Location: adherent.php " );
2003-08-12 18:44:18 +02:00
}
}
2003-08-12 19:23:50 +02:00
llxHeader ();
2003-08-12 18:44:18 +02:00
/*
2003-08-28 17:41:56 +02:00
* Interface de configuration de certaines variables de la partie adherent
2003-08-12 18:44:18 +02:00
*/
2003-08-19 18:15:31 +02:00
print_titre ( " Gestion des adh<64> rents : Configurations de parametres " );
2003-08-12 18:44:18 +02:00
2003-08-28 17:41:56 +02:00
/*
* Mailman
*/
2003-08-12 18:44:18 +02:00
print '<table border="1" cellpadding="3" cellspacing="0">' ;
2003-08-28 17:41:56 +02:00
print " <tr $bc[$var] class=value><td>Mailman</td><td>Syst<73> me de mailing listes " ;
2003-08-12 19:23:50 +02:00
print '</td><td align="center">' ;
2003-09-01 01:04:04 +02:00
if ( defined ( " ADHERENT_USE_MAILMAN " ) && ADHERENT_USE_MAILMAN == 1 )
2003-08-12 19:23:50 +02:00
{
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=unset&value=0&name=ADHERENT_USE_MAILMAN">d<> sactiver</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
// Edition des varibales globales rattache au theme Mailman
2003-09-01 01:04:04 +02:00
$constantes = array ( 'ADHERENT_MAILMAN_LISTS' ,
'ADHERENT_MAILMAN_LISTS_COTISANT' ,
'ADHERENT_MAILMAN_ADMINPW' ,
'ADHERENT_MAILMAN_SERVER' ,
'ADHERENT_MAILMAN_UNSUB_URL' ,
'ADHERENT_MAILMAN_URL'
2003-08-28 17:41:56 +02:00
);
form_constantes ( $constantes );
2003-08-12 19:23:50 +02:00
}
else
{
print " " ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=set&value=1&name=ADHERENT_USE_MAILMAN">activer</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
2003-08-12 19:23:50 +02:00
}
2003-09-03 16:20:22 +02:00
print " <HR><BR> \n " ;
/*
* Gestion banquaire
*/
print '<table border="1" cellpadding="3" cellspacing="0">' ;
print " <tr $bc[$var] class=value><td>Gestion Banquaire</td><td>Gestion banquaire des adherents " ;
print '</td><td align="center">' ;
if ( defined ( " ADHERENT_BANK_USE " ) && ADHERENT_BANK_USE == 1 )
{
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
print " </td><td> \n " ;
print '<a href="' . $PHP_SELF . '?action=unset&value=0&name=ADHERENT_BANK_USE">d<> sactiver</a>' ;
print '</td></tr>' ;
print '</table>' ;
// Edition des varibales globales rattache au theme Mailman
$constantes = array ( 'ADHERENT_BANK_USE_AUTO' ,
'ADHERENT_BANK_ACCOUNT' ,
'ADHERENT_BANK_CATEGORIE'
);
form_constantes ( $constantes );
}
else
{
print " " ;
print " </td><td> \n " ;
print '<a href="' . $PHP_SELF . '?action=set&value=1&name=ADHERENT_BANK_USE">activer</a>' ;
print '</td></tr>' ;
print '</table>' ;
}
2003-08-28 17:41:56 +02:00
print " <HR><BR> \n " ;
/*
* Spip
*/
$var =! $var ;
print '<table border="1" cellpadding="3" cellspacing="0">' ;
print " <tr $bc[$var] class=value><td>Spip</td><td>Syst<73> me de publication en ligne " ;
2003-08-12 18:44:18 +02:00
print '</td><td align="center">' ;
2003-09-01 01:04:04 +02:00
if ( defined ( " ADHERENT_USE_SPIP " ) && ADHERENT_USE_SPIP == 1 )
2003-08-12 18:44:18 +02:00
{
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=unset&value=0&name=ADHERENT_USE_SPIP">d<> sactiver</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
// Edition des varibales globales rattache au theme Mailman
2003-09-01 01:04:04 +02:00
$constantes = array ( 'ADHERENT_USE_SPIP_AUTO' ,
'ADHERENT_SPIP_SERVEUR' ,
'ADHERENT_SPIP_DB' ,
'ADHERENT_SPIP_USER' ,
'ADHERENT_SPIP_PASS'
2003-08-28 17:41:56 +02:00
);
form_constantes ( $constantes );
2003-08-12 18:44:18 +02:00
}
else
{
print " " ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=set&value=1&name=ADHERENT_USE_SPIP">activer</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
2003-08-12 18:44:18 +02:00
}
2003-08-28 17:41:56 +02:00
print " <HR><BR> \n " ;
/*
* Glasnost
*/
$var =! $var ;
print '<table border="1" cellpadding="3" cellspacing="0">' ;
print " <tr $bc[$var] class=value><td>Glasnost</td><td>Syst<73> me de vote en ligne " ;
2003-08-12 19:23:50 +02:00
print '</td><td align="center">' ;
2003-09-01 01:04:04 +02:00
if ( defined ( " ADHERENT_USE_GLASNOST " ) && ADHERENT_USE_GLASNOST == 1 )
2003-08-12 19:23:50 +02:00
{
print '<img src="' . DOL_URL_ROOT . '/theme/' . $conf -> theme . '/img/tick.png" border="0"></a>' ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=unset&value=0&name=ADHERENT_USE_GLASNOST">d<> sactiver</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
// Edition des varibales globales rattache au theme Mailman
2003-09-01 01:04:04 +02:00
$constantes = array ( 'ADHERENT_USE_GLASNOST_AUTO' ,
'ADHERENT_GLASNOST_SERVEUR' ,
'ADHERENT_GLASNOST_USER' ,
'ADHERENT_GLASNOST_PASS'
2003-08-28 17:41:56 +02:00
);
form_constantes ( $constantes );
2003-08-12 19:23:50 +02:00
}
else
{
print " " ;
2003-08-28 17:41:56 +02:00
print " </td><td> \n " ;
2003-09-01 01:04:04 +02:00
print '<a href="' . $PHP_SELF . '?action=set&value=1&name=ADHERENT_USE_GLASNOST">activer</a>' ;
2003-08-28 17:41:56 +02:00
print '</td></tr>' ;
print '</table>' ;
2003-08-12 19:23:50 +02:00
}
2003-08-28 17:41:56 +02:00
print " <HR><BR> \n " ;
$var =! $var ;
/*
* Edition des varibales globales non rattache a un theme specifique
*/
print '<table border="1" cellpadding="3" cellspacing="0">' ;
print " <tr $bc[$var] class=value><td>Variables globales</td><td>Variables globales non rattach<63> es a un th<74> me " ;
2003-08-12 19:23:50 +02:00
print '</td></tr>' ;
2003-08-12 18:44:18 +02:00
print '</table>' ;
2003-09-01 01:04:04 +02:00
$constantes = array ( 'ADHERENT_TEXT_NEW_ADH' ,
'ADHERENT_MAIL_COTIS_SUBJECT' ,
'ADHERENT_MAIL_COTIS' ,
'ADHERENT_MAIL_EDIT_SUBJECT' ,
'ADHERENT_MAIL_EDIT' ,
'ADHERENT_MAIL_NEW_SUBJECT' ,
'ADHERENT_MAIL_NEW' ,
'ADHERENT_MAIL_RESIL_SUBJECT' ,
'ADHERENT_MAIL_RESIL' ,
'ADHERENT_MAIL_VALID_SUBJECT' ,
'ADHERENT_MAIL_VALID' ,
'ADHERENT_MAIL_FROM' ,
'ADHERENT_CARD_HEADER_TEXT' ,
'ADHERENT_CARD_TEXT' ,
2003-09-15 17:22:59 +02:00
'ADHERENT_CARD_FOOTER_TEXT' ,
'ADHERENT_ETIQUETTE_TYPE'
2003-08-28 17:41:56 +02:00
);
form_constantes ( $constantes );
2003-08-12 18:44:18 +02:00
$db -> close ();
llxFooter ();
2003-08-28 17:41:56 +02:00
function form_constantes ( $tableau ){
// Variables globales
global $db , $bc ;
$form = new Form ( $db );
print '<table border="1" cellpadding="3" cellspacing="0">' ;
print '<TR class="liste_titre">' ;
print '<TD>Description</TD>' ;
print '<TD>Valeur</TD>' ;
print '<TD>Type</TD>' ;
//print '<TD>Note</TD>';
print " <TD>Action</TD> " ;
print " </TR> \n " ;
$var = True ;
foreach ( $tableau as $const ){
2004-02-01 01:55:46 +01:00
$sql = " SELECT rowid, name, value, type, note FROM " . MAIN_DB_PREFIX . " const WHERE name=' $const ' " ;
2003-08-28 17:41:56 +02:00
$result = $db -> query ( $sql );
if ( $result && ( $db -> num_rows () == 1 )) {
$obj = $db -> fetch_object ( 0 );
$var =! $var ;
print '<form action="' . $PHP_SELF . '" method="POST">' ;
print '<input type="hidden" name="action" value="update">' ;
print '<input type="hidden" name="rowid" value="' . $rowid . '">' ;
print '<input type="hidden" name="constname" value="' . $obj -> name . '">' ;
print '<input type="hidden" name="constnote" value="' . stripslashes ( nl2br ( $obj -> note )) . '">' ;
print " <tr $bc[$var] class=value><td> " . stripslashes ( nl2br ( $obj -> note )) . " </td> \n " ;
print '<td>' ;
if ( $obj -> type == 'yesno' )
{
$form -> selectyesnonum ( 'constvalue' , $obj -> value );
print '</td><td>' ;
$form -> select_array ( 'consttype' , array ( 'yesno' , 'texte' , 'chaine' ), 0 );
}
elseif ( $obj -> type == 'texte' )
{
print '<textarea name="constvalue" cols="35" rows="5"wrap="soft">' ;
print $obj -> value ;
print " </textarea> \n " ;
print '</td><td>' ;
$form -> select_array ( 'consttype' , array ( 'yesno' , 'texte' , 'chaine' ), 1 );
}
else
{
print '<input type="text" size="30" name="constvalue" value="' . stripslashes ( $obj -> value ) . '">' ;
print '</td><td>' ;
$form -> select_array ( 'consttype' , array ( 'yesno' , 'texte' , 'chaine' ), 2 );
}
print '</td><td>' ;
// print '<input type="text" size="15" name="constnote" value="'.stripslashes(nl2br($obj->note)).'">';
// print '</td><td>';
print '<input type="Submit" value="Update" name="Button"><BR>' ;
print '<a href="' . $PHP_SELF . '?name=$const&action=unset">Delete</a>' ;
print " </td></tr> \n " ;
print '</form>' ;
$i ++ ;
}
}
print '</table>' ;
}
2003-08-12 18:44:18 +02:00
?>