mediarss.php
Here's the link:
choosegallery.php
Here's the php file:
<?php
//make sure connections file exists
//--
$rssdir = getcwd();
chdir(dirname(__FILE__));
require('Connections/powergallery.php');
require('webassist/framework/library.php');
chdir($rssdir);
mysql_select_db($database_powergallery);
if(empty($no_xml_header)) header('Content-type: text/xml');
$gallery_id = (isset($_GET['gallery']) && is_numeric($_GET['gallery'])) ? intval($_GET['gallery']) : false;
$thumb_size = isset($_GET['thumb']) ? $_GET['thumb'] : '62c';
$full_size = isset($_GET['full']) ? $_GET['full'] : '782p';
$super_size = isset($_GET['super']) ? $_GET['super'] : false;
$url_prefix = '';
$absLink = dirname(__FILE__);
$assumedRoot = (empty($_GET['local'])?$virtualdir:"") . "/".(abs2rel($absLink,$site_root)). "/";
$assumedRoot = str_replace("//", "/", $assumedRoot);
$WAGLOBAL_Root_URL = ((isset($_SERVER['SERVER_PROTOCOL']) && strpos($_SERVER['SERVER_PROTOCOL'], 'HTTPS') !== false) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] .( (isset($_SERVER['SERVER_PORT'])&& $_SERVER['SERVER_PORT'] != 80)?":".$_SERVER['SERVER_PORT']:"") . $assumedRoot;
//global settings
$wa_settings = array();
$result = mysql_query('SELECT * FROM wa_settings');
while($row = mysql_fetch_assoc($result)) {
$wa_settings[$row['name']] = $row['value'];
}
//get first gallery id if none specified
if(!$gallery_id) {
$gallery_id = mysql_result(mysql_query('
SELECT COALESCE(id, 0) AS id
FROM pg1_gallery
ORDER BY id ASC LIMIT 0, 1'), 0, 'id');
}
//get url prefix if not set to local
if(empty($_GET['local'])) {
$url_prefix = $WAGLOBAL_Root_URL;
}
//gallery prefix
$gallery_prefix = 'images/' . $gallery_id . '/';
$url_prefix .= $gallery_prefix;
$gallery_prefix = realpath(dirname(__FILE__)) . '/' . $gallery_prefix;
if(!function_exists('xmlencode')) {
function xmlencode($s) {
return htmlspecialchars($s);
}
}
$result_gallery = mysql_query('
SELECT *
FROM pg1_gallery
WHERE id = ' . $gallery_id);
if(mysql_num_rows($result_gallery) == 1) {
$row_gallery = mysql_fetch_assoc($result_gallery);
echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
echo '<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">';
echo '<channel><title>' . xmlencode($row_gallery['title']) . '</title><link></link><description></description><generator>PowerGallery by WebAssist</generator>';
$result = mysql_query('
SELECT *
FROM pg1_gallery_images
WHERE gallery_id = ' . $gallery_id . "
ORDER BY display_order ASC");
if(mysql_num_rows($result) > 0) {
while($row = mysql_fetch_assoc($result)) {
//get image info
$thumb_file = $row['file_prefix'] . '_' . $thumb_size . '.' . $row['file_ext'];
$thumb_imagesize = @getimagesize($gallery_prefix . $thumb_file);
$full_file = $row['file_prefix'] . '_' . $full_size . '.' . $row['file_ext'];
$full_imagesize = @getimagesize($gallery_prefix . $full_file);
if(!empty($super_size)) {
$super_size_file = $row['file_prefix'] . '_' . $super_size . '.' . $row['file_ext'];
$super_size_imagesize = @getimagesize($gallery_prefix . $super_size_file);
}
//create item
echo '<item>';
echo '<title>' . xmlencode($row['title']) . '</title><description>' . xmlencode($row['description']) . '</description><link></link>';
echo '<media:title>' . xmlencode($row['title']) . '</media:title><media:description>' . xmlencode($row['description']) . '</media:description>';
echo '<media:thumbnail url="' . $url_prefix . $thumb_file . '" type="' . $thumb_imagesize['mime'] . '" ' . $thumb_imagesize[3] . ' />';
echo '<media:content url="' . $url_prefix . $full_file . '" type="' . $full_imagesize['mime'] . '" ' . $full_imagesize[3] . ' />';
if(!empty($super_size)) {
echo '<media:supersize url="' . $url_prefix . $super_size_file . '" type="' . $super_size_imagesize['mime'] . '" ' . $super_size_imagesize[3] . ' />';
}
echo '</item>';
}
}
echo '</channel>';å
echo '</rss>';
}
?>