File: /home/httpd/html/porn.tw/public_html/controllers/control.wmfeed.php
<?php
header("Content-Type: text/plain");
$bad = array('?', '!', ' ', '&', '*', '$', '#', '@');
$good = array('', '', '-', '', '', '', '', '');
$_GET = mysql_real_escape_array($_GET);
if (is_numeric($_GET[limit])) {
$limit = $_GET[limit];
} else {
$limit = 1000;
}
if ($_GET['format']) {
$format = $_GET['format'];
} else {
$format = "id|username|url|length|title|description|keywords|channels|pornstars|main_thumb|all_thumbs";
}
$validOrderBy = array("encoded_date","views","length");
$validDirection = array("asc","desc");
if(in_array($_GET['orderBy'],$validOrderBy)) {
$orderBy = $_GET['orderBy'];
} else {
$orderBy = 'encoded_date';
}
if(in_array($_GET['orderDirection'],$validDirection)) {
$orderDirection = $_GET['orderDirection'];
} else {
$orderDirection = 'desc';
}
if($_GET['channels']) {
$imploded = mysqli_real_escape_string($dblink,$_GET['channels']);
$nichesAnd = "AND content.record_num IN (SELECT content_niches.content FROM content_niches WHERE content_niches.niche IN ($imploded))";
}
$result = dbQuery("SELECT content.*, (SELECT content_views.views FROM content_views WHERE content_views.content = content.record_num) AS views, (SELECT users.username FROM users WHERE users.record_num = content.submitter) AS username FROM content WHERE enabled = 1 AND photos = 0 $nichesAnd ORDER BY $orderBy $orderDirection LIMIT 0,$limit", true);
foreach ($result as $row) {
$bad = array('?', '!', ' ', '&', '*', '$', '#', '@');
$good = array('', '', '-', '', '', '', '', '');
$link = generateUrl('video', $row['title'], $row['record_num']) . "?utm_source=$_GET[utm_source]&utm_medium=$_GET[utm_medium]&utm_campaign=$_GET[utm_campaign]";
$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;
unset($thumbsArr);
if ($row[embed]) {
$thumb = "$thumb_url/embedded/$row[record_num].jpg";
} else {
$thumb = "$thumb_url/$dirname/$row[orig_filename]-$row[main_thumb].jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-1.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-2.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-3.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-4.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-5.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-6.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-7.jpg";
$thumbsArr[] = "$thumb_url/$dirname/$row[orig_filename]-8.jpg";
}
$embed = "<iframe src='$basehttp/embed/$row[record_num]' allowfullscreen frameborder=0 width=640 height=480></iframe>";
$pornstars = strip_tags(buildPornstars($row[record_num]));
$channels = strip_tags(buildChannels($row[record_num]));
$thumbs = implode(",", $thumbsArr);
$badDesc = array("\r","\n","\t");
$replace = array("\n",
"\r",
"\t",
'id',
'username',
'url',
'length',
'title',
'description',
'keywords',
'channels',
'pornstars',
'embed',
'main_thumb',
'all_thumbs',
'encoded_date'
);
$with = array("",
"",
"",
$row[record_num],
$row[username],
$link,
$row[length],
$row[title],
str_replace($badDesc,"",$row[description]),
$row[keywords],
$channels,
$pornstars,
$embed,
$thumb,
$thumbs,
$row['encoded_date']
);
echo str_replace($replace, $with, $format) . "\n";
}
exit();
?>