{"id":8,"date":"2011-08-05T03:04:05","date_gmt":"2011-08-05T03:04:05","guid":{"rendered":"http:\/\/www.uut8.com\/?p=4"},"modified":"2011-08-05T03:04:05","modified_gmt":"2011-08-05T03:04:05","slug":"discuz%e5%bc%ba%e5%88%b6%e4%b8%8a%e4%bc%a0%e5%a4%b4%e5%83%8f%e5%90%8e%e5%a4%b1%e8%b4%a5%e7%9a%84%e5%8e%9f%e5%9b%a0%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.uut8.com\/?p=8","title":{"rendered":"Discuz!\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\u540e\u5931\u8d25\u7684\u539f\u56e0\u5206\u6790"},"content":{"rendered":"<p>\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\u5f80\u5f80\u4f1a\u4f5c\u4e3a\u7ad9\u957f\u9632\u704c\u6c34\u548c\u5f15\u5bfc\u7528\u6237\u5b8c\u5584\u8d44\u6599\u7684\u624b\u6bb5\uff0c\u4e4b\u524d\u6709\u90e8\u5206\u7ad9\u957f\u63d0\u51fa\u81ea\u5df1\u7684\u7f51\u7ad9\u8bbe\u7f6e\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\u65e0\u6548\uff0c\u4e0a\u4f20\u5934\u50cf\u540e\uff0c\u4f9d\u7136\u63d0\u793a\u9700\u8981\u4e0a\u4f20\u3002\u73b0\u5728\u5bf9\u8fd9\u90e8\u5206\u529f\u80fd\u505a\u4e00\u4e0b\u5206\u6790\uff0c\u770b\u770b\u95ee\u9898\u51fa\u5728\u54ea\u3002<\/p>\n<p>\u5728\u540e\u53f0\uff0c\u5168\u5c40\u9632\u704c\u6c34\u57fa\u672c\u8bbe\u7f6e\u4e2d\uff0c\u53ef\u4ee5\u5f00\u542f\u201c<strong>\u5f3a\u5236\u65b0\u7528\u6237\u4e0a\u4f20\u5934\u50cf<\/strong>\u201d\uff0c\u5f00\u542f\u540e\uff0csetting\u8868\u4e2dneed_avatar\u5b57\u6bb5\u7684\u503c\u53d8\u4e3a\u201c1\u201d\u3002\u8fd9\u65f6\u65b0\u6ce8\u518c\u7684\u7528\u6237\u5982\u679c\u9700\u8981\u8fdb\u884c\u53d1\u5e16\u56de\u590d\u7b49\u64cd\u4f5c\uff0c\u6ca1\u8fdb\u884c\u5934\u50cf\u4e0a\u4f20\u7684\uff0c\u5e94\u8be5\u4f1a\u63d0\u793a\u4e0a\u4f20\u5934\u50cf\u3002\u4f8b\u5982\u8fdb\u884c\u53d1\u5e16\u64cd\u4f5c\uff0c\u4f1a\u8c03\u7528forum_post.php\u6587\u4ef6\u4e2d\u7684cknewuser();\u51fd\u6570\u5bf9\u7528\u6237\u8fdb\u884c\u9a8c\u8bc1\uff0ccknewuser();\u5728function_core.php\u4e2d\u5b9a\u4e49\uff0c\u5176\u4e2d\u5927\u7ea63160\u884c\u6709\u5bf9\u5934\u50cf\u7684\u9a8c\u8bc1\uff0c\u6211\u4eec\u770b\u770b\u9a8c\u8bc1\u7684\u6761\u4ef6\uff1a<\/p>\n<pre class=\"brush:php\">if($_G['setting']['need_avatar'] &amp;&amp;\n empty($ckuser['avatarstatus'])) {\n\nif(empty($return)) showmessage('no_privilege_avatar', '', array(), array('return' =&gt; true));\n\n$result\n = false;\n\n}<\/pre>\n<p><!--more--><\/p>\n<pre class=\"brush:php\"><\/pre>\n<p>\u9996\u5148\u770b\u770bsetting\u8868\u4e2d\u662f\u5426\u6709need_avatar\u503c\uff0c\u5373\u662f\u5426\u9700\u8981\u9a8c\u8bc1\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\uff0c\u5e76\u4e14\u9a8c\u8bc1\u7528\u6237member\u8868\u4e2d\u7684avatarstatus\u5b57\u6bb5\u662f\u5426\u6709\u503c\uff0c\u5373\u8fd9\u4e2a\u7528\u6237\u662f\u5426\u4e0a\u4f20\u8fc7\u5934\u50cf\uff0c\u4e0a\u4f20\u8fc7\u503c\u4e3a1\uff0c\u5426\uff0c\u5219\u503c\u4e3a0\uff0c\u4ece\u8fd9\u91cc\u770b\uff0c\u5982\u8fc7\u8bbe\u7f6e\u8fc7\u9700\u8981\u8fdb\u884c\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\uff0c\u90a3\u4e48\uff0csetting\u8868\u4e2dneed_avatar\u5b57\u6bb5\u503c\u5e94\u8be5\u662f\u6709\u7684\uff0c\u5982\u679c\u8fd8\u63d0\u793a\u9700\u8981\u4e0a\u4f20\uff0c\u5219\u8bf4\u660emember\u8868\u4e2d\u7684\u5934\u50cf\u72b6\u6001\u503c\u4e3a0\uff0c\u4e0b\u9762\u6211\u4eec\u770b\u770b\u8fd9\u4e2a\u72b6\u6001\u503c\u600e\u4e48\u6765\u7684\u3002<\/p>\n<p>\u6211\u4eec\u4ece\u4e0a\u4f20\u5934\u50cf\u5f00\u59cb\uff0c\u4e0a\u4f20\u5934\u50cf\u9700\u8981\u7684\u6587\u4ef6\u4e3aspacecp_avatar.php\uff0c<\/p>\n<pre class=\"brush:php\">if(empty($space['avatarstatus']) &amp;&amp;\n uc_check_avatar($_G['uid'], 'middle')) {\n\nDB::update('common_member',\n array('avatarstatus'=&gt;'1'), array('uid'=&gt;$_G['uid']));\n\nupdatecreditbyaction('setavatar');\n\nmanyoulog('user',\n $_G['uid'], 'update');\n\n}<\/pre>\n<p>\u6211\u4eec\u53ea\u5bf9\u90e8\u5206\u4ee3\u7801\u8fdb\u884c\u5206\u6790\uff0c\u8fd9\u6bb5\u4ee3\u7801\u7684\u4f5c\u7528\u662f\uff0c\u4e0a\u4f20\u4e86\u5934\u50cf\u540e\uff0c\u5224\u65ad\u8fd9\u4e2a\u7528\u6237\u662f\u5426\u4e0a\u4f20\u8fc7\u5934\u50cf\uff0c\u5373\u6709\u6ca1\u6709avatarstatus\u503c\uff0c\u5e76\u4e14\u7528uc_check_avatar\u68c0\u67e5\u7528\u6237\u5934\u50cf\u662f\u5426\u5b58\u5728\uff0c\u8fd9\u4e2auc_check_avatar\u51fd\u6570\u7528\u5230\u4e86uc_fopen2\u51fd\u6570\uff0cuc_fopen2\u51fd\u6570\u7528\u5230\u51e0\u4e2a\u53c2\u6570\uff0c\u5176\u4e2d\u5c31\u6709UCenter\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684Ip\uff0chost\uff0c\u5982\u679c\u7528\u6237\u5bf9\u5176hosts\u6587\u4ef6\u8fdb\u884c\u8fc7\u4fee\u6539\uff0c\u6216\u7559\u7a7a\u4e14\u57df\u540d\u89e3\u6790\u6709\u95ee\u9898\uff0c\u90fd\u4f1a\u9020\u6210uc_fopen2\u51fd\u6570\u8fd4\u56de\u503c\u4e0d\u4e3a1\uff0c\u4e0d\u4e3a1\u7684\u60c5\u51b5\u4e0b\uff0c\u9020\u6210\u4e0a\u4e00\u6bb5\u4ee3\u7801\u6761\u4ef6\u4e0d\u6210\u7acb\uff0c\u8fdb\u800c\u6ca1\u6709\u5bf9common_member\u8868\u7684avatarstatus\u503c\u8fdb\u884cupdate\u66f4\u65b0\u64cd\u4f5c\uff0c\u90a3\u4e48\u4e5f\u5c31\u9020\u6210\u4e00\u76f4\u63d0\u793a\u7528\u6237\u9700\u8981\u4e0a\u4f20\u5934\u50cf\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1a\u4e00\u4e2a\u662f\u53ef\u4ee5\u586b\u5199\u670d\u52a1\u5668\u771f\u5b9eIP,\u6216\u8005\u53c2\u7167\u7f51\u4e0a\u5176\u5b83\u65b9\u6cd5\uff0c\u4f8b\u5982<\/p>\n<p>\u627e\u5230<\/p>\n<pre class=\"brush:php\">function uc_check_avatar($uid, $size =\n \u2018middle\u2019, $type = \u2018virtual\u2019) {\n\n$url =\n UC_API.\u201d\/avatar.php?uid=$uid&amp;size=$size&amp;type=$type&amp;check_file_exists=1\u2033;\n\n$res = uc_fopen2($url, 500000, \u201d, \u201d, TRUE, UC_IP, 20);\n\nif($res == 1) {\n\nreturn 1;\n\n} else {\n\nreturn 0;\n\n}\n\n}<\/pre>\n<p>\u6539\u6210\uff1a<\/p>\n<pre class=\"brush:php\">function uc_check_avatar($uid, $size =\n \u2018middle\u2019, $type = \u2018virtual\u2019) {\n\n$url =\n UC_API.\u201d\/avatar.php?uid=$uid&amp;size=$size&amp;type=$type&amp;check_file_exists=1\u2033;\n\n@$file_exists = trim(uc_fopen2(UC_API.\u201d\/avatar.php?uid=$uid&amp;check_file_exists=1\u2033));\n\nreturn $file_exists;\n\n}<\/pre>\n<p>\u76f4\u63a5\u8fdb\u884c\u5934\u50cf\u6587\u4ef6\u5b58\u5728\u4e0e\u5426\u7684\u5224\u65ad\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f3a\u5236\u4e0a\u4f20\u5934\u50cf\u5f80\u5f80\u4f1a\u4f5c\u4e3a\u7ad9\u957f\u9632\u704c\u6c34\u548c\u5f15\u5bfc\u7528\u6237\u5b8c\u5584\u8d44\u6599\u7684\u624b\u6bb5\uff0c\u4e4b&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-8","post","type-post","status-publish","format-standard","hentry","category-discuz"],"_links":{"self":[{"href":"https:\/\/www.uut8.com\/index.php?rest_route=\/wp\/v2\/posts\/8","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.uut8.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.uut8.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.uut8.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.uut8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/www.uut8.com\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.uut8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.uut8.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.uut8.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}