Minor improvements (#1548)

* Minor improvements

* Update register.php

* Update register.php

* Updated

* Update CHANGELOG.md

* Update topic_watch.php

* Update Ajax.php
This commit is contained in:
Roman Kelesidis 2024-07-20 17:05:02 +07:00 committed by GitHub
commit c9d9ebb9c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 15 deletions

View file

@ -376,22 +376,21 @@ foreach ($profile_fields as $field => $can_edit) {
case 'avatar_ext_id':
if ($submit && !bf($pr_data['user_opt'], 'user_opt', 'dis_avatar')) {
// Integration with MonsterID
if (!isset($_POST['delete_avatar']) && isset($_POST['use_monster_avatar'])) {
if (empty($_FILES['avatar']['name']) && !isset($_POST['delete_avatar']) && isset($_POST['use_monster_avatar'])) {
$monsterAvatar = new Arokettu\MonsterID\Monster($pr_data['user_email'], $bb_cfg['avatars']['max_height']);
$tempAvatar = tmpfile();
$tempAvatarMeta = stream_get_meta_data($tempAvatar);
$tempAvatarPath = stream_get_meta_data($tempAvatar)['uri'];
$monsterAvatar->writeToStream($tempAvatar);
// Manual filling $_FILES['avatar']
$_FILES['avatar'] = array();
if (!empty($tempAvatarMeta['uri']) && is_file($tempAvatarMeta['uri'])) {
if (is_file($tempAvatarPath)) {
$_FILES['avatar'] = [
'name' => 'MonsterID.png',
'full_path' => 'MonsterID.png',
'type' => 'image/png',
'tmp_name' => $tempAvatarMeta['uri'],
'error' => 0,
'size' => filesize($tempAvatarMeta['uri'])
'name' => "MonsterID_{$pr_data['user_id']}.png",
'type' => mime_content_type($tempAvatarPath),
'tmp_name' => $tempAvatarPath,
'error' => UPLOAD_ERR_OK,
'size' => filesize($tempAvatarPath)
];
}
}

View file

@ -66,7 +66,7 @@ if ($watch_count > 0) {
AND p.poster_id = u2.user_id
AND t.topic_poster = u.user_id
AND w.user_id = $user_id
GROUP BY t.topic_last_post_time DESC
ORDER BY t.topic_last_post_time DESC
LIMIT $start, $per_page";
if (!($result = DB()->sql_query($sql))) {
bb_die('Could not obtain watch topic information #3');