Файл: adultscript-2.0.3-pro/files/admin/modules/nuevo/components/embed.php
Строк: 85
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_nuevo_embed
{
private $db;
private $cache;
private $filter;
public function __construct()
{
$this->db = VF::factory('database');
$this->cache = VF::factory('cache');
$this->filter = VF::factory('filter');
}
public function render()
{
$errors = array();
$messages = array();
$warnings = array();
$data = array();
$this->db->query("SELECT * FROM nuevo__player WHERE ID = '2' LIMIT 1");
$player= $this->db->fetch_assoc();
if (isset($_POST['submit_player_settings'])) {
$hex_pattern = '~^[a-f0-9]{6,6}$~i';
$data['skin'] = trim($_POST['skin']);
if($data['skin']=='default') $data['skin']='';
$data['playbar'] = trim($_POST['playbar']);
$data['player_width'] = trim($_POST['player_width']);
$data['player_height'] = trim($_POST['player_height']);
$data['autostart'] = trim($_POST['autostart']);
$data['usetooltips'] = trim($_POST['usetooltips']);
$data['onclick'] = trim($_POST['onclick']);
$data['plugin_preroll'] = trim($_POST['plugin_preroll']);
$data['plugin_midroll'] = trim($_POST['plugin_midroll']);
$data['plugin_overlay'] = trim($_POST['plugin_overlay']);
$data['plugin_ticker'] = trim($_POST['plugin_ticker']);
if (!$errors) {
$sql = update_player($data)." where ID = 2";
$this->db->query($sql);
if($this->db->affected_rows()) {
$messages[] = 'Nuevoplayer settings updated succesfully!';
} else {
$errors[] = 'Error while saving data in database or nothing has changed.';
}
}
$player=$data;
}
$dir = BASE_DIR."/modules/video/nuevo/skins";
$skins=array();
$html5skins=array();
if (is_dir($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false)
{
$filename=strtolower($file);
if (substr($filename, -4)=='.swf')
$skins[] = str_replace('.swf','',$filename);
}
closedir($dh);
$direct=$dir.'/';
foreach(glob($direct.'*', GLOB_ONLYDIR) as $dir) {
$dir = str_replace($direct, '', $dir);
$html5skins[] = $dir;
}
}
$tpl = &VF::factory('template');
$tpl->menu = 'nuevo';
$tpl->submenu = 'nuevo_embed';
$tpl->meta_title = 'Admin::Nuevo::Embed Player';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->player = $player;
$tpl->pmenu = 'embed';
$tpl->skins = $skins;
$tpl->html5skins = $html5skins;
$tpl->load(array('header', 'nuevo_embed', 'footer'));
$tpl->display();
}
}
function update_player($data)
{
$sql="UPDATE nuevo__player set
skin='".mysql_real_escape_string($data['skin'])."',
playbar='".mysql_real_escape_string($data['playbar'])."',
player_width='".mysql_real_escape_string($data['player_width'])."',
player_height='".mysql_real_escape_string($data['player_height'])."',
plugin_preroll='".mysql_real_escape_string($data['plugin_preroll'])."',
plugin_midroll='".mysql_real_escape_string($data['plugin_midroll'])."',
plugin_overlay='".mysql_real_escape_string($data['plugin_overlay'])."',
plugin_ticker='".mysql_real_escape_string($data['plugin_ticker'])."',
usetooltips='".mysql_real_escape_string($data['usetooltips'])."',
autostart='".mysql_real_escape_string($data['autostart'])."',
onclick='".mysql_real_escape_string($data['onclick'])."'";
return $sql;
}
?>