- Brand new PDF of the contact list (using FPDF). -MC
- Even include Photos in the PDF (kludgy !). -MC
+ * Photo Submission :
+ - Rework of the form. -MC
+ - Photo is resized on the fly, instead of dropping too big images. -MC
+
* Skins :
- Openweb : update. -MC
require_once('validations.inc.php');
-if (Env::has('ordi') and isset($_FILES['userfile']['tmp_name'])) {
- $data = file_get_contents($_FILES['userfile']['tmp_name']);
- if ($myphoto = new PhotoReq(Session::getInt('uid'), $data)) {
- $myphoto->submit();
- }
-} elseif (Env::has('web') and Env::has('photo')) {
- // net
- if ($s = file_get_contents(Env::get('photo'))) {
- if ($myphoto = new PhotoReq(Session::getInt('uid'), $s)) {
+$trombi_x = '/home/web/trombino/photos'.Session::get('promo').'/'.Session::get('forlife').'.jpg';
+
+if (Env::has('upload')) {
+ $file = isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : Env::get('photo');
+ if ($data = file_get_contents($file)) {
+ if ($myphoto = new PhotoReq(Session::getInt('uid'), $data)) {
$myphoto->submit();
}
} else {
$page->trig('Fichier inexistant ou vide');
}
} elseif (Env::has('trombi')) {
- // Fichier à récupérer dans les archives trombi + commit immédiat
- $file = '/home/web/trombino/photos'.Session::get('promo').'/'.Session::get('forlife').'.jpg';
- $myphoto = new PhotoReq(Session::getInt('uid'), file_get_contents($file));
- if ($myphoto) {// There was no errors, we can go on
+ $myphoto = new PhotoReq(Session::getInt('uid'), file_get_contents($trombi_x));
+ if ($myphoto) {
$myphoto->commit();
$myphoto->clean();
}
} elseif (Env::get('suppr')) {
- // effacement de la photo
$globals->xdb->execute('DELETE FROM photo WHERE uid = {?}', Session::getInt('uid'));
$globals->xdb->execute('DELETE FROM requests WHERE user_id = {?} AND type="photo"', Session::getInt('uid'));
+} elseif (Env::get('cancel')) {
+ $sql = $globals->xdb->query('DELETE FROM requests WHERE user_id={?} AND type="photo"', Session::getInt('uid'));
}
$sql = $globals->xdb->query('SELECT COUNT(*) FROM requests WHERE user_id={?} AND type="photo"', Session::getInt('uid'));
$page->assign('submited', $sql->fetchOneCell());
+$page->assign('has_trombi_x', file_exists($trombi_x));
$page->run();
</tr>
<tr>
<td class="center">
- <img src="{rel}/getphoto.php?x={$smarty.session.uid}" width="110" alt=" [ PHOTO ] " />
+ <img src="{rel}/getphoto.php?x={$smarty.session.uid}" width="200" alt=" [ PHOTO ] " />
</td>
<td class="center half">
{if $submited}
- <img src="{rel}/getphoto.php?x={$smarty.session.uid}&req=true" width=110 alt=" [ PHOTO ] " />
+ <img src="{rel}/getphoto.php?x={$smarty.session.uid}&req=true" width="200" alt=" [ PHOTO ] " />
{else}
Pas d'image soumise
{/if}
</td>
</tr>
<tr>
- <td colspan="2" class="center">
- Si tu ne souhaites plus montrer cette photo tu peux aussi l'effacer en la remplaçant par : <br />
- {if ($session.promo ge 1995) or ($session.promo le 2002)}
- <input type="submit" value="Trombino de l'X" name="trombi" /><br />
- {/if}
- <input type="submit" value="Image par défaut" name="suppr" />
- </td>
- </tr>
- <tr>
<td colspan="2" class="smaller">
* 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
photo aura été contrôlée.
</td>
</tr>
- </table>
-
- <table class="bicol" cellspacing="0" cellpadding="2">
<tr>
- <th>
+ <th colspan="2">
+ Actions immédiates
+ </th>
+ </tr>
+ <tr>
+ <td {if !$submited}colspan="2"{/if} class="center">
+ Si tu ne souhaites plus montrer cette photo tu peux aussi l'effacer en la remplaçant par : <br />
+ {if $has_trombi_x}
+ <input type="submit" value="Trombino de l'X" name="trombi" /><br />
+ {/if}
+ <input type="submit" value="Image par défaut" name="suppr" />
+ </td>
+ {if $submited}
+ <td class="center">
+ Tu peux annuler ta soumission et garder ta photo actuelle : <br />
+ <input type="submit" value="Annuler ta soumission" name="cancel" />
+ </td>
+ {/if}
+ </tr>
+ <tr>
+ <th colspan="2">
Changement de ta photo
</th>
</tr>
<tr>
- <td>
+ <td colspan="2">
<p>
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
<td class="titre">
Sur ton ordinateur
</td>
- </tr>
- <tr>
- <td>
- <input name="userfile" type="file" size="20" maxlength="150" />
- </td>
- </tr>
- <tr>
- <td class="center">
- <input type="submit" value=" OK " name="ordi" />
- </td>
- </tr>
- <tr>
<td class="titre">
Sur Internet
</td>
</tr>
<tr>
<td>
+ <input name="userfile" type="file" size="20" maxlength="150" />
+ </td>
+ <td>
<input type="text" size="45" maxlength="140" name="photo"
value="{$smarty.request.photo|default:"http://www.multimania.com/joe/maphoto.jpg"}" />
</td>
</tr>
<tr>
<td class="center">
- <input type="submit" value=" OK " name="web" />
+ <input type="submit" value="Envoyer !" name="upload" />
+ </td>
+ <td class="center">
+ <input type="submit" value="Envoyer !" name="upload" />
</td>
</tr>
</table>