Файл: adultscript-2.0.3-pro/files/admin/modules/template/config/defboot.php
Строк: 73
<?php
defined('_VALID') or die('Restricted Access!');
function template_config_defboot($tpl_id)
{
$errors = array();
if (isset($_POST['submit_config'])) {
$filter = VF::factory('filter');
$categories_left = (int) trim($_POST['categories_left']);
$categories_popular = (int) trim($_POST['categories_popular']);
$channels_popular = (int) trim($_POST['channels_popular']);
$pornstars_popular = (int) trim($_POST['pornstars_popular']);
$albums_recent = (int) trim($_POST['albums_recent']);
$albums_popular = (int) trim($_POST['albums_popular']);
$tags_popular = (int) trim($_POST['tags_popular']);
$video_categories_left = (int) trim($_POST['video_categories_left']);
$photo_categories_left = (int) trim($_POST['photo_categories_left']);
$links = (int) trim($_POST['links']);
$sharing_links = (int) trim($_POST['sharing_links']);
$facebook = trim($_POST['facebook']);
$twitter = trim($_POST['twitter']);
$google_plus = trim($_POST['google_plus']);
$thumblr = trim($_POST['thumblr']);
$pinterest = trim($_POST['pinterest']);
$instagram = trim($_POST['instagram']);
$sharing_code = trim($_POST['sharing_code']);
$javascript_code = trim($_POST['javascript_code']);
$colors = $filter->get('colors');
$logo_url = trim($_POST['logo_url']);
if (isset($_FILES) && isset($_FILES['logo_file']['tmp_name']) && $_FILES['logo_file']['tmp_name'] != '') {
if ($file = VUpload::process('logo_file', 10, array('png'))) {
$dst_dir = BASE_DIR.'/templates/defboot/images';
$dst = BASE_DIR.'/templates/defboot/images/logo.png';
if (file_exists($dst) && is_readable($dst)) {
if (!is_writable($dst)) {
$errors[] = 'Logo path is not writable! Please chmod '.$dst.' to 0777 via FTP!';
}
} else {
if (!file_exists($dst_dir) or !is_writable($dst_dir)) {
$errors[] = 'Template images folder does not exist or not writable! Please chmod '.$dst_dir.' to 0777 via FTP!';
}
}
} else {
$errors = array_merge($errors, VUpload::error());
}
}
if ($logo_url != '' && !VValid::url($logo_url)) {
$errors[] = 'Logo URL is not a valid URL address!';
}
if (!$errors) {
if (isset($file)) {
$logo_url = '';
if (!move_uploaded_file($file['path'], $dst)) {
$errors[] = 'Failed to move uploaded file to '.$dst.'!';
}
}
if (!$errors) {
$config = array(
'categories_left' => $categories_left,
'categories_popular' => $categories_popular,
'channels_popular' => $channels_popular,
'pornstars_popular' => $pornstars_popular,
'tags_popular' => $tags_popular,
'albums_recent' => $albums_recent,
'albums_popular' => $albums_popular,
'video_categories_left' => $video_categories_left,
'photo_categories_left' => $photo_categories_left,
'javascript_code' => $javascript_code,
'colors' => $colors,
'logo_url' => $logo_url,
'links' => $links,
'sharing_links' => $sharing_links,
'sharing_code' => $sharing_code,
'facebook' => $facebook,
'twitter' => $twitter,
'google_plus' => $google_plus,
'thumblr' => $thumblr,
'pinterest' => $pinterest,
'instagram' => $instagram
);
$db = VF::factory('database');
$db->query("
UPDATE #__template
SET config = '".$db->escape(serialize($config))."',
config_cache = '".$db->escape(serialize($config))."'
WHERE tpl_id = ".$tpl_id."
LIMIT 1
");
VCfg::cache_set('defboot', $config, 'template');
return true;
}
}
return $errors;
}
}