From: Stéphane Jacob Date: Mon, 1 Mar 2010 19:22:52 +0000 (+0100) Subject: Removes last occurence to table photo. X-Git-Tag: xorg/1.0.0~332^2~134 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5d83c3be8d026adc67efc2ea1ac7fb37de8b2ccd;p=platal.git Removes last occurence to table photo. Signed-off-by: Stéphane Jacob --- diff --git a/classes/profile.php b/classes/profile.php index 8087474..f46eb15 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -231,16 +231,14 @@ class Profile */ public function getPhoto($fallback = true) { - /* TODO: migrate photo table to profile_photo, change uid to pid - */ $cond = ''; if ($this->visibility) { $cond = ' AND pub IN ' . XDB::formatArray($this->visibility); } - $res = XDB::query('SELECT * + $res = XDB::query("SELECT * FROM profile_photos - WHERE attachmime IN (\'jpeg\', \'png\') - ' . $cond . ' AND pid = {?}', + WHERE attachmime IN ('jpeg', 'png') + " . $cond . ' AND pid = {?}', $this->id()); if ($res->numRows() > 0) { $photo = $res->fetchOneAssoc(); diff --git a/modules/xnet.php b/modules/xnet.php index 00e929e..2a03c39 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -42,10 +42,11 @@ class XnetModule extends PLModule return PL_NOT_FOUND; } - $res = XDB::query("SELECT attachmime, attach - FROM aliases AS a - INNER JOIN photo AS p ON(a.uid = p.uid) - WHERE alias = {?}", $x); + $res = XDB::query("SELECT pp.attachmime, pp.attach + FROM aliases AS a + INNER JOIN account_profiles AS ap ON (ap.uid = a.uid AND FIND_IN_SET('owner', ap.flags)) + INNER JOIN profile_photos AS pp ON (ap.pid = pp.pid) + WHERE a.alias = {?}", $x); if ((list($type, $data) = $res->fetchOneRow())) { pl_cached_dynamic_content_headers("image/$type");