Файл: adultscript-2.0.3-pro/files/admin/modules/pornstar/components/config.php
Строк: 86
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_pornstar_config
{
public function __construct()
{
}
public function render()
{
$errors = array();
$messages = array();
$warnings = array();
if (isset($_POST['submit_config'])) {
$filter = VF::factory('filter');
$models_per_page = (int) trim($_POST['models_per_page']);
$videos_per_page = (int) trim($_POST['videos_per_page']);
$albums_per_page = (isset($_POST['albums_per_page'])) ? (int) trim($_POST['albums_per_page']) : 20;
$allow_rating = (int) trim($_POST['allow_rating']);
$rating_count = (int) trim($_POST['rating_count']);
$rating_type = $filter->get('rating_type');
$view_comments = (int) trim($_POST['view_comments']);
$allow_comment = (int) trim($_POST['allow_comment']);
$comments_per_page = (int) trim($_POST['comments_per_page']);
$approve_comments = (int) trim($_POST['approve_comments']);
$photo_allowed_ext = $filter->get('photo_allowed_ext');
$photo_max_size = (int) trim($_POST['photo_max_size']);
$photo_width = (int) trim($_POST['photo_width']);
$photo_height = (int) trim($_POST['photo_height']);
$photo_method = $filter->get('photo_method');
$track_views = (int) trim($_POST['track_views']);
if (!$errors) {
$photo_allowed_ext = explode(',', preg_replace('/[^a-z,]+/', '', $photo_allowed_ext));
$pcfg = array();
$pcfg['components'] = array(
'browse' => 1,
'view' => 1,
'search' => 1,
'videos' => 1,
'albums' => 1
);
$pcfg['models_per_page'] = $models_per_page;
$pcfg['videos_per_page'] = $videos_per_page;
$pcfg['albums_per_page'] = $albums_per_page;
$pcfg['allow_rating'] = $allow_rating;
$pcfg['rating_count'] = $rating_count;
$pcfg['rating_type'] = $rating_type;
$pcfg['view_comments'] = $view_comments;
$pcfg['allow_comment'] = $allow_comment;
$pcfg['comments_per_page'] = $comments_per_page;
$pcfg['approve_comments'] = $approve_comments;
$pcfg['photo_allowed_ext'] = $photo_allowed_ext;
$pcfg['photo_max_size'] = $photo_max_size;
$pcfg['photo_width'] = $photo_width;
$pcfg['photo_height'] = $photo_height;
$pcfg['photo_method'] = $photo_method;
$pcfg['track_views'] = $track_views;
$db = VF::factory('database');
$db->query("UPDATE #__module
SET config_cache = '".$db->escape(serialize($pcfg))."',
config = '".$db->escape(serialize($pcfg))."'
WHERE name = 'pornstar'
LIMIT 1");
VF::cache_set('pornstar', $pcfg, 'module');
$messages[] = 'Pornstar module configuration updated!';
}
}
$tpl = VF::factory('template');
$tpl->menu = 'pornstar';
$tpl->submenu = 'pornstar_config';
$tpl->meta_title = 'Admin::Pornstar::Config';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->warnings = $warnings;
$tpl->pcfg = VF::cfg('module.pornstar', TRUE, TRUE);
$tpl->load(array('header', 'pornstar_config', 'footer'));
$tpl->display();
}
}