From 7b728d84a6c4f39a1ff4bfefee1dae2ceb2180fc Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Mon, 10 Jul 2006 22:07:49 +0000 Subject: [PATCH] migrage trombi promo. 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 | 2 +- hooks/tmp.inc.php | 2 +- htdocs/trombipromo.php | 70 --------------------------------------------- include/login.conf.php | 8 +++--- include/trombi.inc.php | 14 ++++----- include/xorg.plugin.inc.php | 25 ++++++++-------- templates/trombipromo.tpl | 26 ++++++----------- 7 files changed, 34 insertions(+), 113 deletions(-) delete mode 100644 htdocs/trombipromo.php diff --git a/classes/Platal.php b/classes/Platal.php index eb536b4..92604db 100644 --- a/classes/Platal.php +++ b/classes/Platal.php @@ -30,7 +30,7 @@ class Platal var $__hooks; var $path; - var $args; + var $argv; function Platal() { diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index 07f16c8..dd8f471 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -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 index f7f1969..0000000 --- a/htdocs/trombipromo.php +++ /dev/null @@ -1,70 +0,0 @@ -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(); - -?> diff --git a/include/login.conf.php b/include/login.conf.php index c577dfd..a1695d9 100644 --- a/include/login.conf.php +++ b/include/login.conf.php @@ -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 !!' ) ; ?> diff --git a/include/trombi.inc.php b/include/trombi.inc.php index 9f09a3f..034c9ac 100644 --- a/include/trombi.inc.php +++ b/include/trombi.inc.php @@ -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'); } - + // }}} } diff --git a/include/xorg.plugin.inc.php b/include/xorg.plugin.inc.php index 7a4a97c..21343d7 100644 --- a/include/xorg.plugin.inc.php +++ b/include/xorg.plugin.inc.php @@ -35,15 +35,15 @@ 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 "

params should be an array

"; - } 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('&',$get); + return '?' . join('&', $get); } // }}} diff --git a/templates/trombipromo.tpl b/templates/trombipromo.tpl index a81a6bd..87cd5ef 100644 --- a/templates/trombipromo.tpl +++ b/templates/trombipromo.tpl @@ -20,9 +20,6 @@ {* *} {**************************************************************************} - - -{if !$smarty.request.xpromo || $error}

Trombinoscope promo

@@ -33,12 +30,10 @@ donn

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.

-
+
@@ -51,22 +46,21 @@ chaque page affiche au plus {$limit} photos. -   +
-

Site web promo

-

Pour accéder à la liste des sites web promo, clique ici.

- -{else} +{if $trombi}

- {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}

@@ -74,6 +68,4 @@ chaque page affiche au plus {$limit} photos. {/if} - - {* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4