return Array(
Array(
- 'url' => 'webredirect.php',
+ 'url' => 'prefs/webredirect',
'title' => 'Ma redirection de page WEB',
'text' => $text,
'weight' => 60
+++ /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('webredirect.tpl', AUTH_MDP);
-$page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
-
-$log =& Session::getMixed('log');
-$url = Env::get('url');
-
-if ((Env::get('submit') == 'Valider' or Env::get('submit') == 'Modifier') and Env::has('url')) {
- if ($globals->xdb->execute('UPDATE auth_user_quick SET redirecturl = {?} WHERE user_id = {?}',
- $url, Session::getInt('uid')))
- {
- $log->log('carva_add', 'http://'.Env::get('url'));
- $page->trig("Redirection activée vers <a href='http://$url'>$url</a>");
- } else {
- $page->trig('Erreur de mise à jour');
- }
-} elseif (Env::get('submit') == "Supprimer") {
- if ($globals->xdb->execute("UPDATE auth_user_quick SET redirecturl = '' WHERE user_id = {?}", Session::getInt('uid')))
- {
- $log->log("carva_del", $url);
- Post::kill('url');
- $page->trig('Redirection supprimée');
- } else {
- $page->trig('Erreur de suppression');
- }
-}
-
-
-$res = $globals->xdb->query('SELECT redirecturl FROM auth_user_quick WHERE user_id = {?}', Session::getInt('uid'));
-$page->assign('carva', $res->fetchOneCell());
-
-$page->run();
-?>
// Preferences thingies
'prefs' => $this->make_hook('prefs', AUTH_COOKIE),
'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE),
+ 'prefs/webredirect'
+ => $this->make_hook('webredir', AUTH_MDP),
'skin' => $this->make_hook('skin', AUTH_COOKIE),
// password related thingies
return PL_OK;
}
+ function handler_webredir(&$page)
+ {
+ global $globals;
+
+ $page->changeTpl('webredirect.tpl');
+
+ $page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
+
+ $log =& Session::getMixed('log');
+ $url = Env::get('url');
+
+ if (Env::get('submit') == 'Valider' and Env::has('url')) {
+ $globals->xdb->execute('UPDATE auth_user_quick
+ SET redirecturl = {?} WHERE user_id = {?}',
+ $url, Session::getInt('uid')))
+ $log->log('carva_add', 'http://'.Env::get('url'));
+ $page->trig("Redirection activée vers <a href='http://$url'>$url</a>");
+ } elseif (Env::get('submit') == "Supprimer") {
+ $globals->xdb->execute("UPDATE auth_user_quick
+ SET redirecturl = ''
+ WHERE user_id = {?}",
+ Session::getInt('uid')))
+ $log->log("carva_del", $url);
+ Post::kill('url');
+ $page->trig('Redirection supprimée');
+ }
+
+ $res = $globals->xdb->query('SELECT redirecturl
+ FROM auth_user_quick
+ WHERE user_id = {?}',
+ Session::getInt('uid'));
+ $page->assign('carva', $res->fetchOneCell());
+
+ return PL_OK;
+ }
+
function handler_prefs_rss(&$page)
{
global $globals;
</p>
<p>
- Pour modifier cette redirection remplis le champ suivant et clique sur <strong>Modifier</strong>.
+ Pour modifier cette redirection remplis le champ suivant et clique sur <strong>Valider</strong>.
{if $carva}
Si tu veux annuler ta redirection, clique sur <strong>Supprimer</strong>.
{/if}
</td>
</tr>
<tr>
-{if $carva}
- <td class="center">
- <input type="submit" value="Modifier" name="submit" />
- </td>
- <td class="center">
- <input type="submit" value="Supprimer" name="submit" />
- </td>
-{else}
<td colspan="2" class="center">
<input type="submit" value="Valider" name="submit" />
- </td>
+{if $carva}
+ <input type="submit" value="Supprimer" name="submit" />
{/if}
+ </td>
</tr>
</table>
</form>