File: /home/httpd/html/baretube.com.new/admin/ajax/metatags.edit.php
<?
require_once "../db.php";
if (!isset($_SESSION['isAdmin'])) {
die('You must be logged in as Administrator!');
}
$id = filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT);
if (!is_numeric($id) || !is_array(dbRow("SELECT * FROM `metatags` WHERE `record_num` = '$id'"))) {
echo setMessage('Metatag not found, or ID is not valid.', 'error', true);
exit;
}
$row = dbRow("SELECT * FROM `metatags` WHERE `record_num` = '$id'");
if (!is_array($row)) {
include_once 'header.popup.php';
echo '<div class="notification error">Metatag not found</div>';
include_once 'footer.popup.php';
exit();
}
if (isset($_POST['formSubmit'])) {
$_POST = array_map_array('trim', $_POST);
if (!getMessages(false, 'error')) {
$table = 'metatags';
$data = array(
'path' => $_POST['path'],
'meta_title' => $_POST['meta_title'],
'header_title' => $_POST['header_title'],
'meta_description' => $_POST['meta_description'],
'meta_keywords' => $_POST['meta_keywords'],
'robots' => $_POST['robots'],
'record_num' => $id,
);
dbUpdate($table, $data);
// clear cache for currently saved metatag
//setMessage(var_dump("metatags.$row[controller].$row[mode].$row[language]"));
setCache("metatags.$row[controller].$row[mode].$row[language]", false, -1);
setMessage('Metatag settings have been saved');
addJs('$.get("' . $basehttp . '/admin/metatags_row.php?id=' . $id . '", function(response) { $("#record' . $id . '").replaceWith(response); $("#record' . $id . '").addClass("blink"); });');
}
}
$_POST += $row;
entities_walk($_POST);
?>
<script>
$().ready(function () {
$('<input>').attr({
type: 'hidden',
id: 'mbAuthToken',
name: 'mbAuthToken',
value: '<? echo $_SESSION['mbAuthToken']; ?>'
}).appendTo('form');
});
</script>
<div class="ajax-popup">
<form action="<? echo $basehttp; ?>/admin/ajax/metatags.edit.php" class="form form-embed">
<header class="window-head">
<h1>Edit Metatags Settings</h1>
<a href="#" class="close"><i class="ion ion-close"></i></a>
</header>
<div class="content">
<? echo getMessages(); ?>
<? echo setMessage('Settings for ' . ($_POST['path'] != "" ? ("<b>path: $_POST[path]</b>") : ("<b>controller: $_POST[controller]</b>" . ($_POST['mode'] != "" ? ", <b>mode: $_POST[mode]</b>" : ''))), 'alert', true); ?>
<table class="pagetable">
<tbody>
<tr>
<td>Page Controller</td>
<td><input type="text" name="controller" value="<? echo $_POST['controller']; ?>" readonly disabled /></td>
</tr>
<tr>
<td>Page Mode</td>
<td><input type="text" name="mode" value="<? echo $_POST['mode']; ?>" readonly disabled /></td>
</tr>
<? /*<tr>
<td>Custom Path</td>
<td>
<input type="text" name="path" value="<? echo $_POST['path']; ?>" />
<p class="hint">Use star (*) as a placeholder, e.g. my-path* will apply to all pages where URL starts with "my-path"</p>
</td>
</tr>*/ ?>
<tr>
<td>Meta Title</td>
<td><input type="text" name="meta_title" value="<? echo $_POST['meta_title']; ?>" /></td>
</tr>
<tr>
<td>Header Title</td>
<td><input type="text" name="header_title" value="<? echo $_POST['header_title']; ?>" /></td>
</tr>
<tr>
<td>Meta Description</td>
<td><input type="text" name="meta_description" value="<? echo $_POST['meta_description']; ?>" /></td>
</tr>
<tr>
<td>Meta Keywords</td>
<td>
<input type="text" name="meta_keywords" value="<? echo $_POST['meta_keywords']; ?>" />
<p class="hint">Comma-separated keywords yet for some search engines.</p>
</td>
</tr>
<tr>
<td>Placeholders</td>
<td>
{{SITENAME}} - Site Name<br>
{{DESCRIPTION}} - Default Meta Description<br>
{{KEYWORDS}} - Default Meta Keywords<br>
{{USER_NAME}} - Username (submitter) of a content (available on: user profile)<br>
{{MODEL_NAME}} - Model Name assigned to a content (available on: model bio)<br>
{{PAYSITE_TITLE}} - Paysite Title (available on: paysite)<br>
{{PAYSITE_NAME}} - Paysite Header Title (available on: paysite)<br>
{{CHANNEL_TITLE}} - Channel Meta Title (available on: channel)<br>
{{CHANNEL_NAME}} - Channel Header Title (available on: channel)<br>
{{SEARCH_STRING}} - Search Query used on search pages (available on: videos/galleries/members search)<br>
{{TITLE}} - Title of the current content (available on: video, gallery)<br>
{{PAGE}} - Page information for any paginated innerpages (sample usage: "Videos{{PAGE}} - {{SITENAME}}" will return "Videos - Page 2 - <?php echo $sitename; ?>" or "Videos - <?php echo $sitename; ?>" for page 1)
</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 pull-right">Save</button>
<a href="#" class="btn btn-back action-cancel pull-left">Cancel</a>
</td>
</tr>
</tbody>
</table>
</div>
</form>
</div>