Exemplo n.º 1
0
function xfd_head()
{
    global $CONFIG, $thisplugin, $XFDSET, $album, $cat;
    $xfd_feed = "index.php?file=xfeed/xfeed";
    $superCage = Inspekt::makeSuperCage();
    switch ($XFDSET['xfd_theme']) {
        case 0:
            $color = "orange";
            break;
        case 1:
            $color = "azure";
            break;
        case 2:
            $color = "red";
            break;
        case 3:
            $color = "blue";
            break;
        case 4:
            $color = "trans_dark";
            break;
        case 5:
            $color = "trans_light";
            break;
    }
    $header = "\r\n    <!-- Begin CPG XFeed Headcode -->\r\n    ";
    if ($XFDSET['xfd_feedroute'] == 1) {
        $xfeed_loc = "feeds.feedburner.com/" . $XFDSET['xfd_feedburnuname'];
        $header .= "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $CONFIG['gallery_name'] . " - Feedburner\" href=\"http://" . $xfeed_loc . "\" />\n";
    }
    $extra_header = $header_str = '';
    if ($superCage->get->keyExists('album')) {
        $album = $superCage->get->getRaw('album');
        $header_str .= "&album={$album}";
    }
    if ($superCage->get->keyExists('cat')) {
        $cat = $superCage->get->getRaw('cat');
        $header_str .= "&cat={$cat}";
    }
    // Code to show the proper title for various RSS and ATOM
    $extraTitle = '';
    if ($album) {
        if ((int) $album) {
            $albumDetails = get_album_name((int) $album);
            $album = $albumDetails['title'];
        } else {
            $album = ucwords($album);
        }
        $extraTitle .= " | {$album}";
    }
    if (!is_null($cat) && (int) $cat !== FALSE) {
        if ($cat < 0) {
            $album = -$cat;
            $query = "SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '{$album}'";
            $result = cpg_db_query($query);
            $row = cpg_db_fetch_rowset($result);
            $cat = $row[0]['category'];
        }
        $cat_name = populate_category_name($cat);
        $extraTitle .= " | {$cat_name}";
    }
    if ($header_str) {
        $extra_header = "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$CONFIG['gallery_name']}{$extraTitle} - RSS\" href=\"{$CONFIG['ecards_more_pic_target']}{$xfd_feed}{$header_str}\" />\r\n        <link rel=\"alternate\" type=\"application/atom+xml\" title=\"" . $CONFIG['gallery_name'] . "{$extraTitle} - Atom\" href=\"{$CONFIG['ecards_more_pic_target']}{$xfd_feed}&type=atom{$header_str}\" />";
    }
    $header .= "    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"" . $CONFIG['gallery_name'] . " - RSS\" href=\"" . $CONFIG['ecards_more_pic_target'] . $xfd_feed . "\" />\r\n    <link rel=\"alternate\" type=\"application/atom+xml\" title=\"" . $CONFIG['gallery_name'] . " - Atom\" href=\"" . $CONFIG['ecards_more_pic_target'] . $xfd_feed . "&amp;type=atom\" />\r\n    {$extra_header}\r\n    <style type=\"text/css\">\r\n        .xfeeds{background-image: url(./plugins/xfeed/images/xfeeds_" . $color . ".png);}\r\n    </style>\r\n    <link rel=\"stylesheet\" href=\"plugins/xfeed/css/xfeeds.css\" type=\"text/css\" />\r\n    <!-- END CPG XFeed Headcode -->\r\n    ";
    return $header;
}
Exemplo n.º 2
0
            $query = "SELECT category FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = '{$aid}'";
            $result = cpg_db_query($query);
            $row = cpg_db_fetch_rowset($result);
            $cat = $row[0]['category'];
        }
        $CURRENT_CAT_NAME = populate_category_name($cat);
        get_meta_album_set($cat);
    } else {
        get_meta_album_set(0);
    }
    $pic_data = get_pic_data($album, $count, $album_name, 0, $XFDSET['xfd_feed_items'], false);
} elseif ($superCage->get->testInt('cat')) {
    // If on category page, show the last uploaded photos for all the albums in that category in feed
    $cat = $superCage->get->getInt('cat');
    $album = 'lastup';
    $CURRENT_CAT_NAME = populate_category_name($cat);
    get_meta_album_set($cat);
    $pic_data = get_pic_data($album, $count, $album_name, 0, $XFDSET['xfd_feed_items'], false);
} else {
    get_meta_album_set(0);
    $query = "SELECT pid,aid,filepath,filename,url_prefix,pwidth,pheight,filesize,ctime,title,keywords,votes,pic_rating,hits,caption,owner_id,u.user_name FROM {$CONFIG['TABLE_PICTURES']} r, {$CONFIG['TABLE_USERS']} u\r\n            {$RESTRICTEDWHERE} AND r.owner_id = u.user_id AND approved = 'YES' ORDER BY pid DESC LIMIT 0, {$XFDSET['xfd_feed_items']}";
    $result = cpg_db_query($query);
    $pic_data = cpg_db_fetch_rowset($result);
}
/**
 * MAIN CODE
 */
$feedtype = $superCage->get->keyExists('type') ? $superCage->get->getEscaped('type') : '';
header("Content-type: text/xml; charset={$CONFIG['charset']}");
if ($feedtype == "atom") {
    atom10();