HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/approve_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` = 0");
if (!is_array($row)) {
    setMessage("Video 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')) {

        $server = 0;
        if ($multiple_servers && $_POST['server']) {
            $server = (int) $_POST['server'];
        }

        $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'],
            'server' => $_POST['server'],
            'description' => $_POST['description'],
            'keywords' => $_POST['keywords'],
            'scheduled_date' => 'NOW()',
            'paysite' => $_POST['paysite'],
            'approved' => 1,
            'submitter' => $_POST['submitter'],
            'record_num' => $id,
        ));

        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);
        }

        setMessage('Video 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>Video</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="2">Approve Video - <? 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>Filename</td>
                            <td><a href="<? echo $basehttp; ?>/content/<? echo $_POST['orig_filename']; ?>"><? echo $_POST['orig_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 colspan="3"><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 colspan="3"><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['record_num'] == $row['paysite'] ? ' selected' : ''; ?>><? echo $srow['name']; ?></option>
                                    <? } ?>
                                </select>
                            </td>
                        </tr>
                        <?php if ($multiple_servers == 1 && $row['photos'] == 0 && empty($row['embed'])) { ?>
                            <tr>
                                <td>Media Server</td>
                                <td>
                                    <select name="server">
                                        <option value="0">Default Media Server</option>
                                        <?php $getServers = dbQuery("SELECT `name`, `record_num` FROM `servers` ORDER BY `name`", false); ?>
                                        <?php if (count($getServers) > 0) { ?>
                                            <?php foreach ($getServers as $server) { ?>
                                                <option value="<?php echo $server['record_num']; ?>"><?php echo $server['name']; ?></option>
                                            <?php } ?>
                                        <?php } ?>
                                    </select>
                                </td>
                            </tr>
                        <?php } ?>
                        <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"; ?>