File: //home/httpd/mech_ftp/baretube.com/admin/queue.php
<?php
ini_set("max_execution_time", "86400");
set_time_limit(86400);
require "db.php";
if ($_GET['all']) {
$result = dbQuery("SELECT `record_num`, `photos`, `filename` FROM `content` WHERE `enabled` = 0 AND `approved` = 0", false);
if(is_array($result)) {
foreach ($result as $row) {
if ($row['photos'] == 1) {
makeThumbs($row['filename']);
dbQuery("UPDATE `content` SET `approved` = 2 WHERE `record_num` = '$row[record_num]'");
if ($row['filename']) {
echo shell_exec("rm -rf $basepath/ftp_photos/$row[filename]");
}
} else {
dbQuery("UPDATE `content` SET `approved` = 1 WHERE `record_num` = '$row[record_num]'");
if (!$row['embed']) {
dbQuery("INSERT INTO `content_views` SET `views` = 0, `content` = '$row[record_num]'");
}
}
}
}
}
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
if ($_POST['action'] == 'delete') {
$result = dbQuery("SELECT `record_num`, `filename`, `orig_filename` FROM `content` WHERE `record_num` = '$i'", false);
$row = $result[0];
if ($row['record_num'] && $row['photos'] == 0) {
if ($row['orig_filename']) {
unlink($basepath . '/content/' . $row['orig_filename']);
}
} else {
if (strlen($row['filename']) > 2 && $row['record_num']) {
echo shell_exec("rm -rf $basepath/media/galleries/$row[filename]");
}
}
dbQuery("DELETE FROM `content` WHERE `record_num` = '$i'");
dbQuery("DELETE FROM `content_views` WHERE `content` = '$i'");
dbQuery("DELETE FROM `content_niches` WHERE `content` = '$i'");
dbQuery("DELETE FROM `content_pornstars` WHERE `content` = '$i'");
} else {
$result = dbQuery("SELECT `record_num`, `filename` FROM `content` WHERE `record_num` = '$i' AND `photos` = 1", false);
if (count($result) < 1) {
$server = 0;
if ($multiple_servers == 1 && isset($_POST['server'][$i]) && is_numeric($_POST['server'][$i])) {
$server = $_POST['server'][$i];
}
dbQuery("UPDATE `content` SET `approved` = 1, `server` = $server WHERE `record_num` = '$i'");
} else {
$row = $result[0];
makeThumbs($row['filename']);
dbQuery("UPDATE `content` SET `approved` = 2 WHERE `record_num` = '$i'");
if ($row[filename]) {
echo shell_exec("rm -rf $basepath/ftp_photos/$row[filename]");
}
}
dbQuery("INSERT INTO `content_views` (`views`, `content`) values ('0', '$i')");
}
}
}
}
?>
<? require "header.php"; ?>
<script type="text/javascript">
function setVideo(filename) {
$("#previewvid").load("preview.php?filename=" + filename);
}
$(document).ready(function () {
$(".preview").colorbox({width: "580px", height: "520px", inline: true, href: "#previewvid"});
});
</script>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="queue.php">Approval Queue</a></span>
</div>
</div>
<div class="content-outer">
<h2>Approval<strong>Queue</strong></h2>
<div class="notification info">The following videos are awaiting your approval. Once approved, they will be moved into the encoding queue where they will be thumbnailed and encoded (Note: Videos already in FLV or H264 format do not get re-encoded).</div>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="GET" action="" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Search Existing Content</th>
</tr>
</thead>
<tr>
<td>Select Channel</td>
<td>
<select name="channel">
<option value="">--All Channels--</option>
<?
$result1 = dbQuery("SELECT * FROM niches ORDER BY name ASC", false);
if(is_array($result1)) {
foreach ($result1 as $row1) {
?>
<option<? echo ($_REQUEST['channel'] == $row1['record_num']) ? ' selected' : ''; ?> value="<? echo $row1['record_num']; ?>"><? echo $row1['name']; ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Select Model</td>
<td><select name="pornstar">
<option value=''>--All Models--</option>
<?
$result1 = dbQuery("SELECT * FROM pornstars ORDER BY name ASC", false);
if(is_array($result1)) {
foreach ($result1 as $row1) {
?>
<option<? echo ($_REQUEST['pornstar'] == $row1['record_num']) ? ' selected' : ''; ?> value="<? echo $row1['record_num']; ?>"><? echo $row1['name']; ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Select Paysite</td>
<td>
<select name="paysite">
<option value="">--All Paysites--</option>
<option value="none"<? echo ($_REQUEST['paysite'] == 'none') ? ' selected' : ''; ?>>No Paysite</option>
<? $result1 = dbQuery("SELECT * FROM paysites ORDER BY name ASC", false); ?>
<?
if(is_array($result1)) {
foreach ($result1 as $row1) {
?>
<option<? echo ($_REQUEST['paysite'] == $row1['record_num']) ? ' selected' : ''; ?> value="<? echo $row1['record_num']; ?>"><? echo $row1['name']; ?></option>
<?
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Type</td>
<td>
<select name="type">
<option value="">--All Types--</option>
<option <? echo ($_GET['type'] == 'photos') ? ' selected' : ''; ?> value="photos">Photos</option>
<option <? echo ($_GET['type'] == 'videos') ? ' selected' : ''; ?> value="videos">Videos</option>
<option <? echo ($_GET['type'] == 'plugs') ? ' selected' : ''; ?> value="plugs">Plugs</option>
</select>
</td>
</tr>
<tr>
<td>Search</td>
<td><input name="keywords" type="text" value="<? echo $_REQUEST['keywords']; ?>" /></td>
</tr>
<tr>
<td>User Number</td>
<td><input name="user" type="text" value="<? echo $_REQUEST['user']; ?>" /></td>
</tr>
<tr>
<td>Sort By</td>
<td>
<select name="sortby">
<option<? echo ($_GET['sortby'] == 'date_added' || !$_GET['sortby']) ? ' selected' : ''; ?> value="date_added">Date Added</option>
<option<? echo ($_GET['sortby'] == 'title') ? ' selected' : ''; ?> value="title">Title</option>
<option<? echo ($_GET['sortby'] == 'length') ? ' selected' : ''; ?> value="length">Length</option>
</select>
<select name="sorttype">
<option<? echo ($_GET['sorttype'] == 'ASC') ? ' selected' : ''; ?> value="ASC">Ascending</option>
<option<? echo ($_GET['sorttype'] == 'DESC' || !$_GET['sorttype']) ? ' selected' : ''; ?> value="DESC">Descending</option>
</select>
</td>
</tr>
<tr>
<td>Results Per Page</td>
<td>
<select name="setmax">
<option<? echo ($_GET['setmax'] == '100' || !$_GET['setmax']) ? ' selected' : ''; ?> value="100">100</option>
<option<? echo ($_GET['setmax'] == '250') ? ' selected' : ''; ?> value="250">250</option>
<option<? echo ($_GET['setmax'] == '500') ? ' selected' : ''; ?> value="500">500</option>
<option<? echo ($_GET['setmax'] == '1000') ? ' selected' : ''; ?> value="1000">1000</option>
<option<? echo ($_GET['setmax'] == '2500') ? ' selected' : ''; ?> value="2500">2500</option>
</select>
</td>
</tr>
<tr class="item submit">
<td colspan="2">
<input type="hidden" name="searchSubmit" value="1" />
<button type="submit" class="btn action-search">Search</button>
</td>
</tr>
</tbody>
</table>
</form>
<form method="POST" action="" class="form" novalidate autocomplete="off">
<?
$page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int) $_GET['page'] : 1;
$max_results = (isset($_GET['setmax']) && $_GET['setmax'] > 0) ? (int) $_GET['setmax'] : 100;
$from = ($page * $max_results) - $max_results;
$okSortBy = array('date_added', 'title', 'views', 'length', 'rating');
$okSortType = array('ASC', 'DESC');
if (in_array($_REQUEST['sortby'], $okSortBy)) {
$sortBy = $_REQUEST['sortby'];
} else {
$sortBy = 'encoded_date';
}
if (in_array($_REQUEST['sorttype'], $okSortType)) {
$sortType = $_REQUEST['sorttype'];
} else {
$sortType = 'DESC';
}
if (is_numeric($_REQUEST['channel'])) {
$nicheand = " AND content_niches.niche = '$_REQUEST[channel]' AND content_niches.content = content.record_num ";
$tableif = ', content_niches ';
}
if (is_numeric($_REQUEST['pornstar'])) {
$nicheand .= " AND content_pornstars.pornstar = '$_REQUEST[pornstar]' AND content_pornstars.content = content.record_num";
$tableif .= ', content_pornstars ';
}
if (!empty($_REQUEST['keywords'])) {
$_REQUEST[keywords] = mysqli_real_escape_string($dbconn, $_REQUEST[keywords]);
$keywordsand = " AND (keywords LIKE '%$_REQUEST[keywords]%' OR title LIKE '%$_REQUEST[keywords]%' OR description LIKE '%_REQUEST[keywords]%' OR embed LIKE '%$_REQUEST[keywords]%') ";
}
if (is_numeric($_REQUEST['paysite']) || $_REQUEST['paysite'] == 'none') {
if ($_REQUEST[paysite] == 'none') {
$paysitesand = " AND content.paysite = '0'";
} else {
$paysitesand = " AND content.paysite = '$_REQUEST[paysite]'";
}
}
if (!empty($_GET['type'])) {
if ($_GET['type'] == 'photos') {
$paysitesand .= " AND photos = '1'";
} elseif ($_GET['type'] == 'videos') {
$paysitesand .= " AND photos = '0'";
} elseif ($_GET['type'] == 'plugs') {
$paysitesand .= " AND plug_url != ''";
}
}
if (is_numeric($_REQUEST['user'])) {
$paysitesand .= "AND submitter = '$_REQUEST[user]'";
}
$groupby = "GROUP BY `content`.`record_num`";
$rresult = 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`, (SELECT `paysites`.`name` FROM `paysites` WHERE `paysites`.`record_num` = `content`.`paysite`) AS `paysitename` FROM `content` $tableif WHERE 1=1 $nicheand $paysitesand $keywordsand $dateand $pornstarsand $dateaand $urland $usersand $typeand AND `content`.`enabled` = 0 AND `content`.`approved` = 0 $groupby ORDER BY $sortBy $sortType LIMIT $from,$max_results", false);
$result_count = dbQuery("SELECT COUNT(*) AS count FROM content $tableif WHERE 1=1 $nicheand $paysitesand $pornstarsand $keywordsand $dateand $dateaand $urland $usersand $typeand AND content.enabled = 0 AND approved = 0", false);
$total_results = $result_count[0]['count'];
$total_pages = ceil($total_results / $max_results);
?>
<div class="notification info"><? echo $total_results; ?> result<? echo $total_results != 1 ? 's' : ''; ?> found</div>
<table class="pagetable table-fixed">
<thead>
<tr>
<th style="width:200px">Title</th>
<th>Information</th>
<?php if ($multiple_servers == 1) { ?>
<th style="width:250px">
<?php if ($total_results > 0) { ?>
<select name="servers" class="servers-list">
<option value="0">Default Media Server</option>
<?php $getServers = dbQuery("SELECT name, record_num FROM servers ORDER BY name ASC", false); ?>
<?php if (count($getServers) > 0) { ?>
<? foreach ($getServers as $server) { ?>
<option value="<?php echo $server['record_num']; ?>"><?php echo $server['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
<?php } ?>
</th>
<?php } ?>
<th class="options"></th>
<th style="width:50px">
<label for="check-select-all-1" class="checkbox">
<input type="checkbox" name="select_all" value="1" data-items="list[]" id="check-select-all-1">
<i></i>
</label>
</th>
</tr>
</thead>
<tbody>
<? if ($total_results === 0) { ?>
<tr><td colspan="<?php echo ($multiple_servers == 1) ? "5" : "4"; ?>"><div class="notification alert">No entries found</div></td></tr>
<? } else { ?>
<? if(is_array($rresult)) { ?>
<? foreach ($rresult as $rrow) { ?>
<tr id="record<? echo $rrow['record_num']; ?>">
<? include('queue_row.php'); ?>
</tr>
<? } ?>
<? } ?>
<tr>
<td colspan="<?php echo ($multiple_servers == 1) ? "5" : "4"; ?>">
<? if ($total_results > 0) { ?>
<span>
<select name="action" id="action">
<option value="approve">Approve</option>
<option value="delete">Delete</option>
</select>
</span>
<button type="submit" class="btn action-delete" style='background-color: #85A847; border-color: #85A847'>Process Selected</button>
<? } ?>
</td>
</tr>
<? } ?>
</tbody>
</table>
<?php if ($total_results > 0 && $multiple_servers == 0) { ?>
<div class="text-center"><br><br><br><a href="queue.php?all=true" class="btn btn-sm btn-process-all"><i class="ion ion-checkmark-circled"></i> Click here to approve all content</a></div>
<?php } ?>
<div id="adminPagination"><? echo showAdminPagination($total_pages); ?></div>
</form>
</div>
</div>
</div>
<div style='display: none;'>
<div style='padding-top: 10px;' id='previewvid'>
vidpreviewgoeshere
</div>
</div>
<script>
$().ready(function () {
$(document).on('change', 'select.servers-list', function () {
var selectedServer = $(this).val();
$('select.server-row').val(selectedServer).trigger('update');
});
});
</script>
<?php require "footer.php"; ?>