Ticket #2336: handler.php.patch

File handler.php.patch, 2.3 KB (added by ATSantema@…, 18 years ago)

Patch for mythweb/modules/video/handler.php

  • handler.php

    old new  
    8484    $sh->finish();
    8585    $Category_String[0] = 'Uncategorized';
    8686
     87
     88// New:  Get the video genres on the system
     89    $Genre_String = array();
     90    $Total_Genres = 0;
     91    $sh = $db->query('SELECT * FROM videogenre');
     92    while ($row = $sh->fetch_assoc()) {
     93        $Genre_String[$row['intid']] = $row['genre'];
     94        $Total_Genres++;
     95    }
     96    $sh->finish();
     97    $Genre_String[0] = 'No Genre';   
     98   
    8799// Parse the list
    88100// Filter_Category of -1 means All, 0 mean uncategorized
    89101    $Total_Programs = 0;
     
    91103    if( isset($_GET['category']) ) {
    92104        $Filter_Category = $_GET['category'];
    93105        if( $Filter_Category != -1)
    94             $where = ' WHERE category='.$db->escape($Filter_Category);
     106            #$where = ' WHERE category='.$db->escape($Filter_Category);
     107            $where = ' AND category='.$db->escape($Filter_Category);
    95108    }
    96109    else {
    97110        $Filter_Category = -1;
    98111    }
     112   
     113// New:  sort fields
     114    if( isset($_GET['genre']) ) {
     115        $Filter_Genre = $_GET['genre'];
     116        if( $Filter_Genre != -1)
     117            $where .= ' AND idgenre='.$db->escape($Filter_Genre);
     118    }
     119    else {
     120        $Filter_Genre = -1;
     121    }
     122   
     123    if( isset($_GET['browse']) ) {
     124        $Filter_Browse = $_GET['browse'];
     125        if( $Filter_Browse != -1)
     126            $where .= ' AND browse='.$db->escape($Filter_Browse);
     127    }
     128    else {     
     129        $Filter_Browse = -1;
     130    }
     131   
     132    if( isset($_GET['search']) ) {
     133        $Filter_Search = $_GET['search'];
     134        if( strlen($Filter_Search) != 0)
     135            $where .= ' AND title LIKE '.$db->escape("%".$Filter_Search."%");
     136    }
     137    else {     
     138        $Filter_Search = "";
     139    }
     140   
     141    if ($where) { $where = 'WHERE '.substr($where, 4); }
    99142
    100     $sh = $db->query('SELECT * FROM videometadata ' . $where . ' ORDER BY title');
     143    #$sh = $db->query('SELECT * FROM videometadata ' . $where . ' ORDER BY title');
     144    // Added: New query for added sort fields
     145    $sql = 'SELECT * FROM videometadata LEFT JOIN videometadatagenre ON videometadata.intid=videometadatagenre.idvideo ' . $where . ' GROUP BY intid ORDER BY title';
     146    $sh = $db->query($sql);
     147   
    101148    while ($row = $sh->fetch_assoc()) {
    102149    // Create a new show object
    103150        $All_Shows[] = new Video($row);