================================================================================
+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:
--- /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:
+?>
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();
}
// }}}
+/** 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:
?>
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;
}
$it = XDB::Iterator('SELECT p.pid, p.hrpid, p.xorg_id, p.ax_id, p.birthdate, p.birthdate_ref,
p.next_birthday, p.deathdate, p.deathdate_rec, p.sex = \'female\' AS sex,
- p.cv, p.medals_pub, p.alias_pub, p.email_directory, p.last_change,
- p.nationality1, p.nationality2, p.nationality3,
+ IF ({?}, p.cv, NULL) AS cv, p.medals_pub, p.alias_pub, p.email_directory,
+ p.last_change, p.nationality1, p.nationality2, p.nationality3,
IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
pe.entry_year, pe.grad_year,
IF ({?}, pse.text, NULL) AS section,
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,
WHERE p.pid IN {?}
GROUP BY p.pid
' . $order,
- $visibility->levels(),
- $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
- $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
- $visibility->levels(),
- $visibility->levels(),
+ $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // CV
+ $visibility->levels(), // freetext
+ $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // section
+ $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // nickname
+ $visibility->levels(), // mobile
+ $visibility->levels(), // photo
$pids
);
return new ProfileIterator($it, $pids, $fields, $visibility);
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 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->full_name;
+ }
+ return $this->profile()->directory_name;
+ }
+
/** Return the main profile attached with this account if any.
*/
public function profile()
*/
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->last_relance;
+ 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_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;
}
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;
}
}
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
-Subproject commit 786bffb570bfc2f5ff1dad386a9558501d4c16e8
+Subproject commit 7f6d1063f7543f8e6c0e775dccdeff18626534cc
}
}
- 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
$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());
}
$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 $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;
}
// }}}
$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;
}
// }}}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-// {{{ class NamesReq4
+// {{{ class NamesReq
class NamesReq extends ProfileValidate
{
}
}
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) . '
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();
}
// }}}
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,
$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']);
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 */
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 */
$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);
$profiletel->saveTels($page->pid(), 'tel', $address['tel']);
}
}
+
+ public function getText($value) {
+ $addresses = array();
+ foreach ($value as $addrid => $address) {
+ $phones = new ProfileSettingPhones('address', $addrid);
+ $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->getText($address['tel']);
+ }
+ return implode(' ; ' , $addresses);
+ }
}
class ProfileSettingAddresses extends ProfilePage
}
}
}
+
+ 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
$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';
set_profile_display($display_names, $page->pid());
}
}
+
+ public function getText($value) {
+ $names = array();
+ foreach ($value as $name) {
+ if ($name['name'] != '') {
+ $names[] = $name['type_name'] . ' : ' . $name['name'];
+ }
+ }
+ return implode(', ' , $names);
+ }
}
class ProfileSettingEdu implements ProfileSetting
}
}
}
+
+ 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;
+ }
}
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
$job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
$req->submit();
$job['jobid'] = null;
+ sleep(1);
} else {
$job['jobid'] = $res->fetchOneCell();
}
}
}
}
+
+ public function getText($value) {
+ $jobs = array();
+ foreach ($value as $id => $job) {
+ $address = new ProfileSettingAddress();
+ $phones = new ProfileSettingPhones('pro', $id);
+ $jobs[] = 'Entreprise : ' . $job['name'] . ', secteur : ' . $job['subSubSectorName']
+ . ', description : ' . $job['description'] . ', web : ' . $job['w_url']
+ . ', email : ' . $job['w_email']
+ . ', ' . $phones->getText($job['w_phone']) . ', ' . $address->getText($job['w_address']);
+ }
+ return implode(' ; ' , $jobs);
+ }
}
class ProfileSettingJobs extends ProfilePage
{
parent::__construct($wiz);
$this->settings['cv'] = null;
+ /* TODO: ProfileSettingCorps, required for notifications. */
$this->settings['corps'] = null;
$this->settings['jobs'] = new ProfileSettingJob();
$this->watched = array('cv' => true, 'jobs' => true, 'corps' => true);
}
}
}
+
+ 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
$this->saveTel($pid, $telid, $phone);
}
}
+
+ public function getText($value) {
+ $phones = array();
+ foreach ($value as $phone) {
+ if ($phone['tel'] != '') {
+ $phones[] = 'type : ' . $phone['type'] .', numéro : ' . $phone['tel']
+ . ', commentaire : « ' . $phone['comment'] . ' », affichage : ' . $phone['pub'];
+ }
+ }
+ return implode(' ; ' , $phones);
+ }
}
class ProfileSettingPub extends ProfileNoSave
}
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
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 !');
}
}
}
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;
}
}
}
$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>';
}
<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()})
{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>
{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}
<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>
</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}
{/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>
- {foreach from=$members item=xs key=promo}
- {foreach from=$xs item=x name=all}
+ {foreach from=$members item=users key=promo}
+ {foreach from=$users item=user}
<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}
+ {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>
{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}
<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.
<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}
<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">
{* *}
{**************************************************************************}
-<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: *}
<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='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()}
{$globals->core->NbIns|number_format} polytechniciens sur le web
<form action="search" method="get">
<div>
+ <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="{$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>
</div>
</form>
{if $smarty.session.auth gt AUTH_PUBLIC && $smarty.session.notifs}
--- /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;
+
+-- 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
+../../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: */
+?>