Minor improvements (#843)

This commit is contained in:
Roman Kelesidis 2023-07-24 12:55:46 +07:00 committed by GitHub
commit ab0d2133d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -62,4 +62,6 @@ ALTER TABLE `bb_users` CHANGE `user_newpasswd` `user_newpasswd` VARCHAR(255) NOT
INSERT INTO bb_config VALUES ('show_board_start_index', '1');
// 2.4.0-beta2
INSERT INTO `bb_cron` VALUES (NULL, '1', 'PM cleanup', 'clean_pm.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0');
INSERT INTO `bb_cron` (`cron_active`, `cron_title`, `cron_script`, `schedule`, `run_day`, `run_time`, `run_order`,
`last_run`, `next_run`, `run_interval`, `log_enabled`, `log_file`, `log_sql_queries`,
`disable_board`, `run_counter`) VALUES ('1', 'PM cleanup', 'clean_pm.php', 'daily', '', '05:00:00', '70', '', '', '', '1', '', '0', '1', '0');

View file

@ -34,8 +34,8 @@ function get_attach_path($id, $ext_id = '', $base_path = null, $first_div = 1000
function delete_avatar($user_id, $avatar_ext_id)
{
$avatar_file = $avatar_ext_id ? get_avatar_path($user_id, $avatar_ext_id) : '';
return ($avatar_file && file_exists($avatar_file)) ? @unlink($avatar_file) : false;
$avatar_file = $avatar_ext_id ? get_avatar_path($user_id, $avatar_ext_id) : false;
return ($avatar_file && file_exists($avatar_file) && unlink($avatar_file));
}
function get_tracks($type)
@ -739,8 +739,12 @@ function get_user_id($username)
if (empty($username)) {
return false;
}
$row = DB()->fetch_row("SELECT user_id FROM " . BB_USERS . " WHERE username = '" . DB()->escape($username) . "' LIMIT 1");
return $row['user_id'];
if ($row = DB()->fetch_row("SELECT user_id FROM " . BB_USERS . " WHERE username = '" . DB()->escape($username) . "' LIMIT 1")) {
return $row['user_id'];
}
return false;
}
function str_short($text, $max_length, $space = ' ')