announces.user_id -> announces.uid
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 26 Feb 2010 21:50:57 +0000 (22:50 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 26 Feb 2010 21:58:29 +0000 (22:58 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/validations/evts.inc.php
modules/events.php
modules/events/feed.inc.php
modules/gadgets.php
templates/events/admin.tpl
templates/events/index.tpl
upgrade/account/20_naming_convention.sql

index c269587..bb2ebb5 100644 (file)
@@ -135,7 +135,7 @@ class EvtReq extends Validate
     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)) {
index a9dc2d5..98d4a37 100644 (file)
@@ -143,22 +143,22 @@ class EventsModule extends PLModule
         // 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'));
@@ -452,7 +452,7 @@ class EventsModule extends PLModule
             }
 
             $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,
index 2d9b966..524ff32 100644 (file)
@@ -47,7 +47,7 @@ class EventFeed extends PlFeed
         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()');
index 40651cd..d769a9d 100644 (file)
@@ -45,9 +45,9 @@ class GadgetsModule extends PLModule
         $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());
index 8bd9026..9513349 100644 (file)
@@ -60,7 +60,7 @@
       <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>
index b4e32d0..5a5744c 100644 (file)
@@ -189,7 +189,7 @@ Bienvenue {$smarty.session.display_name}{if $birthday}
             <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>
index 3dfadf4..977897d 100644 (file)
@@ -20,6 +20,12 @@ CHANGE COLUMN  cle pkey VARCHAR(5) NOT NULL;
   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;