Файл: adultscript-2.0.3-pro/files/admin/templates/default/extend/ajax/preview_adv.plugin.php
Строк: 27
<?php
defined('_VALID') or die('Restricted Access!');
function ajax_plugin_preview_adv()
{
$data = array('status' => 0, 'msg' => '', 'code' => '', 'debug' => '');
if (isset($_POST['adv_id'])) {
$adv_id = (int) trim($_POST['adv_id']);
$db = VF::factory('database');
$db->query("SELECT * FROM #__adv WHERE adv_id = ".$adv_id." LIMIT 1");
if ($db->affected_rows()) {
$adv = $db->fetch_assoc();
$output = '<html><head><title>Advertising Banner Preview</title></head><body><div style="width: 100%; text-align: center;">';
if ($adv['type'] == 'html') {
$output .= $adv['code'];
} elseif ($adv['type'] == 'text') {
$title = ($adv['description'] != '') ? 'title="'.htmlspecialchars($adv['description']).'"' : '';
$output .= '<a href="'.BASE_URL.'/adv/'.$adv['adv_id'].'/"'.$title.'>'.htmlspecialchars($adv['title']).'</a>';
} elseif ($adv['type'] == 'image') {
$image_url = ($adv['image_type'] == 'url') ? $adv['image_url'] : MEDIA_URL.'/banners/'.$adv['adv_id'].'.'.$adv['image_ext'];
$output .= '<a href="'.BASE_URL.'/adv/'.$adv['adv_id'].'/"><img src="'.$image_url.'" alt="" /></a>';
} else {
$data['code'] = 'Invalid banner! What exactly did you click!?';
}
$output .= '</div></body></html>';
$data['code'] = $output;
$data['status'] = 1;
} else {
$data['code'] = 'Invalid banner! Are you sure this banner exists!?';
}
} else {
$data['code'] = 'Invalid ajax request!';
}
return json_encode($data);
}