#!/usr/bin/perl # # REF: resooconfadmin2.pl # ResooSite v.0.9.5.1 -(p)Resoo 2002-2003 # (c)2003 - pascal blain / GNU GPL - General Public License # http://www.resoo.org/resoosite # pascal@resoo.org # require "resooconf.pl"; $query = $ENV{'QUERY_STRING'}; &parse_form; &get_date; &get_variables; ######## recuperation des variables ######## ##################################################### # Obtenir les informations du formulaire - Subroutine sub parse_form { # recevoir les variables read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # partager les variables en paire ( nom , valeur ) @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s/\"/\\\"/g; $FORM{$name} = $value; } } ################################################### # Mettre les champs dans des variables - Subroutine sub get_variables { if ($FORM{'dir2'}) { $dir2 = "$FORM{'dir2'}"; } if ($FORM{'server2'}) { $server2 = "$FORM{'server2'}"; } if ($FORM{'domainurl2'}) { $domainurl2 = "$FORM{'domainurl2'}"; } if ($FORM{'template2'}) { $template2 = "$FORM{'template2'}"; } if ($FORM{'myuprep_list2'}) { $myuprep_list2 = "$FORM{'myuprep_list2'}"; } if ($FORM{'sign2'}) { $sign2 = "$FORM{'sign2'}"; } if ($FORM{'use_backend2'}) { $use_backend2 = "$FORM{'use_backend2'}"; } if ($FORM{'backenddesc2'}) { $backenddesc2 = "$FORM{'backenddesc2'}"; } if ($FORM{'backendmax2'}) { $backendmax2 = "$FORM{'backendmax2'}"; } if ($FORM{'backendforce2'}) { $backendforce2 = "$FORM{'backendforce2'}"; } if ($FORM{'pageindex2'}) { $pageindex2 = "$FORM{'pageindex2'}"; } if ($FORM{'action'}) { $action = "$FORM{'action'}"; } if ($FORM{'verif'}) { $verif = "$FORM{'verif'}"; } else { $verif = "0" } if ($FORM{'util'}) { $util = "$FORM{'util'}"; if ($FORM{'pass'}) { $pass = "$FORM{'pass'}"; &verify; } else { $verif = ( $verif + 1 ); &page_verify; } } else { &page_verify; } } ######## affichage page mot de passe ######## sub page_verify { &page_tete; if ($verif == 2) { print "$fontgrande\n"; print "Votre mot de passe n'est pas valide,
\n"; print "merci de contacter \n"; print "l'administrateur du site $dir.
\n"; print "$finfontgrande\n"; } else { print "$fontstitre\n"; print "Vous êtes en mode \"Super Administrateur\":
\n"; print "$finfontstitre
\n"; print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$font Utilisateur: $finfont
$font Mot de passe: $finfont
\n"; print "
\n"; if ($verif == 1) { print "
 
\n"; print "$fontstitre\n"; print "deuxième essai\n"; print "$finfontstitre\n"; } else { print "
 
