/** * Generate genres array for use with genre checkboxes * * @param array $selected selected genre IDs * @return string HTML for genre checkboxes */ function out_genres2($item_genres = null) { // get detailed genres $all_genres = getGenres(); $adultgenres = array(); if ($config['multiuser'] && !check_permission(PERM_ADULT)) { $adultgenres = get_adult_genres(); } $genres = array(); foreach ($all_genres as $gen) { // don't show adult genres if no permissions if (in_array($gen['id'], $adultgenres)) { continue; } // selected? if ($item_genres) { $gen['checked'] = @in_array($gen['id'], $item_genres) ? 1 : 0; } $genres[] = $gen; } return $genres; }
/** * Checks if a movie is not prohibited because of adults content * * @param integer $id video id * @return boolean Returns true if access is granted */ function adultcheck($id) { global $config; if (check_permission(PERM_ADULT) || empty($config['adultgenres'])) { // no multiuser or adult genres set or we actually do have the // permissions - whatever let's watch some pr0n ;-) return true; } $adultgenres = 'genre_id=' . join(' OR genre_id=', get_adult_genres()); $select = 'SELECT video_id FROM ' . TBL_VIDEOGENRE . ' WHERE video_id = ' . $id . ' AND (' . $adultgenres . ')'; $result = runSQL($select); return empty($result[0]['video_id']); }