migrage trombi promo.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 10 Jul 2006 22:07:49 +0000 (22:07 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 10 Jul 2006 22:07:49 +0000 (22:07 +0000)
remove links to the 'promo sites' that are a joke atm

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@426 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Platal.php
hooks/tmp.inc.php
htdocs/trombipromo.php [deleted file]
include/login.conf.php
include/trombi.inc.php
include/xorg.plugin.inc.php
templates/trombipromo.tpl

index eb536b4..92604db 100644 (file)
@@ -30,7 +30,7 @@ class Platal
     var $__hooks;
 
     var $path;
-    var $args;
+    var $argv;
 
     function Platal()
     {
index 07f16c8..dd8f471 100644 (file)
@@ -29,7 +29,7 @@ function tmp_menu()
     $globals->menu->addPrivateEntry(XOM_CUSTOM,   40, 'Mon mot de passe',   'password');
     $globals->menu->addPrivateEntry(XOM_CUSTOM,   50, 'Mes préférences',    'prefs');
 
-    $globals->menu->addPrivateEntry(XOM_GROUPS,   10, 'Trombi/Site promo',  'trombipromo.php');
+    $globals->menu->addPrivateEntry(XOM_GROUPS,   10, 'Trombi promo',       'trombi');
     $globals->menu->addPrivateEntry(XOM_GROUPS,   20, 'Conseil Pro.',       'referent.php');
     if ($globals->geoloc->use_map())
         $globals->menu->addPrivateEntry(XOM_GROUPS,   10, 'Planisphère',    'geoloc/');
diff --git a/htdocs/trombipromo.php b/htdocs/trombipromo.php
deleted file mode 100644 (file)
index f7f1969..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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('trombipromo.tpl', AUTH_COOKIE);
-require_once("trombi.inc.php");
-$page->assign('xorg_title','Polytechnique.org - Trombi Promo');
-
-function getList($offset,$limit) {
-    global $globals;
-
-    $xpromo = Env::getInt('xpromo');
-    $where  = ( $xpromo>0 ? "WHERE promo='$xpromo'" : "" );
-
-    $res = $globals->xdb->query(
-            "SELECT  COUNT(*)
-               FROM  auth_user_md5 AS u
-         RIGHT JOIN  photo         AS p ON u.user_id=p.uid
-         $where");
-    $pnb = $res->fetchOneCell();
-
-    $res = $globals->xdb->query(
-            "SELECT  promo,user_id,a.alias AS forlife,IF(nom_usage='', nom, nom_usage) AS nom,prenom
-               FROM  photo         AS p
-         INNER JOIN  auth_user_md5 AS u ON u.user_id=p.uid
-         INNER JOIN  aliases       AS a ON ( u.user_id=a.id AND a.type='a_vie' )
-              $where
-           ORDER BY  promo,nom,prenom LIMIT {?}, {?}", $offset*$limit, $limit);
-    
-    return Array($pnb, $res->fetchAllAssoc());
-}
-
-if (Env::has('xpromo')) {
-    $xpromo = Env::getInt('xpromo');
-
-    if ( $xpromo<1900 || $xpromo>date('Y') || ($xpromo == -1 && Session::get('perms')!="admin") ) {
-       $page->trig("Promotion incorrecte (saisir au format YYYY). Recommence.");
-        $page->assign('error', true);
-    } else {
-       $trombi = new Trombi('getList');
-       $trombi->hidePromo();
-       $trombi->setAdmin();
-       $page->assign_by_ref('trombi',$trombi);
-    }
-} else {
-    $tmp = new Trombi();
-    $page->assign("limit", $tmp->limit);
-}
-
-$page->run();
-
-?>
index c577dfd..a1695d9 100644 (file)
@@ -11,9 +11,9 @@ $pub_tjs = array(
 
 // Liens apparaissant de façon aléatoire
 $pub_rnd = array(
-    'newsletter/show.php?nid=last'                 => 'Afficher la dernière newsletter' ,
-    'http://www.polytechnique.net'                 => 'Vers les autres sites polytechniciens' ,
-    "trombipromo.php?xpromo={$_SESSION["promo"]}"   => "Voir le trombi de ma promo" ,
-    'banana/'                                       => 'Un petit tour du côté des forums !!'
+    'newsletter/show.php?nid=last' => 'Afficher la dernière newsletter' ,
+    'http://www.polytechnique.net' => 'Vers les autres sites polytechniciens' ,
+    "trombi/{$_SESSION["promo"]}"  => "Voir le trombi de ma promo" ,
+    'banana'                       => 'Un petit tour du côté des forums !!'
     ) ;
 ?>
index 9f09a3f..034c9ac 100644 (file)
@@ -26,33 +26,33 @@ require_once('xorg.plugin.inc.php');
 class Trombi extends XOrgPlugin
 {
     // {{{ properties
-    
-    var $_get_vars = Array('offset');
+
+    var $_get_vars = array('offset');
     var $limit = 24;
     var $admin = false;
     var $showpromo = true;
 
     // }}}
     // {{{ function setNbRows()
-    
+
     function setNbRows($row)
     { $this->limit = $row*3; }
 
     // }}}
     // {{{ function setAdmin()
-    
+
     function setAdmin()
     { $this->admin = true; }
 
     // }}}
     // {{{ function hidePromo()
-    
+
     function hidePromo()
     { $this->showpromo = false; }
 
     // }}}
     // {{{ function show()
-    
+
     function show()
     {
        /* this point is nasty...  but since show() is called from the template ...
@@ -81,7 +81,7 @@ class Trombi extends XOrgPlugin
        $page->assign('trombi_admin', $this->admin);
        return $page->fetch('include/trombi.tpl');
     }
-    
+
     // }}}
 }
 
index 7a4a97c..21343d7 100644 (file)
 class XOrgPlugin
 {
     // {{{ properties
-    
+
     /** have to override, contents the fields names used to drive the plugin */
-    var $_get_vars = Array();
+    var $_get_vars = array();
     /** some polymorphism at low cost, may be used, or not */
     var $_callback;
 
     // }}}
     // {{{ function XOrgPlugin()
-   
+
     /** constructor.
      * the constructor override $_get_vars settings by prefixing the names with $prefix
      */
@@ -58,7 +58,7 @@ class XOrgPlugin
 
     // }}}
     // {{{ function get_value()
-    
+
     /** transparent access to $_GET, wrt the right $prefix
      */
     function get_value($key)
@@ -68,7 +68,7 @@ class XOrgPlugin
 
     // }}}
     // {{{ function make_url()
-    
+
     /** construct an url with the given parameters to drive the plugin.
      * leave all other GET params alone
      */
@@ -78,22 +78,21 @@ class XOrgPlugin
        $args = isset($params) ? $params : Array();
 
        if (!is_array($args)) {
-           if (count($this->_get_vars)!=1) {
-               return "<p class='erreur'>params should be an array</p>";
-           } else {
-               $args = Array($this->_get_vars[0]=>$params);
-           }
+            $args = array($this->_get_vars[0]=>$params);
        }
 
        foreach ($_GET as $key=>$val) {
-           if (in_array($key,$this->_get_vars) && array_key_exists($key,$args)) {
+            if ($key == 'p') {
+                continue;
+            }
+           if (in_array($key, $this->_get_vars) && array_key_exists($key, $args)) {
                 continue;
             }
            $get[] = urlencode($key) . '=' . urlencode($val);
        }
 
        foreach ($this->_get_vars as $key) {
-           if (array_key_exists($key,$args)) {
+           if (array_key_exists($key, $args)) {
                if ($args[$key]) {
                     $get[] = urlencode($key) . '=' . urlencode($args[$key]);
                 }
@@ -102,7 +101,7 @@ class XOrgPlugin
            }
        }
 
-       return $_SERVER['PHP_SELF'] . '?' . join('&amp;',$get);
+       return '?' . join('&amp;', $get);
     }
 
     // }}}
index a81a6bd..87cd5ef 100644 (file)
@@ -20,9 +20,6 @@
 {*                                                                        *}
 {**************************************************************************}
 
-
-
-{if !$smarty.request.xpromo || $error}
 <h1>
   Trombinoscope promo
 </h1>
@@ -33,12 +30,10 @@ donn
 <p>
 Fais attention, si tu as une connexion à internet lente (par
 exemple si tu es sur un vieux modem), la page que tu vas télécharger
-en validant peut être longue à afficher. Pour te donner une
-idée de la taille, chaque photo est limitée à 30 ko, et
-chaque page affiche au plus {$limit} photos.
+en validant peut être longue à afficher.
 </p>
 
-<form action="{$smarty.server.PHP_SELF}" method="get">
+<form action="{rel}/trombi/" method="post">
   <table class="tinybicol" cellpadding="3" summary="Saisie promo" style="width: 30%; margin-left:35%">
     <tr>
       <th colspan="2">
@@ -51,22 +46,21 @@ chaque page affiche au plus {$limit} photos.
       </td>
       <td>
         <input type="text" name="xpromo" size="4" maxlength="4" />
-        <input type="hidden" name="offset" value="0" />&nbsp;<input type="submit" value="Ok" />
+        <input type="submit" value="Ok"
+          onclick='this.form.action = this.form.action + this.form.xpromo.value' />
       </td>
     </tr>
   </table>
 </form>
 
-<h1>Site web promo</h1>
-<p>Pour accéder à la liste des sites web promo, clique <a href="http://www.polytechnique.net/groupes.php?cat=promotions">ici</a>.</p>
-
-{else}
+{if $trombi}
 
 <h1>
-  {if $smarty.request.xpromo eq 'all'}
-  Album photo Polytechnique.org
+  Album photo
+  {if $platal->argv[1] eq -1}
+  Polytechnique.org
   {else}
-  Album photo promotion {$smarty.request.xpromo}
+  promotion {$platal->argv[1]}
   {/if}
 </h1>
 
@@ -74,6 +68,4 @@ chaque page affiche au plus {$limit} photos.
 
 {/if}
 
-
-
 {* vim:set et sw=2 sts=2 sws=2: *}