diff --git a/upload/admin/admin_users.php b/upload/admin/admin_users.php
index 539fc744f..579defc26 100644
--- a/upload/admin/admin_users.php
+++ b/upload/admin/admin_users.php
@@ -496,7 +496,6 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
{
$update_user_opt = array(
'viewemail',
- 'attachsig',
);
$user_opt = $this_userdata['user_opt'];
@@ -625,7 +624,7 @@ if ( $mode == 'edit' || $mode == 'save' && ( isset($_POST['username']) || isset(
$viewemail = bf($this_userdata['user_opt'], 'user_opt', 'viewemail');
$notifypm = $this_userdata['user_notify_pm'];
$notifyreply = $this_userdata['user_notify'];
- $attachsig = bf($this_userdata['user_opt'], 'user_opt', 'attachsig');
+ $attachsig = bf($this_userdata['user_opt'], 'user_opt', 'allow_sig');
$allowviewonline = $this_userdata['user_allow_viewonline'];
$user_avatar = $this_userdata['user_avatar'];
diff --git a/upload/ajax.php b/upload/ajax.php
index ec2ad17cf..18af35bbf 100644
--- a/upload/ajax.php
+++ b/upload/ajax.php
@@ -56,6 +56,7 @@ class ajax_common
// ACTION NAME AJAX_AUTH
'edit_user_profile' => array('admin'),
'change_user_rank' => array('admin'),
+ 'change_user_opt' => array('admin'),
'change_torrent' => array('mod'),
'change_tor_status' => array('mod'),
@@ -301,6 +302,43 @@ class ajax_common
$this->response['html'] = ($rank_id != 0) ? 'Присвоено звание '. $ranks[$rank_id]['rank_title'] .'' : 'Звание снято';
}
+ function change_user_opt ()
+ {
+ global $userdata, $bf;
+
+ $user_id = (int) $this->request['user_id'];
+ $new_opt = bb_json_decode($this->request['user_opt']);
+
+ if (!$user_id OR !$u_data = get_userdata($user_id))
+ {
+ $this->ajax_die('invalid user_id');
+ }
+ if (!is_array($new_opt))
+ {
+ $this->ajax_die('invalid new_opt');
+ }
+
+ $user_can_change = array(
+ 'hide_porn_forums',
+ );
+
+ foreach ($bf['user_opt'] as $opt_name => $opt_bit)
+ {
+ if (isset($new_opt[$opt_name]))
+ {
+ if (!IS_ADMIN && !in_array($opt_name, $user_can_change))
+ {
+ $this->ajax_die("not admin: $opt_name");
+ }
+ setbit($u_data['user_opt'], $opt_bit, !empty($new_opt[$opt_name]));
+ }
+ }
+
+ DB()->query("UPDATE ". BB_USERS ." SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
+
+ $this->response['resp_html'] = 'сохранено';
+ }
+
function gen_passkey ()
{
global $userdata, $lang;
diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index 2dc9f86f1..54a4f9219 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -565,7 +565,7 @@ $bf['forum_perm'] = array(
$bf['user_opt'] = array(
'viewemail' => 0,
- 'attachsig' => 1,
+ 'allow_sig' => 1,
'allowavatar' => 2,
'allow_pm' => 3,
'allow_viewonline' => 4,
diff --git a/upload/includes/functions_torrent.php b/upload/includes/functions_torrent.php
index 4f55427d1..3570d6a0e 100644
--- a/upload/includes/functions_torrent.php
+++ b/upload/includes/functions_torrent.php
@@ -465,16 +465,14 @@ function send_torrent_with_passkey ($filename)
}
}
-
-
if (!$attachment['tracker_status'])
{
message_die(GENERAL_ERROR, $lang['PASSKEY_ERR_TOR_NOT_REG']);
}
- if ($userdata['session_logged_in'] && !$userdata['user_allow_passkey'])
+ if (bf($userdata['user_opt'], 'user_opt', 'allow_passkey'))
{
- message_die(GENERAL_ERROR, 'Could not add passkey
You are not authorized to use passkey');
+ message_die(GENERAL_ERROR, 'Could not add passkey');
}
if ($bt_userdata = get_bt_userdata($user_id))
@@ -658,7 +656,7 @@ function generate_passkey ($user_id, $force_generate = false)
// Check if user can change passkey
if (!$force_generate)
{
- $sql = "SELECT user_allow_passkey
+ $sql = "SELECT user_opt
FROM ". BB_USERS ."
WHERE user_id = $user_id
LIMIT 1";
@@ -669,7 +667,7 @@ function generate_passkey ($user_id, $force_generate = false)
}
if ($row = DB()->sql_fetchrow($result))
{
- if (!$row['user_allow_passkey'])
+ if (bf($row['user_opt'], 'user_opt', 'allow_passkey'))
{
message_die(GENERAL_MESSAGE, $lang['NOT_AUTHORISED']);
}
diff --git a/upload/includes/ucp/usercp_register.php b/upload/includes/ucp/usercp_register.php
index 59aaf7b70..dbe072ad4 100644
--- a/upload/includes/ucp/usercp_register.php
+++ b/upload/includes/ucp/usercp_register.php
@@ -413,7 +413,7 @@ foreach ($profile_fields as $field => $can_edit)
$sig = isset($_POST['user_sig']) ? (string) $_POST['user_sig'] : $pr_data['user_sig'];
if ($submit)
{
- if (strlen($sig) > $bb_cfg['max_sig_chars'])
+ if (mb_strlen($sig) > $bb_cfg['max_sig_chars'])
{
$errors[] = 'Слишком длинная подпись';
}
diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php
index 48966a13e..08a9bff91 100644
--- a/upload/includes/ucp/usercp_viewprofile.php
+++ b/upload/includes/ucp/usercp_viewprofile.php
@@ -6,6 +6,8 @@ if ( !defined('IN_PHPBB') )
exit;
}
+require(INC_DIR .'bbcode.php');
+
$datastore->enqueue(array(
'ranks',
));
@@ -43,8 +45,7 @@ else
{
$percentage = 0;
}
-$avatar_img = '';
-$avatar_img = get_avatar($profiledata['user_avatar'], $profiledata['user_avatar_type'], $profiledata['user_allowavatar']);
+$avatar_img = get_avatar($profiledata['user_avatar'], $profiledata['user_avatar_type'], !bf($profiledata['user_opt'], 'user_opt', 'allowavatar'));
if (!$ranks = $datastore->get('ranks'))
{
@@ -148,6 +149,17 @@ if ($profiledata['user_level'] == ADMIN && !IS_ADMIN)
}
// IP Mod End
+$signature = ($bb_cfg['allow_sig'] && $profiledata['user_sig']) ? $profiledata['user_sig'] : '';
+
+if(bf($profiledata['user_opt'], 'user_opt', 'allow_sig'))
+{
+ $signature = 'Подпись удалена.';
+}
+else if ($signature)
+{
+ $signature = bbcode2html($signature);
+}
+
$template->assign_vars(array(
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'USERNAME' => $profiledata['username'],
@@ -195,6 +207,8 @@ $template->assign_vars(array(
'L_SEARCH_RELEASES' => $lang['SEARCH_USER_RELEASES'],
'S_PROFILE_ACTION' => "profile.php",
+
+ 'SIGNATURE' => $signature,
));
//bt
@@ -219,6 +233,25 @@ if (IS_ADMIN)
'U_MANAGE' => "admin/admin_users.php?mode=edit&u={$profiledata['user_id']}",
'U_PERMISSIONS' => "admin/admin_ug_auth.php?mode=user&u={$profiledata['user_id']}",
));
+
+ $ajax_user_opt = bb_json_encode(array(
+ 'allowavatar' => bf($profiledata['user_opt'], 'user_opt', 'allowavatar'),
+ 'allow_passkey' => bf($profiledata['user_opt'], 'user_opt', 'allow_passkey'),
+ 'allow_pm' => bf($profiledata['user_opt'], 'user_opt', 'allow_pm'),
+ 'allow_sig' => bf($profiledata['user_opt'], 'user_opt', 'allow_sig'),
+ ));
+
+ $template->assign_vars(array(
+ 'EDITABLE_TPLS' => true,
+ 'AJAX_USER_OPT' => $ajax_user_opt,
+ 'EMAIL_ADDRESS' => htmlCHR($profiledata['user_email']),
+ ));
+}
+else
+{
+ $user_restrictions = array();
+
+ $template->assign_var('USER_RESTRICTIONS', join('