Index: mythweb/themes/Default/program_detail.php
===================================================================
--- mythweb/themes/Default/program_detail.php (revision 7368)
+++ mythweb/themes/Default/program_detail.php (working copy)
@@ -105,12 +105,12 @@
category)) { ?>
- :
- - category ?>
+ - category ?>
airdate)) {
?>
- :
- - airdate ?>
+ - airdate ?>
rating)) {
?>
@@ -122,46 +122,29 @@
?>:
- rating ?>
get_credits('host')) {
+ $credit_types = array('host' => 'Hosted by',
+ 'presenter' => 'Presented by',
+ 'actor' => 'Cast',
+ 'guest_star' => 'Guest Starring',
+ 'director' => 'Directed by',
+ 'producer' => 'Produced by',
+ 'executive_producer' => 'Exec. Producer',
+ 'writer' => 'Written by');
+ foreach (array_keys($credit_types) as $c) {
+ if ($program->get_credits($c)) {
?>
- - :
- - get_credits('host') ?>
-get_credits('presenter')) {
+ - :
-
+get_credits($c)) as $peep) {
+ $peep = trim($peep);
+ $peeplist[] = "$peep";
+ }
+ print implode(', ', $peeplist);
+?>
+
- - :
- - get_credits('presenter') ?>
-get_credits('actor')) {
-?>
- - :
- - get_credits('actor') ?>
-get_credits('guest_star')) {
-?>
- - :
- - get_credits('guest_star') ?>
-get_credits('director')) {
-?>
- - :
- - get_credits('director') ?>
-get_credits('producer')) {
-?>
- - :
- - get_credits('producer') ?>
-get_credits('executive_producer')) {
-?>
- - :
- - get_credits('executive_producer') ?>
-get_credits('writer')) {
-?>
- - :
- - get_credits('writer') ?>
-
Index: mythweb/search.php
===================================================================
--- mythweb/search.php (revision 7368)
+++ mythweb/search.php (working copy)
@@ -15,38 +15,45 @@
// Load all channels
load_all_channels();
-// A single search string passed in
- if ($_GET['searchstr'] || $_POST['searchstr']) {
+ $program_search_fields = array('title', 'subtitle', 'descr', 'category', 'category_type', 'originalairdate', 'name');
+
+// A single search string passed in, OR search
+ if (array_key_exists('searchstr', $_REQUEST)) {
unset($_SESSION['search']);
- $_SESSION['search']['searchstr'] = _or($_GET['searchstr'], $_POST['searchstr']);
- $_SESSION['search']['search_title'] = _or($_GET['search_title'], $_POST['search_title']);
- $_SESSION['search']['search_subtitle'] = _or($_GET['search_subtitle'], $_POST['search_subtitle']);
- $_SESSION['search']['search_description'] = _or($_GET['search_description'], $_POST['search_description']);
- $_SESSION['search']['search_category'] = _or($_GET['search_category'], $_POST['search_category']);
- $_SESSION['search']['search_category_type'] = _or($_GET['search_category_type'], $_POST['search_category_type']);
+ $_SESSION['search']['searchstr'] = $_REQUEST['searchstr'];
+ foreach ($program_search_fields as $e) {
+ $e = "search_$e";
+ if (array_key_exists($e, $_REQUEST)) {
+ $_SESSION['search'][$e] = $_REQUEST[$e];
+ }
+ }
}
-
-// Individual search strings for different fields
- elseif ($_GET['title'] || $_GET['subtitle'] || $_GET['description'] || $_GET['category'] || $_GET['category_type'] || $_GET['originalairdate']
- || $_POST['title'] || $_POST['subtitle'] || $_POST['description'] || $_POST['category'] || $_POST['category_type'] || $_POST['originalairdate'] ) {
- unset($_SESSION['search']);
- $_SESSION['search']['title'] = _or($_GET['title'], $_POST['title']);
- $_SESSION['search']['subtitle'] = _or($_GET['subtitle'], $_POST['subtitle']);
- $_SESSION['search']['description'] = _or($_GET['description'], $_POST['description']);
- $_SESSION['search']['category'] = _or($_GET['category'], $_POST['category']);
- $_SESSION['search']['category_type'] = _or($_GET['category_type'], $_POST['category_type']);
- $_SESSION['search']['originalairdate'] = _or($_GET['originalairdate'], $_POST['originalairdate']);
+// Individual search strings for different fields, AND search
+ else {
+ $first = 1;
+ foreach ($program_search_fields as $e) {
+ if (array_key_exists($e, $_REQUEST)) {
+ if ($first) {
+ unset($_SESSION['search']);
+ $first = 0;
+ }
+ $_SESSION['search'][$e] = $_REQUEST[$e];
+ }
+ }
}
// Update some universal search settings
- if ($_GET['search_exact'] || $_POST['search_exact'])
- $_SESSION['search']['search_exact'] = _or($_GET['search_exact'], $_POST['search_exact']);
- if ($_GET['search_hd'] || $_POST['search_hd'])
- $_SESSION['search']['search_hd'] = _or($_GET['search_hd'], $_POST['search_hd']);
+ if ($_REQUEST['search_exact'])
+ $_SESSION['search']['search_exact'] = $_REQUEST['search_exact'];
+ if ($_REQUEST['search_hd'])
+ $_SESSION['search']['search_hd'] = $_REQUEST['search_hd'];
// Flags that apply in all cases
- $nodups = _or($_GET['nodups'], $_POST['nodups']);
+ $nodups = $_REQUEST['nodups'];
+// Debugging
+// print_r($_SESSION['search']); exit;
+
// Start the query
$search_name = '';
$query = array();
@@ -99,16 +106,11 @@
else
$search = search_escape($search_str);
// Build the query
- if ($_SESSION['search']['search_title'])
- $query[] = "program.title$compare$search";
- if ($_SESSION['search']['search_subtitle'])
- $query[] = "program.subtitle$compare$search";
- if ($_SESSION['search']['search_description'])
- $query[] = "program.description$compare$search";
- if ($_SESSION['search']['search_category'])
- $query[] = "program.category$compare$search";
- if ($_SESSION['search']['search_category_type'])
- $query[] = "program.category_type$compare$search";
+ foreach ($program_search_fields as $e) {
+ if (array_key_exists("search_$e", $_SESSION['search'])) {
+ $query[] = "program.$e$compare$search";
+ }
+ }
// No query formed - default to quicksearch
if (!count($query)) {
$query[] = "program.title$compare$search";
@@ -121,18 +123,26 @@
// Individual-field search is an AND search
$joiner = ' AND ';
// Build the query
- if ($_SESSION['search']['title'])
- $query[] = "program.title$compare".search_escape($_SESSION['search']['title']);
- if (isset($_SESSION['search']['subtitle']))
- $query[] = "program.subtitle$compare".search_escape($_SESSION['search']['subtitle']);
- if (isset($_SESSION['search']['description']))
- $query[] = "program.description$compare".search_escape($_SESSION['search']['description']);
- if (isset($_SESSION['search']['category']))
- $query[] = "program.category$compare".search_escape($_SESSION['search']['category']);
- if (isset($_SESSION['search']['category_type']))
- $query[] = "program.category_type$compare".search_escape($_SESSION['search']['category_type']);
- if (isset($_SESSION['search']['originalairdate']))
- $query[] = "program.originalairdate > NOW()";
+ $search_name_list = array();
+ foreach ($program_search_fields as $e) {
+ if (isset($_SESSION['search'][$e])) {
+ if ($e == 'originalairdate') {
+ $search_name_list[] = "originally aired " . $_SESSION['search'][$e];
+ if (strstr($_SESSION['search']['originalairdate'], '-')) {
+ $query[] = "program.originalairdate = '".$_SESSION['search'][$e]."'";
+ } else {
+ $query[] = "program.originalairdate LIKE '".$_SESSION['search'][$e]."-%'";
+ }
+ } elseif ($e == 'name') {
+ $query[] = "people.$e$compare".search_escape($_SESSION['search'][$e]);
+ $search_name_list[] = "cast or crew includes " . $_SESSION['search'][$e];
+ } else {
+ $query[] = "program.$e$compare".search_escape($_SESSION['search'][$e]);
+ $search_name_list[] = "$e is " . $_SESSION['search'][$e];
+ }
+ }
+ }
+ $search_name = implode(', ', $search_name_list);
}
// No query?
Index: mythweb/includes/programs.php
===================================================================
--- mythweb/includes/programs.php (revision 7368)
+++ mythweb/includes/programs.php (working copy)
@@ -107,13 +107,15 @@
trigger_error("load_all_program_data() attempted with an empty \$Channels array", FATAL);
$these_channels = implode(',', $these_channels);
// Build the sql query, and execute it
- $query = 'SELECT program.*,'
+ $query = 'SELECT distinct program.*,'
.' UNIX_TIMESTAMP(program.starttime) AS starttime_unix,'
.' UNIX_TIMESTAMP(program.endtime) AS endtime_unix,'
.' CONCAT(repeat('.escape(star_character).', program.stars * '.escape(max_stars).'), IF((program.stars * '.escape(max_stars).' * 10) % 10, "½", "")) AS starstring,'
.' IFNULL(programrating.system, "") AS rater,'
.' IFNULL(programrating.rating, "") AS rating'
.' FROM program LEFT JOIN programrating USING (chanid, starttime)'
+ .' LEFT JOIN credits USING (chanid, starttime)'
+ .' LEFT JOIN people USING (person)'
.' WHERE';
// Only loading a single channel worth of information
if ($chanid > 0)