diff options
| author | fisharebest <fisharebest@gmail.com> | 2013-01-30 12:56:30 +0000 |
|---|---|---|
| committer | fisharebest <fisharebest@gmail.com> | 2013-01-30 12:56:30 +0000 |
| commit | a2a20c1815bfb8918cc38eac119b95ac4b6c0214 (patch) | |
| tree | 3f265169c7db04e654a95877a526bfe30e7f46fe /library/WT | |
| parent | 5819ff7cf1e8f755af2548519a6fe641f2bed9f6 (diff) | |
| download | webtrees-a2a20c1815bfb8918cc38eac119b95ac4b6c0214.tar.gz webtrees-a2a20c1815bfb8918cc38eac119b95ac4b6c0214.tar.bz2 webtrees-a2a20c1815bfb8918cc38eac119b95ac4b6c0214.zip | |
#1104494 - svn 14680 - Folder Media List shows all tree media
Diffstat (limited to 'library/WT')
| -rw-r--r-- | library/WT/Query/Media.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/library/WT/Query/Media.php b/library/WT/Query/Media.php index 6c94de7c10..5bcccde588 100644 --- a/library/WT/Query/Media.php +++ b/library/WT/Query/Media.php @@ -65,24 +65,18 @@ class WT_Query_Media { // Generate a filtered, sourced, privacy-checked list of media objects - for the media list. public static function mediaList($folder, $subfolders, $sort, $filter) { + // All files in the folder, plus external files $sql = "SELECT 'OBJE' AS type, m_id AS xref, m_file AS ged_id, m_gedcom AS gedrec, m_titl, m_filename" . " FROM `##media`" . " WHERE m_file=?" . - " AND (m_filename LIKE CONCAT(?, '%', ?, '%')" . - " OR m_filename LIKE CONCAT('http://%', ?, '%')" . - " OR m_filename LIKE CONCAT('https://%', ?, '%')" . - " OR m_titl LIKE CONCAT('%', ?, '%')" . - " )"; + " AND (m_filename LIKE CONCAT(?, '%') OR m_filename LIKE 'http://%' OR m_filename LIKE 'https://%')"; $args = array( WT_GED_ID, $folder, - $filter, - $filter, - $filter, - $filter, ); + // Exclude subfolders switch ($subfolders) { case 'include': // subfolders are included by default @@ -95,6 +89,13 @@ class WT_Query_Media { throw new Exception('Bad argument (subfolders=', $subfolders, ') in WT_Query_Media::mediaList()'); } + // Apply search terms + if ($filter) { + $sql .= " AND (m_filename LIKE CONCAT('%', ?, '%') OR m_titl LIKE CONCAT('%', ?, '%'))"; + $args[] = $filter; + $args[] = $filter; + } + switch ($sort) { case 'file': $sql .= " ORDER BY m_filename"; |
