Minor improvements (#1306)

* Minor improvements

* Update functions.php

* Updated

* Updated

* Update edit_user_profile.php

* Update index_data.php

* Update

* Update sitemap.php
This commit is contained in:
Roman Kelesidis 2024-01-02 21:18:54 +07:00 committed by GitHub
commit 36e52d5d3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 67 additions and 64 deletions

View file

@ -13,9 +13,11 @@ if (!defined('IN_AJAX')) {
global $bb_cfg, $lang, $user;
$mode = (string)$this->request['mode'];
$user_id = (int)$this->request['user_id'];
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
$user_id = (int)$this->request['user_id'];
if (!$user_id or !$u_data = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
@ -33,7 +35,7 @@ switch ($mode) {
$response = get_avatar($user_id, $new_ext_id);
break;
default:
$this->ajax_die('Invalid mode');
$this->ajax_die('Invalid mode: ' . $mode);
}
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");

View file

@ -16,6 +16,7 @@ global $bb_cfg, $lang;
if (!$user_id = (int)$this->request['user_id'] or !$profiledata = get_userdata($user_id)) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$field = (string)$this->request['field']) {
$this->ajax_die('invalid profile field');
}

View file

@ -13,9 +13,11 @@ if (!defined('IN_AJAX')) {
global $bb_cfg, $lang, $userdata, $datastore;
$mode = (string)$this->request['mode'];
$html = '';
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
$html = '';
switch ($mode) {
case 'birthday_week':
$stats = $datastore->get('stats');
@ -122,7 +124,7 @@ switch ($mode) {
break;
default:
$this->ajax_die('Invalid mode');
$this->ajax_die('Invalid mode: ' . $mode);
}
$this->response['html'] = $html;

View file

@ -95,7 +95,7 @@ switch ($mode) {
break;
default:
$this->ajax_die('Invalid mode');
$this->ajax_die('Invalid mode: ' . $mode);
}
$this->response['mode'] = $mode;

View file

@ -13,27 +13,31 @@ if (!defined('IN_AJAX')) {
global $userdata, $lang;
$req_uid = (int)$this->request['user_id'];
$mode = (string)$this->request['mode'];
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
if ($req_uid == $userdata['user_id'] || IS_ADMIN) {
switch ($mode) {
case 'generate':
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
if (!$req_uid = (int)$this->request['user_id']) {
$this->ajax_die($lang['NO_USER_ID_SPECIFIED']);
}
if (!$passkey = \TorrentPier\Legacy\Torrent::generate_passkey($req_uid, IS_ADMIN)) {
$this->ajax_die('Could not insert passkey');
}
\TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
break;
default:
$this->ajax_die('Invalid mode');
}
} else {
if (!IS_ADMIN && $req_uid != $userdata['user_id']) {
$this->ajax_die($lang['NOT_AUTHORISED']);
}
switch ($mode) {
case 'generate':
if (empty($this->request['confirmed'])) {
$this->prompt_for_confirm($lang['BT_GEN_PASSKEY_NEW']);
}
if (!$passkey = \TorrentPier\Legacy\Torrent::generate_passkey($req_uid, IS_ADMIN)) {
$this->ajax_die('Could not insert passkey');
}
\TorrentPier\Legacy\Torrent::tracker_rm_user($req_uid);
$this->response['passkey'] = $passkey;
break;
default:
$this->ajax_die('Invalid mode: ' . $mode);
}

View file

@ -18,8 +18,8 @@ if (!$mode = (string)$this->request['mode']) {
}
$map = new TorrentPier\Sitemap();
$html = '';
$html = '';
switch ($mode) {
case 'create':
$map->createSitemap();

View file

@ -17,8 +17,13 @@ if (!$bb_cfg['tor_thank']) {
$this->ajax_die($lang['MODULE_OFF']);
}
$mode = (string)$this->request['mode'];
$topic_id = (int)$this->request['topic_id'];
if (!$mode = (string)$this->request['mode']) {
$this->ajax_die('invalid mode (empty)');
}
if (!$topic_id = (int)$this->request['topic_id']) {
$this->ajax_die($lang['INVALID_TOPIC_ID']);
}
switch ($mode) {
case 'add':
@ -47,7 +52,7 @@ switch ($mode) {
break;
default:
$this->ajax_die('Invalid mode');
$this->ajax_die('Invalid mode: ' . $mode);
}
$this->response['mode'] = $mode;

View file

@ -48,7 +48,7 @@ switch ($mode) {
break;
default:
$this->ajax_die('Invalid mode');
$this->ajax_die('Invalid mode: ' . $mode);
}
$this->response['html'] = $html;