Файл: adultscript-2.0.3-pro/files/admin/modules/photo/components/config.php
Строк: 173
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_photo_config extends VModule_Admin_photo
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$errors = array();
$messages = array();
$warnings = array();
$pcfg = VF::cfg('module.photo');
if (isset($_POST['submit_config'])) {
$filter = VF::factory('filter');
$browse_type = $filter->get('browse_type');
$browse_category = (int) trim($_POST['browse_category']);
$browse_order = (int) trim($_POST['browse_order']);
$browse_timeline = (int) trim($_POST['browse_timeline']);
$browse_per_page = (int) trim($_POST['browse_per_page']);
$search_type = $filter->get('search_type');
$search_per_page = (int) trim($_POST['search_per_page']);
$rss = (int) trim($_POST['rss']);
$rss_type = $filter->get('rss_type');
$rss_per_page = (int) trim($_POST['rss_per_page']);
$tag_per_page = (int) trim($_POST['tag_per_page']);
$view_access = $filter->get('view_access');
$view_desc = (int) trim($_POST['view_desc']);
$album_per_page = (int) trim($_POST['album_per_page']);
$view_comments = (int) trim($_POST['view_comments']);
$allow_comment = (int) trim($_POST['allow_comment']);
$approve_comments = (int) trim($_POST['approve_comments']);
$comments_per_page = (int) trim($_POST['comments_per_page']);
$allow_rating = (int) trim($_POST['allow_rating']);
$rating_count = (int) trim($_POST['rating_count']);
$rating_type = $filter->get('rating_type');
$allow_password = (int) trim($_POST['allow_password']);
$approve = (int) trim($_POST['approve']);
$upload_enabled = (int) trim($_POST['upload_enabled']);
$upload_perm = $filter->get('upload_perm');
$photo_allowed_ext = $filter->get('photo_allowed_ext');
$photo_max_size = (int) trim($_POST['photo_max_size']);
$max_categories = (int) trim($_POST['max_categories']);
$cover_resize_type = $filter->get('cover_resize_type');
$cover_width = (int) trim($_POST['cover_width']);
$cover_height = (int) trim($_POST['cover_height']);
$photo_width = (int) trim($_POST['photo_width']);
$photo_height = (int) trim($_POST['photo_height']);
$thumb_width = (int) trim($_POST['thumb_width']);
$thumb_height = (int) trim($_POST['thumb_height']);
$mobile = (int) trim($_POST['mobile']);
$mobile_width = (int) trim($_POST['mobile_width']);
$mobile_height = (int) trim($_POST['mobile_height']);
$multi_server = (int) trim($_POST['multi_server']);
$thumb_server = (int) trim($_POST['thumb_server']);
$thumb_host = $filter->get('thumb_host');
$thumb_port = (int) trim($_POST['thumb_port']);
$thumb_user = trim($_POST['thumb_user']);
$thumb_pass = trim($_POST['thumb_pass']);
$thumb_root = trim($_POST['thumb_root']);
$track_views = (int) trim($_POST['track_views']);
$delete_enabled = (int) trim($_POST['delete_enabled']);
$delete_method = $filter->get('delete_method');
$delete_username = $filter->get('delete_username');
$title_min_length = (int) trim($_POST['title_min_length']);
$title_max_length = (int) trim($_POST['title_max_length']);
$desc_min_length = (int) trim($_POST['desc_min_length']);
$desc_max_length = (int) trim($_POST['desc_max_length']);
$tags_min_length = (int) trim($_POST['tags_min_length']);
$tags_max_length = (int) trim($_POST['tags_max_length']);
$tag_max_length = (int) trim($_POST['tag_max_length']);
$tag_max_words = (int) trim($_POST['tag_max_words']);
if (!$errors) {
$photo_allowed_ext = explode(',', preg_replace('/[^a-z0-9,]+/', '', $photo_allowed_ext));
$pcfg = array();
$pcfg['components'] = array(
'browse' => 1,
'albums' => 1,
'photos' => 1,
'tag' => 1,
'search' => 1,
'add' => 1,
'upload' => 1,
'album' => 1,
'category' => 1,
'photo' => 1,
'edit' => 1,
'slideshow' => 1
);
$pcfg['browse_type'] = $browse_type;
$pcfg['browse_category'] = $browse_category;
$pcfg['browse_order'] = $browse_order;
$pcfg['browse_timeline'] = $browse_timeline;
$pcfg['browse_per_page'] = $browse_per_page;
$pcfg['search_type'] = $search_type;
$pcfg['search_per_page'] = $search_per_page;
$pcfg['rss'] = $rss;
$pcfg['rss_type'] = $rss_type;
$pcfg['rss_per_page'] = $rss_per_page;
$pcfg['tag_per_page'] = $tag_per_page;
$pcfg['view_access'] = $view_access;
$pcfg['view_desc'] = $view_desc;
$pcfg['album_per_page'] = $album_per_page;
$pcfg['view_comments'] = $view_comments;
$pcfg['allow_comment'] = $allow_comment;
$pcfg['approve_comments'] = $approve_comments;
$pcfg['comments_per_page'] = $comments_per_page;
$pcfg['allow_rating'] = $allow_rating;
$pcfg['rating_count'] = $rating_count;
$pcfg['rating_type'] = $rating_type;
$pcfg['allow_password'] = $allow_password;
$pcfg['upload_enabled'] = $upload_enabled;
$pcfg['upload_perm'] = $upload_perm;
$pcfg['photo_allowed_ext'] = $photo_allowed_ext;
$pcfg['photo_max_size'] = $photo_max_size;
$pcfg['approve'] = $approve;
$pcfg['max_categories'] = $max_categories;
$pcfg['cover_resize_type'] = $cover_resize_type;
$pcfg['cover_width'] = $cover_width;
$pcfg['cover_height'] = $cover_height;
$pcfg['photo_width'] = $photo_width;
$pcfg['photo_height'] = $photo_height;
$pcfg['thumb_width'] = $thumb_width;
$pcfg['thumb_height'] = $thumb_height;
$pcfg['mobile'] = $mobile;
$pcfg['mobile_width'] = $mobile_width;
$pcfg['mobile_height'] = $mobile_height;
$pcfg['multi_server'] = $multi_server;
$pcfg['thumb_server'] = $thumb_server;
$pcfg['thumb_host'] = $thumb_host;
$pcfg['thumb_port'] = $thumb_port;
$pcfg['thumb_user'] = $thumb_user;
$pcfg['thumb_pass'] = $thumb_pass;
$pcfg['thumb_root'] = $thumb_root;
$pcfg['track_views'] = $track_views;
$pcfg['delete_enabled'] = $delete_enabled;
$pcfg['delete_method'] = $delete_method;
$pcfg['delete_username'] = $delete_username;
$pcfg['title_min_length'] = $title_min_length;
$pcfg['title_max_length'] = $title_max_length;
$pcfg['desc_min_length'] = $desc_min_length;
$pcfg['desc_max_length'] = $desc_max_length;
$pcfg['tags_min_length'] = $tags_min_length;
$pcfg['tags_max_length'] = $tags_max_length;
$pcfg['tag_max_length'] = $tag_max_length;
$pcfg['tag_max_words'] = $tag_max_words;
$this->db->query("UPDATE #__module
SET config_cache = '".$this->db->escape(serialize($pcfg))."',
config = '".$this->db->escape(serialize($pcfg))."'
WHERE name = 'photo'
LIMIT 1");
VF::cache_set('photo', $pcfg, 'module');
$messages[] = 'Photo Module Configuration Updated';
}
}
$pcfg = VF::cfg('module.photo', TRUE, TRUE);
$tpl = VF::factory('template');
$tpl->menu = 'photo';
$tpl->submenu = 'config';
$tpl->meta_title = 'Admin::Photo::Config';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->warnings = $warnings;
$tpl->pcfg = $pcfg;
$tpl->groups = $this->get_user_groups();
$tpl->load(array('header', 'photo_config', 'footer'));
$tpl->display();
}
private function get_user_groups()
{
$this->db->query("SELECT group_id, name FROM #__user_groups ORDER BY group_id ASC");
if ($this->db->affected_rows()) {
return $this->db->fetch_rows();
} else {
throw new Exception('Failed to load user groups table!');
}
}
}