--- /dev/null
+[submodule "core"]
+ path = core
+ url = ./
================================================================================
-VERSION 0.9.17 XX XX 2008
+VERSION 0.9.18 XX XX XXXX
+
+
+================================================================================
+VERSION 0.9.17 19 07 2008
New:
- Add an anti-XSRF framework, and add protection to most pages -VZA
- Add a 'disallow all' robots.txt in development working copies. -VZA
+ * Forums:
+ - Can choose the color of the branches -FRU
+
Bug/Wish:
* Admin:
+ - #770: Keeps hidden validation preferences in the database -JAC
- #811: Improve interface to add medal ranks and avoid losing data -ALK
+ - #830: Adds admnistration pages for sub-sectors and functions -JAC
* Carnet:
- #831: Don't be notified of birthdays of the previous day -FRU
* Core:
- Fix email sending, correcting bugs introduced in r1897 -VZA
+ - #832: Always include the url in bug reports -ALK
- #841: Improves contrast of links in legends in skin 'Espace' -FRU
+ - #844: Uses INT in MySQL to store user ids -VZA
+ - #851: Adds a direct link to GApps for gapps-active users -VZA
* Lists:
+ - #756: Can build the list of members from a file -FRU
- #761: Fix user comment in moderation mail sent by mailman -FRU
- #810: Fix encoding of admin pages -FRU
- #813: Fix display of the sample mail refusal message -JAC
+ - #817: Automation of the management of associations' ML -JAC
- #839: Fix warning when adding an external address -FRU
+ - #849: Don't list registrated user in unregistrated list -FRU
- Larger click target to toggle emails in the validation interface -ALK
* Profile:
* Search:
- Fix display of autocompletion menu (use plugin's latest version) -ALK
- Clicking on the "..." entry no longer replaces search with "..." -ALK
+ - #850: Fix autocompletion bug when changing an advanced search -ALK
+ - #854: Indicates the bounds of the page's display if possible -JAC
* Xnet:
- #821: Fix infinite loop when user can't be authenticated -FRU
* XnetGrp:
- #806: Unsubscribe from MLs when leaving the group -FRU
+ - #807: Notify groupes managers of unsubscriptions -FRU
- #814: Group managers can change the visibility of the group -FRU
+ - #823: Store the subscription requests -FRU
- #824: Fix redirection when changing status of the user -FRU
+ - #846: Don't export users without a forlife in the vcard -FRU
+ - #847: Can export the directory as .csv file -FRU
+ - #848: Add a free text field in user profile -FRU
* XnetEvents:
- #825: Show the number of comers when the events contains 1 part -FRU
## core
##
-core: spool/templates_c spool/mails_c include/globals.inc.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp
+core: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp
spool/templates_c spool/mails_c spool/uploads spool/conf spool/tmp:
mkdir -p $@
jquery: htdocs/javascript/jquery.js htdocs/javascript/jquery.autocomplete.js $(JQUERY_PLUGINS_PATHES)
-htdocs/javascript/jquery.js: DOWNLOAD_SRC = http://jquery.com/src/jquery-latest.pack.js
+htdocs/javascript/jquery.js: DOWNLOAD_SRC = http://jquery.com/src/jquery-latest.min.js
htdocs/javascript/jquery.js:
@$(download)
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-ini_set('include_path',dirname(__FILE__).'/../include:' . dirname(__FILE__).'/../classes:/usr/share/php');
-
+ini_set('include_path', dirname(__FILE__) . '/../core/include:'
+ . dirname(__FILE__) . '/../include:'
+ . dirname(__FILE__) . '/../core/classes:'
+ . dirname(__FILE__) . '/../classes:'
+ . '/usr/share/php');
require_once('xorg.inc.php');
-require_once('xorg.misc.inc.php');
-require_once 'xdb.php';
+new Platal('core');
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
}
// la table des notifs est nettoyée
-$eight_days_ago = date("YmdHis",mktime() - 8*24*60*60);
+$eight_days_ago = date("YmdHis", time() - 8*24*60*60);
query("DELETE FROM watch_ops WHERE known<$eight_days_ago");
query("DELETE FROM register_pending WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 365");
-query("delete from register_pending WHERE hash = 'INSCRIT'");
+query("DELETE FROM register_pending WHERE hash = 'INSCRIT'");
// quelques tables sont triées pour que la lecture triée soit plus facile
-query("alter table applis_def order by text");
-query("alter table binets_def order by text");
-query("alter table groupesx_def order by text");
-query("alter table secteur order by text");
-query("alter table sections order by text");
+query("ALTER TABLE applis_def ORDER BY text");
+query("ALTER TABLE binets_def ORDER BY text");
+query("ALTER TABLE groupesx_def ORDER BY text");
+query("ALTER TABLE secteur ORDER BY text");
+query("ALTER TABLE sections ORDER BY text");
+// Prunes older autocomplete queries.
+query("DELETE FROM search_autocomplete WHERE generated < DATE_SUB(NOW(), INTERVAL 1 DAY)");
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
break;
}
- if ($client->handle_request($list, $mid, $action, utf8_decode($reason))) {
- $sent_mails += $count;
- $texte = "le message suivant :\n\n"
- . " Auteur: {$mail['sender']}\n"
- . " Sujet : « {$mail['subj']} »\n"
- . " Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n"
- . $append;
- $mailer = new PlMailer();
- $mailer->addTo("$list-owner@{$domain}");
- $mailer->setFrom("$list-bounces@{$domain}");
- $mailer->addHeader('Reply-To', "$list-owner@{$domain}");
- $mailer->setSubject($subject);
- $mailer->setTxtBody($texte);
- $mailer->send();
- }
-
// if the mail was classified as Unsure, feed bogo
$raw_mail = html_entity_decode($client->get_pending_mail($list, $mid, 1));
// search for the X-Spam-Flag header
$mailer->send();
}
+ // send feedback to the mailing list owners
+ if ($client->handle_request($list, $mid, $action, utf8_decode($reason))) {
+ $sent_mails += $count;
+ $texte = "le message suivant :\n\n"
+ . " Auteur: {$mail['sender']}\n"
+ . " Sujet : « {$mail['subj']} »\n"
+ . " Date : ".strftime("le %d %b %Y à %H:%M:%S", (int)$mail['stamp'])."\n\n"
+ . $append;
+ $mailer = new PlMailer();
+ $mailer->addTo("$list-owner@{$domain}");
+ $mailer->setFrom("$list-bounces@{$domain}");
+ $mailer->addHeader('Reply-To', "$list-owner@{$domain}");
+ $mailer->setSubject($subject);
+ $mailer->setTxtBody($texte);
+ $mailer->send();
+ }
+
// release the lock
XDB::execute("DELETE FROM ml_moderate WHERE handler = {?}",
$handler);
$res = XDB::query('SELECT COUNT(DISTINCT uid), COUNT(*) FROM register_marketing');
list($a, $b) = $res->fetchOneRow();
$MESSAGE .= "\n$c INSCRIPTIONS SOLICITÉES :\n";
-$MESSAGE .= " $a utilisateurs\n $b adresses mails\n";
+$MESSAGE .= " $a utilisateurs\n $b adresses email\n";
// ---------------------------------------
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once(dirname(__FILE__) . '/../classes/csvimporter.php');
+require_once(dirname(__FILE__) . '/../core/classes/csvimporter.php');
// {{{ function showHelp()
$keys = 'id';
processArgs();
-require_once(dirname(__FILE__) . '/../classes/xdb.php');
+require_once(dirname(__FILE__) . '/../core/classes/xdb.php');
$source = file_get_contents($sourceName);
$insert_relation = null;
ini_set('include_path', '.:../include:/usr/share/php');
require_once('connect.db.inc.php');
-require_once('xorg.inc.php');
require_once('emails.inc.php');
$opts = getopt('o:');
ini_set('include_path', '.:../include:/usr/share/php');
require_once('connect.db.inc.php');
-require_once('xorg.inc.php');
require_once('emails.inc.php');
require_once('../classes/plmailer.php');
#!/usr/bin/php5 -q
<?php
-require_once("xorg.inc.php");
+
+require_once(dirname(__FILE__) . '/connect.db.inc.php');
require_once('validations.inc.php');
+global $globals;
+
$opt = getopt('p:o:h');
if(empty($opt['p']) || empty($opt['o']) || isset($opt['h'])) {
$promo = intval($opt['p']);
$owner = $opt['o'];
-$req = new ListeReq(0, "promo$promo", "Liste de la promotion $promo",
+$req = new ListeReq(0, false, "promo$promo", $globals->mail->domain, "Liste de la promotion $promo",
1 /*private*/, 2 /*moderate*/, 0 /*free subscription*/,
array($owner), array());
$req->submit();
return 0
def get_bogo_level(userdesc, perms, vhost, listname):
+ """ Compute bogo level from the filtering rules set up on the list. """
try:
mlist = MailList.MailList(vhost+VHOST_SEP+listname.lower(), lock=0)
except:
try:
if not is_admin_on(userdesc, perms, mlist):
return 0
- if mlist.header_filter_rules == []:
+ if len(mlist.header_filter_rules) == 0:
return 0
+
+ unsurelevel = 0
+ filterlevel = 0
+ filterbase = 0
+
+ # The first rule filters Unsure mails
+ if mlist.header_filter_rules[0][0] == 'X-Spam-Flag: Unsure, tests=bogofilter':
+ unsurelevel = 1
+ filterbase = 1
+
+ # Check the other rules:
+ # - we have 2 rules: this is level 2 (drop > 0.999999, moderate Yes)
+ # - we have only one rule with HOLD directive : this is level 1 (moderate spams)
+ # - we have only one rule with DISCARD directive : this is level 3 (drop spams)
try:
- action = mlist.header_filter_rules[2][1]
- return 2
+ action = mlist.header_filter_rules[filterbase + 1][1]
+ filterlevel = 2
except:
- action = mlist.header_filter_rules[1][1]
+ action = mlist.header_filter_rules[filterbase][1]
if action == mm_cfg.HOLD:
- return 1
- if action == mm_cfg.DISCARD:
- return 3
+ filterlevel = 1
+ elif action == mm_cfg.DISCARD:
+ filterlevel = 3
+ return (filterlevel << 1) + unsurelevel
except:
return 0
def set_bogo_level(userdesc, perms, vhost, listname, level):
+ """ set filter to the specified level. """
try:
mlist = MailList.MailList(vhost+VHOST_SEP+listname.lower(), lock=0)
except:
if not is_admin_on(userdesc, perms, mlist):
return 0
hfr = []
- if int(level) is 1:
+
+ # The level is a combination of a spam filtering level and unsure filtering level
+ # - the unsure filtering level is only 1 bit (1 = HOLD unsures, 0 = Accept unsures)
+ # - the spam filtering level is a number growing with filtering strength
+ # (0 = no filtering, 1 = moderate spam, 2 = drop 0.999999 and moderate others, 3 = drop spams)
+ bogolevel = int(level)
+ filterlevel = bogolevel >> 1
+ unsurelevel = bogolevel & 1
+
+ # Set up unusre filtering
+ if unsurelevel == 1:
hfr.append(('X-Spam-Flag: Unsure, tests=bogofilter', mm_cfg.HOLD, False))
+
+ # Set up spam filtering
+ if filterlevel is 1:
hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
- elif int(level) is 2:
- hfr.append(('X-Spam-Flag: Unsure, tests=bogofilter', mm_cfg.HOLD, False))
+ elif filterlevel is 2:
hfr.append(('X-Spam-Flag: Yes, tests=bogofilter, spamicity=(0\.999999|1\.000000)', mm_cfg.DISCARD, False))
hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
- elif int(level) is 3:
- hfr.append(('X-Spam-Flag: Unsure, tests=bogofilter', mm_cfg.HOLD, False))
+ elif filterlevel is 3:
hfr.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.DISCARD, False))
+
+ # save configuration
if mlist.header_filter_rules != hfr:
mlist.Lock()
mlist.header_filter_rules = hfr
+ "http://listes.polytechnique.org/members/" + inverted_listname
mlist.header_filter_rules = []
+ mlist.header_filter_rules.append(('X-Spam-Flag: Unsure, tests=bogofilter', mm_cfg.HOLD, False))
mlist.header_filter_rules.append(('X-Spam-Flag: Yes, tests=bogofilter', mm_cfg.HOLD, False))
mlist.Save()
server.serve_forever()
-# vim:set et:
+# vim:set et sw=4 sts=4 sws=4:
XDB::execute('DELETE FROM search_name');
$res = XDB::iterRow('SELECT auth_user_md5.user_id, nom, prenom, nom_usage, profile_nick
FROM auth_user_md5
- LEFT JOIN auth_user_quick USING(user_id)');
+ LEFT JOIN auth_user_quick USING(user_id)');
$i = 0;
$muls = array(1, 1, 1, 0.2);
$pub = array(true, true, true, false);
--- /dev/null
+/platalglobals.php
+++ /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
- */
-
-
-class CoreLogger
-{
- /** user id */
- public $uid;
- /** id of the session */
- private $session;
- /** list of available actions */
- private $actions;
-
- public $ip;
- public $host;
- public $proxy_ip;
- public $proxy_host;
-
- /** The constructor, creates a new entry in the sessions table
- *
- * @param $uid the id of the logged user
- * @param $suid the id of the administrator who has just su'd to the user
- * @return VOID
- */
- public function __construct($uid, $suid = 0)
- {
- // write the session entry
- $this->uid = $uid;
- $this->session = $this->writeSession($uid, $suid);
-
- // retrieve available actions
- $res = XDB::iterRow("SELECT id, text FROM logger.actions");
-
- while (list($action_id, $action_text) = $res->next()) {
- $this->actions[$action_text] = $action_id;
- }
- }
-
- /** Creates a new session entry in database and return its ID.
- *
- * @param $uid the id of the logged user
- * @param $suid the id of the administrator who has just su'd to the user
- * @return session the session id
- */
- private function writeSession($uid, $suid = 0)
- {
- $ip = $_SERVER['REMOTE_ADDR'];
- $host = strtolower(gethostbyaddr($_SERVER['REMOTE_ADDR']));
- $browser = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
-
- @list($forward_ip,) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
- $forward_host = $forward_ip;
- if ($forward_host) {
- $forward_host = strtolower(gethostbyaddr($forward_host));
- }
- $proxy = '';
- if ($forward_ip || @$_SERVER['HTTP_VIA']) {
- $proxy = 'proxy';
- }
-
- XDB::execute("INSERT INTO logger.sessions
- SET uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
- $uid, $host, ip_to_uint($ip), ip_to_uint($forward_ip), $forward_host, $browser, $suid, $proxy);
- if ($forward_ip) {
- $this->proxy_ip = $ip;
- $this->proxy_host = $host;
- $this->ip = $forward_ip;
- $this->host = $forward_host;
- } else {
- $this->ip = $ip;
- $this->host = $host;
- }
-
- return XDB::insertId();
- }
-
-
- /** Logs an action and its related data.
- *
- * @param $action le type d'action
- * @param $data les données (id de liste, etc.)
- * @return VOID
- */
- public function log($action, $data = null)
- {
- if (isset($this->actions[$action])) {
- XDB::execute("INSERT INTO logger.events
- SET session={?}, action={?}, data={?}",
- $this->session, $this->actions[$action], $data);
- } else {
- trigger_error("CoreLogger: unknown action, $action", E_USER_WARNING);
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-define('CSV_INSERT', 'insert'); // INSERT IGNORE
-define('CSV_REPLACE', 'replace'); // REPLACE
-define('CSV_UPDATE', 'update'); // INSERT and UPDATE on error
-define('CSV_UPDATEONLY', 'updateonly'); // UPDATE
-
-class CSVImporter
-{
- private $table;
- private $key;
- private $do_sql;
-
- private $index;
- private $data = array();
-
- private $user_functions = array();
- private $field_desc = array();
- private $field_value = array();
-
- public function __construct($table, $key = 'id', $do_sql = true)
- {
- $this->table = $table;
- $this->key = explode(',', $key);
- $this->do_sql = $do_sql;
- }
-
- private function processLine(array $array)
- {
- if (is_null($this->index)) {
- $this->index = array_map('strtolower', $array);
- return true;
- }
-
- if (count($array) != count($this->index)) {
- return false;
- }
- $assoc = array();
- $i = 0;
- foreach ($this->index as $key) {
- $assoc[$key] = $array[$i];
- $i++;
- }
- $this->data[] = $assoc;
- return true;
- }
-
- private function getValue($line, $key, $action)
- {
- if (@array_key_exists($action, $line)) {
- $value = $line[$action];
- } elseif (is_callable($action, false)) {
- $value = call_user_func($action, $line, $key);
- } else {
- $value = $action;
- }
- if (is_null($value) || $value == 'NULL') {
- $value = 'NULL';
- }
- return $value;
- }
-
- private function makeAssoc($line, $relation)
- {
- $ops = array();
- foreach ($relation as $key=>$ref) {
- $ops[$key] = $this->getValue($line, $key, $ref);
- }
- return $ops;
- }
-
- private function makeRequestArgs($line, $relation)
- {
- $ops = array();
- foreach ($relation as $key=>$ref) {
- $value = $this->getValue($line, $key, $ref);
- if (!is_null($value) && $value != 'NULL') {
- $value = "'" . addslashes($value) . "'";
- }
- $ops[$key] = "$key = $value";
- }
- return $ops;
- }
-
- private function makeRelation()
- {
- $relation = array();
- foreach ($this->index as $title) {
- $relation[$title] = $title;
- }
- return $relation;
- }
-
- private function execute($query)
- {
- if (!$this->do_sql) {
- echo "$query;\n";
- return false;
- }
- return XDB::execute($query);
- }
-
- private function getFieldList()
- {
- $res = XDB::query("SHOW COLUMNS FROM {$this->table}");
- if ($res->numRows()) {
- return $res->fetchColumn();
- }
- return null;
- }
-
- public function setCSV($csv, $index = null, $separator = ';')
- {
- require_once dirname(__FILE__) . '/varstream.php';
- VarStream::init();
- global $csv_source;
- $this->index = null;
-
- $csv_source = $csv;
- $res = fopen('var://csv_source', 'r');
-
- while (!feof($res)) {
- $this->processLine(fgetcsv($res, 0, $separator));
- }
- }
-
- public function run($action = CSV_UPDATE, $insert_relation = null, $update_relation = null)
- {
- if (is_null($insert_relation)) {
- $insert_relation = $this->makeRelation();
- }
- if (is_null($update_relation)) {
- $update_relation = $insert_relation;
- }
- foreach ($this->data as $line) {
- $set = join(', ', $this->makeRequestArgs($line, $insert_relation));
- switch ($action) {
- case CSV_INSERT:
- $this->execute("INSERT IGNORE INTO {$this->table} SET $set");
- break;
- case CSV_REPLACE:
- $this->execute("REPLACE INTO {$this->table} SET $set");
- break;
- case CSV_UPDATE: case CSV_UPDATEONLY:
- if ($action == CSV_UPDATEONLY || !$this->execute("INSERT INTO {$this->table} SET $set")) {
- $ops = $this->makeRequestArgs($line, $update_relation);
- $set = join(', ', $ops);
- $where = array();
- foreach ($this->key as $key) {
- $where[] = $ops[$key];
- }
- $where = join(' AND ', $where);
- $this->execute("UPDATE {$this->table} SET $set WHERE $where");
- }
- break;
- }
- }
- }
-
- static public function dynamicCond($line, $key)
- {
- static $fields, $conds, $values, $thens, $elses;
-
- if (!isset($fields)) {
- $fields = $_SESSION['csv_cond_field'];
- $conds = $_SESSION['csv_cond'];
- $values = $_SESSION['csv_cond_value'];
- $thens = $_SESSION['csv_cond_then'];
- $elses = $_SESSION['csv_cond_else'];
- }
- $field = $line[$fields[$key]];
- $cond = $conds[$key];
- $value = $values[$key];
- if (is_numeric($field) && is_numeric($value)) {
- $field = floatval($field);
- $value = floatval($value);
- }
- switch ($cond) {
- case 'defined': $ok = (!empty($field)); break;
- case 'equals': $ok = ($field == $value); break;
- case 'contains': $ok = (strpos($field, $value) !== false); break;
- case 'contained': $ok = (strpos($value, $field) !== false); break;
- case 'greater': $ok = ($field > $value); break;
- case 'greater_or_equal': $ok ($field >= $value); break;
- case 'lower': $ok = ($field < $value); break;
- case 'lower_or_equal': $ok = ($field <= $value); break;
- default: $ok = false;
- }
- if ($ok) {
- return $thens[$key];
- } else {
- return $elses[$key];
- }
- }
-
- public function registerFunction($name, $desc, $callback)
- {
- if (is_callable($callback, false, $ref)) {
- $this->user_functions['func_' . $name] = array('desc' => $desc, 'callback' => $callback);
- return true;
- }
- return false;
- }
-
- public function describe($name, $desc)
- {
- $this->field_desc[$name] = $desc;
- }
-
- public function forceValue($name, $value)
- {
- $this->field_value[$name] = $value;
- }
-
- private function cleanSession($fields)
- {
- foreach ($fields as $field) {
- unset($_SESSION[$field]);
- }
- }
-
- /** Handle insertion form
- * @param $page PlatalPage to process
- * @param $url URI of the page
- * @param $field Editable fields
- */
- public function apply(&$page, $url, $fields = null)
- {
- $sesfields = array('csv_value', 'csv_user_value', 'csv_cond_field',
- 'csv_update', 'csv_action', 'csv_cond_field',
- 'csv_cond', 'csv_cond_value', 'csv_cond_then',
- 'csv_cond_else', 'csv', 'csv_separator', 'csv_url');
- if ($url != @$_SESSION['csv_url']) {
- $this->cleanSession($sesfields);
- $_SESSION['csv_url'] = $url;
- }
-
- if (is_null($fields) || empty($fields)) {
- $fields = $this->getFieldList();
- }
- if (is_null($fields)) {
- return false;
- }
- foreach ($this->field_value as $key=>$value) {
- $search = array_search($key, $fields);
- unset($fields[$search]);
- }
-
- $current = Env::v('csv_page');
- if (empty($current)) {
- $current = 'source';
- }
- $next = Env::v('csv_next_page');
- if (empty($next)) {
- $next = $current;
- }
- $csv = @$_SESSION['csv'];
- if ($current == 'source' && Env::has('csv_valid')) {
- $csv = Env::v('csv_source');
- $_SESSION['csv'] = $csv;
- $next = 'values';
- }
- if ($csv) {
- if (Env::has('csv_separator')) {
- $sep = Env::v('csv_separator');
- if (empty($sep)) {
- $sep = ';';
- }
- $_SESSION['csv_separator'] = $sep;
- }
- $this->setCSV($csv, null, $_SESSION['csv_separator']);
- }
- if ($current == 'values' && Env::has('csv_valid')) {
- $next = 'valid';
- }
- if (empty($csv)) {
- $next = 'source';
- }
- if (Env::has('csv_action')) {
- $_SESSION['csv_action'] = Env::v('csv_action');
- }
- if ($next == 'valid') {
- if ($current != 'valid') {
- $cpyfields = array('csv_value', 'csv_user_value', 'csv_cond_field',
- 'csv_update', 'csv_action', 'csv_cond_field',
- 'csv_cond', 'csv_cond_value', 'csv_cond_then',
- 'csv_cond_else');
- foreach ($cpyfields as $field) {
- $_SESSION[$field] = Env::v($field);
- }
- }
- $insert = $_SESSION['csv_value'];
- $values = $_SESSION['csv_user_value'];
- $update = $_SESSION['csv_update'];
- foreach ($insert as $key=>$value) {
- if (empty($value)) {
- $insert[$key] = null;
- } elseif ($value == 'user_value') {
- $insert[$key] = $values[$key];
- } elseif ($value == 'cond_value') {
- $insert[$key] = array($this, 'dynamicCond');
- } elseif (array_key_exists($value, $this->user_functions)) {
- $insert[$key] = $this->user_functions[$value]['callback'];
- }
- if (isset($update[$key])) {
- $update[$key] = $insert[$key];
- }
- }
- foreach ($this->field_value as $key=>$value) {
- $insert[$key] = $value;
- $fields[] = $key;
- }
- if ($current == 'valid' && Env::has('csv_valid')) {
- S::assert_xsrf_token();
- $this->run($_SESSION['csv_action'], $insert, $update);
- $page->assign('csv_done', true);
- $this->cleanSession($sesfields);
- } else {
- $preview = array();
- foreach ($this->data as $line) {
- $preview[] = $this->makeAssoc($line, $insert);
- }
- $page->assign('csv_preview', $preview);
- }
- }
- $page->assign('csv_index', $this->index);
- $page->assign('csv_functions', $this->user_functions);
- $page->assign('csv_field_desc', $this->field_desc);
- $page->assign('csv_page', $next);
- $page->assign('csv_path', $url);
- $page->assign('csv_fields', $fields);
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class Env
-{
- public static function _get($key, $default)
- {
- return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
- }
-
- public static function has($key)
- {
- return isset($_REQUEST[$key]);
- }
-
- public static function kill($key)
- {
- unset($_REQUEST[$key]);
- }
-
- public static function v($key, $default = null)
- {
- return Env::_get($key, $default);
- }
-
- public static function s($key, $default = '')
- {
- return (string)Env::_get($key, $default);
- }
-
- public static function b($key, $default = false)
- {
- return (bool)Env::_get($key, $default);
- }
-
- public static function i($key, $default = 0)
- {
- $i = Env::_get($key, $default);
- return is_numeric($i) ? intval($i) : $default;
- }
-
- public static function l(array $keys)
- {
- return array_map(array('Env', 'v'), $keys);
- }
-}
-
-class Post
-{
- public static function _get($key, $default)
- {
- return isset($_POST[$key]) ? $_POST[$key] : $default;
- }
-
- public static function has($key)
- {
- return isset($_POST[$key]);
- }
-
- public static function kill($key)
- {
- unset($_POST[$key]);
- }
-
- public static function v($key, $default = null)
- {
- return Post::_get($key, $default);
- }
-
- public static function b($key, $default = false)
- {
- return (bool)Post::_get($key, $default);
- }
-
- public static function s($key, $default = '')
- {
- return (string)Post::_get($key, $default);
- }
-
- public static function i($key, $default = 0)
- {
- $i = Post::_get($key, $default);
- return is_numeric($i) ? intval($i) : $default;
- }
-
- public static function l(array $keys)
- {
- return array_map(array('Post', 'v'), $keys);
- }
-}
-
-class Get
-{
- public static function _get($key, $default)
- {
- return isset($_GET[$key]) ? $_GET[$key] : $default;
- }
-
- public static function has($key)
- {
- return isset($_GET[$key]);
- }
-
- public static function kill($key)
- {
- unset($_GET[$key]);
- }
-
- public static function v($key, $default = null)
- {
- return Get::_get($key, $default);
- }
-
- public static function b($key, $default = false)
- {
- return (bool)Get::_get($key, $default);
- }
-
- public static function s($key, $default = '')
- {
- return (string)Get::_get($key, $default);
- }
-
- public static function i($key, $default = 0)
- {
- $i = Get::_get($key, $default);
- return is_numeric($i) ? intval($i) : $default;
- }
-
- public static function l(array $keys)
- {
- return array_map(array('Get', 'v'), $keys);
- }
-}
-
-class Cookie
-{
- public static function _get($key, $default)
- {
- return isset($_COOKIE[$key]) ? $_COOKIE[$key] : $default;
- }
-
- public static function has($key)
- {
- return isset($_COOKIE[$key]);
- }
-
- public static function kill($key)
- {
- unset($_COOKIE[$key]);
- }
-
- public static function v($key, $default = null)
- {
- return Cookie::_get($key, $default);
- }
-
- public static function s($key, $default = '')
- {
- return (string)Cookie::_get($key, $default);
- }
-
- public static function b($key, $default = false)
- {
- return (bool)Cookie::_get($key, $default);
- }
-
- public static function i($key, $default = 0)
- {
- $i = Cookie::_get($key, $default);
- return is_numeric($i) ? intval($i) : $default;
- }
-
- public static function l(array $keys)
- {
- return array_map(array('Cookie', 'v'), $keys);
- }
-}
-
-function fix_gpc_magic(&$item, $key) {
- if (is_array($item)) {
- array_walk($item, 'fix_gpc_magic');
- } else {
- $item = stripslashes($item);
- }
-}
-
-if (ini_get('magic_quotes_gpc') && empty($DONT_FIX_GPC)) {
- array_walk($_GET, 'fix_gpc_magic');
- array_walk($_POST, 'fix_gpc_magic');
- array_walk($_COOKIE, 'fix_gpc_magic');
- array_walk($_REQUEST, 'fix_gpc_magic');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /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
- */
-
-
-/** class for describing flags
- */
-class Flagset
-{
- /** string that holds the flagset */
- private $value;
-
- /** the boundary between flags */
- private $sep = ",";
-
-
- /** set flag
- * @param $flags services FROM coupures
- * @return VOID
- */
- public function __construct($flags = "")
- {
- $this->value = $flags;
- }
-
-
- /** add flag
- * @param $flag XXX
- * @return VOID
- */
- public function addFlag($flag)
- {
- if (!$flag) return;
- if (!$this->hasflag($flag)) {
- if ($this->value)
- $this->value .= $this->sep;
- $this->value .= $flag;
- }
- }
-
-
- /** test si flag ou pas
- * @param $flag XXX
- * @return 1 || 0
- */
- public function hasFlag($flag)
- {
- $tok = strtok($this->value,$this->sep);
- while ($tok) {
- if ($tok==$flag) return 1;
- $tok = strtok($this->sep);
- }
- return 0;
- }
-
- /** test flag combination
- */
- public function hasFlagCombination($flag)
- {
- $perms = explode(',', $flag);
- foreach ($perms as $perm)
- {
- $ok = true;
- $rights = explode(':', $perm);
- foreach ($rights as $right) {
- if (($right{0} == '!' && $this->hasFlag(substr($right, 1))) || !$this->hasFlag($right)) {
- $ok = false;
- }
- }
- if ($ok) {
- return true;
- }
- }
- return false;
- }
-
- /** remove flag
- * @param $flag XXX
- * @return VOID
- */
- public function rmFlag($flag)
- {
- if (!$flag) return;
- $newvalue = "";
- $tok = strtok($this->value,$this->sep);
- while ($tok) {
- if ($tok!=$flag) {
- if ($newvalue)
- $newvalue .= $this->sep;
- $newvalue .= $tok;
- }
- $tok = strtok($this->sep);
- }
- $this->value=$newvalue;
- }
-
- /** return the flagset
- */
- public function flags()
- {
- return $this->value;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-
-class MiniWiki
-{
-
- private static $patternsWiki = array();
- private static $replacementHTML = array();
- private static $replacementText = array();
-
- private static $title_index = -1;
- private static $info = array();
-
- public static function Markup($pattern, $replacement, $replacementTxt, $info = null)
- {
- $id = count(MiniWiki::$patternsWiki);
- MiniWiki::$patternsWiki[$id] = $pattern;
- MiniWiki::$replacementHTML[$id] = $replacement;
- MiniWiki::$replacementText[$id] = $replacementTxt;
- if ($info) {
- MiniWiki::$info[$id] = $info;
- }
- return $id;
- }
-
- public static function init()
- {
- if (isset(MiniWiki::$patternsWiki[0])) {
- return;
- }
- MiniWiki::Markup("/(\r\n|\r([^\n]))/", "\n$2", "\n$2");
-
- // retours à la ligne avec \\
- MiniWiki::Markup("/\\\\(?".">(\\\\*))\n/e", "str_repeat('<br />\n',mb_strlen('$1'))", "str_repeat('\n',mb_strlen('$1'))", "ligne1\\\\\nligne2");
-
- // * unordered list
- MiniWiki::Markup("/(^|\n)\*(([^\n]*(\n|$))(\*[^\n]*(\n|$))*)/se",
- "'</p><ul><li>'.str_replace(\"\\n*\",'</li><li>','$2').'</li></ul><p>'",
- "'$1 -' . str_replace(\"\\n*\", \"\\n -\", '$2')",
- "* element1\n* element2\n* element3");
- // # unordered list
- MiniWiki::Markup("/(^|\n)#(([^\n]*(\n|$))(#[^\n]*(\n|$))*)/se", "'<ol><li>'.str_replace(\"\\n#\",'</li><li>','$2').'</li></ol>'", "'$0'", "# element1\n# element2\n# element3");
-
- // bold, italic and others
- // ''' bold '''
- MiniWiki::Markup("/'''(.*?)'''/",'<strong>$1</strong>','*$1*', "'''gras'''");
- // '' italic ''
- MiniWiki::Markup("/''(.*?)''/",'<em>$1</em>','/$1/', "''italique''");
- // '+ big +'
- MiniWiki::Markup("/'\\+(.*?)\\+'/",'<big>$1</big>','*$1*', "'+grand+'");
- // '- small -'
- MiniWiki::Markup("/'\\-(.*?)\\-'/",'<small>$1</small>','$1', "'-petit-'");
- // '^superscript^'
- MiniWiki::Markup("/'\\^(.*?)\\^'/",'<sup>$1</sup>','$1', "'^exposant^'");
- // '_subscript_'
- MiniWiki::Markup("/'_(.*?)_'/",'<sub>$1</sub>','$1', "'_indice_'");
- // {+ underline +}
- MiniWiki::Markup("/\\{\\+(.*?)\\+\\}/",'<ins>$1</ins>','_$1_', "{+insertion+}");
- // {- strikeout -}
- MiniWiki::Markup("/\\{-(.*?)-\\}/",'<del>$1</del>','-$1-', "{-suppression-}");
- // {color| colored text |}
- MiniWiki::Markup("/%([a-z]+|\#[0-9a-f]{3,6})%(.*?)%%/i", "<span style='color: $1;'>$2</span>", "$2",
- "%red% texte en rouge %%\\\\\n%#ff0% texte en jaune %%\\\\\n%#0000ff% texte en bleu %%");
- // [+ big +] [++ bigger ++] [+++ even bigger +++] ...
- MiniWiki::Markup("/\\[(([-+])+)(.*?)\\1\\]/e","'<span style=\'font-size:'.(round(pow(6/5,$2mb_strlen('$1'))*100,0)).'%\'>$3</span>'", "'$3'", "[+ grand +]\n\n[++ plus grand ++]\n\n[+++ encore plus grand +++]");
-
- // ----- <hr/>
- MiniWiki::Markup("/(\n|^)--(--+| \n)/s", '$1<hr/>', '$1-- '."\n", "----\n");
- // titles
- MiniWiki::$title_index = MiniWiki::Markup('/(\n|^)(!+)([^\n]*)/se',
- "'$1<h'.mb_strlen('$2').'>$3</h'.mb_strlen('$2').'>'",
- "'$1$3'", "!titre1\n\n!!titre2\n\n!!!titre3");
-
- // links
- MiniWiki::Markup('/((?:https?|ftp):\/\/(?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/ui',
- '<a href="\\0">\\0</a>', '<\\0>');
- MiniWiki::Markup('/(\s|^|\[\[)www\.((?:[\.\,\;\!\:]*[\w@~%$£µ&i#\-+=_\/\?])*)/iu',
- '\\1<a href="http://www.\\2">www.\\2</a>', '\\1<http://www.\\2>');
- MiniWiki::Markup('/(?:mailto:)?([a-z0-9.\-+_]+@([\-.+_]?[a-z0-9])+)/i', '<a href="mailto:\\0">\\0</a>', '<\\0>');
- MiniWiki::Markup('/\[\[\s*<(?:a href=")?([^">]*?)(?:">.*?<\/a)?>\s*\|([^\]]+)\]\]/i',
- '<a href="\\1">\\2</a>', '\\2 <\\1>',
- "[[http://www.example.com|Mon site web]]\n\nhttp://www.example.com\n\ntest@example.com");
-
- // paragraphs and empty lines
- MiniWiki::Markup("/\n\n/", '</p><p>', "\n\n", "paragraphe1\n\nparagraphe2");
- MiniWiki::Markup("/\n/", ' ', "\n");
- MiniWiki::Markup("/^.*<\/p>.*<p>.*$/s", "<p>$0</p>", "$0");
-
- // french typo rules, unbreakable spaces
- MiniWiki::Markup("/ +([!?:;])/", " $1", "$0");
- }
-
- public static function WikiToHTML($wiki, $title = false)
- {
- if (!$title) {
- $oldrule12 = MiniWiki::$replacementHTML[MiniWiki::$title_index];
- MiniWiki::$replacementHTML[MiniWiki::$title_index] = "'$0'";
- }
- $html = preg_replace(MiniWiki::$patternsWiki,
- MiniWiki::$replacementHTML,
- htmlentities(trim($wiki), ENT_COMPAT, 'UTF-8'));
- if (!$title) {
- MiniWiki::$replacementHTML[MiniWiki::$title_index] = $oldrule12;
- }
- return $html;
- }
-
- private static function justify($text, $n)
- {
- $arr = explode("\n", wordwrap($text, $n));
- $arr = array_map('trim', $arr);
- $res = '';
- foreach ($arr as $key => $line) {
- $nxl = isset($arr[$key+1]) ? trim($arr[$key+1]) : '';
- $nxl_split = preg_split('! +!u', $nxl);
- $nxw_len = count($nxl_split) ? mb_strlen($nxl_split[0]) : 0;
- $line = trim($line);
-
- if (mb_strlen($line)+1+$nxw_len < $n) {
- $res .= "$line\n";
- continue;
- }
-
- if (preg_match('![.:;]$!u',$line)) {
- $res .= "$line\n";
- continue;
- }
-
- $tmp = preg_split('! +!u', trim($line));
- $words = count($tmp);
- if ($words <= 1) {
- $res .= "$line\n";
- continue;
- }
-
- $len = array_sum(array_map('mb_strlen', $tmp));
- $empty = $n - $len;
- $sw = floatval($empty) / floatval($words-1);
-
- $cur = 0;
- $l = '';
- foreach ($tmp as $word) {
- $l .= $word;
- $cur += $sw + strlen($word); // Use strlen here instead of mb_strlen because it is used by str_pad
- // which is not multibyte compatible
- $l = str_pad($l, intval($cur + 0.5));
- }
- $res .= trim($l)."\n";
- }
- return trim($res);
- }
-
-
- public static function WikiToText($wiki, $just=false, $indent=0, $width=68, $title=false)
- {
- if (!$title) {
- $oldrule12 = MiniWiki::$replacementHTML[MiniWiki::$title_index];
- MiniWiki::$replacementHTML[MiniWiki::$title_index] = "'$0'";
- }
- //$text = trim($wiki);
- //foreach (MiniWiki::$patternsWiki as $key=>$pattern) {
- // echo $key . " - " . $pattern . "\n";
- // $text = preg_replace($pattern, MiniWiki::$replacementText[$key], $text);
- //}
- $text = preg_replace(MiniWiki::$patternsWiki, MiniWiki::$replacementText, trim($wiki));
- if (!$title) {
- MiniWiki::$replacementHTML[MiniWiki::$title_index] = $oldrule12;
- }
- $text = $just ? MiniWiki::justify($text, $width - $indent) : wordwrap($text, $width - $indent);
- if($indent) {
- $ind = str_pad('',$indent);
- $text = $ind.str_replace("\n","\n$ind",$text);
- }
- return $text;
- }
-
- static public function help($with_title = false)
- {
- if (!$with_title) {
- $info12 = MiniWiki::$info[MiniWiki::$title_index];
- unset(MiniWiki::$info[MiniWiki::$title_index]);
- }
-
- $res = array();
- foreach (MiniWiki::$info as $value) {
- $res[$value] = MiniWiki::wikiToHtml($value, true);
- }
-
- if (!$with_title) {
- MiniWiki::$info[MiniWiki::$title_index] = $info12;
- }
- return $res;
- }
-}
-
-MiniWiki::init();
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-define('PL_DO_AUTH', 300);
-define('PL_FORBIDDEN', 403);
-define('PL_NOT_FOUND', 404);
-
-class Platal
-{
- private $__mods;
- private $__hooks;
-
- protected $https;
-
- public $ns;
- public $path;
- public $argv;
-
- public function __construct()
- {
- $modules = func_get_args();
- if (is_array($modules[0])) {
- $modules = $modules[0];
- }
- $this->path = trim(Get::_get('n', null), '/');
-
- $this->__mods = array();
- $this->__hooks = array();
-
- array_unshift($modules, 'core');
- foreach ($modules as $module) {
- $module = strtolower($module);
- $this->__mods[$module] = $m = PLModule::factory($module);
- $this->__hooks += $m->handlers();
- }
-
- global $globals;
- if ($globals->mode == '') {
- pl_redirect('index.html');
- }
- }
-
- public function pl_self($n = null)
- {
- if (is_null($n))
- return $this->path;
-
- if ($n >= 0)
- return join('/', array_slice($this->argv, 0, $n + 1));
-
- if ($n <= -count($this->argv))
- return $this->argv[0];
-
- return join('/', array_slice($this->argv, 0, $n));
- }
-
- protected function find_hook()
- {
- $p = $this->path;
-
- while ($p) {
- if (array_key_exists($p, $this->__hooks))
- break;
-
- $p = substr($p, 0, strrpos($p, '/'));
- }
-
- if (empty($this->__hooks[$p])) {
- return null;
- }
-
- $hook = $this->__hooks[$p];
-
- if (!is_callable($hook['hook'])) {
- return null;
- }
-
- $this->https = ($hook['type'] & NO_HTTPS) ? false : true;
- $this->argv = explode('/', substr($this->path, strlen($p)));
- $this->argv[0] = $p;
-
- return $hook;
- }
-
- protected function find_nearest_key($key, array &$array)
- {
- $keys = array_keys($array);
- if (in_array($key, $keys)) {
- return $key;
- }
-
- if (($pos = strpos($key, '.php')) !== false) {
- $key = substr($key, 0, $pos);
- }
-
- $has_end = in_array("#final#", $keys);
- if (strlen($key) > 24 && $has_end) {
- return "#final#";
- }
-
- foreach ($keys as $k) {
- if ($k == "#final#") {
- continue;
- }
- $lev = levenshtein($key, $k);
-
- if ((!isset($val) || $lev < $val)
- && ($lev <= strlen($k)/2 || strpos($k, $key) !== false || strpos($key, $k) !== false)) {
- $val = $lev;
- $best = $k;
- }
- }
- if (!isset($best) && $has_end) {
- return "#final#";
- } else if (isset($best)) {
- return $best;
- }
- return null;
- }
-
- public function near_hook()
- {
- $hooks = array();
- $leafs = array();
- foreach ($this->__hooks as $hook=>$handler) {
- if (!$this->check_perms($handler['perms'])) {
- continue;
- }
- $parts = split('/', $hook);
- $place =& $hooks;
- foreach ($parts as $part) {
- if (!isset($place[$part])) {
- $place[$part] = array();
- }
- $place =& $place[$part];
- }
- $leaf = $parts[count($parts)-1];
- if (!isset($leafs[$leaf])) {
- $leafs[$leaf] = $hook;
- } else if (is_array($leafs[$leaf])) {
- $leafs[$leaf][] = $hook;
- } else {
- $leafs[$leaf] = array($hook, $leafs[$leaf]);
- }
- $place["#final#"] = array();
- }
-
- // search for the nearest full path
- $p = split('/', $this->path);
- $place =& $hooks;
- $link = '';
- foreach ($p as $k) {
- if (!isset($ended)) {
- $key = $this->find_nearest_key($k, $place);
- } else {
- $key = $k;
- }
- if ($key == "#final#") {
- if (!array_key_exists($link, $this->__hooks)) {
- $link = '';
- break;
- }
- $key = $k;
- $ended = true;
- }
- if (!is_null($key)) {
- if (!empty($link)) {
- $link .= '/';
- }
- $link .= $key;
- $place =& $place[$key];
- } else {
- $link = '';
- break;
- }
- }
- if ($link == $this->path) {
- $link = '';
- }
- if ($link && levenshtein($link, $this->path) < strlen($link)/3) {
- return $link;
- }
-
- // search for missing namespace (the given name is a leaf)
- $leaf = array_shift($p);
- $args = count($p) ? '/' . implode('/', $p) : '';
- if (isset($leafs[$leaf]) && !is_array($leafs[$leaf]) && $leafs[$leaf] != $this->path) {
- return $leafs[$leaf] . $args;
- }
- unset($val);
- $best = null;
- foreach ($leafs as $k=>&$path) {
- if (is_array($path)) {
- continue;
- }
- $lev = levenshtein($leaf, $k);
-
- if ((!isset($val) || $lev < $val)
- && ($lev <= strlen($k)/2 || strpos($k, $leaf) !== false || strpos($leaf, $k) !== false)) {
- $val = $lev;
- $best = $path;
- }
- }
- return $best == null ? ( $link ? $link : null ) : $best . $args;
- }
-
- protected function check_perms($perms)
- {
- if (!$perms) { // No perms, no check
- return true;
- }
- $s_perms = S::v('perms');
- return $s_perms->hasFlagCombination($perms);
- }
-
- private function call_hook(PlatalPage &$page)
- {
- $hook = $this->find_hook();
- if (empty($hook)) {
- return PL_NOT_FOUND;
- }
- global $globals;
- if ($this->https && !$_SERVER['HTTPS'] && $globals->core->secure_domain) {
- http_redirect('https://' . $globals->core->secure_domain . $_SERVER['REQUEST_URI']);
- }
-
- $args = $this->argv;
- $args[0] =& $page;
-
- if ($hook['auth'] > S::v('auth', AUTH_PUBLIC)) {
- if ($hook['type'] & DO_AUTH) {
- if (!call_user_func(array($globals->session, 'doAuth'))) {
- $this->force_login($page);
- }
- } else {
- return PL_FORBIDDEN;
- }
- }
- if ($hook['auth'] != AUTH_PUBLIC && !$this->check_perms($hook['perms'])) {
- return PL_FORBIDDEN;
- }
-
- $val = call_user_func_array($hook['hook'], $args);
- if ($val == PL_DO_AUTH) {
- // The handler need a better auth with the current args
- if (!call_user_func(array($globals->session, 'doAuth'))) {
- $this->force_login($page);
- }
- $val = call_user_func_array($hook['hook'], $args);
- }
- return $val;
- }
-
- public function force_login(PlatalPage &$page)
- {
- header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
- if (S::logged()) {
- $page->changeTpl('core/password_prompt_logged.tpl');
- $page->addJsLink('do_challenge_response_logged.js');
- } else {
- $page->changeTpl('core/password_prompt.tpl');
- $page->addJsLink('do_challenge_response.js');
- }
- $page->assign('platal', $this);
- $page->run();
- }
-
- public function run()
- {
- global $page;
-
- new_skinned_page('platal/index.tpl');
-
- if (empty($this->path)) {
- $this->path = 'index';
- }
-
- $page->assign('platal', $this);
- switch ($this->call_hook($page)) {
- case PL_FORBIDDEN:
- $this->__mods['core']->handler_403($page);
- break;
-
- case PL_NOT_FOUND:
- $this->__mods['core']->handler_404($page);
- break;
- }
-
- $page->assign('platal', $this);
- $page->run();
- }
-
- public function on_subscribe($forlife, $uid, $promo, $pass)
- {
- $args = func_get_args();
- foreach ($this->__mods as $mod) {
- if (!is_callable($mod, 'on_subscribe'))
- continue;
- call_user_func_array(array($mod, 'on_subscribe'), $args);
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 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 *
+ ***************************************************************************/
+
+class PlatalGlobals extends PlGlobals
+{
+ /** The x.org version */
+ public $version = '@VERSION@';
+
+ /** db params */
+ public $dbdb = 'x4dat';
+ public $dbhost = 'localhost';
+ public $dbuser = 'x4dat';
+ public $dbpwd = 'x4dat';
+ public $dbcharset = 'utf8';
+
+ /** default skin */
+ public $skin;
+ public $register_skin;
+
+ public function __construct()
+ {
+ parent::__construct(array('platal.ini', 'platal.conf'));
+ $this->bootstrap(array('NbIns'), array($this, 'updateNbIns'));
+ $this->bootstrap(array('NbValid'), array($this, 'updateNbValid'));
+ }
+
+ public function asso($key=null)
+ {
+ static $aid = null;
+
+ if (is_null($aid)) {
+ $gp = Get::v('n');
+ if ($p = strpos($gp, '/')) {
+ $gp = substr($gp, 0, $p);
+ }
+
+ if ($gp) {
+ $res = XDB::query('SELECT a.*, d.nom AS domnom,
+ FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc,
+ FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub
+ FROM groupex.asso AS a
+ LEFT JOIN groupex.dom AS d ON d.id = a.dom
+ WHERE diminutif = {?}', $gp);
+ if (!($aid = $res->fetchOneAssoc())) {
+ $aid = array();
+ }
+ } else {
+ $aid = array();
+ }
+ }
+ if (empty($key)) {
+ return $aid;
+ } elseif ( isset($aid[$key]) ) {
+ return $aid[$key];
+ } else {
+ return null;
+ }
+ }
+
+
+ public function updateNbIns()
+ {
+ $res = XDB::query("SELECT COUNT(*)
+ FROM auth_user_md5
+ WHERE perms IN ('admin','user') AND deces=0");
+ $cnt = $res->fetchOneCell();
+ $this->changeDynamicConfig(array('NbIns' => $cnt));
+ }
+
+ public function updateNbValid()
+ {
+ $res = XDB::query("SELECT COUNT(*)
+ FROM requests");
+ $this->changeDynamicConfig(array('NbValid' => $res->fetchOneCell()));
+ }
+}
+
+
+/******************************************************************************
+ * Dynamic configuration update/edition stuff
+ *****************************************************************************/
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'smarty/libs/Smarty.class.php';
-
-abstract class PlatalPage extends Smarty
-{
- private $_page_type;
- private $_tpl;
- private $_errors;
- private $_failure;
- private $_jsonVars;
-
- // {{{ function PlatalPage()
-
- public function __construct($tpl, $type = SKINNED)
- {
- parent::Smarty();
-
- global $globals;
-
- $this->caching = false;
- $this->config_overwrite = false;
- $this->use_sub_dirs = false;
- $this->template_dir = $globals->spoolroot."/templates/";
- $this->compile_dir = $globals->spoolroot."/spool/templates_c/";
- array_unshift($this->plugins_dir, $globals->spoolroot."/plugins/");
- $this->config_dir = $globals->spoolroot."/configs/";
-
- $this->compile_check = !empty($globals->debug);
-
- $this->changeTpl($tpl, $type);
- $this->_errors = array('errors' => array());
- $this->_jsonVars = array();
- $this->_failure = false;
-
- if ($globals->mode != 'rw') {
- $this->trigError("En raison d'une maintenance, une partie des fonctionnalités du site sont"
- . " actuellement désactivée, en particuliers aucune donnée ne sera sauvegardée");
- }
- $this->register_prefilter('at_to_globals');
- $this->addJsLink('xorg.js');
- $this->addJsLink('jquery.js');
- }
-
- // }}}
- // {{{ function changeTpl()
-
- public function changeTpl($tpl, $type = SKINNED)
- {
- $this->_tpl = $tpl;
- $this->_page_type = $type;
- $this->assign('xorg_tpl', $tpl);
- }
-
- // }}}
- // {{{ function raw()
-
- public function raw()
- {
- global $globals;
- $this->assign('globals', $globals);
- return $this->fetch($this->_tpl);
- }
-
- // }}}
- // {{{ function _run()
-
- protected function _run($skin)
- {
- global $globals, $TIME_BEGIN;
-
- session_write_close();
-
- $this->register_prefilter('trimwhitespace');
- $this->register_prefilter('form_force_encodings');
- $this->register_prefilter('wiki_include');
- $this->register_prefilter('if_has_perms');
- $this->assign('xorg_triggers', $this->_errors);
- $this->assign('xorg_errors', $this->nb_errs());
- $this->assign('xorg_failure', $this->_failure);
- $this->assign('globals', $globals);
-
- if (Env::has('json') && count($this->_jsonVars)) {
- return $this->jsonDisplay();
- }
-
- if (Env::v('display') == 'light') {
- $this->_page_type = SIMPLE;
- } elseif (Env::v('display') == 'raw') {
- $this->_page_type = NO_SKIN;
- } elseif (Env::v('display') == 'full') {
- $this->_page_typ = SKINNED;
- }
-
- switch ($this->_page_type) {
- case NO_SKIN:
- if (!($globals->debug & DEBUG_SMARTY)) {
- error_reporting(0);
- }
- $this->display($this->_tpl);
- exit;
-
- case SIMPLE:
- $this->assign('simple', true);
-
- case SKINNED:
- $this->register_modifier('escape_html', 'escape_html');
- $this->default_modifiers = Array('@escape_html');
- }
- if (S::i('auth') <= AUTH_PUBLIC) {
- $this->register_outputfilter('hide_emails');
- }
- $this->addJsLink('wiki.js');
- header("Accept-Charset: utf-8");
- if (Env::v('forceXml')) {
- header("Content-Type: text/xml; charset=utf-8");
- }
-
- if (!$globals->debug) {
- error_reporting(0);
- $this->display($skin);
- exit;
- }
-
- $this->assign('validate', true);
- if (!($globals->debug & DEBUG_SMARTY)) {
- error_reporting(0);
- }
- $START_SMARTY = microtime(true);
- $result = $this->fetch($skin);
- $ttime = sprintf('Temps total: %.02fs (Smarty %.02fs) - Mémoire totale : %dKo<br />',
- microtime(true) - $TIME_BEGIN, microtime(true) - $START_SMARTY,
- memory_get_peak_usage(true) / 1024);
- if ($globals->debug & DEBUG_BT) {
- PlBacktrace::clean();
- $this->assign_by_ref('backtraces', PlBacktrace::$bt);
- $result = str_replace('@@BACKTRACE@@', $this->fetch('skin/common.backtrace.tpl'), $result);
- } else {
- $result = str_replace('@@BACKTRACE@@', '', $result);
- }
-
- $replc = "<span class='erreur'>VALIDATION HTML INACTIVE</span><br />";
- if ($globals->debug & DEBUG_VALID) {
- $fd = fopen($this->compile_dir."/valid.html","w");
- fwrite($fd, $result);
- fclose($fd);
-
- exec($globals->spoolroot."/bin/devel/xhtml.validate.pl ".$this->compile_dir."/valid.html", $val);
- foreach ($val as $h) {
- if (preg_match("/^X-W3C-Validator-Errors: (\d+)$/", $h, $m)) {
- $replc = '<span style="color: #080;">HTML OK</span><br />';
- if ($m[1]) {
- $replc = "<span class='erreur'><a href='http://validator.w3.org/check?uri={$globals->baseurl}"
- ."/valid.html&ss=1#result'>{$m[1]} ERREUR(S) !!!</a></span><br />";
- }
- break;
- }
- }
- }
-
- echo str_replace("@HOOK@", $ttime.$replc, $result);
- exit;
- }
-
- abstract public function run();
-
- // }}}
- // {{{ function nb_errs()
-
- public function nb_errs()
- {
- return count($this->_errors['errors']);
- }
-
- // }}}
- // {{{ function trig()
-
- private function trig($msg, $type = 'errors')
- {
- if (!isset($this->_errors[$type])) {
- $this->_errors[$type] = array();
- }
- $this->_errors[$type][] = $msg;
- }
-
- public function trigError($msg)
- {
- $this->trig($msg, 'errors');
- }
-
- public function trigWarning($msg)
- {
- $this->trig($msg, 'warnings');
- }
-
- public function trigSuccess($msg)
- {
- $this->trig($msg, 'success');
- }
-
- // }}}
- // {{{ function kill()
-
- public function kill($msg)
- {
- global $platal;
-
- $this->assign('platal', $platal);
- $this->trigError($msg);
- $this->_failure = true;
- $this->run();
- }
-
- // }}}
- // {{{ function addJsLink
-
- public function addJsLink($path)
- {
- $this->append('xorg_js', $path);
- }
-
- // }}}
- // {{{ function addCssLink
-
- public function addCssLink($path)
- {
- $this->append('xorg_css', $path);
- }
-
- // }}}
- // {{{ function addCssInline
-
- public function addCssInline($css)
- {
- if (!empty($css)) {
- $this->append('xorg_inline_css', $css);
- }
- }
-
- // }}}
- // {{{ function setRssLink
-
- public function setRssLink($title, $path)
- {
- $this->assign('xorg_rss', array('title' => $title, 'href' => $path));
- }
-
- // }}}
- // {{{ function jsonDisplay
- protected function jsonDisplay()
- {
- header("Content-type: text/javascript; charset=utf-8");
- array_walk_recursive($this->_jsonVars, "escape_xorgDB");
- $jsonbegin = Env::v('jsonBegin');
- $jsonend = Env::v('jsonEnd');
- if (Env::has('jsonVar')) {
- $jsonbegin = Env::v('jsonVar').' = ';
- $jsonend = ';';
- } elseif (Env::has('jsonFunc')) {
- $jsonbegin = Env::v('jsonFunc').'(';
- $jsonend = ');';
- }
- echo $jsonbegin, json_encode($this->_jsonVars), $jsonend;
- exit;
- }
- // }}}
- // {{{ function jsonAssign
- public function jsonAssign($var, $value)
- {
- $this->_jsonVars[$var] = $value;
- }
-
- // }}}
-}
-
-function escape_xorgDB(&$item, $key)
-{
- if (is_a($item, 'XOrgDBIterator')) {
- $expanded = array();
- while ($a = $item->next()) {
- $expanded[] = $a;
- }
- $item = $expanded;
- }
-}
-
-// {{{ function escape_html ()
-
-/**
- * default smarty plugin, used to auto-escape dangerous html.
- *
- * < --> <
- * > --> >
- * " --> "
- * & not followed by some entity --> &
- */
-function escape_html($string)
-{
- if (is_string($string)) {
- return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
- } else {
- return $string;
- }
-}
-
-// }}}
-// {{{ function at_to_globals()
-
-/**
- * helper
- */
-
-function _to_globals($s) {
- global $globals;
- $t = explode('.',$s);
- if (count($t) == 1) {
- return var_export($globals->$t[0],true);
- } else {
- return var_export($globals->$t[0]->$t[1],true);
- }
-}
-
-/**
- * compilation plugin used to import $globals confing through #globals.foo.bar# directives
- */
-
-function at_to_globals($tpl_source, &$smarty)
-{
- return preg_replace('/#globals\.([a-zA-Z0-9_.]+?)#/e', '_to_globals(\'\\1\')', $tpl_source);
-}
-
-// }}}
-// {{{ function trimwhitespace
-
-function trimwhitespace($source, &$smarty)
-{
- $tags = '(script|pre|textarea)';
- preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
- $source = preg_replace("!<$tags.*?>.*?</(\\1)>!ius", "&&&tags&&&", $source);
-
- // remove all leading spaces, tabs and carriage returns NOT
- // preceeded by a php close tag.
- $source = preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source);
- $source = preg_replace("!&&&tags&&&!e", 'array_shift($tagsmatches[0])', $source);
-
- return $source;
-}
-
-// }}}
-// {{{ function wiki_include
-
-function wiki_include($source, &$smarty)
-{
- return preg_replace('/\{include( [^}]*)? wiki=([^} ]+)(.*?)\}/ui',
- '{include\1 file="../spool/wiki.d/cache_\2.tpl"\3 included=1}',
- $source);
-}
-
-// }}}
-//{{{ function hasPerm
-
-function if_has_perms($source, &$smarty)
-{
- $source = preg_replace('/\{if([^}]*) (\!?)hasPerms\(([^)]+)\)([^}]*)\}/',
- '{if\1 \2$smarty.session.perms->hasFlagCombination(\3)\4}',
- $source);
- return preg_replace('/\{if([^}]*) (\!?)hasPerm\(([^)]+)\)([^}]*)\}/',
- '{if\1 \2($smarty.session.perms && $smarty.session.perms->hasFlag(\3))\4}',
- $source);
-}
-
-// }}}
-// {{{
-
-function form_force_encodings($source, &$smarty)
-{
- return preg_replace('/<form[^\w]/',
- '\0 accept-charset="utf-8" ',
- $source);
-}
-
-// }}}
-// {{{ function hide_emails
-
-function _hide_email($source)
-{
- $source = str_replace("\n", '', $source);
- return '<script type="text/javascript">//<![CDATA[' . "\n" .
- 'Nix.decode("' . addslashes(str_rot13($source)) . '");' . "\n" .
- '//]]></script>';
-}
-
-function hide_emails($source, &$smarty)
-{
- if (!strpos($source, '@')) {
- return $source;
- }
-
- //prevent email replacement in <script> and <textarea>
- $tags = '(script|textarea|select)';
- preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
- $source = preg_replace("!<$tags.*?>.*?</(\\1)>!ius", "&&&tags&&&", $source);
-
- //catch all emails in <a href="mailto:...">
- preg_match_all("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'].*?>.*?</a>!ius", $source, $ahref);
- $source = preg_replace("!<a[^>]+href=[\"'][^\"']*[-a-z0-9+_.]+@[-a-z0-9_.]+[^\"']*[\"'].*?>.*?</a>!ius", '&&&ahref&&&', $source);
-
- //prevant replacement in tag attributes
- preg_match_all("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+.+?>!ius", $source, $misc);
- $source = preg_replace("!<[^>]+[-a-z0-9_+.]+@[-a-z0-9_.]+.+?>!ius", '&&&misc&&&', $source);
-
- //catch !
- $source = preg_replace('!([-a-z0-9_+.]+@[-a-z0-9_.]+)!iue', '_hide_email("\1")', $source);
- $source = preg_replace('!&&&ahref&&&!e', '_hide_email(array_shift($ahref[0]))', $source);
-
- // restore data
- $source = preg_replace('!&&&misc&&&!e', 'array_shift($misc[0])', $source);
- $source = preg_replace("!&&&tags&&&!e", 'array_shift($tagsmatches[0])', $source);
-
- return $source;
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-/** Ligth debugging tool to generate execution backtrace
- */
-class PlBacktrace
-{
- static public $bt = array();
-
- public $traces = array();
- public $totaltime = 0.0;
- public $error = false;
-
- function __construct($name, array $init = array(), $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
- {
- PlBacktrace::$bt[$name] = $this;
- foreach ($init as &$entry) {
- $this->add($entry, $sizef, $timef, $errorf);
- }
- }
-
- private function fixCharset($action)
- {
- if (!is_string($action)) {
- return $action;
- } else {
- return is_utf8($action) ? $action : utf8_encode($action);
- }
- }
-
- private function add(array &$entry, $sizef = 'rows', $timef = 'exectime', $errorf = 'error')
- {
- $trace = array();
- $trace['action'] = $this->fixCharset($entry['action']);
- unset($entry['action']);
- $trace['exectime'] = @$entry[$timef];
- $this->totaltime += $trace['exectime'];
- unset($entry[$timef]);
- $trace['rows'] = @$entry[$sizef];
- unset($entry[$sizef]);
- $trace['error'] = $this->fixCharset(@$entry[$errorf]);
- unset($entry[$errorf]);
- if ($trace['error']) {
- $this->error = true;
- }
- $trace['data'] = array($this->fixCharset($entry));
- $this->traces[] =& $trace;
- }
-
- public function newEvent($action, $rows = 0, $error = null, array $userdata = array())
- {
- $trace = array('action' => $this->fixCharset($action), 'time' => 0);
- $this->traces[] =& $trace;
- $this->update($rows, $error, $userdata);
- }
-
- public function start($action)
- {
- $this->traces[] = array('action' => $this->fixCharset($action), 'starttime' => microtime(true));;
- }
-
- public function stop($rows = 0, $error = null, array $userdata = array())
- {
- $time = microtime(true);
- if (!$this->traces) {
- return;
- }
- $trace =& $this->traces[count($this->traces) - 1];
- $trace['exectime'] = $time - $trace['starttime'];
- unset($trace['starttime']);
- $this->totaltime += $trace['exectime'];
- $this->update($rows, $error, $userdata);
- }
-
- public function update($rows = 0, $error = null, array $userdata = array())
- {
- $trace =& $this->traces[count($this->traces) - 1];
- $trace['rows'] = $rows;
- $trace['error'] = $this->fixCharset($error);
- array_walk_recursive($userdata, array($this, 'fixCharset'));
- $trace['data'] = $userdata;
- if ($trace['error']) {
- $this->error = true;
- }
- }
-
- public static function clean()
- {
- foreach (PlBacktrace::$bt as $name=>&$entry) {
- if (!$entry->traces) {
- unset(PlBacktrace::$bt[$name]);
- }
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-interface PlIterator
-{
- public function next();
- public function total();
- public function first();
- public function last();
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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('smarty/libs/Smarty.class.php');
-
-/** Classe de mail avec corps en templates.
- */
-class PlMail extends Smarty
-{
- private $tpl;
- private $mailer = null;
-
- function __construct($tpl)
- {
- global $globals;
- $this->tpl = $tpl;
- $this->caching = false;
- $this->compile_check = true;
-
- $this->template_dir = $globals->spoolroot . "/templates/";
- $this->compile_dir = $globals->spoolroot . "/spool/mails_c/";
- $this->config_dir = $globals->spoolroot . "/configs/";
- array_unshift($this->plugins_dir, $globals->spoolroot."/plugins/");
-
- $this->register_outputfilter(Array($this, 'mail_format'));
- $this->register_function('from', Array($this, 'setFrom'));
- $this->register_function('to', Array($this, 'addTo'));
- $this->register_function('cc', Array($this, 'addCc'));
- $this->register_function('bcc', Array($this, 'addBcc'));
- $this->register_function('subject', Array($this, 'setSubject'));
- $this->register_function('add_header', Array($this, 'addHeader'));
- $this->assign_by_ref('globals', $globals);
- }
-
- public static function &get(&$mailer, $tpl)
- {
- static $plmail;
- if (!isset($plmail) || $plmail->tpl != $tpl) {
- $plmail = new PlMail($tpl);
- }
- $plmail->mailer =& $mailer;
- return $plmail;
- }
-
- public function run($version)
- {
- $this->assign('mail_part', $version);
- $text = $this->fetch($this->tpl);
- if ($version == 'text') {
- return wordwrap($text, 78);
- }
- return $text;
- }
-
- /** used to remove the empty lines due to {from ...}, {to ...} ... functions */
- static public function mail_format($output, &$smarty)
- {
- return "\n".trim($output)."\n";
- }
-
- static protected function format_addr(&$params)
- {
- if (isset($params['full'])) {
- return $params['full'];
- } elseif (empty($params['text'])) {
- return $params['addr'];
- } else {
- return $params['text'].' <'.$params['addr'].'>';
- }
- }
-
- /** template function : from.
- * {from full=...} for an already formatted address
- * {from addr=... [text=...]} else
- */
- public function setFrom($params, &$smarty)
- {
- $smarty->mailer->setFrom(PlMail::format_addr($params));
- }
-
- /** template function : to.
- * {to full=...} for an already formatted address
- * {to addr=... [text=...]} else
- */
- public function addTo($params, &$smarty)
- {
- $smarty->mailer->addTo(PlMail::format_addr($params));
- }
-
- /** template function : cc.
- * {cc full=...} for an already formatted address
- * {cc addr=... [text=...]} else
- */
- public function addCc($params, &$smarty)
- {
- $smarty->mailer->addCc(PlMail::format_addr($params));
- }
-
- /** template function : bcc.
- * {bcc full=...} for an already formatted address
- * {bcc addr=... [text=...]} else
- */
- public function addBcc($params, &$smarty)
- {
- $smarty->mailer->addBcc(PlMail::format_addr($params));
- }
-
- /** template function : subject.
- * {subject text=...}
- */
- public function setSubject($params, &$smarty)
- {
- $smarty->mailer->setSubject($params['text']);
- }
-
- /** template function : add_header.
- * {add_header name=... value=...}
- */
- public function addHeader($params, &$smarty)
- {
- $smarty->mailer->addHeader($params['name'], $params['value']);
- }
-}
-
-require_once('Mail.php');
-require_once('Mail/mime.php');
-
-/** Class for sending inline or multipart-emails.
- * Based on Diogenes' HermesMailer
- */
-class PlMailer extends Mail_Mime {
-
- private $mail;
- private $page = null;
- private $charset;
- private $wiki = null;
-
- function __construct($tpl = null, $charset = "UTF-8")
- {
- $this->charset = $charset;
- $this->Mail_Mime("\n");
- $this->mail = Mail::factory('sendmail', Array('sendmail_args' => '-oi'));
- if (!is_null($tpl)) {
- $this->page =& PlMail::get($this, $tpl);
- }
- }
-
- /**
- * converts all : Foo Bar Baz <quux@foobar.org> into "Foo Bar Baz" <quux@foobar.org> which is RFC compliant
- */
- private function correct_emails($email)
- {
- return preg_replace('!(^|, *)([^<"]+?) *(<[^>]*>)!u', '\1"\2" \3', $email);
- }
-
- public function addTo($email)
- {
- $email = $this->correct_emails($email);
- if (isset($this->_headers['To'])) {
- $this->_headers['To'] .= ", $email";
- } else {
- $this->_headers['To'] = $email;
- }
- }
-
- public function addCc($email)
- {
- return parent::addCc($this->correct_emails($email));
- }
-
- public function addBcc($email)
- {
- return parent::addBcc($this->correct_emails($email));
- }
-
- public function setFrom($email)
- {
- return parent::setFrom($this->correct_emails($email));
- }
-
- public function addHeader($hdr,$val)
- {
- switch($hdr) {
- case 'From':
- $this->setFrom($val);
- break;
-
- case 'To':
- unset($this->_headers[$hdr]);
- $this->addTo($val);
- break;
-
- case 'Cc':
- unset($this->_headers[$hdr]);
- $this->addCc($val);
- break;
-
- case 'Bcc':
- unset($this->_headers[$hdr]);
- $this->addBcc($val);
- break;
-
- default:
- $this->headers(Array($hdr=>$val));
- }
- }
-
- public function addUploadAttachment(PlUpload &$upload, $name)
- {
- $encoding = $upload->isType('text') ? 'quoted-printable' : 'base64';
- $this->addAttachment($upload->getContents(), $upload->contentType(), $name, false, $encoding);
- }
-
- public function assign($var, $value)
- {
- if (!is_null($this->page)) {
- $this->page->assign($var, $value);
- }
- }
-
- public function assign_by_ref($var, &$value)
- {
- if (!is_null($this->page)) {
- $this->page->assign_by_ref($var, $value);
- }
- }
-
- public function register_modifier($var, $callback)
- {
- if (!is_null($this->page)) {
- $this->page->register_modifier($var, $callback);
- }
- }
-
- public function register_function($var, $callback)
- {
- if (!is_null($this->page)) {
- $this->page->register_function($var, $callback);
- }
- }
-
- public function setWikiBody($wiki)
- {
- $this->wiki = $wiki;
- }
-
- private function processPage($with_html = true)
- {
- if (!is_null($this->page)) {
- $level = error_reporting(0);
- $this->page->run('head'); // process page headers
- $this->wiki = trim($this->page->run('wiki')); // get wiki
- if (!$this->wiki) {
- $this->setTxtBody($this->page->run('text'));
- if ($with_html) {
- $html = trim($this->page->run('html'));
- if (!empty($html)) {
- $this->setHtmlBody($html);
- }
- }
- }
- error_reporting($level);
- }
- if ($this->wiki) {
- $this->setTxtBody(MiniWiki::WikiToText($this->wiki, false, 0, 78));
- if ($with_html) {
- $this->setHtmlBody('<html><body>' . MiniWiki::WikiToHtml($this->wiki, true) . '</body></html>');
- }
- }
- }
-
- public function send($with_html = true)
- {
- $this->processPage($with_html);
- if (S::v('forlife')) {
- global $globals;
- $this->addHeader('X-Org-Mail', S::v('forlife') . '@' . $globals->mail->domain);
- }
- $addrs = Array();
- foreach(Array('To', 'Cc', 'Bcc') as $hdr) {
- if(isset($this->_headers[$hdr])) {
- require_once 'Mail/RFC822.php';
- $parsed = @Mail_RFC822::parseAddressList($this->_headers[$hdr]);
- if (is_array($parsed)) {
- $addrs = array_merge($addrs, $parsed);
- }
- }
- }
- if(empty($addrs)) {
- return false;
- }
-
- $dests = Array();
- foreach($addrs as $a) {
- $dests[] = "{$a->mailbox}@{$a->host}";
- }
-
- // very important to do it in THIS order very precisely.
- $body = $this->get(array('text_charset' => $this->charset,
- 'text_encoding' => '8bit',
- 'html_charset' => $this->charset,
- 'head_charset' => $this->charset));
- $hdrs = $this->headers();
- if (empty($hdrs['From'])) {
- trigger_error('Empty "From", mail not sent', E_USER_WARNING);
- return false;
- }
- return $this->mail->send($dests, $hdrs, $body);
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-abstract class PLModule
-{
- abstract function handlers();
-
- /** Register a hook
- * @param fun name of the handler (the exact name will be handler_$fun)
- * @param auth authentification level of needed to run this handler
- * @param perms permission required to run this handler
- * @param type additionnal flags
- *
- * Perms syntax is the following:
- * perms = rights(,rights)*
- * rights = right(:right)*
- * right is an atomic right permission (like 'admin', 'user', 'groupadmin', 'groupmember'...)
- *
- * If type is set to NO_AUTH, the system will return 403 instead of asking auth data
- * this is useful for Ajax handler
- * If type is not set to NO_SKIN, the system will consider redirecting the user to https
- */
- public function make_hook($fun, $auth, $perms = 'user', $type = DO_AUTH)
- {
- return array('hook' => array($this, 'handler_'.$fun),
- 'auth' => $auth,
- 'perms' => $perms,
- 'type' => $type);
- }
-
- /* static functions */
-
- public static function factory($modname)
- {
- $mod_path = dirname(__FILE__) . '/../modules/' . $modname . '.php';
- $class = ucfirst($modname) . 'Module';
-
- require_once $mod_path;
- return new $class();
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class PlProfiler
-{
- static public function start($name, $info = "action")
- {
- global $globals;
- if (!($globals->debug & DEBUG_BT)) {
- return false;
- }
- if (!isset(PlBacktrace::$bt[$name])) {
- new PlBacktrace($name);
- }
- PlBacktrace::$bt[$name]->start($info);
- return true;
- }
-
- static public function step($name, $info = "action")
- {
- PlProfiler::stop($name);
- PlProfiler::start($name, $info);
- }
-
- static public function stop($name)
- {
- global $globals;
- if (!($globals->debug & DEBUG_BT)) {
- return false;
- }
- PlBacktrace::$bt[$name]->stop();
- return true;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-/** UserSet is a light-weight Model/View tool for displaying a set of items
- */
-class PlSet
-{
- private $from = null;
- private $groupby = null;
- private $joins = null;
- private $where = null;
-
- private $count = null;
-
- private $mods = array();
- private $modParams = array();
- private $mod = null;
- private $default = null;
-
- public function __construct($from, $joins = '', $where = '', $groupby = '')
- {
- $this->from = $from;
- $this->joins = $joins;
- $this->where = $where;
- $this->groupby = $groupby;
- }
-
- public function addMod($name, $description, $default = false, array $params = array())
- {
- $name = strtolower($name);
- $this->mods[$name] = $description;
- $this->modParams[$name] = $params;
- if ($default) {
- $this->default = $name;
- }
- }
-
- public function rmMod($name)
- {
- $name = strtolower($name);
- unset($this->mods[$name]);
- }
-
- private function &query($fields, $from, $joins, $where, $groupby, $order, $limit)
- {
- if (trim($order)) {
- $order = "ORDER BY $order";
- }
- if (trim($where)) {
- $where = "WHERE $where";
- }
- if (trim($groupby)) {
- $groupby = "GROUP BY $groupby";
- }
- $query = "SELECT SQL_CALC_FOUND_ROWS
- $fields
- FROM $from
- $joins
- $where
- $groupby
- $order
- $limit";
-// echo $query;
-// print_r($this);
- $it = XDB::iterator($query);
- $count = XDB::query('SELECT FOUND_ROWS()');
- $this->count = intval($count->fetchOneCell());
- return $it;
- }
-
- public function args()
- {
- $get = $_GET;
- unset($get['n']);
- return $get;
- }
-
- protected function encodeArgs(array $args, $encode = false)
- {
- $qs = '?';
- $sep = '&';
- foreach ($args as $k=>$v) {
- if (!$encode) {
- $k = urlencode($k);
- $v = urlencode($v);
- }
- $qs .= "$k=$v$sep";
- }
- return $encode ? urlencode($qs) : $qs;
- }
-
- public function &get($fields, $joins, $where, $groupby, $order, $limitcount = null, $limitfrom = null)
- {
- if (!is_null($limitcount)) {
- if (!is_null($limitfrom)) {
- $limitcount = "$limitfrom,$limitcount";
- }
- $limitcount = "LIMIT $limitcount";
- }
- $joins = $this->joins . ' ' . $joins;
- if (trim($this->where)) {
- if (trim($where)) {
- $where .= ' AND ';
- }
- $where .= $this->where;
- }
- if (!$groupby) {
- $groupby = $this->groupby;
- }
- return $this->query($fields, $this->from, $joins, $where, $groupby, $order, $limitcount);
- }
-
- public function count()
- {
- return $this->count;
- }
-
- private function &buildView($view, $data)
- {
- $view = strtolower($view);
- if (!$view || !class_exists($view . 'View') || !isset($this->mods[$view])) {
- reset($this->mods);
- $view = $this->default ? $this->default : key($this->mods);
- }
- $this->mod = $view;
- $class = $view . 'View';
- if (!class_exists($class)) {
- $view = null;
- } else {
- $view = new $class($this, $data, $this->modParams[$this->mod]);
- if (!$view instanceof PlView) {
- $view = null;
- }
- }
- return $view;
- }
-
- public function apply($baseurl, PlatalPage &$page, $view = null, $data = null)
- {
- $view =& $this->buildView($view, $data);
- if (is_null($view)) {
- return false;
- }
- $args = $view->args();
- if (!isset($args['rechercher'])) {
- $args['rechercher'] = 'Chercher';
- }
- $page->changeTpl('core/plset.tpl');
- $page->assign('plset_base', $baseurl);
- $page->assign('plset_mods', $this->mods);
- $page->assign('plset_mod', $this->mod);
- $page->assign('plset_search', $this->encodeArgs($args));
- $page->assign('plset_search_enc', $this->encodeArgs($args, true));
- foreach ($this->modParams[$this->mod] as $param=>$value) {
- $page->assign($this->mod . '_' . $param, $value);
- }
- $page->assign('plset_content', $view->apply($page));
- $page->assign('plset_count', $this->count);
- return true;
- }
-}
-
-interface PlView
-{
- public function __construct(PlSet &$set, $data, array $params);
- public function apply(PlatalPage &$page);
- public function args();
-}
-
-abstract class MultipageView implements PlView
-{
- protected $set;
-
- public $pages = 1;
- public $page = 1;
- public $offset = 0;
-
- protected $entriesPerPage = 20;
- protected $params = array();
-
- protected $sortkeys = array();
- protected $defaultkey = null;
-
- public function __construct(PlSet &$set, $data, array $params)
- {
- $this->set =& $set;
- $this->page = Env::i('page', 1);
- $this->offset = $this->entriesPerPage * ($this->page - 1);
- $this->params = $params;
- }
-
- public function joins()
- {
- return null;
- }
-
- public function where()
- {
- return null;
- }
-
- public function groupBy()
- {
- return null;
- }
-
- protected function addSortKey($name, array $keys, $desc, $default = false)
- {
- $this->sortkeys[$name] = array('keys' => $keys, 'desc' => $desc);
- if (!$this->defaultkey || $default) {
- $this->defaultkey = $name;
- }
- }
-
- public function order()
- {
- $order = Env::v('order', $this->defaultkey);
- $invert = ($order{0} == '-');
- if ($invert) {
- $order = substr($order, 1);
- }
- $list = array();
- foreach ($this->sortkeys[$order]['keys'] as $item) {
- $desc = ($item{0} == '-');
- if ($desc) {
- $item = substr($item, 1);
- }
- if ($desc xor $invert) {
- $item .= ' DESC';
- }
- $list[] = $item;
- }
- return implode(', ', $list);
- }
-
- abstract public function templateName();
-
- public function apply(PlatalPage &$page)
- {
- $page->assign('order', Env::v('order', $this->defaultkey));
- $page->assign('orders', $this->sortkeys);
- $page->assign_by_ref('plview', $this);
- $page->assign_by_ref('set',
- $this->set->get($this->fields(),
- $this->joins(),
- $this->where(),
- $this->groupBy(),
- $this->order(),
- $this->entriesPerPage,
- $this->offset));
- $count = $this->set->count();
- $this->pages = intval(ceil($count / $this->entriesPerPage));
- return 'include/plview.multipage.tpl';
- }
-
- public function args()
- {
- $list = $this->set->args();
- unset($list['page']);
- unset($list['order']);
- return $list;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class PLTableEditor
-{
- // the plat/al name of the page
- public $pl;
- // the table name
- public $table;
- // joint tables to delete when deleting an entry
- public $jtables = array();
- // sorting field
- public $sort = array();
- // the id field
- public $idfield;
- // possibility to edit the field
- public $idfield_editable;
- // vars
- public $vars;
- // number of displayed fields
- public $nbfields;
- // a where clause to restrict table
- public $whereclause;
- // the field for sorting entries
- public $sortfield;
- public $sortdesc = false;
- // action to do to delete row:
- // null => delete effectively, false => no deletion, SQL
- public $delete_action;
- public $delete_message;
- // Should "Save" button return to the list view
- public $auto_return = true;
-
- /* table editor for platal
- * $plname : the PLname of the page, ex: admin/payments
- * $table : the table to edit, ex: profile_medals
- * $idfield : the field of the table which is the id, ex: id
- * $editid : is the id editable or not (if not, it is considered as an int)
- */
- public function __construct($plname, $table, $idfield, $editid=false)
- {
- $this->pl = $plname;
- $this->table = $table;
- $this->idfield = $idfield;
- $this->sortfield = $idfield;
- $this->idfield_editable = $editid;
- $this->whereclause = '1';
- $r = XDB::iterator("SHOW FULL COLUMNS FROM $table");
- $this->vars = array();
- while ($a = $r->next()) {
- // desc will be the title of the column
- $a['desc'] = $a['Field'];
- $a['display'] = true;
-
- if (substr($a['Type'],0,8) == 'varchar(') {
- // limit editing box size
- $a['Size'] = $a['Maxlength'] = substr($a['Type'], 8, strlen($a['Type']) - 9);
- if ($a['Size'] > 40) $a['Size'] = 40;
- // if too big, put a textarea
- $a['Type'] = ($a['Maxlength']<200)?'varchar':'varchar200';
- }
- elseif ($a['Type'] == 'text' || $a['Type'] == 'mediumtext')
- $a['Type'] = 'textarea';
- elseif (substr($a['Type'],0,4) == 'set(') {
- // get the list of options
- $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 5, strlen($a['Type']) - 7)));
- if (count($a['List']) == 1) {
- $a['Type'] = 'checkbox';
- $a['Value'] = $a['List'][0];
- } else {
- $a['Type'] = 'set';
- }
- }
- elseif (substr($a['Type'],0,5) == 'enum(') {
- // get the list of options
- $a['List'] = explode('§',str_replace("','","§",substr($a['Type'], 6, strlen($a['Type']) - 8)));
- $a['Type'] = 'enum';
- }
- elseif (substr($a['Type'],0,10) == 'timestamp(' || $a['Type'] == 'datetime') {
- $a['Type'] = 'timestamp';
- }
- elseif ($a['Comment'] == 'ip_address') {
- $a['Type']='ip_address';
- }
-
- $this->vars[$a['Field']] = $a;
- }
- $this->vars[$idfield]['desc'] = 'id';
- }
-
- // called before creating a new entry
- private function prepare_new()
- {
- $entry = array();
- foreach ($this->vars as $field => $descr) {
- $entry[$field] = $descr['Default'];
- }
- return $this->prepare_edit($entry);
- }
-
- // called before editing $entry
- private function prepare_edit(&$entry)
- {
- foreach ($this->vars as $field => $descr) {
- if ($descr['Type'] == 'set') {
- // get the list of options selected
- $selected = explode(',', $entry[$field]);
- $entry[$field] = array();
- foreach ($selected as $option)
- $entry[$field][$option] = 1;
- }
- if ($descr['Type'] == 'timestamp') {
- // set readable timestamp
- $date =& $entry[$field];
- $date = preg_replace('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', '\3/\2/\1 \4:\5:\6', $date);
- }
- if ($descr['Type'] == 'date') {
- $date =& $entry[$field];
- $date = preg_replace('/([0-9]{4})-?([0-9]{2})-?([0-9]{2})/', '\3/\2/\1', $date);
- }
- if ($descr['Type'] == 'ip_address') {
- $ip = & $entry[$field];
- $ip = long2ip($ip);
- }
- }
- return $entry;
- }
-
- // set whether the save button show redirect to list view or edit view
- public function list_on_edit($var)
- {
- $this->auto_return = $var;
- }
-
- // change display of a field
- public function describe($name, $desc, $display)
- {
- $this->vars[$name]['desc'] = $desc;
- $this->vars[$name]['display'] = $display;
- }
-
- // add a join table, when deleting a row corresponding entries will be deleted in these tables
- public function add_join_table($name,$joinid,$joindel,$joinextra="")
- {
- if ($joindel)
- $this->jtables[$name] = array("joinid" => $joinid,"joinextra" => $joinextra?(" AND ".$joinextra):"");
- }
-
- // add a sort key
- public function add_sort_field($key, $desc = false, $default = false)
- {
- if ($default) {
- $this->sortfield = $key . ($desc ? ' DESC' : '');
- } else {
- $this->sort[] = $key . ($desc ? ' DESC' : '');
- }
- }
-
- // add a where clause to limit table listing
- public function set_where_clause($whereclause="1")
- {
- $this->whereclause = $whereclause;
- }
-
- // set an action when trying to delete row
- public function on_delete($action = NULL, $message = NULL)
- {
- $this->delete_action = $action;
- $this->delete_message = $message;
- }
-
- // call when done
- public function apply(PlatalPage &$page, $action, $id = false)
- {
- $page->changeTpl('core/table-editor.tpl');
- $list = true;
- if ($action == 'delete') {
- S::assert_xsrf_token();
-
- if (!isset($this->delete_action)) {
- foreach ($this->jtables as $table => $j)
- XDB::execute("DELETE FROM {$table} WHERE {$j['joinid']} = {?}{$j['joinextra']}", $id);
- XDB::execute("DELETE FROM {$this->table} WHERE {$this->idfield} = {?}",$id);
- $page->trigSuccess("L'entrée ".$id." a été supprimée.");
- } else if ($this->delete_action) {
- XDB::execute($this->delete_action, $id);
- if (isset($this->delete_message)) {
- $page->trigSuccess($this->delete_message);
- } else {
- $page->trigSuccess("L'entrée ".$id." a été supprimée.");
- }
- } else {
- $page->trigError("Impossible de supprimer l'entrée.");
- }
- }
- if ($action == 'edit') {
- $r = XDB::query("SELECT * FROM {$this->table} WHERE {$this->idfield} = {?} AND {$this->whereclause}",$id);
- $entry = $r->fetchOneAssoc();
- $page->assign('entry', $this->prepare_edit($entry));
- $page->assign('id', $id);
- $list = false;
- }
- if ($action == 'massadd') {
- $importer = new CSVImporter($this->table, $this->idfield_editable ? $this->idfield : null);
- $fields = array();
- foreach ($this->vars as $field=>$descr) {
- if ($this->idfield_editable || $field != $this->idfield) {
- $fields[] = $field;
- $importer->describe($field, @$descr['desc']);
- }
- }
- $page->assign('massadd', true);
- $importer->apply($page, $this->pl . '/massadd', $fields);
- $list = false;
- }
- if ($action == 'new') {
- if (!$this->idfield_editable) {
- $r = XDB::query("SELECT MAX({$this->idfield})+1 FROM {$this->table}");
- $page->assign('id', $r->fetchOneCell());
- $page->assign('entry', $this->prepare_new());
- }
- $list = false;
- }
- if ($action == 'update') {
- S::assert_xsrf_token();
-
- $values = "";
- $cancel = false;
- foreach ($this->vars as $field => $descr) {
- if ($values) $values .= ',';
- if (($field == $this->idfield) && !$this->idfield_editable)
- $val = "'".addslashes($id)."'";
- elseif ($descr['Type'] == 'set') {
- $val = "";
- if (Post::has($field)) foreach (Post::v($field) as $option) {
- if ($val) $val .= ',';
- $val .= $option;
- }
- $val = "'".addslashes($val)."'";
- } elseif ($descr['Type'] == 'checkbox') {
- $val = Post::has($field)?"'".addslashes($descr['Value'])."'":"''";
- } elseif (Post::has($field)) {
- $val = Post::v($field);
- if ($descr['Type'] == 'timestamp') {
- $val = preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/', '\3\2\1\4\5\6', $val);
- }
- elseif ($descr['Type'] == 'date') {
- $val = preg_replace('/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/', '\3-\2-\1', $val);
- }
- elseif ($descr['Type'] == 'ip_address') {
- $val = ip2long($val);
- }
- $val = "'".addslashes($val)."'";
- } else {
- $cancel = true;
- $page->trigError("Il manque le champ ".$field);
- }
- $values .= $val;
- }
- if (!$cancel) {
- if ($this->idfield_editable && ($id != Post::v($this->idfield)) && $action != 'new')
- XDB::execute("UPDATE {$this->table} SET {$this->idfield} = {?} WHERE {$this->idfield} = {?} AND {$this->whereclause}", Post::v($this->idfield), $id);
- XDB::execute("REPLACE INTO {$this->table} VALUES ($values)");
- if ($id !== false)
- $page->trigSuccess("L'entrée ".$id." a été mise à jour.");
- else {
- $page->trigSuccess("Une nouvelle entrée a été créée.");
- $id = XDB::insertId();
- }
- } else
- $page->trigError("Impossible de mettre à jour.");
- if (!$this->auto_return) {
- return $this->apply($page, 'edit', $id);
- }
- }
- if ($action == 'sort') {
- $this->sortfield = $id;
- }
- if ($action == 'sortdesc') {
- $this->sortfield = $id.' DESC';
- }
- if ($list) {
- // user can sort by field by clicking the title of the column
- if (isset($this->sortfield)) {
- // add this sort order after the others (chosen by dev)
- $this->add_sort_field($this->sortfield);
- if (substr($this->sortfield,-5) == ' DESC') {
- $this->sortfield = substr($this->sortfield,0,-5);
- $this->sortdesc = true;
- }
- }
- if (count($this->sort) > 0) {
- $sort = 'ORDER BY ' . join($this->sort, ',');
- }
- $it = XDB::iterator("SELECT * FROM {$this->table} WHERE {$this->whereclause} $sort");
- $this->nbfields = 0;
- foreach ($this->vars as $field => $descr)
- if ($descr['display']) $this->nbfields++;
- $page->assign('list', $it);
- }
- $page->assign('t', $this);
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-/** Class to store per user and per category files
- */
-class PlUpload
-{
- private $forlife;
- private $category;
- private $file_id;
-
- private $filename;
- private $type;
-
- static public $lastError;
-
- /** For images
- */
- private $x;
- private $y;
-
- public function __construct($forlife, $category, $filename = null)
- {
- $this->file_id = $filename;
- $this->category = $category;
- $this->forlife = $forlife;
- $this->filename = $this->makeFilename($this->file_id);
- $this->checkContentType();
- }
-
- private function makeFilename($file_id)
- {
- global $globals;
- $filename = $globals->spoolroot . '/spool/tmp/';
- if (!file_exists($filename)) {
- if (!mkdir($filename)) {
- trigger_error('can\'t create upload directory: ' . $filename, E_USER_ERROR);
- }
- }
- $filename .= $this->forlife . '--' . $this->category;
- if ($file_id) {
- $filename .= '--' . $file_id;
- }
- return $filename;
- }
-
- private function checkContentType()
- {
- if ($this->exists()) {
- $this->type = trim(mime_content_type($this->filename));
- if ($this->type == 'text/plain') { // Workaround a bug of php 5.2.0+etch10 (mime_content_type fallback is 'text/plain')
- $this->type = preg_replace('/;.*/', '', trim(shell_exec('file -bi ' . escapeshellarg($this->filename))));
- }
- }
- }
-
- public function upload(array &$file)
- {
- if (@$file['error']) {
- PlUpload::$lastError = 'Erreur de téléchargement de ' . $file['name'] . ' : ';
- switch ($file['error']) {
- case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE:
- PlUpload::$lastError .= 'le fichier est trop gros (limite : ' . ini_get('upload_max_filesize') . ')';
- break;
- case UPLOAD_ERR_PARTIAL: case UPLOAD_ERR_NO_FILE:
- PlUpload::$lastError .= 'le fichier n\'a pas été transmis intégralement';
- break;
- default:
- PlUpload::$lastError .= 'erreur interne';
- break;
- }
- return false;
- }
- if (!is_uploaded_file($file['tmp_name'])) {
- return false;
- } else if (!move_uploaded_file($file['tmp_name'], $this->filename)) {
- return false;
- }
- $this->checkContentType();
- return true;
- }
-
- public function copyFrom($filename)
- {
- if (!copy($filename, $this->filename)) {
- return false;
- }
- $this->checkContentType();
- return true;
- }
-
- public function download($url)
- {
- if (!$url || @parse_url($url) === false) {
- trigger_error('malformed URL given', E_USER_NOTICE);
- return false;
- }
- $data = file_get_contents($url);
- if (!$data) {
- return false;
- }
- if (!file_put_contents($this->filename, $data)) {
- return false;
- }
- $this->checkContentType();
- return true;
- }
-
- static public function &get(array &$file, $forlife, $category, $uniq = false)
- {
- $upload = new PlUpload($forlife, $category, $uniq ? null : $file['name']);
- if (!$upload->upload($file)) {
- $upload = null;
- }
- return $upload;
- }
-
- public function rm()
- {
- @unlink($this->filename);
- @clearstatcache();
- }
-
- public function rename($fn)
- {
- if (!$this->file_id) {
- return false;
- }
- $filename = $this->makeFilename($fn);
- if (rename($this->filename)) {
- $this->filename = $filename;
- $this->file_id = $fn;
- clearstatcache();
- return true;
- }
- return false;
- }
-
- public function exists()
- {
- return file_exists($this->filename);
- }
-
- static public function listRawFiles($forlife = '*', $category = '*', $uniq = false, $basename = false)
- {
- global $globals;
- $filename = $globals->spoolroot . '/spool/tmp/';
- $filename .= $forlife . '--' . $category;
- if (!$uniq) {
- $filename .= '--*';
- }
- $files = glob($filename);
- if ($basename) {
- $files = array_map('basename', $files);
- }
- return $files;
- }
-
- static public function listFilenames($forlife = '*', $category = '*')
- {
- $files = PlUpload::listRawFiles($forlife, $category, false, true);
- foreach ($files as &$name) {
- list($forlife, $cat, $fn) = explode('--', $name, 3);
- $name = $fn;
- }
- return $files;
- }
-
- static public function &listFiles($forlife = '*', $category = '*', $uniq = false)
- {
- $res = array();
- $files = PlUpload::listRawFiles($forlife, $category, $uniq, true);
- foreach ($files as $name) {
- list($forlife, $cat, $fn) = explode('--', $name, 3);
- $res[$fn] = new PlUpload($forlife, $cat, $fn);
- }
- return $res;
- }
-
- static public function clear($user = '*', $category = '*', $uniq = false)
- {
- $files = PlUpload::listRawFiles($user, $category, $uniq, false);
- array_map('unlink', $files);
- }
-
- public function contentType()
- {
- return $this->type;
- }
-
- public function isType($type, $subtype = null)
- {
- list($mytype, $mysubtype) = explode('/', $this->type);
- if ($mytype != $type || ($subtype && $mysubtype != $subtype)) {
- return false;
- }
- return true;
- }
-
- public function imageInfo()
- {
- static $map;
- if (!isset($map)) {
- $tmpmap = array (IMG_GIF => 'gif', IMG_JPG => 'jpeg', IMG_PNG => 'png', IMG_WBMP => 'bmp', IMG_XPM => 'xpm');
- $map = array();
- $supported = imagetypes();
- foreach ($tmpmap as $type=>$mime) {
- if ($supported & $type) {
- $map[$type] = $mime;
- }
- }
- }
- $array = getimagesize($this->filename);
- $array[2] = @$map[$array[2]];
- if (!$array[2]) {
- list($image, $type) = explode('/', $array['mime']);
- $array[2] = $type;
- }
- if (!$array[2]) {
- trigger_error('unknown image type', E_USER_NOTICE);
- return null;
- }
- return $array;
- }
-
- public function resizeImage($max_x = -1, $max_y = -1, $min_x = 0, $min_y = 0, $maxsize = -1)
- {
- if (!$this->exists() || strpos($this->type, 'image/') !== 0) {
- trigger_error('not an image', E_USER_NOTICE);
- return false;
- }
- $image_infos = $this->imageInfo();
- if (!$image_infos) {
- trigger_error('invalid image', E_USER_NOTICE);
- return false;
- }
- list($this->x, $this->y, $mimetype) = $image_infos;
- if ($max_x == -1) {
- $max_x = $this->x;
- }
- if ($max_y == -1) {
- $max_y = $this->y;
- }
- if ($maxsize == -1) {
- $maxsize = filesize($this->filename);
- }
- if (filesize($this->filename) > $maxsize || $this->x > $max_x || $this->y > $max_y
- || $this->x < $min_x || $this->y < $min_y) {
- $img = imagecreatefromstring(file_get_contents($this->filename));
- if (!$img) {
- trigger_error('too large image, can\'t be resized', E_USER_NOTICE);
- return false;
- }
-
- $nx = $this->x;
- $ny = $this->y;
- if ($nx > $max_x) {
- $ny = intval($ny*$max_x/$nx);
- $nx = $max_x;
- }
- if ($ny > $max_y) {
- $nx = intval($nx*$max_y/$ny);
- $ny = $max_y;
- }
- if ($nx < $min_x) {
- $ny = intval($ny*$min_x/$nx);
- $nx = $min_x;
- }
- if ($ny < $min_y) {
- $nx = intval($nx * $min_y/$ny);
- $ny = $min_y;
- }
-
- $comp = 90;
- do {
- $img2 = imagecreatetruecolor($nx, $ny);
- imagecopyresampled($img2, $img, 0, 0, 0, 0, $nx, $ny, $this->x, $this->y);
- imagejpeg($img2, $this->filename, $comp);
- $comp --;
- clearstatcache();
- } while (filesize($this->filename) > $maxsize && $comp > 0);
- $this->type = 'image/jpeg';
- $this->x = $nx;
- $this->y = $ny;
- }
- return true;
- }
-
- public function getContents()
- {
- if ($this->exists()) {
- return file_get_contents($this->filename);
- }
- return null;
- }
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- **************************************************************************/
-
-/** A Wizard Page is a page of a wizard. It is a self-contained step which
- * handles both the creation and initialisation of the step (by using the
- * Wizard global state, if needed) and the processing of the action the
- * user made on it.
- */
-interface PlWizardPage
-{
- /** Build a new instance of the class
- * associated with the given wizard master.
- */
- public function __construct(PlWizard &$wiz);
-
- /** Return the name of the templace describing the page.
- */
- public function template();
-
- /** Prepare the page by assigning to it any useful value.
- */
- public function prepare(PlatalPage &$page, $id);
-
- /** Process information resulting of the application of the page.
- * This function must return a clue indicating the next page to show.
- * This clue can be either a page id, a page number or a navigation
- * id (PlWizard::FIRST_PAGE, PlWizard::NEXT_PAGE, PlWizard::CURRENT_PAGE
- * PlWizard::PREVIOUS_PAGE, PlWizard::LAST_PAGE).
- */
- public function process();
-}
-
-/** A PlWizard is a set of pages through which the user can navigate,
- * his action on a page determining which the next one will be.
- *
- * A Wizard can either a stateless wizard (which is only a set of
- * independent pages through which the user can easily navigate) or
- * stateful (a suite of steps where each step gives clue for the next
- * one).
- */
-class PlWizard
-{
- const FIRST_PAGE = 'bt_first';
- const NEXT_PAGE = 'bt_next';
- const CURRENT_PAGE = 'bt_current';
- const PREVIOUS_PAGE = 'bt_previous';
- const LAST_PAGE = 'bt_last';
-
- protected $name;
- protected $layout;
- protected $stateless;
- protected $ajax;
-
- protected $pages;
- protected $titles;
- protected $lookup;
- protected $inv_lookup;
-
- public function __construct($name, $layout, $stateless = false, $ajax = true)
- {
- $this->name = 'wiz_' . $name;
- $this->layout = $layout;
- $this->stateless = $stateless;
- $this->pages = array();
- $this->lookup = array();
- $this->titles = array();
- $this->ajax = $ajax;
- if (!isset($_SESSION[$this->name])) {
- $_SESSION[$this->name] = array();
- $_SESSION[$this->name . '_page'] = null;
- $_SESSION[$this->name . '_stack'] = array();
- }
- }
-
- public function addPage($class, $title, $id = null)
- {
- if ($id == null) {
- $id = count($this->pages);
- }
- $this->lookup[$id] = count($this->pages);
- $this->inv_lookup[] = $id;
- $this->pages[] = $class;
- $this->titles[] = $title;
- }
-
- public function set($varname, $value)
- {
- $_SESSION[$this->name][$varname] = $value;
- }
-
- public function get($varname, $default = null)
- {
- return isset($_SESSION[$this->name][$varname]) ?
- $_SESSION[$this->name][$varname] : $default;
- }
-
- public function v($varname, $default = "")
- {
- return $this->get($varname, $default);
- }
-
- public function i($varname, $default = 0)
- {
- return (int)$this->get($varname, $default);
- }
-
- public function clear($varname = null)
- {
- if (is_null($varname)) {
- $_SESSION[$this->name] = array();
- } else {
- unset($_SESSION[$this->name][$varname]);
- }
- $_SESSION[$this->name . '_page'] = null;
- }
-
- private function getPage($id)
- {
- $page = $this->pages[$id];
- return new $page($this);
- }
-
- public function apply(PlatalPage &$smarty, $baseurl, $pgid = null, $mode = 'normal')
- {
- if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) {
- $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid];
- } else if ($this->stateless && is_null($pgid)) {
- $curpage = 0;
- } else {
- $curpage = $_SESSION[$this->name . '_page'];
- }
- $oldpage = $curpage;
-
- // Process the previous page
- if (Post::has('valid_page')) {
- $page = $this->getPage(Post::i('valid_page'));
- $curpage = Post::i('valid_page');
- $next = $page->process();
- $last = $curpage;
- switch ($next) {
- case PlWizard::FIRST_PAGE:
- $curpage = 0;
- break;
- case PlWizard::PREVIOUS_PAGE:
- if (!$this->stateless && count($_SESSION[$this->name . '_stack'])) {
- $curpage = array_pop($_SESSION[$this->name . '_stack']);
- } elseif ($curpage && $this->stateless) {
- $curpage--;
- } else {
- $curpage = 0;
- }
- break;
- case PlWizard::NEXT_PAGE:
- if ($curpage < count($this->pages) - 1) {
- $curpage++;
- }
- break;
- case PlWizard::LAST_PAGE:
- $curpage = count($this->pages) - 1;
- break;
- case PlWizard::CURRENT_PAGE: break; // don't change the page
- default:
- $curpage = is_numeric($next) ? $next : $this->lookup[$next];
- break;
- }
- if (!$this->stateless) {
- array_push($_SESSION[$this->name . '_stack'], $last);
- }
- }
- if (is_null($curpage)) {
- $curpage = 0;
- }
-
- // Prepare the page
- $_SESSION[$this->name . '_page'] = $curpage;
- if ($curpage != $oldpage) {
- pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage]);
- } else if (!isset($page)) {
- $page = $this->getPage($curpage);
- }
- if ($mode == 'ajax') {
- header('Content-Type: text/html; charset=utf-8');
- $smarty->changeTpl($page->template(), NO_SKIN);
- } else {
- $smarty->changeTpl($this->layout);
- }
- $smarty->assign('pages', $this->titles);
- $smarty->assign('current', $curpage);
- $smarty->assign('lookup', $this->inv_lookup);
- $smarty->assign('stateless', $this->stateless);
- $smarty->assign('wiz_baseurl', $baseurl);
- $smarty->assign('wiz_ajax', $this->ajax);
- $smarty->assign('tab_width', (int)(99 / count($this->pages)));
- $smarty->assign('wiz_page', $page->template());
- $smarty->assign('xorg_no_errors', true);
- $page->prepare($smarty, isset($this->inv_lookup[$curpage]) ? $this->inv_lookup[$curpage] : $curpage);
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class S extends Session {
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class Session
-{
- public static function init()
- {
- @session_start();
- if (empty($_SESSION['challenge'])) {
- $_SESSION['challenge'] = sha1(uniqid(rand(), true));
- }
- if (empty($_SESSION['xsrf_token'])) {
- require_once 'xorg.misc.inc.php';
- $_SESSION['xsrf_token'] = rand_url_id();
- }
- if (!isset($_SESSION['perms']) || !($_SESSION['perms'] instanceof FlagSet)) {
- $_SESSION['perms'] = new FlagSet();
- }
- }
-
- public static function destroy()
- {
- @session_destroy();
- unset($_SESSION);
- }
-
- public static function has($key)
- {
- return isset($_SESSION[$key]);
- }
-
- public static function kill($key)
- {
- unset($_SESSION[$key]);
- }
-
- public static function v($key, $default = null)
- {
- return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
- }
-
- public static function s($key, $default = '')
- {
- return (string)Session::v($key, $default);
- }
-
- public static function i($key, $default = 0)
- {
- $i = Session::v($key, $default);
- return is_numeric($i) ? intval($i) : $default;
- }
-
- public static function l(array $keys)
- {
- return array_map(array('Session', 'v'), $keys);
- }
-
- public static function has_perms()
- {
- return Session::logged() && Session::v('perms')->hasFlag(PERMS_ADMIN);
- }
-
- public static function logged()
- {
- return Session::v('auth', AUTH_PUBLIC) >= AUTH_COOKIE;
- }
-
- public static function identified()
- {
- return Session::v('auth', AUTH_PUBLIC) >= AUTH_MDP;
- }
-
- // Anti-XSRF protections.
- public static function has_xsrf_token()
- {
- return Session::has('xsrf_token') && Session::v('xsrf_token') == Env::v('token');
- }
-
- public static function assert_xsrf_token()
- {
- if (!Session::has_xsrf_token()) {
- global $page;
- if ($page instanceof PlatalPage) {
- $page->kill("L'opération n'a pas pu aboutir, merci de réessayer.");
- }
- }
- }
-}
-
-// {{{ function check_perms()
-
-/** verifie si un utilisateur a les droits pour voir une page
- ** si ce n'est pas le cas, on affiche une erreur
- * @return void
- */
-function check_perms()
-{
- global $page;
- if (!S::has_perms()) {
- if ($_SESSION['log']) {
- $_SESSION['log']->log("noperms",$_SERVER['PHP_SELF']);
- }
- $page->kill("Tu n'as pas les permissions nécessaires pour accéder à cette page.");
- }
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class VarStream
-{
- // Stream handler to read from global variables
- private $varname;
- private $position;
-
- public function stream_open($path, $mode, $options, &$opened_path)
- {
- $url = parse_url($path);
- $this->varname = $url['host'];
- $this->position = 0;
- if (!isset($GLOBALS[$this->varname]))
- {
- trigger_error('Global variable '.$this->varname.' does not exist', E_USER_WARNING);
- return false;
- }
- return true;
- }
-
- public function stream_close()
- {
- }
-
- public function stream_read($count)
- {
- $ret = substr($GLOBALS[$this->varname], $this->position, $count);
- $this->position += strlen($ret);
- return $ret;
- }
-
- public function stream_write($data)
- {
- $len = strlen($data);
- if ($len > $this->position + strlen($GLOBALS[$this->varname])) {
- str_pad($GLOBALS[$this->varname], $len);
- }
-
- $GLOBALS[$this->varname] = substr_replace($GLOBALS[$this->varname], $data, $this->position, $len);
- $this->position += $len;
- }
-
- public function stream_eof()
- {
- return $this->position >= strlen($GLOBALS[$this->varname]);
- }
-
- public function stream_tell()
- {
- return $this->position;
- }
-
- public function stream_seek($offs, $whence)
- {
- switch ($whence) {
- case SEEK_SET:
- $final = $offs;
- break;
-
- case SEEK_CUR:
- $final += $offs;
- break;
-
- case SEEK_END:
- $final = strlen($GLOBALS[$this->varname]) + $offs;
- break;
- }
-
- if ($final < 0) {
- return -1;
- }
- $this->position = $final;
- return 0;
- }
-
- public function stream_flush()
- {
- }
-
- static public function init()
- {
- stream_wrapper_register('var','VarStream');
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- **************************************************************************/
-
-class XDB
-{
- private static $mysqli = null;
-
- public static function connect()
- {
- global $globals;
- XDB::$mysqli = new mysqli($globals->dbhost, $globals->dbuser, $globals->dbpwd, $globals->dbdb);
- if ($globals->debug & DEBUG_BT) {
- $bt = new PlBacktrace('MySQL');
- if (mysqli_connect_errno()) {
- $bt->newEvent("MySQLI connection", 0, mysqli_connect_error());
- return false;
- }
- }
- XDB::$mysqli->autocommit(true);
- XDB::$mysqli->set_charset($globals->dbcharset);
- return true;
- }
-
- public static function _prepare($args)
- {
- $query = array_map(Array('XDB', 'escape'), $args);
- $query[0] = str_replace('{?}', '%s', str_replace('%', '%%', $args[0]));
- return call_user_func_array('sprintf', $query);
- }
-
- public static function _reformatQuery($query)
- {
- $query = preg_split("/\n\\s*/", trim($query));
- $length = 0;
- foreach ($query as $key=>$line) {
- $local = -2;
- if (preg_match('/^([A-Z]+(?:\s+(?:JOIN|BY|FROM|INTO))?)\s+(.*)/u', $line, $matches)
- && $matches[1] != 'AND' && $matches[1] != 'OR')
- {
- $local = strlen($matches[1]);
- $line = $matches[1] . ' ' . $matches[2];
- $length = max($length, $local);
- }
- $query[$key] = array($line, $local);
- }
- $res = '';
- foreach ($query as $array) {
- list($line, $local) = $array;
- $local = max(0, $length - $local);
- $res .= str_repeat(' ', $local) . $line . "\n";
- $length += 2 * (substr_count($line, '(') - substr_count($line, ')'));
- }
- return $res;
- }
-
- public static function _query($query)
- {
- global $globals;
-
- if (!XDB::$mysqli && !XDB::connect()) {
- return false;
- }
-
- if ($globals->debug & DEBUG_BT) {
- $explain = array();
- if (strpos($query, 'FOUND_ROWS()') === false) {
- $res = XDB::$mysqli->query("EXPLAIN $query");
- if ($res) {
- while ($row = $res->fetch_assoc()) {
- $explain[] = $row;
- }
- $res->free();
- }
- }
- PlBacktrace::$bt['MySQL']->start(XDB::_reformatQuery($query));
- }
-
- $res = XDB::$mysqli->query($query);
-
- if ($globals->debug & DEBUG_BT) {
- PlBacktrace::$bt['MySQL']->stop(@$res->num_rows ? $res->num_rows : XDB::$mysqli->affected_rows,
- XDB::$mysqli->error,
- $explain);
- }
- return $res;
- }
-
- public static function query()
- {
- return new XOrgDBResult(XDB::_prepare(func_get_args()));
- }
-
- public static function execute()
- {
- global $globals;
- $args = func_get_args();
- if ($globals->mode != 'rw' && !strpos($args[0], 'logger')) {
- return;
- }
- return XDB::_query(XDB::_prepare($args));
- }
-
- public static function iterator()
- {
- return new XOrgDBIterator(XDB::_prepare(func_get_args()));
- }
-
- public static function iterRow()
- {
- return new XOrgDBIterator(XDB::_prepare(func_get_args()), MYSQL_NUM);
- }
-
- public static function insertId()
- {
- return XDB::$mysqli->insert_id;
- }
-
- public static function errno()
- {
- return XDB::$mysqli->errno;
- }
-
- public static function error()
- {
- return XDB::$mysqli->error;
- }
-
- public static function affectedRows()
- {
- return XDB::$mysqli->affected_rows;
- }
-
- public static function escape($var)
- {
- switch (gettype($var)) {
- case 'boolean':
- return $var ? 1 : 0;
-
- case 'integer':
- case 'double':
- case 'float':
- return $var;
-
- case 'string':
- return "'".addslashes($var)."'";
-
- case 'NULL':
- return 'NULL';
-
- case 'object':
- case 'array':
- return "'".addslashes(serialize($var))."'";
-
- default:
- die(var_export($var, true).' is not a valid for a database entry');
- }
- }
-}
-
-class XOrgDBResult
-{
-
- private $_res;
-
- public function __construct($query)
- {
- $this->_res = XDB::_query($query);
- }
-
- public function free()
- {
- if ($this->_res) {
- $this->_res->free();
- }
- unset($this);
- }
-
- protected function _fetchRow()
- {
- return $this->_res ? $this->_res->fetch_row() : null;
- }
-
- protected function _fetchAssoc()
- {
- return $this->_res ? $this->_res->fetch_assoc() : null;
- }
-
- public function fetchAllRow()
- {
- $result = Array();
- if (!$this->_res) {
- return $result;
- }
- while ($result[] = $this->_res->fetch_row());
- array_pop($result);
- $this->free();
- return $result;
- }
-
- public function fetchAllAssoc()
- {
- $result = Array();
- if (!$this->_res) {
- return $result;
- }
- while ($result[] = $this->_res->fetch_assoc());
- array_pop($result);
- $this->free();
- return $result;
- }
-
- public function fetchOneAssoc()
- {
- $tmp = $this->_fetchAssoc();
- $this->free();
- return $tmp;
- }
-
- public function fetchOneRow()
- {
- $tmp = $this->_fetchRow();
- $this->free();
- return $tmp;
- }
-
- public function fetchOneCell()
- {
- $tmp = $this->_fetchRow();
- $this->free();
- return $tmp[0];
- }
-
- public function fetchColumn($key = 0)
- {
- $res = Array();
- if (is_numeric($key)) {
- while($tmp = $this->_fetchRow()) {
- $res[] = $tmp[$key];
- }
- } else {
- while($tmp = $this->_fetchAssoc()) {
- $res[] = $tmp[$key];
- }
- }
- $this->free();
- return $res;
- }
-
- public function fetchOneField()
- {
- return $this->_res ? $this->_res->fetch_field() : null;
- }
-
- public function fetchFields()
- {
- $res = array();
- while ($res[] = $this->fetchOneField());
- return $res;
- }
-
- public function numRows()
- {
- return $this->_res ? $this->_res->num_rows : 0;
- }
-
- public function fieldCount()
- {
- return $this->_res ? $this->_res->field_count : 0;
- }
-}
-
-require_once dirname(__FILE__) . '/pliterator.php';
-
-class XOrgDBIterator extends XOrgDBResult implements PlIterator
-{
- private $_result;
- private $_pos;
- private $_total;
- private $_fpos;
- private $_fields;
- private $_mode = MYSQL_ASSOC;
-
- public function __construct($query, $mode = MYSQL_ASSOC)
- {
- parent::__construct($query);
- $this->_pos = 0;
- $this->_total = $this->numRows();
- $this->_fpost = 0;
- $this->_fields = $this->fieldCount();
- $this->_mode = $mode;
- }
-
- public function next()
- {
- $this->_pos ++;
- if ($this->_pos > $this->_total) {
- $this->free();
- unset($this);
- return null;
- }
- return $this->_mode != MYSQL_ASSOC ? $this->_fetchRow() : $this->_fetchAssoc();
- }
-
- public function first()
- {
- return $this->_pos == 1;
- }
-
- public function last()
- {
- return $this->_pos == $this->_total;
- }
-
- public function total()
- {
- return $this->_total;
- }
-
- public function nextField()
- {
- $this->_fpos++;
- if ($this->_fpos > $this->_fields) {
- return null;
- }
- return $this->fetchOneField();
- }
-
- public function firstField()
- {
- return $this->_fpos == 1;
- }
-
- public function lastField()
- {
- return $this->_fpos == $this->_fields;
- }
-
- public function totalFields()
- {
- return $this->_fields;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-/* taken from : http://fr2.php.net/xml-rpc
- * Author mboeren@php.net
- *
- * Usage:
- * $client = new xmlrpc_client("http://localhost:7080");
- * print $client->echo('x')."\n";
- * print $client->add(1, 3)."\n";
- */
-
-class XmlrpcClient
-{
- private $url;
- private $urlparts;
- public $bt = null;
-
- public function __construct($url)
- {
- $this->url = $url;
- $this->urlparts = parse_url($this->url);
-
- if (empty($this->urlparts['port'])) {
- $this->urlparts['port'] = 80;
- }
-
- if (empty($this->urlparts['path'])) {
- $this->urlparts['path'] = '/';
- }
- }
-
- private function http_post($request)
- {
- $host = $path = $port = $user = $pass = null;
- extract($this->urlparts);
-
- if ($scheme == 'https') {
- $host = 'ssl://'.$host;
- }
-
- $query_fd = fsockopen($host, $port, $errno, $errstr, 10);
- if (!$query_fd)
- return null;
-
- $auth = '';
- if ($user) {
- $auth = 'Authorization: Basic ' . base64_encode("$user:$pass") . "\r\n";
- }
-
- $content_len = strlen($request);
- $http_request =
- "POST $path HTTP/1.0\r\n" .
- $auth .
- "Content-Type: text/xml\r\n" .
- "Content-Length: $content_len\r\n" .
- "Connection: Close\r\n" .
- "Host: $host:$port\r\n" .
- "\r\n" .
- $request;
-
- fputs($query_fd, $http_request, strlen($http_request));
-
- $buf = '';
- while (!feof($query_fd)) {
- $buf .= fread($query_fd, 8192);
- }
-
- fclose($query_fd);
- return $buf;
- }
-
- private function find_and_decode_xml($buf)
- {
- $pos = strpos($buf, '<?xml');
- if ($pos !== false) {
- return xmlrpc_decode(substr($buf, $pos));
- }
- trigger_error("Cannot parse XML\n".$buf);
- }
-
- public function __call($method, $args)
- {
- $query = xmlrpc_encode_request($method, $args);
- if ($this->bt) {
- $this->bt->start($method . "\n" . var_export($args, true));
- }
- $answer = $this->http_post($query, $this->urlparts);
- if ($this->bt) {
- $this->bt->stop();
- }
- $result = $this->find_and_decode_xml($answer);
- if ($this->bt) {
- if (is_array($result) && isset($result['faultCode'])) {
- $this->bt->update(0, $result['faultString']);
- } else {
- $this->bt->update(count($result));
- }
- }
-
- if (is_array($result) && isset($result['faultCode'])) {
- trigger_error("Error in xmlrpc call $function\n".
- " code : {$result['faultCode']}\n".
- " message: {$result['faultString']}\n");
- return null;
- }
- return $result;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 enc=utf-8:
-?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class XnetPage extends PlatalPage
+class XnetPage extends PlPage
{
public $nomenu = false;
// {{{ function XnetPage()
- public function __construct($tpl, $type=SKINNED)
+ public function __construct()
{
- parent::__construct($tpl, $type);
+ parent::__construct();
$this->register_function('list_all_my_groups', 'list_all_my_groups');
$this->register_modifier('cat_pp', 'cat_pp');
$this->assign('it_is_xnet', true);
- if (!S::logged() && Get::has('auth')) {
- XnetSession::doAuthX();
+ global $globals;
+ $this->assign('is_logged', S::logged());
+ if ($globals->asso('id')) {
+ $this->assign('asso', $globals->asso());
+ $this->setType($globals->asso('cat'));
+ $this->assign('is_admin', may_update());
+ $this->assign('is_member', is_member());
}
}
}
// }}}
- // {{{ function changeTpl()
-
- public function changeTpl($tpl, $type = SKINNED)
- {
- global $globals;
- parent::changeTpl($tpl, $type);
- $this->assign('is_logged', S::logged());
- if ($globals->asso('id')) {
- $this->assign('asso', $globals->asso());
- $this->setType($globals->asso('cat'));
- $this->assign('is_admin', may_update());
- $this->assign('is_member', is_member());
- }
- }
-
- // }}}
// {{{ function setType
public function setType($type)
$sub = array();
$sub['liste des groupes'] = 'plan';
$sub['documentation'] = 'Xnet';
- $sub['signaler un bug'] = array('href' => 'send_bug', 'class' => 'popup_840x600');
+ $sub['signaler un bug'] = array('href' => 'send_bug/'.$_SERVER['REQUEST_URI'], 'class' => 'popup_840x600');
$menu["no_title"] = $sub;
$perms = S::v('perms');
}
if (S::has_perms()) {
$sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
- $sub['clear cache'] = array('href' => 'purge_cache', 'style' => 'color: gray;');
+ $sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;');
}
$menu['Administrer'] = $sub;
} elseif (S::has_perms()) {
$sub = array();
$sub['gérer les groupes'] = 'admin';
- $sub['clear cache'] = 'purge_cache';
+ $sub['clear cache'] = 'purge_cache?token=' . S::v('xsrf_token');
$menu['Administrer'] = $sub;
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class XnetSession
+class XnetSession extends PlSession
{
- // {{{ function init
+ public function __construct()
+ {
+ parent::__construct();
+ S::bootstrap('perms_backup', new PlFlagSet());
+ }
- public static function init()
+ public function startAvailableAuth()
{
- global $globals;
+ if (!(S::v('perms') instanceof PlFlagSet)) {
+ S::set('perms', S::v('perms_backup'));
+ }
- S::init();
+ if (!S::logged() && Get::has('auth')) {
+ if (!$this->start(AUTH_MDP)) {
+ return false;
+ }
+ }
+ global $globals;
if (!S::logged()) {
- // prevent connexion to be linked to deconnexion
+ // prevent connection to be linked to disconnection
if (($i = strpos($_SERVER['REQUEST_URI'], 'exit')) !== false)
$returl = "http://{$_SERVER['SERVER_NAME']}".substr($_SERVER['REQUEST_URI'], 0, $i);
else
$url .= "&challenge=" . S::v('challenge');
$url .= "&pass=" . md5(S::v('challenge') . $globals->xnet->secret);
$url .= "&url=".urlencode($returl);
- $_SESSION['loginX'] = $url;
+ S::set('loginX', $url);
}
if (S::logged() && $globals->asso()) {
if ($globals->asso('cat') == 'Promotions') {
$perms->addFlag('groupannu');
}
- $_SESSION['perms'] = $perms;
+ S::set('perms', $perms);
+ S::set('perms_backup', $perms);
}
+ return true;
}
- // }}}
- // {{{ public static function destroy()
-
- public static function destroy() {
- S::destroy();
- XnetSession::init();
- }
-
- // }}}
- // {{{ public static function doAuth()
-
- /** Try to do an authentication.
- *
- * @param page the calling page (by reference)
- */
- public static function doAuth()
+ protected function doAuth($level)
{
- if (S::identified()) { // ok, c'est bon, on n'a rien à faire
- return true;
- }
-
- if (Get::has('auth')) {
- return XnetSession::doAuthX();
+ if (S::identified()) { // ok, c'est bon, on n'a rien à faire
+ return S::i('uid');
}
-
- return false;
- }
-
- // }}}
- // {{{ doAuthCookie
-
- public static function doAuthCookie() {
- return XnetSession::doAuth();
+ if (!Get::has('auth')) {
+ return null;
+ }
+ global $globals;
+ if (md5('1' . S::v('challenge') . $globals->xnet->secret . Get::i('uid') . '1') != Get::v('auth')) {
+ return null;
+ }
+ Get::kill('auth');
+ S::set('auth', AUTH_MDP);
+ return Get::i('uid');
}
- // }}}
- // {{{ doAuthX
-
- public static function doAuthX()
+ protected function startSessionAs($user, $level)
{
- global $globals, $page;
+ global $globals;
- if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::i('uid').'1') != Get::v('auth')) {
- Get::kill('auth');
- if (!$page) {
- require_once 'xnet.inc.php';
- new_skinned_page('platal/index.tpl');
- }
- $page->kill("Erreur d'authentification avec polytechnique.org !");
+ if ($level == -1) {
+ S::set('auth', AUTH_MDP);
}
-
- $res = XDB::query("
- SELECT u.user_id AS uid, prenom, nom, perms, promo, password, FIND_IN_SET('femme', u.flags) AS femme,
- a.alias AS forlife, a2.alias AS bestalias, q.core_mail_fmt AS mail_fmt, q.core_rss_hash
- FROM auth_user_md5 AS u
- INNER JOIN auth_user_quick AS q USING(user_id)
- INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type='a_vie')
- INNER JOIN aliases AS a2 ON (u.user_id = a2.id AND FIND_IN_SET('bestalias',a2.flags))
- WHERE u.user_id = {?} AND u.perms IN('admin','user')
- LIMIT 1", Get::i('uid'));
- $_SESSION = array_merge($_SESSION, $res->fetchOneAssoc());
- $_SESSION['auth'] = AUTH_MDP;
- require_once 'xorg/session.inc.php';
- $_SESSION['perms'] =& XorgSession::make_perms(S::v('perms'));
+ $res = XDB::query('SELECT u.user_id AS uid, prenom, nom, perms, promo, password, FIND_IN_SET(\'femme\', u.flags) AS femme,
+ a.alias AS forlife, a2.alias AS bestalias, q.core_mail_fmt AS mail_fmt, q.core_rss_hash
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
+ INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type = \'a_vie\')
+ INNER JOIN aliases AS a2 ON (u.user_id = a2.id AND FIND_IN_SET(\'bestalias\', a2.flags))
+ WHERE u.user_id = {?} AND u.perms IN(\'admin\', \'user\')
+ LIMIT 1', $user);
+ $sess = $res->fetchOneAssoc();
+ $perms = $sess['perms'];
+ unset($sess['perms']);
+ $_SESSION = array_merge($_SESSION, $sess);
+ $this->makePerms($perms);
S::kill('challenge');
S::kill('loginX');
S::kill('may_update');
S::kill('is_member');
- Get::kill('auth');
Get::kill('uid');
- $path = Get::v('n');
- Get::kill('n');
Get::kill('PHPSESSID');
$args = array();
foreach($_GET as $key => $val) {
- $args[] = urlencode($key).'='.urlencode($val);
+ $args[] = urlencode($key). '=' .urlencode($val);
}
-
- http_redirect($globals->baseurl . '/' . $path, join('&', $args));
+ return true;
}
- // }}}
- // {{{ doSelfSuid
-
- public static function doSelfSuid()
+ public function doSelfSuid()
{
- if (!S::has('suid')) {
- $_SESSION['suid'] = $_SESSION;
+ if (!$this->startSUID(S::i('uid'))) {
+ return false;
}
- require_once 'xorg/session.inc.php';
- $_SESSION['perms'] =& XorgSession::make_perms('user');
+ $this->makePerms('user');
+ return true;
}
- // }}}
- // {{{ killSuid
-
- public static function killSuid()
+ public function stopSUID()
{
- if (!S::has('suid')) {
- return;
- }
$suid = S::v('suid');
+ if (!parent::stopSUID()) {
+ return false;
+ }
S::kill('suid');
S::kill('may_update');
S::kill('is_member');
- $_SESSION['perms'] = $suid['perms'];
+ S::set('perms', $suid['perms']);
+ S::set('perms_backup', $suid['perms_backup']);
+ return true;
+ }
+
+ public function makePerms($perm)
+ {
+ $flags = new PlFlagSet();
+ if ($perm == 'disabled' || $perm == 'ext') {
+ S::set('perms', $flags);
+ S::set('perms_backup', $flags);
+ return;
+ }
+ $flags->addFlag(PERMS_USER);
+ if ($perm == 'admin') {
+ $flags->addFlag(PERMS_ADMIN);
+ }
+ S::set('perms', $flags);
+ S::set('perms_backup', $flags);
}
- // }}}
+ public function sureLevel()
+ {
+ return AUTH_MDP;
+ }
}
-// }}}
// {{{ function may_update
/** Return administration rights for the current asso
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class MMList extends XmlrpcClient
+class XorgPage extends PlPage
{
- public function __construct($uid, $pass, $fqdn = null)
+ public function __construct()
{
- global $globals;
+ parent::__construct();
- $dom = is_null($fqdn) ? $globals->mail->domain : $fqdn;
- $url = "http://$uid:$pass@{$globals->lists->rpchost}:{$globals->lists->rpcport}/$dom";
- parent::__construct($url);
- if ($globals->debug & DEBUG_BT) {
- $this->bt = new PlBacktrace('MMList');
+ // Set the default page
+ $this->changeTpl('platal/index.tpl');
+ }
+
+ public function run()
+ {
+ global $globals, $platal;
+ if (isset($platal) && $platal->path == 'register') {
+ $skin = $globals->register_skin . ".tpl";
+ } else {
+ $skin = S::v('skin', $globals->skin . ".tpl");
}
+ $this->_run('skin/' . $skin);
}
}
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 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 *
+ ***************************************************************************/
+
+class XorgSession extends PlSession
+{
+ public function __construct()
+ {
+ parent::__construct();
+ S::bootstrap('perms_backup', new PlFlagSet());
+ }
+
+ public function startAvailableAuth()
+ {
+ if (!(S::v('perms') instanceof PlFlagSet)) {
+ S::set('perms', S::v('perms_backup'));
+ }
+ if (!S::logged()) {
+ $cookie = $this->tryCookie();
+ if ($cookie == 0) {
+ return $this->start(AUTH_COOKIE);
+ } else if ($cookie == 1 || $cookie == -2) {
+ return false;
+ }
+ }
+ if ((check_ip('dangerous') && S::has('uid')) || check_account()) {
+ $_SESSION['log']->log("view_page", $_SERVER['REQUEST_URI']);
+ }
+ return true;
+ }
+
+ /** Check the cookie and set the associated user_id in the auth_by_cookie session variable.
+ */
+ private function tryCookie()
+ {
+ S::kill('auth_by_cookie');
+ if (Cookie::v('ORGaccess') == '' || !Cookie::has('ORGuid')) {
+ return -1;
+ }
+
+ $res = XDB::query('SELECT user_id, password
+ FROM auth_user_md5
+ WHERE user_id = {?} AND perms IN(\'admin\', \'user\')',
+ Cookie::i('ORGuid'));
+ if ($res->numRows() != 0) {
+ list($uid, $password) = $res->fetchOneRow();
+ require_once 'secure_hash.inc.php';
+ $expected_value = hash_encrypt($password);
+ if ($expected_value == Cookie::v('ORGaccess')) {
+ S::set('auth_by_cookie', $uid);
+ return 0;
+ } else {
+ return 1;
+ }
+ }
+ return -2;
+ }
+
+ private function checkPassword($uname, $login, $response, $login_type)
+ {
+ $res = XDB::query('SELECT u.user_id, u.password
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON (a.id = u.user_id AND type != \'homonyme\')
+ WHERE a.' . $login_type . ' = {?} AND u.perms IN(\'admin\', \'user\')',
+ $login);
+ if (list($uid, $password) = $res->fetchOneRow()) {
+ require_once 'secure_hash.inc.php';
+ $expected_response = hash_encrypt("$uname:$password:" . S::v('challenge'));
+ if ($response != $expected_response) {
+ $new_password = hash_xor(Env::v('xorpass'), $password);
+ $expected_response = hash_encrypt("$uname:$new_password:" . S::v('challenge'));
+ if ($response == $expected_response) {
+ XDB::execute('UPDATE auth_user_md5
+ SET password = {?}
+ WHERE user_id = {?}',
+ $new_password, $uid);
+ }
+ }
+ if ($response != $expected_response) {
+ S::logger($uid)->log('auth_fail', 'bad password');
+ return null;
+ }
+ return $uid;
+ }
+ return null;
+ }
+
+
+ /** Check auth.
+ */
+ protected function doAuth($level)
+ {
+ global $globals;
+
+ /* Cookie authentication
+ */
+ if ($level == AUTH_COOKIE && !S::has('auth_by_cookie')) {
+ $this->tryCookie();
+ }
+ if ($level == AUTH_COOKIE && S::has('auth_by_cookie')) {
+ if (!S::logged()) {
+ S::set('auth', AUTH_COOKIE);
+ }
+ return S::i('auth_by_cookie');
+ }
+
+
+ /* We want to do auth... we must have infos from a form.
+ */
+ if (!Post::has('username') || !Post::has('response') || !S::has('challenge')) {
+ return null;
+ }
+
+ /** We come from an authentication form.
+ */
+ if (S::has('suid')) {
+ $suid = S::v('suid');
+ $login = $uname = $suid['forlife'];
+ $redirect = false;
+ } else {
+ $uname = Env::v('username');
+
+ if (Env::v('domain') == "alias") {
+ $res = XDB::query('SELECT redirect
+ FROM virtual
+ INNER JOIN virtual_redirect USING(vid)
+ WHERE alias LIKE {?}',
+ $uname . '@' . $globals->mail->alias_dom);
+ $redirect = $res->fetchOneCell();
+ if ($redirect) {
+ $login = substr($redirect, 0, strpos($redirect, '@'));
+ } else {
+ $login = '';
+ }
+ } else {
+ $login = $uname;
+ $redirect = false;
+ }
+ }
+
+ $uid = $this->checkPassword($uname, $login, Post::v('response'), (!$redirect && preg_match('/^\d*$/', $uname)) ? 'id' : 'alias');
+ if (!is_null($uid)) {
+ S::set('auth', AUTH_MDP);
+ if (Post::has('domain')) {
+ if (($domain = Post::v('domain', 'login')) == 'alias') {
+ setcookie('ORGdomain', "alias", (time() + 25920000), '/', '', 0);
+ } else {
+ setcookie('ORGdomain', '', (time() - 3600), '/', '', 0);
+ }
+ // pour que la modification soit effective dans le reste de la page
+ $_COOKIE['ORGdomain'] = $domain;
+ }
+ S::kill('challenge');
+ S::logger($uid)->log('auth_ok');
+ }
+ return $uid;
+ }
+
+ protected function startSessionAs($uid, $level)
+ {
+ if ((!is_null(S::v('user')) && S::i('user') != $uid) || (S::has('uid') && S::i('uid') != $uid)) {
+ return false;
+ } else if (S::has('uid')) {
+ return true;
+ }
+ if ($level == -1) {
+ S::set('auth', AUTH_COOKIE);
+ }
+ unset($_SESSION['log']);
+ $res = XDB::query('SELECT u.user_id AS uid, prenom, prenom_ini, nom, nom_ini, nom_usage, perms, promo, promo_sortie,
+ matricule, password, FIND_IN_SET(\'femme\', u.flags) AS femme,
+ a.alias AS forlife, a2.alias AS bestalias,
+ q.core_mail_fmt AS mail_fmt, UNIX_TIMESTAMP(q.banana_last) AS banana_last, q.watch_last, q.core_rss_hash,
+ FIND_IN_SET(\'watch\', u.flags) AS watch_account, q.last_version, g.g_account_name IS NOT NULL AS googleapps
+ FROM auth_user_md5 AS u
+ INNER JOIN auth_user_quick AS q USING(user_id)
+ INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type = \'a_vie\')
+ INNER JOIN aliases AS a2 ON (u.user_id = a2.id AND FIND_IN_SET(\'bestalias\', a2.flags))
+ LEFT JOIN gapps_accounts AS g ON (u.user_id = g.l_userid AND g.g_status = \'active\')
+ WHERE u.user_id = {?} AND u.perms IN(\'admin\', \'user\')', $uid);
+ $sess = $res->fetchOneAssoc();
+ $perms = $sess['perms'];
+ unset($sess['perms']);
+ $res = XDB::query('SELECT UNIX_TIMESTAMP(s.start) AS lastlogin, s.host
+ FROM logger.sessions AS s
+ WHERE s.uid = {?} AND s.suid = 0
+ ORDER BY s.start DESC
+ LIMIT 1', $uid);
+ if ($res->numRows()) {
+ $sess = array_merge($sess, $res->fetchOneAssoc());
+ }
+ $suid = S::v('suid');
+
+ if ($suid) {
+ $logger = S::logger($uid);
+ $logger->log("suid_start", S::v('forlife')." by {$suid['uid']}");
+ $sess['suid'] = $suid;
+ } else {
+ $logger = S::logger($uid);
+ //$logger->log("connexion", Env::v('n'));
+ setcookie('ORGuid', $uid, (time() + 25920000), '/', '', 0);
+ if (Post::v('remember', 'false') == 'true') {
+ $cookie = hash_encrypt($sess['password']);
+ setcookie('ORGaccess', $cookie, (time() + 25920000), '/', '', 0);
+ if ($logger) {
+ $logger->log("cookie_on");
+ }
+ } else {
+ setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
+ if ($logger) {
+ $logger->log("cookie_off");
+ }
+ }
+ }
+
+ $_SESSION = array_merge($_SESSION, $sess);
+ $this->makePerms($perms);
+ $this->securityChecks();
+ $this->setSkin();
+ $this->updateNbNotifs();
+ check_redirect();
+ return true;
+ }
+
+ private function securityChecks()
+ {
+ $mail_subject = array();
+ if (check_account()) {
+ $mail_subject[] = 'Connexion d\'un utilisateur surveillé';
+ }
+ if (check_ip('unsafe')) {
+ $mail_subject[] = 'Une IP surveillee a tente de se connecter';
+ if (check_ip('ban')) {
+ send_warning_mail(implode(' - ', $mail_subject));
+ $this->destroy();
+ Platal::page()->kill('Une erreur est survenue lors de la procédure d\'authentification. '
+ . 'Merci de contacter au plus vite '
+ . '<a href="mailto:support@polytechnique.org">support@polytechnique.org</a>');
+ return false;
+ }
+ }
+ if (count($mail_subject)) {
+ send_warning_mail(implode(' - ', $mail_subject));
+ }
+ }
+
+ public function makePerms($perm)
+ {
+ $flags = new PlFlagSet();
+ if ($perm == 'disabled' || $perm == 'ext') {
+ S::set('perms', $flags);
+ S::set('perms_backup', $flags);
+ return;
+ }
+ $flags->addFlag(PERMS_USER);
+ if ($perm == 'admin') {
+ $flags->addFlag(PERMS_ADMIN);
+ }
+ S::set('perms', $flags);
+ S::set('perms_backup', $flags);
+ }
+
+ public function setSkin()
+ {
+ global $globals;
+ if (S::logged() && (!S::has('skin') || S::has('suid'))) {
+ $uid = S::v('uid');
+ $res = XDB::query("SELECT skin_tpl
+ FROM auth_user_quick AS a
+ INNER JOIN skins AS s ON a.skin = s.id
+ WHERE user_id = {?} AND skin_tpl != ''", $uid);
+ S::set('skin', $res->fetchOneCell());
+ }
+ }
+
+ public function sureLevel()
+ {
+ return AUTH_MDP;
+ }
+
+
+ public function updateNbNotifs()
+ {
+ require_once 'notifs.inc.php';
+ $n = select_notifs(false, S::i('uid'), S::v('watch_last'), false);
+ S::set('notifs', $n->numRows());
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
[geoloc_error]
from=webmaster@polytechnique.org
-to=geoloc@staff.polytechnique.org
+to=non-geoloc@staff.polytechnique.org
[mails_ax]
from="Amicale des Anciens de l'X" <reponses@amicale.polytechnique.org>
[googleapps]
from="Polytechnique.org" <support@polytechnique.org>
cc=validation+googleapps@polytechnique.org
+
+[xnet_unsubscription]
+from="Gestion des groupes X sur Polytechnique.net" <support@polytechnique.org>
--- /dev/null
+Subproject commit 38b7dbd95e5d725eb2b7b34a6a8fe5e0c84073f0
div.contact div.identity {
float: left;
- width: 90%;
+ width: 89%;
}
div.contact div.nom {
div.contact div.bits {
text-align: right;
float: right;
+ width: 10%;
}
div.contact div.long {
}
div.long table { width: 100%; }
-div.long td.lt { width: 35%; font-style: italic; }
-div.long td.rt { width: 65%; }
+div.long td.lt { width: 18%; font-style: italic; }
+div.long td.rt { width: 82%; }
/*******************************************************************************
6 Profil
}
.wizard .wiz_header .wiz_tab {
- background; url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
+ background: url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
height: 100%;
text-align: center;
font-size: 75%;
div.contact div.identity {
float: left;
- width: 70%;
+ width: 89%;
}
div.contact div.nom {
padding-left: 2px;
}
+div.contact div.nom a {
+ text-decoration: none;
+ font-size: 100%;
+}
+
div.contact div.appli {
}
}
div.long table { width: 100%; }
-div.long td.lt { width: 25%; font-style: italic; }
-div.long td.rt { width: 75%; }
+div.long td.lt { width: 15%; font-style: italic; }
+div.long td.rt { width: 85%; }
/*******************************************************************************
6 Profil
}
.wizard .wiz_header .wiz_tab {
- background; url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
+ background: url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
height: 100%;
text-align: center;
font-size: 75%;
}
.wizard .wiz_header .wiz_tab {
- background; url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
+ background: url('../images/skins/wiz_normal.png') #aaa top left repeat-x;
height: 100%;
text-align: center;
font-size: 75%;
{
Ajax.update_html(null, 'emails/test' + (forlife == null ? '' : '/' + forlife) + '?token=' + token,
function() {
- showTempMessage('mail_sent', "Un mail a été envoyé avec succès"
+ showTempMessage('mail_sent', "Un email a été envoyé avec succès"
+ (forlife == null ? " sur ton adresse." : " sur l'adresse de " + forlife),
true); });
return false;
function goodiesPopup(node) {
if (node.href.indexOf('ical') > -1) {
__goodies_popup(node, __goodies_ical_sites, 'Calendrier iCal');
- } else if (node.href.indexOf('rss') > -1 && (node.href.indexOf('xml') > -1 || node.href.indexOf('hash'))) {
+ } else if (node.href.indexOf('rss') > -1 && node.href.indexOf('prefs/rss') < 0 && (node.href.indexOf('xml') > -1 || node.href.indexOf('hash'))) {
__goodies_popup(node, __goodies_rss_sites, 'Fil rss');
}
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once dirname(__FILE__).'/../include/xorg.inc.php';
+require_once 'xorg.inc.php';
preg_match('!^/(moderate|admin|members|archives)/(.*)_([^_]*)(/.*)?$!', $_SERVER['REQUEST_URI'], $matches);
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once dirname(__FILE__).'/../include/xorg.inc.php';
+require_once 'xorg.inc.php';
+
+new Platal('core');
global $globals;
list($username, $path) = preg_split('/\//', $_SERVER["REQUEST_URI"], 2, PREG_SPLIT_NO_EMPTY);
<hr>
<address>Apache Server at www.carva.org Port 80</address>
</body>
+</html>
+<?php
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
***************************************************************************/
$GLOBALS['IS_XNET_SITE'] = true;
-global $platal, $globals, $page;
require_once dirname(__FILE__).'/../include/xnet.inc.php';
***************************************************************************/
require_once dirname(__FILE__).'/../include/xorg.inc.php';
-global $globals, $platal, $page;
if (!($path = Env::v('n')) || ($path{0} < 'A' || $path{0} > 'Z')) {
-
$platal = new Platal('auth', 'carnet', 'email', 'events', 'forums',
'geoloc', 'lists', 'marketing', 'payment', 'platal',
'profile', 'register', 'search', 'stats', 'admin',
'fusionax',
'gadgets', 'googleapps');
$platal->run();
-
exit;
}
+++ /dev/null
-/globals.inc.php
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-global $page;
-
function applis_options($current=0) {
$html = '<option value="-1"></option>';
$res = XDB::iterator("select * from applis_def order by text");
$params['selected'] = 0;
return applis_options($params['selected']);
}
-$page->register_function('applis_options','_applis_options_smarty');
+Platal::page()->register_function('applis_options','_applis_options_smarty');
/** affiche un Array javascript contenant les types de chaque appli
}
return $html;
}
-$page->register_function('applis_type','applis_type');
+Platal::page()->register_function('applis_type','applis_type');
/** affiche tous les types possibles d'applis
*/
$arr_appli = $res->fetchOneAssoc();
return str_replace(")","",str_replace("set(","",$arr_appli["Type"]));
}
-$page->register_function('applis_type_all','applis_type_all');
+Platal::page()->register_function('applis_type_all','applis_type_all');
/** formatte une ecole d'appli pour l'affichage
*/
extract($params);
return applis_fmt($type, $text, $url);
}
-$page->register_function('applis_fmt','_applis_fmt');
+Platal::page()->register_function('applis_fmt','_applis_fmt');
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
// Get user profile from SQL
$req = XDB::query("SELECT nom, mail, sig,
- FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags)
+ FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags),
+ tree_unread, tree_read
FROM {$globals->banana->table_prefix}profils
WHERE uid={?}", S::i('uid'));
- if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
+ if (!(list($nom, $mail, $sig, $disp, $maj, $unread, $read) = $req->fetchOneRow())) {
$nom = S::v('prenom')." ".S::v('nom');
$mail = S::v('forlife')."@" . $globals->mail->domain;
$sig = $nom." (".S::v('promo').")";
$disp = 0;
$maj = 1;
+ $unread = 'o';
+ $read = 'dg';
}
if ($maj) {
$time = time();
Banana::$profile['autoup'] = $maj;
Banana::$profile['lastnews'] = S::v('banana_last');
Banana::$profile['subscribe'] = $req->fetchColumn();
+ Banana::$tree_unread = $unread;
+ Banana::$tree_read = $read;
// Update the "unread limit"
if (!is_null($time)) {
protected function action_updateProfile()
{
- global $page, $globals;
-
- if (!(Post::has('action') && Post::has('banananame') && Post::has('bananasig')
- && Post::has('bananadisplay') && Post::has('bananamail')
- && Post::has('bananaupdate') && Post::v('action')=="Enregistrer" ))
- {
- $req = XDB::query("
- SELECT nom, mail, sig,
- FIND_IN_SET('threads', flags),
- FIND_IN_SET('automaj', flags),
- FIND_IN_SET('xface', flags)
- FROM forums.profils
- WHERE uid = {?}", S::v('uid'));
- if (!(list($nom, $mail, $sig, $disp, $maj, $xface) = $req->fetchOneRow())) {
- $nom = S::v('prenom').' '.S::v('nom');
- $mail = S::v('forlife').'@'.$globals->mail->domain;
- $sig = $nom.' ('.S::v('promo').')';
- $disp = 0;
- $maj = 0;
- $xface = 0;
- }
- $page->assign('nom' , $nom);
- $page->assign('mail', $mail);
- $page->assign('sig', $sig);
- $page->assign('disp', $disp);
- $page->assign('maj', $maj);
- $page->assign('xface', $xface);
- } else {
- $flags = array();
+ global $globals;
+ $page = Platal::page();
+
+ $colors = glob(dirname(__FILE__) . '/../../htdocs/images/banana/m2*.gif');
+ foreach ($colors as $key=>$path) {
+ $path = basename($path, '.gif');
+ $colors[$key] = substr($path, 2);
+ }
+ $page->assign('colors', $colors);
+
+ if (Post::has('action') && Post::v('action') == 'Enregistrer') {
+ S::assert_xsrf_token();
+ $flags = new FlagSet();
if (Post::b('bananadisplay')) {
- $flags[] = 'threads';
+ $flags->addFlag('threads');
}
if (Post::b('bananaupdate')) {
- $flags[] = 'automaj';
+ $flags->addFlag('automaj');
}
if (Post::b('bananaxface')) {
- $flags[] = 'xface';
+ $flags->addFlag('xface');
+ }
+ $unread = Post::s('unread');
+ $read = Post::s('read');
+ if (!in_array($unread, $colors) || !in_array($read, $colors)) {
+ $page->trigError('Le choix de type pour l\'arborescence est invalide');
+ } elseif (XDB::execute("REPLACE INTO forums.profils (uid, sig, mail, nom, flags, tree_unread, tree_read)
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
+ S::v('uid'), Post::v('bananasig'),
+ Post::v('bananamail'), Post::v('banananame'),
+ $flags, $unread, $read)) {
+ $page->trigSuccess("Ton profil a été enregistré avec succès.");
+ } else {
+ $page->trigError("Une erreur s'est produite lors de l'enregistrement de ton profil");
}
- XDB::execute("REPLACE INTO forums.profils (uid, sig, mail, nom, flags)
- VALUES ({?}, {?}, {?}, {?}, {?})",
- S::v('uid'), Post::v('bananasig'),
- Post::v('bananamail'), Post::v('banananame'),
- implode(',', $flags));
}
+
+ $req = XDB::query("
+ SELECT nom, mail, sig,
+ FIND_IN_SET('threads', flags),
+ FIND_IN_SET('automaj', flags),
+ FIND_IN_SET('xface', flags),
+ tree_unread,
+ tree_read
+ FROM forums.profils
+ WHERE uid = {?}", S::v('uid'));
+ if (!(list($nom, $mail, $sig, $disp, $maj, $xface, $unread, $read) = $req->fetchOneRow())) {
+ $nom = S::v('prenom').' '.S::v('nom');
+ $mail = S::v('forlife').'@'.$globals->mail->domain;
+ $sig = $nom.' ('.S::v('promo').')';
+ $disp = 0;
+ $maj = 0;
+ $xface = 0;
+ $unread = 'o';
+ $read = 'dg';
+ }
+ $page->assign('nom' , $nom);
+ $page->assign('mail', $mail);
+ $page->assign('sig', $sig);
+ $page->assign('disp', $disp);
+ $page->assign('maj', $maj);
+ $page->assign('xface', $xface);
+ $page->assign('unread', $unread);
+ $page->assign('read', $read);
return null;
}
}
function hook_makeJs($src)
{
- global $page;
- $page->addJsLink("$src.js");
+ Platal::page()->addJsLink("$src.js");
return ' ';
}
protected function prepare()
{
$tpl = parent::prepare();
- global $wiz, $page;
+ global $wiz;
$wiz = new PlWizard('Banana', 'core/plwizard.tpl', true, false);
foreach ($this->pages as $name=>&$mpage) {
$wiz->addPage($this->handler, $mpage['text'], $name);
}
- $wiz->apply($page, $this->base, $this->page);
+ $wiz->apply(Platal::page(), $this->base, $this->page);
return $tpl;
}
}
return 'banana/index.tpl';
}
- public function prepare(PlatalPage &$page, $id)
+ public function prepare(PlPage &$page, $id)
{
}
$sig = $nom . ' (' . S::v('promo') . ')';
Banana::$msgedit_headers['X-Org-Mail'] = S::v('forlife') . '@' . $globals->mail->domain;
+ // Tree color
+ $req = XDB::query("SELECT tree_unread, tree_read
+ FROM {$globals->banana->table_prefix}profils
+ WHERE uid={?}", S::i('uid'));
+ if (!(list($unread, $read) = $req->fetchOneRow())) {
+ $unread = 'o';
+ $read = 'dg';
+ }
+ Banana::$tree_unread = $unread;
+ Banana::$tree_read = $read;
+
// Build user profile
Banana::$profile['headers']['From'] = "$nom <$mail>";
Banana::$profile['headers']['Organization'] = make_Organization();
function __construct($forlife, $params = null)
{
+ ini_set('memory_limit', '128M');
+
global $globals;
ModerationBanana::$client = $params['client'];
ModerationBanana::$listname = $params['listname'];
public function trig($msg)
{
- global $page;
- if ($page) {
- $page->trigError($msg);
- }
+ Platal::page()->trigError($msg);
return true;
}
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-function smarty_function_xsrf_token_field($params, &$smarty) {
- if (S::has('xsrf_token')) {
- return '<input type="hidden" name="token" value="' . S::v('xsrf_token') . '" />';
+function __autoload($cls)
+{
+ if (!pl_autoload($cls)) {
+ $cls = strtolower($cls);
+ if (substr($cls, -3, 3) == 'req') {
+ @include 'validations.inc.php';
+ return;
+ } else if (substr($cls, 0, 6) == 'banana') {
+ require_once 'banana/banana.inc.php';
+ Banana::load(substr($cls, 6));
+ return;
+ }
+ @include "$cls.inc.php";
}
- return '';
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.misc.inc.php");
-
define("SUCCESS", 1);
define("ERROR_INACTIVE_REDIRECTION", 2);
define("ERROR_INVALID_EMAIL", 3);
SET panne_level = IF(flags = 'panne', panne_level - 1, panne_level),
flags = 'active'
WHERE uid={?} AND email={?}", $this->uid, $this->email);
- $_SESSION['log']->log("email_on", $this->email.($this->uid!=S::v('uid') ? "(admin on {$this->uid})" : ""));
+ S::logger()->log("email_on", $this->email.($this->uid!=S::v('uid') ? "(admin on {$this->uid})" : ""));
$this->active = true;
$this->broken = false;
}
if ($this->active) {
XDB::execute("UPDATE emails SET flags =''
WHERE uid={?} AND email={?}", $this->uid, $this->email);
- $_SESSION['log']->log("email_off",$this->email.($this->uid != S::v('uid') ? "(admin on {$this->uid})" : "") );
+ S::logger()->log("email_off",$this->email.($this->uid != S::v('uid') ? "(admin on {$this->uid})" : "") );
$this->active = false;
}
}
$res = XDB::query("SELECT mail_storage
FROM auth_user_md5
WHERE user_id = {?}", $this->uid);
- return new FlagSet($res->fetchOneCell());
+ return new PlFlagSet($res->fetchOneCell());
}
// Updates the list of active storages.
{
XDB::execute("UPDATE auth_user_md5
SET mail_storage = {?}
- WHERE user_id = {?}", $storages->flags(), $this->uid);
+ WHERE user_id = {?}", $storages, $this->uid);
}
// Returns the list of allowed storages for the @p user.
return ERROR_INACTIVE_REDIRECTION;
}
XDB::execute('DELETE FROM emails WHERE uid={?} AND email={?}', $this->uid, $email);
- $_SESSION['log']->log('email_del',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
+ S::logger()->log('email_del',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
foreach ($this->emails as $i => $mail) {
if ($email == $mail->email) {
unset($this->emails[$i]);
}
XDB::execute('REPLACE INTO emails (uid,email,flags) VALUES({?},{?},"active")', $this->uid, $email);
if ($logger = S::v('log', null)) { // may be absent --> step4.php
- $logger->log('email_add',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
+ S::logger()->log('email_add',$email.($this->uid!=S::v('uid') ? " (admin on {$this->uid})" : ""));
}
foreach ($this->emails as $mail) {
if ($mail->email == $email_stripped) {
$where . ($direct ? "gcim.infos = 'smallest'" : '1'),
'gc.id, gc.alias',
'pop DESC');
- while ($c = $cityres->next()) {
+ foreach($cityres as $c) {
if ($c['pop'] > 0) {
$city = $c;
$city['x'] = geoloc_to_x($c['x'], $c['y']);
'NULL');
$maxpop = 0;
- $nbentities = $nbcities + $countryres->total();
- while ($c = $countryres->next()) {
+ $nbentities = $nbcities + count($countryres);
+ foreach ($countryres as $c) {
$c['latPop'] /= $c['nbPop'];
$c['lonPop'] /= $c['nbPop'];
$c['rad'] = size_of_territory($c['nbPop']);
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class PlatalGlobals
-{
- public $session;
-
- /** The x.org version */
- public $version = '@VERSION@';
- public $debug = 0;
- public $mode = 'rw'; // 'rw' => read/write,
- // 'r' => read/only
- // '' => site down
-
- /** db params */
- public $dbdb = 'x4dat';
- public $dbhost = 'localhost';
- public $dbuser = 'x4dat';
- public $dbpwd = 'x4dat';
- public $dbcharset = 'utf8';
-
- /** default skin */
- public $skin;
- public $register_skin;
-
- /** paths */
- public $baseurl;
- public $baseurl_http;
- public $spoolroot;
-
- public $locale;
- public $timezone;
-
- public function __construct($sess)
- {
- $this->session = $sess;
- $this->spoolroot = dirname(dirname(__FILE__));
-
- $this->read_config();
- if (isset($_SERVER) && isset($_SERVER['SERVER_NAME'])) {
- $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
- $this->baseurl = @trim($base .$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
- $this->baseurl_http = @trim('http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
- }
-
- $this->setlocale();
- }
-
- private function read_ini_file($filename)
- {
- $array = parse_ini_file($filename, true);
- if (!is_array($array)) {
- return;
- }
- foreach ($array as $cat => $conf) {
- $c = strtolower($cat);
- foreach ($conf as $k => $v) {
- if ($c == 'core' && property_exists($this, $k)) {
- $this->$k=$v;
- } else {
- if (!isset($this->$c)) {
- $this->$c = new stdClass;
- }
- $this->$c->$k = $v;
- }
- }
- }
- }
-
- private function read_config()
- {
- $this->read_ini_file($this->spoolroot.'/configs/platal.ini');
- $this->read_ini_file($this->spoolroot.'/configs/platal.conf');
- if (file_exists($this->spoolroot.'/spool/conf/platal.dynamic.conf')) {
- $this->read_ini_file($this->spoolroot.'/spool/conf/platal.dynamic.conf');
- }
- }
-
- /** Writes an ini file separated in categories
- * @param filename the name of the file to write (overwrite existing)
- * @param categories an array of categories (array of keys and values)
- */
- private static function write_ini_file($filename, &$categories)
- {
- // [category]
- // key = value
- $f = fopen($filename, 'w');
- foreach ($categories as $cat => $conf) {
- fwrite($f, '; {{{ '.$cat."\n\n");
- fwrite($f, '['.$cat.']'."\n\n");
- foreach ($conf as $k => $v) {
- fwrite($f, $k.' = "'.str_replace('"','\\"',$v).'"'."\n");
- }
- fwrite($f, "\n".'; }}}'."\n");
- }
- fwrite($f, '; vim:set syntax=dosini foldmethod=marker:'."\n");
- fclose($f);
- }
-
- /** Change dynamic config file
- * @param conf array of keys and values to add or replace
- * @param category name of category to change
- *
- * Opens the dynamic conf file and set values from conf in specified
- * category. Updates config vars too.
- */
- public function change_dynamic_config($conf, $category = 'Core')
- {
- $dynamicfile = $this->spoolroot.'/spool/conf/platal.dynamic.conf';
- if (file_exists($dynamicfile)) {
- $array = parse_ini_file($dynamicfile, true);
- } else {
- $array = null;
- }
- if (!is_array($array)) {
- // dynamic conf is empty
- $array = array($category => $conf);
- } else {
- // looks for a category that looks the same (case insensitive)
- $same = false;
- foreach ($array as $m => &$c) {
- if (strtolower($m) == strtolower($category)) {
- $same = $m;
- break;
- }
- }
- if (!$same) {
- // this category doesn't exist yet
- $array[$category] = $conf;
- } else {
- // this category already exists
- $conflower = array();
- foreach ($conf as $k => $v) {
- $conflower[strtolower($k)] = $v;
- }
- // $conflower is now same as $conf but with lower case keys
- // replaces values of keys that already exists
- foreach ($array[$same] as $k => $v) {
- if (isset($conflower[strtolower($k)])) {
- $array[$same][$k] = $conflower[strtolower($k)];
- unset($conflower[strtolower($k)]);
- }
- }
- // add new keys
- foreach ($conf as $k => $v) {
- if (isset($conflower[strtolower($k)])) {
- $array[$same][$k] = $v;
- }
- }
- }
- }
- // writes the file over
- PlatalGlobals::write_ini_file($dynamicfile, $array);
- // rereads the new config to correctly set vars
- $this->read_ini_file($dynamicfile);
- }
-
- public function bootstrap($conf, $callback, $category = 'Core')
- {
- $bootstrap = false;
- $category = strtolower($category);
- foreach ($conf as $key) {
- if (!isset($this->$category->$key)) {
- $bootstrap = true;
- break;
- }
- }
- if ($bootstrap) {
- call_user_func($callback);
- }
- }
-
- private function setlocale()
- {
- setlocale(LC_MESSAGES, $this->locale);
- setlocale(LC_TIME, $this->locale);
- setlocale(LC_CTYPE, $this->locale);
- date_default_timezone_set($this->timezone);
- mb_internal_encoding("UTF-8");
- }
-
- public function asso($key=null)
- {
- static $aid = null;
-
- if (is_null($aid)) {
- $gp = Get::v('n');
- if ($p = strpos($gp, '/')) {
- $gp = substr($gp, 0, $p);
- }
-
- if ($gp) {
- $res = XDB::query('SELECT a.*, d.nom AS domnom, FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc
- FROM groupex.asso AS a
- LEFT JOIN groupex.dom AS d ON d.id = a.dom
- WHERE diminutif = {?}', $gp);
- if (!($aid = $res->fetchOneAssoc())) {
- $aid = array();
- }
- } else {
- $aid = array();
- }
- }
- if (empty($key)) {
- return $aid;
- } elseif ( isset($aid[$key]) ) {
- return $aid[$key];
- } else {
- return null;
- }
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
private function getUser($uid, $email)
{
- require_once("xorg.misc.inc.php");
$res = XDB::query("SELECT FIND_IN_SET('femme', flags) AS sexe, nom, prenom, promo
FROM auth_user_md5
WHERE user_id = {?}", $uid);
return $this->signature;
}
- protected function prepareText(PlatalPage &$page, array $user)
+ protected function prepareText(PlPage &$page, array $user)
{
$page->assign('intro', $this->getIntro());
$page->assign('u', $user);
public function getText(array $user)
{
- $page = new XorgPage('marketing/marketing.mail.tpl', NO_SKIN);
+ $page = new XorgPage();
+ $page->changeTpl('marketing/marketing.mail.tpl', NO_SKIN);
$this->prepareText($page, $user);
return $page->raw();
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.misc.inc.php");
-
// {{{ class MassMailer
abstract class MassMailer
WHERE ni_id={?}', $uid);
XDB::execute('DELETE FROM watch_nonins WHERE ni_id={?}', $uid);
}
- require_once 'xorg.misc.inc.php';
- update_NbNotifs();
+ Platal::session()->updateNbNotifs();
}
// }}}
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-$TIME_BEGIN = microtime(true);
-
-define('AUTH_PUBLIC', 0);
-define('AUTH_COOKIE', 1);
-define('AUTH_MDP', 2);
-
-define('PERMS_EXT', 'ext');
-define('PERMS_USER', 'user');
-define('PERMS_ADMIN', 'admin');
-
-define('SKINNED', 0);
-define('SIMPLE', 1);
-define('NO_SKIN', 2);
-
-define('NO_AUTH', 0);
-define('DO_AUTH', 1);
-define('NO_HTTPS', 2);
-
-define('DEBUG_BT', 1);
-define('DEBUG_VALID', 2);
-define('DEBUG_SMARTY', 4);
-
-function __autoload($cls)
-{
- $cls = strtolower($cls);
- $path = dirname(dirname(__FILE__));
- if (!@include "$path/classes/$cls.php") {
- if (substr($cls, -3, 3) == 'req') {
- @include 'validations.inc.php';
- return;
- } else if (substr($cls, 0, 6) == 'banana') {
- require_once 'banana/banana.inc.php';
- Banana::load(substr($cls, 6));
- return;
- }
- @include "$cls.inc.php";
- }
-}
-__autoload('Env');
-
-function pl_error_handler($errno, $errstr, $errfile, $errline)
-{
- static $errortype;
- if (!error_reporting())
- return;
-
- if (!isset($errortype)) {
- $errortype = array (
- E_ERROR => "Error",
- E_WARNING => "Warning",
- E_PARSE => "Parsing Error",
- E_NOTICE => "Notice",
- E_CORE_ERROR => "Core Error",
- E_CORE_WARNING => "Core Warning",
- E_COMPILE_ERROR => "Compile Error",
- E_COMPILE_WARNING => "Compile Warning",
- E_USER_ERROR => "User Error",
- E_USER_WARNING => "User Warning",
- E_USER_NOTICE => "User Notice",
- E_STRICT => "Runtime Notice",
- E_RECOVERABLE_ERROR => "Recoverable Error"
- );
- }
-
- global $globals;
- if (isset($globals) && !$globals->debug) {
- if ($errno == E_NOTICE || $errno == E_USER_NOTICE || $errno == E_STRICT) {
- return;
- }
- }
-
- $type = isset($errortype[$errno]) ? $errortype[$errno] : $errno;
- $errstr = utf8_encode(htmlentities($errstr));
- $GLOBALS['pl_errors'][] =
- "<div class='phperror'>".
- "<strong>{$type}</strong> <em>$errstr</em><br />".
- "<tt>$errfile : $errline</tt>".
- "</div>";
-}
-
-function pl_clear_errors()
-{
- unset($GLOBALS['pl_errors']);
-}
-
-function pl_dump_env()
-{
- echo "<div class='phperror'><pre>";
- echo "\nSESSION: "; var_export($_SESSION);
- echo "\nPOST: "; var_export($_POST);
- echo "\nGET: "; var_export($_GET);
- echo "\nCOOKIE: "; var_export($_COOKIE);
- echo "</pre></div>";
-}
-
-function pl_print_errors()
-{
- if (!empty($GLOBALS['pl_errors'])) {
- print join("\n", $GLOBALS['pl_errors']);
- }
-}
-
-set_error_handler('pl_error_handler', E_ALL | E_STRICT);
-register_shutdown_function('pl_print_errors');
-// register_shutdown_function('pl_dump_env');
-
-/** Check if the string is utf8
- */
-function is_utf8($s)
-{
- return @iconv('utf-8', 'utf-8', $s) == $s;
-}
-
-/** vérifie si une adresse email est bien formatée * ATTENTION, cette fonction ne doit pas être appelée sur une chaîne ayant subit un addslashes (car elle accepte le "'" qui it alors un "\'"
- * @param $email l'adresse email a verifier
- * @return BOOL */
-function isvalid_email($email)
-{
- // la rfc2822 authorise les caractères "a-z", "0-9", "!", "#", "$", "%", "&", "'", "*", "+", "-", "/", "=", "?", "^", `", "{", "|", "}", "~" aussi bien dans la partie locale que dans le domaine.
- // Pour la partie locale, on réduit cet ensemble car il n'est pas utilisé.
- // Pour le domaine, le système DNS limite à [a-z0-9.-], on y ajoute le "_" car il est parfois utilisé.
- return preg_match("/^[a-z0-9_.'+-]+@[a-z0-9._-]+\.[a-z]{2,6}$/i", $email);
-}
-
-function pl_url($path, $query = null, $fragment = null)
-{
- global $platal;
-
- $base = $platal->ns . $path . ($query ? '?'.$query : '');
- return $fragment ? $base.'#'.$fragment : $base;
-}
-
-function pl_self($n = null) {
- global $platal;
- return $platal->pl_self($n);
-}
-
-function http_redirect($fullurl)
-{
- if (count($_SESSION)) {
- session_write_close();
- }
- header('Location: '.$fullurl);
- exit;
-}
-
-function pl_redirect($path, $query = null, $fragment = null)
-{
- global $globals;
- http_redirect($globals->baseurl . '/' . pl_url($path, $query, $fragment));
-}
-
-function pl_entities($text, $mode = ENT_COMPAT)
-{
- return htmlentities($text, $mode, 'UTF-8');
-}
-
-function pl_entity_decode($text, $mode = ENT_COMPAT)
-{
- return html_entity_decode($text, $mode, 'UTF-8');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
function init_rss($template, $alias, $hash, $require_uid = true)
{
- global $page;
+ $page =& Platal::page();
$page->changeTpl($template, NO_SKIN);
$page->register_modifier('rss_date', '_rss_encode_date');
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2008 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 *
+ ***************************************************************************/
+
+/******************************************************************************
+ * Security functions
+ *****************************************************************************/
+
+function check_ip($level)
+{
+ if (empty($_SERVER['REMOTE_ADDR'])) {
+ return false;
+ }
+ if (empty($_SESSION['check_ip'])) {
+ $ips = array();
+ if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
+ $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+ }
+ $ips[] = $_SERVER['REMOTE_ADDR'];
+ foreach ($ips as &$ip) {
+ $ip = '(ip & mask) = (' . ip_to_uint($ip) . '& mask)';
+ }
+ $res = XDB::query('SELECT state, description
+ FROM ip_watch
+ WHERE ' . implode(' OR ', $ips) . '
+ ORDER BY state DESC');
+ if ($res->numRows()) {
+ $state = $res->fetchOneAssoc();
+ $_SESSION['check_ip'] = $state['state'];
+ $_SESSION['check_ip_desc'] = $state['description'];
+ } else {
+ $_SESSION['check_ip'] = 'safe';
+ }
+ }
+ $test = array();
+ switch ($level) {
+ case 'unsafe': $test[] = 'unsafe';
+ case 'dangerous': $test[] = 'dangerous';
+ case 'ban': $test[] = 'ban'; break;
+ default: return false;
+ }
+ return in_array($_SESSION['check_ip'], $test);
+}
+
+function check_email($email, $message)
+{
+ $res = XDB::query("SELECT state, description
+ FROM emails_watch
+ WHERE state != 'safe' AND email = {?}", $email);
+ if ($res->numRows()) {
+ send_warning_mail($message);
+ return true;
+ }
+ return false;
+}
+
+function check_account()
+{
+ return S::v('watch_account');
+}
+
+function check_redirect($red = null)
+{
+ require_once 'emails.inc.php';
+ if (is_null($red)) {
+ $red = new Redirect(S::v('uid'));
+ }
+ if ($red->get_uid() == S::v('uid')) {
+ $_SESSION['no_redirect'] = !$red->other_active('');
+ $_SESSION['mx_failures'] = $red->get_broken_mx();
+ }
+}
+
+function send_warning_mail($title)
+{
+ global $globals;
+ $mailer = new PlMailer();
+ $mailer->setFrom("webmaster@" . $globals->mail->domain);
+ $mailer->addTo($globals->core->admin_email);
+ $mailer->setSubject("[Plat/al Security Alert] $title");
+ $mailer->setTxtBody("Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n"
+ ."Identifiants de connexion :\n" . var_export($_SERVER, true));
+ $mailer->send();
+}
+
+function kill_sessions()
+{
+ assert(S::has_perms());
+ shell_exec('sudo -u root ' . dirname(dirname(__FILE__)) . '/bin/kill_sessions.sh');
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-
-require_once("xorg.inc.php");
-
require_once('user.func.inc.php');
function is_ax_key_missing() {
// Defaut callback to call when a login is not found
function _default_user_callback($login)
{
- global $page;
- $page->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login");
+ Platal::page()->trigError("Il n'y a pas d'utilisateur avec l'identifiant : $login");
return;
}
function get_user_login($data, $get_forlife = false, $callback = '_default_user_callback')
{
- global $globals, $page;
+ global $globals;
if (is_numeric($data)) {
$res = XDB::query("SELECT alias FROM aliases WHERE type='a_vie' AND id={?}", $data);
default:
if (S::has_perms()) {
$aliases = $res->fetchColumn();
- $page->trigError("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases));
+ Platal::page()->trigError("Il y a $i utilisateurs avec cette adresse mail : ".join(', ', $aliases));
} else {
$res->free();
}
if (strlen(trim($members)) == 0) {
return null;
}
- $members = explode(' ', $members);
+ $members = split("[; ,\r\n\|]+", $members);
}
if ($members) {
$list = array();
foreach ($members as $i => $alias) {
+ $alias = trim($alias);
+ if (empty($alias)) {
+ continue;
+ }
if (($login = get_user_forlife($alias, $callback)) !== false) {
$list[$i] = $login;
- } else if(!$strict) {
+ } else if (!$strict) {
$list[$i] = $alias;
+ } else {
+ global $globals;
+ if (strpos($alias, '@') !== false) {
+ list($user, $dom) = explode('@', $alias);
+ if ($dom != $globals->mail->domain && $dom != $globals->mail->domain2) {
+ $list[$i] = $alias;
+ }
+ }
}
}
return $list;
}
$sql = "SELECT user_id, nom, prenom, promo
FROM auth_user_md5
- WHERE $where
+ WHERE $where AND perms = 'pending'
ORDER BY promo, nom, prenom";
if ($iterator) {
return XDB::iterator($sql, $nom, $prenom, $promo);
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once('xorg.misc.inc.php');
require_once('user.func.inc.php');
global $globals;
: "");
}
+ public function bounds()
+ {
+ $order = Env::v('order', $this->defaultkey);
+ $show_bounds = 0;
+ if (($order == "name") || ($order == "-name")) {
+ $this->bound_field = "nom";
+ $show_bounds = 1;
+ } elseif (($order == "promo") || ($order == "-promo")) {
+ $this->bound_field = "promo";
+ $show_bounds = -1;
+ }
+ if ($order{0} == '-') {
+ $show_bounds = -$show_bounds;
+ }
+ return $show_bounds;
+ }
+
public function templateName()
{
return 'include/plview.minifiche.tpl';
return "INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)";
}
+ public function bounds()
+ {
+ $order = Env::v('order', $this->defaultkey);
+ $show_bounds = 0;
+ if (($order == "name") || ($order == "-name")) {
+ $this->bound_field = "nom";
+ $show_bounds = 1;
+ } elseif (($order == "promo") || ($order == "-promo")) {
+ $this->bound_field = "promo";
+ $show_bounds = -1;
+ }
+ if ($order{0} == '-') {
+ $show_bounds = -$show_bounds;
+ }
+ return $show_bounds;
+ }
+
public function templateName()
{
return 'include/plview.referent.tpl';
INNER JOIN profile_names_display AS nd ON (nd.user_id = u.user_id)";
}
+ public function bounds()
+ {
+ $order = Env::v('order', $this->defaultkey);
+ $show_bounds = 0;
+ if (($order == "name") || ($order == "-name")) {
+ $this->bound_field = "nom";
+ $show_bounds = 1;
+ } elseif (($order == "promo") || ($order == "-promo")) {
+ $this->bound_field = "promo";
+ $show_bounds = -1;
+ }
+ if ($order{0} == '-') {
+ $show_bounds = -$show_bounds;
+ }
+ return $show_bounds;
+ }
+
public function templateName()
{
return 'include/plview.trombi.tpl';
}
- public function apply(PlatalPage &$page)
+ public function apply(PlPage &$page)
{
if (!empty($GLOBALS['IS_XNET_SITE'])) {
global $globals;
return $args;
}
- public function apply(PlatalPage &$page)
+ public function apply(PlPage &$page)
{
require_once 'geoloc.inc.php';
require_once '../modules/search/search.inc.php';
: "");
}
- public function apply(PlatalPage &$page)
+ public function apply(PlPage &$page)
{
$page->assign_by_ref('set',
$this->set->get($this->fields(), $this->joins(), null, null, null, 5, 0));
define('SIZE_MAX', 32768);
-require_once dirname(__FILE__) . '/../classes/xdb.php';
+global $globals;
+require_once $globals->spoolroot . '/core/classes/xdb.php';
/**
* Iterator class, that lists objects through the database
$this->uid, $this->type, $this, $this->stamp);
global $globals;
- update_NbValid();
+ $globals->updateNbValid();
return true;
}
$success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?} AND stamp={?}',
$this->uid, $this->type, $this->stamp);
}
- update_NbValid();
+ $globals->updateNbValid();
return $success;
}
if ($this->commit()) {
$this->sendmail(true);
$this->clean();
- $this->trigSuccess('Mail de validation envoyé');
+ $this->trigSuccess('Email de validation envoyé');
return true;
} else {
$this->trigError('Erreur lors de la validation');
if (Env::v('comm')) {
$this->sendmail(false);
$this->clean();
- $this->trigSuccess('Mail de refus envoyé');
+ $this->trigSuccess('Email de refus envoyé');
return true;
} else {
$this->trigError('pas de motivation pour le refus !!!');
protected function trigError($msg)
{
- global $page;
- $page->trigError($msg);
+ Platal::page()->trigError($msg);
}
protected function trigWarning($msg)
{
- global $page;
- $page->trigWarning($msg);
+ Platal::page()->trigWarning($msg);
}
protected function trigSuccess($msg)
{
- global $page;
- $page->trigSuccess($msg);
+ Platal::page()->trigSuccess($msg);
}
// }}}
protected function _mail_body($isok)
{
if ($isok) {
- return " L'adresse mail {$this->alias} que tu avais demandée vient d'être créée, tu peux désormais l'utiliser à ta convenance.".(($this->public == 'public')?" A ta demande, cette adresse apparaît maintenant sur ta fiche.":"");
+ return " L'adresse email {$this->alias} que tu avais demandée vient d'être créée, tu peux désormais l'utiliser à ta convenance.".(($this->public == 'public')?" A ta demande, cette adresse apparaît maintenant sur ta fiche.":"");
} else {
return " La demande que tu avais faite pour l'alias {$this->alias} a été refusée.";
}
private $m_reactive = false;
- public $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance).
- Si le demandeur marque sa propre adresse mail, refuser dans tous les cas.
+ public $rules = "Accepter si l'adresse email parait correcte, et pas absurde (ou si le marketeur est de confiance).
+ Si le demandeur marque sa propre adresse email, refuser dans tous les cas.
Si l'adresse proposée est surveillée, refuser.
Si le compte associé est désactivé, étudier le cas en fonction de la raison de la désactivation.";
// }}}
protected function _mail_body($isok)
{
if ($isok && !$this->m_reactive) {
- return " Un mail de contact vient d'être envoyé"
+ return " Un email de contact vient d'être envoyé"
." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour confirmer sa volonté de"
." mettre à jour sa redirection Polytechnique.org !\n\n"
."Merci de ta participation !\n";
} elseif ($isok) {
return " L'adresse de redirection {$this->m_email} de {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) "
- ."vient d'être réactivée. Un mail lui a été envoyé pour l'en informer.\n\n"
+ ."vient d'être réactivée. Un email lui a été envoyé pour l'en informer.\n\n"
."Merci de ta participation !\n";
} else {
return " Nous n'utiliserons pas cette adresse pour contacter {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
global $globals;
return
"
-Comme nous t'en avons informé par mail il y a quelques temps,
-pour respecter nos engagements en terme d'adresses e-mail devinables,
+Comme nous t'en avons informé par email il y a quelques temps,
+pour respecter nos engagements en terme d'adresses email devinables,
tu te verras bientôt retirer l'alias ".$this->loginbis."@".$globals->mail->domain." pour
ne garder que ".$this->forlife."@".$globals->mail->domain.".
public $liste;
public $desc;
+ public $asso;
+ public $domain;
public $advertise;
public $modlevel;
// }}}
// {{{ constructor
- public function __construct($_uid, $_liste, $_desc, $_advertise, $_modlevel,
- $_inslevel, $_owners, $_members, $_stamp=0)
+ public function __construct($_uid, $_asso, $_liste, $_domain, $_desc, $_advertise,
+ $_modlevel, $_inslevel, $_owners, $_members, $_stamp=0)
{
parent::__construct($_uid, false, 'liste', $_stamp);
+ $this->asso = $_asso;
$this->liste = $_liste;
+ $this->domain = $_domain;
$this->desc = $_desc;
$this->advertise = $_advertise;
$this->modlevel = $_modlevel;
protected function handle_editor()
{
+ global $globals;
+
if (Env::has('listname')) {
$this->liste = trim(Env::v('listname'));
}
+ if (Env::has('domainname')) {
+ $this->domain = trim(Env::v('domainname'));
+ }
+ if (Env::has('assotype')) {
+ $this->asso = trim(Env::v('assotype'));
+ }
+ if (!$this->asso) {
+ $this->domain = $globals->mail->domain;
+ }
return true;
}
protected function _mail_body($isok)
{
if ($isok) {
- return " La mailing list {$this->liste} que tu avais demandée vient d'être créée.";
+ return " La liste de diffusion {$this->liste} que tu avais demandée vient d'être créée.";
} else {
- return " La demande que tu avais faite pour la mailing list {$this->liste} a été refusée.";
+ return " La demande que tu avais faite pour la liste de diffusion {$this->liste} a été refusée.";
}
}
public function commit()
{
- $list = new MMList(S::v('uid'), S::v('password'));
+ global $globals;
+
+ if ($this->asso == "alias") {
+ $new = $this->liste . '@' . $this->domain;
+ XDB::query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new);
+ foreach ($this->members as $member) {
+ $res = XDB::query(
+ "SELECT a.alias, b.alias
+ FROM x4dat.aliases AS a
+ LEFT JOIN x4dat.aliases AS b ON (a.id=b.id AND b.type = 'a_vie')
+ WHERE a.alias={?} AND a.type!='homonyme'", $member);
+ list($alias, $blias) = $res->fetchOneRow();
+ $alias = empty($blias) ? $alias : $blias;
+ XDB::query(
+ "INSERT INTO x4dat.virtual_redirect (vid,redirect)
+ SELECT vid, {?}
+ FROM x4dat.virtual
+ WHERE alias={?}", $alias . "@" . $globals->mail->domain, $new);
+ }
+ return 1;
+ }
+
+ $list = new MMList(S::v('uid'), S::v('password'), $this->domain);
$ret = $list->create_list($this->liste, utf8_decode($this->desc), $this->advertise,
$this->modlevel, $this->inslevel,
$this->owners, $this->members);
$liste = strtolower($this->liste);
- if ($ret) {
- foreach(Array($liste, $liste."-owner", $liste."-admin", $liste."-bounces", $liste."-unsubscribe") as $l) {
+ if ($ret && !$this->asso) {
+ foreach(Array($liste, $liste . "-owner", $liste . "-admin", $liste . "-bounces", $liste . "-unsubscribe") as $l) {
XDB::execute("INSERT INTO aliases (alias,type) VALUES({?}, 'liste')", $l);
}
+ } elseif ($ret) {
+ foreach (Array('', 'owner', 'admin', 'bounces', 'unsubscribe') as $app) {
+ $mdir = $app == '' ? '+post' : '+' . $app;
+ if (!empty($app)) {
+ $app = '-' . $app;
+ }
+ $red = $this->domain . '_' . $liste;
+ XDB::execute('INSERT INTO x4dat.virtual (alias,type)
+ VALUES({?},{?})', $liste . $app . '@' . $this->domain, 'list');
+ XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
+ VALUES ({?}, {?})', XDB::insertId(),
+ $red . $mdir . '@listes.polytechnique.org');
+ $list->mass_subscribe($liste, join(' ', $this->members));
+ }
}
return $ret;
}
public $m_type;
public $m_data;
- public $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
- demandeur marque sa propre adresse mail, refuser dans tous les cas.
+ public $rules = "Accepter si l'adresse email parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
+ demandeur marque sa propre adresse email, refuser dans tous les cas.
Ne pas marqueter au nom de Polytechnique.org plus d'une fois par an.
Sauf abus flagrant, il n'y a pas de raison de refuser des marketing perso répétés.";
// }}}
protected function _mail_body($isok)
{
if ($isok) {
- return " Un mail de marketing vient d'être envoyé "
+ return " Un email de marketing vient d'être envoyé "
.($this->perso ? 'en ton nom' : 'en notre nom')
." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à s'inscrire !\n\n"
."Merci de ta participation !\n";
} else {
- return " Nous n'avons pas jugé bon d'envoyer de mail de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
+ return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
}
}
parent::__construct($_uid, true, 'usage');
$this->nom_usage = $_usage;
$this->reason = $_reason;
- require_once 'xorg.misc.inc.php';
$this->alias = make_username($this->prenom, $this->nom_usage);
if (!$this->nom_usage) $this->alias = "";
public $evt;
public $evt_intitule;
- public $rules = "Laisser la validation à un trésorier";
+ public $rules = "Vérifier que les balises <salutation>, <prenom>, <nom> et <montant> n'ont pas été modifiées.
+Vérifier que le demandeur n'a pas laissé les crochets [].
+Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, laisser la validation à un trésorier";
// }}}
// {{{ constructor
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once('xorg.misc.inc.php');
require_once('user.func.inc.php');
class VCardIterator implements PlIterator
public function add_user($user)
{
- $this->user_list[] = get_user_forlife($user);
- $this->count++;
+ $forlife = get_user_forlife($user, '_silent_user_callback');
+ if ($forlife) {
+ $this->user_list[] = get_user_forlife($user);
+ $this->count++;
+ }
}
public function first()
INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' )
WHERE ( redirect={?} OR redirect={?} )
AND alias LIKE '%@{$globals->mail->alias_dom}'",
- S::v('uid'),
+ $user['user_id'],
$user['forlife'].'@'.$globals->mail->domain,
$user['forlife'].'@'.$globals->mail->domain2);
$user['virtualalias'] = $res->fetchOneCell();
- $user['gpxs_vcardjoin'] = join(',', array_map(array('VCard', 'text_encode'), $user['gpxs_name']));
- $user['binets_vcardjoin'] = join(',', array_map(array('VCard', 'text_encode'), $user['binets']));
+ $user['gpxs_vcardjoin'] = join(', ', array_map(array('VCard', 'text_encode'), $user['gpxs_name']));
+ $user['binets_vcardjoin'] = join(', ', array_map(array('VCard', 'text_encode'), $user['binets']));
// get photo
if ($this->photos) {
$res = XDB::query(
header("Pragma: ");
header("Cache-Control: ");
header("Content-type: text/x-vcard; charset=UTF-8");
- header("Content-Transfer-Encoding: 8bit");
}
}
}
$table = $res->fetchOneAssoc();
$_SESSION = array_merge($_SESSION, $table, array('forlife' => Env::v('user')));
- require_once 'xorg/session.inc.php';
$_SESSION['perms'] =& XorgSession::make_perms($_SESSION['perms']);
if ($perm == 'logged' || $_SESSION['perms']->hasFlag('admin')) {
return;
exit;
}
-function wiki_apply_perms($perm) {
- global $page, $platal, $globals;
+function wiki_apply_perms($perm)
+{
+ global $platal, $globals;
+ $page =& Platal::page();
switch ($perm) {
case 'public':
pl_clear_errors();
exit;
} elseif (Env::v('action')) {
- $page->assign('xorg_extra_header', substr($wikiAll, 0, $i));
+ $page->assign('pl_extra_header', substr($wikiAll, 0, $i));
$wikiAll = substr($wikiAll, $j);
} else {
if (!$cache_exists && $wiki_exists) {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once('platal.inc.php');
-require_once('globals.inc.php');
-require_once('xnet/session.inc.php');
-$globals = new PlatalGlobals('XnetSession');
-XnetSession::init();
+define('PL_GLOBALS_CLASS', 'PlatalGlobals');
+define('PL_SESSION_CLASS', 'XnetSession');
+define('PL_PAGE_CLASS', 'XnetPage');
-function new_skinned_page($tpl_name)
-{
- global $page;
- require_once("xnet/page.inc.php");
- if (!$page instanceof XnetPage) {
- $page = new XnetPage($tpl_name);
- } else {
- $page->changeTpl($tpl_name);
- }
-}
+require_once dirname(dirname(__FILE__)) . '/core/include/platal.inc.php';
+require_once 'common.inc.php';
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once('platal.inc.php');
-require_once('globals.inc.php');
-require_once('xorg/session.inc.php');
-$globals = new PlatalGlobals('XorgSession');
-$globals->bootstrap(array('NbIns'), 'update_NbIns');
-$globals->bootstrap(array('NbValid'), 'update_NbValid');
+define('PL_GLOBALS_CLASS', 'PlatalGlobals');
+define('PL_SESSION_CLASS', 'XorgSession');
+define('PL_PAGE_CLASS', 'XorgPage');
-// {{{ class XorgPage
-
-class XorgPage extends PlatalPage
-{
- public function __construct($tpl, $type = SKINNED)
- {
- parent::__construct($tpl, $type);
- }
-
- public function run()
- {
- global $globals, $platal;
- $this->assign('globals', $globals);
- if (isset($platal) && $platal->path == 'register') {
- $skin = $globals->register_skin . ".tpl";
- } else {
- $skin = S::v('skin', $globals->skin . ".tpl");
- }
- $this->_run('skin/' . $skin);
- }
-}
-
-// {{{ function new_skinned_page()
-
-function new_skinned_page($tpl_name)
-{
- global $page;
- if (!$page instanceof XorgPage) {
- $page = new XorgPage($tpl_name);
- } else {
- $page->changeTpl($tpl_name);
- }
-}
-
-XorgSession::init();
+require_once dirname(dirname(__FILE__)) . '/core/include/platal.inc.php';
+require_once 'security.inc.php';
+require_once 'common.inc.php';
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 quoted_printable_encode($input, $line_max = 76)
-{
- $lines = preg_split("/(?:\r\n|\r|\n)/", $input);
- $eol = "\n";
- $linebreak = "=0D=0A=\n ";
- $escape = "=";
- $output = "";
-
- foreach ($lines as $j => $line) {
- $linlen = strlen($line);
- $newline = "";
- for($i = 0; $i < $linlen; $i++) {
- $c = $line{$i};
- $dec = ord($c);
- if ( ($dec == 32) && ($i == ($linlen - 1)) ) {
- // convert space at eol only
- $c = "=20";
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
- // always encode "\t", which is *not* required
- $c = $escape.strtoupper(sprintf("%02x",$dec));
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol;
- $newline = " ";
- }
- $newline .= $c;
- } // end of for
- $output .= $newline;
- if ($j<count($lines)-1) $output .= $linebreak;
- }
- return trim($output);
-}
-
-/** vérifie si une adresse email convient comme adresse de redirection
- * @param $email l'adresse email a verifier
- * @return BOOL
- */
-function isvalid_email_redirection($email)
-{
- return isvalid_email($email) &&
- !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
-}
-
-/** genere une chaine aleatoire de 22 caracteres ou moins
- * @param $len longueur souhaitée, 22 par défaut
- * @return la chaine aleatoire qui contient les caractères [A-Za-z0-9+/]
- */
-function rand_token($len = 22)
-{
- $len = max(2, $len);
- $len = min(50, $len);
- $fp = fopen('/dev/urandom', 'r');
- // $len * 2 is certainly an overkill,
- // but HEY, reading 40 bytes from /dev/urandom is not that slow !
- $token = fread($fp, $len * 2);
- fclose($fp);
- $token = base64_encode($token);
- $token = preg_replace("![Il10O+/]!", "", $token);
- $token = substr($token,0,$len);
- return $token;
-}
-
-/** genere une chaine aleatoire convenable pour une url
- * @param $len longueur souhaitée, 22 par défaut
- * @return la chaine aleatoire
- */
-function rand_url_id($len = 22)
-{
- return rand_token($len);
-}
-
-
-/** genere une chaine aleatoire convenable pour un mot de passe
- * @return la chaine aleatoire
- */
-function rand_pass()
-{
- return rand_token(8);
-}
-
-/** Remove accent from a string and replace them by the nearest letter
- */
-global $lc_convert, $uc_convert;
-$lc_convert = array('é' => 'e', 'è' => 'e', 'ë' => 'e', 'ê' => 'e',
- 'á' => 'a', 'à' => 'a', 'ä' => 'a', 'â' => 'a', 'å' => 'a', 'ã' => 'a',
- 'ï' => 'i', 'î' => 'i', 'ì' => 'i', 'í' => 'i',
- 'ô' => 'o', 'ö' => 'o', 'ò' => 'o', 'ó' => 'o', 'õ' => 'o', 'ø' => 'o',
- 'ú' => 'u', 'ù' => 'u', 'û' => 'u', 'ü' => 'u',
- 'ç' => 'c', 'ñ' => 'n');
-$uc_convert = array('É' => 'E', 'È' => 'E', 'Ë' => 'E', 'Ê' => 'E',
- 'Á' => 'A', 'À' => 'A', 'Ä' => 'A', 'Â' => 'A', 'Å' => 'A', 'Ã' => 'A',
- 'Ï' => 'I', 'Î' => 'I', 'Ì' => 'I', 'Í' => 'I',
- 'Ô' => 'O', 'Ö' => 'O', 'Ò' => 'O', 'Ó' => 'O', 'Õ' => 'O', 'Ø' => 'O',
- 'Ú' => 'U', 'Ù' => 'U', 'Û' => 'U', 'Ü' => 'U',
- 'Ç' => 'C', 'Ñ' => 'N');
-
-function replace_accent($string)
-{
- global $lc_convert, $uc_convert;
- $string = strtr($string, $lc_convert);
- return strtr($string, $uc_convert);
-}
-
-/** creates a username from a first and last name
- *
- * @param $prenom the firstname
- * @param $nom the last name
- *
- * return STRING the corresponding username
- */
-function make_username($prenom,$nom)
-{
- /* on traite le prenom */
- $prenomUS=replace_accent(trim($prenom));
- $prenomUS=stripslashes($prenomUS);
-
- /* on traite le nom */
- $nomUS=replace_accent(trim($nom));
- $nomUS=stripslashes($nomUS);
-
- // calcul du login
- $username = strtolower($prenomUS.".".$nomUS);
- $username = str_replace(" ","-",$username);
- $username = str_replace("'","",$username);
- return $username;
-}
-
-/* Un soundex en français posté par Frédéric Bouchery
- Voici une adaptation en PHP de la fonction soundex2 francisée de Frédéric BROUARD (http://sqlpro.developpez.com/Soundex/).
- C'est une bonne démonstration de la force des expressions régulières compatible Perl.
-trouvé sur http://expreg.com/voirsource.php?id=40&type=Chaines%20de%20caract%E8res */
-function soundex_fr($sIn)
-{
- static $convVIn, $convVOut, $convGuIn, $convGuOut, $accents;
- if (!isset($convGuIn)) {
- global $uc_convert, $lc_convert;
- $convGuIn = array( 'GUI', 'GUE', 'GA', 'GO', 'GU', 'SCI', 'SCE', 'SC', 'CA', 'CO',
- 'CU', 'QU', 'Q', 'CC', 'CK', 'G', 'ST', 'PH');
- $convGuOut = array( 'KI', 'KE', 'KA', 'KO', 'K', 'SI', 'SE', 'SK', 'KA', 'KO',
- 'KU', 'K', 'K', 'K', 'K', 'J', 'T', 'F');
- $convVIn = array( '/E?(AU)/', '/([EA])?[UI]([NM])([^EAIOUY]|$)/', '/[AE]O?[NM]([^AEIOUY]|$)/',
- '/[EA][IY]([NM]?[^NM]|$)/', '/(^|[^OEUIA])(OEU|OE|EU)([^OEUIA]|$)/', '/OI/',
- '/(ILLE?|I)/', '/O(U|W)/', '/O[NM]($|[^EAOUIY])/', '/(SC|S|C)H/',
- '/([^AEIOUY1])[^AEIOUYLKTPNR]([UAO])([^AEIOUY])/', '/([^AEIOUY]|^)([AUO])[^AEIOUYLKTP]([^AEIOUY1])/', '/^KN/',
- '/^PF/', '/C([^AEIOUY]|$)/',
- '/C/', '/Z$/', '/(?<!^)Z+/', '/ER$/', '/H/', '/W/');
- $convVOut = array( 'O', '1\3', 'A\1',
- 'E\1', '\1E\3', 'O',
- 'Y', 'U', 'O\1', '9',
- '\1\2\3', '\1\2\3', 'N',
- 'F', 'K\1',
- 'S', 'SE', 'S', 'E', '', 'V');
- $accents = $uc_convert + $lc_convert;
- $accents['Ç'] = 'S';
- $accents['¿'] = 'E';
- }
- // Si il n'y a pas de mot, on sort immédiatement
- if ( $sIn === '' ) return ' ';
- // On supprime les accents
- $sIn = strtr( $sIn, $accents);
- // On met tout en minuscule
- $sIn = strtoupper( $sIn );
- // On supprime tout ce qui n'est pas une lettre
- $sIn = preg_replace( '`[^A-Z]`', '', $sIn );
- // Si la chaîne ne fait qu'un seul caractère, on sort avec.
- if ( strlen( $sIn ) === 1 ) return $sIn . ' ';
- // on remplace les consonnances primaires
- $sIn = str_replace( $convGuIn, $convGuOut, $sIn );
- // on supprime les lettres répétitives
- $sIn = preg_replace( '`(.)\1`', '$1', $sIn );
- // on réinterprète les voyelles
- $sIn = preg_replace( $convVIn, $convVOut, $sIn);
- // on supprime les terminaisons T, D, S, X (et le L qui précède si existe)
- $sIn = preg_replace( '`L?[TDX]S?$`', '', $sIn );
- // on supprime les E, A et Y qui ne sont pas en première position
- $sIn = preg_replace( '`(?!^)Y([^AEOU]|$)`', '\1', $sIn);
- $sIn = preg_replace( '`(?!^)[EA]`', '', $sIn);
- return substr( $sIn . ' ', 0, 4);
-}
-
-/** met les majuscules au debut de chaque atome du prénom
- * @param $prenom le prénom à formater
- * return STRING le prénom avec les majuscules
- */
-function make_firstname_case($prenom)
-{
- $prenom = strtolower($prenom);
- $pieces = explode('-',$prenom);
-
- foreach ($pieces as $piece) {
- $subpieces = explode("'",$piece);
- $usubpieces="";
- foreach ($subpieces as $subpiece)
- $usubpieces[] = ucwords($subpiece);
- $upieces[] = implode("'",$usubpieces);
- }
- return implode('-',$upieces);
-}
-
-
-function make_forlife($prenom, $nom, $promo)
-{
- $prenomUS = replace_accent(trim($prenom));
- $nomUS = replace_accent(trim($nom));
-
- $forlife = strtolower($prenomUS.".".$nomUS.".".$promo);
- $forlife = str_replace(" ","-",$forlife);
- $forlife = str_replace("'","",$forlife);
- return $forlife;
-}
-
-/** Convert ip to uint (to store it in a database)
- */
-function ip_to_uint($ip)
-{
- $part = explode('.', $ip);
- if (count($part) != 4) {
- return null;
- }
- $v = 0;
- $fact = 0x1000000;
- for ($i = 0 ; $i < 4 ; ++$i) {
- $v += $fact * $part[$i];
- $fact >>= 8;
- }
- return $v;
-}
-
-/** Convert uint to ip (to build a human understandable ip)
- */
-function uint_to_ip($uint)
-{
- return long2ip($uint);
-}
-
-
-/******************************************************************************
- * Security functions
- *****************************************************************************/
-
-function check_ip($level)
-{
- if (empty($_SERVER['REMOTE_ADDR'])) {
- return false;
- }
- if (empty($_SESSION['check_ip'])) {
- $ips = array();
- if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
- $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
- }
- $ips[] = $_SERVER['REMOTE_ADDR'];
- foreach ($ips as &$ip) {
- $ip = '(ip & mask) = (' . ip_to_uint($ip) . '& mask)';
- }
- $res = XDB::query('SELECT state, description
- FROM ip_watch
- WHERE ' . implode(' OR ', $ips) . '
- ORDER BY state DESC');
- if ($res->numRows()) {
- $state = $res->fetchOneAssoc();
- $_SESSION['check_ip'] = $state['state'];
- $_SESSION['check_ip_desc'] = $state['description'];
- } else {
- $_SESSION['check_ip'] = 'safe';
- }
- }
- $test = array();
- switch ($level) {
- case 'unsafe': $test[] = 'unsafe';
- case 'dangerous': $test[] = 'dangerous';
- case 'ban': $test[] = 'ban'; break;
- default: return false;
- }
- return in_array($_SESSION['check_ip'], $test);
-}
-
-function check_email($email, $message)
-{
- $res = XDB::query("SELECT state, description
- FROM emails_watch
- WHERE state != 'safe' AND email = {?}", $email);
- if ($res->numRows()) {
- send_warning_mail($message);
- return true;
- }
- return false;
-}
-
-function check_account()
-{
- return S::v('watch_account');
-}
-
-function check_redirect($red = null)
-{
- require_once 'emails.inc.php';
- if (is_null($red)) {
- $red = new Redirect(S::v('uid'));
- }
- if ($red->get_uid() == S::v('uid')) {
- $_SESSION['no_redirect'] = !$red->other_active('');
- $_SESSION['mx_failures'] = $red->get_broken_mx();
- }
-}
-
-function send_warning_mail($title)
-{
- global $globals;
- $mailer = new PlMailer();
- $mailer->setFrom("webmaster@" . $globals->mail->domain);
- $mailer->addTo($globals->core->admin_email);
- $mailer->setSubject("[Plat/al Security Alert] $title");
- $mailer->setTxtBody("Identifiants de session :\n" . var_export($_SESSION, true) . "\n\n"
- ."Identifiants de connexion :\n" . var_export($_SERVER, true));
- $mailer->send();
-}
-
-function kill_sessions()
-{
- assert(S::has_perms());
- shell_exec('sudo -u root ' . dirname(dirname(__FILE__)) . '/bin/kill_sessions.sh');
-}
-
-
-/******************************************************************************
- * Dynamic configuration update/edition stuff
- *****************************************************************************/
-
-function update_NbIns()
-{
- global $globals;
- $res = XDB::query("SELECT COUNT(*)
- FROM auth_user_md5
- WHERE perms IN ('admin','user') AND deces=0");
- $cnt = $res->fetchOneCell();
- $globals->change_dynamic_config(array('NbIns' => $cnt));
-}
-
-function update_NbValid()
-{
- global $globals;
- $res = XDB::query("SELECT COUNT(*)
- FROM requests");
- $globals->change_dynamic_config(array('NbValid' => $res->fetchOneCell()));
-}
-
-function update_NbNotifs()
-{
- require_once 'notifs.inc.php';
- $n = select_notifs(false, S::i('uid'), S::v('watch_last'), false);
- $_SESSION['notifs'] = $n->numRows();
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
function handler_default(&$page)
{
$page->changeTpl('admin/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration');
+ $page->setTitle('Polytechnique.org - Administration');
}
function handler_postfix_delayed(&$page)
{
$page->changeTpl('admin/postfix_delayed.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Retardés');
+ $page->setTitle('Polytechnique.org - Administration - Postfix : Retardés');
if (Env::has('del')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'del' WHERE crc = {?}", $crc);
- $page->trigSuccess($crc." verra tous ses mails supprimés !");
+ $page->trigSuccess($crc." verra tous ses emails supprimés !");
} elseif (Env::has('ok')) {
$crc = Env::v('crc');
XDB::execute("UPDATE postfix_mailseen SET release = 'ok' WHERE crc = {?}", $crc);
function handler_postfix_regexpsbounces(&$page, $new = null) {
$page->changeTpl('admin/emails_bounces_re.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Regexps Bounces');
+ $page->setTitle('Polytechnique.org - Administration - Postfix : Regexps Bounces');
$page->assign('new', $new);
if (Post::has('submit')) {
$page->changeTpl('admin/logger-view.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Logs des sessions');
+ $page->setTitle('Polytechnique.org - Administration - Logs des sessions');
}
function handler_user(&$page, $login = false)
{
global $globals;
$page->changeTpl('admin/utilisateurs.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Edit/Su/Log');
+ $page->setTitle('Polytechnique.org - Administration - Edit/Su/Log');
require_once("emails.inc.php");
require_once("user.func.inc.php");
}
if(Env::has('suid_button') && $login) {
- $_SESSION['log']->log("suid_start", "login by ".S::v('forlife'));
- $_SESSION['suid'] = $_SESSION;
- $r = XDB::query("SELECT id FROM aliases WHERE alias={?}", $login);
+ S::logger()->log("suid_start", "login by ".S::v('forlife'));
+ $r = XDB::query("SELECT id
+ FROM aliases
+ WHERE alias={?}", $login);
if($uid = $r->fetchOneCell()) {
- start_connexion($uid, true);
- pl_redirect("");
+ if (!Platal::session()->startSUID($uid)) {
+ $page->trigError('Impossible d\'effectuer un SUID sur ' . $uid);
+ } else {
+ $page->kill("coucou");
+ pl_redirect("");
+ }
}
}
$mailer->send();
// update number of subscribers (perms or deceased may have changed)
- update_NbIns();
+ $globals->updateNbIns();
$page->trigSuccess("updaté correctement.");
}
if (Env::v('nomusageN') != $mr['nom_usage']) {
- require_once "xorg.misc.inc.php";
set_new_usage($mr['user_id'], Env::v('nomusageN'), make_username(Env::v('prenomN'), Env::v('nomusageN')));
}
if (Env::v('decesN') != $mr['deces']) {
case "u_kill":
user_clear_all_subs($mr['user_id']);
// update number of subscribers (perms or deceased may have changed)
- update_NbIns();
+ $globals->updateNbIns();
$page->trigSuccess("'{$mr['user_id']}' a été désinscrit !");
$mailer = new PlMailer("admin/useredit.mail.tpl");
$mailer->assign("admin", S::v('forlife'));
function handler_homonyms(&$page, $op = 'list', $target = null) {
$page->changeTpl('admin/homonymes.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Homonymes');
+ $page->setTitle('Polytechnique.org - Administration - Homonymes');
require_once("homonymes.inc.php");
if ($target) {
function handler_ax_xorg(&$page) {
$page->changeTpl('admin/ax-xorg.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - AX/X.org');
+ $page->setTitle('Polytechnique.org - Administration - AX/X.org');
// liste des différences
$res = XDB::query(
function handler_deaths(&$page, $promo = 0, $validate = false) {
$page->changeTpl('admin/deces_promo.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Deces');
+ $page->setTitle('Polytechnique.org - Administration - Deces');
if (!$promo)
$promo = Env::i('promo');
function handler_dead_but_active(&$page) {
$page->changeTpl('admin/dead_but_active.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Décédés');
+ $page->setTitle('Polytechnique.org - Administration - Décédés');
$res = XDB::iterator(
"SELECT u.promo, u.nom, u.prenom, u.deces, u.matricule_ax, a.alias, DATE(MAX(s.start)) AS last
function handler_synchro_ax(&$page, $user = null, $action = null) {
$page->changeTpl('admin/synchro_ax.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Synchro AX');
+ $page->setTitle('Polytechnique.org - Administration - Synchro AX');
require_once('synchro_ax.inc.php');
function handler_validate(&$page, $action = 'list', $id = null)
{
$page->changeTpl('admin/valider.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Valider une demande');
+ $page->setTitle('Polytechnique.org - Administration - Valider une demande');
$page->addCssLink('nl.css');
$page->addJsLink('ajax.js');
require_once("validations.inc.php");
$page->assign('categories', $categories = explode(',', str_replace("'", '', substr($a['Type'], 5, -1))));
$hidden = array();
+ $res = XDB::query('SELECT hidden_requests FROM requests_hidden WHERE user_id = {?}', S::v('uid'));
+ $hide_requests = $res->fetchOneCell();
if (Post::has('hide')) {
$hide = array();
foreach ($categories as $cat)
$hidden[$cat] = 1;
$hide[] = $cat;
}
- setcookie('hide_requests', join(',',$hide), time()+(count($hide)?25920000:(-3600)), '/', '', 0);
- } elseif (Env::has('hide_requests')) {
- foreach (explode(',',Env::v('hide_requests')) as $hide_type)
+ $hide_requests = join(',', $hide);
+ XDB::query('REPLACE INTO requests_hidden (user_id, hidden_requests) VALUES({?}, {?})',
+ S::v('uid'), $hide_requests);
+ } elseif ($hide_requests) {
+ foreach (explode(',', $hide_requests) as $hide_type)
$hidden[$hide_type] = true;
}
$page->assign('hide_requests', $hidden);
// Update the count of item to validate here... useful in development configuration
// where several copies of the site use the same DB, but not the same "dynamic configuration"
- update_NbValid();
+ global $globals;
+ $globals->updateNbValid();
$page->assign('vit', new ValidateIterator());
}
function handler_validate_answers(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Réponses automatiques de validation');
+ $page->setTitle('Polytechnique.org - Administration - Réponses automatiques de validation');
$page->assign('title', 'Gestion des réponses automatiques');
$table_editor = new PLTableEditor('admin/validate/answers','requests_answers','id');
$table_editor->describe('category','catégorie',true);
$table_editor->apply($page, $action, $id);
}
function handler_skins(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Skins');
+ $page->setTitle('Polytechnique.org - Administration - Skins');
$page->assign('title', 'Gestion des skins');
$table_editor = new PLTableEditor('admin/skins','skins','id');
$table_editor->describe('name','nom',true);
}
function handler_postfix_blacklist(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Blacklist');
+ $page->setTitle('Polytechnique.org - Administration - Postfix : Blacklist');
$page->assign('title', 'Blacklist de postfix');
$table_editor = new PLTableEditor('admin/postfix/blacklist','postfix_blacklist','email', true);
$table_editor->describe('reject_text','Texte de rejet',true);
$table_editor->apply($page, $action, $id);
}
function handler_postfix_whitelist(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Postfix : Whitelist');
+ $page->setTitle('Polytechnique.org - Administration - Postfix : Whitelist');
$page->assign('title', 'Whitelist de postfix');
$table_editor = new PLTableEditor('admin/postfix/whitelist','postfix_whitelist','email', true);
$table_editor->describe('email','email',true);
$table_editor->apply($page, $action, $id);
}
function handler_mx_broken(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title', 'Polytechnique.org - Administration - MX Défaillants');
+ $page->setTitle('Polytechnique.org - Administration - MX Défaillants');
$page->assign('title', 'MX Défaillant');
$table_editor = new PLTableEditor('admin/mx/broken', 'mx_watch', 'host', true);
$table_editor->describe('host', 'Masque', true);
$table_editor->apply($page, $action, $id);
}
function handler_logger_actions(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Actions');
+ $page->setTitle('Polytechnique.org - Administration - Actions');
$page->assign('title', 'Gestion des actions de logger');
$table_editor = new PLTableEditor('admin/logger/actions','logger.actions','id');
$table_editor->describe('text','intitulé',true);
$table_editor->apply($page, $action, $id);
}
function handler_downtime(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Coupures');
+ $page->setTitle('Polytechnique.org - Administration - Coupures');
$page->assign('title', 'Gestion des coupures');
$table_editor = new PLTableEditor('admin/downtime','coupures','id');
$table_editor->describe('debut','date',true);
$uid = S::i('uid');
if (!isset($_SESSION['suid'])) {
$logger = (isset($_SESSION['log']) && $_SESSION['log']->uid == $uid)
- ? $_SESSION['log'] : new CoreLogger($uid);
+ ? $_SESSION['log'] : new PlLogger($uid);
global $platal;
- $logger->log('connexion_auth_ext', $platal->path);
+ S::logger()->log('connexion_auth_ext', $platal->path);
}
/* on parcourt les entrees de groupes_auth */
function handler_admin_authgroupesx(&$page, $action = 'list', $id = null)
{
- $page->assign('xorg_title','Polytechnique.org - Administration - Auth groupes X');
+ $page->setTitle('Polytechnique.org - Administration - Auth groupes X');
$page->assign('title', 'Gestion de l\'authentification centralisée');
$table_editor = new PLTableEditor('admin/auth-groupes-x','groupesx_auth','id');
$table_editor->describe('name','nom',true);
require_once dirname(__FILE__) . '/axletter/axletter.inc.php';
$page->changeTpl('axletter/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Envois de l\'AX');
+ $page->setTitle('Polytechnique.org - Envois de l\'AX');
switch ($action) {
case 'in': AXLetter::subscribe(); break;
global $globals;
$mailer = new PlMailer();
$mailer->setFrom("support@" . $globals->mail->domain);
- $mailer->setSubject("Un nouveau projet de mail de l'AX vient d'être proposé");
- $mailer->setTxtBody("Un nouveau mail vient d'être rédigé en prévision d'un envoi prochain. Vous pouvez "
+ $mailer->setSubject("Un nouveau projet d'email de l'AX vient d'être proposé");
+ $mailer->setTxtBody("Un nouvel email vient d'être rédigé en prévision d'un envoi prochain. Vous pouvez "
. "le modifier jusqu'à ce qu'il soit verrouillé pour l'envoi\n\n"
- . "Le sujet du mail : $subject\n"
+ . "Le sujet de l'email : $subject\n"
. "L'échéance d'envoi est fixée à $echeance.\n"
- . "Le mail pourra néanmoins partir avant cette échéance si un administrateur de "
+ . "L'email pourra néanmoins partir avant cette échéance si un administrateur de "
. "Polytechnique.org le valide.\n\n"
- . "Pour modifier, valider ou annuler le mail :\n"
+ . "Pour modifier, valider ou annuler l'email :\n"
. "https://www.polytechnique.org/ax/edit\n"
. "-- \n"
. "Association Polytechnique.org\n");
function handler_index(&$page)
{
$page->changeTpl('carnet/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Mon carnet');
+ $page->setTitle('Polytechnique.org - Mon carnet');
$this->_add_rss_link($page);
}
$page->changeTpl('carnet/panel.tpl');
if (Get::has('read')) {
- $_SESSION['watch_last'] = Get::v('read');
- update_NbNotifs();
+ S::set('watch_last', Get::v('read'));
+ Platal::session()->updateNbNotifs();
pl_redirect('carnet/panel');
}
}
function searchErrorHandler($explain) {
- global $page;
+ $page =& Platal::page();
$page->trigError($explain);
$this->handler_contacts($page);
}
function handler_contacts(&$page, $action = null, $subaction = null, $ssaction = null)
{
- $page->assign('xorg_title','Polytechnique.org - Mes contacts');
+ $page->setTitle('Polytechnique.org - Mes contacts');
$this->_add_rss_link($page);
$uid = S::v('uid');
$base = 'carnet/contacts';
$view = new UserSet("INNER JOIN contacts AS c2 ON (u.user_id = c2.contact)", " c2.uid = $uid ");
}
- $view->addMod('minifiche', 'Mini-Fiches', true);
+ $view->addMod('minifiche', 'Mini-fiches', true);
$view->addMod('trombi', 'Trombinoscope', false, array('with_admin' => false, 'with_promo' => true));
$view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'carnet/contacts/search'));
$view->apply($base, $page, $action, $subaction);
require_once dirname(__FILE__).'/carnet/contacts.pdf.inc.php';
require_once 'user.func.inc.php';
- session_write_close();
+ Platal::session()->close();
$sql = "SELECT a.alias
FROM aliases AS a
if (!$uid) {
$uid = S::i('uid');
} else if ($uid != S::i('uid')) {
- require_once 'xorg.misc.inc.php';
send_warning_email("Récupération d\'un autre utilisateur ($uid)");
}
} else if (!$uid) {
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-class CoreModule extends PLModule
-{
- function handlers()
- {
- return array(
- '403' => $this->make_hook('403', AUTH_PUBLIC),
- '404' => $this->make_hook('404', AUTH_PUBLIC),
- 'login' => $this->make_hook('login', AUTH_COOKIE),
- 'send_bug' => $this->make_hook('bug', AUTH_COOKIE),
- 'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin'),
- 'kill_sessions' => $this->make_hook('kill_sessions', AUTH_COOKIE, 'admin'),
- 'get_rights' => $this->make_hook('get_rights', AUTH_MDP, 'admin'),
-
- 'wiki_help' => $this->make_hook('wiki_help', AUTH_PUBLIC),
- 'wiki_preview' => $this->make_hook('wiki_preview', AUTH_COOKIE, 'user', NO_AUTH),
-
- 'valid.html' => $this->make_hook('valid', AUTH_PUBLIC),
- 'favicon.ico' => $this->make_hook('favicon', AUTH_PUBLIC),
- 'robots.txt' => $this->make_hook('robotstxt', AUTH_PUBLIC, 'user', NO_HTTPS),
- );
- }
-
- function handler_valid(&$page)
- {
- readfile($page->compile_dir.'/valid.html');
- exit;
- }
-
- function handler_403(&$page)
- {
- global $globals;
- header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
- $page->changeTpl('core/403.tpl');
- }
-
- function handler_404(&$page)
- {
- global $globals, $platal;
- header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
- $page->changeTpl('core/404.tpl');
- $page->assign('near', $platal->near_hook());
- }
-
- function handler_login(&$page)
- {
- $allkeys = func_get_args();
- unset($allkeys[0]);
- $url = join('/',$allkeys);
- pl_redirect($url);
- }
-
- function handler_favicon(&$page)
- {
- $data = file_get_contents(dirname(__FILE__).'/../htdocs/images/favicon.ico');
- header('Content-Type: image/x-icon');
- echo $data;
- exit;
- }
-
- function handler_robotstxt(&$page)
- {
- global $globals;
- if (!$globals->core->restricted_platal) {
- return PL_NOT_FOUND;
- }
-
- header('Content-Type: text/plain');
- echo "User-agent: *\n";
- echo "Disallow: /\n";
- exit;
- }
-
- function handler_purge_cache(&$page)
- {
- require_once 'wiki.inc.php';
- S::assert_xsrf_token();
-
- $page->clear_compiled_tpl();
- wiki_clear_all_cache();
-
- http_redirect(empty($_SERVER['HTTP_REFERER']) ? './' : $_SERVER['HTTP_REFERER']);
- }
-
- function handler_kill_sessions(&$page)
- {
- kill_sessions();
- }
-
- function handler_get_rights(&$page, $level)
- {
- if (S::has('suid')) {
- $page->kill('Déjà en SUID');
- }
-
- if (isset($_SESSION['log'])) {
- $_SESSION['log']->log("suid_start", "login by ".S::v('forlife'));
- }
- $_SESSION['suid'] = $_SESSION;
- $_SESSION['perms'] =& XorgSession::make_perms($level);
-
- pl_redirect('/');
- }
-
- function handler_bug(&$page)
- {
- global $globals;
- $page->changeTpl('core/bug.tpl', SIMPLE);
- $page->addJsLink('close_on_esc.js');
- if (Env::has('send') && trim(Env::v('detailed_desc'))) {
- S::assert_xsrf_token();
-
- $body = wordwrap(Env::v('detailed_desc'), 78) . "\n\n"
- . "----------------------------\n"
- . "Page : " . Env::v('page') . "\n\n"
- . "Utilisateur : " . S::v('forlife') . "\n"
- . "Navigateur : " . $_SERVER['HTTP_USER_AGENT'] . "\n"
- . "Skin : " . S::v('skin') . "\n";
- $page->assign('bug_sent',1);
- $mymail = new PlMailer();
- $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@' . $globals->mail->domain . '>');
- $mymail->addTo('support+platal@' . $globals->mail->domain);
- $mymail->addCc('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@' . $globals->mail->domain . '>');
- $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary'));
- $mymail->setTxtBody($body);
- $mymail->send();
- } elseif (Env::has('send')) {
- $page->trigError("Merci de remplir une explication du problème rencontré");
- }
- }
-
- function handler_wiki_help(&$page, $action = 'title')
- {
- $page->changeTpl('core/wiki.help.tpl', SIMPLE);
- $page->assign('wiki_help', MiniWiki::help($action == 'title'));
- }
-
- /// Shared handler for wiki syntax result preview
- function handler_wiki_preview(&$page, $action = 'title')
- {
- header('Content-Type: text/html; charset=utf-8');
- $text = Get::v('text');
- echo MiniWiki::wikiToHtml($text, $action == 'title');
- exit;
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
require_once 'emails.inc.php';
$page->changeTpl('emails/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Mes emails');
+ $page->setTitle('Polytechnique.org - Mes emails');
$uid = S::v('uid');
global $globals;
$page->changeTpl('emails/alias.tpl');
- $page->assign('xorg_title','Polytechnique.org - Alias melix.net');
+ $page->setTitle('Polytechnique.org - Alias melix.net');
$uid = S::v('uid');
$forlife = S::v('forlife');
$mime = $upload->contentType();
if ($mime != 'text/x-mail' && $mime != 'message/rfc822') {
$upload->clear();
- $page->trigError('Le fichier ne contient pas un mail complet');
+ $page->trigError('Le fichier ne contient pas un email complet');
return;
}
global $globals;
$page->changeTpl('emails/send.tpl');
$page->addJsLink('ajax.js');
- $page->assign('xorg_title','Polytechnique.org - Envoyer un email');
+ $page->setTitle('Polytechnique.org - Envoyer un email');
// action si on recoit un formulaire
if (Post::has('save')) {
$mymail->setWikiBody($txt);
}
if ($mymail->send()) {
- $page->trigSuccess("Ton mail a bien été envoyé.");
+ $page->trigSuccess("Ton email a bien été envoyé.");
$_REQUEST = array('bcc' => S::v('bestalias').'@'.$globals->mail->domain);
PlUpload::clear(S::v('forlife'), 'emails.send');
} else {
// envoi du mail
$message = "Bonjour !
-Ce mail a été généré automatiquement par le service de patte cassée de
+Cet email a été généré automatiquement par le service de patte cassée de
Polytechnique.org car un autre utilisateur, ".S::v('prenom').' '.S::v('nom').",
-nous a signalé qu'en t'envoyant un mail, il avait reçu un message d'erreur
+nous a signalé qu'en t'envoyant un email, il avait reçu un message d'erreur
indiquant que ton adresse de redirection $email
ne fonctionnait plus !
$mail->setSubject("Une de tes adresse de redirection Polytechnique.org ne marche plus !!");
$mail->setTxtBody($message);
$mail->send();
- $page->trigSuccess("Mail envoyé !");
+ $page->trigSuccess("Email envoyé !");
}
} elseif (Post::has('email')) {
S::assert_xsrf_token();
'special' => true);
}
- $exclude = is_null($exclude) ? '' : ' AND id != ' . $exclude . ' ';
+ $exclude = is_null($exclude) ? '' : ' AND id != ' . intval($exclude) . ' ';
$priority = rand(0, 510);
do {
$priority = (int)($priority/2);
return $res->fetchOneAssoc();
}
- private function upload_image(PlatalPage &$page, PlUpload &$upload)
+ private function upload_image(PlPage &$page, PlUpload &$upload)
{
if (@!$_FILES['image']['tmp_name'] && !Env::v('image_url')) {
return true;
$page->assign('geoloc_incitation', count($res));
// ajout du lien RSS
- if (S::has('core_rss_hash')) {
+ if (S::rssActivated()) {
$page->setRssLink('Polytechnique.org :: News',
'/rss/'.S::v('forlife') .'/'.S::v('core_rss_hash').'/rss.xml');
}
} elseif ($action && (!trim($texte) || !trim($titre))) {
$page->trigError("L'article doit avoir un titre et un contenu");
} elseif ($action) {
+ S::assert_xsrf_token();
+
require_once 'validations.inc.php';
$evtreq = new EvtReq($titre, $texte, $promo_min, $promo_max,
$peremption, $valid_mesg, S::v('uid'), $upload);
function handler_admin_tips(&$page, $action = 'list', $id = null)
{
- $page->assign('xorg_title', 'Polytechnique.org - Administration - Astuces');
+ $page->setTitle('Polytechnique.org - Administration - Astuces');
$page->assign('title', 'Gestion des Astuces');
$table_editor = new PLTableEditor('admin/tips', 'tips', 'id');
$table_editor->describe('peremption', 'date de péremption', true);
{
$page->changeTpl('events/admin.tpl');
$page->addJsLink('ajax.js');
- $page->assign('xorg_title','Polytechnique.org - Administration - Evenements');
+ $page->setTitle('Polytechnique.org - Administration - Evenements');
$page->register_modifier('hde', 'html_entity_decode');
$arch = $action == 'archives';
}
if (Post::v('action') == 'Pas d\'image' && $eid) {
+ S::assert_xsrf_token();
$upload->rm();
XDB::execute("DELETE FROM evenements_photo WHERE eid = {?}", $eid);
$action = 'edit';
} elseif (Post::v('action') == 'Supprimer l\'image' && $eid) {
+ S::assert_xsrf_token();
$upload->rm();
$action = 'edit';
} elseif (Post::v('action') == "Proposer" && $eid) {
+ S::assert_xsrf_token();
$promo_min = Post::i('promo_min');
$promo_max = Post::i('promo_max');
if (($promo_min != 0 && ($promo_min <= 1900 || $promo_min >= 2020)) ||
$action = 'edit';
} else {
$res = XDB::query('SELECT flags FROM evenements WHERE id = {?}', $eid);
- $flags = new FlagSet($res->fetchOneCell());
+ $flags = new PlFlagSet($res->fetchOneCell());
$flags->addFlag('wiki');
if (Post::v('important')) {
$flags->addFlag('important');
WHERE id = {?}',
Post::v('titre'), Post::v('texte'), Post::v('peremption'),
Post::v('promo_min'), Post::v('promo_max'),
- $flags->flags(), $eid);
+ $flags, $eid);
if ($upload->exists() && list($x, $y, $type) = $upload->imageInfo()) {
XDB::execute('REPLACE INTO evenements_photo
SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}',
} else {
switch ($action) {
case 'delete':
+ S::assert_xsrf_token();
XDB::execute('DELETE from evenements
WHERE id = {?}', $eid);
break;
case "archive":
+ S::assert_xsrf_token();
XDB::execute('UPDATE evenements
SET creation_date = creation_date, flags = CONCAT(flags,",archive")
WHERE id = {?}', $eid);
break;
case "unarchive":
+ S::assert_xsrf_token();
XDB::execute('UPDATE evenements
SET creation_date = creation_date, flags = REPLACE(flags,"archive","")
WHERE id = {?}', $eid);
break;
case "valid":
+ S::assert_xsrf_token();
XDB::execute('UPDATE evenements
SET creation_date = creation_date, flags = CONCAT(flags,",valide")
WHERE id = {?}', $eid);
break;
case "unvalid":
+ S::assert_xsrf_token();
XDB::execute('UPDATE evenements
SET creation_date = creation_date, flags = REPLACE(flags,"valide", "")
WHERE id = {?}', $eid);
function handler_banana(&$page, $group = null, $action = null, $artid = null)
{
$page->changeTpl('banana/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Forums & PA');
+ $page->setTitle('Polytechnique.org - Forums & PA');
$get = Array();
if (Post::has('updateall')) {
run_banana($page, 'ForumsBanana', $get);
}
- function handler_profile(&$page, $action = null)
- {
- global $globals;
-
- $page->changeTpl('banana/profile.tpl');
-
- if (!(Post::has('action') && Post::has('banananame') && Post::has('bananasig')
- && Post::has('bananadisplay') && Post::has('bananamail')
- && Post::has('bananaupdate') && Post::v('action')=="Enregistrer" ))
- {
- $req = XDB::query("
- SELECT nom, mail, sig,
- FIND_IN_SET('threads', flags),
- FIND_IN_SET('automaj', flags),
- FIND_IN_SET('xface', flags)
- FROM forums.profils
- WHERE uid = {?}", S::v('uid'));
- if (!(list($nom, $mail, $sig, $disp, $maj, $xface) = $req->fetchOneRow())) {
- $nom = S::v('prenom').' '.S::v('nom');
- $mail = S::v('forlife').'@'.$globals->mail->domain;
- $sig = $nom.' ('.S::v('promo').')';
- $disp = 0;
- $maj = 0;
- $xface = 0;
- }
- $page->assign('nom' , $nom);
- $page->assign('mail', $mail);
- $page->assign('sig', $sig);
- $page->assign('disp', $disp);
- $page->assign('maj', $maj);
- $page->assign('xface', $xface);
- } else {
- $flags = array();
- if (Post::b('bananadisplay')) {
- $flags[] = 'threads';
- }
- if (Post::b('bananaupdate')) {
- $flags[] = 'automaj';
- }
- if (Post::b('bananaxface')) {
- $flags[] = 'xface';
- }
- XDB::execute("REPLACE INTO forums.profils (uid, sig, mail, nom, flags)
- VALUES ({?}, {?}, {?}, {?}, {?})",
- S::v('uid'), Post::v('bananasig'),
- Post::v('bananamail'), Post::v('banananame'),
- implode(',', $flags));
- }
- }
-
function handler_rss(&$page, $group, $alias, $hash, $file = null)
{
if (is_null($file)) {
function handler_forums_bans(&$page, $action = 'list', $id = null)
{
- $page->assign('xorg_title','Polytechnique.org - Administration - Bannissements des forums');
+ $page->setTitle('Polytechnique.org - Administration - Bannissements des forums');
$page->assign('title', 'Gestion des mises au ban');
$table_editor = new PLTableEditor('admin/forums','forums.innd','id_innd');
$table_editor->add_sort_field('priority', true, true);
static function run_banana(&$page, $params = null)
{
$page->changeTpl('banana/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Forums & PA');
+ $page->setTitle('Polytechnique.org - Forums & PA');
require_once 'banana/forum.inc.php';
run_banana($page, 'ForumsBanana', $params);
// iGoogle gadgets helpers.
function init_igoogle_xml($template)
{
- global $page;
- $page->changeTpl($template, NO_SKIN);
+ Platal::page()->changeTpl($template, NO_SKIN);
header('Content-Type: application/xml; charset=utf-8');
}
function init_igoogle_html($template, $auth = AUTH_PUBLIC)
{
- global $page;
+ $page =& Platal::page();
$page->changeTpl('gadgets/ig-skin.tpl', NO_SKIN);
$page->register_modifier('escape_html', 'escape_html');
$page->default_modifiers = Array('@escape_html');
function handler_admin(&$page, $action = false) {
$page->changeTpl('geoloc/admin.tpl');
require_once("geoloc.inc.php");
- $page->assign('xorg_title','Polytechnique.org - Administration - Geolocalisation');
+ $page->setTitle('Polytechnique.org - Administration - Geolocalisation');
$nb_synchro = 0;
$noCoordinates = $countNoCoordinates->fetchOneCell();
if (isset($refresh) && $missing) {
- $page->assign("xorg_extra_header", "<meta http-equiv='Refresh' content='3'/>");
+ $page->assign("pl_extra_header", "<meta http-equiv='Refresh' content='3'/>");
}
$page->assign("nb_cities_not_on_map", $missing);
$page->assign("no_smallest", $noSmallest);
require_once("googleapps.inc.php");
$page->changeTpl('googleapps/index.tpl');
$page->addJsLink('motdepasse.js');
- $page->assign('xorg_title', 'Polytechnique.org - Compte Google Apps');
+ $page->setTitle('Polytechnique.org - Compte Google Apps');
$account = new GoogleAppsAccount(S::v('uid'), S::v('forlife'));
function handler_admin(&$page, $action = null) {
require_once("googleapps.inc.php");
$page->changeTpl('googleapps/admin.tpl');
- $page->assign('xorg_title', 'Polytechnique.org - Administration Google Apps');
+ $page->setTitle('Polytechnique.org - Administration Google Apps');
$page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid')));
if ($action == 'ack') {
function handler_admin_job(&$page, $job = null) {
require_once("googleapps.inc.php");
$page->changeTpl('googleapps/admin.job.tpl');
- $page->assign('xorg_title', 'Polytechnique.org - Administration Google Apps');
+ $page->setTitle('Polytechnique.org - Administration Google Apps');
$page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid')));
if ($job) {
require_once("emails.inc.php");
require_once("googleapps.inc.php");
$page->changeTpl('googleapps/admin.user.tpl');
- $page->assign('xorg_title', 'Polytechnique.org - Administration Google Apps');
+ $page->setTitle('Polytechnique.org - Administration Google Apps');
$page->assign('googleapps_admin', GoogleAppsAccount::is_administrator(S::v('uid')));
if (!$user && Post::has('login')) {
$page->changeTpl('lists/index.tpl');
$page->addJsLink('ajax.js');
- $page->assign('xorg_title','Polytechnique.org - Listes de diffusion');
+ $page->setTitle('Polytechnique.org - Listes de diffusion');
if (Get::has('del')) {
+ S::assert_xsrf_token();
$this->client->unsubscribe(Get::v('del'));
pl_redirect('lists');
}
if (Get::has('add')) {
+ S::assert_xsrf_token();
$this->client->subscribe(Get::v('add'));
pl_redirect('lists');
}
if (Post::has('promo_add')) {
+ S::assert_xsrf_token();
+
$promo = Post::i('promo_add');
if ($promo >= 1900 and $promo < 2100) {
$this->client->subscribe("promo$promo");
$page->trigSuccess("promo incorrecte, il faut une promo sur 4 chiffres.");
}
}
+
$listes = $this->client->get_lists();
$owner = array_filter($listes, 'filter_owner');
$listes = array_diff_key($listes, $owner);
header('Content-Type: text/html; charset="UTF-8"');
$domain = $this->prepare_client($page);
$page->changeTpl('lists/liste.inc.tpl', NO_SKIN);
+ S::assert_xsrf_token();
+
if (Get::has('unsubscribe')) {
$this->client->unsubscribe($list);
}
function handler_create(&$page)
{
+ global $globals;
+
$page->changeTpl('lists/create.tpl');
+ $user_promo = S::i('promo');
+ $year = date('Y');
+ $month = date('m');
+ $young_promo = $very_young_promo = 0;
+ if ((($year > $user_promo) && ($month > 3)) && ($year < $user_promo + 5)) {
+ $young_promo = 1;
+ }
+ if ((($year > $user_promo) && ($month > 7)) && (($year < $user_promo + 1) && ($month < 8))) {
+ $very_young_promo = 1;
+ }
+ $page->assign('young_promo', $young_promo);
+ $page->assign('very_young_promo', $very_young_promo);
+
$owners = preg_split("/[\s]+/", Post::v('owners'), -1, PREG_SPLIT_NO_EMPTY);
$members = preg_split("/[\s]+/", Post::v('members'), -1, PREG_SPLIT_NO_EMPTY);
}
// click on validate button 'add_member_sub'
+ require_once('user.func.inc.php');
if (Post::has('add_member_sub') && Post::has('add_member')) {
- require_once('user.func.inc.php');
$forlifes = get_users_forlife_list(Post::v('add_member'), true);
if (!is_null($forlifes)) {
$members = array_merge($members, $forlifes);
}
}
+ if (Post::has('add_member_sub') && isset($_FILES['add_member_file']) && $_FILES['add_member_file']['tmp_name']) {
+ $upload =& PlUpload::get($_FILES['add_member_file'], S::v('forlife'), 'list.addmember', true);
+ if (!$upload) {
+ $page->trigError('Une erreur s\'est produite lors du téléchargement du fichier');
+ } else {
+ $forlifes = get_users_forlife_list($upload->getContents(), true);
+ if (!is_null($forlifes)) {
+ $members = array_merge($members, $forlifes);
+ }
+ }
+ }
ksort($owners);
$owners = array_unique($owners);
ksort($members);
$members = array_unique($members);
- $page->assign('owners', join(' ', $owners));
- $page->assign('members', join(' ', $members));
+ $page->assign('owners', join("\n", $owners));
+ $page->assign('members', join("\n", $members));
if (!Post::has('submit')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
+ $asso = Post::v('asso');
$liste = Post::v('liste');
if (empty($liste)) {
- $page->trigError('champs «adresse souhaitée» vide');
+ $page->trigError('Le champ «adresse souhaitée» est vide.');
}
if (!preg_match("/^[a-zA-Z0-9\-]*$/", $liste)) {
- $page->trigError('le nom de la liste ne doit contenir que des lettres non accentuées, chiffres et tirets');
+ $page->trigError('Le nom de la liste ne doit contenir que des lettres non accentuées, chiffres et tirets.');
+ }
+
+ if (($asso == "binet") || ($asso == "alias")) {
+ $promo = Post::i('promo');
+ $domain = $promo . '.' . $globals->mail->domain;
+
+ if (($promo < 1921) || ($promo > date('Y'))) {
+ $page->trigError('La promotion est mal renseignée, elle doit être du type : 2004.');
+ }
+
+ $new = $liste . '@' . $domain;
+ $res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
+
+ } else {
+ if ($asso == "groupex") {
+ $groupex_name = Post::v('groupex_name');
+
+ $res_groupe = XDB::query('SELECT mail_domain FROM groupex.asso WHERE nom={?}', $groupex_name);
+ $domain = $res_groupe->fetchOneCell();
+
+ if (!$domain) {
+ $page->trigError('Il n\'y a aucun groupe de ce nom sur Polytechnique.net.');
+ }
+
+ $new = $liste . '@' . $domain;
+ $res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
+ } else {
+ $res = XDB::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
+ $domain = $globals->mail->domain;
+ }
}
- $res = XDB::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
- $n = $res->fetchOneCell();
+ $n = $res->fetchOneCell();
if ($n) {
- $page->trigError('cet alias est déjà pris');
+ $page->trigError('L\'«adresse souhaitée» est déjà prise.');
}
if (!Post::v('desc')) {
- $page->trigError('le sujet est vide');
+ $page->trigError('Le sujet est vide.');
}
if (!count($owners)) {
- $page->trigError('pas de gestionnaire');
+ $page->trigError('Il n\'y a pas de gestionnaire.');
}
if (count($members)<4) {
- $page->trigError('pas assez de membres');
+ $page->trigError('Il n\'y a pas assez de membres.');
}
if (!$page->nb_errs()) {
$page->assign('created', true);
require_once 'validations.inc.php';
- $req = new ListeReq(S::v('uid'), $liste,
+ $req = new ListeReq(S::v('uid'), $asso, $liste, $domain,
Post::v('desc'), Post::i('advertise'),
Post::i('modlevel'), Post::i('inslevel'),
$owners, $members);
$page->changeTpl('lists/members.tpl');
if (Get::has('del')) {
+ S::assert_xsrf_token();
$this->client->unsubscribe($liste);
pl_redirect('lists/members/'.$liste);
}
if (Get::has('add')) {
+ S::assert_xsrf_token();
$this->client->subscribe($liste);
pl_redirect('lists/members/'.$liste);
}
$this->prepare_client($page);
if (Get::has('del')) {
+ S::assert_xsrf_token();
$this->client->unsubscribe($liste);
pl_redirect('lists/annu/'.$liste);
}
if (Get::has('add')) {
+ S::assert_xsrf_token();
$this->client->subscribe($liste);
pl_redirect('lists/annu/'.$liste);
}
$view = new ArraySet($users);
$view->addMod('trombi', 'Trombinoscope', true, array('with_promo' => true));
if (empty($GLOBALS['IS_XNET_SITE'])) {
- $view->addMod('minifiche', 'Minifiches', false);
+ $view->addMod('minifiche', 'Mini-fiches', false);
}
$view->addMod('geoloc', 'Planisphère');
$view->apply("lists/annu/$liste", $page, $action, $subaction);
$page->register_modifier('hdc', 'list_header_decode');
if (Env::has('sadd') || Env::has('sdel')) {
+ S::assert_xsrf_token();
+
if (Env::has('sadd')) { /* 4 = SUBSCRIBE */
$sub = $this->client->get_pending_sub($liste, Env::v('sadd'));
$this->client->handle_request($liste,Env::v('sadd'),4,'');
}
if (Post::has('moderate_mails') && Post::has('select_mails')) {
+ S::assert_xsrf_token();
+
$mails = array_keys(Post::v('select_mails'));
foreach($mails as $mail) {
$this->moderate_mail($domain, $liste, $mail);
$page->changeTpl('lists/admin.tpl');
if (Env::has('send_mark')) {
+ S::assert_xsrf_token();
+
$actions = Env::v('mk_action');
$uids = Env::v('mk_uid');
$mails = Env::v('mk_email');
}
if (Env::has('add_member')) {
+ S::assert_xsrf_token();
+
require_once('user.func.inc.php');
$members = get_users_forlife_list(Env::v('add_member'),
false,
}
}
+ if (isset($_FILES['add_member_file']) && $_FILES['add_member_file']['tmp_name']) {
+ S::assert_xsrf_token();
+
+ $upload =& PlUpload::get($_FILES['add_member_file'], S::v('forlife'), 'list.addmember', true);
+ if (!$upload) {
+ $page->trigError('Une erreur s\'est produite lors du téléchargement du fichier');
+ } else {
+ $members = get_users_forlife_list($upload->getContents(),
+ false,
+ array('ListsModule', 'no_login_callback'));
+ $arr = $this->client->mass_subscribe($liste, $members);
+ if (is_array($arr)) {
+ foreach($arr as $addr) {
+ $page->trigSuccess("{$addr[0]} inscrit.");
+ }
+ }
+ }
+ }
+
if (Env::has('del_member')) {
+ S::assert_xsrf_token();
+
if (strpos(Env::v('del_member'), '@') === false) {
$this->client->mass_unsubscribe(
$liste, array(Env::v('del_member').'@'.$globals->mail->domain));
}
if (Env::has('add_owner')) {
+ S::assert_xsrf_token();
+
require_once('user.func.inc.php');
$owners = get_users_forlife_list(Env::v('add_owner'), false, array('ListsModule', 'no_login_callback'));
if ($owners) {
}
if (Env::has('del_owner')) {
+ S::assert_xsrf_token();
+
if (strpos(Env::v('del_owner'), '@') === false) {
$this->client->del_owner($liste, Env::v('del_owner').'@'.$globals->mail->domain);
} else {
$page->changeTpl('lists/options.tpl');
if (Post::has('submit')) {
+ S::assert_xsrf_token();
+
$values = $_POST;
$values = array_map('utf8_decode', $values);
- $this->client->set_bogo_level($liste, intval($values['bogo_level']));
+ $spamlevel = intval($values['bogo_level']);
+ $unsurelevel = intval($values['unsure_level']);
+ if ($spamlevel == 0) {
+ $unsurelevel = 0;
+ }
+ if ($spamlevel > 3 || $spamlevel < 0 || $unsurelevel < 0 || $unsurelevel > 1) {
+ $page->trigError("Réglage de l'antispam non valide");
+ } else {
+ $this->client->set_bogo_level($liste, ($spamlevel << 1) + $unsurelevel);
+ }
switch($values['moderate']) {
case '0':
$values['generic_nonmember_action'] = 0;
}
$this->client->set_owner_options($liste, $values);
} elseif (isvalid_email(Post::v('atn_add'))) {
+ S::assert_xsrf_token();
$this->client->add_to_wl($liste, Post::v('atn_add'));
} elseif (Get::has('atn_del')) {
+ S::assert_xsrf_token();
$this->client->del_from_wl($liste, Get::v('atn_del'));
pl_redirect('lists/options/'.$liste);
}
if (list($details,$options) = $this->client->get_owner_options($liste)) {
$page->assign_by_ref('details', $details);
$page->assign_by_ref('options', $options);
- $page->assign('bogo_level', $this->client->get_bogo_level($liste));
+ $bogo_level = intval($this->client->get_bogo_level($liste));
+ $page->assign('unsure_level', $bogo_level & 1);
+ $page->assign('bogo_level', $bogo_level >> 1);
} else {
$page->kill("La liste n'existe pas ou tu n'as pas le droit de l'administrer");
}
$page->changeTpl('lists/delete.tpl');
if (Post::v('valid') == 'OUI') {
+ S::assert_xsrf_token();
+
if ($this->client->delete_list($liste, Post::b('del_archive'))) {
foreach (array('', '-owner', '-admin', '-bounces', '-unsubscribe') as $app) {
XDB::execute("DELETE FROM $table
$page->changeTpl('lists/soptions.tpl');
if (Post::has('submit')) {
+ S::assert_xsrf_token();
+
$values = $_POST;
$values = array_map('utf8_decode', $values);
unset($values['submit']);
$page->changeTpl('lists/check.tpl');
if (Post::has('correct')) {
+ S::assert_xsrf_token();
$this->client->check_options($liste, true);
}
function handler_admin_all(&$page) {
$page->changeTpl('lists/admin_all.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Mailing lists');
+ $page->setTitle('Polytechnique.org - Administration - Mailing lists');
$client = new MMList(S::v('uid'), S::v('password'));
$listes = $client->get_all_lists();
LEFT JOIN auth_user_md5 AS u ON(m2.origine = "X" AND m2.uid = u.user_id)
WHERE m1.email={?}', $globals->asso('id'), $mem);
if (list($uid, $prenom, $nom, $promo) = $res->fetchOneRow()) {
- $key = $tri_promo ? ($promo != 'non-X' ? $promo : 0) : strtoupper($nom{0});
+ $key = $tri_promo ? ($promo != 'non-X' ? $promo : 0) : strtoupper(@$nom{0});
if ($tri_promo) {
$promo = null;
}
{
$page->changeTpl('marketing/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Marketing');
+ $page->setTitle('Polytechnique.org - Marketing');
// Quelques statistiques
}
if ($action == 'del') {
+ S::assert_xsrf_token();
Marketing::clear($uid, $value);
}
}
if ($action == 'relforce') {
+ S::assert_xsrf_token();
+
$market = Marketing::get($uid, Post::v('to'));
if (is_null($market)) {
$market = new Marketing($uid, Post::v('to'), 'default', null, 'staff');
}
$market->send(Post::v('title'), Post::v('message'));
- $page->trigSuccess("Mail envoyé");
+ $page->trigSuccess("Email envoyé");
}
if ($action == 'insrel') {
+ S::assert_xsrf_token();
if (Marketing::relance($uid)) {
$page->trigSuccess('relance faite');
}
$email = valide_email(Post::v('mail'));
}
if (Post::has('valide') && isvalid_email_redirection($email)) {
+ S::assert_xsrf_token();
+
// security stuff
check_email($email, "Proposition d'une adresse surveillee pour " . $user['forlife'] . " par " . S::v('forlife'));
- $res = XDB::query("SELECT state
+ $res = XDB::query("SELECT e.flags
FROM emails AS e
INNER JOIN aliases AS a ON (a.id = e.uid)
WHERE e.email = {?} AND a.alias = {?}", $email, $user['forlife']);
$page->assign('promo', $promo);
if (Post::has('valide')) {
- require_once('xorg.misc.inc.php');
+ S::assert_xstf_token();
$email = trim(Post::v('mail'));
if (!isvalid_email_redirection($email)) {
require_once 'newsletter.inc.php';
$page->changeTpl('newsletter/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Lettres mensuelles');
+ $page->setTitle('Polytechnique.org - Lettres mensuelles');
switch ($action) {
case 'out': Newsletter::unsubscribe(); break;
function handler_admin_nl(&$page, $new = false) {
$page->changeTpl('newsletter/admin.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : liste');
+ $page->setTitle('Polytechnique.org - Administration - Newsletter : liste');
require_once("newsletter.inc.php");
if($new) {
function handler_admin_nl_edit(&$page, $nid = 'last', $aid = null, $action = 'edit') {
$page->changeTpl('newsletter/edit.tpl');
$page->addCssLink('nl.css');
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Edition');
+ $page->setTitle('Polytechnique.org - Administration - Newsletter : Edition');
require_once("newsletter.inc.php");
$nl = new NewsLetter($nid);
}
function handler_admin_nl_cat(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Catégories');
+ $page->setTitle('Polytechnique.org - Administration - Newsletter : Catégories');
$page->assign('title', 'Gestion des catégories de la newsletter');
$table_editor = new PLTableEditor('admin/newsletter/categories','newsletter_cat','cid');
$table_editor->describe('titre','intitulé',true);
/* sort en affichant une erreur */
function paypal_erreur($text, $send=true)
{
- global $page, $erreur, $globals;
+ global $erreur, $globals;
if ($erreur) return;
$erreur = $text;
if (!$send) return;
$mymail->setTxtBody("\n\n".var_export($_REQUEST,true));
$mymail->send();
- $page->trigError($text);
+ Platal::page()->trigError($text);
}
/* http://fr.wikipedia.org/wiki/Formule_de_Luhn */
}
}
$page->changeTpl('payment/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Télépaiements');
+ $page->setTitle('Polytechnique.org - Télépaiements');
// initialisation
$op = Env::v('op', 'select');
}
function handler_admin(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Paiements');
+ $page->setTitle('Polytechnique.org - Administration - Paiements');
$page->assign('title', 'Gestion des télépaiements');
$table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
$table_editor->add_join_table('paiement.transactions','ref',true);
$this->montant_min = (float)$this->montant_min;
$this->montant_max = (float)$this->montant_max;
- $this->flags = new Flagset($flags);
+ $this->flags = new PlFlagSet($flags);
}
// }}}
$name = $req->fetchOneCell();
// on constuit la reference de la transaction
- require_once 'xorg.misc.inc.php';
$prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id();
$fullref = substr("$prefix-xorg-{$pay->id}",-15);
$this->infos['client'] = array_map('replace_accent', array_merge($info_client, $res->fetchOneAssoc()));
// on constuit la reference de la transaction
- require_once 'xorg.misc.inc.php';
$prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id();
$fullref = substr("$prefix-xorg-{$pay->id}",-15);
function handler_prefs(&$page)
{
$page->changeTpl('platal/preferences.tpl');
- $page->assign('xorg_title','Polytechnique.org - Mes préférences');
+ $page->setTitle('Polytechnique.org - Mes préférences');
if (Post::has('mail_fmt')) {
$fmt = Post::v('mail_fmt');
{
$page->changeTpl('platal/webredirect.tpl');
- $page->assign('xorg_title','Polytechnique.org - Redirection de page WEB');
+ $page->setTitle('Polytechnique.org - Redirection de page WEB');
$log =& S::v('log');
$url = Env::v('url');
XDB::execute('UPDATE auth_user_quick
SET redirecturl = {?} WHERE user_id = {?}',
$url, S::v('uid'));
- $log->log('carva_add', 'http://'.Env::v('url'));
+ S::logger()->log('carva_add', 'http://'.Env::v('url'));
$page->trigSuccess("Redirection activée vers <a href='http://$url'>$url</a>");
} elseif (Env::v('submit') == "Supprimer") {
XDB::execute("UPDATE auth_user_quick
SET redirecturl = ''
WHERE user_id = {?}",
S::v('uid'));
- $log->log("carva_del", $url);
+ S::logger()->log("carva_del", $url);
Post::kill('url');
$page->trigSuccess('Redirection supprimée');
}
}
$log =& S::v('log');
- $log->log('passwd', '');
+ S::logger()->log('passwd', '');
if (Cookie::v('ORGaccess')) {
setcookie('ORGaccess', hash_encrypt($password), (time()+25920000), '/', '' ,0);
$page->changeTpl('platal/motdepasse.tpl');
$page->addJsLink('motdepasse.js');
- $page->assign('xorg_title','Polytechnique.org - Mon mot de passe');
+ $page->setTitle('Polytechnique.org - Mon mot de passe');
}
function handler_smtppass(&$page)
{
$page->changeTpl('platal/acces_smtp.tpl');
- $page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
+ $page->setTitle('Polytechnique.org - Acces SMTP/NNTP');
require_once 'wiki.inc.php';
wiki_require_page('Xorg.SMTPSécurisé');
XDB::execute('UPDATE auth_user_md5 SET smtppass = {?}
WHERE user_id = {?}', $pass, $uid);
$page->trigSuccess('Mot de passe enregistré');
- $log->log("passwd_ssl");
+ S::logger()->log("passwd_ssl");
} elseif (Env::v('op') == "Supprimer") {
XDB::execute('UPDATE auth_user_md5 SET smtppass = ""
WHERE user_id = {?}', $uid);
$page->trigSuccess('Compte SMTP et NNTP supprimé');
- $log->log("passwd_del");
+ S::logger()->log("passwd_del");
}
$res = XDB::query("SELECT IF(smtppass != '', 'actif', '')
Polytechnique.org
\"Le portail des élèves & anciens élèves de l'Ecole polytechnique\"
-Mail envoyé à ".Env::v('login') . (Post::has('email') ? "
+Email envoyé à ".Env::v('login') . (Post::has('email') ? "
Adresse de secours : " . Post::v('email') : ""));
$mymail->send();
// on cree un objet logger et on log l'evenement
- $logger = $_SESSION['log'] = new CoreLogger($uid);
- $logger->log('recovery', $mails);
+ $logger = $_SESSION['log'] = new PlLogger($uid);
+ S::logger()->log('recovery', $mails);
} else {
$page->trigError('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.<br />'.
'Si tu as un homonyme, utilise prenom.nom.promo comme login');
}
}
- $logger = new CoreLogger($uid);
- $logger->log("passwd","");
+ $logger = new PlLogger($uid);
+ S::logger()->log("passwd","");
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
$page->changeTpl('platal/motdepasse.tpl');
global $globals;
$page->changeTpl('platal/skins.tpl');
- $page->assign('xorg_title','Polytechnique.org - Skins');
+ $page->setTitle('Polytechnique.org - Skins');
if (Env::has('newskin')) { // formulaire soumis, traitons les données envoyées
XDB::execute('UPDATE auth_user_quick
SET skin={?} WHERE user_id={?}',
Env::i('newskin'), S::v('uid'));
S::kill('skin');
- set_skin();
+ Platal::session()->setSkin();
}
$res = XDB::query('SELECT id FROM skins WHERE skin_tpl={?}', S::v('skin'));
$a4l = S::v('forlife');
$suid = S::v('suid');
$log = S::v('log');
- $log->log("suid_stop", S::v('forlife') . " by " . $suid['forlife']);
- $_SESSION = $suid;
- S::kill('suid');
+ S::logger()->log("suid_stop", S::v('forlife') . " by " . $suid['forlife']);
+ Platal::session()->stopSUID();
pl_redirect('admin/user/' . $a4l);
}
setcookie('ORGaccess', '', time() - 3600, '/', '', 0);
Cookie::kill('ORGaccess');
if (isset($_SESSION['log']))
- $_SESSION['log']->log("cookie_off");
+ S::logger()->log("cookie_off");
}
if ($level == 'forgetuid' || $level == 'forgetall') {
if (isset($_SESSION['log'])) {
$ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
- $_SESSION['log']->log('deconnexion',$ref);
+ S::logger()->log('deconnexion',$ref);
}
-
- XorgSession::destroy();
+ Platal::session()->destroy();
if (Get::has('redirect')) {
http_redirect(rawurldecode(Get::v('redirect')));
public function template() { return 'platal/review.tpl'; }
public function process() { }
- public function prepare(PlatalPage &$page, $id)
+ public function prepare(PlPage &$page, $id)
{
require_once 'wiki.inc.php';
$dom = (@$GLOBALS['IS_XNET_SITE'] ? 'ReviewXnet' : 'Review') . '.' . ucfirst($id);
function handler_photo_change(&$page)
{
+ global $globals;
$page->changeTpl('profile/trombino.tpl');
require_once('validations.inc.php');
.'/'.S::v('forlife').'.jpg';
if (Env::has('upload')) {
+ S::assert_xsrf_token();
+
$upload = new PlUpload(S::v('forlife'), 'photo');
if (!$upload->upload($_FILES['userfile']) && !$upload->download(Env::v('photo'))) {
$page->trigError('Une erreur est survenue lors du téléchargement du fichier');
}
}
} elseif (Env::has('trombi')) {
+ S::assert_xsrf_token();
+
$upload = new PlUpload(S::v('forlife'), 'photo');
if ($upload->copyFrom($trombi_x)) {
$myphoto = new PhotoReq(S::v('uid'), $upload);
}
}
} elseif (Env::v('suppr')) {
+ S::assert_xsrf_token();
+
XDB::execute('DELETE FROM photo
WHERE uid = {?}',
S::v('uid'));
XDB::execute('DELETE FROM requests
WHERE user_id = {?} AND type="photo"',
S::v('uid'));
- update_NbValid();
+ $globals->updateNbValid();
} elseif (Env::v('cancel')) {
+ S::assert_xsrf_token();
+
$sql = XDB::query('DELETE FROM requests
WHERE user_id={?} AND type="photo"',
S::v('uid'));
- update_NbValid();
+ $globals->updateNbValid();
}
$sql = XDB::query('SELECT COUNT(*)
}
if (S::logged()) {
- $_SESSION['log']->log('view_profile', $login);
+ S::logger()->log('view_profile', $login);
}
$title = $user['prenom'] . ' ' . ( empty($user['nom_usage']) ? $user['nom'] : $user['nom_usage'] );
- $page->assign('xorg_title', $title);
+ $page->setTitle($title);
// photo
INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' )
WHERE ( redirect={?} OR redirect={?} )
AND alias LIKE '%@{$globals->mail->alias_dom}'",
- S::v('uid'),
+ $user['user_id'],
$user['forlife'].'@'.$globals->mail->domain,
$user['forlife'].'@'.$globals->mail->domain2);
$page->assign('virtualalias', $res->fetchOneCell());
. " la procédure de récupération de mot de passe si un jour tu le perdais");
}
- $page->assign('xorg_title', 'Polytechnique.org - Mon Profil');
+ $page->setTitle('Polytechnique.org - Mon Profil');
}
function handler_applis_js(&$page)
$page->changeTpl('profile/orange.tpl');
require_once 'validations.inc.php';
- require_once 'xorg.misc.inc.php';
$res = XDB::query(
"SELECT u.promo, u.promo_sortie
if (!Env::has('promo_sortie')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
$promo_sortie = Env::i('promo_sortie');
{
require_once 'wiki.inc.php';
wiki_require_page('Docs.Emploi');
- $page->assign('xorg_title', 'Polytechnique.org - Conseil Pro');
+ $page->setTitle('Polytechnique.org - Conseil Pro');
//recuperation des noms de secteurs
$res = XDB::iterRow("SELECT id, label FROM emploi_secteur");
$page->changeTpl('profile/nomusage.tpl');
require_once 'validations.inc.php';
- require_once 'xorg.misc.inc.php';
$res = XDB::query(
"SELECT u.nom, u.nom_usage, u.flags, e.alias
WHERE user_id={?}", S::v('uid'));
list($nom, $usage_old, $flags, $alias_old) = $res->fetchOneRow();
- $flags = new flagset($flags);
+ $flags = new PlFlagSet($flags);
$page->assign('usage_old', $usage_old);
$page->assign('alias_old', $alias_old);
$page->assign('usage_req', $nom_usage);
if (Env::has('submit') && ($nom_usage != $usage_old)) {
+ S::assert_xsrf_token();
+
// on vient de recevoir une requete, differente de l'ancien nom d'usage
if ($nom_usage == $nom) {
$page->assign('same', true);
function handler_xnet(&$page)
{
$page->changeTpl('profile/groupesx.tpl');
- $page->assign('xorg_title', 'Polytechnique.org - Promo, Groupes X, Binets');
+ $page->setTitle('Polytechnique.org - Promo, Groupes X, Binets');
$req = XDB::query('
SELECT m.asso_id, a.nom, diminutif, a.logo IS NOT NULL AS has_logo,
function handler_admin_trombino(&$page, $uid = null, $action = null) {
$page->changeTpl('profile/admin_trombino.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Trombino');
+ $page->setTitle('Polytechnique.org - Administration - Trombino');
$page->assign('uid', $uid);
$q = XDB::query(
list($forlife, $promo) = $q->fetchOneRow();
switch ($action) {
-
case "original":
header("Content-type: image/jpeg");
readfile("/home/web/trombino/photos".$promo."/".$forlife.".jpg");
break;
case "new":
+ S::assert_xsrf_token();
+
$data = file_get_contents($_FILES['userfile']['tmp_name']);
list($x, $y) = getimagesize($_FILES['userfile']['tmp_name']);
$mimetype = substr($_FILES['userfile']['type'], 6);
break;
case "delete":
+ S::assert_xsrf_token();
+
XDB::execute('DELETE FROM photo WHERE uid = {?}', $uid);
break;
}
$page->assign('forlife', $forlife);
}
function handler_admin_binets(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Binets');
+ $page->setTitle('Polytechnique.org - Administration - Binets');
$page->assign('title', 'Gestion des binets');
$table_editor = new PLTableEditor('admin/binets', 'binets_def', 'id');
$table_editor->add_join_table('binets_ins','binet_id',true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_formations(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Formations');
+ $page->setTitle('Polytechnique.org - Administration - Formations');
$page->assign('title', 'Gestion des formations');
$table_editor = new PLTableEditor('admin/formations','applis_def','id');
$table_editor->add_join_table('applis_ins','aid',true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_sections(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Sections');
+ $page->setTitle('Polytechnique.org - Administration - Sections');
$page->assign('title', 'Gestion des sections');
$table_editor = new PLTableEditor('admin/sections','sections','id');
$table_editor->describe('text','intitulé',true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_ss_secteurs(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title', 'Polytechnique.org - Administration - Sous-secteurs');
+ $page->setTitle('Polytechnique.org - Administration - Sous-secteurs');
$page->assign('title', 'Gestion des sous-secteurs');
$table_editor = new PLTableEditor('admin/ss_secteurs', 'emploi_ss_secteur', 'id', true);
$table_editor->describe('label', 'intitulé', true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_fonctions(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title', 'Polytechnique.org - Administration - Fonctions');
+ $page->setTitle('Polytechnique.org - Administration - Fonctions');
$page->assign('title', 'Gestion des fonctions');
$table_editor = new PLTableEditor('admin/fonctions', 'fonctions_def', 'id', true);
$table_editor->describe('fonction_fr', 'intitulé', true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_secteurs(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title', 'Polytechnique.org - Administration - Secteurs');
+ $page->setTitle('Polytechnique.org - Administration - Secteurs');
$page->assign('title', 'Gestion des secteurs');
$table_editor = new PLTableEditor('admin/secteurs', 'emploi_secteur', 'id', true);
$table_editor->describe('label', 'intitulé', true);
$table_editor->apply($page, $action, $id);
}
function handler_admin_medals(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Distinctions');
+ $page->setTitle('Polytechnique.org - Administration - Distinctions');
$page->assign('title', 'Gestion des Distinctions');
$table_editor = new PLTableEditor('admin/medals','profile_medals','id');
$table_editor->describe('text', 'intitulé', true);
private function saveAddress($adrid, array &$address)
{
- $flags = array();
+ $flags = new PlFlagSet();
if ($address['secondaire']) {
- $flags[] = 'res-secondaire';
+ $flags->addFlag('res-secondaire');
}
if ($address['mail']) {
- $flags[] = 'courrier';
+ $flags->addFlag('courrier');
}
if ($address['temporary']) {
- $flags[] = 'temporaire';
+ $flags->addFlag('temporaire');
}
if ($address['current']) {
- $flags[] = 'active';
+ $flags->addFlag('active');
}
if ($address['checked']) {
- $flags[] = 'coord-checked';
+ $flags->addFlag('coord-checked');
}
- $flags = implode(',', $flags);
XDB::execute("INSERT INTO adresses (adr1, adr2, adr3,
postcode, city, cityid,
country, region, regiontxt,
}
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
$res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate
FROM profile_medals
|| $this->matchWord($ini, $new, $newLen)
|| ($field == 'nom' && $new == 'DE ' . $old);
if (!$success) {
- global $page;
- $page->trigError("Le $field que tu as choisi ($value) est trop loin de ton $field initial ($init)"
- . (($init == $current)? "" : " et de ton prénom précédent ($current)"));
+ Platal::page()->trigError("Le $field que tu as choisi ($value) est trop loin de ton $field initial ($init)"
+ . (($init == $current)? "" : " et de ton prénom précédent ($current)"));
}
return $success ? $value : $current;
}
}
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
require_once "applis.func.inc.php";
$this->watched['section'] = $this->watched['binets'] = true;
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
$page->assign('mygroups', XDB::iterator("SELECT a.nom, a.site, a.diminutif, a.unsub_url, a.pub, m.perms
FROM groupex.asso AS a
}
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
require_once "emails.combobox.inc.php";
fill_email_combobox($page);
} else if (!is_array($value)) {
$value = array();
} else if (count($value) > 10) {
- global $page;
- $page->trigError("Le nombre de secteurs d'expertise est limité à 10");
+ Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10");
$success = false;
}
ksort($value);
} else if (!is_array($value)) {
$value = array();
} else if (count($value) > 10) {
- global $page;
- $page->trigError("Le nombre de secteurs d'expertise est limité à 10");
+ Platal::page()->trigError("Le nombre de secteurs d'expertise est limité à 10");
$success = false;
}
ksort($value);
}
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
$page->assign('secteurs_sel', XDB::iterator("SELECT id, label
FROM emploi_secteur"));
$value = trim($value);
$success = empty($value) || preg_match("{^(https?|ftp)://[a-zA-Z0-9._%#+/?=&~-]+$}i", $value);
if (!$success) {
- global $page;
- $page->trigError('URL Incorrecte : une url doit commencer par http:// ou https:// ou ftp://'
- . ' et ne pas contenir de caractères interdits');
+ Platal::page()->trigError('URL Incorrecte : une url doit commencer par http:// ou https:// ou ftp://'
+ . ' et ne pas contenir de caractères interdits');
}
return $value;
}
return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
}
$value = trim($value);
- require_once 'xorg.misc.inc.php';
$success = empty($value) || isvalid_email($value);
if (!$success) {
- global $page;
- $page->trigError('Adresse Email invalide');
+ Platal::page()->trigError('Adresse Email invalide');
}
return $value;
}
} else {
$success = preg_match('@(\d{2})/(\d{2})/(\d{4})@', $value, $matches);
if (!$success) {
- global $page;
- $page->trigError("Les dates doivent être au format jj/mm/aaaa");
+ Platal::page()->trigError("Les dates doivent être au format jj/mm/aaaa");
} else {
$day = (int)$matches[1];
$month = (int)$matches[2];
$year = (int)$matches[3];
$success = ($day > 0 && $day <= 31) && ($month > 0 && $month <= 12) && ($year > 1900 && $year <= 2020);
if (!$success) {
- global $page;
- $page->trigError("La date n'a pas une valeur valide");
+ Platal::page()->trigError("La date n'a pas une valeur valide");
}
}
}
}
global $platal;
$log =& $_SESSION['log'];
- $log->log('profil', $platal->pl_self(1));
+ S::logger()->log('profil', $platal->pl_self(1));
}
protected function checkChanges()
return 'profile/base.tpl';
}
- protected function _prepare(PlatalPage &$page, $id)
+ protected function _prepare(PlPage &$page, $id)
{
}
- public function prepare(PlatalPage &$page, $id)
+ public function prepare(PlPage &$page, $id)
{
if (count($this->values) == 0) {
$this->fetchData();
}
return Post::has('next_page') ? PlWizard::NEXT_PAGE : PlWizard::CURRENT_PAGE;
}
- global $page;
- $page->trigError("Certains champs n'ont pas pu être validés, merci de corriger les informations "
- . "de ton profil et de revalider ta demande");
+ Platal::page()->trigError("Certains champs n'ont pas pu être validés, merci de corriger les informations "
+ . "de ton profil et de revalider ta demande");
return PlWizard::CURRENT_PAGE;
}
}
$this->settings['langues'] = new ProfileSkill('langues', 'lid', 'langue_fr');
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
$page->assign('comp_list', XDB::iterator("SELECT id, text_fr, FIND_IN_SET('titre',flags) AS title
FROM competences_def"));
}
}
if ($sub_state['watch']) {
- $alter .= "Inscription d'un utilisateur surveillé - ";
+ $alert .= "Inscription d'un utilisateur surveillé - ";
}
if (check_ip('unsafe')) {
}
$_SESSION['sub_state'] = $sub_state;
- if ($alert) {
+ if (!empty($alert)) {
send_warning_mail($alert);
}
$page->changeTpl('register/step'.intval($sub_state['step']).'.tpl');
$redirect->add_email($email);
// on cree un objet logger et on log l'inscription
- $logger = new CoreLogger($uid);
- $logger->log('inscription', $email);
+ $logger = new PlLogger($uid);
+ S::logger()->log('inscription', $email);
XDB::execute('UPDATE register_pending SET hash="INSCRIT" WHERE uid={?}', $uid);
user_reindex($uid);
// update number of subscribers (perms has changed)
- update_NbIns();
+ $globals->updateNbIns();
if (!start_connexion($uid, false)) {
return PL_FORBIDDEN;
}
$log = S::v('log');
- $log->log('passwd', '');
+ S::logger()->log('passwd', '');
if (Cookie::v('ORGaccess')) {
require_once('secure_hash.inc.php');
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once 'xorg.misc.inc.php';
-
// {{{ function user_cmp
function user_cmp($prenom, $nom, $_prenom, $_nom)
global $globals;
extract ($sub);
- require_once "xorg.misc.inc.php";
$mailorg = make_username($prenom, $nom);
$mailorg2 = $mailorg.sprintf(".%02u", ($promo%100));
$forlife = make_forlife($prenom, $nom, $promo);
"Bonjour,\n\n".
"Un homonyme vient de s'inscrire. La politique de Polytechnique.org est de fournir des\n".
- "adresses mail devinables, nous ne pouvons donc pas conserver ton alias '$mailorg' qui\n".
+ "adresses email devinables, nous ne pouvons donc pas conserver ton alias '$mailorg' qui\n".
"correspond maintenant à deux personnes.\n\n".
"Tu gardes tout de même l'usage de cet alias pour un mois encore à compter de ce jour.\n\n".
function form_prepare()
{
- global $page;
-
- $page->assign('formulaire',1);
+ Platal::page()->assign('formulaire',1);
}
function get_diplomas($school = null)
$types = explode('(',$row[1]);
$types = str_replace("'","",substr($types[1],0,-1));
}
- global $page;
- $page->assign('choix_diplomas', explode(',',$types));
+ Platal::page()->assign('choix_diplomas', explode(',',$types));
}
function handler_quick(&$page, $action = null, $subaction = null)
if (Env::has('quick') || $action == 'geoloc') {
$quick = trim(Env::v('quick'));
if (S::logged() && !Env::has('page')) {
- $_SESSION['log']->log('search', 'quick=' . $quick);
+ S::logger()->log('search', 'quick=' . $quick);
}
$list = 'profile|prf|fiche|fic|referent|ref|mentor';
if (S::has_perms()) {
require_once 'userset.inc.php';
$view = new SearchSet(true, $action == 'geoloc' && substr($subaction, -3) == 'swf');
- $view->addMod('minifiche', 'Minifiches', true, array('with_score' => true));
+ $view->addMod('minifiche', 'Mini-fiches', true, array('with_score' => true));
if (S::logged() && !Env::i('nonins')) {
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true, 'with_score' => true));
$view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
require_once dirname(__FILE__) . '/search/search.inc.php';
$page->changeTpl('search/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Annuaire');
+ $page->setTitle('Polytechnique.org - Annuaire');
}
function handler_advanced(&$page, $action = null, $subaction = null)
'city' => array('table' => 'geoloc_city', 'text' => 'name', 'exact' => false)
);
if (!Env::has('page')) {
- $_SESSION['log']->log('search', 'adv=' . var_export($_GET, true));
+ S::logger()->log('search', 'adv=' . var_export($_GET, true));
}
foreach ($textFields as $field=>&$query) {
if (!Env::v($field) && Env::v($field . 'Txt')) {
require_once 'userset.inc.php';
$view = new SearchSet(false, $action == 'geoloc' && substr($subaction, -3) == 'swf');
- $view->addMod('minifiche', 'Minifiches', true);
+ $view->addMod('minifiche', 'Mini-fiches', true);
$view->addMod('trombi', 'Trombinoscope', false, array('with_promo' => true));
//$view->addMod('geoloc', 'Planisphère', false, array('with_annu' => 'search/adv'));
$view->apply('search/adv', $page, $action, $subaction);
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once("xorg.misc.inc.php");
-
// {{{ Global variables used for the search Queries
@$globals->search->result_fields = '
*/
private static function defaultHandler($explain)
{
- global $page, $globals;
+ global $globals;
+ $page =& Platal::page();
$page->changeTpl('search/index.tpl');
- $page->assign('xorg_title','Polytechnique.org - Annuaire');
+ $page->setTitle('Polytechnique.org - Annuaire');
$page->assign('baseurl', $globals->baseurl);
$page->trigError($explain);
$page->run();
$s = preg_replace('!\d+!', ' ', $s);
$this->strings = preg_split("![^a-zA-Z%]+!",$s, -1, PREG_SPLIT_NO_EMPTY);
if (count($this->strings) > 5) {
- global $page;
- $page->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
+ Platal::page()->trigWarning("Tu as indiqué trop d'éléments dans ta recherche, seuls les 5 premiers seront pris en compte");
$this->strings = array_slice($this->strings, 0, 5);
}
function handler_exit(&$page)
{
- XnetSession::killSuid();
- XnetSession::destroy();
+ Platal::session()->stopSUID();
+ Platal::session()->destroy();
$page->changeTpl('xnet/deconnexion.tpl');
}
if (!may_update()) {
return PL_FORBIDDEN;
}
+ S::assert_xsrf_token();
$res = XDB::query("SELECT asso_id, short_name FROM groupex.evenements
WHERE eid = {?} AND asso_id = {?}",
XDB::execute("DELETE FROM requests
WHERE type = 'paiements' AND data LIKE {?}",
PayReq::same_event($eid, $globals->asso('id')));
- update_NbValid();
+ $globals->updateNbValid();
}
if ($action == 'archive') {
if (!Post::has('submit')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
$moments = Post::v('moment', array());
$page->assign('moments', $moments);
if (Post::v('intitule')) {
+ S::assert_xsrf_token();
+
require_once dirname(__FILE__).'/xnetevents/xnetevents.inc.php';
$short_name = event_change_shortname($page, $eid,
$infos['short_name'],
}
if (may_update() && Post::v('adm')) {
+ S::assert_xsrf_token();
+
$member = get_infos(Post::v('mail'));
if (!$member) {
$page->trigError("Membre introuvable");
function subscribe_lists_event($participate, $uid, $evt)
{
require_once('user.func.inc.php');
- global $globals,$page;
+ global $globals;
+ $page =& Platal::page();
$participant_list = $evt['participant_list'];
$absent_list = $evt['absent_list'];
$res = XDB::query("SELECT email
FROM groupex.membres
WHERE uid = {?} AND asso_id = {?}",
- S::v('uid'), $globals->asso('id'));
+ $uid, $globals->asso('id'));
$email = $res->fetchOneCell();
}
}
$res = XDB::query(
- "SELECT uid, nom, prenom, email, email AS email2, perms='admin', origine, sexe
+ "SELECT uid, nom, prenom, email, email AS email2, perms='admin', origine, comm, sexe
FROM groupex.membres
WHERE $field = {?} AND asso_id = {?}", $email, $globals->asso('id'));
u.prenom, b.alias,
CONCAT(b.alias, '@m4x.org') AS email,
CONCAT(b.alias, '@polytechnique.org') AS email2,
- m.perms = 'admin' AS perms, m.origine,
+ m.perms = 'admin' AS perms, m.origine, m.comm,
FIND_IN_SET('femme', u.flags) AS sexe
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON ( u.user_id = a.id AND a.type != 'homonyme' )
'%grp/forum' => $this->make_hook('forum', AUTH_MDP, 'groupmember'),
'%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP, 'groupannu'),
'%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_MDP, 'groupmember:groupannu'),
+ '%grp/annuaire/csv' => $this->make_hook('csv', AUTH_MDP, 'groupmember:groupannu'),
'%grp/trombi' => $this->make_hook('trombi', AUTH_MDP, 'groupannu'),
'%grp/geoloc' => $this->make_hook('geoloc', AUTH_MDP, 'groupannu'),
'%grp/subscribe' => $this->make_hook('subscribe', AUTH_MDP),
+ '%grp/subscribe/valid' => $this->make_hook('subscribe_valid', AUTH_MDP, 'groupadmin'),
'%grp/unsubscribe' => $this->make_hook('unsubscribe', AUTH_MDP, 'groupmember'),
'%grp/change_rights' => $this->make_hook('change_rights', AUTH_MDP),
AND FIND_IN_SET('public', u.flags)",
$globals->asso('id'));
}
+ if (may_update()) {
+ $subs_valid = XDB::query("SELECT uid
+ FROM groupex.membres_sub_requests
+ WHERE asso_id = {?}",
+ $globals->asso('id'));
+ $page->assign('requests', $subs_valid->numRows());
+ }
if (!S::has('core_rss_hash')) {
$page->setRssLink("Polytechnique.net :: {$globals->asso("nom")} :: News publiques",
if (Post::has('submit')) {
S::assert_xsrf_token();
+ $flags = new PlFlagSet('wiki_desc');
+ if (Post::has('notif_unsub') && Post::i('notif_unsub') == 1) {
+ $flags->addFlag('notif_unsub');
+ }
if (S::has_perms()) {
if (Post::v('mail_domain') && (strstr(Post::v('mail_domain'), '.') === false)) {
$page->trigError("le domaine doit être un FQDN (aucune modif effectuée) !!!");
descr={?}, site={?}, mail={?}, resp={?},
forum={?}, mail_domain={?}, ax={?}, pub={?},
sub_url={?}, inscriptible={?}, unsub_url={?},
- flags='wiki_desc'
+ flags={?}
WHERE id={?}",
Post::v('nom'), Post::v('diminutif'),
Post::v('cat'), Post::i('dom'),
Post::v('forum'), Post::v('mail_domain'),
Post::has('ax'), Post::v('pub'),
Post::v('sub_url'), Post::v('inscriptible'),
- Post::v('unsub_url'),$globals->asso('id'));
+ Post::v('unsub_url'), $flags, $globals->asso('id'));
if (Post::v('mail_domain')) {
- XDB::execute('INSERT INTO virtual_domains (domain) VALUES({?})',
+ XDB::execute('INSERT IGNORE INTO virtual_domains (domain) VALUES({?})',
Post::v('mail_domain'));
}
} else {
"UPDATE groupex.asso
SET descr={?}, site={?}, mail={?}, resp={?},
forum={?}, ax={?}, pub= {?}, sub_url={?},
- unsub_url={?},flags='wiki_desc'
+ unsub_url={?},flags={?}
WHERE id={?}",
Post::v('descr'), Post::v('site'),
Post::v('mail'), Post::v('resp'),
Post::v('forum'), Post::has('ax'),
Post::v('pub'),
Post::v('sub_url'), Post::v('unsub_url'),
- $globals->asso('id'));
+ $flags, $globals->asso('id'));
}
if ($_FILES['logo']['name']) {
$page->addJsLink('ajax.js');
if (Post::has('send')) {
+ S::assert_xsrf_token();
$from = Post::v('from');
$sujet = Post::v('sujet');
$body = Post::v('body');
if ($upload) {
$upload->rm();
}
- $page->kill("Mail envoyé !");
+ $page->kill("Email envoyé !");
$page->assign('sent', true);
}
}
m.perms='admin' AS admin,
m.origine='X' AS x,
u.perms!='pending' AS inscrit,
+ m.comm as comm,
m.uid, IF(e.email IS NULL AND FIND_IN_SET('googleapps', u.mail_storage) = 0, NULL, 1) AS actif
FROM groupex.membres AS m
LEFT JOIN auth_user_md5 AS u ON ( u.user_id = m.uid )
$vcard->do_page($page);
}
+ function handler_csv(&$page, $filename = null)
+ {
+ global $globals;
+ if (is_null($filename)) {
+ $filename = $globals->asso('diminutif') . '.csv';
+ }
+ $ann = XDB::iterator(
+ "SELECT IF(m.origine='X',IF(u.nom_usage<>'', u.nom_usage, u.nom) ,m.nom) AS nom,
+ IF(m.origine='X',u.prenom,m.prenom) AS prenom,
+ IF(m.origine='X', u.promo, IF(m.origine='ext', 'extérieur', 'personne morale')) AS promo,
+ IF(m.origine='X' AND u.perms != 'pending',CONCAT(a.alias, '@', {?}), m.email) AS email,
+ IF(m.origine='X',FIND_IN_SET('femme', u.flags), m.sexe) AS femme,
+ m.comm as comm
+ FROM groupex.membres AS m
+ LEFT JOIN auth_user_md5 AS u ON ( u.user_id = m.uid )
+ LEFT JOIN aliases AS a ON ( a.id = m.uid AND a.type = 'a_vie' )
+ WHERE m.asso_id = {?}
+ AND (m.origine != 'X' OR u.perms != 'pending' OR m.email IS NOT NULL)
+ GROUP BY m.uid
+ ORDER BY nom, prenom",
+ $globals->mail->domain, $globals->asso('id'));
+ header('Content-Type: text/x-csv; charset=utf-8;');
+ header('Pragma: ');
+ header('Cache-Control: ');
+ $page->changeTpl('xnetgrp/annuaire-csv.tpl', NO_SKIN);
+ $page->assign('ann', $ann);
+ }
+
+ private function removeSubscriptionRequest($uid)
+ {
+ global $globals;
+ XDB::execute("DELETE FROM groupex.membres_sub_requests
+ WHERE asso_id = {?} AND uid = {?}",
+ $globals->asso('id'), $uid);
+ }
+
+ private function validSubscription($nom, $prenom, $sexe, $uid, $forlife)
+ {
+ global $globals;
+ $this->removeSubscriptionRequest($uid);
+ XDB::execute("INSERT INTO groupex.membres (asso_id, uid)
+ VALUES ({?}, {?})",
+ $globals->asso('id'), $uid);
+ $mailer = new PlMailer();
+ $mailer->addTo("$forlife@polytechnique.org");
+ $mailer->setFrom('"' . S::v('prenom') . ' ' . S::v('nom')
+ . '" <' . S::v('forlife') . '@polytechnique.org>');
+ $mailer->setSubject('[' . $globals->asso('nom') . '] Demande d\'inscription');
+ $message = ($sexe ? 'Chère' : 'Cher') . " Camarade,\n"
+ . "\n"
+ . " Suite à ta demande d'adhésion à " . $globals->asso('nom') . ",\n"
+ . "j'ai le plaisir de t'annoncer que ton inscription a été validée !\n"
+ . "\n"
+ . "Bien cordialement,\n"
+ . "-- \n"
+ . S::s('prenom') . ' ' . S::s('nom') . '.';
+ $mailer->setTxtBody($message);
+ $mailer->send();
+ }
+
function handler_subscribe(&$page, $u = null)
{
global $globals;
if (!is_null($u) && may_update()) {
$page->assign('u', $u);
- $res = XDB::query("SELECT u.nom, u.prenom, u.promo, u.user_id, FIND_IN_SET('femme', u.flags)
+ $res = XDB::query("SELECT u.nom, u.prenom, u.promo, u.user_id, FIND_IN_SET('femme', u.flags), s.reason
FROM auth_user_md5 AS u
INNER JOIN aliases AS al ON (al.id = u.user_id AND al.type != 'liste')
- WHERE al.alias = {?}", $u);
+ LEFT JOIN groupex.membres_sub_requests AS s ON (u.user_id = s.uid AND s.asso_id = {?})
+ WHERE al.alias = {?}", $globals->asso('id'), $u);
- if (list($nom, $prenom, $promo, $uid, $sexe) = $res->fetchOneRow()) {
+ if (list($nom, $prenom, $promo, $uid, $sexe, $reason) = $res->fetchOneRow()) {
$res = XDB::query("SELECT COUNT(*)
FROM groupex.membres AS m
INNER JOIN aliases AS a ON (m.uid = a.id AND a.type != 'homonyme')
$u, $globals->asso('id'));
$n = $res->fetchOneCell();
if ($n) {
+ $this->removeSubscriptionRequest($uid);
$page->kill("$prenom $nom est déjà membre du groupe !");
return;
- }
- elseif (Env::has('accept'))
- {
- XDB::execute("INSERT INTO groupex.membres (asso_id, uid)
- VALUES ({?}, {?})",
- $globals->asso('id'), $uid);
- $mailer = new PlMailer();
- $mailer->addTo("$u@polytechnique.org");
- $mailer->setFrom('"'.S::v('prenom').' '.S::v('nom')
- .'" <'.S::v('forlife').'@polytechnique.org>');
- $mailer->setSubject('['.$globals->asso('nom').'] Demande d\'inscription');
- $message = ($sexe ? 'Chère' : 'Cher') . " Camarade,\n"
- . "\n"
- . " Suite à ta demande d'adhésion à ".$globals->asso('nom').",\n"
- . "j'ai le plaisir de t'annoncer que ton inscription a été validée !\n"
- . "\n"
- . "Bien cordialement,\n"
- . "-- \n"
- . "{$_SESSION["prenom"]} {$_SESSION["nom"]}.";
- $mailer->setTxtBody($message);
- $mailer->send();
+ } elseif (Env::has('accept')) {
+ S::assert_xsrf_token();
+
+ $this->validSubscription($nom, $prenom, $sexe, $uid, $u);
pl_redirect("member/$u");
- }
- elseif (Env::has('refuse'))
- {
+ } elseif (Env::has('refuse')) {
+ S::assert_xsrf_token();
+
+ $this->removeSubscriptionRequest($uid);
$mailer = new PlMailer();
$mailer->addTo("$u@polytechnique.org");
$mailer->setFrom('"'.S::v('prenom').' '.S::v('nom')
$page->assign('nom', $nom);
$page->assign('promo', $promo);
$page->assign('uid', $uid);
+ $page->assign('reason', $reason);
}
return;
}
return;
}
+ $res = XDB::query("SELECT uid
+ FROM groupex.membres_sub_requests
+ WHERE uid = {?} AND asso_id = {?}",
+ S::i('uid'), $globals->asso('id'));
+ if ($res->numRows() != 0) {
+ $page->kill("Tu as déjà demandé ton inscription à ce groupe. Cette demande est actuellement en attente de validation.");
+ return;
+ }
+
if (Post::has('inscrire')) {
+ S::assert_xsrf_token();
+
+ XDB::execute("INSERT INTO groupex.membres_sub_requests (asso_id, uid, ts, reason)
+ VALUES ({?}, {?}, NOW(), {?})",
+ $globals->asso('id'), S::i('uid'), Post::v('message'));
$res = XDB::query('SELECT IF(m.email IS NULL,
- CONCAT(al.alias,"@polytechnique.org"),
- m.email)
- FROM groupex.membres AS m
- INNER JOIN aliases AS al ON (al.type = "a_vie"
- AND al.id = m.uid)
- WHERE perms="admin" AND m.asso_id = {?}',
- $globals->asso('id'));
+ CONCAT(al.alias,"@polytechnique.org"),
+ m.email)
+ FROM groupex.membres AS m
+ INNER JOIN aliases AS al ON (al.type = "a_vie"
+ AND al.id = m.uid)
+ WHERE perms="admin" AND m.asso_id = {?}',
+ $globals->asso('id'));
$emails = $res->fetchColumn();
$to = implode(',', $emails);
}
}
+ function handler_subscribe_valid(&$page)
+ {
+ global $globals;
+
+ if (Post::has('valid')) {
+ S::assert_xsrf_token();
+ $subs = Post::v('subs');
+ if (is_array($subs)) {
+ $users = array();
+ foreach ($subs as $forlife => $val) {
+ if ($val == '1') {
+ $res = XDB::query("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS u,
+ u.prenom, FIND_IN_SET('femme', u.flags) AS sexe,
+ u.user_id
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON (a.id = u.user_id)
+ WHERE a.alias = {?}", $forlife);
+ if ($res->numRows() == 1) {
+ list($nom, $prenom, $sexe, $uid) = $res->fetchOneRow();
+ $this->validSubscription($nom, $prenom, $sexe, $uid, $forlife);
+ }
+ }
+ }
+ }
+ }
+
+ $it = XDB::iterator("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom,
+ u.prenom, u.promo, a.alias AS forlife, s.ts AS date
+ FROM groupex.membres_sub_requests AS s
+ INNER JOIN auth_user_md5 AS u ON (s.uid = u.user_id)
+ INNER JOIN aliases AS a ON (a.id = s.uid AND a.type = 'a_vie')
+ WHERE asso_id = {?}
+ ORDER BY nom, prenom",
+ $globals->asso('id'));
+
+ $page->changeTpl('xnetgrp/subscribe-valid.tpl');
+ $page->assign('valid', $it);
+ }
+
function handler_change_rights(&$page)
{
if (Env::has('right') && (may_update() || S::has('suid'))) {
switch (Env::v('right')) {
case 'admin':
- XnetSession::killSuid();
+ Platal::session()->stopSUID();
break;
case 'anim':
- XnetSession::doSelfSuid();
+ Platal::session()->doSelfSuid();
may_update(true);
is_member(true);
break;
case 'member':
- XnetSession::doSelfSuid();
+ Platal::session()->doSelfSuid();
may_update(false, true);
is_member(true);
break;
case 'logged':
- XnetSession::doSelfSuid();
+ Platal::session()->doSelfSuid();
may_update(false, true);
is_member(false, true);
break;
}
}
+// var_dump($_SESSION);
http_redirect($_SERVER['HTTP_REFERER']);
}
if (is_null($email)) {
return;
+ } else {
+ S::assert_xsrf_token();
}
if (strpos($email, '@') === false) {
$page->trigError($email." n'est pas un alias polytechnique.org valide.");
}
} else {
- require_once 'xorg.misc.inc.php';
if (isvalid_email($email)) {
if (Env::v('x') && Env::has('userid') && Env::i('userid')) {
$uid = Env::i('userid');
XDB::execute('INSERT INTO groupex.membres (uid, asso_id, origine, email)
VALUES ({?}, {?}, "X", {?})',
$uid, $globals->asso('id'), $email);
+ $this->removeSubscriptionRequest($uid);
pl_redirect("member/$email");
}
$page->trigError("Utilisateur invalide");
pl_redirect("member/$email");
}
} else {
- $page->trigError("« <strong>$email</strong> » n'est pas une adresse mail valide.");
+ $page->trigError("« <strong>$email</strong> » n'est pas une adresse email valide.");
}
}
}
function unsubscribe(&$user)
{
- global $globals, $page;
+ global $globals;
XDB::execute(
"DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}",
$user['uid'], $globals->asso('id'));
+ if ($globals->asso('notif_unsub')) {
+ $mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl');
+ $res = XDB::iterRow("SELECT a.alias, u.prenom, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom
+ FROM groupex.membres AS m
+ INNER JOIN aliases AS a ON (m.uid = a.id AND FIND_IN_SET('bestalias', a.flags))
+ INNER JOIn auth_user_md5 AS u ON (u.user_id = a.id)
+ WHERE m.asso_id = {?} AND m.perms = 'admin'",
+ $globals->asso('id'));
+ while (list($alias, $prenom, $nom) = $res->next()) {
+ $mailer->addTo("\"$prenom $nom\" <$alias@{$globals->mail->domain}>");
+ }
+ $mailer->assign('group', $globals->asso('nom'));
+ $mailer->assign('prenom', $user['prenom']);
+ $mailer->assign('nom', $user['nom']);
+ $mailer->assign('mail', $user['email2']);
+ $mailer->assign('selfdone', $user['uid'] == S::i('uid'));
+ $mailer->send();
+ }
+
$user_same_email = get_infos($user['email']);
$domain = $globals->asso('mail_domain');
$mmlist->unsubscribe($liste['list']);
}
} elseif ($liste['sub']) {
- $page->trigWarning("{$user['prenom']} {$user['nom']} a une"
- ." demande d'inscription en cours sur la"
- ." liste {$liste['list']}@ !");
+ Platal::page()->trigWarning("{$user['prenom']} {$user['nom']} a une"
+ ." demande d'inscription en cours sur la"
+ ." liste {$liste['list']}@ !");
$warning = true;
}
}
if (!Post::has('confirm')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
if ($this->unsubscribe($user)) {
$page->trigSuccess('Vous avez été désinscrit du groupe avec succès.');
} else {
- $page->trigWarning('Vous avez été désinscrit du groupe, mais des erreurs se sont produites lors des désinscriptions des alias et des mailing-lists.');
+ $page->trigWarning('Vous avez été désinscrit du groupe, mais des erreurs se sont produites lors des désinscriptions des alias et des listes de diffusion.');
}
$page->assign('is_member', is_member(true));
}
if (!Post::has('confirm')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
if ($this->unsubscribe($user)) {
}
}
- private function changeLogin(PlatalPage &$page, array &$user, MMList &$mmlist, $login)
+ private function changeLogin(PlPage &$page, array &$user, MMList &$mmlist, $login)
{
require_once 'user.func.inc.php';
// Search the uid of the user...
$globals->asso('mail_domain'));
if (Post::has('change')) {
+ S::assert_xsrf_token();
+
// Convert user status to X
if ($user['origine'] == 'ext' && trim(Post::v('login_X'))) {
$forlife = $this->changeLogin($page, $user, $mmlist, trim(Post::v('login_X')));
SET prenom={?}, nom={?}, email={?}, sexe={?}, origine={?}
WHERE uid={?} AND asso_id={?}',
$user['prenom'], $user['nom'], Post::v('email'),
- $user['sexe'], $user['origine'], $user['uid'],
- $globals->asso('id'));
+ $user['sexe'], $user['origine'],
+ $user['uid'], $globals->asso('id'));
$user['email'] = Post::v('email');
$user['email2'] = Post::v('email');
+ $page->trigSuccess('Données de l\'utilisateur mise à jour.');
}
$perms = Post::i('is_admin');
- if ($user['perms'] != $perms) {
- XDB::query('UPDATE groupex.membres SET perms={?}
+ $comm = trim(Post::s('comm'));
+ if ($user['perms'] != $perms || $user['comm'] != $comm) {
+ XDB::query('UPDATE groupex.membres
+ SET perms={?}, comm={?}
WHERE uid={?} AND asso_id={?}',
- $perms ? 'admin' : 'membre',
+ $perms ? 'admin' : 'membre', $comm,
$user['uid'], $globals->asso('id'));
+ if ($perms != $user['perms']) {
+ $page->trigSuccess('Permissions modifiées !');
+ }
+ if ($comm != $user['comm']) {
+ $page->trigSuccess('Commentaire mis à jour.');
+ }
$user['perms'] = $perms;
- $page->trigSuccess('Permissions modifiées !');
+ $user['comm'] = $comm;
}
// Update ML subscriptions
}
$page->assign('user', $user);
- echo $user['email2'];
$listes = $mmlist->get_lists($user['email2']);
$page->assign('listes', $listes);
$page->assign('rss', $rss);
}
- private function upload_image(PlatalPage &$page, PlUpload &$upload)
+ private function upload_image(PlPage &$page, PlUpload &$upload)
{
if (@!$_FILES['image']['tmp_name'] && !Env::v('image_url')) {
return true;
if (Post::v('valid') == 'Visualiser' || Post::v('valid') == 'Enregistrer'
|| Post::v('valid') == 'Supprimer l\'image' || Post::v('valid') == 'Pas d\'image') {
+ S::assert_xsrf_token();
+
if (!is_null($aid)) {
$art['id'] = $aid;
}
if (Post::v('valid') == 'Enregistrer') {
$promo_min = ($art['public'] ? 0 : $art['promo_min']);
$promo_max = ($art['public'] ? 0 : $art['promo_max']);
- $flags = array();
+ $flags = new PlFlagSet();
if ($art['public']) {
- $flags[] = 'public';
+ $flags->addFlag('public');
}
if ($art['photo']) {
- $flags[] = 'photo';
+ $flags->addFlag('photo');
}
- $flags = implode(',', $flags);
if (is_null($aid)) {
$fulltext = $art['texte'];
if (!empty($art['contact_html'])) {
$page->changeTpl('xnetgrp/announce-admin.tpl');
if (Env::has('del')) {
+ S::assert_xsrf_token();
XDB::execute("DELETE FROM groupex.announces
WHERE id = {?} AND asso_id = {?}",
Env::i('del'), $globals->asso('id'));
$page->changeTpl('xnetlists/index.tpl');
if (Get::has('del')) {
+ S::assert_xsrf_token();
$this->client->unsubscribe(Get::v('del'));
pl_redirect('lists');
}
if (Get::has('add')) {
+ S::assert_xsrf_token();
$this->client->subscribe(Get::v('add'));
pl_redirect('lists');
}
if (Post::has('del_alias') && may_update()) {
+ S::assert_xsrf_token();
+
$alias = Post::v('del_alias');
// prevent group admin from erasing aliases from other groups
$alias = substr($alias, 0, strpos($alias, '@')).'@'.$globals->asso('mail_domain');
if (!Post::has('submit')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
if (!Post::has('liste')) {
$page->changeTpl('xnetlists/sync.tpl');
if (Env::has('add')) {
+ S::assert_xsrf_token();
$this->client->mass_subscribe($liste, array_keys(Env::v('add')));
}
$page->changeTpl('xnetlists/alias-admin.tpl');
if (Env::has('add_member')) {
+ S::assert_xsrf_token();
+
$add = Env::v('add_member');
if (strstr($add, '@')) {
list($mbox,$dom) = explode('@', strtolower($add));
}
if (Env::has('del_member')) {
+ S::assert_xsrf_token();
XDB::query(
"DELETE FROM x4dat.virtual_redirect
USING x4dat.virtual_redirect
if (!Post::has('submit')) {
return;
+ } else {
+ S::assert_xsrf_token();
}
if (!Post::has('liste')) {
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 *
- ***************************************************************************/
-
-global $tidy_config;
-$tidy_config = array(
- 'drop-empty-paras' => true,
- 'drop-font-tags' => true,
- 'drop-proprietary-attributes' => true,
- 'hide-comments' => true,
- 'logical-emphasis' => true,
- 'output-xhtml' => true,
- 'replace-color' => true,
- 'show-body-only' => true,
- 'clean' => false,
- 'join-styles' => false,
- 'join-classes' => false,
- 'alt-text' => '[ inserted by TIDY ]',
- 'wrap' => '120');
-
-/*
- * Smarty plugin
- * -------------------------------------------------------------
- * File: block.min_perms.php
- * Type: block
- * Name: min_perms
- * Purpose:
- * -------------------------------------------------------------
- */
-function smarty_block_tidy($params, $content, &$smarty)
-{
- global $tidy_config;
- return tidy_repair_string($content, $tidy_config, 'utf8');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function smarty_compiler_checkpasswd($tag_attrs, &$compiler)
-{
- extract($compiler->_parse_attrs($tag_attrs));
- if (!isset($width)) {
- $width = '230px';
- }
- if (!isset($prompt)) {
- $prompt = "'nouveau'";
- }
- if (!isset($submit)) {
- $submit = "'submitn'";
- }
-
- return '?><script type="text/javascript" src="javascript/jquery.js" ></script>
- <script type="text/javascript" src="javascript/jquery.color.js" ></script>
- <script type="text/javascript">//<![CDATA[
- var passwordprompt_name = '. $prompt . ';
- var passwordprompt_submit = ' . $submit . ';
- $(":input[@name=' . $prompt . ']").keyup(function(event) { checkPassword(event.target); });
- $(document).ready(function() {
- checkPassword($(":input[@name=' . $prompt . ']").get(0));
- });
- //]]></script>
- <div>
- <div style="border: 1px solid white; width: ' . $width . '; height: 7px; background-color: #444; margin-top: 4px; float: left">
- <div id="passwords_measure" style="height: 100%; background-color: red; width: 0px"></div>
- </div>
- <a href="Xorg/MDP?display=light" style="display: block; float: left; margin-left: 4px;" class="popup_600x800">
- <img src="images/icons/information.gif" alt="Aide" title="Comment construire un mot de passe fort..." />
- </a>
- </div><?php';
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once 'platal.inc.php';
function smarty_compiler_icon($tag_attrs, &$compiler)
{
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 iterate_end($tag_attrs, &$compiler) {
- return 'endwhile;';
-}
-
-function smarty_compiler_iterate($tag_attrs, &$compiler)
-{
- static $reg = false;
- if (!$reg) {
- $reg = true;
- $compiler->register_compiler_function("/iterate", 'iterate_end');
- }
-
- $_params = $compiler->_parse_attrs($tag_attrs);
-
- if (!isset($_params['from'])) {
- $compiler->_syntax_error("iterate: missing 'from' parameter", E_USER_ERROR, __FILE__, __LINE__);
- return;
- }
-
- if (empty($_params['item'])) {
- $compiler->_syntax_error("iterate: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__);
- return;
- }
-
- $_from = $compiler->_dequote($_params['from']);
- $_item = $compiler->_dequote($_params['item']);
-
- return "\$_iterate_$_item = $_from;\n"
- . "while ((\$this->_tpl_vars['$_item'] = \$_iterate_{$_item}->next()) !== null):";
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function smarty_compiler_javascript($tag_attrs, &$compiler)
-{
- extract($compiler->_parse_attrs($tag_attrs));
-
- if (!isset($name)) {
- return null;
- }
- $name = pl_entities(trim($name, '\'"'), ENT_QUOTES);
- $name = "javascript/$name.js";
- if ($full) {
- global $globals;
- $name = $globals->baseurl . '/' . $name;
- }
-
- return "?><script type='text/javascript' src='$name'></script><?php";
-}
-
-/* vim: set expandtab enc=utf-8: */
-
-?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once 'platal.inc.php';
function smarty_function_make_forlife($params, &$smarty)
{
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function select_options($table,$valeur,$champ="text",$pad=false,
- $where="",$join="",$group="")
-{
- $fields = 't.id,' . $champ;
- $order = $champ;
- if ($group) {
- $fields .= ',' . $group;
- $order = $group . ',' . $order;
- }
- $sql = "SELECT $fields FROM $table AS t $join $where ORDER BY $order";
- $res = XDB::iterRow($sql);
- $sel = ' selected="selected"';
-
- // on ajoute une entree vide si $pad est vrai
- $html = "";
- if ($pad) {
- $html.= '<option value="0"'.($valeur==0?$sel:"")."></option>\n";
- }
- $optgrp = null;
- while (list($my_id,$my_text,$my_grp) = $res->next()) {
- if ($my_grp != $optgrp) {
- if (!is_null($optgrp)) {
- $html .= '</optgroup>';
- }
- $html .= '<optgroup label="' . pl_entities($my_grp, ENT_QUOTES) . '">';
- $optgrp = $my_grp;
- }
- $html .= sprintf("<option value=\"%s\" %s>%s</option>\n",
- $my_id, $valeur==$my_id ? $sel : "", pl_entities($my_text));
- }
- if (!is_null($optgrp)) {
- $html .= '</optgroup>';
- }
- return $html;
-}
-
-function smarty_function_select_db_table($params, &$smarty) {
- if(empty($params['table']))
- return;
- if(empty($params['champ']))
- $params['champ'] = 'text';
- if(empty($params['pad']) || !($params['pad']))
- $pad = false;
- else
- $pad = true;
- if(empty($params['where']))
- $params['where'] = '';
- return select_options($params['table'], $params['valeur'], $params['champ'], $pad,
- $params['where'], $params['join'], $params['group']);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
***************************************************************************/
function smarty_function_test_email($params, &$smarty) {
- $label = isset($params['title']) ? $params['title'] : 'Envoyer un mail de test';
+ $label = isset($params['title']) ? $params['title'] : 'Envoyer un email de test';
$token = "'" . S::v('xsrf_token') . (isset($params['forlife']) ? "', " : "'");
$forlife = isset($params['forlife']) ? "'" . $params['forlife'] . "'" : '';
return '<div class="center">'
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function smarty_function_valid_date($params, &$smarty)
-{
- extract($params);
-
- if (!isset($name)) {
- $name = 'valid_date';
- }
- $text = "<select name=\"$name\">";
- if (!isset($from)) {
- $from = 1;
- }
- if (!isset($to)) {
- $to = 30;
- }
- $value = strtr($value, array('-' => ''));
- $time = time() + 3600 * 24 * $from;
- $mth = '';
- for ($i = $from ; $i <= $to ; $i++) {
- $p_stamp = date('Ymd', $time);
- $date = date('d / m / Y', $time);
- $select = ($p_stamp == $value) ? 'selected="selected"' : '';
- $month = pl_entities(strftime('%B', $time), ENT_QUOTES);
- if ($mth != $month) {
- if ($i != $from) {
- $text .= '</optgroup>';
- }
- $text .= "<optgroup label=\"$month\">";
- $mth = $month;
- }
- $time += 3600 * 24;
- $text .= "<option value=\"$p_stamp\" $select>$date</option>";
- }
- return $text . "</optgroup></select>";
-}
-
-/* vim: set expandtab enc=utf-8: */
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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_function_xsrf_token($params, &$smarty) {
- return S::v('xsrf_token', '');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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_date_format($string, $format = '%x', $default_date=null)
-{
- $d = empty($string) ? $default_date : $string;
- if (empty($format) || preg_match('/^[ 0\-]*$/', $d)) return;
- $f = str_replace('%X', '%T', str_replace('%x', '%e %B %Y', $format));
-
- if (preg_match('/^\d{14}$/', $d)) {
- $t = mktime(substr($d,8,2), substr($d,10,2), substr($d,12,2), substr($d,4,2), substr($d,6,2), substr($d,0,4));
- } elseif (preg_match('/^\d{8}$/', $d)) {
- $t = mktime(0, 0, 0, substr($d,4,2), substr($d,6,2), substr($d,0,4));
- } elseif (is_numeric($d)) {
- $t = intval($d);
- } else {
- $t = strtotime($d);
- }
-
- if ( $t != -1 ) {
- return strftime($f , $t);
- } else {
- require_once('Date.php');
- $date = new Date($d);
- return $date->format($f);
- }
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function smarty_modifier_htmlentities($string, $format = ENT_COMPAT)
-{
- return pl_entities($string, $format);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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 'platal.inc.php';
-
-function smarty_modifier_miniwiki($string, $format = 'no_title')
-{
- return MiniWiki::wikiToHTML($string, $format == 'title');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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_number_format($string, $decimal = 0)
-{
- return number_format($string, $decimal, ',', '.');
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2008 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_uint_to_ip($string)
-{
- return uint_to_ip($string);
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
<h1>Gestion des homonymes</h1>
{if $op eq 'mail'}
-<p class="erreur">mail envoyé à {$forlife}</p>
+<p class="erreur">email envoyé à {$forlife}</p>
{elseif $op eq 'correct'}
-<p class="erreur">mail envoyé à {$forlife}, alias supprimé</p>
+<p class="erreur">email envoyé à {$forlife}, alias supprimé</p>
{/if}
{if $op eq 'list' || $op eq 'mail' || $op eq 'correct'}
<a href="profile/{$user.forlife}" class='popup2'>fiche</a>
<a href="admin/user/{$user.forlife}">edit</a>
{if $user.type eq 'alias'}
- <a href="admin/homonyms/mail-conf/{$user.user_id}">mailer</a>
+ <a href="admin/homonyms/mail-conf/{$user.user_id}">envoyer un email</a>
<a href="admin/homonyms/correct-conf/{$user.user_id}">corriger</a>
{/if}
</td>
{xsrf_token_field}
<table class="bicol">
<tr>
- <th>Envoyer un mail pour prévenir l'utilisateur</th>
+ <th>Envoyer un email pour prévenir l'utilisateur</th>
</tr>
<tr>
<td>
{$prenom},
-Comme nous t'en avons informé par mail il y a quelques temps,
-pour respecter nos engagements en terme d'adresses e-mail devinables,
+Comme nous t'en avons informé par email il y a quelques temps,
+pour respecter nos engagements en terme d'adresses email devinables,
tu te verras bientôt retirer l'alias {$loginbis}@{#globals.mail.domain#} pour
ne garder que {$forlife}@{#globals.mail.domain#}.
<textarea cols="80" rows="20" name="mailbody">
{$prenom},
-Comme nous t'en avons informé par mail il y a quelques temps,
+Comme nous t'en avons informé par email il y a quelques temps,
nous t'avons retiré de façon définitive l'adresse
{$loginbis}@{#globals.mail.domain#}.
{* *}
{**************************************************************************}
-<h1>Mails en attente de décision</h1>
+<h1>Emails en attente de décision</h1>
<table class="bicol" cellpadding='0' cellspacing='0'>
<tr>
<th>Checksum</th>
- <th>Nb mails reçus</th>
+ <th>Nb d'emails reçus</th>
<th>Dernier reçu</th>
<th>Premier reçu</th>
<th>Etat</th>
<div>
<input type="hidden" name="crc" value="{$m.crc}" />
<input type="submit" name="ok" value="Laisser passer" />
- <input type="submit" name="del" value="Effacer les mails" />
+ <input type="submit" name="del" value="Effacer les emails" />
</div>
</form>
</td>
{if !$smarty.request.login && !$mr.forlife}
<tr class="pair">
<td class="center">
- Il est possible d'entrer ici n'importe quelle adresse mail : redirection, melix, ou alias.
+ Il est possible d'entrer ici n'importe quelle adresse email : redirection, melix, ou alias.
</td>
</tr>
{/if}
<table class="tinybicol" cellpadding="2" cellspacing="0">
<tr>
<th class="alias" colspan="3">
- Alias e-mail
+ Alias email
</th>
</tr>
{iterate from=$aliases item=a}
{cycle assign=class values="impair,pair"}
<tr class="{$class}">
<td class="titre" colspan="2">
- Ajouter un email
+ Ajouter une adresse
</td>
<td>
<input type="text" name="email" size="29" maxlength="60" value="" />
<tr class="{$class}">
<td colspan="4" class="center">
{if $actives}
- <input type="submit" name="disable_fwd" value="Désactiver la redirection mail" />
+ <input type="submit" name="disable_fwd" value="Désactiver la redirection des emails" />
{/if}
{if $disabled}
- <input type="submit" name="enable_fwd" value="Réactiver la redirection mail" />
+ <input type="submit" name="enable_fwd" value="Réactiver la redirection des emails" />
{/if}
</td>
</tr>
{/if}
<fieldset>
- <legend>Sujet du mail : <input type="text" name="subject" value="{$subject}" size="60"/></legend>
+ <legend>Sujet de l'email : <input type="text" name="subject" value="{$subject}" size="60"/></legend>
<p class="center">
<a href="wiki_help" class="popup3">
{icon name=information title="Syntaxe wiki"} Voir les marqueurs de mise en forme autorisés
{if $ax_rights && !$new}
<tr class="pair">
<td colspan="2" class="center">
- <a href="ax/edit">{icon name=page_edit} Proposer un nouveau mail</a>
+ <a href="ax/edit">{icon name=page_edit} Proposer un nouvel email</a>
</td>
</tr>
{elseif $ax_rights && $new}
{$banana|smarty:nodefaults}
{else}
-{if !$smarty.post.action}
<p class="normal">
Tu peux régler quelques paramètres qui apparaîtront sur les messages lorsque
tu posteras sur les forums. Cela ne te permettra pas d'être anonyme, puisque
</p>
<form action="banana/profile" method="post">
+ {xsrf_token_field}
<table class="bicol" cellpadding="3" cellspacing="0" summary="Configuration de Banana">
<tr>
<th colspan="2">Profil Banana</th>
</td>
</tr>
<tr class="pair">
+ <td class="titre">Aspect de l'arborescence</td>
+ <td>
+ {foreach from=$colors item=color}
+ <label>non-lu <input type="radio" name="unread" value="{$color}" {if $unread eq $color}checked="checked"{/if} /></label>
+ <img src="images/banana/m2{$color}.gif" alt="{$color}" />
+ <label><input type="radio" name="read" value="{$color}" {if $read eq $color}checked="checked"{/if} /> lu</label>
+ <br />
+ {/foreach}
+ </td>
+ </tr>
+ <tr class="pair">
<td class="titre">Mise à jour des messages non lus</td>
<td>
<input type="radio" name="bananaupdate" value="1"
</table>
<div class="center"><input type="submit" name="action" value="Enregistrer" /></div>
</form>
-{else}
-<p class="normal">
- Ton profil est enregistré !!!
-</p>
-{/if}
{/if}
{if !$it_is_xnet}
<p class="smaller">
Ma liste personnelle de contacts
</h1>
-<div>
-Ajouter la personne suivante à ma liste de contacts :
-<div style="float: right">
-<form id="add_user" action="carnet/contacts" method="post">
- {xsrf_token_field}
- <div>
- <input type="hidden" name="action" value="ajouter" />
- <input type="text" size="30" name="user" class="quick_search"
- value="ajouter prenom.nom"
- onfocus="if (this.value == 'ajouter prenom.nom') this.value=''"
- onblur="if (this.value == '') this.value='ajouter prenom.nom'"
- size="20" maxlength="70"/>
- <a href="" onclick="document.getElementById('add_user').submit(); return false;">
- {icon name=add title="Ajouter la personne"}
- </a>
+<p>
+ <div style="float: right">
+ <form id="add_user" action="carnet/contacts" method="post">
+ {xsrf_token_field}
+ <div>
+ <input type="hidden" name="action" value="ajouter" />
+ <input type="text" size="30" name="user" class="quick_search"
+ value="ajouter prenom.nom"
+ onfocus="if (this.value == 'ajouter prenom.nom') this.value=''"
+ onblur="if (this.value == '') this.value='ajouter prenom.nom'"
+ size="20" maxlength="70"/>
+ <a href="" onclick="document.getElementById('add_user').submit(); return false;">
+ {icon name=add title="Ajouter la personne"}
+ </a>
+ </div>
+ </form>
</div>
+ Ajouter à tes contacts :
</p>
-</form>
-</div>
-</div>
<p style="clear: both">
- Tu peux également rajouter des camarades dans tes contacts lors d'une recherche dans l'annuaire :
- il te suffit de cliquer sur l'icône {icon name=add} en face de son nom dans les résultats !
-</p>
+ Sur la page de résultats d'une recherche, tu peux ajouter un contact en cliquant sur {icon name=add}.
+</p>
-{if $plset_count || $smarty.request.quick}
<p>
-Pour récupérer ta liste de contacts dans un PDF imprimable :<br />
-(attention, les photos font beaucoup grossir les fichiers !)
+ Tu peux télécharger des informations sur tes contacts :
</p>
+{if $plset_count || $smarty.request.quick}
<ul>
- <li>avec les photos :
- [<a href="carnet/contacts/pdf/promo/photos/mescontacts.pdf" class='popup'><strong>tri par promo</strong></a>]
- [<a href="carnet/contacts/pdf/photos/mescontacts.pdf" class='popup'><strong>tri par noms</strong></a>]
- </li>
- <li>sans les photos :
+ <li>Tes contacts en PDF, sans les photos :
[<a href="carnet/contacts/pdf/promo/mescontacts.pdf" class='popup'><strong>tri par promo</strong></a>]
[<a href="carnet/contacts/pdf/mescontacts.pdf" class='popup'><strong>tri par noms</strong></a>]
</li>
-</ul>
-
-<p>
- Tu peux télécharger des informations sur tes contacts :
-</p>
-<ul>
+ <li>Avec les photos (attention fichier plus gros) :
+ [<a href="carnet/contacts/pdf/promo/photos/mescontacts.pdf" class='popup'><strong>tri par promo</strong></a>]
+ [<a href="carnet/contacts/pdf/photos/mescontacts.pdf" class='popup'><strong>tri par noms</strong></a>]
+ </li>
<li>
{icon name=calendar_view_day title='Anniversaires'}
<a href="carnet/contacts/ical/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}/anniv-x.ics" title="Anniversaires">
</div>
</form>
</div>
- Tu peux faire une recherche sur tes contacts :
+ Rechercher dans tes contacts :
</p>
{include file="core/plset.tpl"}
--
L'Équipe de Polytechnique.org
-'''''Note:''''' Tu reçois ce mail car tu as activé la notification automatique par mail des événements que tu surveilles.\\
+'''''Note:''''' Tu reçois cet email car tu as activé la notification automatique par email des événements que tu surveilles.\\
Tu peux changer cette option sur la [[https://www.polytechnique.org/carnet/notifs|page de configuration des notifications]].
{/if}
<h1>Notifications automatiques</h1>
-<p>Les mails sont hebdomadaires (pour éviter une trop grosse charge du serveur de mails et de ta boite mail).
-S'il n'y a rien à te signaler le mail ne t'est pas envoyé.</p>
+<p>Les emails sont hebdomadaires (pour éviter une trop grosse charge du serveur d'envoi et de ta boite email).
+S'il n'y a rien à te signaler l'email ne t'est pas envoyé.</p>
<form action="carnet/notifs" method="post">
{xsrf_token_field}
<fieldset>
- <legend>Mail</legend>
+ <legend>Email</legend>
<input type='checkbox' name='mail' onclick="this.form.submit();" {if $watch->watch_mail}checked="checked"{/if} />
- Recevoir un mail hebdomadaire des événements que je n'ai pas déjà vus sur le site<br />
+ Recevoir un email hebdomadaire des événements que je n'ai pas déjà vus sur le site<br />
<input type='hidden' name='flags_mail' value='valider' />
</fieldset>
</form>
<option value="wish">Souhait</option>\r
<option value="help">Aide/Dépannage</option>\r
</select>\r
- Sujet : <input type="text" name="item_summary" id="flyspray_title" value="sur la page {$smarty.server.HTTP_REFERER}" size="50" maxlength="100"/>\r
+ Sujet : <input type="text" name="item_summary" id="flyspray_title" value="sur la page { $location }" size="50" maxlength="100"/>\r
<textarea name="detailed_desc" id="flyspray_detail" cols="70" rows="10" style="width:100%;margin-top:10px;margin-bottom:10px;height:400px;display:block;" onFocus="cleanContent()" onBlur="fillContent()"></textarea>\r
<input type="hidden" name="page" value="{$smarty.server.HTTP_REFERER|default:$smarty.request.page}" />\r
<div class="center">\r
</p>
<ul>
<li>
- Si tu viens de terminer ta pré-inscription, <strong>il est dans le mail</strong> que
+ Si tu viens de terminer ta pré-inscription, <strong>il est dans l'email</strong> que
nous t'avons envoyé (expéditeur pre-inscription@{#globals.mail.domain#}).
</li>
<li>
Si tu n'es jamais venu sur le site, <strong>il faut t'enregistrer auprès de
- nous</strong> pour obtenir un accès. {#globals.core.sitename#} c'est l'e-mail des X,
+ nous</strong> pour obtenir un accès. {#globals.core.sitename#} c'est l'email des X,
l'annuaire en ligne, plus un tas d'autres services. Nous te fournirons un accès le plus
rapidement possible. <strong> <a href="register/">Clique ici pour nous demander tes
paramètres personnels.</a></strong>
{* *}
{**************************************************************************}
-<div style="clear: both">
+<div id="pl_set_top" style="clear: both">
<h1 style="display: block; float: left">
{$plset_mods[$plset_mod]}
{if $plset_mods|@count > 1}[
{foreach from=$plset_mods key=mod item=desc name=mods}
{if $mod neq $plset_mod}
{if $has_prev}| {/if}
- <a href="{$platal->ns}{$plset_base}/{$mod}{$plset_search}">{$desc}</a>
+ <a href="{$platal->ns}{$plset_base}/{$mod}{$plset_search}#pl_set_top">{$desc}</a>
{assign var=has_prev value=true}
{/if}
{/foreach}
{if strlen(trim($vcard.freetext)) == 0}
NOTE:(X{$vcard.promo})
{else}
-NOTE:(X{$vcard.promo})\n{$vcard.freetext|vcard_enc}
+NOTE:(X{$vcard.promo})\n{$vcard.freetext|miniwiki:'no_title':'text'|vcard_enc}
{/if}
{if $vcard.section}
X-SECTION:{$vcard.section}
<p>
La demande de création des alias <strong>{$success}@{#globals.mail.alias_dom#}</strong> et
<strong>{$success}@{#globals.mail.alias_dom2#}</strong> a bien été enregistrée. Après
- vérification, tu recevras un mail te signalant l'ouverture de ces adresses.
+ vérification, tu recevras un email te signalant l'ouverture de ces adresses.
</p>
<p>
- Encore merci de nous faire confiance pour tes e-mails !
+ Encore merci de nous faire confiance pour tes emails !
</p>
{else}
<h1>
- Adresses e-mail personnalisées
+ Adresses email personnalisées
</h1>
{if $actuel}
{else}
<p>
- Pour plus de <strong>convivialité</strong> dans l'utilisation de tes mails, tu peux choisir une adresse
- e-mail discrète et personnalisée. Ce nouvel e-mail peut par exemple correspondre à ton surnom.
+ Pour plus de <strong>convivialité</strong> dans l'utilisation de tes emails, tu peux choisir une adresse
+ email discrète et personnalisée. Ce nouvel email peut par exemple correspondre à ton surnom.
</p>
{/if}
<fieldset>
<legend><strong>Choisis ton propre réglage :</strong></legend>
<input id='s0' type='radio' name='statut_filtre' value='0' {if $filtre eq 0}checked="checked"{/if} onclick="Ajax.update_html(null, '{$globals->baseurl}/emails/antispam/'+this.value, bogoUpdated)" />
- <label for='s0'>(1) le filtre anti-spam n'agit pas sur tes mails</label>
+ <label for='s0'>(1) le filtre anti-spam n'agit pas sur tes emails</label>
<br />
<input id='s1' type='radio' name='statut_filtre' value='1' {if $filtre eq 1}checked="checked"{/if} onclick="Ajax.update_html(null, '{$globals->baseurl}/emails/antispam/'+this.value, bogoUpdated)" />
- <label for='s1'>(2) le filtre anti-spam marque les mails</label>
+ <label for='s1'>(2) le filtre anti-spam marque les emails</label>
<br />
<input id='s2' type='radio' name='statut_filtre' value='2' {if $filtre eq 2}checked="checked"{/if} onclick="Ajax.update_html(null, '{$globals->baseurl}/emails/antispam/'+this.value, bogoUpdated)" />
- <label for='s2'>(3) le filtre anti-spam marque les mails, et élimine les spams avec des notes les plus hautes</label>
+ <label for='s2'>(3) le filtre anti-spam marque les emails, et élimine les spams avec des notes les plus hautes</label>
<br />
<input id='s3' type='radio' name='statut_filtre' value='3' {if $filtre eq 3}checked="checked"{/if} onclick="Ajax.update_html(null, '{$globals->baseurl}/emails/antispam/'+this.value, bogoUpdated)" />
- <label for='s3'>(4) le filtre anti-spam élimine les mails détectés comme spams</label>
+ <label for='s3'>(4) le filtre anti-spam élimine les emails détectés comme spams</label>
</fieldset>
<div id="bogo-msg" style="position:absolute;"></div><br />
</p>
<p>
Nous pensons qu'il serait une bonne idée de le prévenir que cette adresse email ne fonctionne plus.
- Si tu veux que nous lui envoyions un mail automatique de ta part pour le prévenir,
+ Si tu veux que nous lui envoyions un email automatique de ta part pour le prévenir,
<a href="emails/broken/warn/{$email}?token={xsrf_token}">clique sur ce lien</a>.
</p>
{elseif $x}
<td><input type="text" name="emailN" /></td>
{else}
<td>
- <a href="mailto:{$doublon.mail}">{icon name=email title="Envoyer un mail"}</a>
+ <a href="mailto:{$doublon.mail}">{icon name=email title="Envoyer un email"}</a>
{$doublon.mail}
<input type="hidden" name="emailN" value="{$doublon.mail}" />
</td>
<p class="smaller">
{if $homonyme}
Tu as un homonyme X donc tu ne peux pas profiter de l'alias {$homonyme}@{#globals.mail.domain#}. Si quelqu'un essaie
-d'envoyer un mail à cette adresse par mégarde il recevra une réponse d'un robot lui expliquant l'ambiguité et lui
+d'envoyer un email à cette adresse par mégarde il recevra une réponse d'un robot lui expliquant l'ambiguité et lui
proposant les adresses des différents homonymes.
{else}
Si tu venais à avoir un homonyme X, l'alias prenom.nom@{#globals.mail.domain#} sera désactivé. Si bien que
{/if}
{if #globals.mailstorage.imap_active# or hasPerm('admin')}
<p>
- Polytechnique.org te propose de conserver les mails que tu reçois, pendant une durée limitée (environ 30 jours).
- Grâce à ce service, tu disposes d'une sauvegarde de tes mails en secours, au cas où, par exemple, tu effacerais
- un mail par erreur.<br />
+ Polytechnique.org te propose de conserver les emails que tu reçois, pendant une durée limitée (environ 30 jours).
+ Grâce à ce service, tu disposes d'une sauvegarde de tes emails en secours, au cas où, par exemple, tu effacerais
+ un email par erreur.<br />
<strong>Attention :</strong> il ne s'agit que d'un service de secours, dont la disponibilité n'est pas garantie.
</p>
{$smarty.session.forlife}@{#globals.mail.domain#} (attention, cela demande de la concentration).
</p>
<p>
- Si tu utilises le service POP de poly pour récupérer tes mails dans ton logiciel de courrier,
+ Si tu utilises le service POP de poly pour récupérer tes emails dans ton logiciel de courrier,
l'équipe de Polytechnique.org te conseille de rediriger :
</p>
<ul>
{* *}
{**************************************************************************}
-<h1>Envoyer un mail</h1>
+<h1>Envoyer un email</h1>
<script type="text/javascript">//<![CDATA[
{literal}
{
_selectAll('to_contacts');
_selectAll('cc_contacts');
- if(form.sujet.value == "" && !confirm("Le sujet du mail est vide, veux-tu continuer ?")) {
+ if(form.sujet.value == "" && !confirm("Le sujet de l'email est vide, veux-tu continuer ?")) {
form.sujet.focus();
return false;
}
if (form.to.value == "" && form.cc.value == ""
&& document.getElementById('to_contacts').length == 0 && document.getElementById('cc_contacts').length == 0) {
if (form.bcc.value == "") {
- alert("Il faut définir au moins un destinataire au mail.");
+ alert("Il faut définir au moins un destinataire.");
return false;
}
if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer ?")) {
//]]>
</script>
+<p>
+ <small>{icon name=information title="Envoi d'email"} Pour envoyer un email, tu peux soit le faire depuis l'interface
+ ci-dessous, soit utiliser <a href="Xorg/SMTPSecurise">notre serveur d'envoi SMTP<a>.</small>
+</p>
+
<form action="emails/send" method="post" enctype="multipart/form-data" id="form_mail" onsubmit="return check(this);">
{xsrf_token_field}
<table class="bicol" cellpadding="2" cellspacing="0">
<tr class="pair">
<td colspan="2" class="smaller">
• Les destinataires sont simplement séparés par des virgules.<br />
- • Pense à te mettre en copie cachée du mail pour en avoir une trace.
+ • Pense à te mettre en copie cachée de l'email pour en avoir une trace.
</td>
</tr>
{if $contacts|@count}
<div class="center">
Tu peux utiliser des <a href="wiki_help" class="popup3">{icon name=information title="Syntaxe wiki"} marqueurs wiki</a> pour formatter ton texte.<br />
<small><input type="checkbox" name="nowiki" value="1" {if $smarty.request.nowiki}checked="checked"{/if} onchange="updateWikiView(this);" />
- coche cette case pour envoyer le mail en texte brut, sans formattage</small>
+ coche cette case pour envoyer l'email en texte brut, sans formattage</small>
</div>
<div id="preview">
<div id="preview_pv" style="display: none">
- <strong>Aperçu du mail :</strong>
+ <strong>Aperçu de l'email :</strong>
<div id="mail_preview">
</div>
<div class="center">
<p>
Pour soumettre un (non-)spam mal détecté par notre <a href="emails/antispam">antispam</a>, il suffit d'enregistrer
- les sources (regarde dans la documentation de ton client mail dans la liste ci-dessous) du mail en tant que fichier
- depuis ton client mail, puis de soumettre ce fichier à l'interface ci-dessus en sélectionnant l'action adaptée :
+ les sources (regarde dans la documentation de ton client email dans la liste ci-dessous) de l'email en tant que fichier
+ depuis ton client email, puis de soumettre ce fichier à l'interface ci-dessus en sélectionnant l'action adaptée :
</p>
<ul>
<li><strong>spam</strong> : pour soumettre un spam mal reconnu ;</li>
- <li><strong>nonspam</strong> : pour soumettre un mail légitime mal reconnu.</li>
+ <li><strong>nonspam</strong> : pour soumettre un email légitime mal reconnu.</li>
</ul>
{include wiki=Xorg.Mails part=clients}
{elseif $mail_part eq 'wiki'}
{if $sexe}Chère{else}Cher{/if} {$prenom},
-Tu reçois ce mail car tu as demandé la confirmation du bon fonctionnement de ton adresse polytechnicienne {$email}.
-{if count($redirects) gt 1}Si toutes tes redirections fonctionnent correctement tu devrais recevoir une copie de ce mail
+Tu reçois cet email car tu as demandé la confirmation du bon fonctionnement de ton adresse polytechnicienne {$email}.
+{if count($redirects) gt 1}Si toutes tes redirections fonctionnent correctement tu devrais recevoir une copie de cet email
dans les boîtes suivantes :
{foreach from=$redirects item=mail}
* {$mail->display_email}
Tu trouveras sur le site divers outils pour gérer ton adresse email :
* [[https://www.polytechnique.org/emails/redirect|La gestion de tes redirections]]
* [[https://www.polytechnique.org/emails/antispam|La gestion de ton antispam]]
-* [[https://www.polytechnique.org/emails/send|Un formulaire pour envoyer des mails d'où que tu sois]]
+* [[https://www.polytechnique.org/emails/send|Un formulaire pour envoyer des emails d'où que tu sois]]
N'hésite pas à venir découvrir ou redécouvrir les services du site grâce au [[https://www.polytechnique.org/review|tour d'horizon]].
<td class="right">{if !$ev.fvalide}<strong>{/if}{$ev.peremption}{if !$ev.fvalide}</strong>{/if}</td>
<td class="right" style="width: 42px">
{if $arch}
- <a href="admin/events/unarchive/{$ev.id}">{icon name=package_delete title="Désarchiver"}</a><br />
+ <a href="admin/events/unarchive/{$ev.id}?token={xsrf_token}">{icon name=package_delete title="Désarchiver"}</a><br />
{else}
{if $ev.fvalide}
- <a href="admin/events/unvalid/{$ev.id}">{icon name=thumb_down title="Invalider"}</a>
- <a href="admin/events/archive/{$ev.id}">{icon name=package_add title="Archiver"}</a><br />
+ <a href="admin/events/unvalid/{$ev.id}?token={xsrf_token}">{icon name=thumb_down title="Invalider"}</a>
+ <a href="admin/events/archive/{$ev.id}?token={xsrf_token}">{icon name=package_add title="Archiver"}</a><br />
{else}
- <a href="admin/events/valid/{$ev.id}">{icon name=thumb_up title="Valider"}</a><br />
+ <a href="admin/events/valid/{$ev.id}?token={xsrf_token}">{icon name=thumb_up title="Valider"}</a><br />
{/if}
{/if}
<a href="admin/events/edit/{$ev.id}">{icon name=page_edit title="Editer"}</a>
- <a href="admin/events/delete/{$ev.id}">{icon name=delete title="Supprimer"}</a>
+ <a href="admin/events/delete/{$ev.id}?token={xsrf_token}">{icon name=delete title="Supprimer"}</a>
</td>
</tr>
{if $ev.preview}
<br />
<form action="{$platal->path}" method="post" enctype="multipart/form-data">
+ {xsrf_token_field}
<table class="bicol">
<tr>
<th colspan="2">Contenu de l'annonce</th>
</td>
</tr>
<tr class="impair">
- <td class="titre">Redirection des mails</td><td>{if $googleapps_storage}activée{else}désactivee{/if}</td>
+ <td class="titre">Redirection des emails</td><td>{if $googleapps_storage}activée{else}désactivee{/if}</td>
</tr>
<tr class="pair">
<td class="titre">Dernière utilisation du webmail</td><td>{$a->r_last_webmail|date_format:"%Y-%m-%d"}</td>
</tr>
<tr class="pair">
- <td class="titre">Utilisation du quota mail</td><td>{$a->r_disk_usage/1024/1024|string_format:"%.2f"}MB</td>
+ <td class="titre">Utilisation du quota d'emails</td><td>{$a->r_disk_usage/1024/1024|string_format:"%.2f"}MB</td>
</tr>
</table><br />
<li>Soit en passant par la <a href="http://google.polytechnique.org/">la page d'accueil Google de Polytechnique.org</a> ;</li>
<li>Soit en utilisant directement les différents services :
<ul>
- <li>Pour tes mails, sur le <a href="http://mail.google.com/a/polytechnique.org/">GMail de Polytechnique.org</a> ;</li>
+ <li>Pour tes emails, sur le <a href="http://mail.google.com/a/polytechnique.org/">GMail de Polytechnique.org</a> ;</li>
<li>Pour ton calendrier, sur <a href="http://www.google.com/calendar/hosted/polytechnique.org/">Google Calendar</a> ;</li>
<li>Pour tes documents, sur <a href="http://docs.google.com/a/polytechnique.org/">Google Docs</a>.</li>
</ul>
</tr>
{if $account->reporting_date and $account->r_disk_usage}
<tr class="pair">
- <td>Au {$account->reporting_date|date_format:"%d %B %Y"}, tu avais {$account->r_disk_usage/1024/1024|string_format:"%.1f"} Mo de mails.</td>
+ <td>Au {$account->reporting_date|date_format:"%d %B %Y"}, tu avais {$account->r_disk_usage/1024/1024|string_format:"%.1f"} Mo d'emails.</td>
</tr>
{/if}
<tr class="impair">
{if $redirect_active and $redirect_unique}
<td>
- Ta seule adresse de redirection de tes mails est celle de ton compte Google Apps.<br />
+ Ta seule adresse de redirection de tes emails est celle de ton compte Google Apps.<br />
Si tu souhaites désactiver celui-ci, tu dois d'abord <a href="emails/redirect">ajouter une nouvelle adresse de redirection</a>.
</td>
{else}
</form>
</div>
<div style="margin-top: 0.5em">
- {icon name=error} Une fois ton compte désactivé, tu ne pourras plus accéder à tes mails sur Google Apps.<br />
+ {icon name=error} Une fois ton compte désactivé, tu ne pourras plus accéder à tes emails sur Google Apps.<br />
{icon name=information} La réactivation est possible, mais nécessite d'être validée par un administrateur.
</div>
</td>
{/if}
</tr>
<tr class="pair">
- <td class="center"><a href="emails/redirect">Changer mes redirections mail</a></td>
+ <td class="center"><a href="emails/redirect">Changer mes redirections email</a></td>
</tr>
</table>
{/if}
{/if}
{if $address.email}
<tr>
- <td><em>E-mail: </em></td>
+ <td><em>Email : </em></td>
<td><strong>{$address.email}</strong></td>
</tr>
{/if}
<td><a href='admin/user/{$valid->m_forlife}'>{$valid->m_prenom} {$valid->m_nom} ({$valid->m_promo})</a></td>
</tr>
<tr class="pair">
- <td class="titre">Mail proposé</td>
+ <td class="titre">Email proposé</td>
<td>{$valid->m_email}</td>
</tr>
{if $valid->m_comment}
{* *}
{**************************************************************************}
-<input type="text" name="listname" size="25" maxlength="200" value="{$valid->liste}" />
+<strong>Nom de la liste :</strong>
+<input type="text" name="listname" size="25" maxlength="200" value="{$valid->liste}" /><br />
+<strong>Type de liste :</strong>
+<label><input type="radio" name="assotype" value="binet" {if $valid->asso eq "binet"}checked="checked"{/if} />binet</label>
+<label><input type="radio" name="assotype" value="" {if !$valid->asso}checked="checked"{/if} />quelconque</label>
+<label><input type="radio" name="assotype" value="alias" {if $valid->asso eq "alias"}checked="checked"{/if} />alias</label>
+<label><input type="radio" name="assotype" value="groupex" {if $valid->asso eq "groupex"}checked="checked"{/if} />groupe X</label><br />
+<strong>Domaine :</strong> <input type="text" name="domainname" size="25" maxlength="200" value="{$valid->domain}" />
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<tr class="pair">
<td class="titre">Liste :</td>
- <td>{$valid->liste}@polytechnique.org</td>
+ <td>{$valid->liste}@{$valid->domain}</td>
</tr>
<tr class="pair">
<td class="titre">Desc :</td>
</td>
</tr>
<tr class="pair">
+ <td class="titre">Type de liste :</td>
+ <td style="border: 1px dotted inherit">
+ {$valid->asso}
+ </td>
+</tr>
+<tr class="pair">
<td class="titre">Propriétés :</td>
<td>
<table cellpadding='2' cellspacing='0'>
<tr>
- <td>visibilité:</td>
+ <td>visibilité :</td>
<td>{if $valid->advertise}publique{else}privée{/if}</td>
</tr>
<tr>
- <td>diffusion:</td>
+ <td>diffusion :</td>
<td>{if $valid->modlevel eq 2}modérée{elseif $valid->modlevel}restreinte{else}libre{/if}</td>
</tr>
<tr>
- <td>inscription:</td>
+ <td>inscription :</td>
<td>{if $valid->inslevel}modérée{else}libre{/if}</td>
</tr>
</table>
</tr>
{/if}
<tr class="pair">
- <td class="titre">Mail deviné</td>
+ <td class="titre">Email deviné</td>
<td>{$valid->m_email}</td>
</tr>
<tr class="pair">
- <td class="titre">Envoi de mail ...</td>
+ <td class="titre">Envoi d'email ...</td>
<td>{if $valid->perso}perso{else}par poly.org{/if}</td>
</tr>
{if $c.iso3166_3}
<img src='images/flags/{$c.iso3166_3}.gif' alt='{$c.nat3}' height='11' title='{$c.nat3}' />
{/if}
- (X {$c.promo}{if $c.app0text}, {applis_fmt type=$c.app0type text=$c.app0text url=$c.app0url}{*
- *}{/if}{if $c.app1text}, {applis_fmt type=$c.app1type text=$c.app1text url=$c.app1url}{/if})
- {if $c.dcd}décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
- {if $smarty.session.auth ge AUTH_COOKIE}
- {if !$c.dcd && !$c.wasinscrit}
- <a href="marketing/public/{$c.user_id}" class='popup'>clique ici si tu connais son adresse email !</a>
- {/if}
- {/if}
+ X {$c.promo}{if $c.app0text}, {applis_fmt type=$c.app0type text=$c.app0text url=$c.app0url}{*
+ *}{/if}{if $c.app1text}, {applis_fmt type=$c.app1type text=$c.app1text url=$c.app1url}{/if}{*
+ *}{if $c.dcd}, décédé{if $c.sexe}e{/if} le {$c.deces|date_format}{/if}
</div>
</div>
{if hasPerm('admin')}
<div>
- {if !$c.wasinscrit && !$c.dcd}
- <a href="marketing/private/{$c.user_id}">{*
- *}{icon name=email title="marketter user"}</a>
- {/if}
- <a href="admin/user/{if $c.wasinscrit}{$c.forlife}{else}{$c.user_id}{/if}">{*
- *}{icon name=wrench title="administrer user"}</a>
- <a href="http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id={$c.matricule_ax}">{*
- *}{icon name=user_gray title="fiche AX"}</a>
+ [{if !$c.wasinscrit && !$c.dcd}
+ <a href="marketing/private/{$c.user_id}">{*
+ *}{icon name=email title="marketter user"}</a>
+ {/if}
+ <a href="admin/user/{if $c.wasinscrit}{$c.forlife}{else}{$c.user_id}{/if}">{*
+ *}{icon name=wrench title="administrer user"}</a>
+ <a href="http://www.polytechniciens.com/?page=AX_FICHE_ANCIEN&anc_id={$c.matricule_ax}">{*
+ *}{icon name=user_gray title="fiche AX"}</a>]
</div>
{/if}
</div>
{/if}
<div class="long">
- {if $c.wasinscrit}
+ {if $c.wasinscrit || !$c.dcd}
{if $c.web || $c.mobile || $c.countrytxt || $c.city || $c.region || $c.entreprise || $c.freetext || (!$c.dcd && !$c.actif )}
<table cellspacing="0" cellpadding="0">
{if $c.web}
<tr>
- <td class="lt">Page web:</td>
+ <td class="lt">Page web :</td>
<td class="rt"><a href="{$c.web}">{$c.web}</a></td>
</tr>
{/if}
{if $c.countrytxt || $c.city}
<tr>
- <td class="lt">Géographie:</td>
+ <td class="lt">Géographie :</td>
<td class="rt">{$c.city}{if $c.city && $c.countrytxt}, {/if}{$c.countrytxt}</td>
</tr>
{/if}
{if $c.mobile && !$c.dcd}
<tr>
- <td class="lt">Mobile:</td>
+ <td class="lt">Mobile :</td>
<td class="rt">{$c.mobile}</td>
</tr>
{/if}
{if $c.entreprise}
<tr>
- <td class="lt">Profession:</td>
+ <td class="lt">Profession :</td>
<td class="rt">
{$c.entreprise} {if $c.secteur}({$c.secteur}){/if}
{if $c.fonction}<br />{$c.fonction}{/if}
{/if}
{if $c.freetext}
<tr>
- <td class="lt">Commentaire:</td>
+ <td class="lt">Commentaire :</td>
<td class="rt">{$c.freetext|nl2br}</td>
</tr>
{/if}
- {if !$c.dcd && !$c.actif && $c.wasinscrit && $smarty.session.auth ge AUTH_COOKIE}
+ {if !$c.dcd && (!$c.actif || !$c.wasinscrit) && $smarty.session.auth ge AUTH_COOKIE}
<tr>
<td class="smaller" colspan="2">
- Ce camarade n'a plus d'adresse de redirection valide.
+ {if !$c.wasinscrit}
+ Ce{if $c.sexe}tte{/if} camarade n'est pas inscrit{if $c.sexe}e{/if}.
+ <a href="marketing/public/{$c.user_id}" class='popup'>Si tu connais son adresse email,
+ <strong>n'hésite pas à nous la transmettre !</a>
+ {elseif !$c.actif}
+ Ce{if $c.sexe}tte{/if} camarade n'a plus d'adresse de redirection valide.
<a href="marketing/broken/{$c.forlife}">
- Si tu en connais une, <strong>n'hésite pas à nous la transmettre</strong>
+ Si tu en connais une, <strong>n'hésite pas à nous la transmettre</strong>.
</a>
+ {/if}
</td>
</tr>
{/if}
{else}
<p>Le moteur de carte n'a pas été installé sur cette version de plat/al. Veuillez contacter <a href="http://www.geodesix.com/">Geodesix</a>.</p>
{/if}
-<p class="descr">Pour toute question, problème ou suggestion tu peux envoyer un mail à
+<p class="descr">Pour toute question, problème ou suggestion tu peux envoyer un email à
<a href="mailto:{#globals.geoloc.email#}">{#globals.geoloc.email#}</a>.</p>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{**************************************************************************}
<div class="contact-list" style="clear: both">
-{iterate from=$set item=res}
+{foreach from=$set item=res}
{if $res.contact}
{include file="include/minifiche.tpl" c=$res show_action="retirer"}
{else}
{include file="include/minifiche.tpl" c=$res show_action="ajouter"}
{/if}
-{/iterate}
+{/foreach}
</div>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{capture name=pages}
{if $plview->pages > 1}
-<div class="center pages">
+ {if $show_bounds}<div style="float: right"><small><strong>[{$first} - {$last}] </strong></small></div>{/if}
+<div class="center pages" style="float: left">
{if $plview->page neq 1}
- <a href="{$platal->pl_self()}{$plset_search}order={$order}&page=1">{icon name=resultset_first title="Première page"}</a>{*
- *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->page-1}">{icon name=resultset_previous title="Page précédente"}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order={$order}&page=1#pl_set_top">{icon name=resultset_first title="Première page"}</a>{*
+ *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->page-1}#pl_set_top">{icon name=resultset_previous title="Page précédente"}</a>
{else}
{icon name=null title=""}{icon name=null title=""}
{/if}
{if $smarty.section.page.index eq $plview->page}
<span style="color: red">{$plview->page}</span>
{else}
- <a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$smarty.section.page.index}">{$smarty.section.page.index}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$smarty.section.page.index}#pl_set_top">{$smarty.section.page.index}</a>
{/if}
{/section}
{if $plview->page neq $plview->pages}
- <a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->page+1}">{icon name=resultset_next title="Page suivante"}</a>{*
- *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->pages}">{icon name=resultset_last title="Dernière page"}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->page+1}#pl_set_top">{icon name=resultset_next title="Page suivante"}</a>{*
+ *}<a href="{$platal->pl_self()}{$plset_search}order={$order}&page={$plview->pages}#pl_set_top">{icon name=resultset_last title="Dernière page"}</a>
{else}
{icon name=null title=""}{icon name=null title=""}
{/if}
{capture name=order}
{if $plset_count > 1}
-<div>
+<div style="clear: both">
Trier par :
{foreach from=$orders key=name item=sort}
[
{if $name eq $order}
<img src='images/dn.png' alt='tri ascendant' />
- <a href="{$platal->pl_self()}{$plset_search}order=-{$name}">{$sort.desc}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order=-{$name}#pl_set_top">{$sort.desc}</a>
{elseif $order eq "-$name"}
<img src='images/up.png' alt='tri ascendant' />
- <a href="{$platal->pl_self()}{$plset_search}order={$name}">{$sort.desc}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order={$name}#pl_set_top">{$sort.desc}</a>
{else}
- <a href="{$platal->pl_self()}{$plset_search}order={$name}">{$sort.desc}</a>
+ <a href="{$platal->pl_self()}{$plset_search}order={$name}#pl_set_top">{$sort.desc}</a>
{/if}
]
{/foreach}
{/capture}
-{$smarty.capture.pages|smarty:nodefaults}
-
{$smarty.capture.order|smarty:nodefaults}
-<div id="multipage_content" style="padding: 0.5em 0">
+{$smarty.capture.pages|smarty:nodefaults}
+
+<div id="multipage_content" style="padding: 0.5em 0; clear: both">
{include file=$plview->templateName()}
</div>
-{$smarty.capture.order|smarty:nodefaults}
+{$smarty.capture.pages|smarty:nodefaults}<br />
-{$smarty.capture.pages|smarty:nodefaults}
+{$smarty.capture.order|smarty:nodefaults}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{**************************************************************************}
<div class="contact-list" style="clear: both">
-{iterate from=$set item=p}
+{foreach from=$set item=p}
<div class="contact">
<div class="nom">
<span {if $p.name_tooltip}class="hinted" title="{$p.name_tooltip}"{/if}>{$p.name_display}</span>
</div>
<div class="bits" style="width: 40%;">
<span class='smaller'>
- <a href="profile/{$p.bestalias}" class="popup2">
+ <a href="profile/{$p.forlife}" class="popup2">
{icon name=user_suit title="Voir sa fiche"}</a> -
- <a href="referent/{$p.bestalias}" class="popup2">Voir sa fiche référent</a>
+ <a href="referent/{$p.forlife}" class="popup2">Voir sa fiche référent</a>
</span>
</div>
<div class="long">
</table>
</div>
</div>
-{/iterate}
+{/foreach}
</div>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
Aucun des camarades concernés n'a de photographie sur sa fiche
</p>
{else}
-<table cellpadding="8" cellspacing="2" style="width: 100%">
- {iterate from=$set item=p}
- {cycle values="1,2,3" assign="loop"}
- {if $loop eq "1"}
+<table cellpadding="0" cellspacing="2" style="width: 100%">
+ {section name=trombi loop=$set start=1}
+ {if $smarty.section.trombi.iteration % 3 == 1}
<tr>
- {/if}
- <td class="center">
- <a href="{$mainsiteurl}profile/{$p.forlife}" class="popup2">
- <img src="photo/{$p.forlife}" width="110" alt=" [ PHOTO ] " />
+ <td class="center" style="vertical-align: middle">
+ <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].forlife}" class="popup2">
+ <img src="photo/{$set[trombi.index_prev].forlife}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_with_admin && hasPerm('admin')}
- <a href="{$mainsiteurl}admin/trombino/{$p.user_id}">{icon name=wrench title="[admin]"}</a>
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_prev].user_id}">{icon name=wrench title="[admin]"}</a>
{/if}
- <br />
- <a href="{$mainsiteurl}profile/{$p.forlife}" class="popup2">
- <span {if $p.name_tooltip}class="hinted" title="{$p.name_tooltip}"{/if}>{$p.name_display}</span>{if $trombi_with_promo} ({$p.promo}){/if}
+ </td>
+ <td class="center" style="vertical-align: middle">
+ <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+ <img src="photo/{$set[trombi].forlife}" width="110" alt=" [ PHOTO ] " />
</a>
+ {if $trombi_with_admin && hasPerm('admin')}
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
+ {/if}
+ </td>
+ <td class="center" style="vertical-align: middle">
+ {if $set[trombi.index_next]}
+ <a href="{$mainsiteurl}profile/{$set[trombi.index_next].forlife}" class="popup2">
+ <img src="photo/{$set[trombi.index_next].forlife}" width="110" alt=" [ PHOTO ] " />
+ </a>
+ {if $trombi_with_admin && hasPerm('admin')}
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_next].user_id}">{icon name=wrench title="[admin]"}</a>
+ {/if}
+ {/if}
</td>
- {if $loop eq "3"}
+ </tr>
+ <tr>
+ <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
+ <a href="{$mainsiteurl}profile/{$set[trombi.index_prev].forlife}" class="popup2">
+ <span {if $set[trombi.index_prev].name_tooltip}class="hinted" title="{$set[trombi.index_prev].name_tooltip}"{/if}>{$set[trombi.index_prev].name_display}</span>{if $trombi_with_promo} ({$set[trombi.index_prev].promo}){/if}
+ </a>
+ </td>
+ <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
+ <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+ <span {if $set[trombi].name_tooltip}class="hinted" title="{$set[trombi].name_tooltip}"{/if}>{$set[trombi].name_display}</span>{if $trombi_with_promo} ({$set[trombi].promo}){/if}
+ </a>
+ </td>
+ <td class="center" style="vertical-align: bottom; padding-bottom: 15px">
+ {if $set[trombi.index_next]}
+ <a href="{$mainsiteurl}profile/{$set[trombi.index_next].forlife}" class="popup2">
+ <span {if $set[trombi.index_next].name_tooltip}class="hinted" title="{$set[trombi.index_next].name_tooltip}"{/if}>{$set[trombi.index_next].name_display}</span>{if $trombi_with_promo} ({$set[trombi.index_next].promo}){/if}
+ </a>
+ {/if}
+ </td>
+ </tr>
+ {elseif ($smarty.section.trombi.iteration % 3 == 0) && ($smarty.section.trombi.last)}
+ <tr>
+ <td class="center" style="vertical-align: middle; padding-bottom: 15px">
+ <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+ <img src="photo/{$set[trombi].forlife}" width="110" alt=" [ PHOTO ] " />
+ </a>
+ {if $trombi_with_admin && hasPerm('admin')}
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
+ {/if}
+ </td>
+ <td></td><td></td>
+ </tr>
+ <tr style="margin-top: 0; padding-top: 0">
+ <td class="center" style="vertical-align: bottom">
+ <a href="{$mainsiteurl}profile/{$set[trombi].forlife}" class="popup2">
+ <span {if $set[trombi].name_tooltip}class="hinted" title="{$set[trombi].name_tooltip}"{/if}>{$set[trombi].name_display}</span>{if $trombi_with_promo} ({$set[trombi].promo}){/if}
+ </a>
+ </td>
+ <td></td><td></td>
</tr>
{/if}
- {/iterate}
- {if $loop neq "3"}
- {if $lopp eq "1"}
- <td></td>
- {/if}
- <td></td></tr>
- {/if}
+ {/section}
</table>
{/if}
<p>
{if $unregistered|@count eq 1}
-L'utilisateur suivant n'est pas inscrit à Polytechnique.org. Tu peux l'y inciter en lui faisant envoyer un mail de marketing. Une fois inscrit à Polytechnique.org, l'inscription à la liste lui sera automatiquement proposée.
+L'utilisateur suivant n'est pas inscrit à Polytechnique.org. Tu peux l'y inciter en lui faisant envoyer un email de marketing. Une fois inscrit à Polytechnique.org, l'inscription à la liste lui sera automatiquement proposée.
{else}
Les utilisateurs suivants ne sont pas inscrits à Polytechnique.org. Tu peux les y inciter en leur faisant envoyer des
-mails de marketing. Une fois inscrits à Polytechnique.org, l'inscription à la liste leur sera automatique proposée.
+emails de marketing. Une fois inscrits à Polytechnique.org, l'inscription à la liste leur sera automatique proposée.
{/if}
<p>
</script>
<form method="post" action='{$smarty.server.REQUEST_URI}'>
+ {xsrf_token_field}
<table class="bicol">
{foreach from=$unregistered key=login item=it}
<tr class="{cycle values="pair,impair"}">
Action* :
<select name="mk_action[{$login}]" onchange="showEmail(this.value, '{$login}');">
<option value="none">Aucune</option>
- <option value="marketu">Envoyer un mail en ton nom</option>
- <option value="markets">Envoyer un mail au nom de Polytechnique.org</option>
+ <option value="marketu">Envoyer un email en ton nom</option>
+ <option value="markets">Envoyer un email au nom de Polytechnique.org</option>
<option value="sub">Lui proposer l'inscription</option>
</select><br />
<span id="mk_s_mail[{$login}]" style="display: none">
<p class="smaller">
*La dernière action ajoute simplement la liste de diffusion aux abonnements qui seront proposés au camarade
- lors de son inscription à Polytechnique.org sans pour autant lui enovyer de mail de marketing. Cette action est
- automatique si tu choisis l'envoi de mail.
+ lors de son inscription à Polytechnique.org sans pour autant lui envoyer d'email de marketing. Cette action est
+ automatique si tu choisis l'envoi d'email.
</p>
{/if}
</h1>
<form method='post' action='{$smarty.server.REQUEST_URI}'>
+ {xsrf_token_field}
<table class='tinybicol' cellpadding='0' cellspacing='0'>
{foreach from=$owners item=xs key=promo}
<tr>
{if $promo && strpos($x.l, '@') === false}
<a href="profile/{$x.l}" class="popup2">{$x.n}</a>
{elseif $x.x}
- <a href="{$platal->ns}member/{$x.x}">{$x.n}</a>
+ <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
{elseif $x.n}
{$x.n}
{else}
</td>
</tr>
{/foreach}
- <tr>
- <td class='titre'>Ajouter ... </td>
+ <tr class="pair">
+ <td class='titre'>Ajouter</td>
<td>
<input type='text' size='30' name='add_owner' />
-
<input type='submit' value='ajouter' />
</td>
</tr>
{$np_m|default:"0"} membre{if $np_m > 1}s{/if} dans la liste
</h1>
-<form method='post' action='{$smarty.server.REQUEST_URI}'>
+<form method='post' action='{$smarty.server.REQUEST_URI}' enctype="multipart/form-data">
+ {xsrf_token_field}
<table class='bicol' cellpadding='0' cellspacing='0'>
{foreach from=$members item=xs key=promo}
<tr>
{if $promo && strpos($x.l, '@') === false}
<a href="profile/{$x.l}" class="popup2">{$x.n}</a>
{elseif $x.x}
- <a href="{$platal->ns}member/{$x.x}">{$x.n}</a>
+ <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
{elseif $x.n}
{$x.n}
{else}
{$x.l}
{/if}
- <a href='{$platal->pl_self(1)}?del_member={$x.l}'>{icon name=cross title='retirer membre'}</a>
+ <a href='{$platal->pl_self(1)}?del_member={$x.l}&token={xsrf_token}'>{icon name=cross title='retirer membre'}</a>
<br />
{/foreach}
</td>
</tr>
{/foreach}
<tr>
- <td class='titre'>Ajouter ...</td>
+ <th colspan="2">Ajouter</th>
+ </tr>
+ <tr class="pair">
+ <td class="titre">Liste</td>
<td>
<input type='text' size='40' name='add_member' />
-
+ </td>
+ </tr>
+ <tr class="pair">
+ <td class="titre">ou fichier(*)</td>
+ <td>
+ <input type="file" name="add_member_file" />*
+ </td>
+ </tr>
+ <tr class="pair">
+ <td colspan="2" class="center">
<input type='submit' value='ajouter' />
</td>
</tr>
</table>
</form>
+<div class="smaller">
+ * Le fichier doit contenir une adresse email par ligne. Les X doivent être identifiés par une adresse
+ @polytechnique.org, @m4x.org ou @melix.net/org.
+</div>
+
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{if $details.sub>1}
Tu es inscrit sur la liste.<br />
Te désinscrire :
- <a href='{$platal->pl_self(1)}?del=1'>{icon name=cross title="me désinscrire"}</a>
+ <a href='{$platal->pl_self(1)}?del=1&token={xsrf_token}'>{icon name=cross title="me désinscrire"}</a>
{elseif $details.sub eq 1}
Ta demande d'inscription est en cours de validation.
{else}
Tu n'es pas inscrit.<br />
Demander ton inscription :
- <a href="{$platal->pl_self(1)}?add=1">{icon name=add title="demander mon inscription"}</a>
+ <a href="{$platal->pl_self(1)}?add=1&token={xsrf_token}">{icon name=add title="demander mon inscription"}</a>
{/if}
</td>
</tr>
{/foreach}
</table>
<form action='{$platal->pl_self(1)}' method='post'>
+ {xsrf_token_field}
<div class='center'>
<br />
<input type='submit' name='correct' value='Corriger les valeurs !' />
{else}
<p>
-N'importe qui peut faire la demande de création d'une mailing-list, il suffit pour cela d'être au
+N'importe qui peut faire la demande de création d'une liste de diffusion, il suffit pour cela d'être au
moins 4 polytechniciens inscrits sur le site, et de fournir les informations suivantes concernant la
liste :
</p>
-<form action='lists/create' method='post'>
+<form action='lists/create' method='post' enctype="multipart/form-data">
+ {xsrf_token_field}
<table class='bicol' cellspacing='0' cellpadding='2'>
<tr>
- <th colspan='2'>Caractéristiques de la Liste</th>
+ <th colspan='5'>Caractéristiques de la liste</th>
+ </tr>
+ <tr>
+ <td class='titre'>C'est une liste pour :</td>
+ <td colspan='2'><input type='radio' name='asso' value='groupex'
+ {if $smarty.post.asso eq 'groupex' && $smarty.post}checked='checked'{/if} />un groupe X</td>
+ <td colspan='2'><input type='radio' name='asso' value=''
+ {if !$smarty.post.asso || !$smarty.post}checked='checked'{/if} />une liste de portée générale ou d'amis</td>
+ </tr>
+ {if $young_promo}
+ <tr>
+ <td></td>
+ <td colspan='2'><input type='radio' name='asso' value='binet'
+ {if $smarty.post.asso eq 'binet' && $smarty.post}checked='checked'{/if} />un binet</td>
+ {if $very_young_promo}
+ <td colspan='2'><input type='radio' name='asso' value='alias'
+ {if $smarty.post.asso eq 'alias' && $smarty.post}checked='checked'{/if} />un alias psc, ...</td>
+ {else}
+ <td colspan='2'></td>
+ {/if}
+ </tr>
+ {/if}
+ <tr class='promo'>
+ <td class='titre'>Promotion :</td>
+ <td><input type='text' name='promo' size='4' maxlength='4'
+ {if $smarty.post.promo}value='{$smarty.post.promo}'{else}value='{$smarty.session.promo}'{/if} />
+ <td class='smaller' colspan='3'>Par exemple : 2004</td>
+ </tr>
+ <tr class='groupex'>
+ <td class='titre'>Nom du groupe X :</td>
+ <td colspan='4'>
+ <input type='text' name='groupex_name' value='{$smarty.post.groupex_name}' /><br />
+ <span class='smaller'><strong>Attention :</strong> le nom du groupe doit être écrit comme sur <a
+ href="http://www.polytechnique.net">Polytechnique.net</a>.</span>
+ </td>
</tr>
<tr>
<td class='titre'>Adresse souhaitée :</td>
- <td>
- <input type='text' name='liste' value='{$smarty.post.liste}' />@polytechnique.org
+ <td colspan='4'>
+ <input type='text' name='liste' size='15' value='{$smarty.post.liste}' />@<span class='promo'><span id='promotion'></span>.</span><span class='groupex'><span class='smaller'>diminutifdugroupe</span>.</span>polytechnique.org
</td>
</tr>
+ <script type="text/javascript">//<![CDATA[
+ {literal}
+ $(function() {
+ $(":radio[@name=asso]").change(function() {
+ var asso = $(":radio[@name=asso]:checked").val();
+ if ((asso == "binet") || (asso == "alias")) {
+ $(".groupex").hide();
+ $(".promo").show();
+ } else if (asso == "groupex") {
+ $(".promo").hide();
+ $(".groupex").show();
+ } else {
+ $(".groupex").hide();
+ $(".promo").hide();
+ }
+ }).change();
+ });
+ $(function() {
+ $(":text[@name=promo]").change(function () {
+ var str = $(":text[@name=promo]").val();
+ $("span#promotion").text(str);
+ }).change();
+ });
+ {/literal}
+ // ]]></script>
<tr>
<td class='titre'>Sujet (bref) :</td>
- <td>
- <input type='text' name='desc' size='50' value="{$smarty.post.desc}" />
+ <td colspan='4'>
+ <input type='text' name='desc' size='50' value='{$smarty.post.desc}' />
</td>
</tr>
<tr>
<td class='titre'>Propriétés :</td>
- <td>
- <table style='width: 100%'>
- <tr>
- <td>visibilité :</td>
- <td><input type='radio' name='advertise' value='0'
- {if $smarty.post.advertise eq 0 && $smarty.post}checked='checked'{/if} />publique</td>
- <td><input type='radio' name='advertise' value='1'
- {if $smarty.post.advertise neq 0 || !$smarty.post}checked='checked'{/if} />privée</td>
- <td></td>
- </tr>
- <tr>
- <td>diffusion :</td>
- <td><input type='radio' name='modlevel' value='0'
- {if !$smarty.post.modlevel}checked='checked'{/if} />libre</td>
- <td><input type='radio' name='modlevel' value='1'
- {if $smarty.post.modlevel eq 1}checked='checked'{/if} />restreinte</td>
- <td><input type='radio' name='modlevel' value='2'
- {if $smarty.post.modlevel eq 2}checked='checked'{/if} />modérée</td>
- </tr>
- <tr>
- <td>inscription :</td>
- <td><input type='radio' name='inslevel' value='0'
- {if $smarty.post.inslevel eq 0 && $smarty.post}checked='checked'{/if} />libre</td>
- <td><input type='radio' name='inslevel' value='1'
- {if $smarty.post.inslevel neq 0 || !$smarty.post}checked='checked'{/if} />modérée</td>
- <td></td>
- </tr>
- </table>
- </td>
+ <td>visibilité :</td>
+ <td><input type='radio' name='advertise' value='0'
+ {if $smarty.post.advertise eq 0 && $smarty.post}checked='checked'{/if} />publique</td>
+ <td><input type='radio' name='advertise' value='1'
+ {if $smarty.post.advertise neq 0 || !$smarty.post}checked='checked'{/if} />privée</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class='smaller' colspan='4'>(est-ce que les non membres peuvent voir l'existence de cette liste ?)</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>diffusion :</td>
+ <td><input type='radio' name='modlevel' value='0'
+ {if !$smarty.post.modlevel}checked='checked'{/if} />libre</td>
+ <td><input type='radio' name='modlevel' value='1'
+ {if $smarty.post.modlevel eq 1}checked='checked'{/if} />restreinte</td>
+ <td><input type='radio' name='modlevel' value='2'
+ {if $smarty.post.modlevel eq 2}checked='checked'{/if} />modérée</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class='smaller' colspan='4'>(l'envoi d'un email à cette liste est-il libre, modéré
+ lorsque l'expéditeur n'appartient pas à la liste ou modéré dans tous les cas ?)</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>inscription :</td>
+ <td><input type='radio' name='inslevel' value='0'
+ {if $smarty.post.inslevel eq 0 && $smarty.post}checked='checked'{/if} />libre</td>
+ <td><input type='radio' name='inslevel' value='1'
+ {if $smarty.post.inslevel neq 0 || !$smarty.post}checked='checked'{/if} />modérée</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td class='smaller' colspan='4'>(détermine si les inscriptions à la liste sont modérées
+ par les modérateurs de la liste ou non.)</td>
</tr>
- <tr><th colspan='2'>Membres et Gestionnaires</th></tr>
+ <tr><th colspan='5'>Membres et gestionnaires</th></tr>
<tr>
- <td class='titre'>Gestionnaires</td>
- <td>
+ <td class='titre'>Gestionnaires :</td>
+ <td colspan='4'>
<input type='hidden' name='owners' value='{$owners}' />
{$owners|nl2br|default:"<span class='erreur'>pas de gestionnaires</span>"}
<br />
</td>
</tr>
<tr>
- <td class='titre'>Membres</td>
- <td>
+ <td class='titre'>Membres :</td>
+ <td colspan='4'>
<input type='hidden' name='members' value='{$members}' />
{$members|nl2br|default:"<span class='erreur'>pas de membres</span>"}
<br />
- <input type='text' name='add_member' />
+ <input type='text' name='add_member' /><br />
+ <input type="file" name="add_member_file" /><br />
<input type='submit' name='add_member_sub' value='Ajouter' />
</td>
</tr>
<tr>
- <td colspan="2">
- <small>Tu peux entrer une liste de membres en entrant plusieurs adresses séparées par des espaces.</small>
+ <td colspan='5'>
+ <small>
+ Tu peux entrer une liste de membres en entrant plusieurs adresses séparées par des espaces, des virgules ou des point-virgules.
+ Tu peux aussi fournir un fichier avec une adresse email par ligne.
+ </small>
</td>
</tr>
</table>
<p>
La liste est habituellement créée dans les jours qui suivent la demande sauf exception. Pour plus
d'informations écris-nous à l'adresse {mailto address='listes@polytechnique.org'} en mettant dans
- le sujet de ton mail le nom de la liste souhaité afin de faciliter les échanges de mails
+ le sujet de ton email le nom de la liste souhaité afin de faciliter les échanges d'emails
ultérieurs éventuels.
</p>
<div class='center'>
</h1>
<form method='post' action='{$platal->pl_self(1)}'>
+ {xsrf_token_field}
<table class='tinybicol' cellpadding='2' cellspacing='0'>
<tr class='impair'>
<td>
La diffusion a trois niveaux de modération. La diffusion peut être :
</p>
<ul>
- <li><strong>libre :</strong> tout le monde peut y envoyer des mails, la diffusion y est
+ <li><strong>libre :</strong> tout le monde peut y envoyer des emails, la diffusion y est
immédiate ;</li>
- <li><strong>restreinte :</strong> les membres de la liste peuvent envoyer librement des mails,
+ <li><strong>restreinte :</strong> les membres de la liste peuvent envoyer librement des emails,
les extérieurs sont modérés ;</li>
- <li><strong>modérée :</strong> l'envoi d'un mail à la liste est alors filtré par des
+ <li><strong>modérée :</strong> l'envoi d'un email à la liste est alors filtré par des
modérateurs, eux seuls peuvent accepter un message envoyé à la liste.</li>
</ul>
{/if}
<form method='post' action='lists'>
+ {xsrf_token_field}
<table class='tinybicol' cellspacing='0' cellpadding='2'>
<tr>
<th colspan='2'>Inscription à une liste de diffusion promo</th>
{if $liste.subscriptions|@count}
<strong>• Demandes d'inscription</strong><br />
{foreach from=$liste.subscriptions item=s}
- <a href='{$platal->ns}lists/moderate/{$liste.list}?sadd={$s.id}'
- onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?sadd={$s.id}'));">
+ <a href='{$platal->ns}lists/moderate/{$liste.list}?sadd={$s.id}&token={xsrf_token}'
+ onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?sadd={$s.id}&token={xsrf_token}'));">
{icon name=add title="Accepter"}
</a>
<a href='{$platal->ns}lists/moderate/{$liste.list}?sid={$s.id}'>
<strong>• Demandes de modération</strong><br />
<span class="smaller">
{foreach from=$liste.mails item=m}
- <a href='{$platal->ns}lists/moderate/{$liste.list}?mid={$m.id}&mok=1'
- onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?mid={$m.id}&mok=1'));">
- {icon name=add title="Valider le mail"}
+ <a href='{$platal->ns}lists/moderate/{$liste.list}?mid={$m.id}&mok=1&token={xsrf_token}'
+ onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?mid={$m.id}&mok=1&token={xsrf_token}'));">
+ {icon name=add title="Valider l'email"}
</a>
- <a href='{$platal->ns}lists/moderate/{$liste.list}?mid={$m.id}&mdel=1'
- onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?mid={$m.id}&mdel=1'));">
+ <a href='{$platal->ns}lists/moderate/{$liste.list}?mid={$m.id}&mdel=1&token={xsrf_token}'
+ onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?mid={$m.id}&mdel=1&token={xsrf_token}'));">
{icon name=delete title="Spam"}
</a>
De : {$m.sender}<br />
<td class='right'>{$liste.nbsub}</td>
<td class='right'>
{if $liste.sub eq 2}
- <a href='{$platal->ns}lists?del={$liste.list}'
- onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?unsubscribe=1'));">
+ <a href='{$platal->ns}lists?del={$liste.list}&token={xsrf_token}'
+ onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?unsubscribe=1&token={xsrf_token}'));">
{icon name=cross title="me désinscrire"}
</a>
{elseif $liste.sub eq 1}
{icon name=flag_orange title='inscription en attente de modération'}
{else}
- <a href='{$platal->ns}lists?add={$liste.list}'
- onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?subscribe=1'));">
+ <a href='{$platal->ns}lists?add={$liste.list}&token={xsrf_token}'
+ onclick="return (is_IE || Ajax.update_html('list_{$liste.list}', '{$platal->ns}lists/ajax/{$liste.list}?subscribe=1&token={xsrf_token}'));">
{icon name=add title="m'inscrire"}
</a>
{/if}
{if $details.sub>1}
Tu es inscrit sur la liste.<br />
Te désinscrire :
- <a href='{$platal->pl_self(1)}?del=1'>{icon name=cross title="me désinscrire"}</a>
+ <a href='{$platal->pl_self(1)}?del=1&token={xsrf_token}'>{icon name=cross title="me désinscrire"}</a>
{elseif $details.sub eq 1}
Ta demande d'inscription est en cours de validation.
{else}
Tu n'es pas inscrit.<br />
Demander ton inscription :
- <a href="{$platal->pl_self(1)}?add=1">{icon name=add title="demander mon inscription"}</a>
+ <a href="{$platal->pl_self(1)}?add=1&token={xsrf_token}">{icon name=add title="demander mon inscription"}</a>
{/if}
</td>
</tr>
{if $x.b}<a href="https://www.polytechnique.org/marketing/broken/{$x.l}">{icon name=error}</a>{/if}
<a href="profile/{$x.l}" class="popup2">{$x.n}</a>
{elseif $x.x}
- <a href="{$platal->ns}member/{$x.x}">{$x.n}</a>
+ <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
{elseif $x.n}
{$x.n}
{else}
</td>
<td>{$s.addr}</td>
<td class='action'>
- <a href='{$platal->pl_self(1)}?sadd={$s.id}'>{icon name=add title="Valider l'inscription"}</a>
+ <a href='{$platal->pl_self(1)}?sadd={$s.id}&token={xsrf_token}'>{icon name=add title="Valider l'inscription"}</a>
<a href='{$platal->pl_self(1)}?sid={$s.id}'>{icon name=delete title="Refuser l'inscription"}</a>
</td>
</tr>
{/if}
<h1>
- Mails en attente de modération
+ Emails en attente de modération
</h1>
{if $mails|@count}
<ul>
<li>
- <strong>{icon name=add}accepter :</strong> le mail est immédiatement libéré, et envoyé à la
+ <strong>{icon name=add}accepter :</strong> l'email est immédiatement libéré, et envoyé à la
liste.
</li>
<li>
- <strong>{icon name=magnifier}refuser :</strong> pour refuser un mail, suivre le lien {icon name=magnifier} et
+ <strong>{icon name=magnifier}refuser :</strong> pour refuser un email, suivre le lien {icon name=magnifier} et
remplir le formulaire en bas de page.
</li>
<li>
- <strong>{icon name=delete}spam :</strong> le mail est effacé sans autre forme de procès.
+ <strong>{icon name=delete}spam :</strong> l'email est effacé sans autre forme de procès.
N'utiliser <strong>QUE</strong> pour les virus et les courriers indésirables. <br/>
</li>
</ul>
//]]></script>
<form method="post" action="{$platal->pl_self(1)}">
+{xsrf_token_field}
{if $with_fromx}
<table class="bicol" style="margin-bottom: 1ex">
<tr>
<th colspan="2"></th>
- <th>Mail</th>
+ <th>Email</th>
<th>Infos</th>
<th colspan="2"></th>
</tr>
<tr>
<th class="smaller" colspan="6">
- Les mails suivants proviennent d'adresses identifiées comme étant celles de camarades.
+ Les emails suivants proviennent d'adresses identifiées comme étant celles de camarades.
</th>
</tr>
{foreach from=$mails item=m name=mail}
{$m.size} octets</small>
</td>
<td class='action'>
- <a href='{$platal->pl_self(1)}?mid={$m.id}&mok=1'>{icon name=add title="Accepter le message"}</a>
+ <a href='{$platal->pl_self(1)}?mid={$m.id}&mok=1&token={xsrf_token}'>{icon name=add title="Accepter le message"}</a>
</td>
<td class='action'>
<a href='{$platal->pl_self(1)}?mid={$m.id}'>{icon name=magnifier title="Voir le message"}</a><br/>
- <a href='{$platal->pl_self(1)}?mid={$m.id}&mdel=1'>{icon name=delete title="Spam !"}</a>
+ <a href='{$platal->pl_self(1)}?mid={$m.id}&mdel=1&token={xsrf_token}'>{icon name=delete title="Spam !"}</a>
</td>
</tr>
{/if}
<a href="javascript:toggleAll()">{icon name="arrow_refresh" title="Tout (dé)cocher"}</a>
</th>
<th></th>
- <th>Mail</th>
+ <th>Email</th>
<th>Infos</th>
<th colspan="2"></th>
</tr>
{$m.size} octets</small>
</td>
<td class='action'>
- <a href='{$platal->pl_self(1)}?mid={$m.id}&mok=1'>{icon name=add title="Accepter le message"}</a>
+ <a href='{$platal->pl_self(1)}?mid={$m.id}&mok=1&token={xsrf_token}'>{icon name=add title="Accepter le message"}</a>
</td>
<td class='action'>
<a href='{$platal->pl_self(1)}?mid={$m.id}'>{icon name=magnifier title="Voir le message"}</a><br/>
- <a href='{$platal->pl_self(1)}?mid={$m.id}&mdel=1'>{icon name=delete title="Spam !"}</a>
+ <a href='{$platal->pl_self(1)}?mid={$m.id}&mdel=1&token={xsrf_token}'>{icon name=delete title="Spam !"}</a>
</td>
</tr>
{/if}
//]]></script>
<p class="center desc">
- Utilise ces boutons pour appliquer une action à tous les mails sélectionnés.<br />
+ Utilise ces boutons pour appliquer une action à tous les emails sélectionnés.<br />
<input type="hidden" name="moderate_mails" value="1" />
<input type="submit" name="mok" value="Accepter" />
<input type="submit" name="mdel" value="Spam !" />
</p>
</form>
{else}
-<p>Il n'y a pas de mails en attente de modération.</p>
+<p>Il n'y a pas d'emails en attente de modération.</p>
{/if}
{include file="lists/header_listes.tpl"}
<h1>
- Contenu du mail en attente
+ Contenu de l'email en attente
</h1>
{$banana|smarty:nodefaults}
<form method='post' action='{$platal->pl_self(1)}'>
<table class='tinybicol' cellpadding='0' cellspacing='0'>
<tr>
- <th class='titre'>Modérer le mail</th>
+ <th class='titre'>Modérer l'email</th>
</tr>
<tr>
<td>raison (pour les refus) :
<td class='center'>
<input type='hidden' name='mid' value='{$smarty.get.mid}' />
<input type='submit' name='mok' value='Accepter !'
- onclick="return confirm('Es-tu sûr de vouloir Envoyer ce mail sur la liste ?')"/>
+ onclick="return confirm('Es-tu sûr de vouloir Envoyer cet email sur la liste ?')"/>
<input type='submit' name='mno' value='Refuser !'
- onclick="return confirm('Es-tu sûr de vouloir Refuser ce mail ?')"/>
+ onclick="return confirm('Es-tu sûr de vouloir Refuser cet email ?')"/>
<input type='submit' name='mdel' value='Spam !' style='color:red;'
- onclick="return confirm('Es-tu sûr de vouloir Détruire ce mail ?')"/>
+ onclick="return confirm('Es-tu sûr de vouloir Détruire cet email ?')"/>
</td>
</tr>
</table>
<ul>
- <li>« Refuser » rejette le mail avec un message à son auteur (celui que tu tapes dans le cadre).</li>
+ <li>« Refuser » rejette l'email avec un message à son auteur (celui que tu tapes dans le cadre).</li>
<li>
- « Spam » détruit efface le mail sans autre forme de procès, et c'est à utiliser <strong>UNIQUEMENT</strong>
+ « Spam » détruit l'email sans autre forme de procès, à utiliser <strong>UNIQUEMENT</strong>
pour les virus et les courriers indésirables.
</li>
</ul>
</form>
<p>
-En cas de refus, le mail envoyé à l'auteur du mail que tu modères actuellement sera de la forme suivante :
+En cas de refus, l'email envoyé à l'auteur de l'email que tu modères actuellement sera de la forme suivante :
</p>
<pre>{$msg|smarty:nodefaults|utf8_encode}</pre>
<h1>Refuser l'inscription d'un utilisateur</h1>
<form method='post' action='{$platal->pl_self(1)}'>
+ {xsrf_token_field}
<table class='tinybicol' cellpadding='0' cellspacing='0'>
<tr>
<th class='titre'>refuser l'inscription de :</th>
</h1>
<form method='post' action='{$platal->pl_self(1)}'>
+ {xsrf_token_field}
<table class='bicol' cellpadding='2' cellspacing='0'>
<tr><th colspan='2'>Options de la liste {$details.addr}</th></tr>
<tr class='impair'>
<tr class='pair'>
<td>
<strong>message de bienvenue :</strong><br />
- <span class='smaller'>un texte de bienvenue incorporé au mail envoyé aux nouveaux
+ <span class='smaller'>un texte de bienvenue incorporé à l'email envoyé aux nouveaux
abonnés à la liste.</span>
</td>
<td>
<tr class='impair'>
<td>
<strong>message d'adieu :</strong><br />
- <span class='smaller'>un texte d'au revoir incorporé au mail de départ envoyé aux
- utilisateurs qui se désinscrivent. Ce mail peut être désactivé.</span>
+ <span class='smaller'>un texte d'au revoir incorporé à l'email de départ envoyé aux
+ utilisateurs qui se désinscrivent. Cet email peut être désactivé.</span>
</td>
<td>
<input type='checkbox' name='send_goodbye_msg'
- {if $options.send_goodbye_msg}checked='checked'{/if} /> activer le mail d'adieu. <br />
+ {if $options.send_goodbye_msg}checked='checked'{/if} /> activer l'email d'adieu. <br />
<textarea cols='40' rows='8' name='goodbye_msg'>{$options.goodbye_msg|smarty:nodefaults|utf8_encode}</textarea>
</td>
</tr>
<tr class='impair'>
<td>
<strong>ajout dans le sujet :</strong><br />
- <span class='smaller'>un préfixe (optionnel) ajouté dans le sujet de chaque mail envoyé sur la liste te permet de trier plus facilement ton courrier.</span>
+ <span class='smaller'>un préfixe (optionnel) ajouté dans le sujet de chaque email envoyé sur la liste te permet de trier plus facilement ton courrier.</span>
</td>
<td>
<input type='text' name='subject_prefix' size='40' value="{$options.subject_prefix|smarty:nodefaults|utf8_encode}" />
<tr class='impair'>
<td>
<strong>diffusion :</strong><br />
- <span class='smaller'>l'envoi d'un mail à cette liste est-il libre, modéré lorsque l'expéditeur n'appartient pas à la liste
+ <span class='smaller'>l'envoi d'un email à cette liste est-il libre, modéré lorsque l'expéditeur n'appartient pas à la liste
ou modéré dans tous les cas ?</span>
</td>
<td>
<span class='smaller'>détermine la politique de l'antispam sur cette liste.</span>
</td>
<td>
- <em><a name='antispam' id='antispam'></a>que faire des mails marqués « [spam probable] » ?</em><br />
- <input type='radio' name='bogo_level' value='0' {if !$bogo_level}checked='checked'{/if} /> les laisser passer ;<br />
- <input type='radio' name='bogo_level' value='1' {if $bogo_level eq 1}checked='checked'{/if} /> les envoyer aux modérateurs pour approbation...<br />
- <input type='radio' name='bogo_level' value='2' {if $bogo_level eq 2}checked='checked'{/if} /> ... après suppression des
- spams les plus probables* ;<br />
- <input type='radio' name='bogo_level' value='3' {if $bogo_level eq 3}checked='checked'{/if} /> tous les supprimer.
+ <div id="spamlevel">
+ <em><a name='antispam' id='antispam'></a>que faire des emails marqués « [spam probable] » ?</em><br />
+ <label><input type='radio' name='bogo_level' value='0' {if !$bogo_level}checked='checked'{/if} /> les laisser passer ;</label><br />
+ <label><input type='radio' name='bogo_level' value='1' {if $bogo_level eq 1}checked='checked'{/if} /> les envoyer aux modérateurs pour approbation...</label><br />
+ <label><input type='radio' name='bogo_level' value='2' {if $bogo_level eq 2}checked='checked'{/if} /> ... après suppression des
+ spams les plus probables* ;</label><br />
+ <label><input type='radio' name='bogo_level' value='3' {if $bogo_level eq 3}checked='checked'{/if} /> tous les supprimer.</label>
+ </div>
+ <div id="unsurelevel">
+ <em>que faire des emails dont le classement est indéterminé** ?</em><br />
+ <label><input type='radio' name='unsure_level' value='0' {if !$unsure_level}checked='checked'{/if} /> les laisser
+ passer ;</label><br />
+ <label><input type='radio' name='unsure_level' value='1' {if $unsure_level eq 1}checked='checked'{/if} /> les modérer.</label>
+ </div>
+ <script type="text/javascript">//<![CDATA[
+ {literal}
+ $(function() {
+ $(":radio[@name=bogo_level]").change(function() {
+ if ($(":radio[@name=bogo_level]:checked").val() == 0) {
+ $("#unsurelevel").hide();
+ } else {
+ $("#unsurelevel").show();
+ }
+ }).change();
+ });
+ {/literal}
+ // ]]></script>
</td>
</tr>
<tr>
<td colspan="2" class="smaller">
*La troisième option permet de supprimer automatiquement les spams sûrs à plus de 99,9999%, qui sont donc peu susceptibles
- d'être des faux-positifs.
+ d'être des faux-positifs.<br />
+ **Certains emails ne sont pas classables par l'antispam qui le signale en indiquant que l'email est "Unsure". Ces
+ emails contiennent statistiquement autant de spams que de non-spams, mais ceci peut varier d'une adresse à l'autre.
+ Cette option te permet de choisir si tu préfères que les emails 'Unsures' soient modérés ou envoyés directement
+ à la liste.
</td>
</tr>
</table>
</p>
<p>
les X inscrits à la liste doivent ajouter leurs adresses usuelles parmis leurs adresses de
-redirection en mode 'inactif'. le logiciel de mailing list saura se débrouiller tout seul.
+redirection en mode 'inactif'. le logiciel de gestion des listes de diffusion saura se débrouiller tout seul.
</p>
<form method='post' action='{$platal->pl_self(1)}'>
+ {xsrf_token_field}
<table class='tinybicol' cellpadding='2' cellspacing='0'>
<tr><th>Adresses non modérées</th></tr>
<tr>
<td>
{if $options.accept_these_nonmembers|@count}
{foreach from=$options.accept_these_nonmembers item=addr}
- {$addr}<a href='{$platal->pl_self(1)}&atn_del={$addr}'>
+ {$addr}<a href='{$platal->pl_self(1)}&atn_del={$addr}&token={xsrf_token}'>
{icon name=cross title="retirer de la whitelist"}
</a><br />
{/foreach}
</h1>
<form method='post' action='{$platal->pl_self(1)}'>
+ {xsrf_token_field}
<table class='bicol' cellpadding='2' cellspacing='0'>
<tr><th colspan='2'>Options de la liste {$details.addr}</th></tr>
<tr class='impair'>
{if !$user.email}
<p>
Avec le temps, toutes les adresses de redirection de notre camarade sont devenues invalides et produisent
- des erreurs lorsqu'on lui envoie un mail. Nous sommes donc à la recherche d'adresses valides où nous pourrions
+ des erreurs lorsqu'on lui envoie un email. Nous sommes donc à la recherche d'adresses valides où nous pourrions
contacter ce camarade.
</p>
{elseif $user.last}
<p>
{$user.prenom} a encore des adresses de redirection actives malgré des pannes détectées sur certaines d'entre elles. Si
tu es sûr{if $smarty.session.femme}e{/if} que son adresse Polytechnique.org est en panne, tu peux proposer une nouvelle
- adresse mail à ajouter à ses redirections. Merci d'ajouter un commentaire pour nous indiquer la raison de cette proposition.
+ adresse email à ajouter à ses redirections. Merci d'ajouter un commentaire pour nous indiquer la raison de cette proposition.
</p>
{else}
<p>
</p>
<form method="post" action="{$platal->path}">
+ {xsrf_token_field}
<table class="bicol" summary="Fiche camarade">
<tr><th colspan="2">Proposition d'adresse pour<br />{$user.nom} {$user.prenom} (X{$user.promo})</th></tr>
<tr class="pair">
Pas de nouvelle boîte aux lettres à relever, il suffit de la rediriger vers ton adresse personnelle et/ou professionnelle que tu indiques et que tu peux changer à ta guise, sans que tes correspondants n'aient à actualiser leur carnet d'adresses.
-De plus, le site web offre des services d'annuaire avec recherche multi-critères, de forums, de mailing-lists. Ce portail est géré par une vingtaine de jeunes camarades, avec le soutien et les conseils de nombreux X de toutes promotions, incluant notamment des camarades de la Kès et de l'AX. Les serveurs sont hébergés au sein même de l'École polytechnique, sur une connexion rapide, et les services évoluent en fonction des besoins exprimés par la communauté sur Internet.
+De plus, le site web offre des services d'annuaire avec recherche multi-critères, de forums, de listes de diffusion. Ce portail est géré par une vingtaine de jeunes camarades, avec le soutien et les conseils de nombreux X de toutes promotions, incluant notamment des camarades de la Kès et de l'AX. Les serveurs sont hébergés au sein même de l'École polytechnique, sur une connexion rapide, et les services évoluent en fonction des besoins exprimés par la communauté sur Internet.
N'hésite pas à parler de Polytechnique.org à nos camarades pas encore inscrits et à nous écrire pour nous proposer toute amélioration ou suggestion.
{/if}
</p>
-<p>[<a href='{$path}/insrel'>le relancer</a>]</p>
+<p>[<a href='{$path}/insrel?token={xsrf_token}'>le relancer</a>]</p>
{/if}
<td>{$a.last|date_format|default:'-'}</td>
<td class='center'>{$a.nb|default:"-"}</td>
<td class='action'>
- <a href='{$path}/del/{$a.email}'>del</a><br />
+ <a href='{$path}/del/{$a.email}?token={xsrf_token}'>del</a><br />
<a href='{$path}/rel/{$a.email}'>relance</a>
</td>
</tr>
{/iterate}
<tr>
<td></td>
- <td colspan='5' class='smaller'>(*): mail perso</td>
+ <td colspan='5' class='smaller'>(*): email perso</td>
</tr>
<tr>
<td>
{if $rel_to}
<form action="{$path}/relforce/{$email}" method="post">
+ {xsrf_token_field}
<table class="bicol">
<tr class="pair">
- <th colspan="2">Edition du mail de relance</th>
+ <th colspan="2">Edition de l'email de relance</th>
</tr>
<tr class="pair">
<td align="right"><strong>From:</strong></td>
Nous avions déjà connaissance de cette adresse, nous espérons donc comme toi que {$prenom} va s'inscrire au plus vite.
</p>
<p>
-Si tu le connais personnellement, un petit mail pour lui expliquer les atouts de Polytechnique.org
+Si tu le connais personnellement, un petit email pour lui expliquer les atouts de Polytechnique.org
peut sans aucun doute l'aider à se décider !
</p>
</p>
<form method="post" action="{$platal->path}">
+ {xsrf_token_field}
<table class="bicol" summary="Fiche camarade">
<tr class="impair"><td>Nom :</td><td>{$nom}</td></tr>
<tr class="pair"><td>Prénom :</td><td>{$prenom}</td></tr>
login : {$lusername}
mot de passe : {$nveau_pass}
-(ceci annule les paramètres envoyés par le mail initial)
+(ceci annule les paramètres envoyés par l'email initial)
Rends-toi sur la page web suivante afin d'achever ton inscription, et de changer ton mot de passe :
{/foreach}
<form action="marketing/relance" method="post">
+ {xsrf_token_field}
<table class="bicol" summary="liste des inscriptions non confirmées">
<tr>
<th>Date</th>
</tr>
<tr>
<td class='titre'>
- Titre du mail
+ Titre de l'email
</td>
<td>
<input type='text' size='60' name='title_mail' value="{$nl->title(true)}" />
<h1>Télépaiements</h1>
-{if $smarty.request.op eq "submit" and !$xorg_errors}
+{if $smarty.request.op eq "submit" and !$pl_errors}
<table class="bicol">
<tr>
</a>
</td>
<td>
- <a href="mailto:{$p.alias}@{#globals.mail.domain#}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$p.alias}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
</td>
<td class="center">{$p.promo}</td>
<td>{$p.comment|comment_decode}</td>
Tu peux donc aussi te <a href='exit/forget'>déconnecter complètement</a>.
</p>
<p>
-De plus, ton adresse e-mail est toujours en mémoire dans ton navigateur afin de faciliter ta
+De plus, ton adresse email est toujours en mémoire dans ton navigateur afin de faciliter ta
prochaine connexion. Si tu utilises un ordinateur public ou que tu désires l'effacer, tu peux
<a href='exit/forgetall'>supprimer cette information et te déconnecter complètement</a>.
</p>
{elseif $smarty.cookies.ORGuid}
<p>
-Ton adresse e-mail est toujours en mémoire dans ton navigateur afin de faciliter ta prochaine
+Ton adresse email est toujours en mémoire dans ton navigateur afin de faciliter ta prochaine
connexion. Si tu utilises un ordinateur public ou que tu désires l'effacer, tu peux
<a href='exit/forgetuid'>supprimer cette information</a>.
</p>
</p>
<p>
Pour une sécurité optimale, ton mot de passe circule de manière chiffrée (https) et est
- stocké chiffrée irréversiblement sur nos serveurs.
+ stocké chiffré irréversiblement sur nos serveurs.
</p>
<br />
<form action="{$smarty.server.REQUEST_URI}" method="post" id="changepass">
<td class="half">
<h3><a href="emails">Mes adresses de redirection</a></h3>
<div class='explication'>
- Tu peux configurer tes différentes redirections de mails ici.
+ Tu peux configurer tes différentes redirections d'emails ici.
</div>
</td>
<td class="half">
<td class="half">
{if $smarty.session.mail_fmt eq html}
<h3>
- <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'texte')">Recevoir les mails en format texte</a>
+ <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'texte')">Recevoir les emails en format texte</a>
</h3>
<div class='explication'>
- Tu recois tous les mails envoyés par le site
+ Tu recois tous les emails envoyés par le site
(lettre mensuelle, carnet, ...) de préférence
<strong>sous forme de html</strong>
</div>
{else}
<h3>
- <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'html')">Recevoir les mails en HTML</a>
+ <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'html')">Recevoir les emails en HTML</a>
</h3>
<div class='explication'>
- Tu recois tous les mails envoyés par le site
+ Tu recois tous les emails envoyés par le site
(lettre mensuelle, carnet, ...) de préférence
<strong>sous forme de texte</strong>
</div>
<div class='explication'>
Pour activer ton compte sur le serveur SMTP et NNTP de {#globals.core.sitename#},
ou changer le mot de passe correspondant si tu as déjà activé l'accès.
- Cela te permet d'envoyer tes mails plus souplement (SMTP), et de consulter
+ Cela te permet d'envoyer tes emails plus souplement (SMTP), et de consulter
les forums directement depuis ton logiciel habituel de courrier électronique.
</div>
</td>
<br />
<p>
-<a href="admin/trombino/{$uid}/delete">Supprimer cette photo</a>
+<a href="admin/trombino/{$uid}/delete?token={xsrf_token}">Supprimer cette photo</a>
</p>
<p>
</p>
<form action="admin/trombino/{$uid}/new" method="post" enctype="multipart/form-data">
+ {xsrf_token_field}
<div>
<input name="userfile" type="file" size="20" maxlength="150" />
<input type="submit" value="Envoyer" />
{**************************************************************************}
<form action="{$wiz_baseurl}/{$lookup[$current]}" method="post" id="prof_annu">
+ {xsrf_token_field}
<div>
{icon name=information title="Voir ma fiche"} Tu peux consulter ta fiche telle que la
voient <a class="popup2" href="profile/{$smarty.session.forlife}?view=public">n'importe quel internaute</a>,
<li><a href="http://www.polytechnique.net/{$asso.diminutif}/trombi">trombino</a></li>
<li><a href="http://www.polytechnique.net/{$asso.diminutif}/geoloc">carte</a></li>
{if $asso.lists}
- <li><a href="http://www.polytechnique.net/{$asso.diminutif}/lists">listes mails</a></li>
+ <li><a href="http://www.polytechnique.net/{$asso.diminutif}/lists">listes de diffusion</a></li>
{/if}
{if $asso.events}
<li><a href="http://www.polytechnique.net/{$asso.diminutif}/events">{$asso.events} événement{if $asso.events > 1}s{/if}</a></li>
{/if}
<p>
- Tu recevras un mail dès que les changements demandés auront été effectués.
- Encore merci de nous faire confiance pour tes e-mails !
+ Tu recevras un email dès que les changements demandés auront été effectués.
+ Encore merci de nous faire confiance pour tes emails !
</p>
{else}
return false;
">
{/literal}
+ {xsrf_token_field}
<table class="bicol" cellpadding="4" summary="Nom d'usage">
<tr>
<th>Nom d'usage</th>
{if $myorange}
<p>
- Tu recevras un mail dès que les changements demandés auront été effectués.
- Encore merci de nous faire confiance pour tes e-mails !
+ Tu recevras un email dès que les changements demandés auront été effectués.
+ Encore merci de nous faire confiance pour tes emails !
</p>
{else}
<br />
<form action="profile/orange" method="post">
+ {xsrf_token_field}
<table class="bicol" cellpadding="4" summary="Année de sortie">
<tr>
<th>Année de sortie</th>
{if $x.dcd}
Décédé{if $x.sexe}e{/if} le {$x.deces|date_format}
{elseif !$x.actif}
- Ce camarade n'a plus d'adresse de redirection valide,<br />
+ Ce{if $c.sexe}tte{/if} camarade n'a plus d'adresse de redirection valide,<br />
<a href="marketing/broken/{$x.forlife}" class="popup">clique ici si tu connais son adresse email !</a>
{elseif !$x.inscrit}
Cette personne n'est pas inscrite à Polytechnique.org,<br />
<h1>Trombinoscope</h1>
<form enctype="multipart/form-data" action="photo/change" method="post">
+ {xsrf_token_field}
{if ($session.promo ge 1995) || ($session.promo le 2002)}
<p>
Si tu n'as pas encore fourni de photo, c'est celle du trombinoscope de l'X qui est
<td colspan="2" class="smaller">
* Les photos sont soumises à une validation manuelle en raison des législations relatives
aux droits d'auteur et à la protection des mineurs. Il faut donc attendre l'intervention
- d'un administrateur pour que la photo soit prise en compte. Tu recevras un mail lorsque ta
+ d'un administrateur pour que la photo soit prise en compte. Tu recevras un email lorsque ta
photo aura été contrôlée.
</td>
</tr>
{$prenom}, félicitations pour ton inscription !
N'oublie pas de changer ton mot de passe sur le site. C'est très important
-si tu veux garder accès au site et ton e-mail en fonction.
+si tu veux garder accès au site et ton email en fonction.
Tu as maintenant accès à l'annuaire en ligne, aux services de listes de
diffusion, aux infos promo, etc. N'oublie pas de mettre ta fiche-annuaire
{/if}
<p>
- Ces adresses sont des redirections vers une ou plusieurs adresses e-mail de ton choix.
+ Ces adresses sont des redirections vers une ou plusieurs adresses email de ton choix.
Indiques-en une pour terminer ton inscription. Tu pourras la modifier ou ajouter d'autres
adresses une fois inscrit.
</p>
</tr>
<tr>
<td class="titre">
- E-mail<br />
+ Email<br />
<span class="smaller">(adresse de ton choix pour reçevoir tes emails)</span>
</td>
<td>
</p>
<p>
Si tu ne reçois rien, vérifie bien l'adresse <strong>{$smarty.session.sub_state.email}</strong>.
-En particulier, vérifie si l'e-mail n'a pas été rejeté par ton filtre anti-spam. L'adresse
+En particulier, vérifie si l'email n'a pas été rejeté par ton filtre anti-spam. L'adresse
d'expéditeur est <code>register@polytechnique.org</code>.
</p>
</dd>
<dt><input type='checkbox' value='1' checked="checked" name='imap' />imap</dt>
<dd>
- d'avoir un accès de secours aux 30 derniers jours de mail reçus sur ton adresse Polytechnique.org.
+ d'avoir un accès de secours aux 30 derniers jours d'emails reçus sur ton adresse Polytechnique.org.
</dd>
</dl>
return false;
});
+ }).parent().find('.autocomplete').change(function() {
+ // If we change the value in the type="text" field, then the value in the 'integer id' field must not be used,
+ // to ensure that, we unset it
+ $(this).parent().find('.autocompleteTarget').val('');
});
});
-->
{**************************************************************************}
-{if $formulaire eq 0 and !$xorg_errors}
+{if $formulaire eq 0 and !$pl_errors}
{if !$simple}
{if !$advanced}
{include file=search/quick.form.tpl show_js=1}
<br />
{/if}
-{if !$xorg_no_errors || $xorg_failure}
+{if !$pl_no_errors || $pl_failure}
{include file="skin/common.triggers.tpl"}
{/if}
-{if !$xorg_failure && $xorg_tpl}{include file=$xorg_tpl}{/if}
+{if !$pl_failure && $pl_tpl}{include file=$pl_tpl}{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<link rel="bookmark" href="http://www.polytechnique.fr/eleves/" title="| Site d'élèves" />
<link rel="stylesheet" type="text/css" href="css/base.css" media="all"/>
- {foreach from=$xorg_css item=css}
+ {foreach from=$pl_css item=css}
<link rel="stylesheet" type="text/css" href="css/{$css}" media="all"/>
{/foreach}
- {foreach from=$xorg_inline_css item=css}
+ {foreach from=$pl_inline_css item=css}
<style type="text/css">
{$css|smarty:nodefaults}
</style>
<script type="text/javascript">
var platal_baseurl = "{$globals->baseurl}/";
</script>
- {foreach from=$xorg_js item=js}
+ {foreach from=$pl_js item=js}
<script type="text/javascript" src="javascript/{$js}"></script>
{/foreach}
{javascript name=overlib}
{javascript name=sha1}
{javascript name=secure_hash}
- {if $xorg_rss}
- <link rel="alternate" type="application/rss+xml" title="{$xorg_rss.title}" href="{$xorg_rss.href}" />
+ {if $pl_rss}
+ <link rel="alternate" type="application/rss+xml" title="{$pl_rss.title}" href="{$pl_rss.href}" />
{/if}
- {if $xorg_extra_header}
- {$xorg_extra_header|smarty:nodefaults}
+ {if $pl_extra_header}
+ {$pl_extra_header|smarty:nodefaults}
{/if}
- <title>{$xorg_title|default:"Polytechnique.org : le site des élèves et anciens élèves de l'École polytechnique"}</title>
+ <title>{$pl_title|default:"Polytechnique.org : le site des élèves et anciens élèves de l'École polytechnique"}</title>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<div class="menu_item"><a href="prefs">Mes préférences</a></div>
<div class="menu_title">Services</div>
-<div class="menu_item"><a href="emails/send">Envoyer un mail</a></div>
+<div class="menu_item"><a href="emails/send">Envoyer un email</a></div>
<div class="menu_item"><a href="banana/">Forums & PA</a></div>
+{if $smarty.session.googleapps}
+<div class="menu_item"><a href="http://gmail.polytechnique.org/">Emails Google Apps</a></div>
+{/if}
<div class="menu_item"><a href="lists">Listes de diffusion</a></div>
<div class="menu_item"><a href="payment">Télépaiements</a></div>
<div class="menu_item"><a href="emails/antispam/submit">Soumettre un spam</a></div>
<div class="menu_item"><a href="nl">Lettres mensuelles</a></div>
<div class="menu_item"><a href="ax">Lettres de l'AX</a></div>
<div class="menu_item"><a href="Xorg/NousContacter">Nous contacter</a></div>
-<div class="menu_item"><a href="send_bug" class="popup2">Signaler un bug</a></div>
+<div class="menu_item"><a href="send_bug/{ $smarty.server.REQUEST_URI }" class="popup2">Signaler un bug</a></div>
{if hasPerm('admin')}
<div class="menu_title">***</div>
{* *}
{**************************************************************************}
-{foreach from=$xorg_triggers key=type item=triggers}
+{foreach from=$pl_triggers key=type item=triggers}
{if $triggers|@count}
<div class="{$type}">
<ul>
<h1>Problèmes avec les autres fournisseurs de services</h1>
<p>
- La liste ci-dessous indique quels sont les fournisseurs de mails vers lesquels nous avons
+ La liste ci-dessous indique quels sont les fournisseurs d'emails vers lesquels nous avons
actuellement des problèmes de tranmission.
</p>
{elseif $survey_message neq ""}
{$survey_message}
{else}
-Une erreur inconnue est survenue dans l'édition de ce sondage. N'hésite pas à <a href='send_bug'>signaler ce bug</a> si il persiste.
+Une erreur inconnue est survenue dans l'édition de ce sondage. N'hésite pas à <a href='send_bug/{ $smarty.server.REQUEST_URI }'>signaler ce bug</a> si il persiste.
{/if}
<br/>
<a href="{$survey_link}">Retour</a>
<link rel="bookmark" href="http://www.polytechnique.org/" title="| Polytechnique.org" />
<link rel="bookmark" href="http://www.polytechnique.fr/eleves/" title="| Site d'élèves" />
- {foreach from=$xorg_css item=css}
+ {foreach from=$pl_css item=css}
<link rel="stylesheet" type="text/css" href="css/{$css}" />
{/foreach}
- {foreach from=$xorg_inline_css item=css}
+ {foreach from=$pl_inline_css item=css}
<style type="text/css">
{$css|smarty:nodefaults}
</style>
if (window.top != window)
document.write('<link rel="stylesheet" type="text/css" href="css/onlycontent.css" media="all"/>');
</script>
- {foreach from=$xorg_js item=js}
+ {foreach from=$pl_js item=js}
<script type="text/javascript" src="javascript/{$js}"></script>
{/foreach}
{javascript name=overlib}
- {if $xorg_rss}
- <link rel="alternate" type="application/rss+xml" title="{$xorg_rss.title}" href="{$xorg_rss.href}" />
+ {if $pl_rss}
+ <link rel="alternate" type="application/rss+xml" title="{$pl_rss.title}" href="{$pl_rss.href}" />
{/if}
- {if $xorg_extra_header}
- {$xorg_extra_header|smarty:nodefaults}
+ {if $pl_extra_header}
+ {$pl_extra_header|smarty:nodefaults}
{/if}
<title>Les associations polytechniciennes</title>
<a href="Xnet/APropos">à propos de ce site</a> -
<a href="mailto:contact@polytechnique.org">nous contacter</a>
{if $smarty.session.auth}
- - <a href="send_bug" class="popup_840x600">signaler un bug</a>
+ - <a href="send_bug/{ $smarty.server.REQUEST_URI }" class="popup_840x600">signaler un bug</a>
{/if}
<br />
Plat/al {#globals.version#} - © Copyright 2000-2008 <a href="http://x-org.polytechnique.org/">Association Polytechnique.org</a>
{if $evt.participant_list && $is_admin}
<p class="center">
-[<a href="mailto:?bcc={$evt.short_name}-participants@{#globals.xnet.evts_domain#}">envoyer un mail à ceux qui viennent</a>]
+[<a href="mailto:?bcc={$evt.short_name}-participants@{#globals.xnet.evts_domain#}">envoyer un email à ceux qui viennent</a>]
-
-[<a href="mailto:?bcc={$evt.short_name}-absents@{#globals.xnet.evts_domain#}">envoyer un mail aux membres non inscrits</a>]
+[<a href="mailto:?bcc={$evt.short_name}-absents@{#globals.xnet.evts_domain#}">envoyer un email aux membres non inscrits</a>]
</p>
{/if}
{if count($moments) > 1}
<p class="center">
-[<a href="{$platal->ns}events/admin/{$evt.short_name|default:$evt.eid}"{if !$platal->argv[2]}class="erreur"{/if}>tout</a>]
+[<a href="{$platal->ns}events/admin/{$evt.short_name|default:$evt.eid}"{if
+!$platal->argv[2]}class="erreur"{/if}>Vue générale</a>]
{foreach from=$moments item=m}
[<a href="{$platal->ns}events/admin/{$evt.short_name|default:$evt.eid}/{$m.item_id}" {if $platal->argv[2] eq $m.item_id}class="erreur"{/if}>{$m.titre}</a>]
{/foreach}
<td>
<a href="https://www.polytechnique.org/profile/{$m.email}">{icon name=user_suit title="fiche"}</a>
<a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="vcard"}</a>
- <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
</td>
<td>{$m.montant}</td>
</tr>
{if $m.x}
<a href="https://www.polytechnique.org/profile/{$m.email}">{icon name=user_suit title="fiche"}</a>
<a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="vcard"}</a>
- <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$m.email}@{#globals.mail.domain#}">{icon name=email title="email"}</a>
{else}
- <a href="mailto:{$m.email}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$m.email}">{icon name=email title="email"}</a>
{/if}
</td>
{if $tout}
{/if}
</tr>
{/foreach}
- {if $is_admin && $evt.money}
+ {if $is_admin && $evt.money && $tout}
<tr>
{assign var=cols value=$moments|@count}
<td colspan="{$cols+3}" class="right"><strong>Total</strong></td>
{if $is_admin}
<p class="descr">
-[<a href="{$platal->ns}events/csv/{$evt.eid}/{$platal->argv[2]}/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv">Télécharger le fichier Excel</a>]
+ <a href="{$platal->ns}events/csv/{$evt.eid}/{$platal->argv[2]}/{$evt.intitule}{if $evt.titre}.{$evt.titre}{/if}.csv">
+ {icon name=page_excel title="Télécharger au format Excel"} Télécharger le fichier Excel
+ </a>
</p>
<hr />
<p class="descr">
En tant qu'administrateur, tu peux fixer la venue (accompagnée ou pas) d'un des membres du groupe.
-Donne ici son mail, ainsi que le nombre de participants.
+Donne ici son email, ainsi que le nombre de participants.
</p>
<form action="{$platal->pl_self()}" method="post" id="inscription">
+ {xsrf_token_field}
<p class="descr">
<input type="hidden" name="adm" value="nbs" />
- Mail : <input name="mail" size="20" />
+ Email : <input name="mail" size="20" />
{if $platal->argv[2]}
{$evt.titre} : <input name="nb[{$platal->argv[2]}]" size="1" value="1" />
</p>
<form action="{$platal->pl_self()}" method="post" id="montant">
+ {xsrf_token_field}
<p class="descr">
<input type="hidden" name="adm" value="prix" />
- Mail : <input name="mail" size="20" />
+ Email : <input name="mail" size="20" />
montant : <input name="montant" size="3" value="0,00" /> €
<input type="submit" />
</p>
{/if}
<form method="post" action="{$platal->ns}events/edit/{$url_ref}">
+ {xsrf_token_field}
<table class='bicol' cellspacing='0' cellpadding='0'>
<colgroup>
<col width='25%' />
<tr>
<td class='titre'>
Nom raccourci :<br />
- <small>(pour les mailings listes)</small>
+ <small>(pour les listes de diffusion)</small>
</td>
<td>
<input type="text" name="short_name" size="20" maxlength="20"
</tr>
<tr id="new_pay" style="display:none">
<td colspan="2">
- Il faut que tu définisses le texte du mail de confirmation de paiement. Pour ceci, tu peux adapter le modèle qui suit :
+ Il faut que tu définisses le texte de l'email de confirmation de paiement. Pour ceci, tu peux adapter le modèle qui suit :
<ul>
<li><strong>Remplace les crochets</strong> ([...]) par le texte que tu désires y voir apparaître</li>
<li><salutation>, <prenom>, <nom> et <montant> seront <strong>automatiquement</strong> remplacés par les informations adaptées</li>
modifier
{icon name=date_edit title="Édition de l'événement"}</a>]
- [<a href="javascript:dynpostkv('{$platal->pl_self()}', {if !$archive}'archive'{else}'unarchive'{/if}, {$e.eid})">
+ [<a href="javascript:dynpostkv('{$platal->pl_self()}?token={xsrf_token}', {if !$archive}'archive'{else}'unarchive'{/if}, {$e.eid})">
{if !$archive}
archiver
{icon name=package_add title="Archivage"}</a>]
{icon name=package_delete title="Désarchivage"}</a>]
{/if}
- [<a href="javascript:dynpostkv('{$platal->ns}events', 'del', {$e.eid})"
+ [<a href="javascript:dynpostkv('{$platal->ns}events?token={xsrf_token}', 'del', {$e.eid})"
onclick="return confirm('Supprimer l\'événement effacera la liste des inscrits et des paiements.\n Es-tu sûr de vouloir supprimer l\'événement ?')">
supprimer
{icon name=delete title='Suppression'}</a>]
{/if}
<form action="{$platal->ns}events/sub/{$event.eid}" method="post">
+ {xsrf_token_field}
<table class="tiny" cellspacing="0" cellpadding="0">
{foreach from=$event.moments item=m}
<tr><th>{$m.titre} ({$m.montant} €)</th></tr>
<tr class="{if $art.perime}im{/if}pair">
<td><a href="{$platal->ns}announce/edit/{$art.id}">{$art.titre}</a></td>
<td>{$art.peremption|date_format}</td>
- <td class="right"><a href="{$platal->ns}admin/announces?del={$art.id}">
+ <td class="right"><a href="{$platal->ns}admin/announces?del={$art.id}&token={xsrf_token}">
Supprimer l'annonce {icon name=cross}
</a>
</td>
{/if}
<form method="post" action="{$platal->ns}announce/{if $new}new{else}edit/{$art.id}{/if}" enctype="multipart/form-data">
+{xsrf_token_field}
<div>
<table class="bicol">
<tr>
<td>
<small>
Le contenu est destiné à recevoir la description de ce qui est annoncé.
- Il faut éviter d'y mettre des adresses mails ou web (surtout si l'annonce est publique),
+ Il faut éviter d'y mettre des adresses emails ou web (surtout si l'annonce est publique),
qui devront être placées dans la section "contacts".
</small>
</td>
<td class="titre">Contacts :</td>
<td>
<small>
- La section "contacts" sert à noter les informations telles que les adresses mails de contact, les sites web.
- Elle n'est accessible qu'aux personnes authentifiées. Si l'annonce est attachée à une événement, un lien vers
+ La section "contacts" sert à noter les informations telles que les adresses emails de contact, les sites web.
+ Elle n'est accessible qu'aux personnes authentifiées. Si l'annonce est attachée à un événement, un lien vers
la page d'inscription est automatiquement ajouté.
</small>
</td>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2008 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 *}
+{* *}
+{**************************************************************************}
+Nom,Prénom,Sexe,Promotion,Email,Commentaire
+{if $ann}
+{iterate from=$ann item=m}
+
+{$m.nom},{$m.prenom},{if $m.sexe}F{else}M{/if},{$m.promo},{$m.email},{$m.comm|replace:',':'\,'}
+
+{/iterate}
+{/if}
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</li>
{/if}
<li>
+ <a href="{$platal->ns}annuaire/csv/{$asso.diminutif}.csv">
+ {icon name=page_excel title="Fichier Excel"}
+ Obtenir au format Excel
+ </a>
+ </li>
+ <li>
<a href="{$platal->ns}annuaire/vcard/photos/{$asso.diminutif}.vcf">
{icon name=vcard title="Carte de visite"}
Ajouter les membres à ton carnet d'adresse
{/foreach}
</p>
-<table summary="membres du groupe" class="tinybicol">
+<table summary="membres du groupe" class="bicol">
<tr>
<th>
<a href="{$platal->ns}annuaire?order=alpha{if $sort neq "alpha_inv"}_inv{/if}{if $request_group and $group eq 'initiale'}&initiale={$request_group}{/if}{if $only_admin}&admin=1{/if}">
Promo
</a>
</th>
- <th>Infos</th>
+ <th colspan="2">Infos</th>
{if $is_admin}
<th>Actions</th>
{/if}
{assign var=broken value=true}
{/if}</td>
<td>{if $m.admin}<strong>{/if}{$m.promo}{if $m.admin}</strong>{/if}</td>
- <td class="center">
+ {if $m.comm}
+ <td>{$m.comm}</td>
+ {/if}
+ <td class="right" {if !$m.comm}colspan="2"{/if}>
{if $m.inscrit}
<a href="https://www.polytechnique.org/vcard/{$m.email}.vcf">{icon name=vcard title="[vcard]"}</a>
- <a href="mailto:{$m.email}@polytechnique.org">{icon name=email title="mail"}</a>
+ <a href="mailto:{$m.email}@polytechnique.org">{icon name=email title="email"}</a>
{else}
- <a href="mailto:{$m.email}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$m.email}">{icon name=email title="email"}</a>
{/if}
</td>
{if $is_admin}
</td>
<td>
{if $asso.mail}
- {mailto address=$asso.mail text=$asso.resp|utf8_decode|default:"par mail" encode=javascript}
+ {mailto address=$asso.mail text=$asso.resp|utf8_decode|default:"par email" encode=javascript}
{else}
{$asso.resp}
{/if}
</td>
</tr>
{/if}
+
+ {if $is_admin && $requests}
+ <tr>
+ <td class="titre center" colspan="2">
+ <a href="{$platal->ns}subscribe/valid">{$requests} demande{if $requests gt 1}s{/if} d'inscription en attente</a>
+ </td>
+ </tr>
+ {/if}
</table>
<br />
<tr>
<td class="titre">
- Adresse mail :
+ Adresse email :
</td>
<td>
<input type="text" size="40" name="mail" value="{$asso.mail}" />
</select>
</td>
</tr>
+ <tr>
+ <td class="titre center" colspan="2">
+ <input type="checkbox" value="1" name="notif_unsub" {if $asso.notif_unsub}checked="checked"{/if} />
+ prévenir les animateurs lors de la désinscription d'un membre
+ </td>
+ </tr>
</table>
<div class="center">
{if $u && $is_admin && $show_form}
<h2>
- Demande de la part de : {$prenom} {$nom} (X{$promo})
- <a href="https://www.polytechnique.org/profile/{$u}">Voir sa fiche</a>
+ Demande de la part de : <a href="profile/{$u}" class="popup2">{$prenom} {$nom} (X{$promo})</a>
</h2>
+
+{if $reason}
+<fieldset>
+ <legend>Motif de la demande</legend>
+ {$reason|nl2br}
+</fieldset>
+{/if}
+
<form action="{$platal->ns}subscribe/{$u}" method="post">
- <input type="submit" value="Accepter" name="accept" />
- <br />
- ou bien
- <br />
- <input type="submit" value="Refuser avec le motif ci-dessous" name="refuse" />
- <textarea cols="70" rows="8" name="motif"></textarea>
- <br />
+ {xsrf_token_field}
+ <table class="bicol">
+ <tr>
+ <td>Raison (en cas de refus) :</td>
+ </tr>
+ <tr>
+ <td>
+ <textarea cols="70" rows="8" name="motif"></textarea>
+ </td>
+ </tr>
+ <tr>
+ <td class="center">
+ <input type="submit" value="Accepter" name="accept" />
+ <input type="submit" value="Refuser" name="refuse" />
+ </td>
+ </tr>
+ </table>
</form>
+<div><a href="{$platal->ns}/subscribe/valid">Revenir à la liste des validations en attente</a></div>
+
{elseif $smarty.post.inscrire}
<p class="descr">
[ M'inscrire ! ].
</p>
<form action="{$platal->ns}subscribe" method="post">
+ {xsrf_token_field}
<p class="descr">
<strong>OUI, je souhaite être inscrit au groupe {$asso.nom}.</strong>
</p>
{**************************************************************************}
-<h1>{$asso.nom} : Envoyer un mail</h1>
+<h1>{$asso.nom} : Envoyer un email</h1>
<p class="descr">
Ton message peut être personnalisé : si tu rentres les mots <cher>, <prenom>,
//]]></script>
<form action="{$platal->ns}mail" method="post" enctype="multipart/form-data">
+ {xsrf_token_field}
<table class='bicol'>
<tr>
- <th colspan="2">Écrire un mail :</th>
+ <th colspan="2">Écrire un email :</th>
</tr>
<tr>
<td class="titre">Expéditeur :</td>
{/foreach}
<tr>
- <th colspan="2">Contenu du mail</th>
+ <th colspan="2">Contenu de l'email</th>
</tr>
<tr>
<td class="titre">
<h1>{$asso.nom} : Ajout d'un membre</h1>
<form method="post" action="{$platal->ns}member/new/">
+ {xsrf_token_field}
<ul class='descr'>
<li>
Pour ajouter un X dans ton groupe, il suffit d'entrer ici une de ses
- adresses mail @polytechnique.org. S'il n'est pas inscrit à Polytechnique.org
+ adresses email @polytechnique.org. S'il n'est pas inscrit à Polytechnique.org
coche la case qui se trouve sous le formulaire et indique ses noms, prénoms et
promotions.
</li>
<li>
Pour ajouter un extérieur dans ton groupe, il suffit d'entrer ici son
- adresse mail, tu seras ensuite redirigé vers une page te permettant
+ adresse email, tu seras ensuite redirigé vers une page te permettant
d'éditer son profil (nom, prenom, ...)
</li>
</ul>
<form method="post" action="{$platal->pl_self()}">
+ {xsrf_token_field}
<div class="center">
<p class="descr">
{if $self}
</p>
<h2>
- Édition du profil de {$user.prenom} {$user.nom}
+ Édition du profil de {if "`$user.prenom` `$user.nom`"|trim}{$user.prenom} {$user.nom}{else}{$user.email}{/if}
{if $user.origine eq 'X'}
(X{$user.promo})
<a href="https://www.polytechnique.org/profile/{$user.alias}">{icon name=user_suit title="fiche"}</a>
</h2>
<form method="post" action="{$platal->ns}member/{$platal->argv[1]}">
+ {xsrf_token_field}
<table cellpadding="0" cellspacing="0" class='tinybicol'>
<tr class="pair">
<td class="titre">
- Permissions:
+ Permissions :
</td>
<td>
<select name="is_admin">
</tr>
<tr class="impair">
<td class="titre">
- Email:
+ Email :
</td>
<td>
<input type="text" value="{$user.email}" name="email" size="40" />
</td>
</tr>
+ {/if}
+ <tr class="impair">
+ <td class="titre">
+ Commentaire :
+ </td>
+ <td>
+ <input type="text" name="comm" value="{$user.comm}" size="40" maxlength="255" /><br />
+ <small>Poste, origine, ... (accessible à toutes les personnes autorisées à consulter l'annuaire)</small>
+ </td>
+ </tr>
+ {if $user.origine neq X}
<tr id="make_X" {if $user.origine eq "groupe"}style="display: none"{/if}>
<td colspan="2">
<span id="make_X_cb">
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2008 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 *}
+{* *}
+{**************************************************************************}
+
+<h1>{$asso.nom} : Validation des inscriptions</h1>
+
+<script type="text/javascript">//<![CDATA[
+{literal}
+ var toggleState = false;
+ function toggleSelection()
+ {
+ toggleState = !toggleState;
+ var boxes = $(':checkbox.select_sub');
+ if (toggleState) {
+ boxes.attr("checked", "checked");
+ } else {
+ boxes.removeAttr("checked");
+ }
+ return true;
+ }
+{/literal}
+//]]></script>
+
+<form action="{$platal->ns}subscribe/valid" method="post">
+ <table class="tinybicol">
+ <tr>
+ <th><a href="javascript:toggleSelection()">{icon name="arrow_refresh" title="Inverser la sélection"}</a></th>
+ <th>Prénom Nom</th>
+ <th>Date de demande</th>
+ <th></th>
+ </tr>
+ {iterate from=$valid item=user}
+ <tr>
+ <td><input type="checkbox" name="subs[{$user.forlife}]" value="1" class="select_sub" /></td>
+ <td><a href="profile/{$user.forlife}" class="popup2">{$user.prenom} {$user.nom} (X{$user.promo})</a></td>
+ <td>{$user.date|date_format}</td>
+ <td><a href="{$platal->ns}subscribe/{$user.forlife}">{icon name=magnifier title="Détails"}</a></td>
+ </tr>
+ {/iterate}
+ </table>
+
+ <div class="center">
+ {xsrf_token_field}
+ <input type="submit" name="valid" value="Accepter" />
+ </div>
+
+ <div>
+ Pour voir le détail sur une demande, clique sur le lien {icon name=magnifier title="Détails"}.<br />
+ Pour refuser une demande, tu dois aller consulter les détails et remplir la raison du refus.
+ </div>
+</form>
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2008 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 *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="xnet_unsubscription"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{subject text="[`$group`] Désinscription de `$prenom` `$nom`"}
+{elseif $mail_part eq 'wiki'}
+Chers animateurs du groupe {$group},
+
+{if $selfdone}
+{$prenom} {$nom} ({$mail}) vient de se désinscrire du groupe.
+{else}
+{$prenom} {$nom} ({$mail}) vient d'être désinscrit du groupe par {$smarty.session.prenom} {$smarty.session.nom}.
+{/if}
+
+Cordialement,\\
+L'Equipe de Polytechnique.org
+{/if}
+{* vim:set et sw=2 sts=2 sws=2: *}
{if $m.admin}</strong>{/if}
</td>
<td class="center">
- <a href='{$platal->ns}alias/admin/{$platal->argv[1]}?del_member={$m.redirect|urlencode}'>
+ <a href='{$platal->ns}alias/admin/{$platal->argv[1]}?del_member={$m.redirect|urlencode}&token={xsrf_token}'>
{icon name=delete title='retirer membre'}
</a>
</td>
<tr>
<td colspan="3" class="center">
<form method="post" action="{$platal->ns}alias/admin/{$platal->argv[1]}">
+ {xsrf_token_field}
<div>
<input type='text' name='add_member' />
de modération), il est recommandé de créer <a href="{$platal->ns}lists/create">une liste de diffusion</a>.
</p>
<form action='{$platal->ns}alias/create' method='post'>
+ {xsrf_token_field}
<table class='large'>
<tr>
<th colspan='2'>Caractéristiques de l'alias</th>
<a href="{$platal->ns}alias/create">un alias</a> qui, lui, est capable de regrouper plusieurs listes.
</p>
<form action='{$platal->ns}lists/create' method='post'>
+ {xsrf_token_field}
<table class="large">
<tr>
<th colspan='4'>Caractéristiques de la Liste</th>
<tr>
<td style="border: 0; border-right: 1px solid gray">
diffusion :<br/><span style='font-size: xx-small;'>
- (l'envoi d'un mail à cette liste est-il modéré ?)</span>
+ (l'envoi d'un email à cette liste est-il modéré ?)</span>
</td>
<td style="border: 0">
<label><input type='radio' name='modlevel' value='0'
<p class="error">Es-tu sûr de vouloir supprimer l'alias {$smarty.get.del_alias} ?</p>
<form action='{$platal->ns}lists' method="post">
+ {xsrf_token_field}
<div class="center">
<input type='submit' value="Oui, je suis sûr" />
<input type='hidden' name='del_alias' value="{$smarty.get.del_alias}" />
<h2>Listes de diffusion du groupe {$asso.nom} :</h2>
<p class="descr">
-Une liste dont <strong>la diffusion</strong> est modérée est une liste dont les mails sont validés
+Une liste dont <strong>la diffusion</strong> est modérée est une liste dont les emails sont validés
par les administrateurs avant d'être transmis aux membres de la liste. Une liste dont
<strong>l'inscription</strong> est modérée est une liste pour laquelle l'abonnement est soumis à
l'accord préalable des responsables du groupe.
{foreach from=$listes item=l}
<tr>
<td class='center'>
- <a href="mailto:{$l.list}@{$asso.mail_domain}">{icon name=email title="mail"}</a>
+ <a href="mailto:{$l.list}@{$asso.mail_domain}">{icon name=email title="email"}</a>
</td>
<td>
{if $l.own}
<td align='right'>{$l.nbsub}</td>
<td align='center'>
{if $l.sub eq 2}
- <a href="{$platal->ns}lists?del={$l.list}">{icon name=cross title="me désinscrire"}</a>
+ <a href="{$platal->ns}lists?del={$l.list}&token={xsrf_token}">{icon name=cross title="me désinscrire"}</a>
{elseif $l.sub eq 1}
{icon name=flag_orange title='inscription en attente de modération'}
{else}
- <a href="{$platal->ns}lists?add={$l.list}">{icon name=add title="m'inscrire"}</a>
+ <a href="{$platal->ns}lists?add={$l.list}&token={xsrf_token}">{icon name=add title="m'inscrire"}</a>
{/if}
</td>
</tr>
{iterate from=$alias item=a}
<tr>
{if $may_update}
- <td class="center"><a href='mailto:{$a.alias}'>{icon name=email title="mail"}</a></td>
+ <td class="center"><a href='mailto:{$a.alias}'>{icon name=email title="email"}</a></td>
<td><a href="{$platal->ns}alias/admin/{$a.alias}">{$a.alias}</a></td>
<td class="center"><a href="{$platal->ns}lists?del_alias={$a.alias}">{icon name=delete title='supprimer'}</a></td>
{else}
- <td><a href='mailto:{$a.alias}'>{icon name=email title="mail"} {$a.alias}</a></td>
+ <td><a href='mailto:{$a.alias}'>{icon name=email title="email"} {$a.alias}</a></td>
{/if}
</tr>
{/iterate}
<h1>Non abonnés à la liste {$platal->argv[1]}@{$asso.mail_domain}</h1>
<form action="{$platal->ns}lists/sync/{$platal->argv[1]}" method="post">
-
+ {xsrf_token_field}
<table cellspacing="2" cellpadding="0" class="tiny">
<tr>
<th colspan="2">Membre</th>
+++ /dev/null
-ALTER TABLE axletter_rights CHANGE COLUMN user_id user_id SMALLINT UNSIGNED NOT NULL DEFAULT 0;
-
--- vim:set syntax=mysql:
--- /dev/null
+ALTER TABLE adresses MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE aliases MODIFY COLUMN id INT NOT NULL DEFAULT 0;
+ALTER TABLE applis_ins MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE auth_user_md5 MODIFY COLUMN user_id INT NOT NULL AUTO_INCREMENT;
+ALTER TABLE auth_user_quick MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE axletter_ins MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE axletter_rights MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE binets_ins MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE competences_ins MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE contacts MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE email_send_save MODIFY COLUMN uid INT NOT NULL;
+ALTER TABLE emails_watch MODIFY COLUMN uid INT DEFAULT NULL;
+ALTER TABLE entreprises MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE evenements MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE evenements_vus MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE gapps_accounts MODIFY COLUMN l_userid INT DEFAULT NULL;
+ALTER TABLE gapps_queue MODIFY COLUMN q_owner_id INT DEFAULT NULL;
+ALTER TABLE gapps_queue MODIFY COLUMN q_recipient_id INT DEFAULT NULL;
+ALTER TABLE groupesx_ins MODIFY COLUMN guid INT NOT NULL DEFAULT 0;
+ALTER TABLE homonymes MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE ip_watch MODIFY COLUMN uid INT DEFAULT NULL;
+ALTER TABLE langues_ins MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE mentor MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE mentor_pays MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE mentor_secteurs MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE ml_moderate MODIFY COLUMN mid INT NOT NULL;
+ALTER TABLE ml_moderate MODIFY COLUMN uid INT NOT NULL;
+ALTER TABLE newsletter_ins MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE perte_pass MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE photo MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE profile_medals_sub MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE register_subs MODIFY COLUMN uid INT NOT NULL;
+ALTER TABLE survey_surveys MODIFY COLUMN author_id INT NOT NULL;
+ALTER TABLE survey_votes MODIFY COLUMN user_id INT NOT NULL;
+ALTER TABLE tels MODIFY COLUMN uid INT NOT NULL DEFAULT 0;
+ALTER TABLE user_changes MODIFY COLUMN user_id INT NOT NULL DEFAULT 0;
+ALTER TABLE watch_profile MODIFY COLUMN uid INT NOT NULL;
+
+# vim:set syntax=mysql:
--- /dev/null
+CREATE TABLE requests_hidden (
+ user_id INT NOT NULL,
+ hidden_requests TEXT NOT NULL,
+ PRIMARY KEY(user_id)
+) CHARSET=utf8;
+
+# vim:set syntax=mysql:
--- /dev/null
+use groupex;
+
+alter table asso change column flags flags set('wiki_desc', 'notif_unsub') not null;
+
+create table membres_sub_requests (
+ asso_id smallint(5) unsigned not null,
+ uid int(11) not null,
+ ts timestamp not null default NOW(),
+ reason text default null,
+
+ primary key sub (asso_id, uid)
+) charset=utf8;
+
+use x4dat;
+
+# vim:set syntax=mysql:
--- /dev/null
+ALTER TABLE auth_user_quick MODIFY COLUMN last_version VARCHAR(16) NOT NULL DEFAULT '';
+
+# vim:set syntax=mysql:
--- /dev/null
+use forums;
+
+alter table profils
+ add column tree_unread varchar(8) not null default 'o',
+ add column tree_read varchar(8) not null default 'dg';
+
+use x4dat;
+
+# vim:set syntax=mysql:
--- /dev/null
+use logger;
+
+alter table events change column data data text default null;
+
+use x4dat;
+
+# vim:set syntax=mysql: