Valid XHTML     Valid CSS2    

Listing du fichier std.php

 

00001     <?php
00002     
00003     
# # (gH) -_- std.php ; TimeStamp (unix) : 09 Janvier 2025 vers 21:42
00004     
00005     
error_reporting(E_ALL | E_NOTICE | E_STRICT ) ;
00006     
00007     require_once(
"strfun.php"
) ; # <== fonctions usuelles pour chaines de caract&egrave;res
00008     
00009     # std.php version 3.47
00010     
00011     ###########################################################
00012     ###########################################################
00013     ## ##
00014     ## fonctions standard pour pages web ##
00015     ## ##
00016     ###########################################################
00017     
00018     ###########################################################
00019     
00020     # 3.27 : fonctions pour svg
00021     # 3.25 : volontairement non d&eacute;taill&eacute;
00022     # 3.23 : ajouts de fonctions pour mysql
00023     # 3.21 : reprise de pre_fichier, option utf et input_option
00024     
00025     # 3.19 : ajout de bouton et finbouton
00026     # 3.17 : ajout d'un id pour debutSection()
00027     # 3.15 : modification de ul() et ol()
00028     # 3.13 : modification de dd et dt pour avoir des dl compactes (pas de <dl compact="compact"> en strict
00029     # 3.11 : ajout de tableauDar, reprise de tdm (table des mati&egrave;res)
00030     # 3.09 : ajout de label et legende, reprise de th
00031     # 3.07 : ajout de $xtra pour ancre et td, modification de js dans debutPage
00032     # 3.05 : reprise de cmt, ajout de sdl
00033     # 3.03 : reprise de input_radio
00034     # 3.01 : reprise de input_radio
00035     # 2.99 : modification de textarea
00036     # 2.97 : reprise de pre_fichier
00037     # 2.95 : ajout de debutPageMinimale() et finPageMinimale()
00038     # 2.93 : ajout de comptageSqlSimple (pour mysql) et de pct
00039     # 2.91 : reprise de debutPage et finPage pour &eacute;viter d'avoir &agrave; recopier les gif, jpg et css
00040     # &agrave; titre d'exemple seulement ==> debutPageGeneral et finPageGeneral
00041     # 2.89 : modification de la fonction hr ; ajout de l'objet tdm
00042     # 2.87 : ajout des fonctions debutPageMinimal et finPageMinimal ; modification de fieldset
00043     # 2.85 : ajout de la fonction pre_fichier
00044     # 2.79 : am&eacute;lioration de certaines fonctions (ajout du param&egrave;tre $cla)
00045     # 2.77 : ajout des fonctions span, finspan, tdvide, snbsp
00046     # 2.75 : ajout des fonctions img, ahref, href, aname
00047     # 2.73 : ajout des fonctions b pour <b>... et em pour <em>...
00048     # 2.71 : ajouts des fonctions jsf et js pour automatiser <script...
00049     # 2.69 : ajouts de $js dans debutPage
00050     # 2.67 : ajouts mineurs de petites fonctions (formulaire)
00051     # 2.65 : ajout d'un param&egrave;tre facultatif pour feuille de style dans debutPage
00052     # 2.63 : ajout d'un param&egrave;tre facultatif pour DTD "strict" dans debutPage
00053     # 2.61 : ajout de fonctions pour formulaire
00054     
00055     #######################################################################################
00056     
00057     
function
debutPageMinimal($titre="",$styl="",$classFond="",$enc="iso") {
00058     
00059     
#######################################################################################
00060     
00061     
echo
"<?xml version='1.0' encoding='ISO-8859-1' ?>\n" ;
00062     echo
"<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n" ;
00063     echo
"<html xmlns='http://www.w3.org/1999/xhtml' lang='fr' xml:lang='fr'>\n" ;
00064     
00065     echo
"<head>\n" ;
00066     if (
$enc
=="iso") {
00067      echo
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /> \n" ;
00068     } else {
00069      echo
"<meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> \n" ;
00070     }
# fin si
00071     
00072     # chargement de style(s) personnalis&eacute;(s)
00073     
00074     
if (
$styl!="") {
00075     
$tstyl
= preg_split("/\s+/",trim($styl)) ;
00076      foreach (
$tstyl
as $fstyl) {
00077      echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"
$fstyl\" title=\"gh\" /> \n" ;
00078      } ;
# fin pour
00079     
} ; # fin de si
00080     
00081     
echo
"<title> \n" ;
00082     echo
"
$titre&nbsp;\n" ;
00083     echo
"</title> \n" ;
00084     echo
"</head> \n" ;
00085     
00086     if (
$classFond
=="") {
00087      echo
"<body> \n" ;
00088     } else {
00089      echo
"<body class='
$classFond'> \n" ;
00090     } ;
# fin si
00091     
00092     
} # fin de fonction debutPageMinimal
00093     
00094     #######################################################################################
00095     
00096     
function
finPageMinimal() {
00097     
00098     
#######################################################################################
00099     
00100     
echo
"</body> \n" ;
00101     echo
"</html> \n" ;
00102     
00103     }
# fin de fonction finPageMinimal
00104     
00105     ###########################################################
00106     
00107     
function
debutPage($titre="",$grm="strict",$styl="",$js="",$favicon="",$mathjax="off",$xml="off",$enc="iso") {
00108     
00109     
###########################################################
00110     
00111     
if (
$enc=="iso") { $encod = "ISO-8859-1" ; } else { $encod = "utf" ; } ;
00112     if (
$grm
=="svg") { header("Content-type: image/svg+xml") ; } ;
00113     if (
$xml
=="on") { echo "<"."?xml version=\"1.0\" encoding=\"$encod\" ?".">\n" ; } ;
00114     
#if ($grm!="html5") { echo "<"."?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?".">\n" ; } ;
00115     
00116     
if ((
$grm=="strict") and ($enc=="iso")) { header("Content-Type: text/html;charset=$encod") ; } ;
00117     if (
$grm
=="std") {
00118      echo
"<!DOCTYPE html \n" ;
00119      echo
" PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n" ;
00120      echo
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n" ;
00121      echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"fr\" xml:lang=\"fr\"> \n" ;
00122     } elseif (
$grm
=="svg") {
00123      echo
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
."\n" ;
00124     
#echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">'."\n" ;
00125     
echo
'<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">'."\n" ;
00126     } elseif (
$grm
=="html5") {
00127      echo
"<!doctype html>\n" ;
00128      echo
"<html>\n" ;
00129     } else {
00130      echo
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
."\n" ;
00131      echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"fr\" xml:lang=\"fr\">\n" ;
00132     } ;
# fin de si
00133     
00134     
echo
"<head> \n" ;
00135     echo
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=
$encod\" />\n" ;
00136     
00137     
# chargement &eacute;ventuel de mathajx
00138     
00139     
if (
$mathjax=="on") {
00140     
00141      echo
"<script type='text/x-mathjax-config'>\n" ;
00142     
#echo " MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]} }) ; \n" ;
00143     
echo
" MathJax.Hub.Config({ tex2jax: {inlineMath: [['$','$']] } }) ; \n" ;
00144      echo
"</script>\n" ;
00145      echo
'<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/1.1-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML-full"></script>'
."\n" ;
00146     
00147     } ;
# fin si
00148     
00149     # chargement d'un ou plusieurs fichiers javascript
00150     
00151     
if (
$js!="") {
00152     
$tjs
= preg_split("/\s+/",trim($js)) ;
00153      foreach(
$tjs
as $fjs) {
00154      echo
"<script type='text/javascript' src='
$fjs'></script>\n" ;
00155      } ;
# fin pour
00156     
} ; # fin de si
00157     
00158     
if (
$favicon!="") {
00159      echo
"<link rel='icon' type='image/png' href='
$favicon' />\n" ;
00160     } ;
# fin de si
00161     
00162     # chargement du style standard
00163     
00164     
echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"std.css\" title=\"gh\" />\n" ;
00165     
00166     
# chargement de style(s) personnalis&eacute;(s)
00167     
00168     
if (
$styl!="") {
00169     
$tstyl
= preg_split("/\s+/",trim($styl)) ;
00170      foreach (
$tstyl
as $fstyl) {
00171      echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"
$fstyl\" title=\"gh\" /> \n" ;
00172      } ;
# fin pour
00173     
} ; # fin de si
00174     
00175     
echo
"<title>\n" ;
00176     echo
"
$titre" ;
00177     echo
"</title>\n" ;
00178     echo
"</head>\n" ;
00179     
00180     
#if ($grm=="std") {
00181     
echo
"<body class=\"beige_jpg\">\n" ;
00182     
#} ; # fin de si
00183     
00184     
echo
"<blockquote>\n" ;
00185     echo
"<p>&nbsp;</p>\n" ;
00186     if (
$grm
=="std") {
00187      echo
"<p align=\"right\">\n" ;
00188     } else {
00189      echo
"<p class='align_right'>\n" ;
00190     } ;
# fin de si
00191     
00192     
echo
"<a href=\"http://validator.w3.org/check?uri=".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']."\">\n" ;
00193     echo
"<img src=\"valid.png\" height=\"31\" width=\"88\" alt=\"Valid XHTML\" />\n" ;
00194     echo
"</a>\n" ;
00195     
00196     echo
"&nbsp;&nbsp;&nbsp;" ;
00197     
$std
= "http://forge.info.univ-angers.fr/~gh/std.css" ;
00198     echo
"<a href='http://jigsaw.w3.org/css-validator/validator?uri="
.urlencode($std)."'>\n" ;
00199     
00200     echo
"<img src=\"css.gif\" height=\"31\" width=\"88\" alt=\"Valid CSS2\" />\n" ;
00201     
00202     echo
"</a>\n" ;
00203     echo
"&nbsp;&nbsp;&nbsp;" ;
00204     echo
"</p>\n" ;
00205     
00206     }
# fin de fonction debutPage
00207     
00208     #######################################################################################
00209     
00210     
function
debutPageGeneral($titre="",$grm="std",$styl="",$js="") {
00211     
00212     
###########################################################
00213     
00214     
if (
$grm=="svg") { header("Content-type: image/svg+xml") ; } ;
00215     echo
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" ;
00216     
00217     if (
$grm
=="std") {
00218      echo
"<!DOCTYPE html \n" ;
00219      echo
" PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n" ;
00220      echo
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n" ;
00221      echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"fr\" xml:lang=\"fr\"> \n" ;
00222     } elseif (
$grm
=="svg") {
00223      echo
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">'
."\n" ;
00224      echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" >\n" ;
00225     } else {
00226      echo
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
."\n" ;
00227      echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"fr\" xml:lang=\"fr\"> \n" ;
00228     } ;
# fin de si
00229     
00230     
echo
"<head> \n" ;
00231     echo
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> \n" ;
00232     
00233     
# chargement d'un ou plusieurs fichiers javascript
00234     
00235     
if (
$js!="") {
00236     
$tjs
= preg_split("/\s+/",trim($js)) ;
00237      foreach(
$tjs
as $fjs) {
00238      echo
"<script type='text/javascript' src='
$fjs'></script>\n" ;
00239      } ;
# fin pour
00240     
} ; # fin de si
00241     
00242     
00243     # chargement du style standard
00244     
00245     
if (@
fopen("http://forge.info.univ-angers.fr/~gh/std.css","r")) {
00246      echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"http://forge.info.univ-angers.fr/~gh/std.css\" title=\"gh\" /> \n" ;
00247     } else {
00248      echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"std.css\" title=\"gh\" /> \n" ;
00249     } ;
# fin de si
00250     
00251     # chargement de style personnalis&eacute;
00252     
00253     
if (
$styl!="") {
00254      echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"
$styl\" title=\"gh\" /> \n" ;
00255     } ;
# fin de si
00256     
00257     
echo
"<title> \n" ;
00258     echo
"
$titre&nbsp;\n" ;
00259     echo
"</title> \n" ;
00260     echo
"</head> \n" ;
00261     
00262     if (
$grm
=="std") {
00263      if (@
fopen
("http://forge.info.univ-angers.fr/~gh/","r")) {
00264      echo
"<body background=\"http://forge.info.univ-angers.fr/~gh/beige.jpg\"> \n" ;
00265      } else {
00266      echo
"<body background=\"beige.jpg\"> \n" ;
00267      } ;
# fin si
00268     
} else {
00269      echo
"<body class=\"beige_jpg\"> \n" ;
00270     } ;
# fin de si
00271     
00272     
echo
"<blockquote> \n" ;
00273     echo
"<p>&nbsp;</p> \n" ;
00274     if (
$grm
=="std") {
00275      echo
"<p align=\"right\"> \n" ;
00276     } else {
00277      echo
"<p class='align_right'> \n" ;
00278     } ;
# fin de si
00279     
00280     
echo
"<a href=\"http://validator.w3.org/check?uri=referer\"> \n" ;
00281     if (@
fopen
("http://forge.info.univ-angers.fr/~gh/valid.png","r")) {
00282      echo
"<img src=\"http://forge.info.univ-angers.fr/~gh/valid.png\" height=\"31\" width=\"88\" alt=\"Valid XHTML\" /> \n" ;
00283     } else {
00284      echo
"<img src=\"valid.png\" height=\"31\" width=\"88\" alt=\"Valid XHTML\" /> \n" ;
00285     } ;
# fin si
00286     
echo
"</a>\n" ;
00287     
00288     echo
"&nbsp;&nbsp;&nbsp;" ;
00289     
$std
= "http://forge.info.univ-angers.fr/~gh/std.css" ;
00290     echo
"<a href='http://jigsaw.w3.org/css-validator/validator?uri="
.urlencode($std)."'>\n" ;
00291     
00292     if (@
fopen
("http://forge.info.univ-angers.fr/~gh/css.gif","r")) {
00293      echo
"<img src=\"http://forge.info.univ-angers.fr/~gh/css.gif\" height=\"31\" width=\"88\" alt=\"Valid CSS2\" />\n" ;
00294     } else {
00295      echo
"<img src=\"css.gif\" height=\"31\" width=\"88\" alt=\"Valid CSS2\" />\n" ;
00296     } ;
# fin si
00297     
echo
"</a>\n" ;
00298     echo
"&nbsp;&nbsp;&nbsp;" ;
00299     echo
"</p>\n" ;
00300     
00301     }
# fin de fonction debutPageGeneral
00302     
00303     #######################################################################################
00304     #######################################################################################
00305     
00306     
function
finPage() {
00307     
00308     
#######################################################################################
00309     
00310     
echo
"<!-- fin de page standard (gH) -->\n" ;
00311     echo
"<p>&nbsp;</p><p>\n" ;
00312     
00313     echo
"<a href=\"http://www.info.univ-angers.fr/~gh/\"> \n" ;
00314     echo
"<img src=\"return.gif\" alt=\"retour gH\" /></a> \n" ;
00315     
00316     echo
"&nbsp;&nbsp;&nbsp;Retour &agrave; la page principale de &nbsp; \n" ;
00317     echo
"<span class='coulGH'>(gH)</span>\n" ;
00318     echo
"</p>\n" ;
00319     echo
"<p>&nbsp;</p> \n" ;
00320     echo
"</blockquote> \n" ;
00321     echo
"</body> \n" ;
00322     echo
"</html> \n" ;
00323     
00324     }
# fin de fonction finPage
00325     
00326     #######################################################################################
00327     
00328     
function
finPageGeneral() {
00329     
00330     
#######################################################################################
00331     
00332     
echo
"<!-- fin de page standard (gH) -->\n" ;
00333     echo
"<p>&nbsp;</p><p>\n" ;
00334     
00335     echo
"<a href=\"http://www.info.univ-angers.fr/~gh/\"> \n" ;
00336     if (@
fopen
("http://forge.info.univ-angers.fr/~gh/return.gif","r")) {
00337      echo
"<img src=\"http://forge.info.univ-angers.fr/~gh/return.gif\" alt=\"retour gH\" /></a> \n" ;
00338     } else {
00339      echo
"<img src=\"return.gif\" alt=\"retour gH\" /></a> \n" ;
00340     } ;
# fin si
00341     
00342     
echo
"&nbsp;&nbsp;&nbsp;Retour &agrave; la page principale de &nbsp; \n" ;
00343     echo
"<span class='coulGH'>(gH)</span>\n" ;
00344     echo
"</p>\n" ;
00345     echo
"<p>&nbsp;</p> \n" ;
00346     echo
"</blockquote> \n" ;
00347     echo
"</body> \n" ;
00348     echo
"</html> \n" ;
00349     
00350     }
# fin de fonction finPageGeneral
00351     
00352     #######################################################################################
00353     
00354     
function
debutPageMinimale($tit="&nbsp;") {
00355     
00356     
#######################################################################################
00357     
00358     
echo
"<html> \n" ;
00359     echo
"<head> \n" ;
00360     echo
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /> \n" ;
00361     echo
"<title>" ;
00362     echo
"
$tit " ;
00363     echo
"</title> \n" ;
00364     echo
"</head> \n" ;
00365     echo
"<body> \n" ;
00366     echo
"<!-- d&eacute;but de page minimale (gH) -->\n" ;
00367     
00368     }
# fin de fonction debutPageMinimale
00369     
00370     #######################################################################################
00371     
00372     
function
finPageMinimale() {
00373     
00374     
#######################################################################################
00375     
00376     
echo
"<!-- fin de page minimale (gH) -->\n" ;
00377     echo
"<p>&nbsp;</p>\n" ;
00378     echo
"</body> \n" ;
00379     echo
"</html> \n" ;
00380     
00381     }
# fin de fonction finPageMinimale
00382     
00383     ###########################################################
00384     
00385     
function
debutPageRedir($titre,$temps="",$newUrl="http://www.google.fr/search") {
00386     
00387     
###########################################################
00388     
00389     
echo
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" ;
00390     echo
"<!DOCTYPE html \n" ;
00391     echo
" PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \n" ;
00392     echo
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n" ;
00393     echo
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"fr\" xml:lang=\"fr\"> \n" ;
00394     echo
"<head> \n" ;
00395     echo
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> \n" ;
00396     echo
"<meta http-equiv=\"Refresh\" content=\"
$temps; URL=$newUrl\">" ;
00397     echo
"<link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.info.univ-angers.fr/~gh/std.css\" title=\"standard (gH)\" /> \n" ;
00398     echo
"<title> \n" ;
00399     echo
"
$titre \n" ;
00400     echo
"</title> \n" ;
00401     echo
"</head> \n" ;
00402     echo
"<body background=\"beige.jpg\"> \n" ;
00403     echo
"<blockquote> \n" ;
00404     echo
"<p>&nbsp;</p> \n" ;
00405     echo
"<h1>redirection vers "
.s_span($newUrl,"grouge")."</h1>\n" ;
00406     echo
"<p align=\"right\"> \n" ;
00407     echo
"<a href=\"http://validator.w3.org/check/referer\"> \n" ;
00408     echo
"<img src=\"valid.png\" height=\"31\" width=\"88\" alt=\"Valid XHTML 1.0!\" /> \n" ;
00409     echo
"</a>\n" ;
00410     echo
"&nbsp;&nbsp;&nbsp;" ;
00411     echo
"</p>\n" ;
00412     
00413     }
# fin de fonction debutPageRedir
00414     
00415     #######################################################################################
00416     #######################################################################################
00417     
00418     
function
debutSection($wi="100%",$ids="") {
00419     
00420     
#######################################################################################
00421     
00422     
echo
"<!-- debut de section (gH) -->\n" ;
00423     if (
$ids
=="") {
00424      echo
"<table cellpadding='50' class='bgcolor_white' width='"
.$wi."' summary='cadre g&eacute;n&eacute;ral'><tr><td class='bgcolor_white'>\n" ;
00425     } else {
00426      echo
"<table cellpadding='50' id='
$ids' class='bgcolor_white' width='".$wi."' summary='cadre g&eacute;n&eacute;ral'><tr><td class='bgcolor_white'>\n" ;
00427     } ;
# # finsi
00428     
00429     
} # fin de fonction debutSection
00430     
00431     #######################################################################################
00432     #######################################################################################
00433     
00434     
function
finSection() {
00435     
00436     
#######################################################################################
00437     
00438     
echo
"<!-- fin de section (gH) -->\n" ;
00439     echo
"</td></tr></table> \n" ;
00440     echo
"<p>&nbsp;</p> \n" ;
00441     
00442     }
# fin de fonction finSection
00443     
00444     #######################################################################################
00445     #######################################################################################
00446     
00447     # passage en gras
00448     
00449     
function
b($chen="&nbsp;") {
00450      return
"<strong>
$chen</strong>" ;
00451     }
# fin de fonction b
00452     
00453     # em comme "emphase"
00454     
00455     
function
em($chen="&nbsp;") {
00456      return
"<em>
$chen</em>" ;
00457     }
# fin de fonction em
00458     
00459     # passage en mode clavier (keyboard ==> kbd)
00460     
00461     
function
kbd($chen="&nbsp;") {
00462      return
"<kbd>
$chen</kbd>" ;
00463     }
# fin de fonction kbd
00464     
00465     # fonction g&eacute;n&eacute;rique pour titre de niveau i
00466     
00467     
function
h($nivi=1,$chen="&nbsp;",$cla="",$id="") {
00468     
$attr
= "" ;
00469      if (!
$cla
=="") {
00470     
$attr
.= " class='$cla'" ;
00471      } ;
# fin de si
00472     
if (!
$id=="") {
00473     
$attr
.= " id='$id'" ;
00474      } ;
# fin de si
00475     
sdl() ;
00476      echo
"<h
$nivi$attr>$chen</h$nivi>\n" ;
00477     
sdl() ;
00478     }
# fin de fonction h
00479     
00480     # titre de niveau 1
00481     
00482     
function
h1($chen="&nbsp;",$cla="",$id="") {
00483     
h
("1",$chen,$cla,$id) ;
00484     }
# fin de fonction h1
00485     
00486     # titre de niveau 2
00487     
00488     
function
h2($chen="&nbsp;",$cla="",$id="") {
00489     
h
("2",$chen,$cla,$id) ;
00490     }
# fin de fonction h2
00491     
00492     # titre de niveau 3
00493     
00494     
function
h3($chen="&nbsp;",$cla="",$id="") {
00495     
h
("3",$chen,$cla,$id) ;
00496     }
# fin de fonction h3
00497     
00498     
function
h4($chen="&nbsp;",$cla="",$id="") {
00499     
h
("4",$chen,$cla,$id) ;
00500     }
# fin de fonction h4
00501     
00502     
function
h5($chen="&nbsp;",$cla="",$id="") {
00503     
h
("5",$chen,$cla,$id) ;
00504     }
# fin de fonction h5
00505     
00506     # ancien titre de niveau 1
00507     
00508     
function
hh1($chen="&nbsp;",$cla="") {
00509      if (
$cla
=="") {
00510      echo
"<h1>
$chen </h1>\n" ;
00511      } else {
00512      echo
"<h1 class='
$cla'> $chen </h1>\n" ;
00513      } ;
# fin de si
00514     
} # fin de fonction hh1
00515     
00516     # ancien titre de niveau 2
00517     
00518     
function
hh2($chen="&nbsp;") {
00519      echo
"<h2>
$chen</h2>\n" ;
00520     }
# fin de fonction hh2
00521     
00522     # ancien titre de niveau 3
00523     
00524     
function
hh3($chen="&nbsp;") {
00525      echo
"<h3>
$chen</h3>\n" ;
00526     }
# fin de fonction hh3
00527     
00528     
function
cmt($chen="&nbsp;") {
00529      return
"<!--
$chen -->\n" ;
00530     }
# fin de fonction cmt
00531     
00532     
function
sdl($nbl=1) {
00533      echo
copies
("\n",$nbl) ;
00534     }
# fin de fonction sdl
00535     
00536     
function
sub($chen="&nbsp;") { # indice
00537     
return
"<sub>$chen</sub>" ;
00538     }
# fin de fonction sub
00539     
00540     
function
sup($chen="&nbsp;") { # expsant
00541     
return
"<sup>$chen</sup>" ;
00542     }
# fin de fonction sup
00543     
00544     #######################################################################################
00545     
00546     
function
ul($xtra="") {
00547      if (
$xtra
=="") {
00548      echo
"<ul>\n" ;
00549      } else {
00550      echo
"<ul
$xtra>\n" ;
00551      } ;
# fin de si
00552     
} # fin de fonction ul
00553     
00554     
function
finul() {
00555      echo
"</ul>\n" ;
00556     }
# fin de fonction finul
00557     
00558     
function
bouton($id="",$xtra="",$type="",$value="") {
00559      echo
"<button" ;
00560      if (
$id
!="") {
00561      echo
" id='
$id'" ;
00562      }
# fin de si
00563     
if (
$type!="") {
00564      echo
" type='"
.$type."'" ;
00565      }
# fin de si
00566     
if (
$xtra!="") {
00567      echo
"
$xtra" ;
00568      }
# fin de si
00569     
echo
">" ;
00570      if (
$value
!= ""){
00571      echo
"
$value";
00572      }
00573      echo
"</button>\n" ;
00574     }
# fin de fonction bouton
00575     
00576     
function
finbouton() {
00577      echo
"</button>\n" ;
00578     }
# fin de fonction finbouton
00579     
00580     
function
ol($xtra="") {
00581      if (
$xtra
=="") {
00582      echo
"<ol>\n" ;
00583      } else {
00584      echo
"<ol
$xtra>\n" ;
00585      } ;
# fin de si
00586     
} # fin de fonction ol
00587     
00588     
function
finol() {
00589      echo
"</ol>\n" ;
00590     }
# fin de fonction finol
00591     
00592     
function
li($cntli="") {
00593      echo
"<li>
$cntli</li>\n" ;
00594     }
# fin de fonction finli
00595     
00596     
function
debutli($cntli="",$xtra="") {
00597      echo
"<li
$xtra>$cntli" ;
00598     }
# fin de fonction debutli
00599     
00600     
function
finli() {
00601      echo
"</li>\n" ;
00602     }
# fin de fonction finli
00603     
00604     
function
dt($cntli="",$cla="") {
00605      if (
$cla
=="") {
00606      echo
"<dt>
$cntli</dt>\n" ;
00607      } else {
00608      echo
"<dt class='
$cla'>$cntli</dt>\n" ;
00609      } ;
# fin de si
00610     
} # fin de fonction dt
00611     
00612     
function
dd($cntli="",$cla="") {
00613      if (
$cla
=="") {
00614      echo
"<dd>
$cntli</dd>\n" ;
00615      } else {
00616      echo
"<dd class='
$cla'>$cntli</dd>\n" ;
00617      } ;
# fin de si
00618     
} # fin de fonction dd
00619     
00620     
function
debutdd($cntli="") {
00621      echo
"<dd>
$cntli" ;
00622     }
# fin de fonction debutdd
00623     
00624     
function
findd() {
00625      echo
"</dd>\n" ;
00626     }
# fin de fonction findd
00627     
00628     
function
debutdt($cntli="") {
00629      echo
"<dt>
$cntli" ;
00630     }
# fin de fonction debutdt
00631     
00632     
function
findt() {
00633      echo
"</dt>\n" ;
00634     }
# fin de fonction findt
00635     
00636     
function
debutdl($cntli="",$xtra="") {
00637      echo
"<dl
$xtra>$cntli" ;
00638     }
# fin de fonction debutdl
00639     
00640     
function
findl() {
00641      echo
"</dl>\n" ;
00642     }
# fin de fonction findl
00643     
00644     
00645     #######################################################################################
00646     
00647     # quelques span
00648     
00649     
function
s_span($chen,$cla,$id="",$xtra="") {
00650     
$attr
= "" ;
00651      if (!
$cla
=="") {
00652     
$attr
.= " class='$cla'" ;
00653      } ;
# fin de si
00654     
if (!
$id=="") {
00655     
$attr
.= " id='$id'" ;
00656      } ;
# fin de si
00657     
if (
$xtra!="") { $attr .= " $xtra" ; } ;
00658      return(
"<span
$attr>$chen</span>") ;
00659     }
# fin de fonction s_span
00660     
00661     
function
span($cla="",$id="",$xtra="") {
00662     
$chen
= "<span" ;
00663      if (
$cla
!="") { $chen .= " class='$cla'" ; } ;
00664      if (
$id
!="") { $chen .= " id='$id'" ; } ;
00665      if (
$xtra
!="") { $chen .= " $xtra" ; } ;
00666     
$chen
.= ">" ;
00667      echo
$chen ;
00668     }
# fin de fonction span
00669     
00670     
function
finspan() {
00671      echo
"</span>" ;
00672     }
# fin de fonction finspan
00673     
00674     
function
grouge($chen=" ") {
00675      echo
"<span class='grouge'>
$chen</span>" ;
00676     }
# fin de fonction grouge
00677     
00678     
function
gbleu($chen=" ") {
00679      echo
"<span class='gbleu'>
$chen</span>" ;
00680     }
# fin de fonction gbleu
00681     
00682     
function
s_gbleu($chen=" ") {
00683      return(
"<span class='gbleu'>
$chen</span>") ;
00684     }
# fin de fonction gbleu
00685     
00686     
function
gbleuf($chen=" ") {
00687      echo
"<span class='gbleuf'>
$chen</span>" ;
00688     }
# fin de fonction gbleuf
00689     
00690     
function
gvert($chen=" ") {
00691      echo
"<span class='gvert'>
$chen</span>" ;
00692     }
# fin de fonction gvert
00693     
00694     
function
gvertf($chen=" ") {
00695      echo
"<span class='gvertf'>
$chen</span>" ;
00696     }
# fin de fonction gvert
00697     
00698     # pre, blockquote et les autres
00699     
00700     
function
finform() {
00701      echo
"</form>" ;
00702     }
# fin de fonction finform
00703     
00704     
function
p($cla="",$id="") {
00705     
$attr
= "" ;
00706      if (!
$cla
=="") {
00707     
$attr
.= " class='$cla'" ;
00708      } ;
# fin de si
00709     
if (!
$id=="") {
00710     
$attr
.= " id='$id'" ;
00711      } ;
# fin de si
00712     
sdl() ;
00713      echo
"<p
$attr>\n" ;
00714     }
# fin de fonction p
00715     
00716     
function
pre($cla="",$id="") {
00717     
$attr
= "" ;
00718      if (!
$cla
=="") {
00719     
$attr
.= " class='$cla'" ;
00720      } ;
# fin de si
00721     
if (!
$id=="") {
00722     
$attr
.= " id='$id'" ;
00723      } ;
# fin de si
00724     
echo
"<pre $attr>\n" ;
00725     }
# fin de fonction pre
00726     
00727     
function
finpre() {
00728      echo
"</pre>\n" ;
00729     }
# fin de fonction finpre
00730     
00731     
function
pre_fichier($nomfic,$cla="",$nbesp=0,$utf=0) {
00732     
pre
($cla) ;
00733      if (!
file_exists
($nomfic)) {
00734      print
" fichier
$nomfic non vu\n" ;
00735      } else {
00736     
$deblig
= "" ;
00737      if (
$nbesp
>0) { $deblig = copies(" ",$nbesp) ; } ;
00738     
cmt
("deblig avec $nbesp espaces : *$deblig*") ;
00739     
$fh
= fopen($nomfic,"r") ;
00740      echo
"\n" ;
00741      while (!
feof
($fh)) {
00742     
$lig
= fgets($fh, 4096) ;
00743     
$lig
= preg_replace("/\n/","",$lig);
00744     
$ligs
= " " ;
00745     
$lng
= strlen($lig) ;
00746     
$idc
= 0 ;
00747      while (
$idc
<$lng) {
00748     
$cc
= substr($lig,$idc,1) ;
00749      if (
$cc
=="<") { $cc = "&lt;" ; } ;
00750      if (
$cc
==">") { $cc = "&gt;" ; } ;
00751      if (
$cc
=="&") { $cc = "&amp;" ; } ;
00752     
$ligs
.= $cc ;
00753     
$idc++ ;
00754      } ;
# fintant que
00755     
echo
$deblig ;
00756      if (
$utf
==0) {
00757      echo
$ligs ;
00758      } else {
00759      echo
utf8_decode
($ligs) ;
00760      } ;
# fin si
00761     
echo
"\n" ;
00762      } ;
# fin tant que
00763     
fclose
($fh) ;
00764      } ;
# fin si le fichier existe
00765     
00766     
finpre() ;
00767     }
# fin de fonction pre_fichier
00768     
00769     
function
code($cla="") {
00770      if (
$cla
=="") {
00771      echo
"<code>\n" ;
00772      } else {
00773      echo
"<code class='
$cla'>\n" ;
00774      } ;
# fin de si
00775     
} # fin de fonction code
00776     
00777     
function
fincode() {
00778      echo
"</code>\n" ;
00779     }
# fin de fonction fincode
00780     
00781     
function
br() {
00782      echo
"<br />\n" ;
00783     }
# fin de fonction br
00784     
00785     
function
sbr() {
00786      return(
"<br />\n") ;
00787     }
# fin de fonction br
00788     
00789     
function
nbsp($rep=1) {
00790      echo
copies
("&nbsp;",$rep) ;
00791     }
# fin de fonction nbsp
00792     
00793     
function
snbsp($rep=1) {
00794      return(
copies
("&nbsp;",$rep)) ;
00795     }
# fin de fonction snbsp
00796     
00797     
function
s_nbsp($rep=1) {
00798      return(
copies
("&nbsp;",$rep)) ;
00799     }
# fin de fonction s_nbsp
00800     
00801     
function
ptexte() {
00802      echo
"<p class='texte'>\n" ;
00803     }
# fin de fonction p
00804     
00805     
function
pj() {
00806      echo
"<p class='texte'>\n" ;
00807     }
# fin de fonction pj
00808     
00809     
function
finp() {
00810     
sdl() ;
00811      echo
"</p>\n" ;
00812     
sdl() ;
00813     }
# fin de fonction finp
00814     
00815     
function
pvide() {
00816      echo
"<p>&nbsp;</p>\n" ;
00817     }
# fin de fonction pvide
00818     
00819     
function
center() {
00820      echo
"<center>\n" ;
00821     }
# fin de fonction center
00822     
00823     
function
fincenter() {
00824      echo
"</center>\n" ;
00825     }
# fin de fonction ficenter
00826     
00827     
function
blockquote() {
00828      echo
"<blockquote>\n" ;
00829     }
# fin de fonction blockquote
00830     
00831     
function
finblockquote() {
00832      echo
"</blockquote>\n" ;
00833     }
# fin de fonction finblockquote
00834     
00835     
function
table($bord=0,$pad=0,$cla="",$resum="?",$xtra="") {
00836     
sdl() ;
00837     
$defcla
= "" ;
00838      if (
strlen
($cla)>0) { $defcla = "class='$cla'" ; } ;
00839      echo
"<table border=\"
$bord\" cellpadding=\"$pad\" $defcla summary=\"$resum\" $xtra>\n" ;
00840     }
# fin de fonction table
00841     
00842     
function
datatable($id="") {
00843      echo
"<table id='
$id'>\n" ;
00844     }
# fin de fonction datatable
00845     
00846     
function
tbody() {
00847      echo
"<tbody>\n" ;
00848     
sdl() ;
00849     }
# fin de fonction tbody
00850     
00851     
function
thead() {
00852      echo
"<thead>\n" ;
00853     
sdl() ;
00854     }
# fin de fonction thead
00855     
00856     
function
fintable() {
00857      echo
"</table>\n" ;
00858     
sdl() ;
00859     }
# fin de fonction fintable
00860     
00861     
function
findatatable() {
00862      echo
"</table>\n" ;
00863     
sdl() ;
00864     }
# fin de fonction findatatable
00865     
00866     
function
fintbody() {
00867      echo
"</tbody>\n" ;
00868     
sdl() ;
00869     }
# fin de fonction fintbody
00870     
00871     
function
finthead() {
00872      echo
"</thead>\n" ;
00873     
sdl() ;
00874     }
# fin de fonction finthead
00875     
00876     
function
entetesTableau($chaineEntetes,$cla="") {
00877     
$lesEntetes
= preg_split("/\s+/",$chaineEntetes) ;
00878     
thead() ;
00879     
tr
($cla) ;
00880      foreach(
$lesEntetes
as $col) {
00881     
th
() ; echo preg_replace("/__/"," ",$col) ; finth() ;
00882      }
# fin pour chaque
00883     
fintr() ;
00884     
finthead() ;
00885     }
# fin de fonction entetesTableau
00886     
00887     
function
tr($cla="",$xtra="",$sdl=1) {
00888     
$defcla
= "" ;
00889      if (
strlen
($cla)>0) { $defcla = "class='$cla'" ; } ;
00890      echo
"<tr" ;
00891      if (
$defcla
!="") {
00892      echo
"
$defcla" ;
00893      } ;
# fin si
00894     
if (
$xtra!="") {
00895      echo
"
$xtra" ;
00896      } ;
# fin si
00897     
echo
">" ;
00898      if (
$sdl
==1) { echo "\n" ; } ;
00899     }
# fin de fonction tr
00900     
00901     
function
fintr() {
00902      echo
"</tr>\n" ;
00903     }
# fin de fonction fintr
00904     
00905     
function
td($aligne="L",$cla="",$colspan="",$xtra="",$sdl=0) {
00906     
$defcla
= "" ;
00907      if (
strlen
($cla)>0) { $defcla = " class='$cla'" ; } ;
00908      if (
strlen
($colspan)>0) { $defcla .= " colspan='$colspan'" ; } ;
00909      if (
strtoupper
($aligne)=="R") {
00910      echo
"<td align='right'" ;
00911      } elseif (
strtoupper
($aligne)=="C") {
00912      echo
"<td align='center'" ;
00913      } else {
00914      echo
"<td align='left'" ;
00915      } ;
# fin si
00916     
if (
$defcla!="") {
00917      echo
"
$defcla" ;
00918      } ;
# fin si
00919     
if (
$xtra!="") {
00920      echo
"
$xtra" ;
00921      } ;
# fin si
00922     
echo
">" ;
00923      if (
$sdl
==1) { echo "\n" ; } ;
00924     }
# fin de fonction td
00925     
00926     
function
th($aligne="C",$cla="",$colspan="",$xtra="",$sdl=0) {
00927     
$defcla
= "" ;
00928      if (
strlen
($cla)>0) { $defcla = " class='$cla'" ; } ;
00929      if (
strlen
($colspan)>0) { $defcla .= " colspan='$colspan'" ; } ;
00930      if (
strtoupper
($aligne)=="R") {
00931      echo
"<th align='right'" ;
00932      } elseif (
strtoupper
($aligne)=="C") {
00933      echo
"<th align='center'" ;
00934      } else {
00935      echo
"<th align='left'" ;
00936      } ;
# fin si
00937     
if (
$defcla!="") {
00938      echo
"
$defcla" ;
00939      } ;
# fin si
00940     
if (
$xtra!="") {
00941      echo
"
$xtra" ;
00942      } ;
# fin si
00943     
echo
">" ;
00944      if (
$sdl
==1) { echo "\n" ; } ;
00945     }
# fin de fonction th
00946     
00947     
function
fintd() {
00948      echo
"</td>\n" ;
00949     }
# fin de fonction fintd
00950     
00951     
function
tdvide() {
00952      echo
"<td>&nbsp;</td>\n" ;
00953     }
# fin de fonction tdvide
00954     
00955     
function
finth() {
00956      echo
"</th>\n" ;
00957     }
# fin de fonction finth
00958     
00959     
function
tdk($aligne) {
00960      if (
strtoupper
($aligne)=="R") {
00961      echo
"<td align='right'>\n<kbd>" ;
00962      } else {
00963      echo
"<td><kbd>" ;
00964      } ;
# fin si
00965     
} # fin de fonction tdk
00966     
00967     
function
fintdk() {
00968      echo
"</kbd>\n</td>\n" ;
00969     }
# fin de fonction fintdk
00970     
00971     
function
div($cla="",$id="",$xtra="") {
00972     
$attr
= "" ;
00973      if (!
$cla
=="") {
00974     
$attr
.= " class='$cla'" ;
00975      } ;
# fin de si
00976     
if (!
$id=="") {
00977     
$attr
.= " id='$id'" ;
00978      } ;
# fin de si
00979     
if (!
$xtra=="") {
00980     
$attr
.= " $xtra" ;
00981      } ;
# fin de si
00982     
echo
"<div$attr>\n" ;
00983     }
# fin de fonction div
00984     
00985     
function
findiv() {
00986      echo
"</div>\n" ;
00987     }
# fin de fonction findiv
00988     
00989     
function
hr($cla="",$xtra="") {
00990      if (
strlen
($cla)==0) {
00991      echo
"<hr
$xtra/>\n" ;
00992      } else {
00993      echo
"<hr class='
$cla' $xtra/>\n" ;
00994      } ;
# fin si
00995     
} # fin de fonction hr
00996     
00997     #######################################################################################
00998     
00999     
function
form($action=".",$method="get",$xtra="") {
01000      echo
"<form action='
$action' method='$method' $xtra>\n" ; ;
01001     }
# fin de fonction form
01002     
01003     
function
fieldset($cla="") {
01004      if (
strlen
($cla)>0) {
01005      echo
"<fieldset class='
$cla'>\n" ;
01006      } else {
01007      echo
"<fieldset>\n" ;
01008      } ;
# fin si
01009     
} # fin de fonction fieldset
01010     
01011     
function
finfieldset() {
01012      echo
"</fieldset>\n" ;
01013     }
# fin de fonction finfieldset
01014     
01015     
function
label($texte,$for,$id) {
01016      echo
"<label for='
$for' id='$id'>$texte" ;
01017      echo
"</label>\n" ;
01018     }
# fin de fonction label
01019     
01020     
function
legende($lngd,$cla="") {
01021      if (
strlen
($cla)>0) {
01022      echo
"<legend class='
$cla'>\n" ;
01023      } else {
01024      echo
"<legend>\n" ;
01025      } ;
# fin si
01026     
echo
"$lngd\n" ;
01027      echo
"</legend>\n" ;
01028     }
# fin de fonction legende
01029     
01030     
function
input_hidden($name,$value=0,$id="") {
01031      if (
$id
=="") { $id = $name ; } ;
01032      echo
"<input type='hidden' name='
$name' value='$value' id='$id' />\n" ;
01033     }
# fin de fonction input_hidden
01034     
01035     
function
input_text($name,$value=0,$size="",$cla="") {
01036     
$defcla
= "" ;
01037      if (
strlen
($size)==0) { $size = "10" ; } ;
01038      if (
strlen
($cla)>0) { $defcla = "class='$cla'" ; } ;
01039      echo
"<input type='text' id='
$name' name='$name' value='$value' size='$size' $defcla />\n" ;
01040     }
# fin de fonction input_text
01041     
01042     
function
input_textNoId($name,$value=0,$size="",$cla="") {
01043     
$defcla
= "" ;
01044      if (
strlen
($size)==0) { $size = "10" ; } ;
01045      if (
strlen
($cla)>0) { $defcla = "class='$cla'" ; } ;
01046      echo
"<input type='text' name='
$name' value='$value' size='$size' $defcla />\n" ;
01047     }
# fin de fonction input_textNoId
01048     
01049     
function
input_password($name,$value="",$size=15,$cla="") {
01050     
$defcla
= "" ;
01051      if (
strlen
($cla)>0) { $defcla = "class='$cla'" ; } ;
01052      echo
"<input type='password' id='
$name' name='$name' value='$value' size='$size' $defcla />\n" ;
01053     }
# fin de fonction input_password
01054     
01055     
function
input_checkbox($value,$display="",$cla="",$chk="") {
01056      if (
$display
=="") { $display = $value ; } ;
01057     
$vchk
= "" ;
01058      if (!
$chk
== "") { $vchk=" checked='checked' " ; } ;
01059      if (!
$cla
=="") { $display = "<span class='$cla'>$display</span>" ; } ;
01060      echo
"<input type='checkbox' id='
$value' name=\"$value\" $vchk /> $display" ;
01061     }
# fin de fonction input_checkbox
01062     
01063     
function
input_checkboxOnClick($name, $value, $id="", $chk="", $cla="",$onClick="", $display="") {
01064     
$attr
= "" ;
01065      if (!
$name
== "") { $attr .= " name='$name' " ; } ;
01066      if (!
$value
=="") { $attr .= " value='$value' " ; } ;
01067      if (!
$id
== "") { $attr .= " id='$id' "; } ;
01068      if (!
$chk
== "") { $attr .= " checked='checked' "; } ;
01069      if (!
$onClick
== "") { $attr .= " onclick='$onClick' "; } ;
01070      if (!
$cla
=="") { $display = "<span class='$cla'>$display</span>" ; } ;
01071      echo
"<input type='checkbox'
$attr /> $display\n" ;
01072     }
# fin de fonction input_checkboxOnClick
01073     
01074     
function
input_radio($name,$value,$display="",$cla="",$chk="",$id="",$xtra="") {
01075     
$attr
= "" ;
01076      if (!
$name
== "") { $attr .= " name='$name' " ; } ;
01077      if (!
$id
== "") { $attr .= " id='$id' " ; } ;
01078      if (!
$value
=="") { $attr .= " value='$value' " ; } ;
01079      if (!
$chk
== "") { $attr .= " checked='checked' " ; } ;
01080      if (!
$cla
=="") { $display = "<span class='$cla'>$display</span>" ; } ;
01081      if (!
$xtra
=="") { $attr .= " $xtra" ; } ;
01082      echo
"<input type='radio'
$attr /> $display\n" ;
01083     }
# fin de fonction input_radio
01084     
01085     
01086     
function
input_submit($value,$name="",$clas="",$xtra="") {
01087      echo
"<input type='submit' " ;
01088      if (!
$value
=="") { echo " value='$value'" ; } ;
01089      if (!
$name
=="") { echo " name='$name'" ; } ;
01090      if (!
$clas
=="") { echo " class='$clas'" ; } ;
01091      if (!
$xtra
=="") { echo " $xtra" ; } ;
01092      echo
" />\n" ;
01093     }
# fin de fonction input_submit
01094     
01095     
function
input_reset($value,$name="",$clas="",$xtra="") {
01096      echo
"<input type='reset' " ;
01097      if (!
$value
=="") { echo " value='$value'" ; } ;
01098      if (!
$name
=="") { echo " name='$name'" ; } ;
01099      if (!
$clas
=="") { echo " class='$clas'" ; } ;
01100      if (!
$xtra
=="") { echo " $xtra" ; } ;
01101      echo
"/>\n" ;
01102     }
# fin de fonction input_reset
01103     
01104     
function
input_file($name, $maxlength=123456,$extra="") {
01105      echo
'<input type="file" id="'
.$name.'" name="'.$name.'" maxlength="'.$maxlength.'" '.$extra.' />'."\n" ;
01106     }
# fin de fonction input_file
01107     
01108     
01109     
function
textarea($name,$class="",$rows=8,$cols=40,$id="") {
01110     
$attr
= "" ;
01111      if (
$name
!="") {
01112     
$attr
.= " name='$name'" ;
01113      } ;
# fin de si
01114     
if (
$class!="") {
01115     
$attr
.= " class='$class'" ;
01116      } ;
# fin de si
01117     
if (
$id!="") {
01118     
$attr
.= " id='$id'" ;
01119      } ;
# fin de si
01120     
if (
$rows=="") { $rows=8 ; } ;
01121      if (
$cols
=="") { $cols=40 ; } ;
01122     
$attr
.= " rows='$rows' cols='$cols'" ;
01123      echo
"<textarea
$attr>\n" ;
01124     }
# fin de fonction textarea
01125     
01126     
function
textarea_fichier($name,$class="",$rows=8,$cols=40,$id="",$fichier="",$deb=" ") {
01127     
$attr
= "" ;
01128      if (!
$name
=="") {
01129     
$attr
.= " name='$name'" ;
01130      } ;
# fin de si
01131     
if (!
$class=="") {
01132     
$attr
.= " class='$class'" ;
01133      } ;
# fin de si
01134     
if (!
$id=="") {
01135     
$attr
.= " id='$id'" ;
01136      } ;
# fin de si
01137     
$attr
.= " rows='$rows' cols='$cols'" ;
01138      echo
"<textarea
$attr>\n" ;
01139      if (!
file_exists
($fichier)) {
01140      print
" fichier
$fichier non vu\n" ;
01141      } else {
01142     
$fh
= fopen($fichier,"r") ;
01143      echo
"\n" ;
01144      while (!
feof
($fh)) {
01145     
$lig
= fgets($fh, 4096) ;
01146     
$lig
= preg_replace("/\n/","",$lig);
01147     
$ligs
= $deb ;
01148     
$lng
= strlen($lig) ;
01149     
$idc
= 0 ;
01150      while (
$idc
<$lng) {
01151     
$cc
= substr($lig,$idc,1) ;
01152      if (
$cc
=="<") { $cc = "&lt;" ; } ;
01153      if (
$cc
==">") { $cc = "&gt;" ; } ;
01154      if (
$cc
=="&") { $cc = "&amp;" ; } ;
01155     
$ligs
.= $cc ;
01156     
$idc++ ;
01157      } ;
# fintant que
01158     
echo
$ligs ;
01159      echo
"\n" ;
01160      } ;
# fin tant que
01161     
fclose
($fh) ;
01162      } ;
# fin de si
01163     
echo
"</textarea>\n" ;
01164     
01165     }
# fin de fonction textarea_fichier
01166     
01167     #######################################################################################
01168     
01169     
function
input_select($name,$xtra="") {
01170      echo
"<select id='
$name' name='$name' $xtra>\n" ;
01171     }
# fin de fonction input_select
01172     
01173     
function
input_select_fin() {
01174      echo
"</select>\n" ;
01175     }
# fin de fonction input_select_fin
01176     
01177     
function
finselect() {
01178      echo
"</select>\n" ;
01179     }
# fin de fonction finselect
01180     
01181     
function
input_option($value,$display="",$sel="",$id="",$xtra="") {
01182      if (
$display
=="") { $display = $value ; } ;
01183     
$attr
= " value='$value'" ;
01184      if (
strlen
($sel)>0) { $attr .= " selected='selected'" ; } ;
01185      if (
strlen
($id)>0) { $attr .= " id='$id'" ; } ;
01186      if (
strlen
($xtra)>0) { $attr .= " $xtra" ; } ;
01187      echo
"<option
$attr> $display </option>\n" ;
01188     }
# fin de fonction input_option
01189     
01190     
function
listeSelectFromTxt($name,$lstValues,$numSel=1,$xtra="",$underscore=0) {
01191     
input_select
($name,$xtra) ;
01192     
$tabValues
= preg_split("/\s+/",(trim($lstValues))) ;
01193     
$nbe
= 0 ;
01194      foreach (
$tabValues
as $elt) {
01195     
$nbe++;
01196     
$esel
= "" ;
01197      if (
$nbe
==$numSel) { $esel = "selected" ; } ;
01198      if (
$underscore
==1) { $elt = preg_replace("/_/"," ",$elt) ; } ;
01199      echo
" " ;
01200     
input_option
($elt,$elt,$esel) ;
01201      } ;
# fin pourchaque
01202     
finselect() ;
01203     }
# fin de fonction listeSelectFromTxt
01204     
01205     
function
listeSelectFromChampMySql($champ,$table,$name,$numSel=1,$xtra="",$underscore=0) {
01206     
$que
= "SELECT distinct $champ FROM $table ORDER BY $champ " ;
01207     
$res
= mysql_query($que) ;
01208     
$lstValues
= "" ;
01209      while (
$ldr
=mysql_fetch_array($res)) {
01210     
$lstValues
.= $ldr[$champ]." " ;
01211      } ;
# fintant que
01212     
listeSelectFromTxt
($name,$lstValues,$numSel=1,$xtra="",$underscore=0) ;
01213     }
# fin de fonction listeSelectFromChampMySql
01214     
01215     #######################################################################################
01216     
01217     
function
fintextarea() {
01218      echo
"</textarea>\n" ;
01219     }
# fin de fonction fintextarea
01220     
01221     
function
noscript() {
01222      echo
"<noscript>\n" ;
01223     }
# fin de fonction noscript
01224     
01225     
function
finnoscript() {
01226      echo
"</noscript>\n" ;
01227     }
# fin de fonction finnoscript
01228     
01229     
function
abbr($bulle) {
01230      echo
"<abbr title='
$bulle'>" ;
01231     }
# fin de fonction abbr
01232     
01233     
function
finabbr() {
01234      echo
"</abbr>" ;
01235     }
# fin de fonction finabbr
01236     
01237     #######################################################################################
01238     #######################################################################################
01239     
01240     # on passe la chaine en rouge fonc&eacute; (gras)
01241     
01242     
function
ghRouge($chen) {
01243      return(
"<span class=\"grouge\">
$chen</span>") ;
01244     }
# fin de fonction ghRouge
01245     
01246     # on passe la chaine en bleu fonc&eacute; (gras)
01247     
01248     
function
ghBleu($chen) {
01249      return(
"<span class=\"gbleu\">
$chen</span>") ;
01250     }
# fin de fonction ghBleu
01251     
01252     
function
ghVert($chen) {
01253      return(
"<span class=\"gvertf\">
$chen</span>") ;
01254     }
# fin de fonction ghVert
01255     
01256     
function
ghOrange($chen) {
01257      return(
"<b><span class=\"orange_stim\">
$chen</span></b>") ;
01258     }
# fin de fonction ghOrange
01259     
01260     #######################################################################################
01261     #######################################################################################
01262     
01263     
function
img( $src , $alt="",$wi="",$id="",$cla="",$tit='') {
01264     
01265     
#######################################################################################
01266     
01267     #echo "<!-- img src='$src' alt='$alt' -->\n" ;
01268     
01269     
if (
$alt=="") { $alt = "non su" ; } ;
01270     
$attr
= "src='$src'" ;
01271     
$attr
.= " alt='$alt'" ;
01272      if (!
$wi
=="") { $attr .= " width='$wi'" ; } ;
01273      if (!
$id
=="") { $attr .= " id='$id'" ; } ;
01274      if (!
$cla
=="") { $attr .= " class='$cla'" ; } ;
01275      if (!
$tit
=="") { $attr .= " title='$tit'" ; } ;
01276     
01277      return(
"<img
$attr />") ;
01278     
01279     }
# fin de fonction img
01280     
01281     #######################################################################################
01282     
01283     
function
imgh( $src , $alt="",$he="") {
01284     if (
$alt
=="") { $alt="non su" ; } ;
01285     if (
$he
=="") { $hei="" ; } else { $hei = "height=\"$he\"" ; } ;
01286     echo
"<!-- img src='
$src' alt='$alt' -->\n" ;
01287     return
"<img src='
$src' alt='$alt' $hei />" ;
01288     }
# fin de fonction imgh
01289     
01290     #######################################################################################
01291     
01292     
function
ancre( $href , $nomh="",$cla="",$id="",$xtra="") {
01293     
01294     
#######################################################################################
01295     
01296     
$attr
= "" ;
01297      if (
$nomh
=="") { $nomh=$href ; } ;
01298      if (!
$href
=="") { $attr .= " href='$href'" ; } ;
01299      if (!
$cla
=="") { $attr .= " class='$cla'" ; } ;
01300      if (!
$id
=="") { $attr .= " id='$id'" ; } ;
01301      if (!
$xtra
=="") { $attr .= " $xtra" ; } ;
01302      return(
"<a
$attr>$nomh</a>") ;
01303     
01304     }
# fin de fonction ancre
01305     
01306     #######################################################################################
01307     
01308     
function
ahref( $href , $nomh="",$cla="",$id="",$xtra="") {
01309      return
ancre
($href , $nomh,$cla,$id,$xtra) ;
01310     }
# fin de fonction ahref
01311     
01312     #######################################################################################
01313     
01314     
function
href( $href , $nomh="",$cla="",$id="",$xtra="") {
01315      return
ancre
($href , $nomh,$cla,$id,$xtra) ;
01316     }
# fin de fonction href
01317     
01318     #######################################################################################
01319     
01320     
function
aname($chen , $ref) {
01321     return
"<a name=\"
$ref\">$chen</a>" ;
01322     }
# fin de fonction aname
01323     
01324     #######################################################################################
01325     
01326     
function
showurlcmtbr($chen,$cmt) {
01327     
01328     
# affiche un lien suivi de br
01329     
01330     
echo
"<a href=\"$chen\">$cmt</a><br />" ;
01331     
01332     }
# fin de fonction showurlcmtbr
01333     
01334     #######################################################################################
01335     
01336     
function
showurlcmt($chen,$cmt) {
01337     
01338     
# affiche un lien
01339     
01340     
echo
"<a href=\"$chen\">$cmt</a>" ;
01341     
01342     }
# fin de fonction showurlcmt
01343     
01344     #######################################################################################
01345     
01346     # affiche une url en "href" et en "cmt
01347     
01348     
function
showurl($chen) {
01349     
showurlcmt
($chen,$chen) ;
01350     }
# fin de fonction showurl
01351     
01352     #######################################################################################
01353     
01354     # affiche une url en "href" et en "cmt" suivi de br
01355     
01356     
function
showurlbr($chen) {
01357     
showurlcmtbr
($chen,$chen) ;
01358     }
# fin de fonction showurlbr
01359     
01360     #######################################################################################
01361     
01362     
function
js($instr_js="") {
01363     
01364     echo
"<script type='text/javascript'>" ;
01365     if (!
$instr_js
=="") { echo $instr_js ; } ;
01366     echo
"</script>\n" ;
01367     
01368     }
# fin de fonction js
01369     
01370     #######################################################################################
01371     
01372     
function
jsf($fic_js="",$instr_js="",$charset="") {
01373     
01374     
#######################################################################################
01375     
01376     
$chrs
= "" ; # exemple : jsf("D3node_leapdb/d3.js","","utf-8") ;
01377     
01378     
if (
$charset!="") { $chrs = " charset='$charset'" ; } ;
01379     
01380     if (
$fic_js
=="") {
01381      echo
"<script type='text/javascript'
$chrs>" ;
01382     } else {
01383      echo
"<script type='text/javascript' src='
$fic_js'$chrs>" ;
01384     } ;
# fin de si
01385     
if (!
$instr_js=="") { echo $instr_js ; } ;
01386     echo
"</script>\n" ;
01387     
01388     }
# fin de fonction jsf
01389     
01390     #######################################################################################
01391     #######################################################################################
01392     
01393     
function
anonymousConnect($base="test") {
01394     
01395     
#######################################################################################
01396     
01397     
mysql_connect
("localhost","anonymous","anonymous") or die("probleme connexion mysql\n") ;
01398     
mysql_query
("use $base") or die("probleme mysql, base $base\n") ;
01399     
01400     }
# fin de fonction anonymousConnect
01401     
01402     #######################################################################################
01403     
01404     
function
comptageSqlSimple($champ,$table,$condition="",$dbgReq=0) {
01405     
01406     
#######################################################################################
01407     
01408     
$esc
= "COUNT($champ)";
01409     
$req
= " SELECT $esc FROM $table " ;
01410      if (
strlen
(trim($condition))>0) { $req .= " WHERE $condition " ; } ;
01411      if (
$dbgReq
>0) { echo "\n$req\n" ; } ;
01412     
$res
= mysql_query($req) ;
01413     
$tdr
= mysql_fetch_array($res) ;
01414     
# print_r($tdr) ;
01415     
return(
$tdr[$esc] ) ;
01416     
01417     }
# fin de fonction comptageSqlSimple
01418     
01419     #######################################################################################
01420     
01421     
function
fonctionSqlSimple($fonction,$champ,$table,$condition="",$dbgReq=0) {
01422     
01423     
#######################################################################################
01424     
01425     
$esc
= "$fonction($champ)";
01426     
$req
= " SELECT $esc FROM $table " ;
01427      if (
strlen
(trim($condition))>0) { $req .= " WHERE $condition " ; } ;
01428      if (
$dbgReq
>0) { echo "\n$req\n" ; } ;
01429     
$res
= mysql_query($req) ;
01430     
$tdr
= mysql_fetch_array($res) ;
01431     
# print_r($tdr) ;
01432     
return(
$tdr[$esc] ) ;
01433     
01434     }
# fin de fonction fonctionSqlSimple
01435     
01436     #######################################################################################
01437     #######################################################################################
01438     
01439     
function
pct($nb,$tot,$nbdec=0) {
01440     
01441     
#######################################################################################
01442     
01443     
$pct
= 100*$nb/$tot ;
01444     
$fmt
= "%5.".$nbdec."f" ;
01445     
$f_pct
= sprintf($fmt, $pct) ;
01446      return(
$f_pct) ;
01447     
01448     }
# fin de fonction pct
01449     
01450     #######################################################################################
01451     #######################################################################################
01452     
01453     # Quelques objets sous le coude...
01454     
01455     #######################################################################################
01456     #######################################################################################
01457     
01458     
class
tdm { # une table des mati&egrave;res cliquable
01459     
01460     ################################################################################
01461     
01462     # Voir http://forge.info.univ-angers.fr/~gh/internet/montresource.php?nomfic=demotdmobj.php
01463     # pour l'utilisation de cette classe
01464     
01465     
var
$rubriques = array() ; # contient les rubriques
01466     
var
$numcrub ; # num&eacute;ro de rubrique courante
01467     
01468     
public function
__construct($rubs) {
01469     
$this
->rubriques = $rubs ;
01470     
$this
->numcrub = 1 ;
01471      }
# fin de fonction __construct
01472     
01473     
function
titre($tit="Table des mati&egrave;res cliquable") {
01474     
h2
($tit) ;
01475      }
# fin de fonction titre
01476     
01477     
function
menu($optB="",$optN="",$cla="") {
01478     
# le premier param&egrave;tre, si non vide, produit un "blockquote"
01479      # le deuxi&egrave;me param&egrave;tre, si non vide, num&eacute;rote les rubriques
01480     
if (
strlen($optB)>0) { blockquote() ; } ;
01481     
$nbr
= count($this->rubriques) ;
01482      for (
$idr
=1;$idr<=$nbr;$idr++) {
01483     
p() ;
01484     
$jdr
= $idr ;
01485      if (
$idr
<10) { $jdr = "&nbsp;&nbsp;$idr" ; } ;
01486      if (
strlen
($optN)>0) { echo $jdr.". " ; } ;
01487      if (
$cla
=="") {
01488      echo
href
("#tdm$idr",$this->rubriques[$idr]) ;
01489      } else {
01490      echo
href
("#tdm$idr",$this->rubriques[$idr],$cla) ;
01491      }
# fin si
01492     
finp() ;
01493      }
# fin pour idr
01494     
if (
strlen($optB)>0) { finblockquote() ; } ;
01495      }
# fin de fonction menu
01496     
01497     
function
rubriqueParNumero($idrub) {
01498     
h2
(aname($this->rubriques[$idrub],"tdm$idrub")) ;
01499      }
# fin de fonction rubriqueParNumero
01500     
01501     
function
afficheRubrique($optN="") {
01502     
$laRub
= "" ;
01503      if (
strlen
($optN)>0) { $laRub .= $this->numcrub.". " ; } ;
01504     
$laRub
.= aname($this->rubriques[$this->numcrub],"tdm$this->numcrub") ;
01505     
h2
($laRub) ;
01506     
$this
->numcrub++ ;
01507      }
# fin de fonction afficheRubrique
01508     
01509     
function
setNumcrub($numero) {
01510     
$this
->numcrub = $numero ;
01511      }
# fin de fonction setNumcrub
01512     
01513     
} # fin de classe tdm
01514     
01515     #######################################################################################
01516     
01517     
function
tableauDar($fn,$dec="") {
01518     
01519     
#######################################################################################
01520     
01521     #
01522     # cette fonction affiche sous forme de tableau HTML un fichier .dar
01523     # le param&egrave;tre $dec contient un codage pour chacune des colonnes :
01524     # L pour justification &agrave; gauche
01525     # C pour justification centr&eacute;e
01526     # x (num&eacute;rique) pour justification &agrave; droite avec x d&eacute;cimales
01527     
01528     
if (!
file_exists($fn)) {
01529     
h3
(" Fichier ".s_span($fn,"grouge")." non vu") ;
01530     } else {
01531     
$fh
= fopen($fn,"r") ;
01532     
table
(1,10,"collapse") ;
01533      echo
"\n" ;
01534     
$nbl
= 0 ;
01535      while (!
feof
($fh)) {
01536     
$lig
= fgets($fh, 4096) ;
01537      if (
strlen
(trim($lig))>0) {
01538     
$nbl++ ;
01539     
tr() ;
01540      if (
$nbl
==1) {
01541     
$entete
= preg_split("/\s+/",(trim($lig))) ;
01542      foreach (
$entete
as $idc) {
01543     
th() ;
01544      echo
$idc ;
01545     
finth() ;
01546      } ;
# fin pour chaque
01547     
} else {
01548     
$lignorm
= preg_split("/\s+/",(trim($lig))) ;
01549     
$jdc
= -1 ;
01550      foreach (
$lignorm
as $idc) {
01551     
$jdc++ ;
01552     
$cdf
= substr($dec,$jdc,1) ;
01553     
$mef
= $cdf ;
01554     
$vdc
= $idc ;
01555      if (
is_numeric
($cdf)) {
01556     
$mef
= "R" ;
01557     
$vdc
= sprintf("%0.".$cdf."f",$idc) ;
01558      } ;
# fin si
01559     
cmt
($mef) ;
01560     
td
($mef) ;
01561      echo
$vdc ;
01562     
fintd() ;
01563      } ;
# fin pour chaque
01564     
} ; # fin si
01565     
fintr() ;
01566      } ;
# fin si
01567     
} ; # fin tant que
01568     
fintable() ;
01569     } ;
# fin si
01570     
01571     
} # fin de fonction tableauDar
01572     
01573     #######################################################################################
01574     
01575     
function
wikifr($mot="") {
01576     
01577     
#######################################################################################
01578     
01579     
$url
= "http://fr.wikipedia.org/wiki/".urlencode($mot) ;
01580     return(
$url) ;
01581     
01582     }
# fin de fonction wikifr
01583     
01584     #######################################################################################
01585     
01586     
function
wikien($mot="") {
01587     
01588     
#######################################################################################
01589     
01590     
$url
= "http://en.wikipedia.org/wiki/$mot" ;
01591     return(
$url) ;
01592     
01593     }
# fin de fonction wikien
01594     
01595     #######################################################################################
01596     
01597     
function
objet($id="",$data="",$type="",$xtra="") {
01598     
01599     
#######################################################################################
01600     
01601     
echo
"<object" ;
01602      if (
$id
!="") { echo ' id="'.$id.'"' ; } ;
01603      if (
$data
!="") { echo ' data="'.$data.'"' ; } ;
01604      if (
$type
!="") { echo ' type="'.$type.'"' ; } ;
01605      if (
$xtra
!="") { echo ' '.$xtra ; } ;
01606      echo
" />\n" ;
01607     
01608     }
# fin de fonction objet
01609     
01610     #######################################################################################
01611     
01612     
function
debutobjet($id="",$data="",$type="",$xtra="") {
01613     
01614     
#######################################################################################
01615     
01616     
echo
"<object" ;
01617      if (
$id
!="") { echo ' id="'.$id.'"' ; } ;
01618      if (
$data
!="") { echo ' data="'.$data.'"' ; } ;
01619      if (
$type
!="") { echo ' type="'.$type.'"' ; } ;
01620      if (
$xtra
!="") { echo ' '.$xtra ; } ;
01621      echo
">\n" ;
01622     
01623     }
# fin de fonction debutobjet
01624     
01625     #######################################################################################
01626     
01627     
function
finobjet() {
01628     
01629     
#######################################################################################
01630     
01631     
echo
"</object>\n" ;
01632     
01633     }
# fin de fonction finobjet
01634     
01635     #######################################################################################
01636     
01637     
function
svg($encoding="latin",$width=500,$height=500) {
01638     
01639     
#######################################################################################
01640     
01641     
if (
$encoding=="") { $encoding = "latin1" ; } ;
01642     
header
("Content-type: image/svg+xml") ;
01643     
#echo '<'.'?xml version="1.0" encoding="'.$encoding.'" ?'.'>'."\n" ;
01644     
echo
'<svg xmlns="http://www.w3.org/2000/svg" width="'.$width.'" height="'.$height.'" >'."\n" ;
01645     
01646     }
# fin de fonction svg
01647     
01648     #######################################################################################
01649     
01650     
function
finsvg() {
01651     
01652     
#######################################################################################
01653     
01654     
echo
"</svg>\n" ;
01655     
01656     }
# fin de fonction finsvg
01657     
01658     #######################################################################################
01659     
01660     
function
rect($x=0,$y=0,$width=100,$height=100,$fill="white",$stroke="black",$stroke_width=5) {
01661     
01662     
#######################################################################################
01663     
01664     
echo
'<rect x="'.$x.'" y="'.$y.'" width="'.$width.'" height="'.$height.'" fill="'.$fill.'"' ;
01665      echo
' stroke="'
.$stroke.'" stroke-width="'.$stroke_width.'" />'."\n" ;
01666     
01667     }
# fin de fonction rect
01668     
01669     #######################################################################################
01670     
?>

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)