$tp_data['USER_BIRTHDAY'] = $pr_data['user_birthday']; break; /** * opt (edit) */ /** * opt (edit) */ case 'user_opt': $user_opt = $pr_data['user_opt']; $reg_mode = $mode == 'register'; $update_user_opt = array('user_viewemail' => $reg_mode ? false : true, 'user_viewonline' => $reg_mode ? false : true, 'user_notify' => $reg_mode ? true : true, 'user_notify_pm' => $reg_mode ? true : true, 'user_porn_forums' => $reg_mode ? false : true, 'user_dls' => $reg_mode ? false : true, 'user_callseed' => $reg_mode ? true : true, 'user_retracker' => $reg_mode ? true : true); foreach ($update_user_opt as $opt => $can_change_opt) { if ($submit && (isset($_POST[$opt]) && $can_change_opt || $reg_mode)) { $change_opt = $reg_mode ? $can_change_opt : !empty($_POST[$opt]); setbit($user_opt, $bf['user_opt'][$opt], $change_opt); } $tp_data[strtoupper($opt)] = bf($user_opt, 'user_opt', $opt); } if ($submit && ($user_opt != $pr_data['user_opt'] || $reg_mode)) { $pr_data['user_opt'] = $user_opt; $db_data['user_opt'] = (int) $user_opt; } break; /** * Avatar (edit) */ /** * Avatar (edit) */ case 'avatar_ext_id':
<?php if (!defined('IN_AJAX')) { die(basename(__FILE__)); } global $bf, $lang; $user_id = (int) $this->request['user_id']; $new_opt = Zend\Json\Json::decode($this->request['user_opt'], Zend\Json\Json::TYPE_ARRAY); 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'); } foreach ($bf['user_opt'] as $opt_name => $opt_bit) { if (isset($new_opt[$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"); // Удаляем данные из кеша cache_rm_user_sessions($user_id); $this->response['resp_html'] = $lang['SAVED'];