public function commit()
{
if (XDB::execute("INSERT INTO announces
- SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?},
+ SET uid = {?}, creation_date=NOW(), titre={?}, texte={?},
peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
$this->user->id(), $this->titre, $this->texte,
$this->peremption, $this->pmin, $this->pmax)) {
// Unhide the requested event, and reload the page to display it.
if ($action == 'unread' && $eid) {
XDB::execute('DELETE FROM announce_read
- WHERE evt_id = {?} AND user_id = {?}',
+ WHERE evt_id = {?} AND uid = {?}',
$eid, S::v('uid'));
pl_redirect('events#newsid'.$eid);
}
// Fetch the events to display, along with their metadata.
$array = array();
- $it = XDB::iterator("SELECT e.id, e.titre, e.texte, e.post_id, e.user_id,
+ $it = XDB::iterator("SELECT e.id, e.titre, e.texte, e.post_id, e.uid,
p.x, p.y, p.attach IS NOT NULL AS img, FIND_IN_SET('wiki', e.flags) AS wiki,
FIND_IN_SET('important', e.flags) AS important,
e.creation_date > DATE_SUB(CURDATE(), INTERVAL 2 DAY) AS news,
e.peremption < DATE_ADD(CURDATE(), INTERVAL 2 DAY) AS end,
- ev.user_id IS NULL AS nonlu, e.promo_min, e.promo_max
+ ev.uid IS NULL AS nonlu, e.promo_min, e.promo_max
FROM announces AS e
LEFT JOIN announce_photos AS p ON (e.id = p.eid)
- LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.user_id = {?})
+ LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})
WHERE FIND_IN_SET('valide', e.flags) AND peremption >= NOW()
ORDER BY important DESC, news DESC, end DESC, e.peremption, e.creation_date DESC",
S::i('uid'));
}
$pid = ($eid && $action == 'preview') ? $eid : -1;
- $sql = "SELECT e.id, e.titre, e.texte,e.id = $pid AS preview, e.user_id,
+ $sql = "SELECT e.id, e.titre, e.texte,e.id = $pid AS preview, e.uid,
DATE_FORMAT(e.creation_date,'%d/%m/%Y %T') AS creation_date,
DATE_FORMAT(e.peremption,'%d/%m/%Y') AS peremption,
e.promo_min, e.promo_max,
global $globals;
$events = XDB::iterator('SELECT e.id, e.titre AS title, e.texte, e.creation_date AS publication, e.post_id,
p.attachmime IS NOT NULL AS photo, FIND_IN_SET(\'wiki\', e.flags) AS wiki,
- e.user_id, e.promo_min, e.promo_max
+ e.uid, e.promo_min, e.promo_max
FROM announces AS e
LEFT JOIN announce_photos AS p ON (p.eid = e.id)
WHERE FIND_IN_SET("valide", e.flags) AND peremption >= NOW()');
$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.user_id
+ ev.user_id IS NULL AS nonlu, e.uid
FROM announces AS e
- LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.user_id = {?})
+ LEFT JOIN announce_read AS ev ON (e.id = ev.evt_id AND ev.uid = {?})
WHERE FIND_IN_SET("valide", e.flags) AND peremption >= NOW()
ORDER BY e.creation_date DESC', S::i('uid'));
$page->assign('event_count', XDB::query("SELECT FOUND_ROWS()")->fetchOneCell());
<a href="admin/events/preview/{$ev.id}#event{$ev.id}">{$ev.titre}</a><br />
{if !$ev.fvalide}</strong>{/if}
<small>
- Proposée par {profile user=$ev.user_id promo=true sex=false}
+ Proposée par {profile user=$ev.uid promo=true sex=false}
</small>
</td>
<td class="right">{if !$ev.fvalide}<strong>{/if}{$ev.peremption}{if !$ev.fvalide}</strong>{/if}</td>
<img alt="Sommaire" title="Remonter tout en haut" src="images/up.png"/>
</a>
</div>
- Annonce proposée par {profile user=$ev.user_id sex=false promo=true}
+ Annonce proposée par {profile user=$ev.uid sex=false promo=true}
</td>
</tr>
</table>
ALTER TABLE aliases
CHANGE COLUMN id uid INT(11) not null;
+# announces
+ ALTER TABLE announces
+CHANGE COLUMN user_id uid INT(11) not null;
+ ALTER TABLE announce_read
+CHANGE COLUMN user_id uid INT(11) not null;
+
# profile
ALTER TABLE profile_photos
CHANGE COLUMN uid pid INT(11) not null;