Print

Print


I am missing something right in front of my eyes.  I'm rusty on my
PHP, I'm wondering if someone can help me with this error:

Warning: gmmktime() expects parameter 3 to be long, string given in
/public_html/magpierss-0.72/rss_utils.inc on line 35

I went through the manual and didn't see anything wrong with the code below.

###FROM MY PHP:

$del_user = 'nengard';						# del.icio.us username

# Use magpie to get del.icio.us links via RSS
$feed = fetch_rss('http://del.icio.us/rss/' . $del_user);

# Only make a post if there are any links today
if (count($feed->items) > 0) {

    $content = "<ul>\n";

    foreach ($feed->items as $link) {

        $publishdate = parse_w3cdtf($link['dc']['date']);

###########CODE CUT HERE##############

##FROM magpierss-0.72/rss_utils.inc

function parse_w3cdtf ( $date_str ) {

    # regex to match wc3dtf
    $pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";

    if ( preg_match( $pat, $date_str, $match ) ) {
        list( $year, $month, $day, $hours, $minutes, $seconds) =
            array( $match[1], $match[2], $match[3], $match[4],
$match[5], $match[6]);

        # LINE 35 BELOW HERE - calc epoch for current date assuming GMT
        $epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);

        $offset = 0;
        if ( $match[10] == 'Z' ) {
            # zulu time, aka GMT
        }
        else {
            list( $tz_mod, $tz_hour, $tz_min ) =
                array( $match[8], $match[9], $match[10]);

            # zero out the variables
            if ( ! $tz_hour ) { $tz_hour = 0; }
            if ( ! $tz_min ) { $tz_min = 0; }

            $offset_secs = (($tz_hour*60)+$tz_min)*60;

            # is timezone ahead of GMT?  then subtract offset
            #
            if ( $tz_mod == '+' ) {
                $offset_secs = $offset_secs * -1;
            }

            $offset = $offset_secs;
        }
        $epoch = $epoch + $offset;
        return $epoch;
    }
    else {
        return -1;
    }
}

Nicole C. Engard
Open Source Evangelist, LibLime
(888) Koha ILS (564-2457) ext. 714
[log in to unmask]
AIM/Y!/Skype: nengard

http://liblime.com
http://blogs.liblime.com/open-sesame/