subscribe($forlife, $uid, $promo, $pass)
triggered when a user subscription is sucessfull
+prefs()
+ function used to add boxes in htdocs/preferences.php
+ must return a dictionnary : url, title, text, weight.
}
// }}}
+// {{{ prefs HOOK
+function emails_prefs()
+{
+ global $globals;
+
+ $res[] = Array(
+ 'url' => 'emails.php',
+ 'title' => 'Mes adresses de redirection',
+ 'text' => 'Tu peux configurer tes différentes redirections de mails ici.',
+ 'weight' => 10
+ );
+
+ if ($globals->mail->alias_dom) {
+ $res [] = Array(
+ 'url' => 'alias.php',
+ 'title' => 'Mon alias mail @'.$globals->mail->alias_dom,
+ 'text' => "Pour choisir un alias @{$globals->mail->alias_dom}/{$globals->mail->alias_dom2} (en choisir un nouveau annule l'ancien).",
+ 'weight' => 20
+ );
+ }
+
+
+ return $res;
+}
+
+// }}}
?>
}
// }}}
+// {{{ prefs hook
+
+function skin_prefs()
+{
+ global $globals;
+ if (empty($globals->skin->enable)) {
+ return null;
+ }
+ return Array(
+ Array(
+ 'url' => 'skins.php',
+ 'title' => 'Apparence du site (skins)',
+ 'text' => 'Tu peux changer les couleurs et les images du site.',
+ 'weight' => 90
+ )
+ );
+}
+
+// }}}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>
}
// }}}
+// {{{ prfs hook
+function tmp_prefs()
+{
+ $fmt = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'html';
+ $fmt2 = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'HTML';
+ return Array(
+ Array(
+ 'url' => 'preferences.php?mail_fmt='.$fmt,
+ 'title' => 'Recevoir les mails en format '.$fmt2,
+ 'text' => 'Les mails envoyés par le site (lettre mensuelle, carnet, ...) le sont de préférence en format '.Session::get('mail_fmt', 'html'),
+ 'weight' => 30
+ )
+ );
+}
+
+// }}}
?>
}
// }}}
+// {{{ prefs hook
+
+function webredirect_prefs()
+{
+ $text = "Tu peux configurer tes redirections WEB http://www.carva.org/" . Session::get('bestalias');
+ if (Session::get('forlife') != Session::get('bestalias')) {
+ $text .= ' et http://www.carva.org/'.Session::get('forlife');
+ }
+
+ return Array(
+ Array(
+ 'url' => 'webredirect.php',
+ 'title' => 'Ma redirection de page WEB',
+ 'text' => $text,
+ 'weight' => 80
+ )
+ );
+}
+
+// }}}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
?>
$_SESSION['mail_fmt'] = $fmt;
}
-$page->run($has_cookie);
+$page->assign('prefs', $globals->hook->prefs());
+$page->run();
// vim:set et sw=4 sts=4 sws=4:
?>
}
}
+ // }}}
+ // {{{ function menu
+
function menu()
{
foreach ($this->_mods as $mod) {
}
}
+ // }}}
+ // {{{ function subscribe
+
function subscribe($forlife, $uid, $promo, $pass)
{
foreach ($this->_mods as $mod) {
}
// }}}
+ // {{{ function prefs
+
+ function prefs()
+ {
+ $res = Array();
+ foreach ($this->_mods as $mod) {
+ if (!function_exists($mod.'_prefs')) continue;
+ $res = array_merge($res, call_user_func($mod.'_prefs'));
+ }
+ usort($res, create_function('$a, $b', 'return strcmp($a["weight"], $b["weight"]);'));
+ return $res;
+ }
+
+ // }}}
}
// }}}
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************/
-
-// {{{ function smarty_modifier_glob()
-
-/**
- * smarty modifier that perform a glob in the templates directory
- */
-function smarty_modifier_glob($string)
-{
- global $globals;
-
- return glob($globals->root.'/templates/'.$string);
-}
-
-// }}}
-
-?>
Configuration des différents services du site
</th>
</tr>
- {foreach from="preferences.tpl.d/*.tpl"|glob item=inc key=id name=glob}
+ {foreach from=$prefs item=pref key=id name=glob}
{if $id is even}
<tr class="{cycle values="impair,pair"}">
- {/if}
+ {/if}
<td class="half">
- {include file=$inc}
+ <h3><a href="{rel}/{$pref.url}">{$pref.title}</a></h3>
+ <div class='explication'>{$pref.text|smarty:nodefaults}</div>
</td>
{if $id is even && $smarty.foreach.glob.last}
<td class="half"></td>
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************}
-
-<h3><a href="{rel}/emails.php">Mes adresses de redirection</a></h3>
-<div class='explication'>
- Tu peux configurer tes différentes redirections de mails ici.
-</div>
-
-{* vim:set et sw=2 sts=2 sws=2: *}
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************}
-
-{if #globals.mail.alias_dom#}
-<h3><a href="{rel}/alias.php">Mon alias mail {#globals.mail.alias_dom#}</a></h3>
-<div class='explication'>
- Pour choisir un alias {#globals.mail.alias_dom#} et {#globals.mail.alias_dom2#} (en choisir un nouveau annule l'ancien).
-</div>
-{/if}
-
-{* vim:set et sw=2 sts=2 sws=2: *}
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************}
-
-{if $smarty.session.mail_fmt eq 'texte'}
-<h3><a href="?mail_fmt=html">Recevoir les mails en format HTML</a></h3>
-{else}
-<h3><a href="?mail_fmt=texte">Recevoir les mails en format texte</a></h3>
-{/if}
-<div class='explication'>
- Les mails envoyés par le site (lettre mensuelle, carnet, ...) le sont de préférence en format {$smarty.session.mail_fmt}.
-</div>
-
-{* vim:set et sw=2 sts=2 sws=2: *}
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************}
-
-<h3><a href="{rel}/webredirect.php">Ma redirection de page WEB</a></h3>
-<div class='explication'>
- Tu peux configurer tes redirections WEB
- http://www.carva.org/{$smarty.session.bestalias}
- et http://www.carva.org/{$smarty.session.forlife}
- </div>
-
-{* vim:set et sw=2 sts=2 sws=2: *}
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************}
-
-{if #globals.skin.enable#}
-<h3><a href="{rel}/skins.php">Apparence du site (skins)</a></h3>
-<div class="explication">
- Tu peux changer les couleurs et les images du site.
-</div>
-{/if}
-
-{* vim:set et sw=2 sts=2 sws=2: *}