================================================================================
+VERSION 1.0.1 XX XX XXXX
+
+From 1.0.0 branch:
+ * AXLetter:
+ - Fix unsubscription -XEL
+
+ * Carnet:
+ - Fix inaccessible carnet/panel in case of profile update -FRU
+ - Fix notification email -JAC
+
+ * Events:
+ - Fix promotion_ml reminder -FRU
+
+ * Lists:
+ - Fix inclusion of banana for achives and moderation preview -FRU
+
+ * Profile:
+ - Fix entreprise validation -JAC
+ - Fix name validation -XEL
+ - Fix orange validation -XEL
+ - Fix vcards -FRU
+ - Fix geocoding -JAC
+
+ * Newsletter:
+ - Fix user selection -FRU
+
+ * Register:
+ - Fix calls to missing functions -JAC
+
+ * Search:
+ - Fix filtering by promotion -XEL
+ - Fix search by address -XEL
+
+ * XnetGrp:
+ - Fix name in unsubscription notification -JAC
+ - Fix mailer sending O(n^2) mails -VZA
+
+ * XnetList:
+ - Fix group directory synchronization page -JAC
+
+================================================================================
VERSION 1.0.0 30 06 2010
New:
## conf
##
-conf: spool/templates_c spool/mails_c classes/platalglobals.php configs/platal.cron htdocs/.htaccess spool/conf spool/tmp
+conf: 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 spool/run:
mkdir -p $@
<?php
require './connect.db.inc.php';
-require_once 'profil.func.inc.php';
$globals->debug = 0; // do not store backtraces
-
+// TODO: Improve this using Phone::iterate.
function do_update_by_block($values)
{
$values = '';
$i = 0;
while ($phone = $res->next()) {
- $disp = format_display_number($phone['search_tel'], $error, array('format' => $format, 'phoneprf' => $prefix));
+ $phone = new Phone('display' => $phone['display_tel']);
+ $phone->format(array('format' => $format, 'phoneprf' => $prefix));
if ($values != '') {
$values .= ",\n";
}
$values .= "('" . addslashes($phone['pid']) . "', '" . addslashes($phone['link_type'])
. "', '" . addslashes($phone['link_id'])
. "', '" . addslashes($phone['tel_id']) . "', '" . addslashes($phone['tel_type'])
- . "', '" . addslashes($phone['search_tel']) . "', '" . addslashes($disp)
+ . "', '" . addslashes($phone['search_tel']) . "', '" . addslashes($phone->display)
. "', '" . addslashes($phone['pub']) . "', '" . addslashes($phone['comment']) . "')";
$i++;
if ($i == 1000) {
--- /dev/null
+#!/usr/bin/php5 -q
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2010 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 'connect.db.inc.php';
+require_once 'plmailer.php';
+global $globals;
+
+$res = XDB::iterator('SELECT p.hrpid, pm.pid, a.full_name, pm.field, pm.oldText, pm.newText, p.sex, pd.yourself, al.alias
+ FROM profile_modifications AS pm
+ INNER JOIN accounts AS a ON (pm.uid = a.uid)
+ INNER JOIN profiles AS p ON (pm.pid = p.pid)
+ INNER JOIN profile_display AS pd ON (pm.pid = pd.pid)
+ INNER JOIN account_profiles AS ap ON (pm.pid = ap.pid AND FIND_IN_SET(\'owner\', ap.perms))
+ INNER JOIN aliases AS al ON (ap.uid = al.uid AND FIND_IN_SET(\'bestalias\', al.flags))
+ ORDER BY pm.pid, pm.field');
+
+$date = time();
+$values = $res->next();
+
+$pid = $values['pid'];
+$sex = ($values['sex'] == 'female') ? 1 : 0;
+$yourself = $values['yourself'];
+$alias = $values['alias'];
+$hrpid = $values['hrpid'];
+$modifications = array();
+$modifications[] = array(
+ 'full_name' => $values['full_name'],
+ 'field' => $values['field'],
+ 'oldText' => $values['oldText'],
+ 'newText' => $values['newText'],
+);
+
+while ($values = $res->next()) {
+ if ($values['pid'] != $pid) {
+ $mailer = new PlMailer('profile/notification.mail.tpl');
+ $mailer->addTo($alias . '@' . $globals->mail->domain);
+ $mailer->assign('modifications', $modifications);
+ $mailer->assign('yourself', $yourself);
+ $mailer->assign('hrpid', $hrpid);
+ $mailer->assign('sex', $sex);
+ $mailer->assign('date', $date);
+ $mailer->send();
+ $modifications = array();
+ }
+ $pid = $values['pid'];
+ $sex = ($values['sex'] == 'female') ? 1 : 0;
+ $yourself = $values['yourself'];
+ $alias = $values['alias'];
+ $hrpid = $values['hrpid'];
+ $modifications[] = array(
+ 'full_name' => $values['full_name'],
+ 'field' => $values['field'],
+ 'oldText' => $values['oldText'],
+ 'newText' => $values['newText'],
+ );
+}
+$mailer = new PlMailer('profile/notification.mail.tpl');
+$mailer->addTo($alias . '@' . $globals->mail->domain);
+$mailer->assign('modifications', $modifications);
+$mailer->assign('yourself', $yourself);
+$mailer->assign('hrpid', $hrpid);
+$mailer->assign('sex', $sex);
+$mailer->assign('date', $date);
+$mailer->send();
+
+XDB::execute('DELETE FROM profile_modifications');
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
require_once 'marketing.inc.php';
$opts = getopt('f:l:m:');
-if (($opts['f'] && $opts['f'] == '-') || empty($opts['f'])) {
- $file = 'php://stdin';
+if (($opts['f'] && $opts['f'] == '-') || empty($opts['f'])) {
+ $file = 'php://stdin';
} else {
$file = $opts['f'];
}
const EDUDEGREES = 'educationdegrees';
const EDUFIELDS = 'educationfields';
+ const CORPS = 'corps';
+ const CORPSRANKS = 'corpsranks';
+
const NATIONALITIES = 'nationalities';
const COUNTRIES = 'countries';
const ADMINAREAS = 'adminareas';
const NETWORKS = 'networking';
+ const MEDALS = 'medals';
+
static private $enumerations = array();
static private function init($type)
}
// }}}
+ /** Builds a list of query parts for searching @$text in @$field :
+ * field LIKE 'text%', field LIKE '% text%', field LIKE '%-text%'
+ */
private function mkTests($field, $text)
{
$tests = array();
}
// }}}
+// {{{ class DE_Corps
+class DE_Corps extends DirEnumeration
+{
+ protected $idfield = 'corps_enum.id';
+ protected $valfield = 'corps_enum.name';
+ protected $valfield2 = 'corps_enum.abbrev';
+ protected $from = 'corps_enum';
+
+ protected $ac_unique = 'corps.pid';
+ protected $ac_join = 'INNER JOIN corps ON (corps.current_corpsid = corps_enum.id)';
+}
+// }}}
+
+// {{{ class DE_CorpsRanks
+class DE_CorpsRanks extends DirEnumeration
+{
+ protected $idfield = 'corps_rank_enum.id';
+ protected $valfield = 'corps_rank_enum.name';
+ protected $valfield2 = 'corps_rank_enum.abbrev';
+ protected $from = 'corps_rank_enum';
+
+ protected $ac_unique = 'corps.pid';
+ protected $ac_join = 'INNER JOIN corps ON (corps.rankid = corps_rank_enum.id)';
+}
+// }}}
+
/** GEOLOC
*/
// {{{ class DE_Nationalities
}
// }}}
+/** MEDALS
+ */
+// {{{ class DE_Medals
+class DE_Medals extends DirEnumeration
+{
+ protected $from = 'profile_medal_enum';
+
+ protected $ac_join = 'INNER JOIN profile_medals ON (profile_medals.mid = profile_medal_enum.id)';
+ protected $ac_unique = 'profile_medals.pid';
+}
+// }}}
+
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2010 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 Phone is meant to perform most of the access to the table profile_phones.
+ *
+ * profile_phone describes a Phone, which can be related to an Address,
+ * a Job, a Profile or a Company:
+ * - for a Profile:
+ * - `link_type` is set to 'user'
+ * - `link_id` is set to 0
+ * - `pid` is set to the id of the related Profile (in profiles)
+ *
+ * - for a Company:
+ * - `link_type` is set to 'hq'
+ * - `link_id` is set to the id of the related Company (in profile_job_enum)
+ * - `pid` is set to 0
+ *
+ * - for an Address (this only applies to a personal address)
+ * - `link_type` is set to 'address'
+ * - `link_id` is set to the related Address `id` (in profile_addresses)
+ * - `pid` is set to the related Address `pid` (in both profiles and profile_addresses)
+ *
+ * - for a Job:
+ * - `link_type` is set to 'pro'
+ * - `link_id` is set to the related Job `id` (not `jobid`) (in profile_job)
+ * - `pid` is set to the related Job `pid` (in both profiles and profile_job)
+ *
+ * Thus a Phone can be linked to a Company, a Profile, a Job, or a Profile-related Address.
+*/
+class Phone
+{
+ const TYPE_FAX = 'fax';
+ const TYPE_FIXED = 'fixed';
+ const TYPE_MOBILE = 'mobile';
+
+ const LINK_JOB = 'pro';
+ const LINK_ADDRESS = 'address';
+ const LINK_PROFILE = 'user';
+ const LINK_COMPANY = 'hq';
+
+ /** The following fields, but $error, all correspond to the fields of the
+ * database table profile_phones.
+ */
+ private $id = 0;
+ private $pid = 0;
+ private $search = '';
+ private $link_type = 'user';
+ private $link_id = 0;
+ // The following fields are the fields of the form in the profile edition.
+ private $type = 'fixed';
+ public $display = '';
+ private $pub = 'private';
+ public $comment = '';
+ private $error = false;
+
+ public function __construct(array $data = array())
+ {
+ if (count($data) > 0) {
+ foreach ($data as $key => $val) {
+ $this->$key = $val;
+ }
+ }
+ }
+
+ public function linkType()
+ {
+ return $this->link_type;
+ }
+
+ public function linkId()
+ {
+ return $this->link_id;
+ }
+
+ public function id()
+ {
+ return $this->id;
+ }
+
+ public function pid()
+ {
+ return $this->pid;
+ }
+
+ public function search()
+ {
+ return $this->search;
+ }
+
+ /** Returns the unique ID of a phone.
+ * This ID will allow to link it to an address, a user or a job.
+ * The format is address_addressId_phoneId (where phoneId is the id
+ * of the phone in the list of those associated with the address).
+ */
+ public function uniqueId() {
+ return $this->link_type . '_' . $this->link_id . '_' . $this->id;
+ }
+
+ public function hasFlags($flags) {
+ return $this->hasType($flags) && $this->hasLink($flags);
+ }
+
+ /** Returns true if this phone's type matches the flags.
+ */
+ public function hasType($flags) {
+ $flags = $flags & Profile::PHONE_TYPE_ANY;
+ return (
+ ($flags == Profile::PHONE_TYPE_ANY)
+ ||
+ (($flags & Profile::PHONE_TYPE_FAX) && $this->type == self::TYPE_FAX)
+ ||
+ (($flags & Profile::PHONE_TYPE_FIXED) && $this->type == self::TYPE_FIXED)
+ ||
+ (($flags & Profile::PHONE_TYPE_MOBILE) && $this->type == self::TYPE_MOBILE)
+ );
+ }
+
+ /** User-friendly accessible version of the type.
+ */
+ public function displayType($short = false)
+ {
+ switch ($this->type) {
+ case Phone::TYPE_FIXED:
+ return $short ? 'Tél' : 'Fixe';
+ case Phone::TYPE_FAX:
+ return 'Fax';
+ case Phone::TYPE_MOBILE:
+ return $short ? 'Mob' : 'Mobile';
+ default:
+ return $this->type;
+ }
+ }
+
+ /** Returns true if this phone's link matches the flags.
+ */
+ public function hasLink($flags)
+ {
+ $flags = $flags & Profile::PHONE_LINK_ANY;
+ return (
+ ($flags == Profile::PHONE_LINK_ANY)
+ ||
+ (($flags & Profile::PHONE_LINK_COMPANY) && $this->link_type == self::LINK_COMPANY)
+ ||
+ (($flags & Profile::PHONE_LINK_JOB) && $this->link_type == self::LINK_JOB)
+ ||
+ (($flags & Profile::PHONE_LINK_ADDRESS) && $this->link_type == self::LINK_ADDRESS)
+ ||
+ (($flags & Profile::PHONE_LINK_PROFILE) && $this->link_type == self::LINK_PROFILE)
+ );
+ }
+
+ /* Properly formats the search phone, based on actual display phone.
+ *
+ * Computes a base form of the phone number with the international prefix.
+ * This number only contains digits, thus does not begin with the '+' sign.
+ * Numbers starting with 0 (or '(0)') are considered as French.
+ * This assumes that non-French numbers have their international prefix.
+ */
+ private function formatSearch()
+ {
+ $tel = trim($this->display);
+ // Number starting with "(0)" is a French number.
+ if (substr($tel, 0, 3) === '(0)') {
+ $tel = '33' . $tel;
+ }
+ // Removes all "(0)" often used as local prefix.
+ $tel = str_replace('(0)', '', $tel);
+ // Removes all non-digit chars.
+ $tel = preg_replace('/[^0-9]/', '', $tel);
+
+ if (substr($tel, 0, 2) === '00') {
+ // Removes prefix for international calls.
+ $tel = substr($tel, 2);
+ } else if (substr($tel, 0, 1) === '0') {
+ // Number starting with 0 is a French number.
+ $tel = '33' . substr($tel, 1);
+ }
+ $this->search = $tel;
+ }
+
+ // Properly formats the display phone, it requires the search phone to be already formatted.
+ private function formatDisplay($format = array())
+ {
+ $tel = $this->search;
+ $ret = '';
+ $telLength = strlen($tel);
+ // Try to find the country by trying to find a matching prefix of 1, 2 or 3 digits.
+ if ((!isset($format['phoneprf'])) || ($format['phoneprf'] == '')) {
+ $res = XDB::query('SELECT phonePrefix AS phoneprf, phoneFormat AS format
+ FROM geoloc_countries
+ WHERE phonePrefix = {?} OR phonePrefix = {?} OR phonePrefix = {?}
+ LIMIT 1',
+ substr($tel, 0, 1), substr($tel, 0, 2), substr($tel, 0, 3));
+ if ($res->numRows() == 0) {
+ // No country found, does not format more than prepending a '+' sign.
+ $this->error = true;
+ $this->display = '+' . $tel;
+ return;
+ }
+ $format = $res->fetchOneAssoc();
+ }
+ if ($format['format'] == '') {
+ // If the country does not have a phone number format, the number will be displayed
+ // as "+prefix ## ## ## ##...".
+ $format['format'] = '+p';
+ }
+
+ /* Formats the phone number according t the template with these rules:
+ * - p is replaced by the international prefix,
+ * - # is replaced by one digit,
+ * - other chars are left intact.
+ * If the number is longer than the format, remaining digits are
+ * appended by blocks of two digits separated by spaces.
+ * The last block can have 3 digits to avoid a final single-digit block.
+ */
+ $j = 0;
+ $i = strlen($format['phoneprf']);
+ $lengthFormat = strlen($format['format']);
+ while (($i < $telLength) && ($j < $lengthFormat)) {
+ if ($format['format'][$j] == '#') {
+ $ret .= $tel[$i];
+ ++$i;
+ } else if ($format['format'][$j] == 'p') {
+ $ret .= $format['phoneprf'];
+ } else {
+ $ret .= $format['format'][$j];
+ }
+ ++$j;
+ }
+ for (; $i < $telLength - 1; $i += 2) {
+ $ret .= ' ' . substr($tel, $i, 2);
+ }
+ // Appends last left alone numbers to the last block.
+ if ($i < $telLength) {
+ $ret .= substr($tel, $i);
+ }
+ $this->display = $ret;
+ }
+
+
+ public function format($format = array())
+ {
+ if (!($this->type == Phone::TYPE_FIXED
+ || $this->type == Phone::TYPE_MOBILE
+ || $this->type == Phone::TYPE_FAX)) {
+ $this->type = Phone::TYPE_FIXED;
+ }
+ $this->formatSearch();
+ $this->formatDisplay($format);
+ return !$this->error;
+ }
+
+ public function toFormArray()
+ {
+ return array(
+ 'type' => $this->type,
+ 'display' => $this->display,
+ 'pub' => $this->pub,
+ 'comment' => $this->comment,
+ 'error' => $this->error
+ );
+ }
+
+ private function toString()
+ {
+ return 'type : ' . $this->type .', numéro : ' . $this->display
+ . ', commentaire : « ' . $this->comment . ' », affichage : ' . $this->pub;
+ }
+
+ private function isEmpty()
+ {
+ return (!$this->search || $this->search == '');
+ }
+
+ public function save()
+ {
+ $this->format();
+ if (!$this->isEmpty()) {
+ XDB::execute('INSERT INTO profile_phones (pid, link_type, link_id, tel_id, tel_type,
+ search_tel, display_tel, pub, comment)
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
+ $this->pid, $this->link_type, $this->link_id, $this->id, $this->type,
+ $this->search, $this->display, $this->pub, $this->comment);
+ }
+ }
+
+ static public function deletePhones($pid, $link_type, $link_id = null)
+ {
+ $where = '';
+ if (!is_null($link_id)) {
+ $where = XDB::format(' AND link_id = {?}', $link_id);
+ }
+ XDB::execute('DELETE FROM profile_phones
+ WHERE pid = {?} AND link_type = {?}' . $where,
+ $pid, $link_type);
+ }
+
+ /** Saves phones into the database.
+ * @param $data: an array of form formatted phones.
+ * @param $pid, $link_type, $link_id: pid, link_type and link_id concerned by the update.
+ */
+ static public function savePhones(array $data, $pid, $link_type, $link_id = null)
+ {
+ foreach ($data as $id => $value) {
+ $value['id'] = $id;
+ if (!is_null($pid)) {
+ $value['pid'] = $pid ;
+ }
+ if (!is_null($link_type)) {
+ $value['link_type'] = $link_type ;
+ }
+ if (!is_null($link_id)) {
+ $value['link_id'] = $link_id ;
+ }
+ $phone = new Phone($value);
+ $phone->save();
+ }
+ }
+
+ static private function formArrayWalk(array $data, $function, &$success = true, $requiresEmptyPhone = false)
+ {
+ $phones = array();
+ foreach ($data as $item) {
+ $phone = new Phone($item);
+ $success = ($phone->format() && $success);
+ if (!$phone->isEmpty()) {
+ $phones[] = call_user_func(array($phone, $function));
+ }
+ }
+ if (count($phones) == 0 && $requiresEmptyPhone) {
+ $phone = new Phone();
+ $phones[] = call_user_func(array($phone, $function));
+ }
+ return $phones;
+ }
+
+ // Formats an array of form phones into an array of form formatted phones.
+ static public function formatFormArray(array $data, &$success = true)
+ {
+ return self::formArrayWalk($data, 'toFormArray', $success, true);
+ }
+
+ static public function formArrayToString(array $data)
+ {
+ return implode(' ; ', self::formArrayWalk($data, 'toString'));
+ }
+
+ static public function iterate(array $pids = array(), array $link_types = array(),
+ array $link_ids = array(), array $pubs = array())
+ {
+ return new PhoneIterator($pids, $link_types, $link_ids, $pubs);
+ }
+}
+
+/** Iterator over a set of Phones
+ *
+ * @param $pid, $link_type, $link_id, $pub
+ *
+ * The iterator contains the phones that correspond to the value stored in the
+ * parameters' arrays.
+ */
+class PhoneIterator implements PlIterator
+{
+ private $dbiter;
+
+ public function __construct(array $pids, array $link_types, array $link_ids, array $pubs)
+ {
+ $where = array();
+ if (count($pids) != 0) {
+ $where[] = XDB::format('(pid IN {?})', $pids);
+ }
+ if (count($link_types) != 0) {
+ $where[] = XDB::format('(link_type IN {?})', $link_types);
+ }
+ if (count($link_ids) != 0) {
+ $where[] = XDB::format('(link_id IN {?})', $link_ids);
+ }
+ if (count($pubs) != 0) {
+ $where[] = XDB::format('(pub IN {?})', $pubs);
+ }
+ $sql = 'SELECT search_tel AS search, display_tel AS display, comment, link_id,
+ tel_type AS type, link_type, tel_id AS id, pid, pub
+ FROM profile_phones
+ WHERE ' . implode(' AND ', $where) . '
+ ORDER BY link_id, tel_id';
+ $this->dbiter = XDB::iterator($sql);
+ }
+
+ public function next()
+ {
+ if (is_null($this->dbiter)) {
+ return null;
+ }
+ $data = $this->dbiter->next();
+ if (is_null($data)) {
+ return null;
+ }
+ return new Phone($data);
+ }
+
+ public function total()
+ {
+ return $this->dbiter->total();
+ }
+
+ public function first()
+ {
+ return $this->dbiter->first();
+ }
+
+ public function last()
+ {
+ return $this->dbiter->last();
+ }
+
+ public function value()
+ {
+ return $this->dbiter;
+ }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
return $this->owner;
}
+ public function isActive()
+ {
+ if ($this->owner()) {
+ return $this->owner->isActive();
+ }
+ return false;
+ }
+
public function promo()
{
return $this->promo;
public function nationalities()
{
$nats = array();
+ $countries = DirEnum::getOptions(DirEnum::COUNTRIES);
if ($this->nationality1) {
- $nats[] = $this->nationality1;
+ $nats[$this->nationality1] = $countries[$this->nationality1];
}
if ($this->nationality2) {
- $nats[] = $this->nationality2;
+ $nats[$this->nationality2] = $countries[$this->nationality2];
}
if ($this->nationality3) {
- $nats[] = $this->nationality3;
+ $nats[$this->nationality3] = $countries[$this->nationality3];
}
return $nats;
}
IF( {?}, pn_n.name, NULL) AS nickname,
IF(pn_uf.name IS NULL, pn_f.name, pn_uf.name) AS firstname_ordinary,
IF(pn_ul.name IS NULL, pn_l.name, pn_ul.name) AS lastname_ordinary,
- pd.yourself, pd.promo, pd.short_name, pd.directory_name AS full_name,
- pd.directory_name, IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
+ pd.yourself, pd.promo, pd.short_name, pd.public_name AS full_name,
+ pd.directory_name, pd.public_name, pd.private_name,
+ IF(pp.pub IN {?}, pp.display_tel, NULL) AS mobile,
(ph.pub IN {?} AND ph.attach IS NOT NULL) AS has_photo,
ph.x AS photo_width, ph.y AS photo_height,
p.last_change < DATE_SUB(NOW(), INTERVAL 365 DAY) AS is_old,
|| $name == self::DN_SHORT || $name == self::DN_SORT;
}
+ /** Returns the closest "accounts only" name type for $name
+ */
+ public static function getAccountEquivalentName($name)
+ {
+ switch ($name)
+ {
+ case self::DN_DIRECTORY:
+ case self::DN_SORT:
+ return 'directory_name';
+ case self::DN_FULL:
+ case self::DN_PUBLIC:
+ return 'full_name';
+ case self::DN_PRIVATE:
+ case self::DN_SHORT:
+ case self::DN_YOURSELF:
+ default:
+ return 'display_name';
+ }
+ }
+
public static function getNameTypeId($type, $for_sql = false)
{
if (!S::has('name_types')) {
/** The school identifier consists of 6 digits. The first 3 represent the
* promotion entry year. The last 3 indicate the student's rank.
- *
+ *
* Our identifier consists of 8 digits and both half have the same role.
* This enables us to deal with bigger promotions and with a wider range
* of promotions.
return $res->fetchOneCell();
}
- /** TODO: implements this by inspecting the profile.
if (preg_match('/^(.*)\.([0-9]{4})$/u', $mbox, $matches)) {
$res = XDB::query('SELECT a.uid
- FROM accounts AS a
- INNER JOIN aliases AS al ON (al.id = a.uid AND al.type IN ('alias', 'a_vie'))
- WHERE al.alias = {?} AND a.promo = {?}', $matches[1], $matches[2]);
+ FROM accounts AS a
+ INNER JOIN aliases AS al ON (al.uid = a.uid AND al.type IN (\'alias\', \'a_vie\'))
+ INNER JOIN account_profiles AS ap ON (a.uid = ap.uid AND FIND_IN_SET(\'owner\', ap.perms))
+ INNER JOIN profiles AS p ON (p.pid = ap.pid)
+ INNER JOIN profile_education AS pe ON (p.pid = pe.pid AND FIND_IN_SET(\'primary\', pe.flags))
+ WHERE p.hrpid = {?} OR ((pe.entry_year <= {?} AND pe.grad_year >= {?}) AND al.alias = {?})
+ GROUP BY a.uid',
+ $matches[0], $matches[2], $matches[2], $matches[1]);
if ($res->numRows() == 1) {
return $res->fetchOneCell();
}
- }*/
+ }
throw new UserNotFoundException();
}
$uids = array_map(array('XDB', 'escape'), $uids);
return XDB::iterator('SELECT a.uid, a.hruid, a.registration_date, ah.alias AS homonym,
- IF (af.alias IS NULL, a.email, CONCAT(af.alias, \'@' . $globals->mail->domain . '\')) AS forlife,
- CONCAT(af.alias, \'@' . $globals->mail->domain2 . '\') AS forlife_alternate,
- IF (ab.alias IS NULL, a.email, CONCAT(ab.alias, \'@' . $globals->mail->domain . '\')) AS bestalias,
- CONCAT(ab.alias, \'@' . $globals->mail->domain2 . '\') AS bestalias_alternate,
- a.full_name, a.display_name, a.sex = \'female\' AS gender,
- IF(a.state = \'active\', at.perms, \'\') AS perms,
- a.email_format, a.is_admin, a.state, a.type, a.skin,
+ IF (af.alias IS NULL, NULL, CONCAT(af.alias, \'@' . $globals->mail->domain . '\')) AS forlife,
+ IF (af.alias IS NULL, NULL, CONCAT(af.alias, \'@' . $globals->mail->domain2 . '\')) AS forlife_alternate,
+ IF (ab.alias IS NULL, NULL, CONCAT(ab.alias, \'@' . $globals->mail->domain . '\')) AS bestalias,
+ IF (ab.alias IS NULL, NULL, CONCAT(ab.alias, \'@' . $globals->mail->domain2 . '\')) AS bestalias_alternate,
+ a.email, a.full_name, a.directory_name, a.display_name, a.sex = \'female\' AS gender,
+ IF(a.state = \'active\', CONCAT(at.perms, \',\', IF(a.user_perms IS NULL, \'\', a.user_perms)), \'\') AS perms,
+ a.user_perms, a.email_format, a.is_admin, a.state, a.type, a.skin,
FIND_IN_SET(\'watch\', a.flags) AS watch, a.comment,
- a.weak_password IS NOT NULL AS weak_access,
- a.token IS NOT NULL AS token_access,
- (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost
+ a.weak_password IS NOT NULL AS weak_access, g.g_account_name IS NOT NULL AS googleapps,
+ a.token IS NOT NULL AS token_access, a.token, a.last_version,
+ (e.email IS NULL AND NOT FIND_IN_SET(\'googleapps\', eo.storage)) AND a.state != \'pending\' AS lost,
+ UNIX_TIMESTAMP(s.start) AS lastlogin, s.host, UNIX_TIMESTAMP(fp.last_seen) AS banana_last
' . $fields . '
FROM accounts AS a
INNER JOIN account_types AS at ON (at.type = a.type)
LEFT JOIN aliases AS ah ON (ah.uid = a.uid AND ah.type = \'homonyme\')
LEFT JOIN emails AS e ON (e.uid = a.uid AND e.flags = \'active\')
LEFT JOIN email_options AS eo ON (eo.uid = a.uid)
+ LEFT JOIN gapps_accounts AS g ON (a.uid = g.l_userid AND g.g_status = \'active\')
+ LEFT JOIN log_last_sessions AS ls ON (ls.uid = a.uid)
+ LEFT JOIN log_sessions AS s ON (s.id = ls.id)
+ LEFT JOIN forum_profiles AS fp ON (fp.uid = a.uid)
' . $joins . '
WHERE a.uid IN (' . implode(', ', $uids) . ')
GROUP BY a.uid
$this->fillFromArray(self::loadMainFieldsFromUIDs(array($this->uid))->next());
}
- // Specialization of the fillFromArray method, to implement hacks to enable
- // lazy loading of user's main properties from the session.
- // TODO(vzanotti): remove the conversion hacks once the old codebase will
- // stop being used actively.
- protected function fillFromArray(array $values)
- {
- // Also, if display_name and full_name are not known, but the user's
- // surname and last name are, we can construct the former two.
- if (isset($values['prenom']) && isset($values['nom'])) {
- if (!isset($values['display_name'])) {
- $values['display_name'] = ($values['prenom'] ? $values['prenom'] : $values['nom']);
- }
- if (!isset($values['full_name'])) {
- $values['full_name'] = $values['prenom'] . ' ' . $values['nom'];
- }
- }
-
- // We also need to convert the gender (usually named "femme"), and the
- // email format parameter (valued "texte" instead of "text").
- if (isset($values['femme'])) {
- $values['gender'] = (bool) $values['femme'];
- }
- if (isset($values['mail_fmt'])) {
- $values['email_format'] = $values['mail_fmt'];
- }
-
- parent::fillFromArray($values);
- }
-
// Specialization of the buildPerms method
// This function build 'generic' permissions for the user. It does not take
// into account page specific permissions (e.g X.net group permissions)
WHERE a.uid = {?}', $this->id());
}
+ public function isActive()
+ {
+ return $this->state == 'active';
+ }
+
/** Overload PlUser::promo(): there no promo defined for a user in the current
* schema. The promo is a field from the profile.
*/
return $this->profile()->lastName();
}
+ public function displayName()
+ {
+ if (!$this->hasProfile()) {
+ return $this->display_name;
+ }
+ return $this->profile()->yourself;
+ }
+
+ public function fullName($with_promo = false)
+ {
+ if (!$this->hasProfile()) {
+ return $this->full_name;
+ }
+ return $this->profile()->fullName($with_promo);
+ }
+
+ public function directoryName()
+ {
+ if (!$this->hasProfile()) {
+ return $this->directory_name;
+ }
+ return $this->profile()->directory_name;
+ }
+
/** Return the main profile attached with this account if any.
*/
- public function profile()
+ public function profile($forceFetch = false)
{
- if (!$this->_profile_fetched) {
+ if (!$this->_profile_fetched || $forceFetch) {
$this->_profile_fetched = true;
$this->_profile = Profile::get($this);
}
*/
private function fetchMarketingData()
{
- if (isset($this->last_known_email)) {
+ if (isset($this->pending_registration_date)) {
return;
}
- // FIXME: We should fetch the last known email as well as the pending registration email (they aren't the same !)
- $infos = XDB::fetchOneAssoc('SELECT IF (MAX(m.last) > p.relance, MAX(m.last), p.relance) AS last_relance,
- p.email AS last_known_email
- FROM register_pending AS p
- LEFT JOIN register_marketing AS m ON (p.uid = m.uid)
- WHERE p.uid = {?}
- GROUP BY p.uid', $this->id());
- if (!$infos) {
- $infos = array('last_relance' => null, 'last_known_email' => null);
+ $infos = XDB::fetchOneAssoc('SELECT rp.date AS pending_registration_date, rp.email AS pending_registration_email,
+ rm.last AS last_marketing_date, rm.email AS last_marketing_email
+ FROM accounts AS a
+ LEFT JOIN register_pending AS rp ON (rp.uid = a.uid)
+ LEFT JOIN register_marketing AS rm ON (rm.uid = a.uid AND rm.last != \'0000-00-00\')
+ WHERE a.uid = {?}
+ ORDER BY rm.last DESC', $this->id());
+ if (is_null($infos)) {
+ $infos = array(
+ 'pending_registration_date' => null,
+ 'pending_registration_email' => null,
+ 'last_marketing_date' => null,
+ 'last_marketing_email' => null
+ );
}
$this->fillFromArray($infos);
}
- public function lastMarketingRelance()
+ public function pendingRegistrationDate()
+ {
+ $this->fetchMarketingData();
+ return $this->pending_registration_date;
+ }
+
+ public function pendingRegistrationEmail()
+ {
+ $this->fetchMarketingData();
+ return $this->pending_registration_email;
+ }
+
+ public function lastMarketingDate()
+ {
+ $this->fetchMarketingData();
+ return $this->last_marketing_date;
+ }
+
+ public function lastMarketingEmail()
{
$this->fetchMarketingData();
- return $this->last_relance;
+ return $this->last_marketing_email;
}
public function lastKnownEmail()
{
$this->fetchMarketingData();
- return $this->last_known_email;
+ if ($this->pending_registration_email > $this->last_marketing_date) {
+ return $this->pending_registration_email;
+ }
+ return $this->last_marketing_email;
}
$this->email_format = $format;
}
-
/** Get watch informations
*/
private function fetchWatchData()
}
$mmlist = new MMList($this);
- $mmlist->kill($alias, $clearAll);
+ $mmlist->kill($this->hruid, $clearAll);
}
// Merge all infos in other user and then clean this one
public function mergeIn(User &$newuser) {
- if ($this->profile() || !$newuser->id()) {
- // don't disable user with profile in this way
+ if ($this->profile()) {
+ // Don't disable user with profile in this way.
+ global $globals;
+ Platal::page()->trigError('Impossible de fusionner les comptes ' . $this->hruid . ' et ' . $newuser->hruid .
+ '. Contacte support@' . $globals->mail->domain . '.');
return false;
}
- // TODO check all tables to see if there is no other info to use
- $newemail = $newuser->forlifeEmail();
- if (!$newemail && $this->forlifeEmail()) {
- XDB::execute("UPDATE accounts
- SET email = {?}
- WHERE uid = {?} AND email IS NULL",
- $this->forlifeEmail(), $newuser->id());
- $newemail = $this->forlifeEmail();
- }
-
- // change email used in aliases and mailing lists
- if ($this->forlifeEmail() != $newemail && $this->forlifeEmail()) {
- // virtual_redirect (email aliases)
- XDB::execute("DELETE v1
- FROM virtual_redirect AS v1, virtual_redirect AS v2
- WHERE v1.vid = v2.vid AND v1.redirect = {?} AND v2.redirect = {?}",
- $this->forlifeEmail(), $newemail);
- XDB::execute("UPDATE virtual_redirect
- SET redirect = {?}
- WHERE redirect = {?}",
- $newemail, $this->forlifeEmail());
-
- // require_once 'mmlist.php';
-
- // group mailing lists
- $group_domains = XDB::fetchColumn("SELECT g.mail_domain
- FROM groups AS g
- INNER JOIN group_members AS gm ON(g.id = gm.asso_id)
- WHERE g.mail_domain != '' AND gm.uid = {?}",
- $this->id());
- foreach ($group_domains as $mail_domain) {
- $mmlist = new MMList($this, $mail_domain);
- $mmlist->replace_email_in_all($this->forlifeEmail(), $newmail);
+ if ($this->forlifeEmail()) {
+ // If the new user is not registered and does not have already an email address,
+ // we need to give him the old user's email address if he has any.
+ if (!$newuser->perms) {
+ XDB::execute('UPDATE accounts
+ SET email = {?}
+ WHERE uid = {?} AND email IS NULL',
+ $this->forlifeEmail(), $newuser->id());
}
- // main domain lists
- $mmlist = new MMList($this);
- $mmlist->replace_email_in_all($this->forlifeEmail(), $newmail);
- }
-
- // group_members (xnet group membership)
- XDB::execute("DELETE g1
- FROM group_members AS g1, group_members AS g2
- WHERE g1.uid = {?} AND g2.uid = {?} AND g1.asso_id = g2.asso_id",
- $this->id(), $newuser->id());
- XDB::execute("UPDATE group_members
- SET uid = {?}
- WHERE uid = {?}",
- $this->id(), $newuser->id());
+ $newemail = XDB::fetchOneCell('SELECT email
+ FROM accounts
+ WHERE uid = {?}',
+ $newuser->id());
+
+ // Change email used in aliases and mailing lists.
+ if ($this->forlifeEmail() != $newemail) {
+ // virtual_redirect (email aliases)
+ XDB::execute('DELETE v1
+ FROM virtual_redirect AS v1, virtual_redirect AS v2
+ WHERE v1.vid = v2.vid AND v1.redirect = {?} AND v2.redirect = {?}',
+ $this->forlifeEmail(), $newemail);
+ XDB::execute('UPDATE virtual_redirect
+ SET redirect = {?}
+ WHERE redirect = {?}',
+ $newemail, $this->forlifeEmail());
+
+ // group mailing lists
+ $group_domains = XDB::fetchColumn('SELECT g.mail_domain
+ FROM groups AS g
+ INNER JOIN group_members AS gm ON(g.id = gm.asso_id)
+ WHERE g.mail_domain != \'\' AND gm.uid = {?}',
+ $this->id());
+ foreach ($group_domains as $mail_domain) {
+ $mmlist = new MMList($this, $mail_domain);
+ $mmlist->replace_email_in_all($this->forlifeEmail(), $newemail);
+ }
+ // main domain lists
+ $mmlist = new MMList($this);
+ $mmlist->replace_email_in_all($this->forlifeEmail(), $newemail);
+ }
+ }
- XDB::execute("DELETE FROM accounts WHERE uid = {?}", $this->id());
+ // Updates user in following tables.
+ foreach (array('group_announces', 'payment_transactions', 'log_sessions') as $table) {
+ XDB::execute('UPDATE ' . $table . '
+ SET uid = {?}
+ WHERE uid = {?}',
+ $newuser->id(), $this->id());
+ }
+ XDB::execute('UPDATE group_events
+ SET organisateur_uid = {?}
+ WHERE organisateur_uid = {?}',
+ $newuser->id(), $this->id());
+
+ // Merges user in following tables, ie updates when possible, then deletes remaining occurences of the old user.
+ foreach (array('group_announces_read', 'group_event_participants', 'group_member_sub_requests', 'group_members') as $table) {
+ XDB::execute('UPDATE IGNORE ' . $table . '
+ SET uid = {?}
+ WHERE uid = {?}',
+ $newuser->id(), $this->id());
+ XDB::execute('DELETE FROM ' . $table . '
+ WHERE uid = {?}',
+ $this->id());
+ }
+
+ // Eventually updates last session id and deletes old user's accounts entry.
+ $lastSession = XDB::fetchOneCell('SELECT id
+ FROM log_sessions
+ WHERE uid = {?}
+ ORDER BY start DESC
+ LIMIT 1',
+ $newuser->id());
+ XDB::execute('UPDATE log_last_sessions
+ SET id = {?}
+ WHERE uid = {?}',
+ $newuser->id());
+ XDB::execute('DELETE FROM accounts
+ WHERE uid = {?}',
+ $this->id());
return true;
}
if ($is_admin) {
$flags->addFlag(PERMS_ADMIN);
}
+
+ // Access to private directory implies access to 'less'-private version.
+ if ($flags->hasFlag('directory_private')) {
+ $flags->addFlag('directory_ax');
+ }
return $flags;
}
public function buildCondition(PlFilter &$uf)
{
$sub = $uf->addJobCompanyFilter();
- $cond = $sub . '.' . $this->type . ' = ' . XDB::format('{?}', $this->value);
+ $cond = $sub . '.' . $this->type . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->value);
return $cond;
}
}
public function __construct($number, $num_type = self::NUM_ANY, $phone_type = self::PHONE_ANY)
{
- require_once('profil.func.inc.php');
- $this->number = $number;
+ $phone = new Phone(array('display' => $number));
+ $phone->format();
+ $this->number = $phone->search();
$this->num_type = $num_type;
- $this->phone_type = format_phone_number($phone_type);
+ $this->phone_type = $phone_type;
}
public function buildCondition(PlFilter &$uf)
{
if (Profile::isDisplayName($this->type)) {
$sub = $uf->addDisplayFilter();
- return 'pd' . $sub . '.' . $this->type;
+ $token = 'pd' . $sub . '.' . $this->type;
+ if ($uf->accountsRequired()) {
+ $account_token = Profile::getAccountEquivalentName($this->type);
+ return 'IFNULL(' . $token . ', a.' . $account_token . ')';
+ } else {
+ return $token;
+ }
} else {
$sub = $uf->addNameFilter($this->type, $this->variant);
if ($this->particle) {
* when referring to the joined table.
*
* For example, if data from profile_job must be available to filter results,
- * the UFC object will call $uf-addJobFilter(), which will set the 'with_pj' var and
+ * the UFC object will call $uf-addJobFilter(), which will set the 'with_pj' var and
* return 'pj', the short name to use when referring to profile_job; when building
* the query, calling the jobJoins function will return an array containing a single
* row:
$this->with_accounts = true;
}
+ public function accountsRequired()
+ {
+ return $this->with_accounts;
+ }
+
public function requireProfiles()
{
$this->with_profiles = true;
}
+ public function profilesRequired()
+ {
+ return $this->with_profiles;
+ }
+
protected function accountJoins()
{
$joins = array();
if (!is_array($key)) {
$key = array($key);
}
- $joins['e' . $sub] = PlSqlJoin::left('emails', '$ME.uid = $UID AND $ME.flags != \'filter\'
+ $joins['e' . $sub] = PlSqlJoin::left('emails', '$ME.uid = $UID AND $ME.flags != \'filter\'
AND $ME.email IN {?}', $key);
}
}
if (!is_array($key)) {
$key = array($key);
}
- $joins['al' . $sub] = PlSqlJoin::left('aliases', '$ME.uid = $UID AND $ME.type IN (\'alias\', \'a_vie\')
+ $joins['al' . $sub] = PlSqlJoin::left('aliases', '$ME.uid = $UID AND $ME.type IN (\'alias\', \'a_vie\')
AND $ME.alias IN {?}', $key);
}
}
{
if (!$this->nomenu) {
$this->useMenu();
+ } else {
+ $this->assign('menu', false);
}
$this->_run('xnet/skin.tpl');
}
protected function startSessionAs($user, $level)
{
+ // The user must have 'groups' permission to access X.net
+ if (!$user->checkPerms('groups')) {
+ return false;
+ }
if ($level == AUTH_SUID) {
S::set('auth', AUTH_MDP);
}
- $res = XDB::query("SELECT a.uid, a.hruid, a.display_name, a.full_name,
- a.sex = 'female' AS femme,
- a.email_format, a.token,
- at.perms, a.is_admin
- FROM accounts AS a
- INNER JOIN account_types AS at ON (at.type = a.type)
- WHERE a.uid = {?} AND a.state = 'active'
- LIMIT 1", $user->id());
- $sess = $res->fetchOneAssoc();
- $_SESSION = array_merge($_SESSION, $sess);
- $this->makePerms(S::s('perms'), S::b('is_admin'));
+
+ S::set('uid', $user->uid);
+ S::set('hruid', $user->hruid);
+
+ // XXX: Transition code, should not be in session anymore
+ S::set('display_name', $user->display_name);
+ S::set('full_name', $user->full_name);
+ S::set('femme', $user->isFemale());
+ S::set('email_format', $user->email_format);
+ S::set('token', $user->token);
+ S::set('perms', $user->perms);
+ S::set('is_admin', $user->is_admin);
+
+
+ $this->makePerms($user->perms, $user->is_admin);
S::kill('challenge');
S::kill('loginX');
S::kill('may_update');
if (!$this->startSUID($user)) {
return false;
}
- S::set('perms', User::makePerms('user'));
+ S::set('perms', User::makePerms(PERMS_USER));
return true;
}
$login);
if (list($uid, $password) = $res->fetchOneRow()) {
$expected_response = sha1("$uname:$password:" . S::v('challenge'));
- /* XXX: Deprecates len(password) > 10 conversion */
+ /* Deprecates len(password) > 10 conversion. */
if ($response != $expected_response) {
if (!S::logged()) {
Platal::page()->trigError('Mot de passe ou nom d\'utilisateur invalide');
S::set('auth', AUTH_MDP);
}
- // Retrieves main user properties.
- /** TODO: Move needed informations to account tables */
- /** TODO: Currently suppressed data are matricule, promo */
- /** TODO: Use the User object to fetch all this */
- $res = XDB::query("SELECT a.uid, a.hruid, a.display_name, a.full_name,
- a.sex = 'female' AS femme, a.email_format,
- a.token, FIND_IN_SET('watch', a.flags) AS watch_account,
- UNIX_TIMESTAMP(fp.last_seen) AS banana_last,
- a.last_version, g.g_account_name IS NOT NULL AS googleapps,
- UNIX_TIMESTAMP(s.start) AS lastlogin, s.host,
- a.is_admin, at.perms
- FROM accounts AS a
- INNER JOIN account_types AS at ON (a.type = at.type)
- LEFT JOIN watch AS w ON (w.uid = a.uid)
- LEFT JOIN forum_profiles AS fp ON (fp.uid = a.uid)
- LEFT JOIN gapps_accounts AS g ON (a.uid = g.l_userid AND g.g_status = 'active')
- LEFT JOIN log_last_sessions AS ls ON (ls.uid = a.uid)
- LEFT JOIN log_sessions AS s ON(s.id = ls.id)
- WHERE a.uid = {?} AND a.state = 'active'", $user->id());
- if ($res->numRows() != 1) {
- return false;
- }
-
- $sess = $res->fetchOneAssoc();
- $perms = $sess['perms'];
- unset($sess['perms']);
-
- // Loads the data into the real session.
- $_SESSION = array_merge($_SESSION, $sess);
+ // Loads uid and hruid into the session for developement conveniance.
+ $_SESSION = array_merge($_SESSION, array('uid' => $user->id(), 'hruid' => $user->hruid));
// Starts the session's logger, and sets up the permanent cookie.
if (S::suid()) {
}
// Finalizes the session setup.
- $this->makePerms($perms, S::b('is_admin'));
+ $this->makePerms($user->perms, $user->is_admin);
$this->securityChecks();
$this->setSkin();
$this->updateNbNotifs();
from="Webmaster Polytechnique.org" <web@polytechnique.org>
to=registration+watch@staff.m4x.org
replyto=registration+watch@staff.m4x.org
+
+[profile]
+from="Polytechnique.org" <validation_modification@polytechnique.org>
+cc="Polytechnique.org" <validation_modification@polytechnique.org>
+
0 2 * * * web cd $WD; ./notifs.birthday.php
0 4 * * 6 web cd $WD; ./notifs.send.php
+# profile modification notifications
+0 23 * * * web cd $WD; ./profile_modification.php
+
# validations
0 */3 * * * web cd $WD; ./cron_validations.php
function doChallengeResponse() {
var new_pass = hash_encrypt(document.forms.login.password.value);
-
+
str = document.forms.loginsub.username.value + ":" +
hash_encrypt(document.forms.login.password.value) + ":" +
document.forms.loginsub.challenge.value;
function() {
$(this).removeClass("ac_over");
}
- ).click(function(e) {
+ ).click(function(e) {
e.preventDefault();
e.stopPropagation();
selectItem(this)
};
function makeUrl(q) {
- var sep = options.url.indexOf('?') == -1 ? '?' : '&';
+ var sep = options.url.indexOf('?') == -1 ? '?' : '&';
var url = options.url + sep + "q=" + encodeURI(q);
for (var i in options.extraParams) {
url += "&" + i + "=" + encodeURI(options.extraParams[i]);
autoFill: false,
width: 0
}, $.fn.autocomplete.defaults, options);
-
+
options.width = parseInt(options.width, 10);
return this.each(function() {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-function EnCryptedResponse() {
- pw1 = document.forms.changepass.nouveau.value;
- pw2 = document.forms.changepass.nouveau2.value;
- if (pw1 != pw2) {
- alert ("\nErreur : les deux champs ne sont pas identiques !")
+function hashResponse(password1, password2, hasConfirmation) {
+ pw1 = $('[name=' + password1 + ']').val();
+
+ if (hasConfirmation) {
+ pw2 = $('[name=' + password2 + ']').val();
+ if (pw1 != pw2) {
+ alert("\nErreur : les deux champs ne sont pas identiques !");
return false;
- exit;
+ }
+ $('[name=' + password2 + ']').val('');
+ } else if (pw1 == '********') {
+ return true;
}
+
if (pw1.length < 6) {
- alert ("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !")
- return false;
- exit;
+ alert("\nErreur : le nouveau mot de passe doit faire au moins 6 caractères !");
+ return false;
+ }
+ if (!differentTypes(pw1)) {
+ alert ("\nErreur : le nouveau mot de passe doit comporter au moins deux types de caractères parmi les suivants : lettres minuscules, lettres majuscules, chiffres, caractères spéciaux.");
+ return false;
}
- str = hash_encrypt(document.forms.changepass.nouveau.value);
- document.forms.changepass2.response2.value = str;
-
- alert ("Le mot de passe que tu as rentré va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair.");
- document.forms.changepass2.submit();
+ alert("Le mot de passe que tu as rentré va être chiffré avant de nous parvenir par Internet ! Ainsi il ne circulera pas en clair.");
+ $('[name=' + password1 + ']').val('');
+ $('[name=pwhash]').val(hash_encrypt(pw1));
return true;
}
-function EncryptedResponseInNestedForm() {
- $('[name=nouveau]').val($('[name=password]').val());
- $('[name=nouveau2]').val($('[name=password2]').val());
- EnCryptedResponse();
-}
-
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
$('#' + id).find('div.titre').html('N°' + i);
$('#' + id).find('a.removeTel').attr('href', 'javascript:removeTel(\'' + prefname + '\',\'' + prefid + '\',' + telid + ')');
$('#' + id).find('select').attr('name', telpref + '[type]');
- $('#' + id).find("[name='" + telprefOld + "[tel]']").attr('name', telpref + '[tel]');
+ $('#' + id).find("[name='" + telprefOld + "[display]']").attr('name', telpref + '[display]');
$('#' + id).find("[name='" + telprefOld + "[comment]']").attr('name', telpref + '[comment]');
$('#' + id).find('a.removePhoneComment').attr('href', 'javascript:removePhoneComment(' + id + ',' + telpref + ')');
$('#' + id).find('#' + idOld + '_addComment').attr('id', id + '_addComment');
}
}
-function checkPassword(box, okLabel) {
+function differentTypes(password) {
var prev = 0;
+
+ for (i = 0 ; i < password.length ; ++i) {
+ var type = getType(password.charAt(i));
+ if (prev != 0 && prev != type) {
+ return true;
+ }
+ prev = type;
+ }
+ return false;
+}
+
+function passwordStrength(password) {
var prop = 0;
- var pass = box.value;
- var types = Array(0, 0, 0, 0, 0);
+ var prev = 0;
var firstType = true;
- for (i = 0 ; i < pass.length ; ++i) {
- type = getType(pass.charAt(i));
+ var types = Array(0, 0, 0, 0, 0);
+
+ for (i = 0 ; i < password.length ; ++i) {
+ var type = getType(password.charAt(i));
if (prev != 0 && prev != type) {
prop += 5;
+ firstType = false;
}
prop += i;
if (types[type] == 0 && !firstType) {
prop += 15;
- } else {
- firstType = false;
}
types[type]++;
prev = type;
}
- if (pass.length < 6) {
+ if (password.length < 6) {
+ prop *= 0.75;
+ }
+ if (firstType) {
prop *= 0.75;
}
if (prop > 100) {
} else if (prop < 0) {
prop = 0;
}
+
+ return prop;
+}
+
+function checkPassword(box, okLabel) {
+ var password = box.value;
+ var prop = passwordStrength(password);
+
if (prop >= 60) {
color = "#4f4";
bgcolor = "#050";
.parent().stop()
.animate({ backgroundColor: bgcolor }, 750);
var submitButton = $(":submit[name='" + passwordprompt_submit + "']");
- if (ok && pass.length >= 6) {
+ if (ok && password.length >= 6 && differentTypes(password)) {
submitButton.attr("value", okLabel);
submitButton.removeAttr("disabled");
} else {
$time = null;
if (!is_null($this->params) && isset($this->params['updateall'])) {
$time = intval($this->params['updateall']);
- S::set('banana_last', $time);
+ S::user()->banana_last = $time;
}
$infos = $this->fetchProfile();
Banana::$profile['signature'] = $infos['sig'];
Banana::$profile['display'] = $infos['threads'];
Banana::$profile['autoup'] = $infos['maj'];
- Banana::$profile['lastnews'] = S::v('banana_last');
+ Banana::$profile['lastnews'] = S::user()->banana_last;
Banana::$profile['subscribe'] = $req->fetchColumn();
Banana::$tree_unread = $infos['tree_unread'];
Banana::$tree_read = $infos['tree_read'];
} else {
$group = '';
}
- return '/rss/' . $group . S::v('hruid') . '/' . S::s('token') . '/rss.xml';
+ return '/rss/' . $group . S::v('hruid') . '/' . S::user()->token . '/rss.xml';
}
function hook_platalMessageLink($params)
function __construct(User &$user, $params = null)
{
- ini_set('memory_limit', '128M');
+ ini_set('memory_limit', '128M');
global $globals;
ModerationBanana::$client = $params['client'];
{
global $globals;
- if (is_null($user) && is_null($profile)) {
+ if (is_null($user)) {
$user = S::user();
- $profile = $user->profile();
+ }
+ if (is_null($profile)) {
+ /* Always refetch the profile. */
+ $profile = $user->profile(true);
}
$email_type = "directory";
// Maximum number of Geocoding calls to the Google Maps API.
const MAX_GMAPS_RPC_CALLS = 5;
+ // Maximum levenshtein distance authorized between input and geocoded text in a single line.
+ const MAX_LINE_DISTANCE = 5;
+ // Maximum levenshtein distance authorized between input and geocoded text in the whole text.
+ const MAX_TOTAL_DISTANCE = 6;
public function getGeocodedAddress(array $address) {
$address = $this->prepareAddress($address);
// cleans up the final informations.
private function getUpdatedAddress(array $address, array $geocodedData, $extraLines) {
$this->fillAddressWithGeocoding(&$address, $geocodedData);
-
- // If the accuracy is 6, it means only the street has been gecoded
- // but not the number, thus we need to fix it.
- if ($address['accuracy'] == 6) {
- $this->fixStreetNumber($address);
- }
-
- // We can now format the address.
$this->formatAddress($address, $extraLines);
-
return $address;
}
$countGeoloc = count($arrayGeoloc);
$countText = count($arrayText);
+ $totalDistance = 0;
if (($countText > $countGeoloc) || ($countText < $countGeoloc - 1)
|| (($countText == $countGeoloc - 1)
&& ($arrayText[$countText - 1] == strtoupper($address['country'])))) {
$same = false;
} else {
for ($i = 0; $i < $countGeoloc && $i < $countText; ++$i) {
- if (levenshtein($arrayText[$i], trim($arrayGeoloc[$i])) > 3) {
+ $lineDistance = levenshtein($arrayText[$i], trim($arrayGeoloc[$i]));
+ $totalDistance += $lineDistance;
+ if ($lineDistance > self::MAX_LINE_DISTANCE || $totalDistance > self::MAX_TOTAL_DISTANCE) {
$same = false;
+ break;
}
}
}
+
if ($same) {
- $address['text'] = $address['geoloc'];
- $address['postalText'] = $address['geocodedPostalText'];
unset($address['geoloc'], $address['geocodedPostalText']);
} else {
$address['geoloc'] = str_replace("\n", "\r\n", $address['geoloc']);
$address['text'] = str_replace("\n", "\r\n", $address['text']);
$address['postalText'] = str_replace("\n", "\r\n", $address['postalText']);
}
-
+
// Returns the address formated for postal use.
// The main rules are (cf AFNOR XPZ 10-011):
// -everything in upper case;
}
return $address['text'];
}
-
- // Search for the lign from the given address that is the closest to the geocoded thoroughfareName
- // and replaces the corresponding lign in the geocoded text by it.
- static protected function fixStreetNumber(&$address)
- {
- if (isset($address['thoroughfareName'])) {
- $thoroughfareName = $address['thoroughfareName'];
- $thoroughfareToken = strtoupper(trim(preg_replace(array("/[,\"'#~:;_\-]/", "/\r\n/"),
- array("", "\n"), $thoroughfareName)));
- $geolocLines = explode("\n", $address['geoloc']);
- $textLines = explode("\n", $address['text']);
- $mindist = strlen($thoroughfareToken);
- $minpos = 0;
- $pos = 0;
- foreach ($textLines as $i => $token) {
- if (($l = levenshtein(strtoupper(trim(preg_replace(array("/[,\"'#~:;_\-]/", "/\r\n/"),
- array("", "\n"), $token))),
- $thoroughfareToken)) < $mindist) {
- $mindist = $l;
- $minpos = $i;
- }
- }
- foreach ($geolocLines as $i => $line) {
- if (strtoupper(trim($thoroughfareName)) == strtoupper(trim($line))) {
- $pos = $i;
- break;
- }
- }
- $geolocLines[$pos] = $textLines[$minpos];
- $address['geoloc'] = implode("\n", $geolocLines);
- }
- }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
global $globals;
if ($from == 'staff' || !($user = User::getSilent($sender))) {
- return '"L\'équipe de Polytechnique.org" <register@' . $globals->mail->domain . '>';
+ return "\"L'équipe de Polytechnique.org\" <register@" . $globals->mail->domain . '>';
}
return '"' . $user->fullName() . '" <' . $user->bestEmail() . '>';
}
}
$sender = substr($this->sender_mail, 1, strpos($this->sender_mail, '"', 2)-1);
$text = str_replace(array('%%hash%%', '%%sender%%', '%%personal_notes%%'),
- array($this->hash, $this->sender_mail, ''), $text);
+ array($this->hash, "Cordialement,\n-- \n" . $this->sender_mail, ''), $text);
$mailer = new PlMailer();
$mailer->setFrom($this->sender_mail);
$mailer->addTo($this->user['mail']);
$this->engine->process($this->user);
if ($valid) {
require_once 'validations.inc.php';
- $valid = new MarkReq(User::getSilent($this->sender), $this->user['user'], $this->user['mail'],
+ $sender = User::getSilent($this->sender);
+ $valid = new MarkReq($sender, $this->user['user'], $this->user['mail'],
$this->from == 'user', $this->type, $this->data, $this->personal_notes);
$valid->submit();
}
}
}
- static public function getAliveUsersCount()
- {
- $uf = new UserFilter(new PFC_Not(new UFC_Dead()));
- return $uf->getTotalCount();
- }
-
static public function relance(PlUser &$user, $nbx = -1)
{
global $globals;
if ($nbx < 0) {
- $nbx = self::getAliveUsersCount();
+ $nbx = $globals->core->NbIns;
}
$res = XDB::fetchOneCell('SELECT r.date, r.email, r.bestalias
. "Pour y figurer, il te suffit de visiter cette page ou de copier cette adresse "
. "dans la barre de ton navigateur :";
if ($from === null) {
- $this->signature = "L'équipe de Polytechnique.org,\n"
- . "Le portail des élèves & anciens élèves de l'École polytechnique";
+ $page = new XorgPage();
+ $page->changeTpl('include/signature.mail.tpl', NO_SKIN);
+ $page->assign('mail_part', 'text');
+ $this->signature = $page->raw();
} else {
- $this->signature = "%%sender%%";
+ $this->signature = '%%sender%%';
}
if (is_null($personal_notes) || $personal_notes == '') {
$this->personal_notes = '%%personal_notes%%';
$page->assign('intro', $this->getIntro());
$page->assign('u', $user);
$page->assign('sign', $this->getSignature());
- $page->assign('num_users', Marketing::getAliveUsersCount());
$page->assign('personal_notes', $this->getPersonalNotes());
}
return $name;
}
-function set_profile_display(&$display_names, $pid)
+function set_profile_display(&$display_names, Profile $profile)
{
XDB::execute("UPDATE profile_display
SET public_name = {?}, private_name = {?},
WHERE pid = {?}",
$display_names['public_name'], $display_names['private_name'],
$display_names['directory_name'], $display_names['short_name'],
- $display_names['sort_name'], $pid);
+ $display_names['sort_name'], $profile->id());
- /* XXX: Inefficient, should directly take the profile as parameter */
- $profile = Profile::get($pid);
$owner = $profile->owner();
if ($owner) {
XDB::execute('UPDATE accounts
- SET full_name = {?}
+ SET full_name = {?}, directory_name = {?}
WHERE uid = {?}',
- $display_names['public_name'], $owner->id());
+ $display_names['public_name'], $display_names['directory_name'], $owner->id());
}
}
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2010 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 replace_ifset(&$var,$req) {
- if (Env::has($req)){
- $var = Env::v($req);
- }
-}
-
-function replace_ifset_i(&$var,$req,$i) {
- if (isset($_REQUEST[$req][$i])){
- $var[$i] = $_REQUEST[$req][$i];
- }
-}
-
-function replace_ifset_i_j(&$var,$req,$i,$j) {
- if (isset($_REQUEST[$req][$j])){
- $var[$i] = $_REQUEST[$req][$j];
- }
-}
-
-//pour rentrer qqchose dans la base
-function put_in_db($string){
- return trim($string);
-}
-
-// example of use for diff_user_details : get $b from database, $a from other site
-// calculate diff $c and add $c in database (with set_user_details)
-function diff_user_details(&$a, &$b, $view = 'private') { // compute $c = $a - $b
-// if (!isset($b) || !$b || !is_array($b) || count($b) == 0)
-// return $a;
-// if (!isset($a) || !$a || !is_array($a))
-// $c = array();
-// else
- $c = $a;
- foreach ($b as $val => $bvar) {
- if (isset($a[$val])) {
- if ($a[$val] == $bvar)
- unset($c[$val]);
- else {
- switch ($val) {
- case 'adr' : if (!($c['adr'] = diff_user_addresses($a[$val], $bvar, $view))) unset($c['adr']); break;
- case 'adr_pro' : if (!($c['adr_pro'] = diff_user_pros($a[$val], $bvar, $view))) unset($c['adr_pro']); break;
- case 'tels' : if (!($c['tels'] = diff_user_tels($a[$val], $bvar, $view))) unset($c['tels']); break;
- }
- }
- }
- }
- // don't modify freetext if you don't have the right
- if (isset($b['freetext_pub']) && !has_user_right($b['freetext_pub'], $view) && isset($c['freetext']))
- unset($c['freetext']);
- if (!count($c))
- return false;
- return $c;
-}
-
-function same_tel(&$a, &$b) {
- $numbera = format_phone_number((string) $a);
- $numberb = format_phone_number((string) $b);
- return $numbera === $numberb;
-}
-function same_address(&$a, &$b) {
- return
- (same_field($a['adr1'],$b['adr1'])) &&
- (same_field($a['adr2'],$b['adr2'])) &&
- (same_field($a['adr3'],$b['adr3'])) &&
- (same_field($a['postcode'],$b['postcode'])) &&
- (same_field($a['city'],$b['city'])) &&
- (same_field($a['countrytxt'],$b['countrytxt'])) &&
- true;
-}
-function same_pro(&$a, &$b) {
- return
- (same_field($a['entreprise'],$b['entreprise'])) &&
- (same_field($a['fonction'],$b['fonction'])) &&
- true;
-}
-function same_field(&$a, &$b) {
- if ($a == $b) return true;
- if (is_array($a)) {
- if (!is_array($b) || count($a) != count($b)) return false;
- foreach ($a as $val => $avar)
- if (!isset($b[$val]) || !same_field($avar, $b[$val])) return false;
- return true;
- } elseif (is_string($a))
- return (mb_strtoupper($a) == mb_strtoupper($b));
-}
-function diff_user_tel(&$a, &$b) {
- $c = $a;
- if (isset($b['tel_pub']) && isset($a['tel_pub']) && has_user_right($b['tel_pub'], $a['tel_pub']))
- $c['tel_pub'] = $b['tel_pub'];
- foreach ($b as $val => $bvar) {
- if (isset($a[$val])) {
- if ($a[$val] == $bvar)
- unset($c[$val]);
- }
- }
- if (!count($c))
- return false;
- $c['telid'] = $a['telid'];
- return $c;
-}
-
-function diff_user_tels(&$a, &$b)
-{
- $c = $a;
- $telids_b = array();
- foreach ($b as $i => $telb) $telids_b[$telb['telid']] = $i;
-
- foreach ($a as $j => $tela) {
- if (isset($tela['telid'])) {
- // if b has a tel with the same telid, compute diff
- if (isset($telids_b[$tela['telid']])) {
- if (!($c[$j] = diff_user_tel($tela, $b[$telids_b[$tela['adrid']]]))) {
- unset($c[$j]);
- }
- unset($telids_b[$tela['telid']]);
- }
- } else {
- // try to find a match in b
- foreach ($b as $i => $telb) {
- if (same_tel($tela['tel'], $telb['tel'])) {
- $tela['telid'] = $telb['telid'];
- if (!($c[$j] = diff_user_tel($tela, $telb))) {
- unset($c[$j]);
- }
- unset($telids_b[$tela['telid']]);
- break;
- }
- }
- }
- }
-
- foreach ($telids_b as $telidb => $i)
- $c[] = array('telid' => $telidb, 'remove' => 1);
- return $c;
-}
-
-function diff_user_address($a, $b) {
- if (isset($b['pub']) && isset($a['pub']) && has_user_right($b['pub'], $a['pub']))
- $a['pub'] = $b['pub'];
- if (isset($b['tels'])) {
- if (isset($a['tels'])) {
- $avar = $a['tels'];
- } else {
- $avar = array();
- }
- $ctels = diff_user_tels($avar, $b['tels']);
-
- if (!count($ctels)) {
- $b['tels'] = $avar;
- } else {
- $a['tels'] = $ctels;
- }
- }
-
- foreach ($a as $val => $avar) {
- if (!isset($b[$val]) || !same_field($avar,$b[$val])) {
- return $a;
- }
- }
- return false;
-}
-
-// $b need to use adrids
-function diff_user_addresses(&$a, &$b) {
- $c = $a;
- $adrids_b = array();
- foreach ($b as $i => $adrb) $adrids_b[$adrb['adrid']] = $i;
-
- foreach ($a as $j => $adra) {
- if (isset($adra['adrid'])) {
- // if b has an address with the same adrid, compute diff
- if (isset($adrids_b[$adra['adrid']])) {
- if (!($c[$j] = diff_user_address($adra, $b[$adrids_b[$adra['adrid']]])))
- unset($c[$j]);
- unset($adrids_b[$adra['adrid']]);
- }
- } else {
- // try to find a match in b
- foreach ($b as $i => $adrb) {
- if (same_address($adra, $adrb)) {
- $adra['adrid'] = $adrb['adrid'];
- if (!($c[$j] = diff_user_address($adra, $adrb)))
- unset($c[$j]);
- if ($c[$j]) $c[$j]['adrid'] = $adra['adrid'];
- unset($adrids_b[$adra['adrid']]);
- break;
- }
- }
- }
- }
-
- foreach ($adrids_b as $adridb => $i)
- $c[] = array('adrid' => $adridb, 'remove' => 1);
-
- if (!count($c)) return false;
- return $c;
-}
-
-function diff_user_pro($a, &$b, $view = 'private') {
- if (isset($b['pub']) && isset($a['pub']) && has_user_right($b['pub'], $a['pub']))
- $a['pub'] = $b['pub'];
- if (isset($b['adr_pub']) && !has_user_right($b['adr_pub'], $view)) {
- unset($a['adr1']);
- unset($a['adr2']);
- unset($a['adr3']);
- unset($a['postcode']);
- unset($a['city']);
- unset($a['countrytxt']);
- unset($a['region']);
- }
- if (isset($b['adr_pub']) && isset($a['adr_pub']) && has_user_right($b['adr_pub'], $a['adr_pub']))
- $a['adr_pub'] = $b['adr_pub'];
- if (isset($b['tels'])) {
- if (isset($a['tels']))
- $avar = $a['tels'];
- else
- $avar = array();
- $ctels = diff_user_tels($avar, $b['tels']);
-
- if (!count($ctels)) {
- $b['tels'] = $avar;
- } else
- $a['tels'] = $ctels;
- }
- if (isset($b['email_pub']) && !has_user_right($b['email_pub'], $view))
- unset($a['email']);
- if (isset($b['email_pub']) && isset($a['email_pub']) && has_user_right($b['email_pub'], $a['email_pub']))
- $a['email_pub'] = $b['email_pub'];
- foreach ($a as $val => $avar) {
- if (($avar && !isset($b[$val])) || !same_field($avar,$b[$val])) {
- return $a;
- }
- }
- return false;
-}
-
-// $b need to use entrids
-function diff_user_pros(&$a, &$b, $view = 'private') {
- $c = $a;
- $entrids_b = array();
- foreach ($b as $i => $prob) $entrids_b[$prob['entrid']] = $i;
-
- foreach ($a as $j => $proa) {
- if (isset($proa['entrid'])) {
- // if b has an address with the same adrid, compute diff
- if (isset($entrids_b[$proa['entrid']])) {
- if (!($c[$j] = diff_user_pro($proa, $b[$entrids_b[$proa['entrid']]], $view)))
- unset($c[$j]);
- unset($entrids_b[$proa['entrid']]);
- }
- } else {
- // try to find a match in b
- foreach ($b as $i => $prob) {
- if (same_pro($proa, $prob)) {
- $proa['entrid'] = $prob['entrid'];
- if (!($c[$j] = diff_user_pro($proa, $prob, $view)))
- unset($c[$j]);
- if ($c[$j]) $c[$j]['entrid'] = $proa['entrid'];
- unset($entrids_b[$proa['entrid']]);
- break;
- }
- }
- }
- }
-
- foreach ($entrids_b as $entridb => $i)
- $c[] = array('entrid' => $entridb, 'remove' => 1);
-
- if (!count($c)) return false;
- return $c;
-}
-
-function format_phone_number($tel)
-{
- $tel = trim($tel);
- if (substr($tel, 0, 3) === '(0)') {
- $tel = '33' . $tel;
- }
- $tel = preg_replace('/\(0\)/', '', $tel);
- $tel = preg_replace('/[^0-9]/', '', $tel);
- if (substr($tel, 0, 2) === '00') {
- $tel = substr($tel, 2);
- } else if(substr($tel, 0, 1) === '0') {
- $tel = '33' . substr($tel, 1);
- }
- return $tel;
-}
-
-function format_display_number($tel, &$error, $format = array('format'=>'','phoneprf'=>''))
-{
- $error = false;
- $ret = '';
- $tel_length = strlen($tel);
- if((!isset($format['phoneprf'])) || ($format['phoneprf'] == '')) {
- $res = XDB::query("SELECT phonePrefix AS phoneprf, phoneFormat AS format
- FROM geoloc_countries
- WHERE phonePrefix = {?} OR phonePrefix = {?} OR phonePrefix = {?}
- LIMIT 1",
- substr($tel, 0, 1), substr($tel, 0, 2), substr($tel, 0, 3));
- if ($res->numRows() == 0) {
- $error = true;
- return '+' . $tel;
- }
- $format = $res->fetchOneAssoc();
- }
- if ($format['format'] == '') {
- $format['format'] = '+p';
- }
- $j = 0;
- $i = strlen($format['phoneprf']);
- $length_format = strlen($format['format']);
- while (($i < $tel_length) && ($j < $length_format)){
- if ($format['format'][$j] == '#'){
- $ret .= $tel[$i];
- $i++;
- } else if ($format['format'][$j] == 'p') {
- $ret .= $format['phoneprf'];
- } else {
- $ret .= $format['format'][$j];
- }
- $j++;
- }
- for (; $i < $tel_length - 1; $i += 2) {
- $ret .= ' ' . substr($tel, $i, 2);
- }
- //appends last alone number to the last block
- if ($i < $tel_length) {
- $ret .= substr($tel, $i);
- }
- return $ret;
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
* @param $pids An array of pids
* @param $visibility The level of visibility fetched fields must have
* @return a PlIterator yielding data suitable for a "new ProfileBlah($data)"
- * XXX MUST be reimplemented for each kind of ProfileField
+ *
+ * MUST be reimplemented for each kind of ProfileField.
*/
public static function fetchData(array $pids, ProfileVisibility $visibility)
{
}
// }}}
-// {{{ class Phone
-class Phone
-{
- const TYPE_FAX = 'fax';
- const TYPE_FIXED = 'fixed';
- const TYPE_MOBILE = 'mobile';
- public $type;
-
- public $search;
- public $display;
- public $comment = '';
-
- const LINK_JOB = 'pro';
- const LINK_ADDRESS = 'address';
- const LINK_PROFILE = 'user';
- const LINK_COMPANY = 'hq';
- public $link_type;
- public $link_id;
-
- public $id;
-
- /** Fields are :
- * $type, $search, $display, $link_type, $link_id, $comment, $pid, $id
- */
- public function __construct($data)
- {
- foreach ($data as $key => $val) {
- $this->$key = $val;
- }
- }
-
- /** Returns the unique ID of a phone
- * This ID will allow to link it to an address, a user or a job
- * The format is address_addressId_phoneId (where phoneId is the id
- * of the phone in the list of those associated with the address)
- */
- public function uid() {
- return $this->link_type . '_' . $this->link_id . '_' . $this->id;
- }
-
- public function hasFlags($flags) {
- return $this->hasType($flags) && $this->hasLink($flags);
- }
-
- /** Returns true if this phone's type matches the flags
- */
- public function hasType($flags) {
- $flags = $flags & Profile::PHONE_TYPE_ANY;
- return (
- ($flags == Profile::PHONE_TYPE_ANY)
- ||
- (($flags & Profile::PHONE_TYPE_FAX) && $this->type == self::TYPE_FAX)
- ||
- (($flags & Profile::PHONE_TYPE_FIXED) && $this->type == self::TYPE_FIXED)
- ||
- (($flags & Profile::PHONE_TYPE_MOBILE) && $this->type == self::TYPE_MOBILE)
- );
- }
-
- /** User accessible version of the type
- */
- public function displayType($short = false)
- {
- switch ($this->type) {
- case Phone::TYPE_FIXED:
- return $short ? 'Tél' : 'Fixe';
- case Phone::TYPE_FAX:
- return 'Fax';
- case Phone::TYPE_MOBILE:
- return $short ? 'Mob' : 'Mobile';
- default:
- return $this->type;
- }
- }
-
- /** Returns true if this phone's link matches the flags
- */
- public function hasLink($flags) {
- $flags = $flags & Profile::PHONE_LINK_ANY;
- return (
- ($flags == Profile::PHONE_LINK_ANY)
- ||
- (($flags & Profile::PHONE_LINK_COMPANY) && $this->link_type == self::LINK_COMPANY)
- ||
- (($flags & Profile::PHONE_LINK_JOB) && $this->link_type == self::LINK_JOB)
- ||
- (($flags & Profile::PHONE_LINK_ADDRESS) && $this->link_type == self::LINK_ADDRESS)
- ||
- (($flags & Profile::PHONE_LINK_PROFILE) && $this->link_type == self::LINK_PROFILE)
- );
- }
-}
-// }}}
// {{{ class Company
class Company
{
public function setPhone(Phone &$phone)
{
- if ($phone->link_type == Phone::LINK_COMPANY && $phone->link_id == $this->id) {
+ if ($phone->linkType() == Phone::LINK_COMPANY && $phone->linkId() == $this->id) {
$this->phone = $phone;
}
}
$this->$key = $val;
}
$this->company = CompanyList::get($this->jobid);
+ if (is_null($this->company)) {
+ require_once 'validations.inc.php';
+ $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise');
+ $this->company = new Company(array('name' => $entreprise[$this->id]->name));
+ }
}
public function phones()
public function addPhone(Phone &$phone)
{
- if ($phone->link_type == Phone::LINK_JOB && $phone->link_id == $this->id && $phone->pid == $this->pid) {
- $this->phones[$phone->uid()] = $phone;
+ if ($phone->linkType() == Phone::LINK_JOB && $phone->linkId() == $this->id && $phone->pid() == $this->pid) {
+ $this->phones[$phone->uniqueId()] = $phone;
}
}
public function addPhone(Phone &$phone)
{
if (
- $phone->link_type == Phone::LINK_ADDRESS && $phone->link_id == $this->id &&
- ($this->link_type == self::LINK_COMPANY || $phone->pid == $this->pid) ) {
- $this->phones[$phone->uid()] = $phone;
+ $phone->linkType() == Phone::LINK_ADDRESS && $phone->linkId() == $this->id &&
+ ($this->link_type == self::LINK_COMPANY || $phone->pid() == $this->pid) ) {
+ $this->phones[$phone->uniqueId()] = $phone;
}
}
* 3) attach addresses to jobs and profiles
*/
-// {{{ Database schema (profile_address, profile_phones, profile_jobs)
+// {{{ Database schema (profile_address, profile_jobs)
/** The database for this is very unclear, so here is a little schema :
* profile_job describes a Job, links to:
* - a Profile, through `pid`
* with that of the row of profile_job for the related job)
* - `id` is the id of the job to which we refer (i.e `profile_job.id`)
*
- * profile_phone describes a Phone, which can be related to an Address,
- * a Job, a Profile or a Company:
- * - for a Profile:
- * - `link_type` is set to 'user'
- * - `link_id` is set to 0
- * - `pid` is set to the id of the related Profile
- *
- * - for a Company:
- * - `link_type` is set to 'hq'
- * - `link_id` is set to the id of the related Company
- * - `pid` is set to 0
- *
- * - for an Address (this is only possible for a *personal* address)
- * - `link_type` is set to 'address'
- * - `link_id` is set to the related Address `id`
- * - `pid` is set to the related Address `pid`
- *
- * - for a Job:
- * - `link_type` is set to 'pro'
- * - `link_id` is set to the related Job `id` (not `jobid`)
- * - `pid` is set to the related Job `pid`
- *
+ * For the documentation of the phone table, please see classes/phone.php.
*
* The possible relations are as follow:
* An Address can be linked to a Company, a Profile, a Job
* A Job is linked to a Company and a Profile
- * A Phone can be linked to a Company, a Profile, a Job, or a Profile-related Address
*/
// }}}
{
$p = $phones->get(Profile::PHONE_LINK_ADDRESS | Profile::PHONE_TYPE_ANY);
foreach ($p as $phone) {
- if ($phone->link_type == Phone::LINK_ADDRESS && array_key_exists($phone->link_id, $this->addresses)) {
- $this->addresses[$phone->link_id]->addPhone($phone);
+ if ($phone->linkType() == Phone::LINK_ADDRESS && array_key_exists($phone->linkId(), $this->addresses)) {
+ $this->addresses[$phone->linkId()]->addPhone($phone);
}
}
}
public static function fetchData(array $pids, ProfileVisibility $visibility)
{
- $data = XDB::iterator('SELECT tel_type AS type, search_tel AS search, display_tel AS display, link_type, comment, pid, link_id, tel_id AS id
- FROM profile_phones
- WHERE pid IN {?} AND pub IN {?}
- ORDER BY ' . XDB::formatCustomOrder('pid', $pids),
- $pids, $visibility->levels());
- return PlIteratorUtils::subIterator($data, PlIteratorUtils::arrayValueCallback('pid'));
+ $it = Phone::iterate($pids, array(), array(), $visibility->levels());
+ return PlIteratorUtils::subIterator($it->value(), PlIteratorUtils::arrayValueCallback('pid'));
}
}
// }}}
{
$p = $phones->get(Profile::PHONE_LINK_JOB | Profile::PHONE_TYPE_ANY);
foreach ($p as $phone) {
- if ($phone->link_type == Phone::LINK_JOB && array_key_exists($phone->link_id, $this->jobs)) {
- $this->jobs[$phone->link_id]->addPhone($phone);
+ if ($phone->linkType() == Phone::LINK_JOB && array_key_exists($phone->linkId(), $this->jobs)) {
+ $this->jobs[$phone->linkId()]->addPhone($phone);
}
}
}
self::$companies[$row['id']] = $cp;
}
- // TODO: determine whether there can be phones attached to a hq's address
// Add phones to hq
if (count($newcompanies)) {
- $it = XDB::iterator('SELECT search_tel AS search, display_tel AS display, comment, link_id, tel_type AS type, link_type, tel_id AS id
- FROM profile_phones
- WHERE link_id IN {?} AND link_type = \'hq\'',
- $newcompanies);
- while ($row = $it->next()) {
- $p = new Phone($row);
- self::$companies[$row['link_id']]->setPhone($p);
+ $it = Phone::iterate(array(), array(Phone::LINK_COMPANY), $newcompanies);
+ while ($phone = $it->next()) {
+ self::$companies[$phone->linkId()]->setPhone($phone);
}
}
function check_account()
{
- return S::v('watch_account');
+ if (S::user()) {
+ return S::user()->watch;
+ }
+ return false;
}
function check_redirect($red = null)
}
$this->val = array($index);
} else {
- $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield),
+ $indexes = DirEnum::getIDs($this->direnum, $ufb->t($this->envfield),
$ufb->b('exact') ? XDB::WILDCARD_EXACT : XDB::WILDCARD_CONTAINS);
if (count($indexes) == 0) {
return false;
public $profile;
public $profileOwner;
public $userIsProfileOwner;
+ public $ownerIsRegistered;
// }}}
// {{{ constructor
parent::__construct($_user, $_unique, $_type);
$this->profile = &$_profile;
$this->profileOwner = $this->profile->owner();
- if (!is_null($this->profileOwner) && $this->profileOwner->id() == $this->user->id()) {
- $this->userIsProfileOwner = true;
- } else {
- $this->userIsProfileOwner = false;
- }
+ $this->userIsProfileOwner = (!is_null($this->profileOwner)
+ && $this->profileOwner->id() == $this->user->id());
+ $this->ownerIsRegistered = $this->profile->isActive();
}
// }}}
protected function sendmail($isok)
{
- global $globals;
- $mailer = new PlMailer();
- $mailer->setSubject($this->_mail_subj());
- $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
- $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
- if (!$this->userIsProfileOwner) {
- $mailer->addCc("\"{$this->user->fullName()}\" <{$this->user->bestEmail()}>");
- }
- $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
-
- $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
- . $this->_mail_body($isok)
- . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
- . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
- . $this->_mail_ps($isok);
+ // Only sends email if the profile's owner exists and is registered.
+ if ($this->ownerIsRegistered) {
+ global $globals;
- $mailer->setTxtBody(wordwrap($body));
- $mailer->send();
+ $mailer = new PlMailer();
+ $mailer->setSubject($this->_mail_subj());
+ $mailer->setFrom("validation+{$this->type}@{$globals->mail->domain}");
+ $mailer->addTo("\"{$this->profile->fullName()}\" <{$this->profileOwner->bestEmail()}>");
+ $mailer->addCc("validation+{$this->type}@{$globals->mail->domain}");
+ $body = ($this->profile->isFemale() ? "Chère camarade,\n\n" : "Cher camarade,\n\n")
+ . $this->_mail_body($isok)
+ . (Env::has('comm') ? "\n\n" . Env::v('comm') : '')
+ . "\n\nCordialement,\n-- \nL'équipe de Polytechnique.org\n"
+ . $this->_mail_ps($isok);
+ $mailer->setTxtBody(wordwrap($body));
+ $mailer->send();
+ }
}
// }}}
public function id()
{
- if (!is_null($this->profile)) {
- return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
- } else {
- return $this->user->id() . '_' . $this->type . '_' . $this->stamp;
- }
+ return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
}
// }}}
public $address;
public $suggestions;
+ public $rules = 'Si l\'entreprise est déjà présente sous un autre nom dans la liste des suggestions, remplacer son nom par celui-ci avant de valider. Laisser les autres champs tels quels.';
// }}}
// {{{ constructor
$where .= "name LIKE '%" . $name_array[$i] . "%'";
}
}
- $res = XDB::iterator('SELECT name
- FROM profile_job_enum
- WHERE ' . $where);
- $this->suggestions = "| ";
- while ($sug = $res->next()) {
- $this->suggestions .= $sug['name'] . " | ";
+ if ($where != '') {
+ $res = XDB::iterator('SELECT name
+ FROM profile_job_enum
+ WHERE ' . $where);
+ $this->suggestions = "| ";
+ while ($sug = $res->next()) {
+ $this->suggestions .= $sug['name'] . " | ";
+ }
}
}
protected function handle_editor()
{
- if (Env::has('holdingid')) {
- $this->holdingid = Env::t('holdingid');
- }
if (Env::has('name')) {
$this->name = Env::t('name');
- if (Env::has('acronym')) {
- $this->acronym = Env::t('acronym');
- if (Env::has('url')) {
- $this->url = Env::t('url');
- if (Env::has('NAF_code')) {
- $this->NAF_code = Env::t('NAF_code');
- if (Env::has('AX_code')) {
- $this->AX_code = Env::t('AX_code');
- return true;
- }
- }
- }
- }
}
- return false;
+ if (Env::has('acronym')) {
+ $this->acronym = Env::t('acronym');
+ }
+ if (Env::has('url')) {
+ $this->url = Env::t('url');
+ }
+ if (Env::has('email')) {
+ $this->email = Env::t('email');
+ }
+ if (Env::has('holdingid')) {
+ $this->holdingid = Env::i('holdingid');
+ }
+ if (Env::has('NAF_code')) {
+ $this->NAF_code = Env::t('NAF_code');
+ }
+ if (Env::has('AX_code')) {
+ $this->AX_code = Env::i('AX_code');
+ }
+ if (Env::has('address')) {
+ $this->address['text'] = Env::t('address');
+ }
+ if (Env::has('tel')) {
+ $this->tel = Env::t('tel');
+ }
+ if (Env::has('fax')) {
+ $this->fax = Env::t('fax');
+ }
+ return true;
}
// }}}
public function commit()
{
- // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
+ // TODO: use address update profile_job_enum once it is done.
$res = XDB::query('SELECT id
FROM profile_job_enum
WHERE name = {?}',
$this->name);
if ($res->numRows() != 1) {
- require_once 'profil.func.inc.php';
require_once 'geocoding.inc.php';
XDB::execute('INSERT INTO profile_job_enum (name, acronym, url, email, holdingid, NAF_code, AX_code)
$this->holdingid, $this->NAF_code, $this->AX_code);
$jobid = XDB::insertId();
- $display_tel = format_display_number($this->tel, $error_tel);
- $display_fax = format_display_number($this->fax, $error_fax);
- XDB::execute("INSERT INTO profile_phones (pid, link_type, link_id, tel_id, tel_type,
- search_tel, display_tel, pub)
- VALUES ({?}, 'hq', 0, 0, 'fixed', {?}, {?}, 'public'),
- ({?}, 'hq', 0, 1, 'fax', {?}, {?}, 'public')",
- $jobid, format_phone_number($this->tel), $display_tel,
- $jobid, format_phone_number($this->fax), $display_fax);
+ $phone = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 0,
+ 'type' => 'fixed', 'display' => $this->tel, 'pub' => 'public'));
+ $fax = new Phone(array('link_type' => 'hq', 'link_id' => $jobid, 'id' => 1,
+ 'type' => 'fax', 'display' => $this->fax, 'pub' => 'public'));
+ $phone->save();
+ $fax->save();
$gmapsGeocoder = new GMapsGeocoder();
$address = $gmapsGeocoder->getGeocodedAddress($this->address);
public function commit()
{
+ /* TODO: refines this filter on promotions by using userfilter. */
if (XDB::execute("INSERT INTO announces
SET uid = {?}, creation_date=NOW(), titre={?}, texte={?},
expiration={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-// {{{ class NamesReq4
+// {{{ class NamesReq
class NamesReq extends ProfileValidate
{
{
require_once 'name.func.inc.php';
- set_profile_display($this->display_names, $this->profile->id());
+ set_profile_display($this->display_names, $this->profile);
if (!is_null($this->profileOwner)) {
set_alias_names($this->sn_new, $this->sn_old, $this->profile->id(),
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-class Ancien
+class Ancien
{
public $NOM_PATR;
public $PART_NOM;
public $NUM_FORMATION = 0;
public $Erreur;
- public function __construct($aa)
+ public function __construct($aa)
{
if ($aa<>'') {
ax_load_object($this, $aa);
public $TEL;
public $FAX;
- public function __construct($aa)
+ public function __construct($aa)
{
ax_load_object($this, $aa);
}
}
}
-class Formation
+class Formation
{
public $LIBELLE;
- public function __construct($aa)
+ public function __construct($aa)
{
ax_load_object($this, $aa);
}
}
-function xml_get_children($vals, &$i)
+function xml_get_children($vals, &$i)
{
$children = array();
if (isset($vals[$i]['value'])) $children[] = $vals[$i]['value'];
if (Post::has('disable_weak_access')) {
$to_update['weak_password'] = null;
} else if (Post::has('update_account')) {
- if (Post::s('full_name') != $user->fullName()) {
- // XXX: Update profile if a profile is associated
- $to_update['full_name'] = Post::s('full_name');
- }
- if (Post::s('display_name') != $user->displayName()) {
- // XXX: Update profile if a profile is associated
- $to_update['display_name'] = Post::s('display_name');
+ if (!$user->hasProfile()) {
+ if (Post::s('full_name') != $user->fullName()) {
+ $to_update['full_name'] = Post::s('full_name');
+ }
+ if (Post::s('display_name') != $user->displayName()) {
+ $to_update['display_name'] = Post::s('display_name');
+ }
+ if (Post::s('directory_name') != $user->directoryName()) {
+ $to_update['directory_name'] = Post::s('directory_name');
+ }
}
if (Post::s('sex') != ($user->isFemale() ? 'female' : 'male')) {
$to_update['sex'] = Post::s('sex');
+ if ($user->hasProfile()) {
+ XDB::execute('UPDATE profiles
+ SET sex = {?}
+ WHERE pid = {?}',
+ Post::s('sex'), $user->profile()->id());
+ }
}
- if (!Post::blank('hashpass')) {
- $to_update['password'] = Post::s('hashpass');
+ if (!Post::blank('pwhash')) {
+ $to_update['password'] = Post::s('pwhash');
+ require_once 'googleapps.inc.php';
$account = new GoogleAppsAccount($user);
if ($account->active() && $account->sync_password) {
- $account->set_password(Post::s('hashpass'));
+ $account->set_password(Post::s('pwhash'));
}
}
if (!Post::blank('weak_password')) {
}
}
if (!empty($to_update)) {
- // TODO: fetch the initial values of the fields, and eventually send
- // a summary of the changes to an admin.
+ $res = XDB::query('SELECT *
+ FROM accounts
+ WHERE uid = {?}', $user->id());
+ $oldValues = $res->fetchAllAssoc();
+ $oldValues = $oldValues[0];
+
$set = array();
+ $diff = array();
foreach ($to_update as $k => $value) {
- $set[] = XDB::format($k . ' = {?}', $value);
+ $value = XDB::format('{?}', $value);
+ $set[] = $k . ' = ' . $value;
+ $diff[$k] = array($oldValues[$k], trim($value, "'"));
+ unset($oldValues[$k]);
}
XDB::execute('UPDATE accounts
- SET ' . implode(', ', $set) . '
+ SET ' . implode(', ', $set) . '
WHERE uid = ' . XDB::format('{?}', $user->id()));
$page->trigSuccess('Données du compte mise à jour avec succès');
$user = User::getWithUID($user->id());
+
+ /* Formats the $diff and send it to the site administrators. The rules are the folowing:
+ * -formats: password, token, weak_password
+ */
+ foreach (array('password', 'token', 'weak_password') as $key) {
+ if (isset($diff[$key])) {
+ $diff[$key] = array('old value', 'new value');
+ } else {
+ $oldValues[$key] = 'old value';
+ }
+ }
+
+ $mail = new PlMailer('admin/useredit.mail.tpl');
+ $mail->assign('admin', S::user()->hruid);
+ $mail->assign('hruid', $user->hruid);
+ $mail->assign('diff', $diff);
+ $mail->assign('oldValues', $oldValues);
+ $mail->send();
}
// }}}
$page->addJsLink('jquery.ui.core.js');
$page->addJsLink('jquery.ui.tabs.js');
+ $page->addJsLink('password.js');
// Displays last login and last host information.
$res = XDB::query("SELECT start, host
}
$page->assign('user', $user);
+ $page->assign('hasProfile', $user->hasProfile());
// Displays forum bans.
$res = XDB::query("SELECT write_perm, read_perm, comment
if ($infos = self::formatNewUser($page, $line, $separator, $promotion, 6)) {
$sex = self::formatSex($page, $infos[3], $line);
if (!is_null($sex)) {
- $name = $infos[1] . ' ' . $infos[0];
+ $fullName = $infos[1] . ' ' . $infos[0];
+ $directoryName = $infos[0] . ' ' . $infos[1];
$birthDate = self::formatBirthDate($infos[2]);
$xorgId = Profile::getXorgId($infos[4]);
if (is_null($xorgId)) {
XDB::execute('INSERT INTO profile_display (pid, yourself, public_name, private_name,
directory_name, short_name, sort_name, promo)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
- $pid, $infos[1], $name, $name, $name, $name, $infos[0] . ' ' . $infos[1], $promo);
+ $pid, $infos[1], $fullName, $fullName, $directoryName, $fullName, $directoryName, $promo);
XDB::execute('INSERT INTO profile_education (pid, eduid, degreeid, entry_year, grad_year, flags)
VALUES ({?}, {?}, {?}, {?}, {?}, {?})',
$pid, $eduSchools[Profile::EDU_X], $degreeid, $entry_year, $grad_year, 'primary');
- XDB::execute('INSERT INTO accounts (hruid, type, is_admin, state, full_name, display_name, sex)
+ XDB::execute('INSERT INTO accounts (hruid, type, is_admin, state, full_name, directory_name, display_name, sex)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})',
- $infos['hrid'], $type, 0, 'active', $name, $infos[1], $sex);
+ $infos['hrid'], $type, 0, 'active', $fullName, $directoryName, $infos[1], $sex);
$uid = XDB::insertId();
XDB::execute('INSERT INTO account_profiles (uid, pid, perms)
VALUES ({?}, {?}, {?})',
if ($infos = self::formatNewUser($page, $line, $separator, $type, 4)) {
$sex = self::formatSex($page, $infos[3], $line);
if (!is_null($sex)) {
- XDB::execute('INSERT INTO accounts (hruid, type, is_admin, state, email, full_name, display_name, sex)
+ $fullName = $infos[1] . ' ' . $infos[0];
+ $directoryName = $infos[0] . ' ' . $infos[1];
+ XDB::execute('INSERT INTO accounts (hruid, type, is_admin, state, email, full_name, directory_name, display_name, sex)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})',
- $infos['hrid'], $type, 0, 'active', $infos[2], $infos[1] . ' ' . $infos[0], $infos[1], $sex);
+ $infos['hrid'], $type, 0, 'active', $infos[2], $fullName, $directoryName, $infos[1], $sex);
$newAccounts[$infos['hrid']] = $infos[1] . ' ' . $infos[0];
}
}
WHERE pd.promo = {?}', $promo);
while (list($pid, $name, $death) = $res->next()) {
$val = Env::v('death_' . $pid);
- if($val == $death || empty($val)) {
+ if ($val == $death) {
continue;
}
+ if (empty($val)) {
+ $val = null;
+ }
XDB::execute('UPDATE profiles
SET deathdate = {?}, deathdate_rec = NOW()
WHERE pid = {?}', $val, $pid);
- $page->trigSuccess('Ajout du décès de ' . $name . ' le ' . $val . '.');
- if($death == '0000-00-00' || empty($death)) {
+
+ $page->trigSuccess('Édition du décès de ' . $name . ' (' . ($val ? $val : 'ressuscité') . ').');
+ if ($val && ($death == '0000-00-00' || empty($death))) {
$profile = Profile::get($pid);
$profile->clear();
$profile->owner()->clear(false);
INNER JOIN profile_display AS pd ON (p.pid = pd.pid)
WHERE pd.promo = {?}
ORDER BY pd.sort_name', $promo);
- $page->assign('decedes', $res);
+ $page->assign('profileList', $res);
}
function handler_dead_but_active(&$page)
$table_editor->apply($page, $action, $id);
}
- function handler_account_types(&$page, $action = 'list', $id = null)
+ function handler_account_types(&$page, $action = 'list', $id = null)
{
$page->setTitle('Administration - Types de comptes');
$page->assign('title', 'Gestion des types de comptes');
{
if (S::hasAuthToken()) {
$page->setRssLink('Changement Récents',
- '/Site/AllRecentChanges?action=rss&user=' . S::v('hruid') . '&hash=' . S::v('token'));
+ '/Site/AllRecentChanges?action=rss&user=' . S::v('hruid') . '&hash=' . S::user()->token);
}
// update wiki perms
}
if (Env::has('edit')) {
- // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
+ // TODO: use address class to update profile_job_enum once it is done.
S::assert_xsrf_token();
$selectedJob = Env::has('selectedJob');
- XDB::execute("DELETE FROM profile_phones
- WHERE pid = {?} AND link_type = 'hq'",
- $id);
+ Phone::deletePhones(0, Phone::LINK_COMPANY, $id);
XDB::execute("DELETE FROM profile_addresses
WHERE jobid = {?} AND type = 'hq'",
$id);
- XDB::execute('DELETE FROM profile_job_enum
- WHERE id = {?}',
- $id);
if (Env::has('change')) {
XDB::execute('UPDATE profile_job
SET jobid = {?}
WHERE jobid = {?}',
Env::i('newJobId'), $id);
+ XDB::execute('DELETE FROM profile_job_enum
+ WHERE id = {?}',
+ $id);
$page->trigSuccess("L'entreprise a bien été remplacée.");
} else {
- require_once 'profil.func.inc.php';
require_once 'geocoding.inc.php';
- $display_tel = format_display_number(Env::v('tel'), $error_tel);
- $display_fax = format_display_number(Env::v('fax'), $error_fax);
$gmapsGeocoder = new GMapsGeocoder();
$address = array('text' => Env::t('address'));
$address = $gmapsGeocoder->getGeocodedAddress($address);
Env::t('name'), Env::t('acronym'), Env::t('url'), Env::t('email'),
Env::t('NAF_code'), Env::i('AX_code'), Env::i('holdingId'), $id);
- XDB::execute("INSERT INTO profile_phones (pid, link_type, link_id, tel_id, tel_type,
- search_tel, display_tel, pub)
- VALUES ({?}, 'hq', 0, 0, 'fixed', {?}, {?}, 'public'),
- ({?}, 'hq', 0, 1, 'fax', {?}, {?}, 'public')",
- $id, format_phone_number(Env::v('tel')), $display_tel,
- $id, format_phone_number(Env::v('fax')), $display_fax);
+ $phone = new Phone(array('display' => Env::v('tel'), 'link_id' => $id, 'id' => 0, 'type' => 'fixed',
+ 'link_type' => Phone::LINK_COMPANY, 'pub' => 'public'));
+ $fax = new Phone(array('display' => Env::v('fax'), 'link_id' => $id, 'id' => 1, 'type' => 'fax',
+ 'link_type' => Phone::LINK_COMPANY, 'pub' => 'public'));
+ $phone->save();
+ $fax->save();
XDB::execute("INSERT INTO profile_addresses (jobid, type, id, accuracy,
text, postalText, postalCode, localityId,
$user =& S::user();
if ($user->hasProfile()) {
- // XXX: Transition table for auth.
+ /* Transition table for authentification. */
$personnal_data = $user->profile()->data();
$personnal_data['matricule'] = $personnal_data['xorg_id'];
$personnal_data['matricule_ax'] = $personnal_data['ax_id'];
}
$page->trigSuccess("Les adresses soumises correspondent à un total de " . count(array_unique($ids)) . " camarades.");
}
- // XXX : no break here, since Vérifier is a subcase of Aperçu.
+ // No break here, since Vérifier is a subcase of Aperçu.
case 'Aperçu':
$this->load('axletter.inc.php');
$al = new AXLetter(array($id, $short_name, $subject, $title, $body, $signature,
if (!$this->_promo_min && !$this->_promo_max && !$this->_subset) {
return '1';
}
+ /* TODO: refines this filter on promotions by using userfilter. */
$where = array();
if ($this->_promo_min) {
$where[] = "((ni.uid = 0 AND ni.promo >= {$this->_promo_min}) OR (ni.uid != 0 AND u.promo >= {$this->_promo_min}))";
function handlers()
{
return array(
- 'carnet' => $this->make_hook('index', AUTH_COOKIE),
- 'carnet/panel' => $this->make_hook('panel', AUTH_COOKIE),
- 'carnet/notifs' => $this->make_hook('notifs', AUTH_COOKIE),
-
- 'carnet/contacts' => $this->make_hook('contacts', AUTH_COOKIE),
- 'carnet/contacts/pdf' => $this->make_hook('pdf', AUTH_COOKIE),
- 'carnet/contacts/vcard' => $this->make_hook('vcard', AUTH_COOKIE),
- 'carnet/contacts/ical' => $this->make_hook('ical', AUTH_PUBLIC, 'user', NO_HTTPS),
- 'carnet/contacts/csv' => $this->make_hook('csv', AUTH_PUBLIC, 'user', NO_HTTPS),
- 'carnet/contacts/csv/birthday' => $this->make_hook('csv_birthday', AUTH_PUBLIC, 'user', NO_HTTPS),
-
- 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'carnet' => $this->make_hook('index', AUTH_COOKIE, 'directory_private'),
+ 'carnet/panel' => $this->make_hook('panel', AUTH_COOKIE, 'directory_private'),
+ 'carnet/notifs' => $this->make_hook('notifs', AUTH_COOKIE, 'directory_private'),
+
+ 'carnet/contacts' => $this->make_hook('contacts', AUTH_COOKIE, 'directory_private'),
+ 'carnet/contacts/pdf' => $this->make_hook('pdf', AUTH_COOKIE, 'directory_private'),
+ 'carnet/contacts/vcard' => $this->make_hook('vcard', AUTH_COOKIE, 'directory_private'),
+ 'carnet/contacts/ical' => $this->make_hook('ical', AUTH_PUBLIC, 'directory_private', NO_HTTPS),
+ 'carnet/contacts/csv' => $this->make_hook('csv', AUTH_PUBLIC, 'directory_private', NO_HTTPS),
+ 'carnet/contacts/csv/birthday' => $this->make_hook('csv_birthday', AUTH_PUBLIC, 'directory_private', NO_HTTPS),
+
+ 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'directory_private', NO_HTTPS),
);
}
return;
}
$page->setRssLink('Polytechnique.org :: Carnet',
- '/carnet/rss/'.S::v('hruid').'/'.S::v('token').'/rss.xml');
+ '/carnet/rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
}
function handler_index(&$page)
// For XSRF protection, checks both the normal xsrf token, and the special RSS token.
// It allows direct linking to contact adding in the RSS feed.
- if (Env::v('action') && Env::v('token') !== S::v('token')) {
+ if (Env::v('action') && Env::v('token') !== S::user()->token) {
S::assert_xsrf_token();
}
switch (Env::v('action')) {
function handlers()
{
return array(
- 'emails' => $this->make_hook('emails', AUTH_COOKIE),
- 'emails/alias' => $this->make_hook('alias', AUTH_MDP),
- 'emails/antispam' => $this->make_hook('antispam', AUTH_MDP),
+ 'emails' => $this->make_hook('emails', AUTH_COOKIE, 'mail'),
+ 'emails/alias' => $this->make_hook('alias', AUTH_MDP, 'mail'),
+ 'emails/antispam' => $this->make_hook('antispam', AUTH_MDP, 'mail'),
'emails/broken' => $this->make_hook('broken', AUTH_COOKIE),
- 'emails/redirect' => $this->make_hook('redirect', AUTH_MDP),
- 'emails/send' => $this->make_hook('send', AUTH_MDP),
+ 'emails/redirect' => $this->make_hook('redirect', AUTH_MDP, 'mail'),
+ 'emails/send' => $this->make_hook('send', AUTH_MDP, 'mail'),
'emails/antispam/submit' => $this->make_hook('submit', AUTH_COOKIE),
- 'emails/test' => $this->make_hook('test', AUTH_COOKIE, 'user', NO_AUTH),
+ 'emails/test' => $this->make_hook('test', AUTH_COOKIE, 'mail', NO_AUTH),
'emails/rewrite/in' => $this->make_hook('rewrite_in', AUTH_PUBLIC),
'emails/rewrite/out' => $this->make_hook('rewrite_out', AUTH_PUBLIC),
if ($user->hasProfile()) {
XDB::execute("UPDATE profiles
SET alias_pub = {?}
- WHERE pid = {?}",
+ WHERE pid = {?}",
$value, $user->profile()->id());
}
$visibility = ($value == 'public');
$storage = new EmailStorage(S::user(), 'imap');
$storage->activate();
$page->assign('ok', true);
- $page->assign('prenom', S::v('prenom'));
- $page->assign('sexe', S::v('femme'));
+ $page->assign('yourself', S::user()->displayName());
+ $page->assign('sexe', S::user()->isFemale());
} else if (!S::logged() && $user) {
$storage = new EmailStorage($user, 'imap');
$storage->activate();
$page->assign('ok', true);
- $page->assign('prenom', $user->displayName());
+ $page->assign('yourself', $user->displayName());
$page->assign('sexe', $user->isFemale());
}
}
{
$page->changeTpl('emails/lost.tpl');
- // TODO: Order by promo.
$page->assign('lost_emails',
- XDB::iterator("SELECT a.uid, a.hruid
- FROM accounts AS a
- INNER JOIN email_options AS eo ON (eo.uid = a.uid)
- LEFT JOIN emails AS e ON (a.uid = e.uid AND FIND_IN_SET('active', e.flags))
- WHERE e.uid IS NULL AND FIND_IN_SET('googleapps', eo.storage) = 0 AND
- a.state = 'active'
- ORDER BY a.hruid"));
+ XDB::iterator('SELECT a.uid, a.hruid, pd.promo
+ FROM accounts AS a
+ INNER JOIN email_options AS eo ON (eo.uid = a.uid)
+ LEFT JOIN emails AS e ON (a.uid = e.uid AND FIND_IN_SET(\'active\', e.flags))
+ LEFT JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET(\'owner\', perms))
+ LEFT JOIN profile_display AS pd ON (ap.pid = pd.pid)
+ WHERE e.uid IS NULL AND FIND_IN_SET(\'googleapps\', eo.storage) = 0
+ AND a.state = \'active\'
+ ORDER BY pd.promo, a.hruid'));
}
function handler_broken_addr(&$page)
{
global $globals;
// Add a new special tip when changing plat/al version
- if ($globals->version != S::v('last_version') && is_null($exclude)) {
+ if ($globals->version != S::user()->last_version && is_null($exclude)) {
XDB::execute('UPDATE accounts
SET last_version = {?}
WHERE uid = {?}',
// Direct link to the RSS feed, when available.
if (S::hasAuthToken()) {
$page->setRssLink('Polytechnique.org :: News',
- '/rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml');
+ '/rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
}
// Hide the read event, and reload the page to get to the next event.
function handlers()
{
return array(
- 'banana' => $this->make_hook('banana', AUTH_COOKIE),
- 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS),
+ 'banana' => $this->make_hook('banana', AUTH_COOKIE, 'forums'),
+ 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'forums', NO_HTTPS),
'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP, 'admin'),
);
}
return XDB::affectedRows() / 2;
}
- /* Cherche les les anciens présents dans Xorg avec un matricule_ax ne correspondant à rien dans la base de l'AX
+ /* Cherche les les anciens présents dans Xorg avec un matricule_ax ne correspondant à rien dans la base de l'AX
* (mises à part les promo 1921 et 1923 qui ne figurent pas dans les données de l'AX)*/
private static function find_wrong_in_xorg($limit = 10)
{
`Date_maj` = CONCAT(SUBSTRING(@StringDate_maj,7),'-',SUBSTRING(@StringDate_maj,4,2),'-',SUBSTRING(@StringDate_maj,1,2));
LOAD DATA LOCAL INFILE 'Activites.txt' INTO TABLE `fusionax_adresses` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
-(provenance, id_ancien, @Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire,
+(provenance, id_ancien, @Code_etab, @Raison_sociale, @Libelle_fonctio, @Annuaire,
Ligne1, Ligne2, Ligne3, code_postal, ville, zip_cedex, etat_distr, pays, tel, fax, @StringDate_maj)
SET
`Type_adr` = 'E',
s/\tès /\t/g;
s/\tof /\t/g;
s/( )+(\t)/\t/g;
-
+
# On remet dans l'ordre lorsque le diplôme se situe après l'université
s/Manag\.Vanderblit/Vanderbilt University\tManagement/;
#unrar e -inul export_4D.txt.rar
cp /home/x2004jacob/export*utf8.TXT .
-# séparation en fichiers de tables
+# séparation en fichiers de tables
cat export_total* | grep ^AD > Adresses.txt
cat export_total* | grep ^AN > Anciens.txt
cat export_total* | grep ^FO > Formations.txt
require_once("emails.inc.php");
require_once("googleapps.inc.php");
$page->changeTpl('googleapps/index.tpl');
- $page->addJsLink('motdepasse.js');
+ $page->addJsLink('password.js');
$page->setTitle('Compte Google Apps');
$user = S::user();
} else {
$account->set_password_sync(false);
}
- } elseif ($action == 'password' && Post::has('response2') && !$account->sync_password) {
+ } elseif ($action == 'password' && Post::has('pwhash') && Post::t('pwhash') && !$account->sync_password) {
S::assert_xsrf_token();
- $account->set_password(Post::v('response2'));
+ $account->set_password(Post::t('pwhash'));
}
if ($action == 'suspend' && Post::has('suspend') && $account->active()) {
if ($password_sync) {
$password = $user->password();
} else {
- $password = Post::v('response2');
+ $password = Post::t('pwhash');
}
$account->create($password_sync, $password, $redirect_mails);
function handlers()
{
return array(
- 'lists' => $this->make_hook('lists', AUTH_MDP),
- 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, 'user', NO_AUTH),
- 'lists/create' => $this->make_hook('create', AUTH_MDP),
-
- 'lists/members' => $this->make_hook('members', AUTH_COOKIE),
- 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE),
- 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE),
- 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE),
- 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS),
-
- 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP),
- 'lists/admin' => $this->make_hook('admin', AUTH_MDP),
- 'lists/options' => $this->make_hook('options', AUTH_MDP),
- 'lists/delete' => $this->make_hook('delete', AUTH_MDP),
-
- 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP),
- 'lists/check' => $this->make_hook('check', AUTH_MDP),
- 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'),
+ 'lists' => $this->make_hook('lists', AUTH_MDP, 'lists'),
+ 'lists/ajax' => $this->make_hook('ajax', AUTH_MDP, 'lists', NO_AUTH),
+ 'lists/create' => $this->make_hook('create', AUTH_MDP, 'lists'),
+
+ 'lists/members' => $this->make_hook('members', AUTH_COOKIE, 'lists'),
+ 'lists/csv' => $this->make_hook('csv', AUTH_COOKIE, 'lists'),
+ 'lists/annu' => $this->make_hook('annu', AUTH_COOKIE, 'lists'),
+ 'lists/archives' => $this->make_hook('archives', AUTH_COOKIE, 'lists'),
+ 'lists/archives/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'lists', NO_HTTPS),
+
+ 'lists/moderate' => $this->make_hook('moderate', AUTH_MDP, 'lists'),
+ 'lists/admin' => $this->make_hook('admin', AUTH_MDP, 'lists'),
+ 'lists/options' => $this->make_hook('options', AUTH_MDP, 'lists'),
+ 'lists/delete' => $this->make_hook('delete', AUTH_MDP, 'lists'),
+
+ 'lists/soptions' => $this->make_hook('soptions', AUTH_MDP, 'lists'),
+ 'lists/check' => $this->make_hook('check', AUTH_MDP, 'lists'),
+ 'admin/lists' => $this->make_hook('admin_all', AUTH_MDP, 'admin'),
);
}
}
$this->prepare_client($page);
$members = $this->client->get_members($liste);
- $list = list_fetch_names(list_extract_members($members[1]));
+ $list = list_fetch_basic_info(list_extract_members($members[1]));
pl_content_headers("text/x-csv");
- echo "email,nom,prenom,promo\n";
- foreach ($list as $member) {
- echo @$member['email'] . ',' . @$member['nom'] . ',' . @$member['prenom'] . ',' . @$member['promo'] . "\n";
- }
+ echo "email,nom,promo\n";
+ echo implode("\n", $list);
exit;
}
foreach($members as $mem) {
$user = User::getSilent($mem);
if (!$user) {
- $membres[0][] = array('l' => $mem, 'p' => (!$tri_promo ? 'inconnue' : null));
+ $membres[0][] = array('l' => $mem, 'p' => (!$tri_promo ? 'inconnue' : null), 'n' => null, 'x' => null, 'b' => null);
} else {
$uid = $user->id();
- $nom = $user->fullName(); # XXX: Get a notion of 'last name' here, I want to sort user by lastnames
+ $nom = $user->directoryName();
$promo = $user->promo();
if (!$promo) {
$promo = 'non-X';
}
- $broken = false; # XXX: fill it with the good value if the user has no valid email
$key = $tri_promo ? ($promo != 'non-X' ? $promo : 0) : strtoupper(@$nom{0});
if ($tri_promo) {
$promo = null;
}
- $membres[$key][$nom.$mem] = Array('n' => $nom, 'l' => $mem, 'p' => $promo, 'x' => $uid, 'b' => $broken);
+ $membres[$key][$nom.$mem] = array('n' => $nom, 'l' => $mem, 'p' => $promo, 'x' => $uid, 'b' => $user->lost);
}
}
}
// }}}
+// {{{ function list_fetch_basic_info
-function list_fetch_names($members)
+function list_fetch_basic_info($members)
{
$res = array();
foreach ($members as $member) {
$user = User::getSilent($member);
if (!$user) {
- $res[] = $member;
+ $res[] = $member . ',,';
} else {
- $res[] = $user->fullName();
+ $res[] = $user->forlifeEmail() . ',' . $user->directoryName() . ',' . $user->promo();
}
}
return $res;
<MultiPg>
-<NoDoc>
+<NoDoc>
<UseLocalTime>
<MsgLocalDateFmt>
%d-%m-%y
<FieldsBeg>
<table class="bicol" cellpadding="0" cellspacing="0">
</FieldsBeg>
-
+
<LabelBeg>
<tr>
<td class="right">
<LabelEnd>
</td>
</LabelEnd>
-
+
<FldBeg>
<td>
</FldBeg>
</td>
</tr>
</FldEnd>
-
+
<FieldsEnd>
</table>
</FieldsEnd>
<!-- ------------------------------------------------------------------------ -->
<TIdxPgSSMarkup>
-
+
</TIdxPgSSMarkup>
<TIdxPgBegin>
<IdxPgSSMarkup>
-
+
</IdxPgSSMarkup>
<IdxPgBegin>
function handler_marketing(&$page)
{
$page->changeTpl('marketing/index.tpl');
-
$page->setTitle('Marketing');
- $page->trigWarning("Les statistiques sont momentanéement désactivées");
+
+ $alive = new UserFilter(new PFC_Not(new UFC_Dead()));
+ $registered = new UserFilter(new PFC_And(new UFC_Registered(), new PFC_Not(new UFC_Dead())));
+ $alive72 = new UserFilter(new PFC_And(new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+ $registered72 = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Promo('>=', UserFilter::GRADE_ING, 1972), new PFC_Not(new UFC_Dead())));
+ $aliveWomen = new UserFilter(new PFC_And(new UFC_Sex(User::GENDER_FEMALE) , new PFC_Not(new UFC_Dead())));
+ $registeredWomen = new UserFilter(new PFC_And(new UFC_Registered(), new UFC_Sex(User::GENDER_FEMALE), new PFC_Not(new UFC_Dead())));
+ $statistics = array(
+ 'alive' => $alive->getTotalCount(),
+ 'registered' => $registered->getTotalCount(),
+ 'alive72' => $alive72->getTotalCount(),
+ 'registered72' => $registered72->getTotalCount(),
+ 'womenAlive' => $aliveWomen->getTotalCount(),
+ 'womenRegistered' => $registeredWomen->getTotalCount(),
+ );
+ $statistics['registeredRate'] = $statistics['registered'] / $statistics['alive'] * 100;
+ $statistics['registeredRate72'] = $statistics['registered72'] / $statistics['alive72'] * 100;
+ $statistics['womenRegisteredRate'] = $statistics['womenRegistered'] / $statistics['womenAlive'] * 100;
+
+ $registeredWeek = new UserFilter(new PFC_And(new UFC_Registered(false, '>=', strtotime('1 week ago')), new PFC_Not(new UFC_Dead())));
+ $registrationPending = XDB::fetchOneCell('SELECT COUNT(*)
+ FROM register_pending');
+ $registrations = array(
+ 'week' => $registeredWeek->getTotalCount(),
+ 'pending' => $registrationPending,
+ );
+
+ $ok = XDB::fetchOneCell('SELECT COUNT(*)
+ FROM register_mstats
+ WHERE success != \'0000-00-00\'');
+ $okWeek = XDB::fetchOneCell('SELECT COUNT(*)
+ FROM register_mstats
+ WHERE success >= {?}', strtotime('1 week ago'));
+ $res = XDB::fetchAllAssoc('SELECT type, COUNT(*) as count
+ FROM register_marketing
+ GROUP BY type');
+ $no = array();
+ foreach ($res as $value) {
+ $no[$value['type']] = $value['count'];
+ }
+ $no['week'] = XDB::fetchOneCell('SELECT COUNT(*)
+ FROM register_marketing
+ WHERE last >= {?}', strtotime('1 week ago'));
+ $marketings = array(
+ 'ok' => $ok,
+ 'okWeek' => $okWeek,
+ 'noPerso' => (isset($no['user']) ? $no['user'] : 0),
+ 'noXorg' => (isset($no['staff']) ? $no['staff'] : 0),
+ 'noAX' => (isset($no['ax']) ? $no['ax'] : 0),
+ 'noWeek' => $no['week'],
+ );
+
+ $page->assign('statistics', $statistics);
+ $page->assign('registrations', $registrations);
+ $page->assign('marketings', $marketings);
}
function handler_private(&$page, $hruid = null,
require_once 'marketing.inc.php';
$sender = User::getSilent(S::v('uid'));
+ $perso_signature = 'Cordialement,<br />-- <br />' . $sender->fullName();
$market = new AnnuaireMarketing(null, true);
$text = $market->getText(array(
'sexe' => $user->isFemale(),
$text = str_replace('%%hash%%', '', $text);
$text = str_replace('%%personal_notes%%', '<em id="personal_notes_display"></em>', $text);
$text = str_replace('%%sender%%',
- "<span id=\"sender\">" . $sender->fullName() . '</span>', $text);
+ '<span id="sender">' . $perso_signature . '</span>', $text);
$page->assign('text', nl2br($text));
- // TODO (JAC): define a unique Xorg signature for all the emails we send.
- $page->assign('xorg_signature', "L'équipe de Polytechnique.org,<br />Le portail des élèves & anciens élèves de l'École polytechnique");
- $page->assign('perso_signature', $sender->fullName());
+ $page->assign('perso_signature', $perso_signature);
+ $page->assign('mail_part', 'escaped_html');
}
}
$page->changeTpl('marketing/relance.tpl');
if (Post::has('relancer')) {
- $nbdix = Marketing::getAliveUsersCount();
+ global $globals;
+ $nbdix = $globals->core->NbIns;
$sent = Array();
$users = User::getBulkUsersWithUIDs($_POST['relance']);
function handlers()
{
return array(
- 'payment' => $this->make_hook('payment', AUTH_MDP),
+ 'payment' => $this->make_hook('payment', AUTH_MDP, 'payment'),
'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'payment/cyber2_return' => $this->make_hook('cyber2_return', AUTH_PUBLIC, 'user', NO_HTTPS),
'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC, 'user', NO_HTTPS),
{
global $globals;
- require_once 'profil.func.inc.php' ;
$this->load('money.inc.php');
if (!empty($GLOBALS['IS_XNET_SITE'])) {
if ($eid = $res->fetchOneCell()) {
require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
$evt = get_event_detail($eid);
- subscribe_lists_event(0, $uid, $evt, $montant, true);
+ subscribe_lists_event($uid, $evt, 1, $montant, true);
}
/* on genere le mail de confirmation */
function handler_cyber2_return(&$page, $uid = null)
{
global $globals, $platal;
-
+
/* on vérifie la signature */
$vads_params = array();
foreach($_REQUEST as $key => $value)
//if($signature != Env::v('signature')) {
// cb_erreur("signature invalide");
//}
-
+
/* on extrait les informations sur l'utilisateur */
$user = User::get(Env::v('vads_cust_id'));
if (!$user) {
if (!list($conf_mail, $conf_title, $conf_text) = $res->fetchOneRow()) {
cb_erreur("référence de commande inconnue");
}
-
+
/* on extrait le montant */
if (Env::v('vads_currency') != "978") {
cb_erreur("monnaie autre que l'euro");
if (Env::v('vads_result') != "00") {
cb_erreur("erreur lors du paiement : ?? (".Env::v('vads_result').")");
}
-
+
/* on fait l'insertion en base de donnees */
XDB::execute("INSERT INTO payment_transactions (id, uid, ref, fullref, amount, pkey, comment)
VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
Env::v('vads_trans_date'), $user->id(), $ref, Env::v('vads_order_id'), $montant, "", Env::v('vads_order_info'));
echo "Paiement stored.\n";
-
+
// We check if it is an Xnet payment and then update the related ML.
$res = XDB::query('SELECT eid
FROM group_events
if ($eid = $res->fetchOneCell()) {
require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
$evt = get_event_detail($eid);
- subscribe_lists_event(0, $user->id(), $evt, $montant, true);
+ subscribe_lists_event($user->id(), $evt, 1, $montant, true);
}
/* on genere le mail de confirmation */
if ($eid = $res->fetchOneCell()) {
require_once dirname(__FILE__) . '/xnetevents/xnetevents.inc.php';
$evt = get_event_detail($eid);
- subscribe_lists_event(0, $uid, $evt, $montant, true);
+ subscribe_lists_event($user->id(), $evt, 1, $montant, true);
}
/* on genere le mail de confirmation */
$prefix = ($pay->flags->hasflag('unique')) ? str_pad("",15,"0") : rand_url_id();
$fullref = substr("$prefix-{$pay->id}",-12); // FIXME : check for duplicates
$ts = time();
- $trans_date = date("YmdHis", $ts);
+ $trans_date = date("YmdHis", $ts);
$trans_id = date("His", $ts); // FIXME : check for duplicates
- // contenu du formulaire
+ // contenu du formulaire
$this->urlform = "https://systempay.cyberpluspaiement.com/vads-payment/";
$this->infos['commercant'] = Array(
'vads_site_id' => $globals->money->cyperplus_account,
'vads_ctx_mode' => $globals->money->cyperplus_prod,
'vads_page_action' => 'PAYMENT',
'vads_action_mode' => 'INTERACTIVE');
-
+
// calcul de la clé d'acceptation en entrée
$all_params = array_merge($this->infos['commercant'],$this->infos['client'],$this->infos['commande'],$this->infos['divers']);
ksort($all_params);
// Preferences thingies
'prefs' => $this->make_hook('prefs', AUTH_COOKIE),
'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE),
- 'prefs/webredirect' => $this->make_hook('webredir', AUTH_MDP),
+ 'prefs/webredirect' => $this->make_hook('webredir', AUTH_MDP, 'mail'),
'prefs/skin' => $this->make_hook('skin', AUTH_COOKIE),
// password related thingies
'password' => $this->make_hook('password', AUTH_MDP),
'tmpPWD' => $this->make_hook('tmpPWD', AUTH_PUBLIC),
- 'password/smtp' => $this->make_hook('smtppass', AUTH_MDP),
+ 'password/smtp' => $this->make_hook('smtppass', AUTH_MDP, 'mail'),
'recovery' => $this->make_hook('recovery', AUTH_PUBLIC),
'exit' => $this->make_hook('exit', AUTH_PUBLIC),
'review' => $this->make_hook('review', AUTH_PUBLIC),
function __set_rss_state($state)
{
if ($state) {
- S::set('token', rand_url_id(16));
+ S::user()->token = rand_url_id(16);
XDB::execute('UPDATE accounts
SET token = {?}
- WHERE uid = {?}', S::s('token'), S::i('uid'));
+ WHERE uid = {?}', S::user()->token, S::i('uid'));
} else {
S::kill('token');
XDB::execute('UPDATE accounts
if (Post::has('email_format')) {
$fmt = Post::s('email_format');
S::user()->setEmailFormat($fmt);
- S::set('email_format', $fmt);
}
if (Post::has('rss')) {
{
global $globals;
- if (Post::has('response2')) {
+ if (Post::has('pwhash') && Post::t('pwhash')) {
S::assert_xsrf_token();
- S::set('password', $password = Post::v('response2'));
+ S::set('password', $password = Post::t('pwhash'));
XDB::execute('UPDATE accounts
SET password = {?}
WHERE uid={?}', $password,
S::logger()->log('passwd');
Platal::session()->setAccessCookie(true);
- $page->changeTpl('platal/motdepasse.success.tpl');
+ $page->changeTpl('platal/password.success.tpl');
$page->run();
}
- $page->changeTpl('platal/motdepasse.tpl');
- $page->addJsLink('motdepasse.js');
+ $page->changeTpl('platal/password.tpl');
+ $page->addJsLink('password.js');
$page->setTitle('Mon mot de passe');
}
}
$uid = $ligne["uid"];
- if (Post::has('response2')) {
- $password = Post::v('response2');
+ if (Post::has('pwhash') && Post::t('pwhash')) {
+ $password = Post::t('pwhash');
XDB::query('UPDATE accounts
SET password={?}
WHERE uid = {?} AND state = \'active\'',
S::logger($uid)->log("passwd", "");
$page->changeTpl('platal/tmpPWD.success.tpl');
} else {
- $page->changeTpl('platal/motdepasse.tpl');
- $page->addJsLink('motdepasse.js');
+ $page->changeTpl('platal/password.tpl');
+ $page->addJsLink('password.js');
}
}
}
}
- function handler_review(&$page, $action = null, $mode = null)
+ function handler_review(&$page, $action = null, $mode = null)
{
// Include X-XRDS-Location response-header for Yadis discovery
global $globals;
);
}
- /* XXX COMPAT */
+ /* Function needed for compatibility reasons.
+ * TODO: removes calls to fiche.php?user=blah.machin.2083 and then removes this.
+ */
function handler_fiche(&$page)
{
return $this->handler_profile($page, Env::v('user'));
$view = 'private';
}
+ // Display pending picture
+ if (S::logged() && Env::v('modif') == 'new') {
+ $page->assign('with_pending_pic', true);
+ }
+
// Fetches profile's and profile's owner information and redirects to
// marketing if the owner has not subscribed and the requirer has logged in.
$profile = Profile::get($pid, Profile::FETCH_ALL, $view);
function handler_admin_education_degree(&$page, $action = 'list', $id = null) {
$page->setTitle('Administration - Niveau de formation');
$page->assign('title', 'Gestion des niveau de formation');
- $table_editor = new PLTableEditor('admin/education_degree', 'profile_education_degree_enum', 'id', true);
+ $table_editor = new PLTableEditor('admin/education_degree', 'profile_education_degree_enum', 'id');
$table_editor->add_join_table('profile_education_degree', 'degreeid', true);
$table_editor->add_join_table('profile_education', 'degreeid', true);
$table_editor->describe('degree', 'niveau', true);
private function cleanAddress(ProfilePage &$page, $addrid, array &$address)
{
- if (!isset($address['tel'])) {
- $address['tel'] = array();
- }
- $profiletel = new ProfileSettingPhones('address', $addrid);
- $address['tel'] = $profiletel->value($page, 'tel', $address['tel'], $s);
+ $address['tel'] = Phone::formatFormArray($address['tel'], $s);
$address['current'] = $this->bool->value($page, 'current', $address['current'], $s);
$address['temporary'] = $this->bool->value($page, 'temporary', $address['temporary'], $s);
$address['secondary'] = $this->bool->value($page, 'secondary', $address['secondary'], $s);
XDB::execute("DELETE FROM profile_addresses
WHERE pid = {?} AND type = 'home'",
$page->pid());
- XDB::execute("DELETE FROM profile_phones
- WHERE pid = {?} AND link_type = 'address'",
- $page->pid());
+ Phone::deletePhones($page->pid(), Phone::LINK_ADDRESS);
foreach ($value as $addrid => &$address) {
$this->saveAddress($page->pid(), $addrid, $address, 'home');
- $profiletel = new ProfileSettingPhones('address', $addrid);
- $profiletel->saveTels($page->pid(), 'tel', $address['tel']);
+ Phone::savePhones($address['tel'], $page->pid(), Phone::LINK_ADDRESS, $addrid);
+ }
+ }
+
+ public function getText($value) {
+ $addresses = array();
+ foreach ($value as $addrid => $address) {
+ $phones = Phone::formArrayToString($address['tel']);
+ $addresses[] = 'Adresse : ' . $address['text'] . ', affichage : ' . $address['pub']
+ . ', commentaire : ' . $address['comment'] . ', actuelle : ' . ($address['current'] ? 'oui' : 'non')
+ . ', temporaire : ' . ($address['temporary'] ? 'oui' : 'non') . ', secondaire : '
+ . ($address['secondary'] ? 'oui' : 'non') . ', conctactable par courier : '
+ . ($address['mail'] ? 'oui' : 'non') . ($phones ? ', ' . $phones : '');
}
+ return implode(' ; ' , $addresses);
}
}
$this->values['addresses'] = $res->fetchAllAssoc();
}
- $res = XDB::iterator("SELECT link_id AS addrid, tel_type AS type, pub, display_tel AS tel, comment
- FROM profile_phones
- WHERE pid = {?} AND link_type = 'address'
- ORDER BY link_id",
- $this->pid());
- $i = 0;
- $adrNb = count($this->values['addresses']);
- while ($tel = $res->next()) {
- $addrid = $tel['addrid'];
- unset($tel['addrid']);
- while ($i < $adrNb && $this->values['addresses'][$i]['id'] < $addrid) {
- $i++;
- }
- if ($i >= $adrNb) {
- break;
- }
- $address =& $this->values['addresses'][$i];
- if (!isset($address['tel'])) {
- $address['tel'] = array();
- }
- if ($address['id'] == $addrid) {
- $address['tel'][] = $tel;
- }
+ // Adds phones to addresses.
+ $it = Phone::iterate(array($this->pid()), array(Phone::LINK_ADDRESS));
+ while ($phone = $it->next()) {
+ $this->values['addresses'][$phone->linkId()]['tel'][$phone->id()] = $phone->toFormArray();
}
+
+ // Properly formats addresses.
foreach ($this->values['addresses'] as $id => &$address) {
+ $phone = new Phone();
if (!isset($address['tel'])) {
- $address['tel'] = array(
- 0 => array(
- 'type' => 'fixed',
- 'tel' => '',
- 'pub' => 'private',
- 'comment' => '',
- )
- );
+ $address['tel'] = array(0 => $phone->toFormArray());
}
unset($address['id']);
$address['changed'] = 0;
$address['removed'] = 0;
}
+ //var_dump($this->values['addresses']['tel']);
}
}
}
}
}
+
+ public function getText($value) {
+ $medalsList = DirEnum::getOptions(DirEnum::MEDALS);
+ $medals = array();
+ foreach ($value as $id => $medal) {
+ $medals[] = $medalsList[$id];
+ }
+ return implode(', ', $medals);
+ }
}
class ProfileSettingDecos extends ProfilePage
public function _prepare(PlPage &$page, $id)
{
- $res = XDB::iterator("SELECT *, FIND_IN_SET('validation', flags) AS validate
- FROM profile_medal_enum
- ORDER BY type, text");
- $mlist = array();
+ $res = XDB::iterator('SELECT *, FIND_IN_SET(\'validation\', flags) AS validate
+ FROM profile_medal_enum
+ ORDER BY type, text');
+ $mlist = array();
while ($tmp = $res->next()) {
$mlist[$tmp['type']][] = $tmp;
}
$page->assign('medal_list', $mlist);
- $trad = Array('ordre' => 'Ordres',
- 'croix' => 'Croix',
- 'militaire' => 'Médailles militaires',
- 'honneur' => 'Médailles d\'honneur',
- 'resistance' => 'Médailles de la résistance',
- 'prix' => 'Prix');
- $page->assign('trad', $trad);
+ $fullType = array(
+ 'ordre' => 'Ordres',
+ 'croix' => 'Croix',
+ 'militaire' => 'Médailles militaires',
+ 'honneur' => 'Médailles d\'honneur',
+ 'resistance' => 'Médailles de la résistance',
+ 'prix' => 'Prix',
+ 'sport' => 'Médailles sportives'
+ );
+ $page->assign('fullType', $fullType);
}
}
$value[] = $sn;
} while ($sn = $sn_all->next());
}
+ require_once 'validations.inc.php';
+ $namesRequest = ProfileValidate::get_typed_requests($page->pid(), 'usage');
+ if (count($namesRequest) > 0) {
+ Platal::page()->assign('validation', true);
+ }
$value = $this->clean($value);
} else {
require_once 'name.func.inc.php';
$display_names = array();
build_display_names($display_names, $this->search_names,
$page->profile->isFemale(), $this->private_name_end);
- set_profile_display($display_names, $page->pid());
+ set_profile_display($display_names, $page->profile);
+ }
+ }
+
+ public function getText($value) {
+ $names = array();
+ foreach ($value as $name) {
+ if ($name['name'] != '') {
+ $names[] = $name['type_name'] . ' : ' . $name['name'];
+ }
}
+ return implode(', ' , $names);
}
}
}
}
}
+
+ public function getText($value) {
+ $schoolsList = DirEnum::getOptions(DirEnum::EDUSCHOOLS);
+ $degreesList = DirEnum::getOptions(DirEnum::EDUDEGREES);
+ $fieldsList = DirEnum::getOptions(DirEnum::EDUFIELDS);
+ $educations = array();
+ foreach ($value as $education) {
+ $educations[] = 'Université : ' . $schoolsList[$education['eduid']]
+ . ', diplôme : ' . $degreesList[$education['degreeid']]
+ . ', domaine : ' . $fieldsList[$education['fieldid']]
+ . ', année d\'obtention : ' . $education['grad_year']
+ . ', intitulé : ' . $education['program'];
+ }
+ return implode(', ', $educations);
+ }
}
class ProfileSettingEmailDirectory implements ProfileSetting
}
return $value;
}
+
+ public function getText($value) {
+ return $value;
+ }
}
class ProfileSettingNetworking implements ProfileSetting
$page->pid(), $id, $network['type'], $network['address'], $network['pub']);
}
}
+
+ public function getText($value) {
+ $networkings = array();
+ foreach ($value as $network) {
+ $networkings[] = 'nom : ' . $network['name'] . ', adresse : ' . $network['address']
+ . ', affichage : ' . $network['pub'];
+ }
+ return implode(' ; ' , $networkings);
+ }
}
class ProfileSettingPromo implements ProfileSetting
}
return intval($value);
}
+
+ public function getText($value) {
+ return $value;
+ }
}
$this->settings['email_directory_new']
= new ProfileSettingEmailDirectory();
$this->settings['networking'] = new ProfileSettingNetworking();
- $this->settings['tels'] = new ProfileSettingPhones('user', 0);
+ $this->settings['tels'] = new ProfileSettingPhones();
$this->settings['edus'] = new ProfileSettingEdu();
$this->settings['promo'] = new ProfileSettingPromo();
$this->watched= array('freetext' => true, 'tels' => true,
{
// Checkout all data...
$res = XDB::query("SELECT p.nationality1, p.nationality2, p.nationality3, p.birthdate,
- pp.display_tel as mobile, pp.pub as mobile_pub,
p.email_directory as email_directory, pd.promo AS promo_display,
p.freetext, p.freetext_pub, p.ax_id AS matricule_ax, pd.yourself
FROM profiles AS p
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
- LEFT JOIN profile_phones AS pp ON (pp.pid = p.pid AND link_type = 'user')
WHERE p.pid = {?}", $this->pid());
$this->values = $res->fetchOneAssoc();
- if ($this->owner) {
- $this->values['yourself'] = $this->owner->displayName();
- }
// Retreive photo informations
$res = XDB::query("SELECT pub
$page->assign('edu_fields', $res->fetchAllAssoc());
require_once "emails.combobox.inc.php";
- fill_email_combobox($page, $this->owner, $this->profile);
+ fill_email_combobox($page, $this->owner);
$res = XDB::query("SELECT nw.nwid AS type, nw.name
FROM profile_networking_enum AS nw
WHERE pid = {?}",
$value, $page->pid());
}
+
+ public function getText($value) {
+ $sectionsList = DirEnum::getOptions(DirEnum::SECTIONS);
+ return $sectionsList[$value];
+ }
}
class ProfileSettingBinets implements ProfileSetting
XDB::execute("INSERT INTO profile_binets (pid, binet_id)
VALUES " . implode(',', $insert));
}
+
+ public function getText($value) {
+ return implode(', ', $value);
+ }
}
class ProfileSettingGroups extends ProfilePage
WHERE a.inscriptible != 0
AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
ORDER BY a.cat, a.dom, a.nom"));
- $page->assign('old', (int) date('Y') >= $page->profile->grad_year);
+ $page->assign('old', (int) date('Y') >= $this->profile->grad_year);
}
}
'changed' => '0',
'removed' => '0',
),
- 'hq_phone' => '',
+ 'hq_fixed' => '',
'hq_fax' => '',
'subSubSectorName' => null,
'sector' => '0',
$job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
$req->submit();
$job['jobid'] = null;
+ sleep(1);
} else {
$job['jobid'] = $res->fetchOneCell();
}
}
$job['w_address']['pub'] = $this->pub->value($page, 'address_pub', $job['w_address']['pub'], $s);
- if (!isset($job['w_phone'])) {
- $job['w_phone'] = array();
- }
- $profiletel = new ProfileSettingPhones('pro', $jobid);
- $job['w_phone'] = $profiletel->value($page, 'tel', $job['w_phone'], $s);
+ $job['w_phone'] = Phone::formatFormArray($job['w_phone'], $s);
unset($job['removed']);
unset($job['new']);
public function save(ProfilePage &$page, $field, $value)
{
- // TODO: use address and phone classes to update profile_job_enum and profile_phones once they are done.
-
- require_once 'profil.func.inc.php';
-
+ // TODO: use address class to update profile_job_enum once it is done.
XDB::execute("DELETE FROM profile_job
WHERE pid = {?}",
$page->pid());
XDB::execute("DELETE FROM profile_addresses
WHERE pid = {?} AND type = 'job'",
$page->pid());
- XDB::execute("DELETE FROM profile_phones
- WHERE pid = {?} AND link_type = 'pro'",
- $page->pid());
+ Phone::deletePhones($page->pid(), Phone::LINK_JOB);
foreach ($value as $id => &$job) {
if (isset($job['name']) && $job['name']) {
if (isset($job['jobid']) && $job['jobid']) {
}
$address = new ProfileSettingAddress();
$address->saveAddress($page->pid(), $id, $job['w_address'], 'job');
- $profiletel = new ProfileSettingPhones('pro', $id);
- $profiletel->saveTels($page->pid(), 'tel', $job['w_phone']);
+ Phone::savePhones($job['w_phone'], $page->pid(), Phone::LINK_JOB, $id);
}
}
}
+
+ public function getText($value) {
+ $jobs = array();
+ foreach ($value as $id => $job) {
+ $address = new ProfileSettingAddress();
+ $phones = Phone::formArrayToString($job['w_phone']);
+ $jobs[] = 'Entreprise : ' . $job['name'] . ', secteur : ' . $job['subSubSectorName']
+ . ', description : ' . $job['description'] . ', web : ' . $job['w_url']
+ . ', email : ' . $job['w_email']
+ . ($phones ? ', ' . $phones : '') . ', ' . $address->getText($job['w_address']);
+ }
+ return implode(' ; ' , $jobs);
+ }
+}
+
+class ProfileSettingCorps implements ProfileSetting
+{
+ public function value(ProfilePage &$page, $field, $value, &$success)
+ {
+ $success = true;
+ if (is_null($value)) {
+ $res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current,
+ rankid AS rank, corps_pub AS pub
+ FROM profile_corps
+ WHERE pid = {?}",
+ $page->pid());
+ return $res->fetchOneAssoc();
+ }
+ return $value;
+ }
+
+ public function save(ProfilePage &$page, $field, $value)
+ {
+ XDB::execute('REPLACE INTO profile_corps (original_corpsid, current_corpsid, rankid, corps_pub, pid)
+ VALUES ({?}, {?}, {?}, {?}, {?})',
+ $value['original'], $value['current'], $value['rank'], $value['pub'], $page->pid());
+ }
+
+ public function getText($value)
+ {
+ $corpsList = DirEnum::getOptions(DirEnum::CORPS);
+ $rankList = DirEnum::getOptions(DirEnum::CORPSRANKS);
+ return 'Corps actuel : ' . $corpsList[$value['current']] . ' , rang : ' . $corpsList[$value['rank']]
+ . ' , corps d\'origine : ' . $corpsList[$value['original']] . ' , affichage : ' . $value['pub'];
+ }
}
class ProfileSettingJobs extends ProfilePage
{
parent::__construct($wiz);
$this->settings['cv'] = null;
- $this->settings['corps'] = null;
+ $this->settings['corps'] = new ProfileSettingCorps();
$this->settings['jobs'] = new ProfileSettingJob();
$this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
}
$this->pid());
$this->values['cv'] = $res->fetchOneCell();
- // Checkout the corps
- $res = XDB::query("SELECT original_corpsid AS original, current_corpsid AS current,
- rankid AS rank, corps_pub AS pub
- FROM profile_corps
- WHERE pid = {?}",
- $this->pid());
- $this->values['corps'] = $res->fetchOneAssoc();
-
// Build the jobs tree
$res = XDB::iterRow("SELECT j.id, j.jobid, je.name, j.sectorid, j.subsectorid, j.subsubsectorid,
s.name, j.description, j.email, j.email_pub, j.url, j.pub,
);
}
- $res = XDB::iterator("SELECT link_id AS jobid, tel_type AS type, pub, display_tel AS tel, comment
- FROM profile_phones
- WHERE pid = {?} AND link_type = 'pro'
- ORDER BY link_id",
- $this->pid());
- $i = 0;
- $jobNb = count($this->values['jobs']);
- while ($phone = $res->next()) {
- $jobid = $phone['jobid'];
- while ($i < $jobNb && $this->values['jobs'][$i]['id'] < $jobid) {
- $i++;
- }
- if ($i >= $jobNb) {
- break;
- }
- $job =& $this->values['jobs'][$i];
- if (!isset($job['w_phone'])) {
- $job['w_phone'] = array();
- }
- if ($job['id'] == $jobid) {
- $job['w_phone'][] = $phone;
- }
+ $it = Phone::iterate(array($this->pid()), array(Phone::LINK_JOB));
+ while ($phone = $it->next()) {
+ $this->values['jobs'][$phone->linkId()]['w_phone'][$phone->id()] = $phone->toFormArray();
}
foreach ($this->values['jobs'] as $id => &$job) {
+ $phone = new Phone();
if (!isset($job['w_phone'])) {
- $job['w_phone'] = array(
- 0 => array(
- 'type' => 'fixed',
- 'tel' => '',
- 'pub' => 'private',
- 'comment' => '',
- )
- );
+ $job['w_phone'] = array(0 => $phone->toFormArray());
}
}
-
+
$job['w_email_new'] = '';
- if (!isset($job['hq_phone'])) {
- $job['hq_phone'] = '';
+ if (!isset($job['hq_fixed'])) {
+ $job['hq_fixed'] = '';
}
if (!isset($job['hq_fax'])) {
$job['hq_fax'] = '';
WHERE pid = {?}",
$this->values['cv'], $this->pid());
}
-
- if ($this->changed['corps']) {
- XDB::execute('REPLACE INTO profile_corps (original_corpsid, current_corpsid, rankid, corps_pub, pid)
- VALUES ({?}, {?}, {?}, {?}, {?})',
- $this->values['corps']['original'], $this->values['corps']['current'],
- $this->values['corps']['rank'], $this->values['corps']['pub'], $this->pid());
- }
}
public function _prepare(PlPage &$page, $id)
{
require_once 'emails.combobox.inc.php';
- fill_email_combobox($page, $this->owner, $this->profile);
+ fill_email_combobox($page, $this->owner);
$res = XDB::query("SELECT id, name AS label
FROM profile_job_sector_enum");
}
}
}
+
+ public function getText($value) {
+ $sectors = array();
+ foreach ($value as $sector) {
+ foreach ($sector as $subsector) {
+ $sectors[] = $subsector;
+ }
+ }
+ return implode(', ', $sectors);
+ }
}
class ProfileSettingCountry implements ProfileSetting
$page->pid(), $id);
}
}
+
+ public function getText($value) {
+ return implode(', ', $value);
+ }
}
$page->assign('countryList', XDB::iterator("SELECT iso_3166_1_a2, countryFR
FROM geoloc_countries
ORDER BY countryFR"));
+ $page->assign('hrpid', $this->profile->hrpid);
}
}
/** Save the new value for the given field.
*/
public function save(ProfilePage &$page, $field, $new_value);
+
+ /** Get text from the value.
+ */
+ public function getText($value);
}
abstract class ProfileNoSave implements ProfileSetting
{
public function save(ProfilePage &$page, $field, $new_value) { }
+
+ public function getText($value) {
+ return $value;
+ }
}
class ProfileSettingWeb extends ProfileNoSave
}
}
-
-class ProfileSettingTel extends ProfileNoSave
-{
- public function value(ProfilePage &$page, $field, $value, &$success)
- {
- if (is_null($value)) {
- return isset($page->values[$field]) ? $page->values[$field] : S::v($field);
- }
- require_once('profil.func.inc.php');
- $value = format_phone_number($value);
- if($value == '') {
- $success = true;
- return $value;
- }
- $value = format_display_number($value,$error);
- $success = !$error;
- if (!$success) {
- Platal::page()->trigError('Le préfixe international du numéro de téléphone est inconnu. ');
- }
- return $value;
- }
-}
-
class ProfileSettingPhones implements ProfileSetting
{
- private $tel;
- private $pub;
- protected $link_type;
- protected $link_id;
-
- public function __construct($type, $link_id)
- {
- $this->tel = new ProfileSettingTel();
- $this->pub = new ProfileSettingPub();
- $this->link_type = $type;
- $this->link_id = $link_id;
- }
-
public function value(ProfilePage &$page, $field, $value, &$success)
{
$success = true;
- if (is_null($value)) {
- $value = array();
- $res = XDB::iterator('SELECT display_tel AS tel, tel_type AS type, pub, comment
- FROM profile_phones
- WHERE pid = {?} AND link_type = {?}
- ORDER BY tel_id',
- $page->pid(), $this->link_type);
- if ($res->numRows() > 0) {
- $value = $res->fetchAllAssoc();
- } else {
- $value = array(
- 0 => array(
- 'type' => 'fixed',
- 'tel' => '',
- 'pub' => 'private',
- 'comment' => '',
- )
- );
- }
- }
+ $phones = array();
- foreach ($value as $key=>&$phone) {
- $phone['pub'] = $this->pub->value($page, 'pub', $phone['pub'], $s);
- $phone['tel'] = $this->tel->value($page, 'tel', $phone['tel'], $s);
- if(!isset($phone['type']) || ($phone['type'] != 'fixed' && $phone['type'] != 'mobile' && $phone['type'] != 'fax')) {
- $phone['type'] = 'fixed';
- $s = false;
- }
- if (!$s) {
- $phone['error'] = true;
- $success = false;
+ if (is_null($value)) {
+ $it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0));
+ while ($phone = $it->next()) {
+ $success = ($phone->format() && $success);
+ $phones[] = $phone->toFormArray();
}
- if (!isset($phone['comment'])) {
- $phone['comment'] = '';
+ if (count($phones) == 0) {
+ $phone = new Phone();
+ $phones[] = $phone->toFormArray();
}
+ return $phones;
}
- return $value;
- }
-
- private function saveTel($pid, $telid, array &$phone)
- {
- if ($phone['tel'] != '') {
- XDB::execute("INSERT INTO profile_phones (pid, link_type, link_id, tel_id, tel_type,
- search_tel, display_tel, pub, comment)
- VALUES ({?}, {?}, {?}, {?}, {?},
- {?}, {?}, {?}, {?})",
- $pid, $this->link_type, $this->link_id, $telid, $phone['type'],
- format_phone_number($phone['tel']), $phone['tel'], $phone['pub'], $phone['comment']);
- }
+ return Phone::formatFormArray($value, $success);
}
public function save(ProfilePage &$page, $field, $value)
{
- XDB::execute("DELETE FROM profile_phones
- WHERE pid = {?} AND link_type = {?} AND link_id = {?}",
- $page->pid(), $this->link_type, $this->link_id);
- $this->saveTels($page->pid(), $field, $value);
+ Phone::deletePhones($page->pid(), Phone::LINK_PROFILE);
+ Phone::savePhones($value, $page->pid(), Phone::LINK_PROFILE);
}
- //Only saves phones without a delete operation
- public function saveTels($pid, $field, $value)
- {
- foreach ($value as $telid=>&$phone) {
- $this->saveTel($pid, $telid, $phone);
- }
+ public function getText($value) {
+ return Phone::formArrayToString($value);
}
}
}
return $value;
}
+
+ public function getText($value) {
+ return $value;
+ }
}
class ProfileSettingBool extends ProfileNoSave
$address = $gmapsGeocoder->stripGeocodingFromAddress($address);
}
}
+
+ public function getText($value) {
+ return $value;
+ }
}
protected function saveData()
{
require_once 'notifs.inc.php';
+ $changedFields = array();
foreach ($this->settings as $field=>&$setting) {
- if (!is_null($setting) && $this->changed[$field]) {
- $setting->save($this, $field, $this->values[$field]);
- }
- if ($this->changed[$field] && @$this->watched[$field]) {
- WatchProfileUpdate::register($this->profile, $field);
+ if ($this->changed[$field]) {
+ if (!is_null($setting)) {
+ $changedFields[$field] = array(
+ str_replace("\n", " - ", $setting->getText($this->orig[$field])),
+ str_replace("\n", " - ", $setting->getText($this->values[$field])),
+ );
+ } else {
+ $changedFields[$field] = array(
+ str_replace("\n", " - ", $this->orig[$field]),
+ str_replace("\n", " - ", $this->values[$field]),
+ );
+ }
+ if (!is_null($setting)) {
+ $setting->save($this, $field, $this->values[$field]);
+ }
+ if (isset($this->watched[$field]) && $this->watched[$field]) {
+ WatchProfileUpdate::register($this->profile, $field);
+ }
}
}
$this->_saveData();
WHERE pid = {?}', $this->pid());
global $platal;
S::logger()->log('profil', $platal->pl_self(2));
+
+ /** If the update was made by a third party and the profile corresponds
+ * to a registered user, stores both former and new text.
+ * This will be daily sent to the user.
+ */
+ $owner = $this->profile->owner();
+ $user = S::user();
+ if ($owner->isActive() && $owner->id() != $user->id()) {
+ foreach ($changedFields as $field => $values) {
+ XDB::execute('REPLACE INTO profile_modifications (pid, uid, field, oldText, newText)
+ VALUES ({?}, {?}, {?}, {?}, {?})',
+ $this->pid(), $user->id(), $field, $values[0], $values[1]);
+ }
+ }
}
protected function checkChanges()
$page->pid(), $id, $skill['level']);
}
}
+
+ public function getText($value) {
+ $skills = array();
+ foreach ($value as $skill) {
+ $skills[] = 'Compétance : ' . $skill['text'] . ', niveau : ' . $skill['level'];
+ }
+ return implode(' ; ' , $skills);
+ }
}
class ProfileSettingSkills extends ProfilePage
$subState->set('services', $services);
// Validate the password.
- if (!Post::v('response2', false)) {
+ if (!Post::v('pwhash', false)) {
$error[] = "Le mot de passe n'est pas valide.";
}
$subState->set('birthdate', sprintf("%04d-%02d-%02d",
intval($birth[2]), intval($birth[1]), intval($birth[0])));
$subState->set('email', Post::t('email'));
- $subState->set('password', Post::t('response2'));
+ $subState->set('password', Post::t('pwhash'));
// Update the current alert if the birthdate is incorrect,
// or if the IP address of the user has been banned.
}
$page->changeTpl('register/step' . $subState->i('step') . '.tpl');
- $page->addJsLink('motdepasse.js');
+ $page->addJsLink('password.js');
if (isset($error)) {
$page->trigError($error);
}
//
XDB::execute("UPDATE accounts
SET password = {?}, state = 'active',
- registration_date = NOW()
+ registration_date = NOW(), email = NULL
WHERE uid = {?}", $password, $uid);
XDB::execute("UPDATE profiles
SET birthdate = {?}, last_change = NOW()
{
return array(
'search' => $this->make_hook('quick', AUTH_PUBLIC),
- 'search/adv' => $this->make_hook('advanced', AUTH_COOKIE),
+ 'search/adv' => $this->make_hook('advanced', AUTH_COOKIE, 'directory_ax'),
'advanced_search.php' => $this->make_hook('redir_advanced', AUTH_PUBLIC),
- 'search/autocomplete' => $this->make_hook('autocomplete', AUTH_COOKIE, 'user', NO_AUTH),
- 'search/list' => $this->make_hook('list', AUTH_COOKIE, 'user', NO_AUTH),
+ 'search/autocomplete' => $this->make_hook('autocomplete', AUTH_COOKIE, 'directory_ax', NO_AUTH),
+ 'search/list' => $this->make_hook('list', AUTH_COOKIE, 'directory_ax', NO_AUTH),
);
}
if ($nb_tot > $globals->search->private_max) {
$this->form_prepare();
$page->trigError('Recherche trop générale.');
+ } else if ($nb_tot == 0) {
+ $this->form_prepare();
+ $page->trigError('Il n\'existe personne correspondant à ces critères dans la base !');
}
}
$page->assign('cat', $cat);
$page->assign('dom', $dom);
- $res = XDB::query("SELECT id,nom
+ $res = XDB::query("SELECT id,nom
FROM group_dom
WHERE FIND_IN_SET({?}, cat)
ORDER BY nom", $cat);
}
if ($updated !== false) {
$page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.');
- subscribe_lists_event($total, S::i('uid'), $evt, $paid);
+ subscribe_lists_event(S::i('uid'), $evt, ($total > 0 ? 1 : 0), 0);
}
$page->assign('event', get_event_detail($eid));
}
// change the price paid by a participant
if (Env::v('adm') == 'prix' && $member) {
+ $amount = strtr(Env::v('montant'), ',', '.');
XDB::execute("UPDATE group_event_participants
SET paid = paid + {?}
WHERE uid = {?} AND eid = {?} AND item_id = 1",
- strtr(Env::v('montant'), ',', '.'),
- $member->uid, $evt['eid']);
+ $amount, $member->uid, $evt['eid']);
+ subscribe_lists_event($member->uid, $evt, 1, $amount);
}
// change the number of personns coming with a participant
foreach ($nbs as $id => $nb) {
$nb = max(intval($nb), 0);
- XDB::execute("REPLACE INTO group_event_participants
- VALUES ({?}, {?}, {?}, {?}, {?}, {?})",
- $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
+ XDB::execute('REPLACE INTO group_event_participants
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?})',
+ $evt['eid'], $member->uid, $id, $nb, '', $id == 1 ? $paid : 0);
}
- $res = XDB::query("SELECT COUNT(uid) AS cnt, SUM(nb) AS nb
- FROM group_event_participants
- WHERE uid = {?} AND eid = {?}
- GROUP BY uid",
- $member->uid, $evt['eid']);
+ $res = XDB::query('SELECT COUNT(uid) AS cnt, SUM(nb) AS nb
+ FROM group_event_participants
+ WHERE uid = {?} AND eid = {?}
+ GROUP BY uid',
+ $member->uid, $evt['eid']);
$u = $res->fetchOneAssoc();
if ($u['cnt'] == 1 && $paid == 0 && Post::v('cancel')) {
XDB::execute("DELETE FROM group_event_participants
WHERE uid = {?} AND eid = {?}",
$member->uid, $evt['eid']);
$u = 0;
+ subscribe_lists_event($member->uid, $evt, -1, $paid);
} else {
+ var_dump($u);
$u = $u['cnt'] ? $u['nb'] : null;
+ subscribe_lists_event($member->uid, $evt, ($u > 0 ? 1 : 0), $paid);
}
- subscribe_lists_event($u, $member->uid, $evt, $paid);
}
$evt = get_event_detail($eid, $item_id);
$page->assign('absents', $absents);
$page->assign('participants',
get_event_participants($evt, $item_id, UserFilter::sortByName(),
- new PLLimit(NB_PER_PAGE), $ofs * NB_PER_PAGE));
+ NB_PER_PAGE, $ofs * NB_PER_PAGE));
}
}
WHERE ep.eid = {?} AND nb > 0 ' . $append . '
GROUP BY ep.uid', $eid);
$uf = new UserFilter(new PFC_True(), $tri);
- $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), $count, $offset));
+ $users = User::getBulkUsersWithUIDs($uf->filter(array_keys($query), new PlLimit($count, $offset)));
$tab = array();
foreach ($users as $user) {
$uid = $user->id();
// }}}
// {{{ function subscribe_lists_event()
-function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
+/** Subscribes user to various event related mailing lists.
+ *
+ * @param $uid: user's id.
+ * @param evt: events data, in particular ids of the lists at stake.
+ * @param participate: indicates if the user takes part at the event or not;
+ * -1 means he did not answer, 0 means no, and 1 means yes.
+ * @param paid: has the user already payed anything?
+ * 0 means no, a positive amount means yes.
+ * @param payment: is this function called from a payment page?
+ * If true, only payment related lists should be updated.
+ */
+function subscribe_lists_event($uid, $evt, $participate, $paid, $payment = false)
{
- global $globals;
- $page =& Platal::page();
-
$participant_list = $evt['participant_list'];
$absent_list = $evt['absent_list'];
$unpayed_list = $evt['booked_unpayed_list'];
function subscribe($list, $email)
{
if ($list && $email) {
- XDB::execute("REPLACE INTO virtual_redirect
- VALUES ({?},{?})",
+ XDB::execute('REPLACE INTO virtual_redirect
+ VALUES ({?}, {?})',
$list, $email);
}
}
function unsubscribe($list, $email)
{
if ($list && $email) {
- XDB::execute("DELETE FROM virtual_redirect
- WHERE vid = {?} AND redirect = {?}",
+ XDB::execute('DELETE FROM virtual_redirect
+ WHERE vid = {?} AND redirect = {?}',
$list, $email);
}
}
- if (is_null($payment)) {
- if (is_null($participate)) {
+ /** If $payment is not null, we do not retrieve the value of $participate,
+ * thus we do not alter participant and absent lists.
+ */
+ if ($payment === true) {
+ if ($paid > 0) {
+ unsubscribe($unpayed_list, $email);
+ subscribe($payed_list, $email);
+ }
+ } else {
+ switch ($participate) {
+ case -1:
unsubscribe($participant_list, $email);
+ unsubscribe($unpayed_list, $email);
+ unsubscribe($payed_list, $email);
subscribe($absent_list, $email);
- } elseif ($participate) {
- subscribe($participant_list, $email);
- unsubscribe($absent_list, $email);
- } else {
+ break;
+ case 0:
unsubscribe($participant_list, $email);
unsubscribe($absent_list, $email);
- }
- }
- if ($paid > 0) {
- unsubscribe($unpayed_list, $email);
- subscribe($payed_list, $email);
- } else {
- unsubscribe($payed_list, $email);
- if (!is_null($participate)) {
- subscribe($unpayed_list, $email);
+ unsubscribe($unpayed_list, $email);
+ unsubscribe($payed_list, $email);
+ break;
+ case 1:
+ subscribe($participant_list, $email);
+ unsubscribe($absent_list, $email);
+ if ($paid > 0) {
+ unsubscribe($unpayed_list, $email);
+ subscribe($payed_list, $email);
+ } else {
+ subscribe($unpayed_list, $email);
+ unsubscribe($payed_list, $email);
+ }
+ break;
}
}
}
Env::i('unread'), S::i('uid'));
pl_redirect("#art" . Env::i('unread'));
}
- // XXX: Fix promo_min; promo_max
- $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo
+
+ /* TODO: refines this filter on promotions by using userfilter. */
+ $user = S::user();
+ if ($user->hasProfile()) {
+ $promo = XDB::format('{?}', $user->profile()->entry_year);
+ $minCondition = ' OR promo_min <= ' . $promo;
+ $maxCondition = ' OR promo_max >= ' . $promo;
+ } else {
+ $minCondition = '';
+ $maxCondition = '';
+ }
+ $arts = XDB::iterator('SELECT a.*, FIND_IN_SET(\'photo\', a.flags) AS photo
FROM group_announces AS a
LEFT JOIN group_announces_read AS r ON (r.uid = {?} AND r.announce_id = a.id)
WHERE asso_id = {?} AND expiration >= CURRENT_DATE()
- AND (promo_min = 0 OR promo_min <= {?})
- AND (promo_max = 0 OR promo_max >= {?})
+ AND (promo_min = 0' . $minCondition . ')
+ AND (promo_max = 0' . $maxCondition . ')
AND r.announce_id IS NULL
- ORDER BY a.expiration",
- S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
- $index = XDB::iterator("SELECT a.id, a.titre, r.uid IS NULL AS nonlu
+ ORDER BY a.expiration',
+ S::i('uid'), $globals->asso('id'));
+ $index = XDB::iterator('SELECT a.id, a.titre, r.uid IS NULL AS nonlu
FROM group_announces AS a
LEFT JOIN group_announces_read AS r ON (a.id = r.announce_id AND r.uid = {?})
WHERE asso_id = {?} AND expiration >= CURRENT_DATE()
- AND (promo_min = 0 OR promo_min <= {?})
- AND (promo_max = 0 OR promo_max >= {?})
- ORDER BY a.expiration",
- S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
+ AND (promo_min = 0' . $minCondition . ')
+ AND (promo_max = 0' . $maxCondition . ')
+ ORDER BY a.expiration',
+ S::i('uid'), $globals->asso('id'));
$page->assign('article_index', $index);
} else {
$arts = XDB::iterator("SELECT *, FIND_IN_SET('photo', flags) AS photo
$platal->ns . "rss/rss.xml");
} else {
$page->setRssLink("Polytechnique.net :: {$globals->asso("nom")} :: News",
- $platal->ns . 'rss/'.S::v('hruid') .'/'.S::v('token').'/rss.xml');
+ $platal->ns . 'rss/' . S::v('hruid') . '/' . S::user()->token . '/rss.xml');
}
$page->assign('articles', $arts);
S::assert_xsrf_token();
- // Finds or creates account
+ // Finds or creates account: first cases are for users with an account.
if (!User::isForeignEmailAddress($email)) {
- // standard x account
+ // Standard account
$user = User::get($email);
} else if (!isvalid_email($email)) {
// email might not be a regular email but an alias or a hruid
$user = User::get($email);
if (!$user) {
// need a valid email address
- $page->trigError("« <strong>$email</strong> » n'est pas une adresse email valide.");
+ $page->trigError('« <strong>' . $email . '</strong> » n\'est pas une adresse email valide.');
return;
}
} else if (Env::v('x') && Env::i('userid')) {
- // user is an x but might not yet be registered
$user = User::getWithUID(Env::i('userid'));
if (!$user) {
- $page->trigError("Utilisateur invalide");
+ $page->trigError('Utilisateur invalide.');
return;
}
- // add email for marketing if unknown
- if ($user->state == 'pending' && Env::v('market')) {
- $market = Marketing::get($user->uid, $email);
- if (!$market) {
- $market = new Marketing($user->uid, $email, 'group', $globals->asso('nom'),
- Env::v('market_from'), S::v('uid'));
- $market->add();
+
+ // User has an account but is not yet registered.
+ if ($user->state == 'pending') {
+ // Add email in account table.
+ XDB::query('UPDATE accounts
+ SET email = {?}
+ WHERE uid = {?} AND email IS NULL',
+ Post::t('email'), $user->id());
+ // Add email for marketing if required.
+ if (Env::v('market')) {
+ $market = Marketing::get($user->uid, $email);
+ if (!$market) {
+ $market = new Marketing($user->uid, $email, 'group', $globals->asso('nom'),
+ Env::v('market_from'), S::v('uid'));
+ $market->add();
+ }
}
}
} else {
- // user is not an x
- $hruid = strtolower(str_replace('@','.',$email).'.ext');
- // might already exists (in another group for example)
+ // User is of type xnet.
+ list($firstname, $lastname) = explode('@', $email);
+ $hruid = User::makeHrid($firstname, $lastname, 'ext');
+ // User might already have an account (in another group for example).
$user = User::get($hruid);
+
+ // If the user has no account yet, creates new account: build names from email address.
if (empty($user)) {
- // creates new account: build names from email address
$display_name = ucwords(strtolower(substr($hruid, strpos('.', $hruid))));
- $full_name = ucwords(strtolower(str_replace('.', ' ',substr($email, strpos('@', $email)))));
- XDB::execute("INSERT INTO accounts (hruid, display_name, full_name, email, type)
- VALUES({?}, {?}, {?}, {?}, 'xnet')",
- $hruid, $display_name, $full_name, $email);
+ $full_name = ucwords(strtolower(str_replace('.', ' ', substr($email, strpos('@', $email)))));
+ XDB::execute('INSERT INTO accounts (hruid, display_name, full_name, email, type)
+ VALUES ({?}, {?}, {?}, {?}, \'xnet\')',
+ $hruid, $display_name, $full_name, $email);
$user = User::get($hruid);
}
}
+
if ($user) {
- XDB::execute("REPLACE INTO group_members (uid, asso_id)
- VALUES ({?}, {?})",
+ XDB::execute('REPLACE INTO group_members (uid, asso_id)
+ VALUES ({?}, {?})',
$user->id(), $globals->asso('id'));
$this->removeSubscriptionRequest($user->id());
- pl_redirect("member/" . $user->login());
+ pl_redirect('member/' . $user->login());
}
}
}
}
if (empty($users)) {
- list($nom, $prenom) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
+ list($lastname, $firstname) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
$cond = new PFC_And(new PFC_Not(new UFC_Registered()));
- if (!empty($nom)) {
- $cond->addChild(new UFC_Name(Profile::LASTNAME, $nom, UFC_Name::CONTAINS));
+ if (!empty($lastname)) {
+ $cond->addChild(new UFC_Name(Profile::LASTNAME, $lastname, UFC_Name::CONTAINS));
}
- if (!empty($prenom)) {
- $cond->addChild(new UFC_Name(Profile::FIRSTNAME, $prenom, UFC_Name::CONTAINS));
+ if (!empty($firstname)) {
+ $cond->addChild(new UFC_Name(Profile::FIRSTNAME, $firstname, UFC_Name::CONTAINS));
}
- if (Env::i('promo')) {
- $cond->addChild(new UFC_Promo('=', UserFilter::GRADE_ING, Env::i('promo')));
+ if (Env::t('promo')) {
+ $cond->addChild(new UFC_Promo('=', UserFilter::DISPLAY, Env::t('promo')));
}
$uf = new UserFilter($cond);
$users = $uf->getUsers(new PlLimit(30));
private function changeLogin(PlPage &$page, PlUser &$user, MMList &$mmlist, $login)
{
- // Search the uid of the user...
+ // Search the user's uid.
$xuser = User::getSilent($login);
if (!$xuser) {
$accounts = User::getPendingAccounts($login);
return false;
}
$xuser = User::getSilent($accounts[0]['uid']);
- $sub = false;
}
if (!$xuser) {
return false;
}
- $user->mergeIn($xuser);
-
- return $xuser->login();
+ if ($user->mergeIn($xuser)) {
+ return $xuser->login();
+ }
+ return $user->login();
}
function handler_admin_member(&$page, $user)
$from_email = $user->forlifeEmail();
if (!$user->profile()) {
XDB::query('UPDATE accounts
- SET full_name = {?}, display_name = {?}, sex = {?}, email = {?}, type = {?}
+ SET full_name = {?}, directory_name = {?}, display_name = {?},
+ sex = {?}, email = {?}, type = {?}
WHERE uid = {?}',
- Post::v('full_name'), Post::v('display_name'), (Post::v('sex') == 'male')?'male':'female', Post::v('email'), (Post::v('type') == 'xnet')?'xnet':'virtual',
- $user->id());
- if (XDB::affectedRows()) {
- $page->trigSuccess('Données de l\'utilisateur mise à jour.');
- }
+ Post::t('full_name'), Post::t('directory_name'), Post::t('display_name'),
+ (Post::t('sex') == 'male') ? 'male' : 'female', Post::t('email'),
+ (Post::t('type') == 'xnet') ? 'xnet' : 'virtual', $user->id());
+ } else if (!$user->perms) {
+ XDB::query('UPDATE accounts
+ SET email = {?}
+ WHERE uid = {?}',
+ Post::t('email'), $user->id());
+ }
+ if (XDB::affectedRows()) {
+ $page->trigSuccess('Données de l\'utilisateur mise à jour.');
}
// Update group params for user
WHERE uid = {?} AND asso_id = {?}',
($perms == 'admin') ? 'admin' : 'membre', $comm,
$user->id(), $globals->asso('id'));
- if ($perms != $user->group_perms) {
- $page->trigSuccess('Permissions modifiées !');
- }
- if ($comm != $user->group_comm) {
- $page->trigSuccess('Commentaire mis à jour.');
+ if (XDB::affectedRows()) {
+ if ($perms != $user->group_perms) {
+ $page->trigSuccess('Permissions modifiées !');
+ }
+ if ($comm != $user->group_comm) {
+ $page->trigSuccess('Commentaire mis à jour.');
+ }
}
}
$user = User::getWithUID($user);
}
- $name = pl_entities($user->fullName());
+ $name = pl_entities($user->directoryName());
if ($with_sex && $user->isFemale()) {
$name = '•' . $name;
}
$name = '<a href="profile/' . $profile->hrid() . '" class="popup2">' . $name . '</a>';
}
}
+ if ($user->lost) {
+ $name .= ' <a href="https://www.polytechnique.org/marketing/broken/' . $user->hruid . '"><img src="images/icons/error.gif" alt="Patte cassée" /></a>';
+ }
if ($with_groupperms && $user instanceof User && $user->group_perms == 'admin' && !empty($name)) {
$name = '<strong>' . $name . '</strong>';
}
global $globals;
$id = Cookie::i('uid', -1);
- $id = S::v($_SESSION['uid'], $id);
+ $id = S::v('uid', $id);
if ($id < 0) {
return '';
<td>
Promotion :
<input type="text" name="promo" value="{$promo}" size="5" maxlength="5" />
- <input type="submit" value="GO" />
+ <input type="submit" value="Afficher" />
</td>
</tr>
</table>
</form>
-{if t($decedes)}
+{if t($profileList)}
<form action="admin/deaths/{$promo}/validate" id="deathDateList" method="post">
{xsrf_token_field}
<table class="bicol" summary="liste des dates de décès">
<th>Nom</th>
<th>Date de décès</th>
</tr>
- {iterate item=x from=$decedes}
+ {iterate item=profile from=$profileList}
<tr class="{cycle values="impair,pair"}">
- <td>{$x.directory_name}</td>
+ <td>{$profile.directory_name}</td>
<td class="center">
- <input type="text" class="deathDate" name="death_{$x.pid}" value="{$x.deathdate}" size="10" maxlength="10" />
+ <input type="text" name="death_{$profile.pid}" value="{$profile.deathdate}" size="10" maxlength="10" />
</td>
</tr>
{/iterate}
</tr>
</table>
</form>
-
-<script type="text/javascript">//<![CDATA[
- {literal}
- $('input.deathDate').change(function () {
- $(this).addClass('sendDate');
- });
-
- $('#deathDateList').submit(function () {
- // Avoid sending useless data to the webserver
- $('input.deathDate').not('.sendDate').attr('disabled', true);
- });
- {/literal}
-//]]></script>
{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
|
<a href="admin/icons">Icônes</a>
|
- <a href="sql_errors">Erreurs MySQL</a>
+ <a href="site_errors">Erreurs d'exécution</a>
</td>
</tr>
<tr class="impair">
<td class="titre">Comptes</td>
<td>
+ <a href="admin/account/types">Types de comptes</a>
+ |
<a href="admin/add_accounts">Ajout de comptes</a>
|
<a href="admin/user">Édition</a>
<script type="text/javascript">
//<![CDATA[
-function doEditUser() {
- document.forms.auth.hashpass.value = hash_encrypt(document.forms.edit.password.value);
- document.forms.auth.password.value = "";
- document.forms.auth.submit();
-}
-
function del_alias(alias) {
document.forms.alias.del_alias.value = alias;
document.forms.alias.submit();
<tr>
<th colspan="2">
<div style="float: right; text-align: right">
+ {if $user->state eq 'pending'}
+ Non-inscrit
+ {else}
Inscrit le {$user->registration_date|date_format}
+ {/if}
</div>
<div style="float: left; text-align: left">
{icon name=user_gray} {$user->hruid} (uid {$user->id()})
</tr>
<tr>
<td class="titre">Nom complet</td>
- <td><input type="text" name="full_name" maxlength="255" value="{$user->fullName()}" /></td>
+ <td>{if $hasProfile}{$user->fullName()}{else}<input type="text" name="full_name" maxlength="255" value="{$user->fullName()}" />{/if}</td>
+ </tr>
+ <tr>
+ <td class="titre">Nom annuaire</td>
+ <td>{if $hasProfile}{$user->directoryName()}{else}<input type="text" name="directory_name" maxlength="255" value="{$user->directoryName()}" />{/if}</td>
</tr>
<tr>
<td class="titre">Nom affiché</td>
- <td><input type="text" name="display_name" maxlength="255" value="{$user->displayName()}" /></td>
+ <td>{if $hasProfile}{$user->displayName()}{else}<input type="text" name="display_name" maxlength="255" value="{$user->displayName()}" />{/if}</td>
</tr>
<tr>
<td class="titre">Sexe</td>
<td class="titre">Mot de passe</td>
<td>
<div style="float: left">
- <input type="text" name="newpass_clair" size="10" maxlength="256" value="********" />
- <input type="hidden" name="hashpass" value="" />
+ <input type="text" name="new_plain_password" size="10" maxlength="256" value="********" />
+ <input type="hidden" name="pwhash" value="" />
</div>
<div style="float: left; margin-top: 5px;">
- {checkpasswd prompt="newpass_clair" submit="dummy_none"}
+ {checkpasswd prompt="new_plain_password" submit="dummy_none"}
</div>
</td>
</tr>
</tr>
<tr class="impair">
<td colspan="2" class="center">
- {* TODO: on 'update_account', update the hashpass field before sending the form. *}
- <input type="submit" name="update_account" value="Mettre à jour" />
+ <input type="submit" name="update_account" value="Mettre à jour" onclick="return hashResponse('new_plain_password', false, false);" />
<input type="submit" name="su_account" value="Prendre l'identité" />
<input type="submit" name="log_account" value="Consulter les logs" />
</td>
{to addr=#to#}
{subject text="INTERVENTION de $admin"}
{elseif $mail_part eq 'wiki'}
-{if $deletion}
-L'utilisateur {$user} a été désinscrit de plat/al.
-{else}
-Le profil du camarade {$old.prenom} {$old.nom} ({$old.promo}) a été édité.\\
+
+Le compte de l'utilisateur {$hruid} a été édité.\\
Les champs suivants ont été changés :
-{foreach from=$old item=value key=field}
-{if $value neq $new[$field]}
-* '''{$field}''' : {$value} -> {$new[$field]}
-{/if}
+{foreach from=$diff item=values key=field}
+* '''{$field}''' : {$values.0} -> {$values.1}
{/foreach}
Et ceux qui n'ont pas changé :
-{foreach from=$old item=value key=field}
-{if $value eq $new[$field]}
+{foreach from=$oldValues item=value key=field}
* '''{$field}''' : {$value}
-{/if}
{/foreach}
{/if}
-{/if}
{* vim:set et sw=2 sts=2 sws=2: *}
<tr>
<td class="titre" style="width: 20%">Demandeur :</td>
<td>
- <a href="profile/{$valid->user->login()}" class="popup2">
- {$valid->user->fullName()} ({$valid->user->promo()})
+ {if $valid->user->hasProfile()}
+ {assign var="profile" value=$valid->user->profile()}
+ <a href="profile/{$profile->hrpid}" class="popup2">
+ {/if}
+ {$valid->user->fullName("promo")}
</a>
</td>
</tr>
- {if $valid->profile}
+ {if $valid->profile && !$valid->userIsProfileOwner}
<tr>
<td class="titre" style="width: 20%">Profil concerné :</td>
<td>
function toggle_folder() {
me = this;
if ($(this).attr("class") == "wiki_category")
- me = $("../img.wiki_root", me)[0];
+ me = $("../img.wiki_root", me)[0];
var cat=$.trim($(me).parent().text().replace(/(.*)\([0-9]+\)/, "$1"));
if ($(me).attr('src') == "images/k1.gif") {
- deplie(me, cat);
+ deplie(me, cat);
}
replie(me, cat);
setTimeout("toggle = 0;", 10);
{/literal}
<p class="center">
- <a href="Site/AllRecentChanges?action=rss&user={$smarty.session.hruid}&hash={$smarty.session.token}" style="display:block;float:right" title="Changements">{icon name=feed title='fil rss'}</a>
+ <a href="Site/AllRecentChanges?action=rss&user={$smarty.session.hruid}&hash={$smarty.session.user->token}" style="display:block;float:right" title="Changements">{icon name=feed title='fil rss'}</a>
{icon name=magnifier} <a href="Site/AllRecentChanges">Voir les changements récents</a>
</p>
{if $is_mail}
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
<title>Lettre d'information de l'AX</title>
<style type="text/css">
{literal}
Votre désinscription aux envois exceptionnels de l'AX a été réalisée avec
succès. Si vous désirez vous réinscrire, merci de contacter
<a href="mailto:info@amicale.polytechnique.org">l'AX</a>. Vous pouvez également
- le faire en vous <a href="register">inscrivant à Polytechnique.org</a> (pour
+ le faire en vous <a href="register">inscrivant à Polytechnique.org</a> (pour
les X uniquement).
</p>
{else}
<table class="bicol">
<tr>
<th colspan="2">
- {if $smarty.session.token}
- <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Notifications">
+ {if $smarty.session.user->token}
+ <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Notifications">
{icon name=feed title='fil rss'}
</a>
{else}
</li>
<li>
Le calendrier des anniversaires :
- <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.token}/anniv-x.ics">
+ <a href="carnet/contacts/ical/{$smarty.session.hruid}/{$smarty.session.user->token}/anniv-x.ics">
{icon name=calendar_view_day title='Anniversaires au format iCal'}
</a>
- <a href="carnet/contacts/csv/birthday/{$smarty.session.hruid}/{$smarty.session.token}/anniv-x.csv">
+ <a href="carnet/contacts/csv/birthday/{$smarty.session.hruid}/{$smarty.session.user->token}/anniv-x.csv">
{icon name=outlook title='Anniversaires au format Outlook'}
</a>
</li>
{icon name=vcard title='Carte de visite au format vCard'}
</a>
(<a href="carnet/contacts/vcard/MesContactsXorg.vcf">sans les photos</a>)
- <a href="carnet/contacts/csv/{$smarty.session.hruid}/{$smarty.session.token}/MesContactsXorg.csv">
+ <a href="carnet/contacts/csv/{$smarty.session.hruid}/{$smarty.session.user->token}/MesContactsXorg.csv">
{icon name=outlook title='Contacts au format Outlook'}
</a>
</li>
</p>
<div class="right">
-{if $smarty.session.token}
-<a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
+{if $smarty.session.user->token}
+<a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
{/if}
</div>
{* *}
{**************************************************************************}
-{if $referer || $platal->pl_self() neq 'login'}
+{if t($referer) || $platal->pl_self() neq 'login'}
<h1>
Accès restreint
</h1>
<td>
<input type="text" name="username" size="20" maxlength="50" value="{insert name="getUserName"}" /> @ <select name="domain">
<option value="login">{#globals.mail.domain#} / {#globals.mail.domain2#}</option>
- <option value="alias" {if $smarty.cookies.ORGdomain eq alias}selected="selected"{/if}>
+ <option value="alias" {if t($smarty.cookies.ORGdomain) eq "alias"}selected="selected"{/if}>
{#globals.mail.alias_dom#} / {#globals.mail.alias_dom2#}
</option>
</select>
en clair entre chez toi et Polytechnique.org, ce qui assure une confidentialité maximale.
{else}
{icon name=lock_open} Tu utilises actuellement une connexion HTTP non sécurisée. Toutes les informations
- (<strong>excepté le mot de passe de connexion au site</strong>) circulent en clair entre chez toi et
+ (<strong>excepté le mot de passe de connexion au site</strong>) circulent en clair entre chez toi et
Polytechnique.org. Tu peux basculer sur une connexion sécurisée en cliquant sur le lien
<div class="center">
<a href="https://{#globals.core.secure_domain#}{$smarty.server.REQUEST_URI}">
{/if}
{if $vcard.tels}
{foreach item=tel from=$vcard.tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.tel|vcard_enc}
+{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.display|vcard_enc}
{/foreach}
{/if}
{if $vcard.adr_pro}
{/if}
{if $vcard.adr_pro[0].tels}
{foreach item=tel from=$vcard.adr_pro[0].tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,work{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=work{/if}:{$tel.tel|vcard_enc}
+{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,work{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=work{/if}:{$tel.display|vcard_enc}
{/foreach}
{/if}
ADR;TYPE=work:{format_adr adr=$vcard.adr_pro[0]}
ADR;TYPE=home{if $adr.courier},postal{/if}:{format_adr adr=$adr}
{if $adr.tels}
{foreach item=tel from=$adr.tels}
-{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,home{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.tel|vcard_enc}
+{if $tel.tel_type eq 'mobile'}TEL;TYPE=cell,home{else}{if $tel.tel_type eq 'fax'}FAX{else}TEL{/if};TYPE=home{/if}:{$tel.display|vcard_enc}
{/foreach}
{/if}
{/foreach}
<h2>Patte cassée</h2>
<p>
Désolé, mais ton correspondant, {$x.user->fullName()},
- n'a actuellement <span class="erreur">aucune adresse email de redirection
+ n'a actuellement <span class="erreur">aucune adresse email de redirection
active autre que celle que tu viens de rentrer.</span>
Nous t'invitons à prendre contact avec lui autrement que par email,
l'idéal étant de l'informer si possible que sa patte Polytechnique.org est cassée !
{if $ok}
<p>
- {if $sexe}Chère{else}Cher{/if} {$prenom},
+ {if $sexe}Chère{else}Cher{/if} {$yourself},
</p>
<p>
<h1>Perdus de vue</h1>
-<p>Ces {$lost_emails->total()} camarades n'ont pas ou plus d'adresse email valides</p>
+<p>Ces {$lost_emails->total()} camarades n'ont pas ou plus d'adresse email valides.</p>
<table class="bicol">
<tr>
- <th>Utilisateur</th>
+ <th colspan="2">Utilisateur</th>
</tr>
+ {assign var="promo" value=""}
{iterate from=$lost_emails item="looser"}
<tr class="{cycle values="pair,impair"}">
+ <td>{if $promo neq $looser.promo}{assign var="promo" value=$looser.promo}{$promo}{/if}</td>
<td>
<a href="profile/{$looser.hruid}" class="popup2">{$looser.hruid}</a>
</td>
<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>
+ <tr>
<th colspan="2">Destinataires</th>
</tr>
- <tr>
+ <tr>
<td class="titre">de :</td>
<td>
<input type='hidden' name='signature' value='1' />
{/if}' />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">à :</td>
<td>
<input type='text' name='to' size='60' value="{$smarty.request.to}" />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">copie :</td>
<td>
<input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
</td>
</tr>
- <tr>
+ <tr>
<td class="titre">copie cachée :</td>
<td>
<input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
<div style="float: right; width: 40%;">
<select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
{foreach key=key item=contact from=$contacts}
- {if in_array($contact->hrpid,$smarty.request.to_contacts)}
+ {if t($smarty.request.to_contacts) && in_array($contact->hrpid,$smarty.request.to_contacts)}
<option value="{$contact->hrpid}">
{$contact->full_name}
</option>
<br />
<select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em">
{foreach key=key item=contact from=$contacts}
- {if in_array($contact->hrpid,$smarty.request.cc_contacts)}
+ {if t($smarty.request.cc_contacts) && in_array($contact->hrpid,$smarty.request.cc_contacts)}
<option value="{$contact->hrpid}">
{$contact->full_name}
</option>
<div style="float: right; width: 40%">
<select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%">
{foreach item=contact from=$contacts}
- {if !in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts)}
+ {if !(isset($smarty.request.to_contacts|smarty:nodefaults) && isset($smarty.request.cc_contacts|smarty:nodefaults)) ||
+ (!in_array($contact->hrpid,$smarty.request.to_contacts) && !in_array($contact->hrpid,$smarty.request.cc_contacts))}
<option value="{$contact->hrpid}">
{$contact->full_name}
</option>
{else}
<h1 id='pagetop'>
-Bienvenue {$smarty.session.display_name}{if $birthday}
+Bienvenue {$smarty.session.user->displayName()}{if $birthday}
et joyeux anniversaire de la part de toute l'équipe !
{else},
{/if}
</h1>
-{if $smarty.session.host}
+{if $smarty.session.user->host}
<div class="smaller">
{if $birthday}T{else}t{/if}a connexion précédente date du
- <strong>{$smarty.session.lastlogin|date_format:"%x, %X"}</strong>
- depuis la machine <strong>{$smarty.session.host}</strong>.
+ <strong>{$smarty.session.user->lastlogin|date_format:"%x, %X"}</strong>
+ depuis la machine <strong>{$smarty.session.user->host}</strong>.
</div>
{/if}
<tr class="pair" style="height: 18px">
<td class="half titre" style="height: 18px; padding-top: 1px; padding-bottom: 1px;">
{if $smarty.foreach.events.first}
- {if $smarty.session.token}
- <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Annonces">
+ {if $smarty.session.user->token}
+ <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Annonces">
{icon name=feed title='fil rss'}
</a>
{else}
{if !$has_evts}
<tr>
<td class="half">
- {if $smarty.session.token}
- <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" style="display:block;float:right" title="Annonces">
+ {if $smarty.session.user->token}
+ <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" style="display:block;float:right" title="Annonces">
{icon name=feed title='fil rss'}
</a>
{else}
{literal}
<script type="text/javascript">
- $('#body td table tr').each(function() {
+ $('#body td table tr').each(function() {
var uidcell = $('td:eq(3)',this);
if (uidcell.length != 1) {
return;
$('#fusion-reload a').click(function(a) {
document.location = a.currentTarget.href;
document.location.reload();
- });
+ });
});
return false;
});
});
//-->
{/literal}
-</script>
+</script>
<h2><a href="fusionax">Fusion des annuaires X.org - AX</a></h2>
<h2>Import de l'annuaire AX</h2>
<h2>Fusion des annuaires X.org - AX</h2>
<ul>
<li>Voir la <a href="Fusion">documentation</a></li>
-<li><a href="fusionax/import">Import de la base AX</a> {if $lastimport} - (dernier import le {$lastimport}){/if}</li>
+<li><a href="fusionax/import">Import de la base AX</a> {if $lastimport} - (dernier import le {$lastimport}){/if}</li>
<li>Mise en <a href="fusionax/ids">correspondance simple</a></li>
<li>Création des <a href="fusionax/view">VIEW annexes nécessaires aux corrélations</a></li>
<li>Corrélation des <a href="fusionax/deceased">dates de décès</a></li>
{if !$dead && $registered}</a>{/if}
</div>
<div class="autre">
- {foreach from=$profile->nationalities() item=nat}
- <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />
+ {foreach from=$profile->nationalities() item=country key=code}
+ <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />
{/foreach}
{$profile->promo()}{*
*}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}
</tr>
<tr class="impair">
<td colspan="2">
- <form action="#" method="post" id="changepass">
+ <form action="#" method="post">
<table class="tinybicol">
<tr>
<td class="titre">Nouveau mot de passe</td>
- <td><input type="password" name="nouveau" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
+ <td><input type="password" name="new1" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
</tr>
<tr>
<td class="titre">Vérification</td>
- <td><input type="password" name="nouveau2" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
+ <td><input type="password" name="new2" onfocus="document.forms.changepass2.password_sync[1].checked = true;" /></td>
</tr>
<tr>
<td class="titre">Sécurité</td>
- <td>{checkpasswd prompt="nouveau" submit="create_account" text="Créer mon compte !"}</td>
+ <td>{checkpasswd prompt="new" submit="create_account" text="Créer mon compte !"}</td>
</tr>
</table>
</form>
{if $password_sync}
<input type="submit" value="Créer mon compte !" />
{else}
- <input type="hidden" name="response2" value="" />
- <input type="submit" name="create_account" value="Créer mon compte !" onclick="EnCryptedResponse(); return false;" />
+ <input type="hidden" name="pwhash" value="" />
+ <input type="submit" name="create_account" value="Créer mon compte !" onclick="return hashResponse('new1', 'new2', true);" />
{/if}
</td>
</tr>
{else}
<tr class="impair"><td colspan="2">
Changer le mot de passe de ton compte Google Apps :<br /><br />
- <form action="googleapps/password" method="post" id="changepass">
+ <form action="googleapps/password" method="post">
+ {xsrf_token_field}
<table class="bicol">
<tr>
<td class="titre">Nouveau mot de passe</td>
- <td><input type="password" name="nouveau" /></td>
+ <td><input type="password" name="new1" /></td>
</tr>
<tr>
<td class="titre">Vérification</td>
- <td><input type="password" name="nouveau2" /></td>
+ <td><input type="password" name="new2" /></td>
</tr>
<tr>
<td class="titre">Sécurité</td>
- <td>{checkpasswd prompt="nouveau" submit="create_account" text="Changer mon mot de passe"}</td>
+ <td>{checkpasswd prompt="new1" submit="create_account" text="Changer mon mot de passe"}</td>
</tr>
<tr>
<td></td>
- <td><input type="submit" name="create_account" value="Changer" onclick="EnCryptedResponse(); return false;" /></td>
+ <td>
+ <input type="hidden" name="pwhash" value="" />
+ <input type="submit" name="create_account" value="Changer" onclick="return hashResponse('new1', 'new2', true);" />
+ </td>
</tr>
</table>
</form>
- <form action="googleapps/password" method="post" id="changepass2">
- {xsrf_token_field}
- <input type="hidden" name="response2" value="" />
- </form><br />
+ <br />
Pour une sécurité optimale, ton mot de passe circule de manière sécurisée (https).
Il est chiffré irréversiblement sur nos serveurs, ainsi que sur ceux de Google.
</td></tr>
range.innerHTML = "L\'annonce est destinée à la promotion " + min + ".";
} else {
range.innerHTML = "L\'annonce est destinée aux promotions de " + min + " à " + max + ' (incluses).';
- }
+ }
return true;
- }
+ }
{/literal}
//]]></script>
<input type="text" name="{$min_field_name|default:"promo_min"}" id="{$prefix}promo_min"
{* *}
{**************************************************************************}
-{if $with_text_value}
+{if t($with_text_value)}
<div>
{/if}
-<select name="{$name}"{if $onchange} onchange="{$onchange}"{/if}{if $id} id="{$id}"{/if}>
+<select name="{$name}"{if t($onchange)} onchange="{$onchange}"{/if}{if t($id)} id="{$id}"{/if}>
<option value=""> - </option>
{iterate from=$list item='option'}
<option value="{$option.id}">{$option.field|htmlspecialchars}</option>
{/iterate}
</select>
-{if $with_text_value}
+{if t($with_text_value)}
<input type="hidden" value="" name="{$name}Txt" />
</div>
{/if}
<strong>Site web :</strong>
<input type="text" name="url" size="25" maxlength="200" value="{$valid->url}" /><br />
<strong>Email :</strong>
-<input type="text" name="url" size="25" maxlength="200" value="{$valid->email}" /><br />
+<input type="text" name="email" size="25" maxlength="200" value="{$valid->email}" /><br />
<strong>Holding :</strong>
<input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
<strong>Code NAF :</strong>
<strong>Code AX :</strong>
<input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
<strong>Adresse :</strong>
-<textarea cols="30" rows="4" name="address">{$valid->address['text']}</textarea><br />
+<textarea cols="30" rows="4" name="address">{$valid->address.text}</textarea><br />
<strong>Téléphone :</strong>
<input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
<strong>Fax :</strong>
<input type="submit" name="preview" value="Aperçu" onclick="previewWiki('msg_{$valid->id()}', 'preview_{$valid->id()}', true, 'preview_{$valid->id()}'); return false;" /><br />
<strong>Site :</strong> <input type="text" name="pay_site" size="45" value="{$valid->site}" />
<br>
-<strong>Montant :</strong> <input type="text" name="pay_montant" size="5" value="{$valid->montant}" />
+<strong>Montant :</strong> <input type="text" name="pay_montant" size="5" value="{$valid->montant}" />
(min <input type="text" name="pay_montant_min" size="5" value="{$valid->montant_min}" />
-> max <input type="text" name="pay_montant_max" size="5" value="{$valid->montant_max}" />)
</tr>
<tr class="pair">
<td class="titre">Adresse :</td>
- <td>{$valid->address[text]}</td>
+ <td>{$valid->address.text}</td>
</tr>
<tr class="pair">
<td class="titre">Téléphone :</td>
<div class="nom">
{if $profile->isFemale()}•{/if}
{if !$dead && $registered}<a href="profile/{$profile->hrid()}" class="popup2">{/if}
- {$profile->full_name}
+ {$profile->directory_name}
{if !$dead && $registered}</a>{/if}
</div>
<div class="edu">
- {foreach from=$profile->nationalities() item=nat}
- <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />
+ {foreach from=$profile->nationalities() item=country key=code}
+ <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />
{/foreach}
{$profile->promo()}{*
*}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{*
{else}
<td class="center" style="vertical-align: bottom; padding-bottom: 15px">
<a href="profile/{$profile->hrid()}" class="popup2">
- <span {if $profile->name_tooltip}class="hinted"
- title="{$profile->directory_name}"{/if}>{$profile->directory_name}</span>
- {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
+ {$profile->private_name} {if $trombi_with_promo && $profile->promo()}({$profile->promo()}){/if}
</a>
</td>
{/if}
-- <br />
l'équipe de Polytechnique.org<br />
Le portail des élèves & anciens élèves de l'École polytechnique
-{/if}
+{elseif $mail_part eq "escaped_html"}Cordialement,<br />-- <br />l'équipe de Polytechnique.org<br />Le portail des élèves & anciens élèves de l'École polytechnique{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
{* *}
{**************************************************************************}
-
+
<table cellpadding="8" cellspacing="2" style="width:100%;">
{foreach from=$trombi_list item=p}
{cycle values="1,2,3" assign="loop"}
{/if}
<br />
<a href="{if $urlmainsite}{$urlmainsite}{/if}profile/{$p.forlife}" class="popup2">
- <span {if $p.name_tooltip}class="hinted" title="{$p.name_tooltip}"{/if}>{$p.name_display}</span>{if $trombi_show_promo} ({$p.promo_display}){/if}
+ {$p.name_display}{if $trombi_show_promo} ({$p.promo_display}){/if}
</a>
</td>
{if $loop eq "3"}
<tr>
<td><strong>Liste {$platal->argv[1]} :</strong></td>
<td>
- {if $on neq members}
+ {if $on neq 'members'}
[<a href='{$platal->ns}lists/members/{$platal->argv[1]}'>liste des membres</a>]
{else}
[liste des membres]
{/if}
- {if $on neq trombi}
+ {if $on neq 'trombi'}
[<a href='{$platal->ns}lists/annu/{$platal->argv[1]}'>annuaire/trombi</a>]
{else}
[annuaire/trombi]
{/if}
- {if $on neq archives}
+ {if $on neq 'archives'}
[<a href='{$platal->ns}lists/archives/{$platal->argv[1]}'>archives</a>]
{else}
[archives]
<tr>
<td><strong>Administrer la liste :</strong></td>
<td>
- {if $on neq moderate}
+ {if $on neq 'moderate'}
[<a href='{$platal->ns}lists/moderate/{$platal->argv[1]}'>modération</a>]
{else}
[modération]
{/if}
- {if $on neq admin}
+ {if $on neq 'admin'}
[<a href='{$platal->ns}lists/admin/{$platal->argv[1]}'>ajout/retrait de membres</a>]
{else}
[ajout/retrait de membres]
{/if}
- {if $on neq options}
+ {if $on neq 'options'}
[<a href='{$platal->ns}lists/options/{$platal->argv[1]}'>options</a>]
{else}
[options]
{/if}
- {if $on neq delete}
+ {if $on neq 'delete'}
[<a href='{$platal->ns}lists/delete/{$platal->argv[1]}'>détruire</a>]
{else}
[détruire liste]
<tr>
<td><strong>Administrer (avancé) :</strong></td>
<td>
- {if $on neq soptions}
+ {if $on neq 'soptions'}
[<a href='{$platal->ns}lists/soptions/{$platal->argv[1]}'>options avancées</a>]
{else}
[options avancées]
{/if}
- {if $on neq check}
+ {if $on neq 'check'}
[<a href='{$platal->ns}lists/check/{$platal->argv[1]}'>vérifications</a>]
{else}
[vérifications]
{if $it_is_xnet && ($details.own || $is_admin)}
<tr>
<td><strong>Synchroniser :</strong></td>
- {if $on neq sync}
+ {if $on neq 'sync'}
<td>[<a href="{$platal->ns}lists/sync/{$platal->argv[1]}">synchroniser avec l'annuaire</a>]</td>
{else}
<td>[synchroniser avec l'annuaire]</td>
<ul>
<li>Pour demander ton inscription à une liste de diffusion, il suffit
de cliquer sur l'icône {icon name=add} située en fin de ligne.</li>
- <li>Si la liste est à inscription modérée, l'icône {icon name=flag_orange title="en cours"}
+ <li>Si la liste est à inscription modérée, l'icône {icon name=flag_orange title="en cours"}
apparaîtra tant que ton inscription n'aura pas été validée par un modérateur.</li>
<li>Pour te désinscrire d'une liste dont tu es membre, il suffit de cliquer sur la croix
{icon name=cross title="désinscription"} située en fin de ligne.</li>
{/if}
</td>
<td>
- <a href='{$platal->ns}lists/members/{$liste.list}'>{$liste.list}</a>
+ <a href='{$platal->ns}lists/members/{$liste.list}'>{$liste.list}</a>
</td>
<td>
{$liste.desc|smarty:nodefaults}<br/>
{if $owners|@count}
<table class='tinybicol' cellpadding='0' cellspacing='0'>
{foreach from=$owners item=xs key=promo}
- {foreach from=$xs item=x name=all}
+ {foreach from=$xs item=user name=all}
<tr>
<td class='titre'>
{if $smarty.foreach.all.first}
{/if}
</td>
<td>
- {if $promo && strpos($x.l, '@') === false}
- {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>
- {elseif $x.n}
- {$x.n}
+ {if $promo && $user.x}
+ {if $user.b}{assign var=lostUsers value=true}{/if}
+ {profile user=$user.x promo=false}
+ {elseif $user.x}
+ <a href="{$platal->ns}member/{$user.x}">{if $user.n|trim}{$x.n}{else}{$user.l}{/if}</a>
+ {elseif $user.n}
+ {$user.n}
{else}
- {$x.l}
+ {$user.l}
{/if}
</td>
- {if $x.p}
+ {if $user.p}
<td class="right">
- {$x.p}
+ {$user.p}
</td>
{/if}
</tr>
</tr>
- {foreach from=$members item=xs key=promo}
- {foreach from=$xs item=x name=all}
+ {assign var=lostUsers value=false}
+ {foreach from=$members item=users key=promo}
+ {foreach from=$users item=user name=all}
<tr>
<td class='titre' style="width: 20%">
{if $smarty.foreach.all.first}
{/if}
</td>
<td>
- {if $promo && strpos($x.l, '@') === false}
- {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}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
- {elseif $x.n}
- {$x.n}
+ {if $promo && $user.x}
+ {if $user.b}{assign var=lostUsers value=true}{/if}
+ {profile user=$user.x promo=false}
+ {elseif $user.x}
+ <a href="{$platal->ns}member/{$user.x}">{if $user.n|trim}{$x.n}{else}{$user.l}{/if}</a>
+ {elseif $user.n}
+ {$user.n}
{else}
- {$x.l}
+ {$user.l}
{/if}
</td>
- {if $x.p}
+ {if $user.p}
<td class="right">
- {$x.p}
+ {$user.p}
</td>
{/if}
</tr>
{/foreach}
{/foreach}
</table>
+
+{if $lostUsers}
+<p class="smaller">
+ {icon name=error} Un camarade signalé par ce symbole n'a plus d'adresse de redirection et ne peut donc
+ plus être contacté via son adresse polytechnique.org. Si tu connais sa nouvelle adresse, tu peux nous la communiquer en
+ cliquant sur le symbole.
+</p>
+{/if}
+
{/if}
if (event.target.tagName === 'INPUT') {
return;
}
-
+
var checkbox = $(this).parent().find(':checkbox');
-
+
checkbox = checkbox.attr('checked', !checkbox.attr('checked'));
-
+
event.stopPropagation();
});
{/literal}
<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 cet email sur la liste ?')"/>
- <input type='submit' name='mno' value='Refuser !'
+ <input type='submit' name='mno' value='Refuser !'
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 cet email ?')"/>
{elseif $user && !$user->alive}
<p class="erreur">
- {$user->fullName()} (X{$user->promo()}) est malheureusement décédé{if $user->isFemale()}e{/if}.
+ {$user->fullName("promo")} est malheureusement décédé{if $user->isFemale()}e{/if}.
Nous ne réaliserons maintenance sur son adresse Polytechnique.org qu'à la demande explicite
de sa famille. Pour tout renseignement, merci de <a href="mailto:contact@polytechnique.org">
contacter le support</a>.
{elseif $user}
<h1>
- Recherche d'adresses pour {$user->fullName()} (X{$user->promo()}).
+ Recherche d'adresses pour {$user->fullName("promo")}.
</h1>
{if !$user->email}
{elseif $user->last}
<p>
{$user->fullName()} 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
+ tu es sûr{if $smarty.session.user->gender}e{/if} que son adresse Polytechnique.org est en panne, tu peux proposer une nouvelle
adresse email à ajouter à ses redirections. Merci d'ajouter un commentaire pour nous indiquer la raison de cette proposition.
</p>
{else}
<p>
- Nous n'avons actuellement enregistré aucune panne sur les adresses de redirection de {$user->fullName()}. Si tu es
- sûr{if $smarty.session.femme}e{/if} que son adresse de redirection actuelle est en panne, tu peux nous proposer
+ Nous n'avons actuellement enregistré aucune panne sur les adresses de redirection de {$user->fullName()}. Si tu es
+ sûr{if $smarty.session.user->gender}e{/if} que son adresse de redirection actuelle est en panne, tu peux nous proposer
une nouvelle adresse, accompagnée d'un commentaire nous expliquant les raisons exactes de cette proposition.
</p>
{/if}
<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->fullName()} (X{$user->promo()})</th></tr>
+ <tr><th colspan="2">Proposition d'adresse pour<br />{$user->fullName("promo")}</th></tr>
<tr class="pair">
<td>Adresse email :</td>
<td>
<br />
<p>
-Nombre d'X vivants d'après notre base de données : {$stats.vivants}<br />
-Nombre d'X vivants inscrits à Polytechnique.org : {$stats.inscrits}<br />
-Soit un pourcentage d'inscrits de : {$stats.ins_rate} %<br />
+nombre d'X vivants d'après notre base de données : {$statistics.alive}<br />
+nombre d'X vivants inscrits à Polytechnique.org : {$statistics.registered}<br />
+Soit un pourcentage d'inscrits de : {$statistics.registeredRate} %<br />
</p>
<p>
Parmi ceux-ci :<br />
-Nombre d'X vivants depuis 1972 d'après notre base de données : {$stats.vivants72}<br />
-Nombre d'X vivants depuis 1972 inscrits à Polytechnique.org : {$stats.inscrits72}<br />
-Soit un pourcentage d'inscrits de : {$stats.ins72_rate} %<br />
+nombre d'X vivants depuis 1972 d'après notre base de données : {$statistics.alive72}<br />
+nombre d'X vivants depuis 1972 inscrits à Polytechnique.org : {$statistics.registered72}<br />
+Soit un pourcentage d'inscrits de : {$statistics.registeredRate72} %<br />
</p>
<p>
-Nombre de Polytechniciennes vivantes : {$stats.vivantes}<br />
-Nombre de Polytechniciennes vivantes et inscrites : {$stats.inscrites}<br />
-Soit un pourcentage d'inscrites de : {$stats.inse_rate} %<br />
+nombre de Polytechniciennes vivantes : {$statistics.womenAlive}<br />
+nombre de Polytechniciennes vivantes et inscrites : {$statistics.womenRegistered}<br />
+Soit un pourcentage d'inscrites de : {$statistics.womenRegisteredRate} %<br />
</p>
<p>
-Nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a> : {$nbInsSem}<br />
-Nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée) : {$nbInsEnCours}
+nombre d'<a href="marketing/this_week">inscrits ces 7 derniers jours</a> : {$registrations.week}<br />
+nombre d'<a href="marketing/relance">inscriptions en cours</a> (2ème phase non terminée) : {$registrations.pending}
</p>
<table class="bicol">
</tr>
<tr>
<td> </td>
- <td class="titre">Abouti</td>
<td class="titre">Non abouti</td>
+ <td class="titre">Abouti</td>
<td class="titre">Total</td>
</tr>
<tr>
<td>Personnel</td>
- <td>{$nbInsMarketOkPerso}</td>
- <td>{$nbInsMarketNoPerso}</td>
- <td>{$nbInsMarketOkPerso+$nbInsMarketNoPerso}</td>
+ <td>{$marketings.noPerso}</td>
+ <td rowspan="3" style="vertical-align: middle">{$marketings.ok}</td>
+ <td rowspan="3" style="vertical-align: middle">{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
</tr>
<tr>
<td>Par Polytechnique.org</td>
- <td>{$nbInsMarketOkXorg}</td>
- <td>{$nbInsMarketNoXorg}</td>
- <td>{$nbInsMarketOkXorg+$nbInsMarketNoXorg}</td>
+ <td>{$marketings.noXorg}</td>
+ </tr>
+ <tr>
+ <td>Par l'AX</td>
+ <td>{$marketings.noAX}</td>
</tr>
<tr>
<td>Cette semaine</td>
- <td>{$nbInsMarketOkWeek}</td>
- <td>{$nbInsMarketNoWeek}</td>
- <td>{$nbInsMarketOkWeek+$nbInsMarketNoWeek}</td>
+ <td>{$marketings.noWeek}</td>
+ <td>{$marketings.okWeek}</td>
+ <td>{$marketings.okWeek+$marketings.noWeek}</td>
</tr>
<tr>
<td class="titre">Total</td>
- <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg}</td>
- <td>{$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
- <td>{$nbInsMarketOkPerso+$nbInsMarketOkXorg+$nbInsMarketNoPerso+$nbInsMarketNoXorg}</td>
+ <td>{$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
+ <td>{$marketings.ok}</td>
+ <td>{$marketings.ok+$marketings.noPerso+$marketings.noXorg+$marketings.noAX}</td>
</tr>
</table>
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+
{#globals.baseurl#}/register/%%hash%%
==========================================================
-Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$num_users} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
+Il ne te faut que 5 minutes sur https://www.polytechnique.org/ pour rejoindre la communauté polytechnicienne sur le web grâce aux services de Polytechnique.org dont profitent déjà {$globals->core->NbIns|number_format} camarades. Cela te permettra, entre autres, de contacter un X en connaissant seulement son nom et son prénom et de bénéficier à vie d'une adresse prestigieuse {$u.forlife_email} et de son alias discret {$u.forlife_email2} (m4x = mail for X).
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.
{$personal_notes}
À bientôt sur Polytechnique.org <https://www.polytechnique.org>,
-Bien cordialement,
---
{$sign}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<td>{profile user=$it}</td>
<td>{if $it->lastKnownEmail()}{mailto address=$it->lastKnownEmail()}{/if}</td>
<td class="center">
- {if $it->lastMarketingRelance() && $it->lastMarketingRelance() != '0000-00-00'}
- Relance le : {$it->lastMarketingRelance()}
- {elseif $it->lastKnownEmail()}
- En cours : {$it->lastKnownEmail()}
+ {if $it->pendingRegistrationDate() > $it->lastMarketingDate()}
+ En cours : {$it->pendingRegistrationEmail()}
+ {elseif $it->lastMarketingDate() && $it->lastMarketingDate() != '0000-00-00'}
+ Relance le : {$it->lastMarketingDate()}
{else}
-
{/if}
</label><br />
<label>
<input type="radio" name="origine" value="staff"
- onclick='$("#sender").html("{$xorg_signature}"); $("#tr_perso").hide();
- $("#personal_notes_display").hide();' />
+ onclick='$("#sender").html("{include file=include/signature.mail.tpl mail_part=$mail_part}");
+ $("#tr_perso").hide(); $("#personal_notes_display").hide();' />
au nom de l'équipe Polytechnique.org
</label>
</td>
<h1>
-{if $actif}Modification du mot de passe SMTP/NNTP{else}Activation de ton compte SMTP/NNTP{/if}
+{if $actif}Modification du mot de passe SMTP/NNTP{else}Activation de ton compte SMTP/NNTP{/if}
</h1>
{literal}
<p>
{icon name=error title="Attention"} Nous te déconseillons fortement d'utiliser le même
mot de passe que pour la connexion au site. En effet, ce mot de passe sert à accéder à des
- services <em>moins</em> sécurisés, ce qui nécessite son enregistrement en clair dans
+ services <em>moins</em> sécurisés, ce qui nécessite son enregistrement en clair dans
notre base de données.
</p>
</p>
{include wiki=Xorg.NNTPSecurise}
{elseif $smarty.request.doc eq "smtp"}
-<p>
+<p>
<a href="{$platal->pl_self()}?doc=nntp">Pourquoi et comment</a> utiliser le serveur NNTP de {#globals.core.sitename#}.<br />
</p>
{include wiki=Xorg.SMTPSecurise}
<h1>Fil RSS</h1>
-{if !$smarty.session.token}
+{if !$smarty.session.user->token}
<p>
Tu viens de cliquer sur le lien d'activation des fils RSS. Les fils RSS du site
ne sont pas activés dans tes préférences.
<ul>
<li>
Anonces sur la page d'entrée :
- <a href="rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Annonces">{icon name=feed title='fil rss'}</a>
+ <a href="rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Annonces">{icon name=feed title='fil rss'}</a>
</li>
<li>
Ton carnet polytechnicien :
- <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
+ <a href="carnet/rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml" title="Notifications">{icon name=feed title='fil rss'}</a>
</li>
</ul>
<p>
<strong>Si vous êtes un recruteur ou une entreprise, / if you are a recruiter or a company,</strong>
<ul>
<li class="spaced">
- vous avez la possibilité
+ vous avez la possibilité
<strong><a href="http://www.manageurs.com/?langue=fr">d'utiliser le site
Manageurs.com</a></strong> pour rentrer en contact avec les
polytechniciens, mettre en ligne des offres d'emploi, consulter l'annuaire
<br />
<fieldset style="width: 70%; margin-left: 15%">
<legend>{icon name=lock} Saisie du nouveau mot de passe</legend>
- <form action="{$smarty.server.REQUEST_URI}" method="post" id="changepass">
+ <form action="{$smarty.server.REQUEST_URI}" method="post">
+ {xsrf_token_field}
<table style="width: 100%">
<tr>
<td class="titre">
Mot de passe :
</td>
<td>
- <input type="password" size="10" maxlength="256" name="nouveau" />
+ <input type="password" size="10" maxlength="256" name="new1" />
</td>
</tr>
<tr>
Retape-le une fois :
</td>
<td>
- <input type="password" size="10" maxlength="256" name="nouveau2" />
+ <input type="password" size="10" maxlength="256" name="new2" />
</td>
</tr>
<tr>
Sécurité
</td>
<td>
- {checkpasswd prompt="nouveau" submit="submitn"}
+ {checkpasswd prompt="new1" submit="submitn"}
</td>
</tr>
<tr>
<td colspan="2" class="center">
- <input type="submit" value="Changer" name="submitn" onclick="EnCryptedResponse(); return false;" />
+ <input type="hidden" name="pwhash" value="" />
+ <input type="submit" value="Changer" name="submitn" onclick="return hashResponse('new1', 'new2', true);" />
</td>
</tr>
</table>
</form>
- <form action="{$smarty.server.REQUEST_URI}" method="post" id="changepass2">
- <div>
- {xsrf_token_field}
- <input type="hidden" name="response2" value="" />
- </div>
- </form>
</fieldset>
<p>
</tr>
<tr class="impair">
<td class="half">
- {if $smarty.session.email_format eq html}
+ {if $smarty.session.user->email_format eq 'html'}
<h3>
<a href="javascript:dynpostkv('prefs','email_format','text')">Recevoir les emails en format texte</a>
</h3>
</td>
<td class="half">
<h3>
- {if $smarty.session.token}
+ {if $smarty.session.user->token}
<a href="javascript:dynpostkv('prefs','rss',0)">Désactiver les fils rss</a>
{else}
<a href="javascript:dynpostkv('prefs','rss',1)">Activer les fils rss</a>
<select name="medal_sel" onchange="updateMedal()">
<option value=''> </option>
{foreach from=$medal_list key=type item=list}
- <optgroup label="{$trad[$type]}…">
+ <optgroup label="{$fullType[$type]}…">
{foreach from=$list item=m}
<option value="{$m.id}">{$m.text}</option>
{/foreach}
{foreach from=$medals item=medal key=id}
{include file="profile/deco.medal.tpl" medal=$medal id=$id}
{/foreach}
- <div class="center"><small>Si ta décoration ou ta médaille ne figure pas dans la liste,
- <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small></div>
+ <p class="center"><small>Si ta décoration ou ta médaille ne figure pas dans la liste,
+ <a href="mailto:support@{#globals.mail.domain#}">contacte-nous</a>.</small></p>
</td>
</tr>
</table>
educationDegree = new Array({education_degree});
educationDegreeAll = new Array({education_degree_all});
-educationDegreeName = new Array({education_degree_name});
+educationDegreeName = new Array({education_degree_name});
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<table class="bicol" style="margin-bottom: 1em" summary="Profil : Noms">
<tr>
- <th colspan="3">Noms</th>
+ <th colspan="3">Noms{if $validation} <small>(validations en attente de modération)</small>{/if}</th>
</tr>
<tr>
<td class="titre">
<h1>Mes groupes X sur Polytechnique.net</h1>
-<p class="center">
-[<a href="http://www.polytechnique.net/login/plan">Tous les groupes X</a>]
-</p>
+<p class="center">
+[<a href="http://www.polytechnique.net/login/plan">Tous les groupes X</a>]
+</p>
{foreach from=$assos item="asso"}
<div style="width:48%;float:left" >
<td class="titre">Téléphone</td>
<td>
<input type="text" maxlength="28" {if $job.hq_tel_error}class="error"{/if}
- name="{$jobpref}[hq_phone]" value="{$job.hq_phone}" />
+ name="{$jobpref}[hq_fixed]" value="{$job.hq_fixed}" />
</td>
</tr>
<tr class="{$entreprise}" style="display: none">
{* *}
{**************************************************************************}
-<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$smarty.session.hruid}">fiche référent</a> qui n'est accessible que par les X.
+<div>{icon name=information title="Afficher ma fiche référent"}Tu peux consulter ta <a class="popup2" href="referent/{$hrpid}">fiche référent</a> qui n'est accessible que par les X.
</div>
{if (!$expertise)||(!($sectors|@count))}
<br /><div>
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2010 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="profile"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{cc full=#cc#}
+{subject text="Modification de ton profil"}
+{elseif $mail_part eq 'wiki'}
+{if $sex}Chère{else}Cher{/if} {$yourself},
+
+Les champs suivants de ton profil ont été modifiés le {$date|date_format:"%x"} :
+{foreach from=$modifications item=modification}
+*{$modification.field} : « {$modification.oldText} » est devenu « {$modification.newText} » (effectuée par {$modification.full_name}).
+{/foreach}
+
+Tu peux voir ta fiche là :
+*{$globals->baseurl}/profile/{$hrpid}
+Tu peux aussi l'éditer toi-même là :
+*{$globals->baseurl}/profile/edit/{$hrpid}
+
+{include file="signature.mail.tpl"}
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
<option value="mobile"{if $tel.type eq 'mobile'} selected="selected"{/if}>Mobile</option>
<option value="fax"{if $tel.type eq 'fax'} selected="selected"{/if}>Fax</option>
</select>
- <input type="text" size="19" maxlength="28" name="{$telpref}[tel]" {if $tel.error}class="error"{/if} value="{$tel.tel}" />
+ <input type="text" size="19" maxlength="28" name="{$telpref}[display]" {if $tel.error}class="error"{/if} value="{$tel.display}" />
<a class="removeTel" href="javascript:removeTel('{$prefname}','{$prefid}','{$telid}')">
{icon name=cross title="Supprimer ce numéro de téléphone"}
</a>
<div id="fiche">
<div id="photo" class="part">
{assign var=photo value=$profile->getPhoto(false)}
- {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}" width="{$photo->width()}"/>{/if}
+ {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
{if $logged && $view eq 'private' && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups()|smarty:nodefaults))}
<h2>À l'X…</h2>
<div id="fiche_identite" class="part">
<div class="civilite">
{if $profile->isFemale()}•{/if}
- <span {if $profile->name_tooltip neq ""}class="hinted" title="{$profile->name_tooltip}"{/if}>{$profile->shortName()}</span>
- {if $logged}
- {if $profile->nickname} (alias {$profile->nickname}){/if}
- {/if}
+ {if $logged}{$profile->private_name}{else}{$profile->public_name}{/if}
{if $logged}
{if !$profile->isDead()}<a href="vcard/{$owner->login()}.vcf">{*
{/if}
<div class='spacer'></div>
</div>
+ {else}
+ <div class='spacer'></div>
{/if}
<div class='formation'>
- {foreach from=$profile->nationalities() item=nat}
- <img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />
+ {foreach from=$profile->nationalities() item=country key=code}
+ <img src='images/flags/{$code}.gif' alt='{$code}' height='11' title='{$country}' />
{/foreach}
{$profile->promo()}
{assign var=corps value=$profile->getCorps()}
{if $corps && ($corps->current || $corps->original)}
- <ul>
+ <ul>
{if $corps->current}
- <li>Corps actuel : {$corps->current_name} {$corps->current_rank}</li>
+ <li>
+ Corps actuel : {$corps->current_name}
+ {if $corps->current_rank}({$corps->current_rank}){/if}
+ </li>
{/if}
- {if $corps->original}
+ {if $corps->current != $corps->original && $corps->original}
<li>Corps d'origine : {$corps->original_name}</li>
{/if}
- </ul>
+ </ul>
{/if}
</div>
} else {
Ajax.update_html('ssect_chg', baseurl + 'ssect/' + sector);
Ajax2.update_html('country_chg', baseurl + 'country/' + sector);
- document.getElementById('scat').style.display = '';
- document.getElementById('country').style.display = '';
- document.getElementById('keywords').style.display = '';
+ document.getElementById('scat').style.display = '';
+ document.getElementById('country').style.display = '';
+ document.getElementById('keywords').style.display = '';
document.getElementById('search_referent').disabled = '';
}
}
</th>
</tr>
<tr>
- <td class="titre">
+ <td class="titre">
Nom <span class="smaller">(à l'X)</span>
</td>
<td>
Tu n'as pour le moment aucun homonyme dans notre base de données. Nous allons
donc te donner l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>,
en plus de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{#globals.mail.domain#}</strong>.
- Note que tu pourrais perdre l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>
+ Note que tu pourrais perdre l'adresse <strong>{$smarty.session.subState.bestalias}@{#globals.mail.domain#}</strong>
si un homonyme s'inscrivait, même si cela reste assez rare.
</p>
{else}
de ton adresse à vie <strong>{$smarty.session.subState.forlife}@{#globals.mail.domain#}</strong>.
</p>
{/if}
-
+
<p>
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>
<p>
- Attention, cette adresse doit <strong>impérativement être valide</strong> pour que nous puissions
+ Attention, cette adresse doit <strong>impérativement être valide</strong> pour que nous puissions
t'envoyer tes informations de connexion.
</p>
<span class="smaller">au moins 6 caractères</span>
</td>
<td>
- <input type="hidden" name="response2" />
- <input type="password" size="10" maxlength="256" name="password" /><br/>
+ <input type="hidden" name="pwhash" />
+ <input type="password" size="10" maxlength="256" name="password1" /><br/>
<input type="password" size="10" maxlength="256" name="password2" /> (retape ton mot de passe)<br />
- {checkpasswd prompt="password" text="Terminer la pré-inscription"}
+ {checkpasswd prompt="password1" text="Terminer la pré-inscription"}
</td>
</tr>
</table>
</tr>
<tr class="impair">
<td class="center">
- <input type="submit" name="submitn" value="Continuer" onclick="EncryptedResponseInNestedForm(); return false;" />
+ <input type="submit" name="submitn" value="Continuer" onclick="return hashResponse('password1', 'password2', true);" />
</td>
</tr>
</table>
</form>
-<form action="register" id="changepass">
- <div>
- <input type="hidden" name="nouveau" />
- <input type="hidden" name="nouveau2" />
- </div>
-</form>
{/if}
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</tr>
<tr>
<td colspan="2">
- <label for="only_current"><input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current}
-checked="checked"{/if}/>Chercher uniquement les adresses où les camarades sont actuellement.</label></td>
+ <label for="only_current">
+ <input name="only_current" id="only_current" type="checkbox"{if $smarty.request.only_current} checked="checked"{/if}/>
+ Chercher uniquement les adresses où les camarades sont actuellement.
+ </label>
+ </td>
</tr>
<tr>
<th colspan="2">Activité</th>
<a href="search/adv">recherche avancée</a>
</strong>
</li>
-
+
<li>Effectuer une nouvelle <strong>
<a href="search">recherche simple</a>
</strong>
</li>
</ul>
-
+
{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
</p>
<p>
Pour éviter ce genre d'écueils, il suffit de chercher : <code>Le Normand</code><br />
-En effet, le moteur de recherche va alors chercher tous les utilisateurs dont le nom
+En effet, le moteur de recherche va alors chercher tous les utilisateurs dont le nom
contient 'Le' <strong>et</strong> 'Normand' sans distinction de casse et sans tenir compte des accents.
</p>
<p>
http://www.polytechnique.org/bandeau.css.
Pour avoir l'icone, pour des raisons de sécurité il n'y a pas d'accès
direct, il faut alors rediriger bandeau/icone.png vers celle du site :
- http://www.polytechnique.org/bandeau/icone.png
+ http://www.polytechnique.org/bandeau/icone.png
-->
<!-- Don't copy this list of emails!!!
<div class="menu_title">Services</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}
+{if $smarty.session.user->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>
</td>
<td class="inscrits">
{$globals->core->NbIns|number_format} polytechniciens sur le web
+ {if t($smarty.request.quick)}
+ {assign var=requestQuick value=$smarty.request.quick}
+ {else}
+ {assign var=requestQuick value="Recherche dans l\'annuaire"}
+ {/if}
<form action="search" method="get">
<div>
- <input type="text" size="20" name="quick" id="quick" class="quick_search"
- value="{$smarty.request.quick|default:'Recherche dans l\'annuaire'}"
- onfocus="if (this.value === 'Recherche dans l\'annuaire') this.value='';
- $('#quick_button').show()"
- onblur="if (this.value === '') this.value='{$smarty.request.quick|default:'Recherche dans l\'annuaire'|escape:javascript}'"
- />
<button id="quick_button" type="submit" style="display: none"
onclick="if ($('#quick').val() === 'Recherche dans l\'annuaire') $('#quick').val('')">
OK
</button>
+ <input type="text" size="20" name="quick" id="quick" class="quick_search"
+ value="{$requestQuick}"
+ onfocus="if (this.value === 'Recherche dans l\'annuaire') this.value='';
+ $('#quick_button').show()"
+ onblur="if (this.value === '') this.value='{$requestQuick|escape:javascript}'"
+ />
</div>
</form>
{if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs}
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
<body>
{include core=plpage.devel.tpl}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<table id="suid" cellpadding="0" cellspacing="0">
<tr>
<td>
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
- <div id="suid">
- <a href="exit">
- Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
- </a>
- </div>
- {/if}
+ {if t($smarty.session.suid)}
+ <div id="suid">
+ <a href="exit">
+ Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
+ </a>
+ </div>
+ {/if}
{if $simple}
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{else}
{include file=skin/common.bandeau.tpl}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
{if !$simple}
{include file=skin/common.bandeau.tpl}
{/if}
- {if $smarty.session.suid}
+ {if t($smarty.session.suid)}
<div id="suid">
<a href="exit">
Quitter le SU sur {$smarty.session.hruid} ({$smarty.session.perms->flags()})
<p>
Tu trouveras ici les interruptions de service de Polytechnique.org qui ont été
constatées <strong>durant les trois dernières semaines</strong>, ou qui sont prévues dans le futur.
- Il est à noter qu'à ce jour la quasi-totalité des coupures proviennent
+ Il est à noter qu'à ce jour la quasi-totalité des coupures proviennent
de défaillances du réseau de l'École, où nos serveurs sont hébergés (rupture de la
connexion internet de l'École, problème électrique…).
</p>
</a>
</td>
</tr>
- <script type="text/javascript">//<![CDATA[
+ <script type="text/javascript">//<![CDATA[
var id = new Array();
id['choices'] = {$survey_current.choices|@count};
id['subquestions'] = {$survey_current.subquestions|@count};
function newField(name, tid)
{
fid = "t" + id[name];
- $("#" + name + "_" + tid).before('<div id="' + name + '_' + fid + '">'
+ $("#" + name + "_" + tid).before('<div id="' + name + '_' + fid + '">'
+ '<input id="' + name + '_' + fid + '_field" type="text" name="survey_question[' + name + '][' + fid + ']" size="50" maxlength="200" value="" /> '
+ '<a href="javascript:removeField("' + name + '","' + fid + '")"><img src="images/icons/delete.gif" alt="" title="Supprimer" /></a>'
- + '</div>');
- id[name]++;
+ + '</div>');
+ id[name]++;
$("#" + name + "_" + fid + "_field").focus();
}
function removeField(name, tid)
{
$("#" + name + "_" + tid).remove();
}
- {/literal}
- //]]></script>
+ {/literal}
+ //]]></script>
{* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}
{literal}
$(document).ready(function() {
function hidePromo(value) {
- if (value == "0" || value == "") {
- $("#ln_promo").hide();
+ if (value == "0" || value == "") {
+ $("#ln_promo").hide();
$("#ln_promo_exp").hide();
- } else {
+ } else {
$("#ln_promo").show();
$("#ln_promo_exp").show();
- }
+ }
}
$("[name='survey_question[mode]']").change(function() { hidePromo(this.value); });
hidePromo({/literal}"{$survey_current.mode}"{literal});
<h1>Sondages</h1>
+{* Survey::MODE_ALL equals 0. *}
+{assign var=SurveyMODE_ALL value=0}
<table class="bicol">
<tr>
<th>
</th>
</tr>
{iterate item=s from=$survey_current}
- {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
+ {if $smarty.session.auth || $s.mode == $SurveyMODE_ALL}
<tr class="{cycle name=cs_cycle values="impair,pair"}">
<td class="half">
•
</th>
</tr>
{iterate item=s from=$survey_old}
- {if $smarty.session.auth || $s.mode == Survey::MODE_ALL}
+ {if $smarty.session.auth || $s.mode == $SurveyMODE_ALL}
<tr class="{cycle name=os_cycle values="impair,pair"}">
<td class="half">
•
<tr>
<td class="titre">Promotions :</td>
<td>
- {if $survey.promos eq "#"}
+ {if $survey.promos eq "#"}
<span class="erreur">erreur</span>
- {elseif $survey.promos eq ""}
- aucune restriction
- {else}
- {$survey.promos}
+ {elseif $survey.promos eq ""}
+ aucune restriction
+ {else}
+ {$survey.promos}
{/if}
</td>
</tr>
<div class="cat {if $cat eq institutions}sel{/if}"><a href="groups/institutions">Institutions</a></div>
<div class="cat {if $cat eq promotions}sel{/if}"><a href="groups/promotions">Promotions</a></div>
</td>
-
+
{if $doms}
<td style="vertical-align: top">
{foreach from=$doms item=g}
{/if}
{/foreach}
{/foreach}
- {assign var=asso_id value=$asso->id}
+ {if t($asso)}{assign var=asso_id value=$asso->id}{/if}
+ {if t($smarty.session.suid)}{assign var=suid value=true}{else}{assign var=suid value=false}{/if}
{if $asso && $is_admin ||
- ($smarty.session.suid && ($smarty.session.suid.perms->hasFlag('admin') ||
+ ($suid && ($smarty.session.suid.perms->hasFlag('admin') ||
$smarty.session.suid.may_update[$asso_id]))}
<h1>Voir le site comme…</h1>
<form method="post" action="{$platal->ns}change_rights">
<div>
<select name="right" onchange="this.form.submit()" style="margin: 0; padding: 0">
- {if hasPerm('admin') || ($smarty.session.suid && $smarty.session.suid.perms->hasFlag('admin'))}
+ {if hasPerm('admin') || ($suid && $smarty.session.suid.perms->hasFlag('admin'))}
<option value="admin" {if hasPerm('admin')}selected="selected"{/if}>Administrateur</option>
{/if}
<option value="anim" {if $is_admin && !hasPerm('admin')}selected="selected"{/if}>Animateur</option>
</tr>
{/foreach}
</table>
-
+
<div class="center">
{if $evt.eid}<input type="hidden" name="organisateur_uid" value="{$evt.organisateur_uid}" />{/if}
<input type="submit" name="valid" value="Valider" />
<h1>{$asso->nom} : Événements</h1>
{else}
<h1>
- {$asso->nom} :
+ {$asso->nom} :
{if $archive}[<a href="{$platal->ns}events">Événements</a>] {else}Événements {/if}
{if $archive}Archives {else}[<a href="{$platal->ns}events/archive">Archives</a>] {/if}
</h1>
{if $admin || $event.show_participants}
<p class='descr'>
- Tu peux
+ Tu peux
<a href="{$platal->ns}events/admin/{$event.eid}">
consulter la liste des participants
{icon name=group title="Liste des participants"}</a>
{elseif $event.paid < $event.topay}
Tu dois encore payer {math equation="a-b" a=$event.topay b=$event.paid|replace:'.':','} €
(tu as déjà payé {$event.paid|replace:'.':','} €).
- {else}
+ {else}
Tu as déjà payé {$event.paid|replace:'.':','} € pour ton inscription.
{/if}
</div>
{
var state = (box.checked ? 'none' : '');
document.getElementById('promo_titre').style.display = state;
+ document.getElementById('promo_explanation').style.display = state;
document.getElementById('promo_min_tr').style.display = state;
document.getElementById('promo_max_tr').style.display = state;
document.getElementById('promo_range_tr').style.display = state;
</td>
</tr>
<tr id="promo_titre" {if $art.public}style="display: none"{/if}>
- <th colspan="2">Promotions cibles</th>
+ <th colspan="2">Promotions d'entrée cibles</th>
+ </tr>
+ <tr id="promo_explanation" {if $art.public}style="display: none"{/if}>
+ <td colspan="2"><span class="smaller">{icon name=information} par exemple 2004 pour les X2004</span></td>
</tr>
{include file="include/field.promo.tpl" promo_min=$art.promo_min promo_max=$art.promo_max}
{if $art.public}
{if $is_admin}
<li>
<a href="{$platal->ns}member/new">
- {icon name=add title="Ajouter un membre"}
+ {icon name=add title="Ajouter un membre"}
Ajouter un membre
</a>
</li>
{if $asso->has_ml}
<li>
<a href="{$platal->ns}admin/annuaire">
- {icon name=wand title="Synchroniser"}
+ {icon name=wand title="Synchroniser"}
Synchroniser annuaire et listes de diffusion
</a>
</li>
{/if}
<li>
<a href="{$platal->ns}annuaire/csv/{$asso->diminutif}.csv">
- {icon name=page_excel title="Fichier Excel"}
+ {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"}
+ {icon name=vcard title="Carte de visite"}
Ajouter les membres à ton carnet d'adresse
</a>
(<a href="{$platal->ns}annuaire/vcard/{$asso->diminutif}.vcf">sans les photos</a>)
<th>Actions</th>
{/if}
</tr>
+ {assign var=lostUsers value=false}
{foreach from=$users item=user}
<tr>
<td>
+ {if $user->lost}{assign var=lostUsers value=true}{/if}
{profile user=$user promo=false}
</td>
<td>
</p>
{/if}
-{if $broken}
+{if $lostUsers}
<p class="smaller">
{icon name=error} Un camarade signalé par ce symbole n'a plus d'adresse de redirection et ne peut donc
plus être contacté via son adresse polytechnique.org. Si tu connais sa nouvelle adresse, tu peux nous la communiquer en
<table class="tinybicol">
<tr>
<th>
- {if $smarty.session.token}
- <a href='{$platal->ns}rss/{$smarty.session.hruid}/{$smarty.session.token}/rss.xml' style="display:block;float:right">
+ {if $smarty.session.user->token}
+ <a href='{$platal->ns}rss/{$smarty.session.hruid}/{$smarty.session.user->token}/rss.xml' style="display:block;float:right">
{icon name=feed title='fil rss'}
</a>
{else}
</tr>
{iterate item=art from=$article_index}
<tr>
- <td>•
+ <td>•
{if $art.nonlu}
<a href="{$platal->ns}#art{$art.id}"><strong>
{else}
</td>
<td>
<select name="cat">
- <option value="groupesx" {if $asso->cat eq GroupesX}selected="selected"{/if}>Groupes X</option>
- <option value="binets" {if $asso->cat eq Binets}selected="selected"{/if}>Binets</option>
- <option value="promotions" {if $asso->cat eq Promotions}selected="selected"{/if}>Promotions</option>
- <option value="institutions" {if $asso->cat eq Institutions}selected="selected"{/if}>Institutions</option>
+ <option value="groupesx" {if $asso->cat eq 'GroupesX'}selected="selected"{/if}>Groupes X</option>
+ <option value="binets" {if $asso->cat eq 'Binets'}selected="selected"{/if}>Binets</option>
+ <option value="promotions" {if $asso->cat eq 'Promotions'}selected="selected"{/if}>Promotions</option>
+ <option value="institutions" {if $asso->cat eq 'Institutions'}selected="selected"{/if}>Institutions</option>
</select>
</td>
</tr>
<tr>
{if $art.photo}
<td rowspan="{if ($is_logged || $admin) && $art.contacts}3{else}2{/if}" style="width: 100px">
- <img src="{$platal->ns}announce/photo/{$art.id}" alt="{$art.titre}" style="width: 100px" />
+ <img src="{$platal->ns}announce/photo/{$art.id}" alt="{$art.titre}" style="width: 100px" />
</td>
{/if}
<td style="padding-bottom: 1em">
{elseif $smarty.post.inscrire}
<p class="descr">
-<strong>Ta demande d'inscription a bien été envoyée !</strong> Tu seras averti{if $smarty.session.femme}e{/if} par email de la suite qui lui sera donnée.
+<strong>Ta demande d'inscription a bien été envoyée !</strong> Tu seras averti{if $smarty.session.user->gender}e{/if} par email de la suite qui lui sera donnée.
<p>
<p class="descr">[<a href="{$platal->ns}">Retour à la page d'accueil de {$asso->nom}</a>]</p>
}
{/literal}
//]]></script>
-
+
<form action="{$platal->ns}mail" method="post" enctype="multipart/form-data" onsubmit="return check(this);">
{xsrf_token_field}
<table class='bicol'>
<tr>
<td colspan="2">
<input type="checkbox" id="x" name="x" onchange="xStateChange(this);" />
+ {* TODO: adapts text for masters and doctorates when required. *}
<label for="x">Coche cette case s'il s'agit d'un X non inscrit à Polytechnique.org.</label>
</td>
</tr>
</tr>
<tr id="xpromo" style="display: none">
<td class="titre">Promotion :</td>
- <td><input type="text" id="promo" name="promo" size="4" value="" onkeyup="searchX();" /></td>
+ {* TODO: add examples for masters and doctorates when required. *}
+ <td><input type="text" id="promo" name="promo" size="4" value="" onkeyup="searchX();" /> <small>(X2004)</small></td>
</tr>
<tr id="xsearch" style="display: none" class="pair">
<td colspan="2" id="search_result">
</p>
{else}
-
+
<h1>{$asso->nom} : gestion des membres</h1>
<h2>
Type d'utilisateur :
</td>
<td>
- <select name="type" onchange="showInformations(this); return true"{if $user->profile()} disabled="disabled"{/if}>
+ <select name="type" onchange="showInformations(this); return true">
<option value="xnet" {if $user->type neq 'virtual'}selected="selected"{/if}>Personne physique</option>
<option value="virtual" {if $user->type eq "virtual"}selected="selected"{/if}>Personne morale</option>
</select>
Nom affiché :
</td>
<td>
- <input type="text" value="{$user->displayName()}" name="display_name" size="40"{if $user->profile()} disabled="disabled"{/if} />
+ <input type="text" value="{$user->displayName()}" name="display_name" size="40" />
</td>
</tr>
<tr class="impair">
Nom complet :
</td>
<td>
- <input type="text" value="{$user->fullName()}" name="full_name" size="40"{if $user->profile()} disabled="disabled"{/if} />
+ <input type="text" value="{$user->fullName()}" name="full_name" size="40" />
+ </td>
+ </tr>
+ <tr class="impair">
+ <td class="titre">
+ Nom annuaire :
+ </td>
+ <td>
+ <input type="text" value="{$user->directoryName()}" name="directory_name" size="40" />
</td>
</tr>
<tr id="sexe" class="impair" {if $user->type eq "virtual"}style="display: none"{/if}>
Sexe :
</td>
<td>
- <select name="sex"{if $user->profile()} disabled="disabled"{/if}>
+ <select name="sex">
<option value="male"{if !$user->isFemale()} selected="selected"{/if}>Homme</option>
<option value="female"{if $user->isFemale()} selected="selected"{/if}>Femme</option>
</select>
</td>
</tr>
+ {/if}
+ {if !$user->profile() || !$user->perms}
<tr class="impair">
<td class="titre">
Email :
</td>
<td>
- <input type="text" value="{$user->forlifeEmail()}" name="email" size="40"{if $user->profile()} disabled="disabled"{/if} />
+ <input type="text" value="{$user->forlifeEmail()}" name="email" size="40" />
</td>
</tr>
{/if}
<input type="submit" name='change' value="Valider ces changements" />
<input type="reset" value="Annuler ces changements" />
- </div>
+ </div>
</form>
<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><a href="javascript:toggleSelection()">{icon name="arrow_refresh" title="Inverser la sélection"}</a></th>
<th>Prénom Nom (Promotion)</th>
<th>Date de demande</th>
<th></th>
<p>[<a href='{$platal->ns}lists'>retour à la page des listes</a>]</p>
<h1>Membres de {$platal->argv[1]}</h1>
-
+
<table class='tinybicol'>
{if $mem|@count}
{foreach from=$mem item=m}
l'accord préalable des responsables du groupe.
</p>
<p class="descr">
-La dernière colonne du tableau t'indique si tu es inscrit{if $smarty.session.femme}e{/if} ou non à
+La dernière colonne du tableau t'indique si tu es inscrit{if $smarty.session.user->gender}e{/if} ou non à
la liste. Dans le premier cas, une croix rouge te permet de te désabonner. Dans le second cas, une
croix verte te permet de t'inscrire, après accord des responsables si l'inscription est modérée.
</p>
</table>
<p class="descr">
-{icon name=wrench title="Modérateur"} tu es {if $smarty.session.femme}modératrice{else}moderateur{/if} sur cette liste.<br />
+{icon name=wrench title="Modérateur"} tu es {if $smarty.session.user->gender}modératrice{else}moderateur{/if} sur cette liste.<br />
{icon name=weather_cloudy title="Liste privée"} cette liste est invisible aux non-membres de la liste. S'en désabonner
t'empêcherait de t'y réabonner par la suite sans l'aide d'un administrateur.
</p>
-
+
<h2>Voici les alias existants pour le groupe {$asso->nom} :</h2>
<table cellspacing="0" cellpadding="0" class='large'>
alter table emails change flags flags enum('active', 'filter', 'panne') not null default 'active';
UPDATE emails SET last = panne WHERE last = 0 AND panne != 0;
UPDATE emails
- SET panne_level = 1
- WHERE flags = 'active'
+ SET panne_level = 1
+ WHERE flags = 'active'
AND DATE_ADD(panne, INTERVAL 2 MONTH) > CURDATE();
-alter table skins change date date date not null default 0;
+alter table skins change date date date not null default 0;
INSERT INTO skins (id, name, date, comment, auteur, skin_tpl, ext)
VALUES (13, 'Keynote', '2006-08-09', 'Skin inspirée d\'un thème de Keynote',
'Florent Bruneau', 'keynote.tpl', 'png');
UPDATE newsletter_art SET body =
-REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(body,
+REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(body,
"[b]", "'''"),
"[/b]", "'''"),
"[i]", "''"),
alter table aliases add index (flags);
update aliases AS a
-left join aliases AS b
+left join aliases AS b
ON(a.id=b.id and b.alias like '%.%' and length(b.alias)<length(a.alias) and b.type!='homonyme')
set a.flags=CONCAT(a.flags,',bestalias')
where a.alias LIKE '%.%' and b.alias IS NULL and a.type!='homonyme';
('ordre', 'Ordre du Mérite Agricole', 'ordre_ma.jpg'),
('ordre', 'Ordre du Mérite Maritime', 'ordre_mm.jpg'),
('ordre', 'Ordre des Arts et des Lettres', 'ordre_al.jpg'),
-
('croix', 'Croix de Guerre 1914 - 1918', 'croix_1418.jpg'),
('croix', 'Croix de Guerre 1939 - 1945', 'croix_3945.jpg'),
('croix', 'Croix des T. O. E.', 'croix_toe.jpg'),
ADD adr_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
ADD tel_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL;
UPDATE entreprises SET
-pub = IF(FIND_IN_SET('entreprise_public', visibilite), 'public', IF(FIND_IN_SET('entreprise_ax', visibilite), 'ax', 'private')),
-adr_pub = IF(FIND_IN_SET('adr_public', visibilite), 'public', IF(FIND_IN_SET('adr_ax', visibilite), 'ax', 'private')),
+pub = IF(FIND_IN_SET('entreprise_public', visibilite), 'public', IF(FIND_IN_SET('entreprise_ax', visibilite), 'ax', 'private')),
+adr_pub = IF(FIND_IN_SET('adr_public', visibilite), 'public', IF(FIND_IN_SET('adr_ax', visibilite), 'ax', 'private')),
tel_pub = IF(FIND_IN_SET('tel_public', visibilite), 'public', IF(FIND_IN_SET('tel_ax', visibilite),'ax', 'private'));
ALTER TABLE entreprises DROP visibilite;
ALTER TABLE entreprises
-UPDATE watch_cat SET mail = "Ces camarades nous ont quittés", mail_sg = "Ce camarade nous a quittés" WHERE id = 3;
+UPDATE watch_cat SET mail = "Ces camarades nous ont quittés", mail_sg = "Ce camarade nous a quittés" WHERE id = 3;
ALTER TABLE virtual CHANGE `type` `type` ENUM('user', 'list', 'dom', 'evt') DEFAULT 'user' NOT NULL;
ALTER TABLE groupex.asso ADD `pub` ENUM( 'public', 'private' ) DEFAULT 'public' NOT NULL AFTER `ax` ;
-INSERT INTO virtual_domains VALUES ('evts.polytechnique.org');
+INSERT INTO virtual_domains VALUES ('evts.polytechnique.org');
use groupex;
INSERT INTO admin_h2 VALUES(2, 11, 'Géoloc', 70);
-INSERT INTO admin_a VALUES(11, 'Synchro', 'admin/geoloc.php',0);
+INSERT INTO admin_a VALUES(11, 'Synchro', 'admin/geoloc.php',0);
--- /dev/null
+ALTER TABLE profile_job_enum MODIFY COLUMN acronym VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN url VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN email VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN NAF_code CHAR(5) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN AX_code BIGINT(10) DEFAULT NULL;
+
+-- vim:set syntax=mysql:
--- /dev/null
+DROP TABLE IF EXISTS profile_modifications;
+
+CREATE TABLE profile_modifications (
+ pid INT(11) NOT NULL,
+ uid INT(11) NOT NULL,
+ field VARCHAR(60) NOT NULL,
+ oldText TEXT NOT NULL,
+ newText TEXT NOT NULL,
+ pub ENUM('private', 'ax', 'public') NOT NULL DEFAULT 'private',
+ PRIMARY KEY(pid, uid, field)
+) ENGINE=InnoDB, CHARSET=utf8;
+
+-- vim:set syntax=mysql:
--- /dev/null
+ALTER TABLE accounts ADD COLUMN directory_name VARCHAR(255) DEFAULT NULL AFTER full_name,
+ ADD COLUMN user_perms SET('groups', 'mail', 'directory_ax', 'directory_private',
+ 'edit_directory', 'forums', 'lists', 'payment')
+ DEFAULT NULL
+ COMMENT "Extra permissions for the account in addition to those specified by the account type"
+ AFTER type;
+UPDATE accounts AS a
+ SET a.directory_name = (SELECT pd.directory_name
+ FROM profile_display AS pd
+ INNER JOIN account_profiles AS ap ON (ap.uid = pd.pid AND FIND_IN_SET('owner', perms))
+ WHERE a.uid = ap.uid);
+
+ALTER TABLE account_types
+CHANGE COLUMN perms perms SET('groups', 'mail', 'directory_ax', 'directory_private',
+ 'edit_directory', 'forums', 'lists', 'payment') NOT NULL;
+
+REPLACE INTO account_types VALUES ('x', 'groups,mail,directory_private,forums,lists,payment'),
+ ('master', 'groups,directory_private,forums,lists,payment'),
+ ('phd', 'groups,directory_private,forums,lists,payment'),
+ ('pi', 'groups,forums,lists'),
+ ('ax', 'groups,directory_ax,edit_directory'),
+ ('xnet', 'groups'),
+ ('virtual', '');
+
+
+-- vim:set syntax=mysql:
--- /dev/null
+ALTER TABLE profile_medal_enum MODIFY COLUMN type ENUM('ordre','croix','militaire','honneur','resistance','prix','sport') NOT NULL DEFAULT 'ordre';
+
+INSERT INTO profile_medal_enum (type, text, flags)
+ VALUES ('sport', 'Championnat du monde de vol à voile', 'validation'),
+ ('sport', 'Championnat d\'Europe de vol à voile', 'validation'),
+ ('sport', 'Championnat de France de vol à voile', 'validation');
+
+INSERT INTO profile_medal_grade_enum (mid, gid, text, pos)
+ SELECT id, 1, 'Or', 1
+ FROM profile_medal_enum
+ WHERE text = 'Championnat du monde de vol à voile'
+ OR text = 'Championnat d\'Europe de vol à voile'
+ OR text = 'Championnat de France de vol à voile';
+
+INSERT INTO profile_medal_grade_enum (mid, gid, text, pos)
+ SELECT id, 2, 'Argent', 2
+ FROM profile_medal_enum
+ WHERE text = 'Championnat du monde de vol à voile'
+ OR text = 'Championnat d\'Europe de vol à voile'
+ OR text = 'Championnat de France de vol à voile';
+
+INSERT INTO profile_medal_grade_enum (mid, gid, text, pos)
+ SELECT id, 3, 'Bronze', 3
+ FROM profile_medal_enum
+ WHERE text = 'Championnat du monde de vol à voile'
+ OR text = 'Championnat d\'Europe de vol à voile'
+ OR text = 'Championnat de France de vol à voile';
+
+-- vim:set syntax=mysql:
--- /dev/null
+ALTER TABLE profile_phones MODIFY COLUMN pid INT(6) NOT NULL DEFAULT 0;
+ALTER TABLE profile_phones MODIFY COLUMN link_id INT(6) NOT NULL DEFAULT 0;
+
+DELETE FROM profile_phones WHERE search_tel = '' OR display_tel = '' OR link_type = 'hq';
+
+-- vim:set syntax=mysql:
--- /dev/null
+UPDATE profile_job_enum
+ SET NAF_code = NULL, AX_code = NULL;
+
+-- vim:set syntax=mysql:
--- /dev/null
+../../bin/connect.db.inc.php
\ No newline at end of file
--- /dev/null
+#!/usr/bin/php5
+<?php
+require_once 'connect.db.inc.php';
+
+$globals->debug = 0; //do not store backtraces
+
+$phones = array(
+ 'AF' => '93',
+ 'AN' => '599',
+ 'BY' => '375',
+ 'FM' => '691',
+ 'GE' => '995',
+ 'GL' => '299',
+ 'ID' => '62',
+ 'IL' => '972',
+ 'IN' => '91',
+ 'IQ' => '964',
+ 'IR' => '98',
+ 'JO' => '962',
+ 'JP' => '81',
+ 'KG' => '996',
+ 'KW' => '965',
+ 'KZ' => '7',
+ 'LA' => '856',
+ 'LB' => '961',
+ 'LK' => '94',
+ 'MM' => '95',
+ 'MN' => '976',
+ 'MV' => '960',
+ 'MY' => '60',
+ 'NP' => '977',
+ 'OM' => '968',
+ 'PH' => '63',
+ 'PK' => '92',
+ 'QA' => '974',
+ 'SA' => '966',
+ 'SG' => '65',
+ 'SY' => '963',
+ 'TH' => '66',
+ 'TJ' => '992',
+ 'TM' => '993',
+ 'TR' => '90',
+ 'TW' => '886',
+ 'UZ' => '998',
+ 'VG' => '1284',
+ 'VN' => '84',
+ 'YE' => '967',
+);
+
+foreach ($phones as $country => $phone) {
+ XDB::execute('UPDATE geoloc_countries
+ SET phonePrefix = {?}
+ WHERE iso_3166_1_a2 = {?}',
+ $phone, $country);
+}
+
+/* vim:set et sw=4 sts=4 ts=4: */
+?>