migrate getlogo
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 14 Jul 2006 19:54:03 +0000 (19:54 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 14 Jul 2006 19:54:03 +0000 (19:54 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@484 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs.net/groupe/getlogo.php [deleted file]
modules/xnetgrp.php
templates/xnet/groupe/asso.tpl
templates/xnet/groupe/edit.tpl

diff --git a/htdocs.net/groupe/getlogo.php b/htdocs.net/groupe/getlogo.php
deleted file mode 100644 (file)
index 21f483b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-require 'xnet.inc.php';
-
-$res = $globals->xdb->query("SELECT logo, logo_mime FROM groupex.asso WHERE id = {?}", $globals->asso('id'));
-list($logo, $logo_mime) = $res->fetchOneRow();
-
-if (!empty($logo)) {
-    header("Content-type: $mime");
-    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-    header("Last-Modified:" . gmdate("D, d M Y H:i:s") . " GMT");
-    header("Cache-Control: no-cache, must-revalidate");
-    header("Pragma: no-cache");
-    echo $logo;
-} else {
-    header("Content-type: image/jpeg");
-    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-    header("Last-Modified:" . gmdate("D, d M Y H:i:s") . " GMT");
-    header("Cache-Control: no-cache, must-revalidate");
-    header("Pragma: no-cache");
-    readfile("../images/dflt_carre.jpg");
-}
-
-?>
index b6d7968..feb9239 100644 (file)
@@ -24,7 +24,9 @@ class XnetGrpModule extends PLModule
     function handlers()
     {
         return array(
-            'grp' => $this->make_hook('index', AUTH_PUBLIC),
+            'grp'             => $this->make_hook('index', AUTH_PUBLIC),
+            'grp/asso.php'    => $this->make_hook('index', AUTH_PUBLIC),
+            'grp/logo'        => $this->make_hook('logo',  AUTH_PUBLIC),
         );
     }
 
@@ -44,6 +46,34 @@ class XnetGrpModule extends PLModule
 
         $page->assign('asso', $globals->asso());
     }
+
+    function handler_logo(&$page)
+    {
+        global $globals;
+
+        $res = $globals->xdb->query("SELECT logo, logo_mime
+                                       FROM groupex.asso WHERE id = {?}",
+                                    $globals->asso('id'));
+        list($logo, $logo_mime) = $res->fetchOneRow();
+
+        if (!empty($logo)) {
+            header("Content-type: $mime");
+            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+            header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
+            header('Cache-Control: no-cache, must-revalidate');
+            header('Pragma: no-cache');
+            echo $logo;
+        } else {
+            header('Content-type: image/jpeg');
+            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+            header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
+            header('Cache-Control: no-cache, must-revalidate');
+            header('Pragma: no-cache');
+            readfile(dirname(__FILE__).'/../htdocs.net/images/dflt_carre.jpg');
+        }
+
+        exit;
+    }
 }
 
 ?>
index 2762497..3a7e082 100644 (file)
@@ -21,9 +21,9 @@
 {**************************************************************************}
 
 {if $asso.site}
-<a href="{$asso.site}"><img src='{rel}/{$platal->ns}getlogo.php' alt="LOGO" style="float: right;" /></a>
+<a href="{$asso.site}"><img src='{rel}/{$platal->ns}logo' alt="LOGO" style="float: right;" /></a>
 {else}
-<img src='{rel}/{$platal->ns}getlogo.php' alt="LOGO" style="float: right;" />
+<img src='{rel}/{$platal->ns}logo' alt="LOGO" style="float: right;" />
 {/if}
 
 <h1>{$asso.nom} : Accueil</h1>
index 1e10b55..f62348b 100644 (file)
@@ -20,7 +20,7 @@
 {*                                                                        *}
 {**************************************************************************}
 
-<img src='getlogo.php' alt="LOGO" style="float: right;" />
+<img src='{rel}/{$platal->ns}logo' alt="LOGO" style="float: right;" />
 
 <h1>{$asso.nom} : Ă‰diter l'accueil</h1>