<!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 { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { 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>[13132] trunk: Use stripos() instead of strpos() with strtolower().</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13132">13132</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-02-14 02:27:19 +0000 (Sun, 14 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use stripos() instead of strpos() with strtolower(). For PHP < 5 we have stripos() in compat.php. Fixes <a href="http://trac.wordpress.org/ticket/11176">#11176</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadminincludesclasswpfilesystemftpextphp">trunk/wp-admin/includes/class-wp-filesystem-ftpext.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpincludesgeneraltemplatephp">trunk/wp-includes/general-template.php</a></li>
<li><a href="#trunkwpincludesvarsphp">trunk/wp-includes/vars.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (13131 => 13132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-02-14 02:14:59 UTC (rev 13131)
+++ trunk/wp-admin/admin-ajax.php        2010-02-14 02:27:19 UTC (rev 13132)
</span><span class="lines">@@ -93,10 +93,10 @@
</span><span class="cx">                  } elseif ( 2 == $_GET['test'] ) {
</span><span class="cx">                         if ( !isset($_SERVER['HTTP_ACCEPT_ENCODING']) )
</span><span class="cx">                                 die('-1');
</span><del>-                        if ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
</del><ins>+                        if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
</ins><span class="cx">                                 header('Content-Encoding: deflate');
</span><span class="cx">                                 $out = gzdeflate( $test_str, 1 );
</span><del>-                        } elseif ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') && function_exists('gzencode') ) {
</del><ins>+                        } elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
</ins><span class="cx">                                 header('Content-Encoding: gzip');
</span><span class="cx">                                 $out = gzencode( $test_str, 1 );
</span><span class="cx">                         } else {
</span></span></pre></div>
<a id="trunkwpadminincludesclasswpfilesystemftpextphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-filesystem-ftpext.php (13131 => 13132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-filesystem-ftpext.php        2010-02-14 02:14:59 UTC (rev 13131)
+++ trunk/wp-admin/includes/class-wp-filesystem-ftpext.php        2010-02-14 02:27:19 UTC (rev 13132)
</span><span class="lines">@@ -258,7 +258,7 @@
</span><span class="cx">         function parselisting($line) {
</span><span class="cx">                 static $is_windows;
</span><span class="cx">                 if ( is_null($is_windows) )
</span><del>-                        $is_windows = strpos( strtolower( ftp_systype($this->link) ), 'win') !== false;
</del><ins>+                        $is_windows = stripos( ftp_systype($this->link), 'win') !== false;
</ins><span class="cx">
</span><span class="cx">                 if ( $is_windows && preg_match('/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/', $line, $lucifer) ) {
</span><span class="cx">                         $b = array();
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (13131 => 13132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2010-02-14 02:14:59 UTC (rev 13131)
+++ trunk/wp-admin/includes/media.php        2010-02-14 02:27:19 UTC (rev 13132)
</span><span class="lines">@@ -1382,7 +1382,7 @@
</span><span class="cx">
</span><span class="cx">         // If Mac and mod_security, no Flash. :(
</span><span class="cx">         $flash = true;
</span><del>-        if ( false !== strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mac') && apache_mod_loaded('mod_security') )
</del><ins>+        if ( false !== stripos($_SERVER['HTTP_USER_AGENT'], 'mac') && apache_mod_loaded('mod_security') )
</ins><span class="cx">                 $flash = false;
</span><span class="cx">
</span><span class="cx">         $flash = apply_filters('flash_uploader', $flash);
</span></span></pre></div>
<a id="trunkwpincludesgeneraltemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/general-template.php (13131 => 13132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/general-template.php        2010-02-14 02:14:59 UTC (rev 13131)
+++ trunk/wp-includes/general-template.php        2010-02-14 02:27:19 UTC (rev 13132)
</span><span class="lines">@@ -1146,7 +1146,7 @@
</span><span class="cx">                 $daywithpost = array();
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'camino') !== false || strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false)
</del><ins>+        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'camino') !== false || stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false)
</ins><span class="cx">                 $ak_title_separator = "\n";
</span><span class="cx">         else
</span><span class="cx">                 $ak_title_separator = ', ';
</span></span></pre></div>
<a id="trunkwpincludesvarsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/vars.php (13131 => 13132)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/vars.php        2010-02-14 02:14:59 UTC (rev 13131)
+++ trunk/wp-includes/vars.php        2010-02-14 02:27:19 UTC (rev 13132)
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx"> if ( isset($_SERVER['HTTP_USER_AGENT']) ) {
</span><span class="cx">         if ( strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false ) {
</span><span class="cx">                 $is_lynx = true;
</span><del>-        } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
</del><ins>+        } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'chrome') !== false ) {
</ins><span class="cx">                 $is_chrome = true;
</span><del>-        } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
</del><ins>+        } elseif ( stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== false ) {
</ins><span class="cx">                 $is_safari = true;
</span><span class="cx">         } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false ) {
</span><span class="cx">                 $is_gecko = true;
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if ( $is_safari && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false )
</del><ins>+if ( $is_safari && stripos($_SERVER['HTTP_USER_AGENT'], 'mobile') !== false )
</ins><span class="cx">         $is_iphone = true;
</span><span class="cx">
</span><span class="cx"> $is_IE = ( $is_macIE || $is_winIE );
</span></span></pre>
</div>
</div>
</body>
</html>