\n"; print "$fontpetite\n"; print "premier essai\n"; print "$finfontpetite\n"; } } &page_pied; } ######## verification mot de passe ######## sub verify { open(MAIN,"$private/$util.su") || &erreurpass; @main =
; foreach $main_line (@main) { $passcrypt = &resoocrypt($pass); if ($main_line =~ /^$passcrypt$/) { if ($action > 0) { &action; } else { $verif = "9"; #condition du titre page_admin $action = "0"; &page_admin; } } else { &erreurpass; } } close(MAIN); } sub erreurpass { $verif = ( $verif + 1 ); &page_verify; } ######## administration du site ######## sub page_admin { &page_tete; print "
\n"; print "\n"; ######## configuration des scripts ################################################ print ""; print "\n"; print ""; ######## URL ###################################################################### print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; print ""; print "\n"; ######## constantes ################################################################ print ""; print "\n"; print ""; print "\n"; print ""; print ""; print "\n"; $signaturebis = $sign; $signaturebis =~ s/\"/\"\;/g; $signaturebis =~ s/\©\;/\(c\)/g; print ""; print "\n"; print ""; print "\n"; print "\n"; print "\n"; print "\n"; &hidden; print "\n"; print "\n"; print ""; print "\n"; print "\n"; ######## page index ################################################################ print ""; print "\n"; $repaidebp =~ s/\"/\"\;/g; $repaidebp =~ s/
/\n/g; print "\n"; ######## log utilisateurs ################################################################ print ""; print "\n"; $repaidebp =~ s/\"/\"\;/g; $repaidebp =~ s/
/\n/g; print "\n"; ######## fond de formulaire ################################################################ print "\n"; &hidden; print "\n"; print "\n"; print "\n"; print "
$fontstitre Configuration des scripts $finfontstitre

$fontstitre URL: $finfontstitre

$font Répertoire du site: $finfont

$font Nom du serveur: $finfont

$font URL racine: $finfont

$fontstitre Constantes: $finfontstitre

$font Répertoires ouverts: $finfont
$font(si ce champs est laissé vide: la liste par défaut sera utilisée)$finfont

$font Squelette de site: $finfont\n"; opendir (TEMPL, $dir_template); @TEMPL=grep(/resoopao[\w]+\.(pl)$/i, readdir TEMPL); close (TEMPL); print "\n"; print "

$font Signature des pages: $finfont

$font Proposer backend: $finfont$font oui \n"; print " non $finfont
$font - nb de pages: $finfont $font - (par défaut: 6)$finfont
$font - page forcée: $finfont
$font - description: $finfont


$fontstitre Page index: $finfontstitre $font (affichage pour info seulement)$finfont

$fontstitre Utilisateurs: $finfontstitre $font (affichage pour info seulement)$finfont
\n"; print "\n"; &page_pied; } ######## entete et pied de page ######## sub page_tete { print "Content-type: text/html\; charset=ISO-8859-1\n\n"; &head; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "$font\n"; print "\n"; print "
\n"; print "$fonttitre\n"; if ( $verif == 9 ) { if ( $action == "4" ) { print "Oups ! Erreur...\n"; } else { print "Page configuration (2)\n"; } } else { print "Saisie du mot de passe $fontstitre(super-admin)$finfontstitre\n"; } print "$finfonttitre

\n"; print "Si vous avez un problème avec cette page, merci d'en informer "; print "l'administrateur de ce site
\n"; print "$finfont\n"; print "
\n"; print "$font\n"; print "\ \;
\ \;\n"; print "$finfont\n"; print "
\n"; print "$font \ \;
\n"; } sub page_pied { print "$finfont\n"; print "
\n"; print "$font\n"; print "\n"; print "
\n"; &foot; } ######## routines "action" ######## # action = 1 ###(creation) # action = 2 ###(modification) # action = 3 ###(suppression) # action = 4 (erreur) # action = 5 ###(creation admin) # action = 6 ###(suppression admin) # action = 7 ###(creation super admin) # action = 8 ###(suppression super admin) # action = 9 (config) # action = 10 ###(stat) sub action { ✓ &page_tete; print "$fontgrande\n"; if ($action == "9" ) { %champs=('dir2', 'dir','server2', 'server', 'domainurl2', 'domainurl', 'sign2', 'sign', 'use_backend2', 'use_backend', 'backenddesc2', 'backenddesc', 'backendmax2', 'backendmax', 'backendforce2', 'backendforce', 'template2', 'template', 'myuprep_list2', 'myuprep_list'); open (CNF, "resoourl.pl") || &badcheck; @cnf = ; close (CNF); open (CNF, ">resoourl.pl") || &badcheck2; foreach $line (@cnf) { print CNF "$line"; last if ($line =~ /\#EDIT/); } print CNF "\n"; foreach $champs (sort keys %champs){ print CNF "\$$champs{$champs} \= \"$$champs\"\;\n"; } print CNF "\n"; print CNF "1\;\n"; close (CNF); } if ($action == "4") { print "Erreur: $error.

\n"; print "$font\n"; print "utiliser le bouton retour de votre navigateur pour revenir au formulaire prédédent.

\n"; print "$finfont\n"; } else { print "Mise à jour configuration ...OK \!

\n"; } print "
\n"; print "
\n"; &hidden; print "\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; print "
\n"; print "
\n"; if ($page) { print "\n"; } print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "


\n"; print "$finfontgrande\n"; print "$font\n"; print "...
\n"; print "$finfont\n"; &page_pied; } sub check { if ($action == "9") { $sign2 =~ s/\(c\)/\©\;/g; } } sub badcheck { $error = "Fichier resoourl.pl absent..."; $action = "4"; } sub badcheck2 { $error = "Impossible d'écrire dans le fichier resoourl.pl..."; $action = "4"; }