Commit f2e6639f authored by Ayolo's avatar Ayolo

menage

parent 998c288c
<?php
$topdir = "../";
require_once($topdir. "include/site.inc.php");
$site = new site();
define('FPDF_FONTPATH', $topdir . 'font/');
require_once($topdir . "include/lib/barcodefpdf.inc.php");
class etoiles extends FPDF
{
var $width;
var $height;
var $xmargin;
var $ymargin;
var $pos;
var $npp;
var $npl;
var $i;
function etoiles()
{
global $topdir;
$this->FPDF();
$this->width = 105; // Largeur d'une carte
$this->height = 105; // Hauteur d'une carte
$this->xmargin = 0; // Marge X
$this->ymargin = 30; // Marge Y
$this->npp = 4; // Nombre par page
$this->npl = 2; // Nombre par ligne
$this->fontsize = 16; // Nombre par ligne
$this->SetAutoPageBreak(false);
$this->i = 0;
}
function add ( $name )
{
if ( $this->i % $this->npp == 0 )
{
$this->AddPage();
$this->i = 0;
}
$x = ($this->i % $this->npl) * $this->width + $this->xmargin;
$y = intval ($this->i / $this->npl) * $this->height + $this->ymargin;
$this->Image("etoile.jpg",$x,$y,$this->width,$this->height);
list($nom,$prenom) = explode(";",$name);
$this->SetFont('Arial','',$this->fontsize);
$this->SetXY($x, $y+($this->height/2)-($this->fontsize/2)/*$x,$y+(($this->height-$this->fontsize)/2)*/);
$this->Cell($this->width,5,utf8_decode($nom),0,0,'C');
$this->SetXY($x, $y+($this->height/2));
$this->Cell($this->width,5,utf8_decode($prenom),0,0,'C');
$this->i++;
}
}
if ( isset($_REQUEST["data"]) )
{
$etoiles = new etoiles();
$lines= explode("\n",$_REQUEST["data"]);
foreach ( $lines as $line )
{
$etoiles->add($line);
}
$etoiles->Output();
exit();
}
$site->start_page("services","Etoiles");
$cts = new contents("Etoiles");
$frm = new form("process","etoiles_gala.php");
$frm->add_text_area("data","Données");
$frm->add_submit("valide","C'est parti");
$cts->add($frm);
$site->add_contents($cts);
$site->end_page();
?>
\ No newline at end of file
<?php
$topdir = "../";
include($topdir. "include/site.inc.php");
require_once($topdir. "include/cts/sqltable.inc.php");
require_once($topdir. "include/globals.inc.php");
require_once($topdir. "include/pgsqlae.inc.php");
require_once($topdir. "trombi/include/entities/commentaire.inc.php");
$site = new site();
$site->start_page("none", "Commentaires existants");
$cts = new contents("Commentaires existant");
$req = new requete($site->db,"SELECT * FROM trombi_commentaire WHERE 1");
$tbl = new sqltable("listcomment",
"Commentaires", $req, "",
"id_commentaire",
array("id_commentaire"=>"ID",
"id_commente"=>"Personne commentée",
"id_commentateur"=>"Auteur",
"commentaire"=>"Commentaire",
"date_commentaire"=>"Date",
"modere"=>"Modéré ?",
"id_utilisateur_moderateur"=>"Modérateur"),
array(), array(), array( )
);
$cts->add($tbl,true);
$site->add_contents($cts);
$site->end_page ();
?>
\ No newline at end of file
<?php
/* Copyright 2007
* - Pierre Mauduit <pierre POINT mauduit CHEZ utbm POINT fr>
*
* Ce fichier fait partie du site de l'Association des Étudiants de
* l'UTBM, http://ae.utbm.fr.
*
* 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.
*/
$topdir = "../";
include($topdir. "include/site.inc.php");
require_once($topdir. "include/cts/sqltable.inc.php");
require_once($topdir. "include/entities/pays.inc.php");
require_once($topdir. "include/entities/ville.inc.php");
require_once($topdir. "include/entities/lieu.inc.php");
require_once($topdir. "include/pgsqlae.inc.php");
require_once($topdir. "include/cts/imgloc.inc.php");
$site = new site ();
$pgconn = new pgsqlae();
$lvl = IMGLOC_COUNTRY;
$loc = new imgloc(800, $lvl, $site->db, $pgconn);
$sql = new requete($site->db, "SELECT `id_ville` FROM `loc_ville` WHERE `id_pays` = 69");
while ($rs = $sql->get_row())
{
$idvilles[] = $rs['id_ville'];
}
foreach ($idvilles as $idville)
{
$loc->add_location_by_idville($idville);
}
$loc->add_context();
$img = $loc->generate_img();
$img->output();
exit();
?>
\ No newline at end of file
<?
$topdir = "../";
require_once($topdir. "include/site.inc.php");
require_once($topdir. "include/cts/sqltable.inc.php");
require_once($topdir. "include/entities/lieu.inc.php");
require_once($topdir. "include/pgsqlae.inc.php");
$code_dept = $_REQUEST['code_dept'];
header("Content-type: application/vnd.google-earth.kml+xml");
header("Content-Disposition: filename=ae_utbm_dept".$code_dept.".kml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<kml xmlns=\"http://earth.google.com/kml/2.1\">";
echo "<Document id=\"ae_utbm_fr_deptcontour\">";
echo "<name>ae utbm - Contour de departement</name>";
echo "<Placemark id=\"dept_".$code_dept."\">";
echo "<name>Département ".$code_dept."</name>";
echo "<description>Contours du département Francais ".$code_dept
."</description>";
echo get_kml_dept(new pgsqlae(), $code_dept);
echo "</Placemark>";
echo "</Document>";
echo "</kml>";
?>
\ No newline at end of file
<?php
$cpg="1";
$sem="A07";
$topdir="../";
require_once ($topdir . "include/mysql.inc.php");
require_once ($topdir . "include/mysqlae.inc.php");
$sql = new mysqlae ();
$req = new requete($sql,"SELECT `id_utilisateur`, `nom_utl`, `prenom_utl`, `nom_ville`, `cpostal_ville`, `nom_pays` ".
"FROM `cpg_participe` ".
"INNER JOIN `utilisateurs` USING(`id_utilisateur`) ".
"INNER JOIN `utl_etu` USING(`id_utilisateur`) ".
"LEFT JOIN `loc_pays` ON `loc_pays`.`id_pays`=`utl_etu`.`id_pays` ".
"LEFT JOIN `loc_ville` ON `loc_ville`.`id_ville`=`utl_etu`.`id_ville` ".
"WHERE `id_campagne`='".$cpg."'");
$question=array();
if( $req->lines==0 )
exit();
$req2 = new requete($sql,"SELECT `id_question`, `nom_question` FROM `cpg_question` WHERE `id_campagne`='".$cpg."'");
if( $req2->lines==0 )
exit();
else
while( list($id,$nom)=$req2->get_row() )
$question[$id]=$nom;
echo "PARRAINS\n";
echo "<table border=\"1\">\n<tr><td>NOM</td><td>PRENOM</td><td>VILLE</td><td>PAYS</td>";
foreach($question AS $q)
echo "<td>".$q."</td>";
echo "</tr>\n";
while ( list($id_utl, $nom, $prenom, $ville, $cpostal, $pays)=$req->get_row() )
{
$_req = new requete($sql,"SELECT `id_question`, `valeur_reponse` FROM `cpg_reponse` ".
"INNER JOIN `cpg_question` USING(`id_campagne`,`id_question`) ".
"WHERE `id_campagne`='".$cpg."' AND `id_utilisateur`='".$id_utl."' ".
"ORDER BY `id_question`");
if( $_req->lines>0 )
{
echo "<tr><td>".$nom."</td><td>".$prenom."<td>".$ville." (".$cpostal.")</td><td>".$pays."&nbsp;</td>";
$rep=array();
while( list($id,$_rep)=$_req->get_row())
$rep[$id]=$_rep;
foreach($question AS $id=>$q)
{
if( isset($rep[$id]) )
echo "<td>".$rep[$id]."&nbsp;</td>";
else
echo "<td>&nbsp;</td>";
}
echo "</tr>\n";
}
}
echo "</table>";
echo "\n<br />\n<hr />\n<br />\nBIJOUX\n";
$req = new requete($sql,"SELECT `nom_utl`, `prenom_utl`, `email_utl`, `addresse_utl`, `nom_ville`, `cpostal_ville`, `nom_pays`, `tc`, `branche` ".
"FROM `pre_parrainage` ".
"INNER JOIN `utilisateurs` USING(`id_utilisateur`) ".
"LEFT JOIN `loc_pays` USING(`id_pays`) ".
"LEFT JOIN `loc_ville` USING(`id_ville`) ".
"WHERE SEMESTRE='".$sem."'");
echo "\n<br />\n";
echo "<table border=\"1\">\n";
echo "<tr><td>NOM</td><td>PRENOM</td><td>EMAIL</td><td>ADRESSE</td><td>VILLE</td><td>PAYS</td><td>TC</td><td>BRANCHE</td></tr>\n";
while(list($nom,$prenom,$email,$adresse,$ville,$cpostal,$pays,$tc,$branche)=$req->get_row())
{
echo "<tr><td>".$nom."</td><td>".$prenom."</td><td>".$email."</td><td>".$adresse."&nbsp;</td><td>".$ville." (".$cpostal.")</td><td>".$pays."</td><td>".$tc."</td><td>".$branche."</td></tr>\n";
}
echo "</table>";
?>
<?php
require_once("../include/mysql.inc.php");
require_once("../include/mysqlae.inc.php");
require_once("../include/entities/cotisation.inc.php");
require_once("/tmp/admin-cotis-data.php");
Header("Content-Type: text/html; charset=UTF-8");
echo "<pre>\n";
$dbro = new mysqlae();
$dbrw = new mysqlae("rw");
foreach ($data as $name) {
$sql = new requete($dbro, "SELECT `id_utilisateur`,`nom_utl`,`prenom_utl` FROM `utilisateurs` WHERE `nom_utl` = '" .
mysql_real_escape_string($name) . "'");
echo "\n<b>$name</b>\n";
if ($sql->lines == 1) {
$c = new cotisation($dbro, $dbrw);
$r = $sql->get_row();
$c->load_lastest_by_user($r['id_utilisateur']);
if ($c->id < 0) {
echo " <font color=red>&gt;&gt;&gt;</font> No cotisation found!\n";
} else {
echo " &gt;&gt;&gt; ID: #" . $c->id . "\n";
echo " &gt;&gt;&gt; Fin cotiz: " . date("Y-m-d", $c->date_fin_cotis) . "\n";
}
if (($c->id > 0 && (date("Y-m-d", $c->date_fin_cotis) != "2007-08-15")) ||
($c->id < 0)) {
echo " <font color=green>-&gt;&gt;</font> Adding ... ";
if ($c->add($r['id_utilisateur'], strtotime("2007-08-15"), 4, 2800)) {
echo " done.\n";
} else {
echo " <font color=red>error</font>.\n";
}
} elseif (date("Y-m-d", $c->date_fin_cotis) == "2007-08-15") {
echo " &gt;&gt;&gt; Already subscribed until 2007-08-15.\n";
} else { " <font color=red>&gt;&gt;&gt;</font> Load error ?\n"; }
} elseif ($sql->lines > 1) {
echo " <font color=red>&gt;&gt;&gt;</font> Multiple matches :\n";
while ($row = $sql->get_row()) {
$c = new cotisation($dbro, $dbrw);
$c->load_lastest_by_user($row['id_utilisateur']);
echo " &gt; " . $row['prenom_utl'] . " (<a href=\"/user.php?id_utilisateur=" .
$row['id_utilisateur'] . "\">#" . $row['id_utilisateur'] . "</a>).";
if ($c->id < 0) {
echo "\tNo cotisation found.\n";
} else {
echo "\tFin cotiz: " . date("Y-m-d", $c->date_fin_cotis) . "\n";
}
}
} else {
echo " <font color=red>&gt;&gt;&gt;</font> Not found.\n";
}
}
echo "</pre>\n";
?>
<?php
/* Premier test, on inscrit un utilisateur */
/* $request = <<<XML
<inscription>
<apikey></apikey>
<utbm>0</utbm>
<nom>Crétin</nom>
<prenom>Lapin</prenom>
<email>benc@oxynux.org</email>
<password>bleh</password>
<naissance>2005-04-02</naissance>
<droitimage>true</droitimage>
<alias>LapinCretin</alias>
<sexe>1</sexe>
</inscription>
XML;*/
/* Deuxième test, on vérifie son mot de passe */
$request= <<<XML
<testLogin>
<apikey></apikey>
<login>benc@oxynux.org</login>
<password>leh</password>
</testLogin>
XML;
$client = new WSClient(array("to" => "https://ae.utbm.fr:443/rezomesync.php"));
$response = $client->request($request);
printf("<br/> Request = %s </br>", htmlspecialchars($client->getLastRequest()));
printf("<br/> Response = %s </br>", htmlspecialchars($client->getLastResponse()));
echo "Service replied asking: '".$response->str."'\n";
$simplexml = new SimpleXMLElement($response->str);
$result = $simplexml->result[0];
echo "<br />Return: ".$result."<br />";
?>
<?php
$topdir = "../";
require_once($topdir. "include/site.inc.php");
require_once($topdir. "include/lib/diff.inc.php");
$site = new site ();
$site->add_css("css/diff.css");
$site->start_page("services","AE - Recherche et Développement");
$intro = new contents("Edition liste au format pdf");
$_old = "Feu est un génie, mais faut pa le dire
sinon il va se faire exploiter
par les vilains luttins de la foret
c'est la fête.";
$_new = "Feu est un génie, mais faut pas le dire
sinon il va se faire exploiter
comme ça devrait être interdit
par les vilains luttins de la foret
c'est un fait.";
$df = new Diff($_old,$_new);
$tdf = new TableDiffFormatter();
$intro->add_paragraph("<table class=\"diff\">\n".$tdf->format($df)."</table>");
$site->add_contents($intro);
require_once $topdir. "include/lib/text_diff/Diff.php";
require_once $topdir. "include/lib/text_diff/Diff/Renderer.php";
$diff = &new Text_Diff('auto',array(split("\n",$_old),split("\n",$_new)));
$intro = new contents("test PEAR");
$intro->add_title(2,'simple');
$renderer = &new Text_Diff_Renderer();
$intro->add_paragraph('<pre>'.$renderer->render($diff).'</pre>');
require_once $topdir. "include/lib/text_diff/Diff/Renderer/unified.php";
$intro->add_title(2,'unifié');
$renderer = &new Text_Diff_Renderer_unified();
$intro->add_paragraph('<pre>'.$renderer->render($diff).'</pre>');
require_once $topdir. "include/lib/text_diff/Diff/Renderer/context.php";
$intro->add_title(2,'context');
$renderer = &new Text_Diff_Renderer_context();
$intro->add_paragraph('<pre>'.$renderer->render($diff).'</pre>');
require_once $topdir. "include/lib/text_diff/Diff/Renderer/inline.php";
$intro->add_title(2,'context');
$renderer = &new Text_Diff_Renderer_inline();
$intro->add_paragraph('<pre>'.$renderer->render($diff).'</pre>');
$site->add_contents($intro);
$site->end_page();
?>
<?
/*
* tests de revision
*
* - pedrov
*/
require_once ("../include/globals.inc.php");
echo get_rev ();
?>
<?
/* UTM et tout le toutim d'ellipsoïde qui va avec mes données :
*
* - zone 1N : 32601 -> zone 60N : 32660;
* - zone 1S : 32701 -> zone 60S : 32760;
*
*/
$topdir = "../";
require_once($topdir . 'include/cts/imgcarto.inc.php');
require_once($topdir . 'include/pgsqlae.inc.php');
$dbconn = new pgsqlae();
$req = new pgrequete($dbconn,
"SELECT
name AS nom
, AsText(TRANSFORM(the_geom, 32631)) AS points
FROM
worldadmwgs
WHERE
name IN ('France')");
$rs = $req->get_all_rows();
foreach($rs as $result)
{
$astext .= $result['points'];
}
preg_match_all("/\(([^)]*)\)/", $astext, $matched);
$i = 0;
foreach ($matched[1] as $polygon)
{
$polygon = str_replace("(", "", $polygon);
$points = explode(",", $polygon);
foreach ($points as $point)
{
$coord = explode(" ", $point);
$totalpoints[$i][] = $coord[0];
$totalpoints[$i][] = $coord[1];
}
$i++;
}
$img = new imgcarto();
foreach($totalpoints as $plg)
{
$img->addpolygon($plg, 'black', false);
}
$rtpoints = array(array(460513, 5385217), // 1
array(453135, 5385765), // 2
array(438623, 5388193), // 3
array(420932, 5388193), // 4
array(402792, 5372371), // 5
array(383085, 5356467), // 6 // ???!?
array(365835, 5348786), // 7
array(329096, 5336143), // 8
array(286619, 5324588), // 9
array(243956, 5327818), // 10
array(200505, 5333266), // 11
array(158642, 5339048), // 12
array(121028, 5316705), // 13
array(104042, 5309117), // 14
array(92709, 5309395), // 15
array(86477, 5304332), // 16
array(76228, 5296226), // 17
array(62057, 5294850), // 18
array(51114, 5295455), // 19
array(49684, 5291693), // 20
array(53755, 5284015));
for ($i = 1; $i < count($rtpoints); $i++)
{
$img->addline($rtpoints[$i-1][0],
$rtpoints[$i-1][1],
$rtpoints[$i][0],
$rtpoints[$i][1],
"black");
}
foreach ($rtpoints as $rtpoint)
{
$img->addpoint($rtpoint[0], $rtpoint[1], 4, "red");
}
$req = pg_query("SELECT
AsText(TRANSFORM(the_geom, 32631)) AS points
FROM
deptfr
WHERE
nom_region NOT IN ('REUNION', 'MARTINIQUE', 'GUYANE', 'GUADELOUPE')");
$rs = pg_fetch_all($req);
foreach($rs as $result)
{
$astext .= $result['points'];
}
preg_match_all("/\(([^)]*)\)/", $astext, $matched);
$i = 0;
foreach ($matched[1] as $polygon)
{
$polygon = str_replace("(", "", $polygon);
$points = explode(",", $polygon);
foreach ($points as $point)
{
$coord = explode(" ", $point);
$totalpoints[$i][] = $coord[0];
$totalpoints[$i][] = $coord[1];
}
$i++;
}
$img->addcolor('grey', 90,90,90);
foreach($totalpoints as $plg)
{
$img->addpolygon($plg, 'grey', false);
}
$img->setfactor(1600);
$img->draw();
$img->output();
?>
\ No newline at end of file
<?
$topdir="../";
$timing["include"] -= microtime(true);
include($topdir. "include/site.inc.php");
if( !preg_match('/^\/var\/www\/ae\/www\//', $_SERVER['SCRIPT_FILENAME']))
$GLOBALS["taiste"] = true;
else
$GLOBALS["taiste"] = false;
$timing["include"] += microtime(true);
class requete2 {
var $result=null;
var $errno=0;
var $errmsg=null;
var $lines=-1;
function requete2 ( &$base, $req_sql )
{
global $timing;
$timing["mysql"] -= $st = microtime(true);
if(!$base->dbh)
{
$this->errmsg = "Non connecté";
if( $GLOBALS["taiste"] )
echo "<p>NON MAIS CA VA PAS ! c'est un \$site->db et pas un \$this->db (ou inversement)</p>\n";
return;
}
$this->result = mysql_query($req_sql, $base->dbh);
$timing["mysql"] += $fn = microtime(true);
$timing["mysql.counter"]++;
if ( $fn-$st > 0.001 )
$timing["req"][] = array($fn-$st,$req_sql);
if ( ($this->errno = mysql_errno($base->dbh)) != 0)
{
$this->errmsg = mysql_error($base->dbh);
if( $GLOBALS["taiste"] )
echo "<p>Erreur lors du traitement de votre demande : ".$this->errmsg."</p>\n";
$this->lines = -1;
return;
}
if(strncasecmp($req_sql, "SELECT",6) == 0)
$this->lines = mysql_num_rows ($this->result);
else
$this->lines = mysql_affected_rows ();
}
/**
* Recupère ligne par ligne le résultat de la requête
* @return un tableau associatif, ou null s'il n'ya plus aucune ligne.
*/
function get_row () {
if(!empty($this->result))
return mysql_fetch_array($this->result);
else
return null;
}
/**
* Retroune à la première ligne du résultat de la requête (si applicable)
*/
function go_first ()
{
if ($this->lines > 0 )
mysql_data_seek($this->result, 0);
}
/**
* Détermine si la requête s'est déroulée avec succès