'ID', 'Name'=>'c.Name', 'Torrents'=>'NumTorrents'); $WayTable = array('Ascending'=>'ASC', 'Descending'=>'DESC'); // Are we searching in bodies, or just names? if(!empty($_GET['type'])) { $Type = $_GET['type']; if(!in_array($Type, array('c.name', 'description'))) { $Type = 'c.name'; } } else { $Type = 'c.name'; } if(!empty($_GET['search'])) { // What are we looking for? Let's make sure it isn't dangerous. $Search = db_string(trim($_GET['search'])); // Break search string down into individual words $Words = explode(' ', $Search); } if(!empty($_GET['tags'])) { $Tags = explode(',',db_string(trim($_GET['tags']))); foreach($Tags as $ID=>$Tag) { $Tags[$ID] = Misc::sanitize_tag($Tag); } } if(!empty($_GET['cats'])) { $Categories = $_GET['cats']; foreach($Categories as $Cat=>$Accept) { if(empty($CollageCats[$Cat]) || !$Accept) { unset($Categories[$Cat]); } } $Categories = array_keys($Categories); } else { $Categories = array(1,2,3,4,5,6); } // Ordering if(!empty($_GET['order_by']) && !empty($OrderTable[$_GET['order_by']])) { $Order = $OrderTable[$_GET['order_by']]; } else { $Order = 'ID'; } if(!empty($_GET['order_way']) && !empty($WayTable[$_GET['order_way']])) { $Way = $WayTable[$_GET['order_way']]; } else { $Way = 'DESC'; } $BookmarkView = !empty($_GET['bookmarks']); if ($BookmarkView) { $Categories[] = 0; $BookmarkJoin = 'INNER JOIN bookmarks_collages AS bc ON c.ID = bc.CollageID'; } else { $BookmarkJoin = ''; } $BaseSQL = $SQL = "SELECT SQL_CALC_FOUND_ROWS c.ID, c.Name, c.NumTorrents, c.TagList, c.CategoryID, c.UserID FROM collages AS c $BookmarkJoin WHERE Deleted = '0'"; if ($BookmarkView) { $SQL .= " AND bc.UserID = '" . $LoggedUser['ID'] . "'"; } if(!empty($Search)) { $SQL .= " AND $Type LIKE '%"; $SQL .= implode("%' AND $Type LIKE '%", $Words); $SQL .= "%'"; } if (isset($_GET['tags_type']) && $_GET['tags_type'] == 0) { // Any $_GET['tags_type'] = 0; } else { // All $_GET['tags_type'] = 1; } if(!empty($Tags)) { $SQL.= " AND (TagList LIKE '%"; if ($_GET['tags_type'] == 0) { $SQL .= implode("%' OR TagList LIKE '%", $Tags); } else { $SQL .= implode("%' AND TagList LIKE '%", $Tags); } $SQL .= "%')"; } if(!empty($_GET['userid'])) { $UserID = $_GET['userid']; if(!is_number($UserID)) { error(404); } $User = Users::user_info($UserID); $Perms = Permissions::get_permissions($User['PermissionID']); $UserClass = $Perms['Class']; $UserLink = ''.$User['Username'].''; if(!empty($_GET['contrib'])) { if (!check_paranoia('collagecontribs', $User['Paranoia'], $UserClass, $UserID)) { error(403); } $DB->query("SELECT DISTINCT CollageID FROM collages_torrents WHERE UserID = $UserID"); $CollageIDs = $DB->collect('CollageID'); if(empty($CollageIDs)) { $SQL .= " AND 0"; } else { $SQL .= " AND c.ID IN(".db_string(implode(',', $CollageIDs)).")"; } } else { if (!check_paranoia('collages', $User['Paranoia'], $UserClass, $UserID)) { error(403); } $SQL .= " AND UserID='".$_GET['userid']."'"; } $Categories[] = 0; } if(!empty($Categories)) { $SQL.=" AND CategoryID IN(".db_string(implode(',',$Categories)).")"; } if ($_GET['action'] == 'mine') { $SQL = $BaseSQL; $SQL .= " AND c.UserID='".$LoggedUser['ID']."' AND c.CategoryID=0"; } $SQL.=" ORDER BY $Order $Way LIMIT $Limit "; $DB->query($SQL); $Collages = $DB->to_array(); $DB->query("SELECT FOUND_ROWS()"); list($NumResults) = $DB->next_record(); View::show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages'); ?>

Your bookmarked collages

Browse collages

Search terms:
Tags (comma-separated):   />   />
Categories: $Cat) { ?> >   
Search in: /> Names   /> Descriptions
Order by:

You have not bookmarked any collages.

Your search did not match anything.

Make sure all names are spelled correctly, or try making your search less specific.

Category Collage Torrents Author
Remove bookmark
format('collages.php?action=search&tags=')?>