File: /home/httpd/html/porn.tw/public_html/controllers/control.crss.php
<?php
if (!is_numeric($_GET['id'])) {
exit(_t("Invalid ID"));
}
if (is_numeric($_GET['limit'])) {
$limit = (int) $_GET['limit'];
} else {
$limit = 100;
}
header('Content-type: text/xml; charset=UTF-8');
$rssRow = dbRow("SELECT * FROM rss_feed WHERE record_num = '$_GET[id]'");
if (empty($rssRow)) {
exit(_t("Invalid Feed"));
}
echo $rssRow['top'];
$niches = json_decode($rssRow['channels'],true);
if(is_array($niches)) {
$imploded = implode(",",$niches);
$nichesAnd = "AND content.record_num IN (SELECT content_niches.content FROM content_niches WHERE content_niches.niche IN ($imploded))";
}
$result = dbQuery("SELECT * FROM content WHERE enabled = 1 AND photos = 0 $nichesAnd ORDER BY encoded_date DESC LIMIT $limit",false);
foreach($result as $row) {
$link = "$basehttp/videos/" . urlencode(strtolower(str_replace($bad, $good, $row['title']))) . "-" . $row['record_num'] . ".html";
if ($row['embed']) {
$thumb_main = "$thumb_url/embedded/$row[record_num].jpg";
$thumb1 = $thumb_main;
$thumb2 = $thumb_main;
$thumb3 = $thumb_main;
$thumb4 = $thumb_main;
$thumb5 = $thumb_main;
$thumb6 = $thumb_main;
$thumb7 = $thumb_main;
$thumb8 = $thumb_main;
$thumb9 = $thumb_main;
$embed = $row[embed];
} else {
$dirname = str_replace('.flv', '', $row['orig_filename']);
$subdir = $row['filename'][0] . '/' . $row['filename'][1] . '/' . $row['filename'][2] . '/' . $row['filename'][3] . '/' . $row['filename'][4] . '/';
$dirname = $subdir . $dirname;
$thumb_main = "$thumb_url/$dirname/$row[orig_filename]-$row[main_thumb].jpg";
$thumb1 = "$thumb_url/$dirname/$row[orig_filename]-1.jpg";
$thumb2 = "$thumb_url/$dirname/$row[orig_filename]-2.jpg";
$thumb3 = "$thumb_url/$dirname/$row[orig_filename]-3.jpg";
$thumb4 = "$thumb_url/$dirname/$row[orig_filename]-4.jpg";
$thumb5 = "$thumb_url/$dirname/$row[orig_filename]-5.jpg";
$thumb6 = "$thumb_url/$dirname/$row[orig_filename]-6.jpg";
$thumb7 = "$thumb_url/$dirname/$row[orig_filename]-7.jpg";
$thumb8 = "$thumb_url/$dirname/$row[orig_filename]-8.jpg";
$thumb9 = "$thumb_url/$dirname/$row[orig_filename]-9.jpg";
$embed = '<iframe src="' . $basehttp . '/embed/' . $row[record_num] . '" width="640" height="480"></iframe>';
}
unset($catstring);
$cresult = dbQuery("SELECT pornstars.name, pornstars.record_num FROM pornstars, content_pornstars WHERE content_pornstars.content = '$row[record_num]' AND content_pornstars.pornstar = pornstars.record_num GROUP BY pornstars.record_num ORDER BY name ASC",false);
foreach($cresult as $crow) {
$catstring .= "$crow[name], ";
}
$catstring = substr($catstring, 0, -2);
$pornstars = $catstring;
unset($catstring);
$cresult = dbQuery("SELECT niches.name, niches.record_num FROM niches, content_niches WHERE content_niches.content = '$row[record_num]' AND content_niches.niche = niches.record_num GROUP BY niches.record_num ORDER BY name ASC",false);
foreach($cresult as $crow) {
$catstring .= "$crow[name], ";
}
$catstring = substr($catstring, 0, -2);
$categories = $catstring;
$replace = array('{title}', '{keywords}', '{embed}', '{description}', '{url}', '{thumb_main}', '{thumb1}', '{thumb2}', '{thumb3}', '{thumb4}', '{thumb5}', '{thumb6}', '{thumb7}', '{thumb8}', '{thumb9}', '{pornstars}', '{categories}', '{lengthsec}', '{length}');
$with = array($row['title'], $row['keywords'], $embed, $row['description'], $link, $thumb_main, $thumb1, $thumb2, $thumb3, $thumb4, $thumb5, $thumb6, $thumb7, $thumb8, $thumb9, $pornstars, $categories, $row['length'], sec2time($row['length']));
echo str_replace($replace, $with, $rssRow['feed']);
}
echo $rssRow['bottom'];
exit();
?>