From: x2000habouzit
Date: Tue, 11 Jul 2006 19:48:52 +0000 (+0000)
Subject: exit getphoto.php => photo
X-Git-Tag: xorg/0.9.11~458
X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=adbdf493197146e64f93e085bb039e8bfdcc22bb;p=platal.git
exit getphoto.php => photo
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@440 839d8a87-29fc-0310-9880-83ba4fa771e5
---
diff --git a/htdocs/fiche.php b/htdocs/fiche.php
index 4ff1587..2453df2 100644
--- a/htdocs/fiche.php
+++ b/htdocs/fiche.php
@@ -60,7 +60,7 @@ $page->assign('xorg_title', $title);
// 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");
diff --git a/htdocs/getphoto.php b/htdocs/getphoto.php
deleted file mode 100644
index 5533dec..0000000
--- a/htdocs/getphoto.php
+++ /dev/null
@@ -1,53 +0,0 @@
-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:
-?>
diff --git a/modules/profile.php b/modules/profile.php
index 4c3703e..2d12210 100644
--- a/modules/profile.php
+++ b/modules/profile.php
@@ -24,6 +24,7 @@ class ProfileModule extends PLModule
function handlers()
{
return array(
+ 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
);
}
@@ -52,6 +53,41 @@ class ProfileModule extends PLModule
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';
diff --git a/templates/admin/admin_trombino.tpl b/templates/admin/admin_trombino.tpl
index 828a55c..627ed65 100644
--- a/templates/admin/admin_trombino.tpl
+++ b/templates/admin/admin_trombino.tpl
@@ -29,7 +29,7 @@
Photo actuelle de {$forlife}
-
+
diff --git a/templates/include/form.valid.photos.tpl b/templates/include/form.valid.photos.tpl
index 5c85d62..847d28a 100644
--- a/templates/include/form.valid.photos.tpl
+++ b/templates/include/form.valid.photos.tpl
@@ -23,9 +23,9 @@
Photos |
-
+
-
+
|
diff --git a/templates/include/trombi.tpl b/templates/include/trombi.tpl
index 1a45528..5d54562 100644
--- a/templates/include/trombi.tpl
+++ b/templates/include/trombi.tpl
@@ -29,7 +29,7 @@
{/if}
{if $trombi_admin && $smarty.session.perms eq 'admin'}
diff --git a/templates/listes/trombi.tpl b/templates/listes/trombi.tpl
index 5dbabc7..357a1a3 100644
--- a/templates/listes/trombi.tpl
+++ b/templates/listes/trombi.tpl
@@ -77,7 +77,7 @@
{cycle values="1,2,3" assign="loop"}
{if $loop eq "1"}{/if}
-
+
|
-
+
|
diff --git a/templates/trombino.tpl b/templates/trombino.tpl
index 158b266..7bbb9c7 100644
--- a/templates/trombino.tpl
+++ b/templates/trombino.tpl
@@ -50,11 +50,11 @@
-
+
|
{if $submited}
-
+
{else}
Pas d'image soumise
{/if}
| |