Resolves the problem that discuz 3.4 forced upload avatars cannot be used (always prompts you to upload avatars)

本次问题是:开启了强制头像上传,即便上传了头像,依旧说没有权限发表,请上传头像。
The main reason is the communication with uc_derver, which shows successful communication, but this may not be accurate (the reasons are very complex), and the website has enabled HTTPS, so the reason is even more complicated.
问题就出在了头像获取上,在uc_client/client.php中,找到
$path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : ''):'/';
下面增加:
$matches['port'] = !empty($matches['port'])&&$scheme=='https' ? $matches['port'] : 443;
然后找到:
if(!$fp = @fsocketopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout)) {
在修改为:
if($port=='443'){$temp = 'ssl://';}else{$temp = 'http://';}if(!$fp = @fsocketopen($temp.($ip ? $ip : $host), $port, $errno, $errstr, $timeout)) {
至此应该修复了该问题了,如果还没修复,尝试以下方法:
在function uc_check_avatar中找到
$res = uc_fopen2($url, 500000, ”, ”, TRUE, UC_IP, 20);
修改为:
$res = trim(uc_fopen2(UC_API."/avatar.php?uid=$uid&check_file_exists=1"));
原本的call很不稳定,有时候返回不出1,新的这个直接打开url返回数值。
© Website copyright and disclaimer
1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;
2. No one is allowed to copy it without the express written permission of [honmau Media];
3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;
4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;
5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice