 {"id":419,"date":"2011-11-11T11:08:04","date_gmt":"2011-11-11T03:08:04","guid":{"rendered":"http:\/\/www.qyuef.com\/?p=419"},"modified":"2011-11-11T11:08:04","modified_gmt":"2011-11-11T03:08:04","slug":"dedecms5-7-utf_8%e7%89%88%e6%9c%ac%e4%b8%8a%e4%bc%a0%e6%96%87%e4%bb%b6%e9%87%8d%e5%91%bd%e5%90%8d%e4%b8%ba%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e7%9a%84%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"http:\/\/www.qyuef.com\/?p=419","title":{"rendered":"DEDECMS5.7 UTF_8\u7248\u672c\u4e0a\u4f20\u6587\u4ef6\u91cd\u547d\u540d\u4e3a\u4e2d\u6587\u4e71\u7801\u7684\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\n\t\u867d\u7136\u4e00\u76f4\u5728\u4f7f\u7528\u7ec7\u68a6\u5efa\u7ad9\uff0c\u4f46\u662f\u81ea\u5df1\u4e14\u5f88\u5c11\u4f7f\u7528\u4ed6\u7684\u529f\u80fd\u3002\u4eca\u5929\u4e00\u4e2a\u670b\u53cb\u7a81\u7136\u8bf4\u7f51\u7ad9\u51fa\u95ee\u9898\u4e86\u3002\u5728\u4e0a\u4f20\u6587\u4ef6\u7684\u65f6\u5019\u5982\u679c\u91cd\u65b0\u8bbe\u7f6e\u4e2d\u6587\u540d\u5c31\u51fa\u73b0\u4e71\u7801\u548c\u65e0\u6cd5\u6253\u5f00\u7684\u95ee\u9898\u3002\u6211\u6253\u5f00\u81ea\u5df1\u7684\u540e\u53f0\u4e00\u770b\u4e5f\u51fa\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\n\t\u5fd9\u6d3b\u4e86\u4e00\u9635\uff0c\u7ec8\u4e8e\u641e\u5b9a\u4e86\u3002\u73b0\u5728\u628a\u4ed6\u5206\u4eab\u51fa\u6765\uff1a<\/p>\n<p>\n\t\u7b2c\u4e00\u6b65\uff1a\u627e\u5230\\include\\dialog\\select_soft_post.php \u66ff\u6362\u4e3a\u4e0b\u9762\u7684\u5185\u5bb9<\/p>\n<p><\/p>\n<pre class=\"brush:php;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;\">\n&lt; ?php\nif(!isset($cfg_basedir))\n{\n\tinclude_once(dirname(__FILE__).&#39;\/config.php&#39;);\n}\nif(empty($uploadfile)) $uploadfile = &#39;&#39;;\nif(empty($uploadmbtype)) $uploadmbtype = &#39;\u8f6f\u4ef6\u7c7b\u578b&#39;;\nif(empty($bkurl)) $bkurl = &#39;select_soft.php&#39;;\n$newname = ( empty($newname) ? &#39;&#39; : ereg_replace(&quot;[\\\\ \\&quot;\\*\\?\\t\\r\\n&lt;&gt;&#39;:\/|]&quot;, &quot;&quot;, $newname) );\n\nif(!is_uploaded_file($uploadfile))\n{\n\tShowMsg(&quot;\u4f60\u6ca1\u6709\u9009\u62e9\u4e0a\u4f20\u7684\u6587\u4ef6\u6216\u9009\u62e9\u7684\u6587\u4ef6\u5927\u5c0f\u8d85\u51fa\u9650\u5236!&quot;, &quot;-1&quot;);\n\texit();\n}\n\n\/\/\u8f6f\u4ef6\u7c7b\u578b\u6240\u6709\u652f\u6301\u7684\u9644\u4ef6\n$cfg_softtype = $cfg_softtype;\n$cfg_softtype = str_replace(&#39;||&#39;, &#39;|&#39;, $cfg_softtype);\n$uploadfile_name = trim(ereg_replace(&quot;[ \\r\\n\\t\\*\\%\\\\\/\\?&gt;&lt; \\|\\&quot;:]{1,}&quot;,&#39;&#39;,$uploadfile_name));\nif(!eregi(&quot;\\.(&quot;.$cfg_softtype.&quot;)&quot;, $uploadfile_name))\n{\n\tShowMsg(&quot;\u4f60\u6240\u4e0a\u4f20\u7684{$uploadmbtype}\u4e0d\u5728\u8bb8\u53ef\u5217\u8868\uff0c\u8bf7\u66f4\u6539\u7cfb\u7edf\u5bf9\u6269\u5c55\u540d\u9650\u5b9a\u7684\u914d\u7f6e\uff01&quot;,&quot;&quot;);\n\texit();\n}\n\n$nowtme = time();\nif($activepath==$cfg_soft_dir)\n{\n\t$newdir = MyDate($cfg_addon_savetype, $nowtme);\n\t$activepath = $activepath.&#39;\/&#39;.$newdir;\n\tif(!is_dir($cfg_basedir.$activepath))\n\t{\n\t\tMkdirAll($cfg_basedir.$activepath,$cfg_dir_purview);\n\t\tCloseFtp();\n\t}\n}\n\n\/\/\u6587\u4ef6\u540d\uff08\u524d\u4e3a\u624b\u5de5\u6307\u5b9a\uff0c \u540e\u8005\u81ea\u52a8\u5904\u7406\uff09\nif(!empty($newname))\n{\n\t$filename = $newname;\n\tif(!ereg(&quot;\\.&quot;, $filename)) $fs = explode(&#39;.&#39;, $uploadfile_name);\n\telse $fs = explode(&#39;.&#39;, $filename);\n\tif(eregi($cfg_not_allowall, $fs[count($fs)-1]))\n\t{\n\t\tShowMsg(&quot;\u4f60\u6307\u5b9a\u7684\u6587\u4ef6\u540d\u88ab\u7cfb\u7edf\u7981\u6b62\uff01&quot;,&#39;javascript:;&#39;);\n\t\texit();\n\t}\n\tif(!ereg(&quot;\\.&quot;, $filename)) $filename = $filename.&#39;.&#39;.$fs[count($fs)-1];\n}else{\n\t$filename = $cuserLogin-&gt;getUserID().&#39;-&#39;.dd2char(MyDate(&#39;ymdHis&#39;,$nowtme));\n\t$fs = explode(&#39;.&#39;, $uploadfile_name);\n\tif(eregi($cfg_not_allowall, $fs[count($fs)-1]))\n\t{\n\t\tShowMsg(&quot;\u4f60\u4e0a\u4f20\u4e86\u67d0\u4e9b\u53ef\u80fd\u5b58\u5728\u4e0d\u5b89\u5168\u56e0\u7d20\u7684\u6587\u4ef6\uff0c\u7cfb\u7edf\u62d2\u7edd\u64cd\u4f5c\uff01&quot;,&#39;javascript:;&#39;);\n\t\texit();\n\t}\n\t$filename = $filename.&#39;.&#39;.$fs[count($fs)-1];\n}\n\n$fullfilename = $cfg_basedir.$activepath.&#39;\/&#39;.$filename;\n$fullfileurl = $activepath.&#39;\/&#39;.$filename;\n$fullfilename  = mb_convert_encoding($fullfilename,&#39;GBK&#39;,&#39;UTF-8&#39;);\n \/\/fullname\u4e5f\u662fGBK\u7f16\u7801\uff0c\u9875\u9762\u662fUTF\uff0d8,\u6240\u4ee5\u9700\u8981\u628a\u4e0a\u4f20\u5931\u8d25\u63d0\u793a\u8f6c\u4e3aUTF-8\n$failupload = mb_convert_encoding($fullfilename,&#39;UTF-8&#39;,&#39;GBK&#39;);\nmove_uploaded_file($uploadfile,$fullfilename) or die(&quot;\u4e0a\u4f20\u6587\u4ef6\u5230&quot;.$failupload.&quot;\u5931\u8d25\uff01&quot;);\n\/\/\u518d\u628a\u6587\u4ef6\u540d\u4eceGBK\u8f6c\u4e3aUTF-8\uff0c\u7528\u4e8e\u4fdd\u5b58\u5230\u6570\u636e\u5e93\n$$fullfilename = mb_convert_encoding($fullfilename,&#39;UTF-8&#39;,&#39;GBK&#39;); \n@unlink($uploadfile);\nif($cfg_remote_site==&#39;Y&#39; &amp;&amp; $remoteuploads == 1)\n{\n\t\/\/\u5206\u6790\u8fdc\u7a0b\u6587\u4ef6\u8def\u5f84\n\t$remotefile = str_replace(DEDEROOT, &#39;&#39;, $fullfilename);\n\t$localfile = &#39;..\/..&#39;.$remotefile;\n\t\/\/\u521b\u5efa\u8fdc\u7a0b\u6587\u4ef6\u5939\n\t$remotedir = preg_replace(&#39;\/[^\\\/]*\\.(&#39;.$cfg_softtype.&#39;)\/&#39;, &#39;&#39;, $remotefile);\n\t$ftp-&gt;rmkdir($remotedir);\n\t$ftp-&gt;upload($localfile, $remotefile);\n}\n\nif($uploadfile_type == &#39;application\/x-shockwave-flash&#39;)\n{\n\t$mediatype=2;\n}\nelse if(eregi(&#39;image&#39;,$uploadfile_type))\n{\n\t$mediatype=1;\n}\nelse if(eregi(&#39;audio|media|video&#39;,$uploadfile_type))\n{\n\t$mediatype=3;\n}\nelse\n{\n\t$mediatype=4;\n}\n\n$inquery = &quot;INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid)\n   VALUES (&#39;0&#39;,&#39;$filename&#39;,&#39;$fullfileurl&#39;,&#39;$mediatype&#39;,&#39;0&#39;,&#39;0&#39;,&#39;0&#39;,&#39;{$uploadfile_size}&#39;,&#39;{$nowtme}&#39;,&#39;&quot;.$cuserLogin-&gt;getUserID().&quot;&#39;); &quot;;\n\n$dsql-&gt;ExecuteNoneQuery($inquery);\n$fid = $dsql-&gt;GetLastID();\nAddMyAddon($fid, $fullfileurl);\n\nShowMsg(&quot;\u6210\u529f\u4e0a\u4f20\u6587\u4ef6\uff01&quot;,$bkurl.&quot;?comeback=&quot;.urlencode($filename).&quot;&amp;f=$f&amp;activepath=&quot;.urlencode($activepath).&quot;&amp;d=&quot;.time());\nexit();\n?&gt;\n<\/pre>\n<p>\n\t\u8fd4\u56de\u6587\u4ef6\u5217\u8868\u9875\u9762\u4fee\u6539 \u627e\u5230 \\include\\dialog\\select_soft.php \u66ff\u6362\u4e3a\uff1a<\/p>\n<p><\/p>\n<pre class=\"brush:php;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;\">\n&lt; ?php\nrequire_once(dirname(__FILE__).&quot;\/config.php&quot;);\nif(empty($activepath))\n{\n\t$activepath = &#39;&#39;;\n}\n$activepath = str_replace(&#39;.&#39;,&#39;&#39;,$activepath);\n$activepath = ereg_replace(&quot;\/{1,}&quot;,&#39;\/&#39;,$activepath);\nif(strlen($activepath) &lt; strlen($cfg_soft_dir))\n{\n\t$activepath = $cfg_soft_dir;\n}\n$inpath = $cfg_basedir.$activepath;\n$activeurl = &#39;..&#39;.$activepath;\nif(empty($f))\n{\n\t$f=&#39;form1.enclosure&#39;;\n}\n\nif(empty($comeback))\n{\n\t$comeback = &#39;&#39;;\n}\n\n?&gt;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u867d\u7136\u4e00\u76f4\u5728\u4f7f\u7528\u7ec7\u68a6\u5efa\u7ad9\uff0c\u4f46\u662f\u81ea\u5df1\u4e14\u5f88\u5c11\u4f7f\u7528\u4ed6\u7684\u529f\u80fd\u3002\u4eca\u5929\u4e00\u4e2a\u670b\u53cb\u7a81\u7136\u8bf4\u7f51\u7ad9\u51fa\u95ee\u9898\u4e86\u3002\u5728\u4e0a\u4f20\u6587\u4ef6\u7684\u65f6\u5019\u5982\u679c\u91cd\u65b0\u8bbe\u7f6e\u4e2d\u6587\u540d\u5c31\u51fa\u73b0\u4e71\u7801\u548c\u65e0\u6cd5\u6253\u5f00\u7684\u95ee\u9898\u3002\u6211\u6253\u5f00\u81ea\u5df1\u7684\u540e\u53f0\u4e00\u770b\u4e5f\u51fa\u73b0\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[18,48],"tcat":[],"_links":{"self":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/419"}],"collection":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=419"}],"version-history":[{"count":0,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/419\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=419"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=419"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=419"},{"taxonomy":"tcat","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftcat&post=419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}