Changeset 28105 for extensions/export_data/admin.php
- Timestamp:
- Apr 7, 2014, 10:29:14 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/export_data/admin.php
r27092 r28105 32 32 // +-----------------------------------------------------------------------+ 33 33 34 if (isset($_GET['type']) and 'albums' == $_GET['type'])34 if (isset($_GET['type'])) 35 35 { 36 36 // output headers so that the file is downloaded rather than displayed … … 40 40 // create a file pointer connected to the output stream 41 41 $output = fopen('php://output', 'w'); 42 43 $query = ' 42 43 if ('albums' == $_GET['type']) 44 { 45 $query = ' 44 46 SELECT 45 47 id, … … 49 51 ORDER BY id ASC 50 52 ;'; 51 $result = pwg_query($query);53 $result = pwg_query($query); 52 54 53 set_make_full_url(); 54 while ($row = pwg_db_fetch_assoc($result)) 55 set_make_full_url(); 56 while ($row = pwg_db_fetch_assoc($result)) 57 { 58 fputcsv($output, array('url' => make_index_url(array('category' => $row)))); 59 } 60 } 61 62 if ('photos' == $_GET['type']) 55 63 { 56 fputcsv($output, array('url' => make_index_url(array('category' => $row)))); 64 $query = ' 65 SELECT 66 i.id, 67 file, 68 date_available, 69 date_creation, 70 i.name AS title, 71 author, 72 hit, 73 filesize, 74 width, 75 height, 76 latitude, 77 longitude, 78 group_concat(t.name) AS tags, 79 comment AS description 80 FROM '.IMAGES_TABLE.' AS i 81 LEFT JOIN '.IMAGE_TAG_TABLE.' ON image_id=i.id 82 LEFT JOIN '.TAGS_TABLE.' AS t ON tag_id=t.id 83 GROUP BY i.id 84 ORDER BY i.id 85 ;'; 86 $result = pwg_query($query); 87 88 $is_first = true; 89 while ($row = pwg_db_fetch_assoc($result)) 90 { 91 if ($is_first) 92 { 93 fputcsv($output, array_keys($row)); 94 $is_first = false; 95 } 96 97 fputcsv($output, $row); 98 } 57 99 } 100 58 101 exit(); 59 102 }
Note: See TracChangeset
for help on using the changeset viewer.