openside("Sidste nyt!"); $result = dbquery( "SELECT l.type AS type, l.id AS id, l.title AS title, MAX(l.mdate) AS mdate, fusion_users.user_name AS name FROM ". "( ". "SELECT 'PA' AS type, fusion_photos.album_id AS id, ". "fusion_photos.photo_datestamp AS mdate, fusion_photo_albums.album_title AS title, fusion_photos.photo_user AS user_id ". "FROM fusion_photos ". "LEFT JOIN fusion_photo_albums ON fusion_photos.album_id=fusion_photo_albums.album_id ". "UNION ". "SELECT 'A' AS type , article_id AS id, article_datestamp AS mdate, article_subject as title, article_name AS user_id ". "FROM fusion_articles ". "UNION ". "SELECT CONCAT('C', comment_type) AS type, comment_item_id AS id, comment_datestamp AS mdate, comment_message AS title, comment_name AS user_id ". "FROM fusion_comments ". "WHERE comment_type='A' OR comment_type='P' ". ") AS l ". "LEFT JOIN fusion_users ON fusion_users.user_id=l.user_id ". "GROUP BY l.type, l.id, l.user_id ". "ORDER BY mdate DESC LIMIT 0,10" ); if (dbrows($result) != 0) { while($data = dbarray($result)) { $id = $data['id']; $titlelong = $data['title']; $titleshort = trimlink($titlelong, 25); $name = $data['name']; switch ($data['type']) { case 'PA': $link="photogallery.php?album_id=".$id; $titlelong="Nye billeder: ".$titlelong." fra ".$name; break; case 'A': $link="readarticle.php?article_id=".$id; $titlelong="Ny artikel: ".$titlelong." fra ".$name; break; case 'CA': $link="readarticle.php?article_id=".$id; $titlelong="Ny kommentar til artikel: ".trimlink($titlelong, 50)." fra ".$name; break; case 'P': $link="photogallery.php?photo_id=".$id; $titlelong="Nyt billede: ".$titlelong." fra ".$name; break; case 'CP': $link="photogallery.php?photo_id=".$id; $titlelong="Ny kommentar til billede: ".trimlink($titlelong, 50)." fra ".$name; break; default: $link=""; break; } echo " $titleshort
\n"; } } else { echo "
".$locale['004']."
\n"; } closeside();