// photo
-$photo = 'getphoto.php?x='.$user['forlife'].($new ? '&req=true' : '');
+$photo = 'photo/'.$user['forlife'].($new ? '/req' : '');
if(!isset($user['y']) and !isset($user['x'])) {
list($user['x'], $user['y']) = getimagesize("images/none.png");
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * 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 *
- ***************************************************************************/
-
-
-require_once('xorg.inc.php');
-new_skinned_page('login.tpl', AUTH_PUBLIC);
-
-if (Env::has('x')) {
-
- $res = $globals->xdb->query("SELECT id, pub FROM aliases LEFT JOIN photo ON(id=uid) WHERE alias = {?}", Env::get('x'));
- list($uid, $photo_pub) = $res->fetchOneRow();
-
- if (Env::get('req') == "true" && logged()) {
- include 'validations.inc.php';
- $myphoto = PhotoReq::get_request($uid);
- Header('Content-type: image/'.$myphoto->mimetype);
- echo $myphoto->data;
- } else {
- $res = $globals->xdb->query(
- "SELECT attachmime, attach
- FROM photo
- WHERE uid={?}", $uid);
-
- if( (list($type,$data) = $res->fetchOneRow()) && ($photo_pub == 'public' || logged()) ) {
- Header( "Content-type: image/$type");
- echo $data;
- } else {
- Header( 'Content-type: image/png');
- echo file_get_contents(dirname(__FILE__).'/images/none.png');
- }
- }
-}
-
-// vim:set et sws=4 sw=4 sts=4:
-?>
function handlers()
{
return array(
+ 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
);
}
return array($pnb, $res->fetchAllAssoc());
}
+ function handler_photo(&$page, $x = null, $req = null)
+ {
+ if (is_null($x)) {
+ return PL_NOT_FOUND;
+ }
+
+ global $globals;
+
+ $res = $globals->xdb->query("SELECT id, pub FROM aliases
+ LEFT JOIN photo ON(id = uid)
+ WHERE alias = {?}", $x);
+ list($uid, $photo_pub) = $res->fetchOneRow();
+
+ if ($req && logged()) {
+ include 'validations.inc.php';
+ $myphoto = PhotoReq::get_request($uid);
+ Header('Content-type: image/'.$myphoto->mimetype);
+ echo $myphoto->data;
+ } else {
+ $res = $globals->xdb->query(
+ "SELECT attachmime, attach
+ FROM photo
+ WHERE uid={?}", $uid);
+
+ if ((list($type,$data) = $res->fetchOneRow()) && ($photo_pub == 'public' || logged())) {
+ Header("Content-type: image/$type");
+ echo $data;
+ } else {
+ Header('Content-type: image/png');
+ echo file_get_contents(dirname(__FILE__).'../htdocs/images/none.png');
+ }
+ }
+ exit;
+ }
+
function handler_trombi(&$page, $promo = null)
{
require_once 'trombi.inc.php';
Photo actuelle de {$forlife}
</p>
-<img src="../getphoto.php?x={$forlife}" alt="[ PHOTO ]" />
+<img src="{rel}/photo/{$forlife}" alt="[ PHOTO ]" />
<br />
<p>
<tr class="pair">
<td class="titre">Photos</td>
<td>
- <img src="{rel}/getphoto.php?x={$valid->forlife}" style="width:110px;" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$valid->forlife}" style="width:110px;" alt=" [ PHOTO ] " />
- <img src="{rel}/getphoto.php?x={$valid->forlife}&req=true" style="width:110px;" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$valid->forlife}/req" style="width:110px;" alt=" [ PHOTO ] " />
</td>
</tr>
{/if}
<td class="center">
<a href="{"fiche.php"|url}?user={$p.forlife}" class="popup2">
- <img src="{"getphoto.php"|url}?x={$p.forlife}" width="110" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$p.forlife}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_admin && $smarty.session.perms eq 'admin'}
<a href="{"admin/admin_trombino.php"|url}?uid={$p.user_id}">
{cycle values="1,2,3" assign="loop"}
{if $loop eq "1"}<tr>{/if}
<td class='center'>
- <img src="{"getphoto.php"|url}?x={$x.l}" width="110" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$x.l}" width="110" alt=" [ PHOTO ] " />
<br />
<a href="{"fiche.php"|url}?user={$x.l}" class="popup2">
{$x.n} ({$promo})
{/if}.
</td>
<td class="dcolg">
- <img src="getphoto.php?x={$smarty.session.forlife}" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$smarty.session.forlife}" alt=" [ PHOTO ] " />
</td>
</tr>
</table>
</tr>
<tr>
<td class="center">
- <img src="{rel}/getphoto.php?x={$smarty.session.forlife}" width="200" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$smarty.session.forlife}" width="200" alt=" [ PHOTO ] " />
</td>
<td class="center half">
{if $submited}
- <img src="{rel}/getphoto.php?x={$smarty.session.forlife}&req=true" width="200" alt=" [ PHOTO ] " />
+ <img src="{rel}/photo/{$smarty.session.forlife}/req" width="200" alt=" [ PHOTO ] " />
{else}
Pas d'image soumise
{/if}