Ticket #1374: 1374.patch

File 1374.patch, 1.3 KB (added by derek@…, 18 years ago)

Patch for 1374

  • includes/sorting.php

     
    126126    }
    127127
    128128    function by_title(&$a, &$b) {
    129         return strcasecmp($a->title, $b->title);
     129        return sort_prog_titles($a->title, $b->title);
    130130    }
    131131
    132132    function by_type(&$a, &$b) {
     
    198198        return ($a->transcoder > $b->transcoder) ? 1 : -1;
    199199    }
    200200
     201    function strip_articles($str)
     202    {
     203        if(preg_match('/^A /', $str))
     204           return substr($str, 2);
     205        if(preg_match('/^An /', $str))
     206           return substr($str, 3);
     207        if(preg_match('/^The /', $str))
     208           return substr($str, 4);
     209        return $str;
     210    }
     211
     212    function sort_prog_titles($a, $b) // Arguments are strings
     213    {
     214        return strcasecmp(strip_articles($a), strip_articles($b));
     215    }
  • modules/tv/recorded.php

     
    203203    }
    204204
    205205// Sort the program titles
    206     ksort($Program_Titles);
     206    uksort($Program_Titles, 'sort_prog_titles');
    207207    ksort($Groups);
    208208
    209209// Keep track of the program/title the user wants to view