// Updates the gapps_accounts table with Plat/al information.
// Cleans-up the job queue, and execute post-queue hooks.
-require_once('connect.db.inc.php');
-require_once('plmailer.php');
-require_once('googleapps.inc.php');
+require_once 'connect.db.inc.php';
+require_once 'plmailer.php';
+require_once 'googleapps.inc.php';
if (!$globals->mailstorage->googleapps_domain) {
exit;
}
$account['id'], $account['g_account_name']);
}
-/* Emits a warning for GApps accounts without local user_id. */
+/* Emits a warning for GApps accounts without local uid. */
$res = XDB::iterator(
"SELECT g.g_account_name
FROM gapps_accounts AS g
WHERE (g.l_userid IS NULL OR g.l_userid <= 0) AND a.uid IS NULL");
while ($account = $res->next()) {
if (!preg_match("/^admin-/", $account['g_account_name'])) {
- printf("Warning: GApps account '%s' has no local user_id.\n", $account['g_account_name']);
+ printf("Warning: GApps account '%s' has no local uid.\n", $account['g_account_name']);
}
}
$nickname['id'], $nickname['g_account_name']);
}
-/* Emits a warning for nicknames without local user_id. */
+/* Emits a warning for nicknames without local uid. */
$res = XDB::iterator(
"SELECT g.g_account_name
FROM gapps_nicknames AS g
WHERE (g.l_userid IS NULL OR g.l_userid <= 0) AND a.uid IS NULL");
while ($nickname = $res->next()) {
if (!preg_match("/^admin-/", $nickname['g_account_name'])) {
- printf("Warning: Nickname '%s' has no local user_id.\n", $nickname['g_account_name']);
+ printf("Warning: Nickname '%s' has no local uid.\n", $nickname['g_account_name']);
}
}
&& $this->gender !== null && $this->email_format !== null) {
return;
}
- $this->fillFromArray(self::loadMainFieldsFromUIDs(array($this->user_id))->next());
+ $this->fillFromArray(self::loadMainFieldsFromUIDs(array($this->uid))->next());
}
// Specialization of the fillFromArray method, to implement hacks to enable
// stop being used actively.
protected function fillFromArray(array $values)
{
- // It might happen that the 'user_id' field is called uid in some places
- // (eg. in sessions), so we hard link uid to user_id to prevent useless
- // SQL requests.
- if (!isset($values['user_id']) && isset($values['uid'])) {
- $values['user_id'] = $values['uid'];
- }
-
// 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'])) {
protected function doAuth($level)
{
if (S::identified()) { // ok, c'est bon, on n'a rien à faire
- return User::getSilentWithValues(null, array('user_id' => S::i('uid')));
+ return User::getSilentWithValues(null, array('uid' => S::i('uid')));
}
if (!Get::has('auth')) {
return null;
}
Get::kill('auth');
S::set('auth', AUTH_MDP);
- return User::getSilentWithValues(null, array('user_id' => Get::i('uid')));
+ return User::getSilentWithValues(null, array('uid' => Get::i('uid')));
}
protected function startSessionAs($user, $level)
return true;
}
- /** Check the cookie and set the associated user_id in the auth_by_cookie session variable.
+ /** Check the cookie and set the associated uid in the auth_by_cookie session variable.
*/
private function tryCookie()
{
public function tokenAuth($login, $token)
{
- $res = XDB::query('SELECT a.uid AS user_id, a.hruid
+ $res = XDB::query('SELECT a.uid, a.hruid
FROM aliases AS l
INNER JOIN accounts AS a ON (l.uid = a.uid AND a.state = \'active\')
WHERE a.token = {?} AND l.alias = {?} AND l.type != \'homonyme\'',
-Subproject commit 701c0b6f4dd6c32acb0508e6d59dce034bdc6a4f
+Subproject commit 643ae90bb09f55e0b0853bf5a554829a3042495e
function post_queue_u_create($job) {
global $globals;
- // Retrieves the user parameters (GoogleApps username and user_id).
+ // Retrieves the user parameters (GoogleApps username and uid).
$parameters = json_decode($job['j_parameters'], true);
$username = isset($parameters['username']) ? $parameters['username'] : null;
if (!($user = User::getSilent($username))) {
if (is_null($hash)) {
$hash = XDB::fetchOneCell("SELECT hash
FROM {$this->_subscriptionTable}
- WHERE user_id = {?}", $user->id());
+ WHERE uid = {?}", $user->id());
}
if (is_null($hash)) {
$hash = $this->createHash(array($user->displayName(), $user->fullName(),
rand(), "X.org rulez"));
XDB::execute("UPDATE {$this->_subscriptionTable} as ni
SET ni.hash = {?}
- WHERE ni.user_id != {?}",
+ WHERE ni.uid != {?}",
$hash, $user->id());
}
global $globals;
return "SELECT a.uid
FROM {$this->_subscriptionTable} AS ni
- INNER JOIN accounts AS a ON (ni.user_id = a.uid)
+ INNER JOIN accounts AS a ON (ni.uid = a.uid)
LEFT JOIN email_options AS eo ON (eo.uid = a.uid)
LEFT JOIN emails AS e ON (e.uid = a.uid AND e.flags='active')
WHERE ni.last < {?} AND ({$this->subscriptionWhere()}) AND
return;
}
foreach ($users as $user) {
- $sent[] = XDB::format('user_id = {?}', $user->id());
+ $sent[] = XDB::format('uid = {?}', $user->id());
$this->sendTo($user, $hash);
}
XDB::execute("UPDATE {$this->_subscriptionTable}
// Updates (or creates) the reminder line for the pair (|user|, |reminder_id|)
// using the |status| as status, and the |next_ask| as the delay between now
// and the next ask (if any).
- private static function UpdateStatus($user_id, $type_id, $status, $next_ask)
+ private static function UpdateStatus($uid, $type_id, $status, $next_ask)
{
XDB::execute('REPLACE INTO reminder
SET uid = {?}, type_id = {?}, status = {?},
remind_last = NOW(), remind_next = FROM_UNIXTIME({?})',
- $user_id, $type_id, $status,
+ $uid, $type_id, $status,
($next_ask > 0 ? time() + $next_ask * 24 * 60 * 60 : null));
}
// Static status update methods -------------------------------------------
- // Marks the candidate reminder as having been accepted for user |user_id|.
+ // Marks the candidate reminder as having been accepted for user |uid|.
// It is intended to be used when a reminder box has been bypassed, and when
// it should behave as if the user had clicked on 'yes'.
- protected static function MarkCandidateAsAccepted($user_id, $candidate)
+ protected static function MarkCandidateAsAccepted($uid, $candidate)
{
- Reminder::UpdateStatus($user_id, $candidate['type_id'],
+ Reminder::UpdateStatus($uid, $candidate['type_id'],
'yes', $candidate['remind_delay_yes']);
}
public function submit()
{
if ($this->unique) {
- XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}', $this->user->id(), $this->type);
+ XDB::execute('DELETE FROM requests
+ WHERE uid = {?} AND type = {?}',
+ $this->user->id(), $this->type);
}
$this->stamp = date('YmdHis');
- XDB::execute('INSERT INTO requests (user_id, type, data, stamp) VALUES ({?}, {?}, {?}, {?})',
+ XDB::execute('INSERT INTO requests (uid, type, data, stamp)
+ VALUES ({?}, {?}, {?}, {?})',
$this->user->id(), $this->type, $this, $this->stamp);
global $globals;
protected function update()
{
- XDB::execute('UPDATE requests SET data={?}, stamp=stamp
- WHERE user_id={?} AND type={?} AND stamp={?}',
+ XDB::execute('UPDATE requests
+ SET data = {?}, stamp = stamp
+ WHERE uid = {?} AND type = {?} AND stamp = {?}',
$this, $this->user->id(), $this->type, $this->stamp);
return true;
}
global $globals;
if ($this->unique) {
- $success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}',
+ $success = XDB::execute('DELETE FROM requests
+ WHERE uid = {?} AND type = {?}',
$this->user->id(), $this->type);
} else {
- $success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?} AND stamp={?}',
+ $success = XDB::execute('DELETE FROM requests
+ WHERE uid = {?} AND type = {?} AND stamp = {?}',
$this->user->id(), $this->type, $this->stamp);
}
$globals->updateNbValid();
static public function get_typed_request($uid, $type, $stamp = -1)
{
if ($stamp == -1) {
- $res = XDB::query('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type);
+ $res = XDB::query('SELECT data
+ FROM requests
+ WHERE uid = {?} and type = {?}',
+ $uid, $type);
} else {
- $res = XDB::query('SELECT data, DATE_FORMAT(stamp, "%Y%m%d%H%i%s") FROM requests WHERE user_id={?} AND type={?} and stamp={?}', $uid, $type, $stamp);
+ $res = XDB::query('SELECT data, DATE_FORMAT(stamp, "%Y%m%d%H%i%s")
+ FROM requests
+ WHERE uid = {?} AND type = {?} and stamp = {?}',
+ $uid, $type, $stamp);
}
if ($result = $res->fetchOneCell()) {
$result = Validate::unserialize($result);
*/
static public function get_typed_requests($uid, $type)
{
- $res = XDB::iterRow('SELECT data FROM requests WHERE user_id={?} and type={?}', $uid, $type);
+ $res = XDB::iterRow('SELECT data
+ FROM requests
+ WHERE uid = {?} and type = {?}',
+ $uid, $type);
$array = array();
while (list($data) = $res->next()) {
$array[] = Validate::unserialize($data);
*/
static public function get_typed_requests_count($uid, $type)
{
- $res = XDB::query('SELECT COUNT(data) FROM requests WHERE user_id={?} and type={?}', $uid, $type);
+ $res = XDB::query('SELECT COUNT(data)
+ FROM requests
+ WHERE uid = {?} and type = {?}',
+ $uid, $type);
return $res->fetchOneCell();
}
$res = XDB::iterator(
"SELECT a.alias AS homonyme, s.alias AS forlife,
IF(h.homonyme_id = s.id, a.expire, NULL) AS expire,
- IF(h.homonyme_id = s.id, a.type, NULL) AS type,
- ac.uid AS user_id
+ IF(h.homonyme_id = s.id, a.type, NULL) AS type, ac.uid
FROM aliases AS a
- LEFT JOIN homonyms AS h ON (h.homonyme_id = a.uid)
- INNER JOIN aliases AS s ON (s.uid = h.uid AND s.type='a_vie')
+ LEFT JOIN homonyms AS h ON (h.homonyme_id = a.uid)
+ INNER JOIN aliases AS s ON (s.uid = h.uid AND s.type = 'a_vie')
INNER JOIN accounts AS ac ON (ac.uid = a.uid)
WHERE a.type = 'homonyme' OR a.expire != ''
ORDER BY a.alias, forlife");
while ($tab = $res->next()) {
$hnymes[$tab['homonyme']][] = $tab;
}
- $page->assign_by_ref('hnymes',$hnymes);
+ $page->assign_by_ref('hnymes', $hnymes);
}
}
. "https://www.polytechnique.org/ax/edit\n"
. "-- \n"
. "Association Polytechnique.org\n");
- $users = User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT user_id
+ $users = User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT uid
FROM axletter_rights'));
foreach ($users as $user) {
$mailer->addTo($user);
}
$page->changeTpl('axletter/admin.tpl');
- $page->assign('admins', User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT user_id
+ $page->assign('admins', User::getBulkUsersWithUIDs(XDB::fetchColumn('SELECT uid
FROM axletter_rights')));
$importer = new CSVImporter('axletter_ins');
- $importer->registerFunction('user_id', 'email vers Id X.org', array($this, 'idFromMail'));
+ $importer->registerFunction('uid', 'email vers Id X.org', array($this, 'idFromMail'));
$importer->forceValue('hash', array($this, 'createHash'));
- $importer->apply($page, "admin/axletter", array('user_id', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
+ $importer->apply($page, "admin/axletter", array('uid', 'email', 'prenom', 'nom', 'promo', 'flag', 'hash'));
}
function idFromMail($line, $key, $relation = null)
if (!empty($hash) || !empty($login)) {
$user = User::getSilent($login);
if ($user) {
- $req = XDB::query("SELECT 1 FROM newsletter_ins WHERE user_id = {?} AND hash = {?}", $user->id(), $hash);
+ $req = XDB::query('SELECT 1
+ FROM newsletter_ins
+ WHERE uid = {?} AND hash = {?}',
+ $user->id(), $hash);
if ($req->numRows() == 0) {
$user = null;
}
if ($x = $sel->fetchOneAssoc()) {
if ($x['nb_mails'] == 0) {
- register_profile_update($x['user_id'], 'broken');
+ register_profile_update($x['uid'], 'broken');
}
fputcsv($csv, array($x['fullname'], $x['promo'], $alias,
join(',', $mails), $x['nb_mails'],
WHERE FIND_IN_SET("valide", e.flags) AND expiration >= NOW()');
$data = array();
while ($e = self::nextEvent($events, $user)) {
- $author = User::getWithUID($e['user_id']);
+ $author = User::getWithUID($e['uid']);
$promo = $author->promo();
$e['author'] = $author->fullName() . ($promo ? ' (' . $promo . ')' : '');
$e['link'] = $globals->baseurl . '/events#newsid' . $e['id'];
require_once 'gadgets/gadgets.inc.php';
init_igoogle_html('gadgets/ig-events.tpl', AUTH_COOKIE);
- $events = XDB::iterator('SELECT SQL_CALC_FOUND_ROWS
+ $events = XDB::iterator("SELECT SQL_CALC_FOUND_ROWS
e.id, e.titre, UNIX_TIMESTAMP(e.creation_date) AS creation_date,
- IF(u.nom_usage = "", u.nom, u.nom_usage) AS nom, u.prenom, u.promo,
- ev.user_id IS NULL AS nonlu, e.uid
- FROM announces AS e
+ IF(u.nom_usage = '', u.nom, u.nom_usage) AS nom, u.prenom, u.promo,
+ ev.uid IS NULL AS nonlu, e.uid
+ FROM announces AS e
LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})
- WHERE FIND_IN_SET("valide", e.flags) AND expiration >= NOW()
- ORDER BY e.creation_date DESC', S::i('uid'));
+ WHERE FIND_IN_SET('valide', e.flags) AND expiration >= NOW()
+ ORDER BY e.creation_date DESC", S::i('uid'));
$page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell());
Platal::load('events', 'feed.inc.php');
$nbf = count($line);
$users = array();
if ($this->isMode(self::MODE_XIDENT)) { // if the mode is non anonymous
- $users = User::getBulkUsersWithUIDs(XDB::fetchAllAssoc('vid', 'SELECT v.id AS vid, v.user_id
+ $users = User::getBulkUsersWithUIDs(XDB::fetchAllAssoc('vid', 'SELECT v.id AS vid, v.uid
FROM survey_votes AS v
WHERE v.survey_id = {?}
ORDER BY vid ASC',
// {{{ functions vote() and hasVoted() : handles vote to a survey
public function vote($uid, $args)
{
- XDB::execute('INSERT INTO survey_votes
- SET survey_id={?}, user_id={?};', $this->id, $uid); // notes the user as having voted
+ XDB::execute('INSERT INTO survey_votes
+ SET survey_id = {?}, uid = {?};', $this->id, $uid); // notes the user as having voted
$vid = XDB::insertId();
for ($i = 0; $i < count($this->questions); $i++) {
$ans = $this->questions[$i]->checkAnswer($args[$i]);
public function hasVoted($uid)
{
- $res = XDB::query('SELECT id
- FROM survey_votes
- WHERE survey_id={?} AND user_id={?};', $this->id, $uid); // checks whether the user has already voted
+ $res = XDB::query('SELECT id
+ FROM survey_votes
+ WHERE survey_id = {?} AND uid = {?};', $this->id, $uid); // checks whether the user has already voted
return ($res->numRows() != 0);
}
// }}}
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.user_id IS NULL AS nonlu
+ $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()
$page->trigError("Le login $login correspond a plusieurs camarades.");
return false;
}
- $uid = $x[0]['user_id'];
+ $uid = $x[0]['uid'];
$sub = false;
} else {
list($uid, $login) = $res->fetchOneRow();
<form method="post" action="admin/user">
{xsrf_token_field}
<div class="center">
- <input type="hidden" name="user_id" value="{$smarty.request.user_id}" />
- Confirmer la suppression de l'utilisateur {$smarty.request.user_id} ({$mr.prenom} {$mr.nom} - X{$mr.promo})
+ <input type="hidden" name="uid" value="{$smarty.request.uid}" />
+ Confirmer la suppression de l'utilisateur {$smarty.request.uid} ({$mr.prenom} {$mr.nom} - X{$mr.promo})
<input type="submit" name="u_kill" value="continuer" />
</div>
</form>
<input type="text" name="email" size="29" maxlength="60" value="" />
</td>
<td class="action">
- <input type="hidden" name="user_id" value="{$mr.user_id}" />
+ <input type="hidden" name="uid" value="{$mr.uid}" />
<input type="hidden" name="del_alias" value="" />
<input type="submit" name="add_alias" value="Ajouter" />
</td>
<input type="text" name="email" size="29" maxlength="60" value="" />
</td>
<td class="action">
- <input type="hidden" name="user_id" value="{$mr.user_id}" />
+ <input type="hidden" name="uid" value="{$mr.uid}" />
<input type="hidden" name="del_fwd" value="" />
<input type="hidden" name="clean_fwd" value="" />
<input type="hidden" name="activate_fwd" value="" />
</tr>
<tr class="center">
<td colspan="3">
- <input type="hidden" name="user_id" value="{$mr.user_id}" />
+ <input type="hidden" name="uid" value="{$mr.uid}" />
<input type="submit" name="b_edit" value="Modifier" />
</td>
</tr>
</div>
{/if}
<a href="events{if !$ev.nonlu}/unread/{$ev.id}{else}#newsid{$ev.id}{/if}" target="_blank" id="link-{$ev.id}"
- title="Ajouté le {$ev.creation_date|date_format} par {profile user=$ev.user_id link=false sex=false promo=true}">
+ title="Ajouté le {$ev.creation_date|date_format} par {profile user=$ev.uid link=false sex=false promo=true}">
{tidy}
{$ev.titre|nl2br}
{/tidy}
{if $smarty.session.auth ge AUTH_COOKIE}
{if !$c.wasinscrit && !$c.dcd}
{if $show_action eq ajouter}
- <a href="carnet/notifs/add_nonins/{$c.user_id}?token={xsrf_token}" target="_top">{*
+ <a href="carnet/notifs/add_nonins/{$c.uid}?token={xsrf_token}" target="_top">{*
*}{icon name=add title="Ajouter à la liste de mes surveillances"}</a>
{else}
- <a href="carnet/notifs/del_nonins/{$c.user_id}?token={xsrf_token}" target="_top">{*
+ <a href="carnet/notifs/del_nonins/{$c.uid}?token={xsrf_token}" target="_top">{*
*}{icon name=cross title="Retirer de la liste de mes surveillances"}</a>
{/if}
{elseif $c.wasinscrit && !$c.dcd}
<img src="photo/{$set[trombi.index_prev].hruid}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_with_admin && hasPerm('admin')}
- <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_prev].user_id}">{icon name=wrench title="[admin]"}</a>
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_prev].uid}">{icon name=wrench title="[admin]"}</a>
{/if}
</td>
<td class="center" style="vertical-align: middle">
<img src="photo/{$set[trombi].hruid}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_with_admin && hasPerm('admin')}
- <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi].uid}">{icon name=wrench title="[admin]"}</a>
{/if}
</td>
<td class="center" style="vertical-align: middle">
<img src="photo/{$set[trombi.index_next].hruid}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_with_admin && hasPerm('admin')}
- <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_next].user_id}">{icon name=wrench title="[admin]"}</a>
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi.index_next].uid}">{icon name=wrench title="[admin]"}</a>
{/if}
{/if}
</td>
<img src="photo/{$set[trombi].hruid}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_with_admin && hasPerm('admin')}
- <a href="{$mainsiteurl}admin/trombino/{$set[trombi].user_id}">{icon name=wrench title="[admin]"}</a>
+ <a href="{$mainsiteurl}admin/trombino/{$set[trombi].uid}">{icon name=wrench title="[admin]"}</a>
{/if}
</td>
<td></td><td></td>
<img src="{$globals->baseurl}/photo/{$p.forlife}" width="110" alt=" [ PHOTO ] " />
</a>
{if $trombi_admin && hasPerm('admin') && !$urlmainsite}
- <a href="admin/trombino/{$p.user_id}">
+ <a href="admin/trombino/{$p.uid}">
{icon name=wrench title="[admin]"}</a>
{/if}
<br />
Camarade :
<select name="mk_uid[{$login}]">
{iterate from=$it item=user}
- <option value="{$user.user_id}">{$user.prenom} {$user.nom} (X{$user.promo})</option>
+ <option value="{$user.uid}">{$user.prenom} {$user.nom} (X{$user.promo})</option>
{/iterate}
</select><br />
Action* :
<td {if $art.photo}colspan="2"{/if}>
<div style="float: right">
<small>
- Annonce proposée par {profile user=$art.user_id sex=false promo=true groupperms=false}
+ Annonce proposée par {profile user=$art.uid sex=false promo=true groupperms=false}
</small>
</div>
<small>