'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 = strtr(db_string(trim($_GET['search'])),$SpecialChars); // 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] = 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']) && !empty($OrderTable[$_GET['order']])) { $Order = $OrderTable[$_GET['order']]; } else { $Order = 'ID'; } if(!empty($_GET['way']) && !empty($WayTable[$_GET['way']])) { $Way = $WayTable[$_GET['way']]; } else { $Way = 'DESC'; } $BookmarkView = !empty($_GET['bookmarks']); if ($BookmarkView) { $BookmarkJoin = 'INNER JOIN bookmarks_collages AS bc ON c.ID = bc.CollageID'; } else { $BookmarkJoin = ''; } $SQL = "SELECT SQL_CALC_FOUND_ROWS c.ID, c.Name, c.NumTorrents, c.TagList, c.CategoryID, c.UserID, um.Username FROM collages AS c $BookmarkJoin LEFT JOIN users_main AS um ON um.ID=c.UserID 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(!empty($Tags)) { $SQL.= " AND TagList LIKE '%"; $SQL .= implode("%' AND TagList LIKE '%", $Tags); $SQL .= "%'"; } if(!empty($_GET['userid'])) { $UserID = $_GET['userid']; if(!is_number($UserID)) { error(404); } $User = user_info($UserID); $Perms = 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)).")"; } $SQL.=" ORDER BY $Order $Way LIMIT $Limit "; $DB->query($SQL); $Collages = $DB->to_array(); $DB->query("SELECT FOUND_ROWS()"); list($NumResults) = $DB->next_record(); show_header(($BookmarkView)?'Your bookmarked collages':'Browse collages'); ?>

Your bookmarked collages

Browse collages

Search for:
Tags:
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.

'.$Tag.''; } $Tags = implode(', ', $Tags); //Print results ?>
Category Collage Torrents Author
[Remove bookmark]