Файл: adultscript-2.0.3-pro/files/admin/modules/user/components/config.php
Строк: 295
<?php
defined('_VALID') or die('Restricted Access!');
class VComponent_Admin_user_config extends VModule_Admin_user
{
public function __construct()
{
parent::__construct();
}
public function render()
{
$ucfg = VF::cfg('module.user');
$groups = $this->get_user_groups();
$errors = array();
$messages = array();
$warnings = array();
if (isset($_POST['submit_config'])) {
$filter = VF::factory('filter');
$signup_enabled = (int) trim($_POST['signup_enabled']);
$user_approve = (int) trim($_POST['user_approve']);
$user_confirm = (int) trim($_POST['user_confirm']);
$signup_name = (int) trim($_POST['signup_name']);
$signup_gender = (int) trim($_POST['signup_gender']);
$signup_birth_date = (int) trim($_POST['signup_birth_date']);
$signup_country = (int) trim($_POST['signup_country']);
$signup_city = (int) trim($_POST['signup_city']);
$signup_zip = (int) trim($_POST['signup_zip']);
$signup_age = (int) trim($_POST['signup_age']);
$signup_captcha = (int) trim($_POST['signup_captcha']);
$avatar_allowed_ext = $filter->get('avatar_allowed_ext');
$avatar_max_size = (int) trim($_POST['avatar_max_size']);
$avatar_width = (int) trim($_POST['avatar_width']);
$avatar_height = (int) trim($_POST['avatar_height']);
$avatar_method = $filter->get('avatar_method');
$guest_limit = trim($_POST['guest_limit']);
$guest_bandwidth = (int) trim($_POST['guest_bandwidth']);
$guest_duration = (float) trim($_POST['guest_duration']);
$guest_views = (int) trim($_POST['guest_views']);
$guest_clean = (int) trim($_POST['guest_clean']);
$registered_limit = (isset($_POST['registered_limit'])) ? (int) trim($_POST['registered_limit']) : 0;
$registered_method = (isset($_POST['registered_method'])) ? (int) trim($_POST['registered_method']) : 0;
$user_points = (int) trim($_POST['user_points']);
$point_signup = (int) trim($_POST['point_signup']);
$point_login = (int) trim($_POST['point_signup']);
$point_avatar = (int) trim($_POST['point_signup']);
$point_friend_add = (int) trim($_POST['point_signup']);
$point_friend_del = (int) trim($_POST['point_signup']);
$point_rate = (int) trim($_POST['point_signup']);
$point_upload_video = (int) trim($_POST['point_signup']);
$point_rate_video = (int) trim($_POST['point_signup']);
$point_share_video = (int) trim($_POST['point_signup']);
$point_favorite_video = (int) trim($_POST['point_signup']);
$point_delete_video = (int) trim($_POST['point_signup']);
$account_pwd_check = (int) trim($_POST['account_pwd_check']);
$account_username_change= (int) trim($_POST['account_username_change']);
$advertising = (int) trim($_POST['advertising']);
$online_expire = (int) trim($_POST['online_expire']);
$verify_expire = (int) trim($_POST['verify_expire']);
$username_min_length = (int) trim($_POST['username_min_length']);
$username_max_length = (int) trim($_POST['username_max_length']);
$pwd_min_length = (int) trim($_POST['pwd_min_length']);
$pwd_max_length = (int) trim($_POST['pwd_max_length']);
if ($guest_limit == 'bandwidth' && $guest_bandwidth === 0) {
$errors[] = 'Guest limit restriction set to bandwidth! Please add a bandwidth limit!';
}
if ($guest_limit == 'duration' && $guest_duration <= 0) {
$errors[] = 'Guest limit restriction set to duration! Please add a duration limit in seconds!';
}
if ($guest_limit == 'views' && $guest_views === 0) {
$errors[] = 'Guest limit restriction set to views! Please add a maximum views number!';
}
if (!$errors) {
$avatar_allowed_ext = explode(',', preg_replace('/[^a-z,]+/', '', $avatar_allowed_ext));
$ucfg = array();
$ucfg['components'] = array(
'login' => 1,
'logout' => 1,
'signup' => 1,
'account' => 1,
'avatar' => 1,
'profile' => 1,
'preferences' => 1,
'notifications' => 1,
'lost' => 1,
'confirm' => 1,
'videos' => 1,
'favorites' => 1,
'playlists' => 1,
'dashboard' => 1,
'history' => 1,
'friends' => 1,
'subscribers' => 1,
'subscriptions' => 1,
'banner' => 1,
'albums' => 1,
'photos' => 1,
'playlist' => 1,
'playlists' => 1,
'comments' => 1
);
$ucfg['points'] = array(
'signup' => $point_signup,
'login' => $point_login,
'avatar' => $point_avatar,
'rate' => $point_rate,
'friend_add' => $point_friend_add,
'friend_del' => $point_friend_del,
'upload_video' => $point_upload_video,
'share_video' => $point_share_video,
'rate_video' => $point_rate_video,
'favorite_video' => $point_favorite_video,
'delete_video' => $point_delete_video
);
$ucfg['signup_enabled'] = $signup_enabled;
$ucfg['user_approve'] = $user_approve;
$ucfg['user_confirm'] = $user_confirm;
$ucfg['signup_name'] = $signup_name;
$ucfg['signup_gender'] = $signup_gender;
$ucfg['signup_country'] = $signup_country;
$ucfg['signup_city'] = $signup_city;
$ucfg['signup_zip'] = $signup_zip;
$ucfg['signup_birth_date'] = $signup_birth_date;
$ucfg['signup_age'] = $signup_age;
$ucfg['signup_captcha'] = $signup_captcha;
$ucfg['avatar_allowed_ext'] = $avatar_allowed_ext;
$ucfg['avatar_max_size'] = $avatar_max_size;
$ucfg['avatar_width'] = $avatar_width;
$ucfg['avatar_height'] = $avatar_height;
$ucfg['avatar_method'] = $avatar_method;
$ucfg['guest_limit'] = $guest_limit;
$ucfg['guest_bandwidth'] = $guest_bandwidth;
$ucfg['guest_duration'] = $guest_duration;
$ucfg['guest_views'] = $guest_views;
$ucfg['guest_clean'] = $guest_clean;
$ucfg['registered_limit'] = $registered_limit;
$ucfg['registered_method'] = $registered_method;
$ucfg['user_points'] = $user_points;
$ucfg['account_pwd_check'] = $account_pwd_check;
$ucfg['account_username_change']= $account_username_change;
$ucfg['advertising'] = $advertising;
$ucfg['online_expire'] = $online_expire;
$ucfg['verify_expire'] = $verify_expire;
$ucfg['username_min_length'] = $username_min_length;
$ucfg['username_max_length'] = $username_max_length;
$ucfg['pwd_min_length'] = $pwd_min_length;
$ucfg['pwd_max_length'] = $pwd_max_length;
$this->db->query("UPDATE #__module
SET config_cache = '".$this->db->escape(serialize($ucfg))."',
config = '".$this->db->escape(serialize($ucfg))."'
WHERE name = 'user'
LIMIT 1");
VF::cache_set('user', $ucfg, 'module');
$messages[] = 'User Module Configuration Updated';
}
}
$ucfg = VF::cfg('module.user', TRUE, TRUE);
$tpl = VF::factory('template');
$tpl->menu = 'user';
$tpl->submenu = 'config';
$tpl->meta_title = 'Admin::User::Config';
$tpl->errors = $errors;
$tpl->messages = $messages;
$tpl->warnings = $warnings;
$tpl->ucfg = $ucfg;
$tpl->groups = $groups;
$tpl->load(array('header', 'user_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();
}
die('Failed to load the user groups table!');
}
}
?>