From: x2000habouzit Date: Sat, 24 Jul 2004 18:22:41 +0000 (+0000) Subject: trombino X-Git-Tag: xorg/old~1782 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6fcd3ce96e780ac56ff198d62d6843a51461b3f6;p=platal.git trombino --- diff --git a/etat_migration b/etat_migration index 97d9a42..d5ac957 100644 --- a/etat_migration +++ b/etat_migration @@ -17,7 +17,6 @@ Etat | Ancien nom | Nouveau nom ------+-[ marketing ]-----------------------------+---------------- ; | admin/utilisateurs_identification.php | marketing/ -------+-[ docs ]----------------------------------+---------------- ------+-[ emails ... ]----------------------------+---------------- ; | routage-mail.php | ------+-[ inscription + mdp ]---------------------+---------------- @@ -26,7 +25,6 @@ Etat | Ancien nom | Nouveau nom ------+-[ bordel ]--------------------------------+---------------- ; | fiche_referent.php | ; | recherche.php | -; | trombino.php | ; | x.php | ------+-[ listes ]--------------------------------+---------------- ; | listes/creation.php | \ @@ -179,6 +177,7 @@ xx | services.php | docs/services.php xx | skins.php | - xx | trezo/gere_operations.php | - xx | trezo/index.php | - +xx | trombino.php | xx | trombipromo.php | xx | vcard.php | - ------+-------------------------------------------+---------------- diff --git a/htdocs/css/default.css b/htdocs/css/default.css index 348a840..914d7d4 100644 --- a/htdocs/css/default.css +++ b/htdocs/css/default.css @@ -235,6 +235,29 @@ div.long td.lt { width: 35%; } div.long td.rt { width: 65%; } /**: VI. :**/ + +table.flags td.texte { + font-size: smaller; + font-weight: bold; + padding-left: 0.5em; +} +table.flags td.vert { + background-color: green; + width: 1.5em; height: 1.5em; + text-align: center; +} +table.flags td.orange { + background-color: #ff9900; + width: 1.5em; + height: 1.5em; + text-align: center; +} +table.flags td.rouge { + background-color: red; + width: 1.5em; + height: 1.5em; + text-align: center; +} table.cadre_a_onglet{ border-width: 0; @@ -418,4 +441,4 @@ div.conteneur_tab { font-size: 95% } /* vim: set et ts=4 sts=4 sw=4: */ -/* $Id: default.css,v 1.28 2004-07-24 16:06:57 x2000habouzit Exp $ */ +/* $Id: default.css,v 1.29 2004-07-24 18:22:42 x2000habouzit Exp $ */ diff --git a/htdocs/getphoto.php b/htdocs/getphoto.php index d6eb5df..30e10f8 100644 --- a/htdocs/getphoto.php +++ b/htdocs/getphoto.php @@ -16,28 +16,29 @@ new_skinned_page('login.tpl', AUTH_COOKIE); function url($url) { $chemins = Array('.', '..', '/'); foreach ($chemins as $ch) - if (file_exists("$ch/login.php") || file_exists("$ch/public/login.php")) - return "$ch/$url"; + if (file_exists("$ch/login.php") || file_exists("$ch/public/login.php")) + return "$ch/$url"; return ""; } if(isset($_REQUEST['x'])) { - if(isset($_REQUEST['req']) && $_REQUEST['req']="true") { - $myphoto = PhotoReq::get_unique_request($_REQUEST['x']); - Header("Content-type: image/".$myphoto->mimetype); - echo $myphoto->data; - } else { - $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'"); + if(isset($_REQUEST['req']) && $_REQUEST['req']="true") { + include 'validations.inc.php'; + $myphoto = PhotoReq::get_unique_request($_REQUEST['x']); + Header("Content-type: image/".$myphoto->mimetype); + echo $myphoto->data; + } else { + $result = $globals->db->query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'"); - if( list($type,$data) = @mysql_fetch_row($result) ) { - Header( "Content-type: image/$type"); - echo $data; - } else { - Header( "Content-type: image/png"); - $f=fopen(url("none.png"),"r"); - echo fread($f,30000); - fclose($f); - } + if( list($type,$data) = @mysql_fetch_row($result) ) { + Header( "Content-type: image/$type"); + echo $data; + } else { + Header( "Content-type: image/png"); + $f=fopen(url("images/none.png"),"r"); + echo fread($f,30000); + fclose($f); } + } } ?> diff --git a/htdocs/images/none.png b/htdocs/images/none.png new file mode 100644 index 0000000..06f2061 Binary files /dev/null and b/htdocs/images/none.png differ diff --git a/htdocs/trombino.php b/htdocs/trombino.php new file mode 100644 index 0000000..81ebf47 --- /dev/null +++ b/htdocs/trombino.php @@ -0,0 +1,51 @@ +submit(); +} elseif (isset($_REQUEST["web"]) and isset($_REQUEST["photo"])) { + // net + $fp = fopen($_REQUEST["photo"], 'r'); + if (!$fp) { + $erreur = "Fichier inexistant"; + } else { + $attach = fread($fp, 35000); + fclose($fp); + $file = tempnam('/tmp','photo_'); + $fp = fopen($file,'w'); + fwrite($fp, $attach); + fclose($fp); + + $myphoto = new PhotoReq($_SESSION['uid'], $file); + if(!isset($erreur)) + $myphoto->submit(); + } +} elseif (isset($_REQUEST["trombi"])) { + // Fichier à récupérer dans les archives trombi + commit immédiat + $file = "/home/web/trombino/photos".$_SESSION["promo"]."/".$_SESSION["username"].".jpg"; + $myphoto = new PhotoReq($_SESSION['uid'], $file); + $myphoto->commit(); + $myphoto->clean(); +} elseif (isset($_REQUEST["suppr"])) { + // effacement de la photo + $globals->db->query("DELETE FROM photo WHERE uid = ".$_SESSION["uid"]); + $globals->db->query("DELETE FROM requests WHERE user_id = ".$_SESSION["uid"]." AND type='photo'"); +} + +// Si une requête a été faite et qu'une erreur est signalée, on affiche l'erreur +if(isset($erreur)) $page->assign('erreur', $erreur); + +$sql = $globals->db->query("SELECT * FROM requests WHERE user_id='{$_SESSION['uid']}' AND type='photo'"); +$page->assign('submited', mysql_num_rows($sql) > 0); + +$page->run(); + +// Affichage de la page principale +?> diff --git a/include/validations.inc.php b/include/validations.inc.php index dfd7512..1feaa6b 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -1,6 +1,6 @@ db->query("LOCK requests"); // le lock est obligatoire pour récupérer le dernier stamp ! - if($this->unique) $globals->db->query("DELETE FROM requests WHERE user_id='".$this->uid . "' AND type='".$this->type."'"); @@ -127,8 +125,6 @@ class Validate { . "WHERE user_id='".$this->uid."' AND type='".$this->type."'"); list($this->stamp) = mysql_fetch_row($sql); mysql_free_result($sql); - - $globals->db->query("UNLOCK requests"); return true; } diff --git a/templates/profil.tpl b/templates/profil.tpl index 826a468..062aff7 100644 --- a/templates/profil.tpl +++ b/templates/profil.tpl @@ -1,4 +1,4 @@ -{* $Id: profil.tpl,v 1.2 2004-07-17 11:23:09 x2000habouzit Exp $ *} +{* $Id: profil.tpl,v 1.3 2004-07-24 18:22:43 x2000habouzit Exp $ *} {config_load file="profil.conf"} {literal} @@ -22,10 +22,6 @@ table.bicol span.nom {} table.bicol span.valeur {font-weight: bold;} table.bicol span.lien {font-size: smaller;} - table.flags td.texte {font-size: smaller; font-weight: bold; padding-left: 0.5em;} - table.flags td.vert {background-color: green; width: 1.5em; height: 1.5em; text-align: center;} - table.flags td.orange {background-color: #ff9900; width: 1.5em; height: 1.5em; text-align: center;} - table.flags td.rouge {background-color: red; width: 1.5em; height: 1.5em; text-align: center;} --> {/literal} diff --git a/templates/trombino.tpl b/templates/trombino.tpl new file mode 100644 index 0000000..03f187b --- /dev/null +++ b/templates/trombino.tpl @@ -0,0 +1,137 @@ +{* $Id: trombino.tpl,v 1.1 2004-07-24 18:22:43 x2000habouzit Exp $ *} + +{dynamic} + +{if $erreur} +

+{$erreur} +

+

+La photo soumise n'a pu être correctement téléchargée pour la raison précédente. +La photo par défaut est donc gardée. +

+{/if} + + +
+ Trombinoscope +
+ +
+ + + + + +
+ privé +
+ + {if ($session.promo ge 1995) or ($session.promo le 2002)} +

+ Si tu n'as pas encore fourni de photo, c'est celle du trombinoscope de l'X qui est + affichée par défaut dans le profil. Si elle ne te plaît pas, ou si tu n'es quand même + plus un tos, tu peux la remplacer par ta photo en suivant les instructions suivantes. +

+ {/if} + + + + + + + + + + + + + + + + +
+ Photo actuelle + + Photo en cours de validation(*) +
+  [ PHOTO ] + + {if $submited} +  [ PHOTO ] + {else} + Pas d'image soumise + {/if} + +
+ Si tu ne souhaites plus montrer cette photo tu peux aussi l'effacer en la remplaçant par :
+ {if ($session.promo ge 1995) or ($session.promo le 2002)} +
+ {/if} + +
+ * Les photos sont soumises à une validation manuelle en raison des législations relatives + aux droits d'auteur et à la protection des mineurs. Il faut donc attendre l'intervention + d'un administrateur pour que la photo soit prise en compte. Tu recevras un mail lorsque ta + photo aura été contrôlée. +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Changement de ta photo +
+

+ Nous te proposons deux possibilités pour mettre à jour ta photo (30 Ko maximum). Tout dépend + de savoir où se trouve ta photo. Si elle est sur ton poste de travail local, c'est la première + solution qu'il faut choisir. +

+

+ Si elle est sur Internet, choisis la seconde solution et nos robots iront la télécharger + directement où il faut :-) +

+
+ Sur ton ordinateur +
+ +
+ +
+ Sur Internet +
+ +
+ +
+ +
+ +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *}