File: /home/httpd/html/freecams1.com/public_html/admin/xml_feeds.php
<?php
require "db.php";
if ($_POST['list']) {
foreach ($_POST['list'] as $i) {
if (is_numeric($i)) {
dbQuery("DELETE FROM `xml_feeds` WHERE `record_num` = '$i'");
}
}
}
if (isset($_POST['formSubmit'])) {
$_POST = array_map_array('trim', $_POST);
if ($_POST['name'] == "") {
setMessage('Feed "Name" is required!', 'error');
}
if ($_POST['url'] == "") {
setMessage('Feed "URL" is required!', 'error');
}
if (!getMessages(false, 'error')) {
dbInsert('xml_feeds', array(
'name' => $_POST['name'],
'url' => $_POST['url'],
'hotlink' => $_POST['hotlink'],
'paysite' => $_POST['paysite'],
));
setMessage('Feed saved successfully. <a href="xml_feeds.php">Click here to go back</a>');
header("Location: $_SERVER[REQUEST_URI]");
exit;
} else {
entities_walk($_POST);
}
}
?>
<? require "header.php"; ?>
<div class="content-page">
<div class="header-area">
<div class="breadcrumbs">
<a href="index.php">Admin Home</a>
<span><a href="xml_feeds.php">XML Feeds</a></span>
</div>
</div>
<div class="content-outer">
<h2>XML<strong>Feeds</strong></h2>
<div class="notification info">XML Imports use the <a href="example.xml">standard Tube XML format</a>. It is the same format most of the other popular tube scripts support. Use this page to add/edit/remove XML feeds. These feeds will update automatically and store videos in your approval queue.</div>
<div class="content-inner">
<? echo getMessages(); ?>
<form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th colspan="2">Add New Feed</th>
</tr>
</thead>
<tr>
<td>Name</td>
<td><input name="name" type="text" required value="<? echo $_POST['name']; ?>" /></td>
</tr>
<tr>
<td>URL</td>
<td><input name="url" type="text" required value="<? echo $_POST['url']; ?>"/></td>
</tr>
<tr>
<td>Hotlink?</td>
<td>
<select name="hotlink">
<option value="0"<? echo $_POST['hotlink'] == '0' ? ' selected' : ''; ?>>Hosted</option>
<option value="1"<? echo $_POST['hotlink'] == '1' ? ' selected' : ''; ?>>Hotlinked</option>
</select>
</td>
</tr>
<tr>
<td>Paysite</td>
<td>
<select name="paysite">
<option value="0">None</option>
<?php $paysites = dbQuery("SELECT `record_num`, `name` FROM `paysites` ORDER BY `name`", false); ?>
<?php if (is_array($paysites)) { ?>
<?php foreach ($paysites as $paysite) { ?>
<option value="<?php echo $paysite['record_num']; ?>"<?php echo $paysite['record_num'] == $_POST['paysite'] ? ' selected' : ''; ?>><?php echo $paysite['name']; ?></option>
<?php } ?>
<?php } ?>
</select>
</td>
</tr>
<tr class="item submit">
<td colspan="2">
<input type="hidden" name="formSubmit" value="1" />
<button type="submit" class="btn action-search">Save XML Feed</button>
</td>
</tr>
</table>
</form>
<form method="POST" action="" enctype="multipart/form-data" class="form" novalidate autocomplete="off">
<table class="pagetable">
<thead>
<tr>
<th>Name</th>
<th>URL</th>
<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>
<?php $results = dbQuery("SELECT * FROM `xml_feeds` ORDER BY `name`", false); ?>
<tbody>
<?php if (!is_array($results)) { ?>
<tr><td colspan="4"><div class="notification alert">No entries found</div></td></tr>
<?php } else { ?>
<?php foreach ($results as $row) { ?>
<tr>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['url']; ?></td>
<td class="options">
<a href="edit_feed.php?id=<?php echo $row['record_num']; ?>" class="btn btn-xs btn-orange" title="Edit Feed"><i class="ion ion-edit icon-edit"></i></a>
</td>
<td>
<label class="checkbox">
<input type="checkbox" name="list[]" value="<?php echo $row['record_num']; ?>" id="ids-<?php echo $row['record_num']; ?>"><i></i>
</label>
</td>
</tr>
<?php } ?>
<?php } ?>
<tr class="item submit">
<td colspan="4">
<?php if (is_array($results)) { ?>
<button type="submit" class="btn action-delete">Delete Selected</button>
<?php } ?>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<?php require "footer.php"; ?>