function import_avatar($source, $use_target = false, $user_id = false)
{
    if (empty($source) || preg_match('#^https?:#i', $source) || preg_match('#blank\\.(gif|png)$#i', $source)) {
        return;
    }
    global $convert, $phpbb_root_path, $config, $user;
    // check for trailing slash
    if (rtrim($convert->convertor['avatar_path'], '/') === '') {
        $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__);
    }
    if ($use_target === false && $user_id !== false) {
        $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1);
    }
    $result = _import_check('avatar_path', $source, $use_target);
    return (!empty($user_id) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1);
}
示例#2
0
function mybb_import_icon($source)
{
	$result = _import_check('icons_path', mybb_get_absolute_path($source), false);
	return $result['target'];
}