<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[11719] trunk: Properly sanitize Gears storeName for IDN domains,
  fixes #9594</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/11719">11719</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-07-18 06:27:42 +0000 (Sat, 18 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Properly sanitize Gears storeName for IDN domains, fixes <a href="http://trac.wordpress.org/ticket/9594">#9594</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminjswpgearsdevjs">trunk/wp-admin/js/wp-gears.dev.js</a></li>
<li><a href="#trunkwpadminjswpgearsjs">trunk/wp-admin/js/wp-gears.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminjswpgearsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/wp-gears.dev.js (11718 => 11719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/wp-gears.dev.js        2009-07-16 22:31:22 UTC (rev 11718)
+++ trunk/wp-admin/js/wp-gears.dev.js        2009-07-18 06:27:42 UTC (rev 11719)
</span><span class="lines">@@ -28,9 +28,13 @@
</span><span class="cx">         },
</span><span class="cx"> 
</span><span class="cx">         storeName : function() {
</span><del>-                var name = window.location.protocol + window.location.host;
</del><ins>+                var name, host = window.location.host;
</ins><span class="cx"> 
</span><del>-                name = name.replace(/[\/\\:*&quot;?&lt;&gt;|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
</del><ins>+                if ( host.match(/[^a-z0-9._-]/i) )
+                        host = encodeURIComponent(host);
+                
+                name = window.location.protocol + host;
+                name = name.replace(/[^a-z0-9._-]+/gi, '_');
</ins><span class="cx">                 name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
</span><span class="cx"> 
</span><span class="cx">                 return name;
</span></span></pre></div>
<a id="trunkwpadminjswpgearsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/wp-gears.js (11718 => 11719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/wp-gears.js        2009-07-16 22:31:22 UTC (rev 11718)
+++ trunk/wp-admin/js/wp-gears.js        2009-07-18 06:27:42 UTC (rev 11719)
</span><span class="lines">@@ -1 +1 @@
</span><del>-var wpGears={createStore:function(){if(&quot;undefined&quot;==typeof google||!google.gears){return}if(&quot;undefined&quot;==typeof localServer){localServer=google.gears.factory.create(&quot;beta.localserver&quot;)}store=localServer.createManagedStore(this.storeName());store.manifestUrl=&quot;gears-manifest.php&quot;;store.checkForUpdate();this.message(3)},getPermission:function(){var a=true;if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){if(!google.gears.factory.hasPermission){a=google.gears.factory.getPermission(&quot;WordPress&quot;,&quot;images/logo.gif&quot;)}if(a){try{this.createStore()}catch(b){this.message()}}else{this.message(4)}}},storeName:function(){var a=window.location.protocol+window.location.host;a=a.replace(/[\/\\:*&quot;?&lt;&gt;|;,]+/g,&quot;_&quot;);a=&quot;wp_&quot;+a.substring(0,60);return a},message:function(a){var d=this,g=d.I(&quot;gears-msg1&quot;),f=d.I(&quot;gears-msg2&quot;),e=d.I(&quot;gears-msg3&quot;),c=d.I(&quot;gears-msg4&quot;),b=d.I(&quot;gears-upd-number&quot;),h=d.I(&quot;gears-wait&quot;);if(!g){return}if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){if(a&amp;&amp;a==4){g.style.display=f.style.display=e.style.display=&quot;none&quot;;c.style.display=&quot;block&quot;}else{if(google.gears.factory.hasPermission){g.style.display=f.style.display=c.style.display=&quot;none&quot;;e.style.display=&quot;block&quot;;if(&quot;undefined&quot;==typeof store){d.createStore()}store.oncomplete=function(){h.innerHTML=(&quot; &quot;+wpGearsL10n.updateCompleted)};store.onerror=function(){h.innerHTML=(&quot; &quot;+wpGearsL10n.error+&quot; &quot;+store.lastErrorMessage)};store.onprogress=function(i){if(b){b.innerHTML=(&quot; &quot;+i.filesComplete+&quot; / &quot;+i.filesTotal)}}}else{g.style.display=e.style.display=c.style.display=&quot;none&quot;;f.style.display=&quot;block&quot;}}}},I:function(a){return document.getElementById(a)}};(function(){if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){return}var a=false;if(&quot;undefined&quot;!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject(&quot;Gears.Factory&quot;);if(factory.getBuildInfo().indexOf(&quot;ie_mobile&quot;)!=-1){a.privateSetGlobalObject(this)}}catch(b){if((&quot;undefined&quot;!=typeof navigator.mimeTypes)&amp;&amp;navigator.mimeTypes[&quot;application/x-googlegears&quot;]){a=document.createElement(&quot;object&quot;);a.style.display=&quot;none&quot;;a.width=0;a.height=0;a.type=&quot;application/x-googlegears&quot;;document.documentElement.appendChild(a)}}}if(!a){return}if(&quot;undefined&quot;==typeof google){google={}}if(!google.gears){google.gears={factory:a}}})();
</del><span class="cx">\ No newline at end of file
</span><ins>+var wpGears={createStore:function(){if(&quot;undefined&quot;==typeof google||!google.gears){return}if(&quot;undefined&quot;==typeof localServer){localServer=google.gears.factory.create(&quot;beta.localserver&quot;)}store=localServer.createManagedStore(this.storeName());store.manifestUrl=&quot;gears-manifest.php&quot;;store.checkForUpdate();this.message(3)},getPermission:function(){var a=true;if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){if(!google.gears.factory.hasPermission){a=google.gears.factory.getPermission(&quot;WordPress&quot;,&quot;images/logo.gif&quot;)}if(a){try{this.createStore()}catch(b){this.message()}}else{this.message(4)}}},storeName:function(){var a,b=window.location.host;if(b.match(/[^a-z0-9._-]/i)){b=encodeURIComponent(b)}a=window.location.protocol+b;a=a.replace(/[^a-z0-9._-]+/gi,&quot;_&quot;);a=&quot;wp_&quot;+a.substring(0,60);return a},message:function(a){var d=this,g=d.I(&quot;gears-msg1&quot;),f=d.I(&quot;gears-msg2&quot;),e=d.I(&quot;gears-msg3&quot;),c=d.I(&quot;gears-msg4&quot;),b=d.I(&quot;gears-upd-number&quot;),h=d.I(&quot;gears-wait&quot;);if(!g){return}if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){if(a&amp;&amp;a==4){g.style.display=f.style.display=e.style.display=&quot;none&quot;;c.style.display=&quot;block&quot;}else{if(google.gears.factory.hasPermission){g.style.display=f.style.display=c.style.display=&quot;none&quot;;e.style.display=&quot;block&quot;;if(&quot;undefined&quot;==typeof store){d.createStore()}store.oncomplete=function(){h.innerHTML=(&quot; &quot;+wpGearsL10n.updateCompleted)};store.onerror=function(){h.innerHTML=(&quot; &quot;+wpGearsL10n.error+&quot; &quot;+store.lastErrorMessage)};store.onprogress=function(i){if(b){b.innerHTML=(&quot; &quot;+i.filesComplete+&quot; / &quot;+i.filesTotal)}}}else{g.style.display=e.style.display=c.style.display=&quot;none&quot;;f.style.display=&quot;block&quot;}}}},I:function(a){return document.getElementById(a)}};(function(){if(&quot;undefined&quot;!=typeof google&amp;&amp;google.gears){return}var a=false;if(&quot;undefined&quot;!=typeof GearsFactory){a=new GearsFactory()}else{try{a=new ActiveXObject(&quot;Gears.Factory&quot;);if(factory.getBuildInfo().indexOf(&quot;ie_mobile&quot;)!=-1){a.privateSetGlobalObject(this)}}catch(b){if((&quot;undefined&quot;!=typeof navigator.mimeTypes)&amp;&amp;navigator.mimeTypes[&quot;application/x-googlegears&quot;]){a=document.createElement(&quot;object&quot;);a.style.display=&quot;none&quot;;a.width=0;a.height=0;a.type=&quot;application/x-googlegears&quot;;document.documentElement.appendChild(a)}}}if(!a){return}if(&quot;undefined&quot;==typeof google){google={}}if(!google.gears){google.gears={factory:a}}})();
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (11718 => 11719)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-07-16 22:31:22 UTC (rev 11718)
+++ trunk/wp-includes/script-loader.php        2009-07-18 06:27:42 UTC (rev 11719)
</span><span class="lines">@@ -347,7 +347,7 @@
</span><span class="cx">                         'l10n_print_after' =&gt; 'try{convertEntities(wordCountL10n);}catch(e){};'
</span><span class="cx">                 ));
</span><span class="cx"> 
</span><del>-                $scripts-&gt;add( 'wp-gears', &quot;/wp-admin/js/wp-gears$suffix.js&quot;, false, '20090102' );
</del><ins>+                $scripts-&gt;add( 'wp-gears', &quot;/wp-admin/js/wp-gears$suffix.js&quot;, false, '20090717' );
</ins><span class="cx">                 $scripts-&gt;localize( 'wp-gears', 'wpGearsL10n', array(
</span><span class="cx">                         'updateCompleted' =&gt; __('Update completed.'),
</span><span class="cx">                         'error' =&gt; __('Error:'),
</span></span></pre>
</div>
</div>

</body>
</html>