File: /home/httpd/html/baretube.com.new/admin/approve_photo_content.php
<?php
require "db.php";
if (!is_numeric($_GET['id'])) {
exit();
}
$id = (int) $_GET['id'];
$row = dbRow("SELECT *, (SELECT `username` FROM `users` WHERE `record_num` = `content`.`submitter`) AS `submitter__username` FROM `content` WHERE `record_num` = '$id' AND `photos` = 1");
if (!is_array($row)) {
setMessage("Gallery ID $id does not exist!", 'error');
pageNotFound(true);
}
if (isset($_POST['formSubmit'])) {
$_POST = array_map_array('trim', $_POST);
$_POST['title'] = strip_tags($_POST['title']);
$_POST['description'] = strip_tags($_POST['description']);
$_POST['keywords'] = strip_tags($_POST['keywords']);
if (!getMessages(false, 'error')) {
$getUser = dbRow("SELECT `record_num` FROM `users` WHERE `username` = '" . mysqli_real_escape_string($dblink, $_POST['submitter']) . "'");
$_POST['submitter'] = is_array($getUser) ? $getUser['record_num'] : 0;
dbUpdate('content', array(
'title' => $_POST['title'],
'description' => $_POST['description'],
'keywords' => $_POST['keywords'],
'scheduled_date' => 'NOW()',
'paysite' => $_POST['paysite'],
'approved' => 2,
'photos' => 1,
'submitter' => $_POST['submitter'],
'record_num' => $id,
));
dbUpdate('images', array(
'title' => $_POST['title'],
'gallery' => $id
), 'gallery');
dbInsert('content_views', array(
'views' => $_POST['views'],
'content' => $id,
), true);
dbQuery("DELETE FROM `content_niches` WHERE `content` = '$id'");
dbQuery("DELETE FROM `content_pornstars` WHERE content = '$id'");
if (!empty($_POST['niche'])) {
foreach ($_POST['niche'] as $i) {
if (is_numeric($i)) {
dbInsert('content_niches', array(
'content' => $id,
'niche' => $i,
), true);
}
}
}
if (!empty($_POST['pornstar'])) {
foreach ($_POST['pornstar'] as $i) {
if (is_numeric($i)) {
dbInsert('content_pornstars', array(
'content' => $id,
'pornstar' => $i,
), true);
}
}
}
foreach ($_POST['lang'] as $k => $v) {
dbInsert('content_languages', array(
'content' => $id,
'language' => $k,
'title' => $v['title'],
'description' => $v['description'],
'keywords' => $v['keywords'],
), false, true);
}
makeThumbs($row['filename']);
setMessage('Gallery approved!');
header("Location: $basehttp/admin/queue.php");
exit();
}
}
$langInfo = array();
$langData = dbQuery("SELECT * FROM `content_languages` WHERE `content` = '$id'", false);
foreach ($langData as $langRow) {
$langInfo[$langRow['language']]['title'] = $langRow['title'];
$langInfo[$langRow['language']]['description'] = $langRow['description'];
$langInfo[$langRow['language']]['keywords'] = $langRow['keywords'];
}
$_POST += $row;
$_POST['lang'] = array();
$_POST['lang'] += $langInfo;
entities_walk($_POST);
?>
<? require "header.php"; ?>
<script>
$().ready(function () {
$('.lang-selection a').on('click', function (e) {
e.preventDefault();
$('.lang-selection').find('a.active').removeClass('active');
$(this).addClass('active');
var activeItems = $(this).attr('href').replace("#", "");
$('#languages').find('.langInput').hide();
$('#languages').find('.' + activeItems).show();
return false;
});
});
</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>Approve<strong>Gallery</strong></h2>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" enctype="multipart/form-data" action="" class="form" novalidate autocomplete="off">
<table class="pagetable" id="languages">
<thead>
<tr>
<th colspan="4">Approve Gallery - <? echo $_POST['title']; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2" class="lang-selection">
<ul class="tabs custom">
<li><a href="#baseLang" class="tab active">Default</a></li>
<? foreach ($languages as $l) { ?>
<li><a href="#<? echo $l['iso']; ?>" class="tab"><i class="flag-icon flag-icon-<? echo strtolower($l['iso']); ?>"></i><? echo $l['iso']; ?></a></li>
<? } ?>
</ul>
</td>
</tr>
<tr>
<td>Folder Name</td>
<td><a href="<? echo $basehttp; ?>/content/<?php echo $_POST['orig_filename']; ?>"><?php echo $_POST['filename']; ?></a></td>
</tr>
<tr class="baseLang langInput">
<td>Title</td>
<td><input name="title" type="text" value="<? echo $_POST['title']; ?>" /></td>
</tr>
<? foreach ($languages as $l) { ?>
<tr class="<? echo $l['iso']; ?> langInput" style="display: none;">
<td><i class="flag-icon flag-icon-<? echo strtolower($l['iso']); ?>"></i>Title (<? echo $l['name']; ?>/<? echo $l['iso']; ?>)</td>
<td><input name="lang[<? echo $l['iso']; ?>][title]" type="text" value="<? echo $_POST['lang'][$l['iso']]['title']; ?>" /></td>
</tr>
<? } ?>
<tr class="baseLang langInput">
<td>Description</td>
<td><textarea name="description" cols="75" rows="3"><? echo $_POST['description']; ?></textarea></td>
</tr>
<? foreach ($languages as $l) { ?>
<tr class="<? echo $l['iso']; ?> langInput" style="display: none;">
<td><i class="flag-icon flag-icon-<? echo strtolower($l['iso']); ?>"></i>Description (<? echo $l['name']; ?>/<? echo $l['iso']; ?>)</td>
<td><textarea name="lang[<? echo $l['iso']; ?>][description]" cols="35" rows="4"><? echo $_POST['lang'][$l['iso']]['description']; ?></textarea></td>
</tr>
<? } ?>
<tr class="baseLang langInput">
<td>Keywords (Comma Separated)</td>
<td><input name="keywords" type="text" value="<? echo $_POST['keywords']; ?>" /></td>
</tr>
<? foreach ($languages as $l) { ?>
<tr class="<? echo $l['iso']; ?> langInput" style="display: none;">
<td><i class="flag-icon flag-icon-<? echo strtolower($l['iso']); ?>"></i>Keywords (<? echo $l['name']; ?>/<? echo $l['iso']; ?>)</td>
<td><input name="lang[<? echo $l['iso']; ?>][keywords]" type="text" value="<? echo $_POST['lang'][$l['iso']]['keywords']; ?>" /></td>
</tr>
<? } ?>
<tr>
<td>Views</td>
<td><input name="views" value="<? echo (int) $POST['views']; ?>" type="number" class="tiny" /></td>
</tr>
<tr>
<td>Uploader</td>
<td>
<input type="text" name="submitter" id="contentAutocomplete" value="<? echo $_POST['submitter__username']; ?>" />
<script>
$(document).ready(function () {
$("#contentAutocomplete").autocomplete({
source: "search_content.php?type=2",
minLength: 2
});
});
</script>
</td>
</tr>
<tr>
<td>Categories</td>
<td>
<? $thisniche = array(); ?>
<? $sresult = dbQuery("SELECT * FROM `content_niches` WHERE `content` = '$id'", false); ?>
<? foreach ($sresult as $srow) { ?>
<? $thisniche[] = $srow['niche']; ?>
<? } ?>
<select name="niche[]" multiple="multiple">
<? $presult = dbQuery("SELECT * FROM `niches` ORDER BY `name`", false); ?>
<? foreach ($presult as $srow) { ?>
<option<? echo in_array($srow['record_num'], $thisniche) ? ' selected' : ''; ?> value="<? echo $srow['record_num']; ?>"><? echo $srow['name']; ?></option>
<? } ?>
</select>
<p class="hint">(Hold CTRL to make multiple selections)</p>
</td>
</tr>
<tr>
<td>Models</td>
<td>
<? $thisniche = array(); ?>
<? $sresult = dbQuery("SELECT * FROM `content_pornstars` WHERE `content` = '$id'", false); ?>
<? foreach ($sresult as $srow) { ?>
<? $thisniche[] = $srow['pornstar']; ?>
<? } ?>
<select name="pornstar[]" multiple="multiple">
<? $presult = dbQuery("SELECT * FROM `pornstars` ORDER BY `name`", false); ?>
<? foreach ($presult as $srow) { ?>
<option<? echo in_array($srow['record_num'], $thisniche) ? ' selected' : ''; ?> value="<? echo $srow['record_num']; ?>"><? echo $srow['name']; ?></option>
<? } ?>
</select>
<p class="hint">(Hold CTRL to make multiple selections)</p>
</td>
</tr>
<tr>
<td>Paysite</td>
<td>
<select name="paysite">
<? $sresult = dbQuery("SELECT * FROM `paysites` ORDER BY `name`", false); ?>
<? foreach ($sresult as $srow) { ?>
<option value="<? echo $srow['record_num']; ?>"><? echo $srow['name']; ?></option>
<? } ?>
</select>
</td>
</tr>
<tr>
<td style="vertical-align:top">Photos</td>
<td>
<?php $rresult = dbQuery("SELECT * FROM `images` WHERE `gallery` = '$id'",false); ?>
<div class="thumbs grid-approve">
<ul>
<?php foreach($rresult as $rrow) { ?>
<li class="thumb">
<a href="<?php echo $gallery_url; ?>/<?php echo $_POST['filename']; ?>/<?php echo $rrow['filename']; ?>" class="colorbox" rel="gallery">
<? if (file_exists("$gallery_path/$_POST[filename]/thumbs/$rrow[filename]")) { ?>
<img src="<?php echo $gallery_url; ?>/<?php echo $_POST['filename']; ?>/thumbs/<?php echo $rrow['filename']; ?>" alt="" />
<? } else { ?>
<img src="<?php echo $gallery_url; ?>/<?php echo $_POST['filename']; ?>/<?php echo $rrow['filename']; ?>" alt="" />
<? } ?>
</a>
</li>
<?php } ?>
</ul>
</div>
</td>
</tr>
<tr class="item submit">
<td colspan="2">
<input type="hidden" name="id" value="<? echo $id; ?>" />
<input type="hidden" name="formSubmit" value="1" />
<button type="submit" class="btn action-save">Save</button>
</td>
</tr>
<tr>
<td colspan="2">
<div class="notification info">Please hit submit only once! Depending on the size of the file and the speed of the source server, it may take a few moments to download. This is neccesary even if you intend to hotlink the video on the source server, as the file is required locally to create thumbnails.</div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<? require "footer.php"; ?>