|
@@ 822-859 (lines=38) @@
|
| 819 |
|
censorText($row['subject']); |
| 820 |
|
|
| 821 |
|
// Do we want to include any attachments? |
| 822 |
|
if (!empty($modSettings['attachmentEnable']) && !empty($modSettings['xmlnews_attachments']) && allowedTo('view_attachments', $row['id_board'])) |
| 823 |
|
{ |
| 824 |
|
$attach_request = $smcFunc['db_query']('', ' |
| 825 |
|
SELECT |
| 826 |
|
a.id_attach, a.filename, COALESCE(a.size, 0) AS filesize, a.mime_type, a.downloads, a.approved, m.id_topic AS topic |
| 827 |
|
FROM {db_prefix}attachments AS a |
| 828 |
|
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg) |
| 829 |
|
WHERE a.attachment_type = {int:attachment_type} |
| 830 |
|
AND a.id_msg = {int:message_id}', |
| 831 |
|
array( |
| 832 |
|
'message_id' => $row['id_msg'], |
| 833 |
|
'attachment_type' => 0, |
| 834 |
|
'is_approved' => 1, |
| 835 |
|
) |
| 836 |
|
); |
| 837 |
|
$loaded_attachments = array(); |
| 838 |
|
while ($attach = $smcFunc['db_fetch_assoc']($attach_request)) |
| 839 |
|
{ |
| 840 |
|
// Include approved attachments only |
| 841 |
|
if ($attach['approved']) |
| 842 |
|
$loaded_attachments['attachment_' . $attach['id_attach']] = $attach; |
| 843 |
|
} |
| 844 |
|
$smcFunc['db_free_result']($attach_request); |
| 845 |
|
|
| 846 |
|
// Sort the attachments by size to make things easier below |
| 847 |
|
if (!empty($loaded_attachments)) |
| 848 |
|
{ |
| 849 |
|
uasort($loaded_attachments, function($a, $b) { |
| 850 |
|
if ($a['filesize'] == $b['filesize']) |
| 851 |
|
return 0; |
| 852 |
|
return ($a['filesize'] < $b['filesize']) ? -1 : 1; |
| 853 |
|
}); |
| 854 |
|
} |
| 855 |
|
else |
| 856 |
|
$loaded_attachments = null; |
| 857 |
|
} |
| 858 |
|
else |
| 859 |
|
$loaded_attachments = null; |
| 860 |
|
|
| 861 |
|
// Being news, this actually makes sense in rss format. |
| 862 |
|
if ($xml_format == 'rss' || $xml_format == 'rss2') |
|
@@ 1232-1269 (lines=38) @@
|
| 1229 |
|
censorText($row['subject']); |
| 1230 |
|
|
| 1231 |
|
// Do we want to include any attachments? |
| 1232 |
|
if (!empty($modSettings['attachmentEnable']) && !empty($modSettings['xmlnews_attachments']) && allowedTo('view_attachments', $row['id_board'])) |
| 1233 |
|
{ |
| 1234 |
|
$attach_request = $smcFunc['db_query']('', ' |
| 1235 |
|
SELECT |
| 1236 |
|
a.id_attach, a.filename, COALESCE(a.size, 0) AS filesize, a.mime_type, a.downloads, a.approved, m.id_topic AS topic |
| 1237 |
|
FROM {db_prefix}attachments AS a |
| 1238 |
|
LEFT JOIN {db_prefix}messages AS m ON (m.id_msg = a.id_msg) |
| 1239 |
|
WHERE a.attachment_type = {int:attachment_type} |
| 1240 |
|
AND a.id_msg = {int:message_id}', |
| 1241 |
|
array( |
| 1242 |
|
'message_id' => $row['id_msg'], |
| 1243 |
|
'attachment_type' => 0, |
| 1244 |
|
'is_approved' => 1, |
| 1245 |
|
) |
| 1246 |
|
); |
| 1247 |
|
$loaded_attachments = array(); |
| 1248 |
|
while ($attach = $smcFunc['db_fetch_assoc']($attach_request)) |
| 1249 |
|
{ |
| 1250 |
|
// Include approved attachments only |
| 1251 |
|
if ($attach['approved']) |
| 1252 |
|
$loaded_attachments['attachment_' . $attach['id_attach']] = $attach; |
| 1253 |
|
} |
| 1254 |
|
$smcFunc['db_free_result']($attach_request); |
| 1255 |
|
|
| 1256 |
|
// Sort the attachments by size to make things easier below |
| 1257 |
|
if (!empty($loaded_attachments)) |
| 1258 |
|
{ |
| 1259 |
|
uasort($loaded_attachments, function($a, $b) { |
| 1260 |
|
if ($a['filesize'] == $b['filesize']) |
| 1261 |
|
return 0; |
| 1262 |
|
return ($a['filesize'] < $b['filesize']) ? -1 : 1; |
| 1263 |
|
}); |
| 1264 |
|
} |
| 1265 |
|
else |
| 1266 |
|
$loaded_attachments = null; |
| 1267 |
|
} |
| 1268 |
|
else |
| 1269 |
|
$loaded_attachments = null; |
| 1270 |
|
|
| 1271 |
|
// Doesn't work as well as news, but it kinda does.. |
| 1272 |
|
if ($xml_format == 'rss' || $xml_format == 'rss2') |