[mythtv-users] mythweb Recorded Programs Warning sorting.php line 42

Andy Whitworth andywhit at gmail.com
Wed Jan 26 07:32:18 EST 2005


I put in an if statement to only perform the foreach statement
if the $_SESSION[....]  variable was set....

See "MY MOD START/END" comments to see my inserted line.

    function sort_status($field, $session = NULL) {
    // Null session means to load the last sorted session
        if (!$session)
            $session = $GLOBALS['last_sort_session'];
    // Make sure the field is lower case
        $field = strtolower($field);
    // No sort function for this variable
        if (!function_exists("by_$field"))
            return NULL;
    // Scan the sort array for any entries matching the current
choice, and remove them
        $depth = 0;
// MY MOD START
         if (!isset ( $_SESSION[$session] ) return false;
// MY MOD END
        foreach ($_SESSION[$session] as $key => $sort) {
            $depth++;
        // No match, continue looking
            if ($sort['field'] != $field)
                continue;
        // What to do now...
            return ($sort['reverse'] ? 0 - $depth : $depth);
        }
    // No match found
        return false;
    }




On Wed, 26 Jan 2005 12:14:27 +0000, Andrew Cheung <agccheung at gmail.com> wrote:
> Mythweb (0.16v) displays errors whilst on the Recorded Programs:
> 
> Warning at /var/www/html/mythweb/includes/sorting.php, line 42:
> Invalid argument supplied for foreach()
> 
> Doesn't display any recorded program details, even though there are recordings.
> 
> Help would be appreciated.
> 
> Thanks
> 
> Andrew
> 
> 
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> 
> 
>


More information about the mythtv-users mailing list