Файл: adultscript-2.0.3-pro/files/admin/modules/player/components/add.php
Строк: 169
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_player_add
{
public function __construct()
{
}
public function render()
{
$errors = array();
$messages = array();
$profile = array(
'name' => '', 'description' => '', 'status' => 1,
'autoPlay' => 'true', 'autoBuffering' => 'true', 'bufferLength' => 3, 'scaling' => 'scale',
'canvas_backgroundColor' => '#000000', 'canvas_backgroundGradient' => 'none',
'backgroundColor' => '#222222', 'backgroundGradient' => 'none',
'buttonColor' => '#8C072A', 'buttonOverColor' => '#AF0A38',
'bufferColor' => '#445566', 'bufferGradient' => 'none',
'timeColor' => '#01DAFF', 'timeBgColor' => '#555555',
'durationColor' => '#ffffff',
'sliderColor' => '#BF0B3D', 'sliderGradient' => 'none',
'progressColor' => '#8C072A', 'progressGradient' => 'none',
'volumeSliderColor' => '#000000', 'volumeSliderGradient' => 'none',
'borderRadius' => '0', 'tooltipColor' => '#5F747C', 'tooltipTextColor' => '#ffffff',
'height' => '24', 'opacity' => '1.0',
'play' => 'true', 'volume' => 'true', 'mute' => 'true',
'time' => 'true', 'stop' => 'false', 'playlist' => 'false',
'fullscreen' => 'true', 'tooltips' => '1',
'adv' => 1, 'adv_text' => 1, 'adv_image' => 1, 'adv_media' => 1,
'license' => '', 'logo' => '', 'left' => 0, 'right' => 20, 'top' => 0, 'bottom' => 5
);
if (isset($_POST['submit_add_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!';
} else {
$profile['name'] = $name;
}
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 = VF::factory('database');
$db->query("INSERT INTO #__player
SET name = '".$db->escape($name)."',
description = '".$db->escape($description)."',
type = 0,
config = '".$db->escape(serialize($config))."',
config_cache = '".$db->escape(serialize($config))."',
status = '".$status."'");
if ($db->affected_rows()) {
$messages[] = 'Player profile added!';
} else {
$errors[] = 'Failed to add profile entry! MySQL Error!?';
}
}
}
$tpl = VF::factory('template');
$tpl->menu = 'video';
$tpl->submenu = 'video_player';
$tpl->meta_title = 'Admin::Video::Player::Add';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->profile = $profile;
$tpl->load(array('header', 'player_add', 'footer'));
$tpl->display();
}
}
?>