Файл: adultscript-2.0.3-pro/files/admin/modules/player/components/edit.php
Строк: 144
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_player_edit
{
public function __construct()
{
}
public function render()
{
$db = VF::factory('database');
$errors = array();
$messages = array();
$profile = array();
$id = (isset($_GET['id'])) ? (int) trim($_GET['id']) : 0;
$db->query("SELECT player_id FROM #__player WHERE player_id = ".$id." LIMIT 1");
if ($db->affected_rows()) {
if (isset($_POST['submit_edit_player'])) {
$filter = &VF::factory('filter');
$name = $filter->get('name');
$description = $filter->get('description');
$autoPlay = ($_POST['autoPlay'] == 'false') ? 'false' : 'true';
$autoBuffering = ($_POST['autoBuffering'] == 'false') ? 'false' : 'true';
$bufferLength = $filter->get('bufferLength', 'INT');
$scaling = $filter->get('scaling');
$backgroundColor = $filter->get('backgroundColor');
$backgroundGradient = $filter->get('backgroundGradient');
$buttonColor = $filter->get('buttonColor');
$buttonOverColor = $filter->get('buttonOverColor');
$bufferColor = $filter->get('bufferColor');
$bufferGradient = $filter->get('bufferGradient');
$timeColor = $filter->get('timeColor');
$timeBgColor = $filter->get('timeBgColor');
$durationColor = $filter->get('durationColor');
$sliderColor = $filter->get('sliderColor');
$sliderGradient = $filter->get('sliderGradient');
$progressColor = $filter->get('progressColor');
$progressGradient = $filter->get('progressGradient');
$volumeSliderColor = $filter->get('volumeSliderColor');
$volumeSliderGradient = $filter->get('volumeSliderGradient');
$borderRadius = $filter->get('borderRadius', 'INT');
$tooltipColor = $filter->get('tooltipColor');
$tooltipTextColor = $filter->get('tooltipTextColor');
$height = $filter->get('height', 'INT');
$opacity = $filter->get('opacity');
$c_backgroundColor = $filter->get('canvas_backgroundColor');
$c_backgroundGradient = $filter->get('canvas_backgroundGradient');
$status = $filter->get('status', 'INT');
$play = ($_POST['play'] == 'false') ? 'false' : 'true';
$volume = ($_POST['volume'] == 'false') ? 'false' : 'true';
$mute = ($_POST['mute'] == 'false') ? 'false' : 'true';
$time = ($_POST['time'] == 'false') ? 'false' : 'true';
$stop = ($_POST['stop'] == 'false') ? 'false' : 'true';
$playlist = ($_POST['playlist'] == 'false') ? 'false' : 'true';
$fullscreen = ($_POST['fullscreen'] == 'false') ? 'false' : 'true';
$tooltips = ($_POST['tooltips'] == '0') ? '0' : '1';
$adv = (int) trim($_POST['adv']);
$adv_text = (int) trim($_POST['adv_text']);
$adv_image = (int) trim($_POST['adv_image']);
$adv_media = (int) trim($_POST['adv_media']);
$license = trim($_POST['license']);
$logo = trim($_POST['logo']);
$top = (int) trim($_POST['top']);
$left = (int) trim($_POST['left']);
$right = (int) trim($_POST['right']);
$bottom = (int) trim($_POST['bottom']);
if ($name == '') {
$errors[] = 'Player profile name field cannot be left blank!';
} elseif (!VValid::length($name, 1, 100)) {
$errors[] = 'Player profile name field cannot contain more that 100 characters!';
} elseif (!VValid::aldash($name)) {
$errors[] = 'Player profile name field can contain only alphanumeric characters, dashes and underscores!';
}
if (!$errors) {
$config = array(
'autoPlay' => $autoPlay,
'autoBuffering' => $autoBuffering,
'bufferLength' => $bufferLength,
'scaling' => $scaling,
'backgroundColor' => $backgroundColor,
'backgroundGradient' => $backgroundGradient,
'buttonColor' => $buttonColor,
'buttonOverColor' => $buttonOverColor,
'bufferColor' => $bufferColor,
'bufferGradient' => $bufferGradient,
'timeColor' => $timeColor,
'timeBgColor' => $timeBgColor,
'durationColor' => $durationColor,
'sliderColor' => $sliderColor,
'sliderGradient' => $sliderGradient,
'progressColor' => $progressColor,
'progressGradient' => $progressGradient,
'volumeSliderColor' => $volumeSliderColor,
'volumeSliderGradient' => $volumeSliderGradient,
'borderRadius' => $borderRadius,
'tooltipColor' => $tooltipColor,
'tooltipTextColor' => $tooltipTextColor,
'height' => $height,
'opacity' => $opacity,
'canvas_backgroundColor' => $c_backgroundColor,
'canvas_backgroundGradient' => $c_backgroundGradient,
'play' => $play,
'volume' => $volume,
'mute' => $mute,
'time' => $time,
'stop' => $stop,
'playlist' => $playlist,
'fullscreen' => $fullscreen,
'tooltips' => $tooltips,
'adv' => $adv,
'adv_text' => $adv_text,
'adv_image' => $adv_image,
'adv_media' => $adv_media,
'license' => $license,
'logo' => $logo,
'top' => $top,
'left' => $left,
'bottom' => $bottom,
'right' => $right
);
$db->query("UPDATE #__player
SET name = '".$db->escape($name)."',
description = '".$db->escape($description)."',
config = '".$db->escape(serialize($config))."',
config_cache = '".$db->escape(serialize($config))."',
status = '".$status."'
WHERE player_id = ".$id."
LIMIT 1");
VF::factory('cache')->remove($name);
$messages[] = 'Player profile added!';
}
}
$db->query("SELECT player_id, name, description, status, config_cache
FROM #__player
WHERE player_id = ".$id."
LIMIT 1");
$player = $db->fetch_assoc();
$profile = array(
'player_id' => $player['player_id'],
'name' => $player['name'],
'description' => $player['description'],
'status' => $player['status']
);
$profile = array_merge($profile, unserialize($player['config_cache']));
// echo var_dump($profile). '<br />';
}
$tpl = VF::factory('template');
$tpl->menu = 'video';
$tpl->submenu = 'player_manage';
$tpl->meta_title = 'Admin::Video::Player::Edit';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->profile = $profile;
$tpl->load(array('header', 'player_edit', 'footer'));
$tpl->display();
}
}
?>