<!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>[BuddyPress] [2984] branches/1.2: Fixes #2317 props jjj</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2984</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-05-03 23:28:51 +0000 (Mon, 03 May 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #2317 props jjj</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpcorebpcoreavatarsphp">branches/1.2/bp-core/bp-core-avatars.php</a></li>
<li><a href="#branches12bpcorebpcorecssjsphp">branches/1.2/bp-core/bp-core-cssjs.php</a></li>
<li><a href="#branches12bpcorebpcoresignupphp">branches/1.2/bp-core/bp-core-signup.php</a></li>
<li><a href="#branches12bpgroupsphp">branches/1.2/bp-groups.php</a></li>
<li><a href="#branches12bpxprofilephp">branches/1.2/bp-xprofile.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpcorebpcoreavatarsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-avatars.php (2983 => 2984)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-avatars.php        2010-05-03 22:39:14 UTC (rev 2983)
+++ branches/1.2/bp-core/bp-core-avatars.php        2010-05-03 23:28:51 UTC (rev 2984)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">         else
</span><span class="cx">                 $html_height = ( 'thumb' == $type ) ? ' height=&quot;' . BP_AVATAR_THUMB_HEIGHT . '&quot;' : ' height=&quot;' . BP_AVATAR_FULL_HEIGHT . '&quot;';
</span><span class="cx"> 
</span><del>-        $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, BP_AVATAR_UPLOAD_PATH ) . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
</del><ins>+        $avatar_folder_url = apply_filters( 'bp_core_avatar_folder_url', BP_AVATAR_URL . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
</ins><span class="cx">         $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
</span><span class="cx"> 
</span><span class="cx">         /****
</span><span class="lines">@@ -293,14 +293,14 @@
</span><span class="cx"> 
</span><span class="cx">         /* We only want to handle one image after resize. */
</span><span class="cx">         if ( empty( $bp-&gt;avatar_admin-&gt;resized ) )
</span><del>-                $bp-&gt;avatar_admin-&gt;image-&gt;dir = $bp-&gt;avatar_admin-&gt;original['file'];
</del><ins>+                $bp-&gt;avatar_admin-&gt;image-&gt;dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp-&gt;avatar_admin-&gt;original['file'] );
</ins><span class="cx">         else {
</span><del>-                $bp-&gt;avatar_admin-&gt;image-&gt;dir = $bp-&gt;avatar_admin-&gt;resized;
</del><ins>+                $bp-&gt;avatar_admin-&gt;image-&gt;dir = str_replace( BP_AVATAR_UPLOAD_PATH, '', $bp-&gt;avatar_admin-&gt;resized );
</ins><span class="cx">                 @unlink( $bp-&gt;avatar_admin-&gt;original['file'] );
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /* Set the url value for the image */
</span><del>-        $bp-&gt;avatar_admin-&gt;image-&gt;url = str_replace( WP_CONTENT_DIR, BP_AVATAR_URL, $bp-&gt;avatar_admin-&gt;image-&gt;dir );
</del><ins>+        $bp-&gt;avatar_admin-&gt;image-&gt;url = BP_AVATAR_URL . $bp-&gt;avatar_admin-&gt;image-&gt;dir;
</ins><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -333,11 +333,13 @@
</span><span class="cx">         if ( !$original_file )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-        if ( !file_exists( WP_CONTENT_DIR . '/' . $original_file ) )
</del><ins>+        $original_file = BP_AVATAR_UPLOAD_PATH . $original_file;
+
+        if ( !file_exists( $original_file ) )
</ins><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="cx">         if ( !$item_id )
</span><del>-                $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', WP_CONTENT_DIR . dirname( $original_file ), $item_id, $object, $avatar_dir );
</del><ins>+                $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', dirname( $original_file ), $item_id, $object, $avatar_dir );
</ins><span class="cx">         else
</span><span class="cx">                 $avatar_folder_dir = apply_filters( 'bp_core_avatar_folder_dir', BP_AVATAR_UPLOAD_PATH . '/' . $avatar_dir . '/' . $item_id, $item_id, $object, $avatar_dir );
</span><span class="cx"> 
</span><span class="lines">@@ -362,11 +364,11 @@
</span><span class="cx">         $thumb_filename = wp_hash( $original_file . time() ) . '-bpthumb.jpg';
</span><span class="cx"> 
</span><span class="cx">         /* Crop the image */
</span><del>-        $full_cropped = wp_crop_image( WP_CONTENT_DIR . $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );
-        $thumb_cropped = wp_crop_image( WP_CONTENT_DIR . $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );
</del><ins>+        $full_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_FULL_WIDTH, BP_AVATAR_FULL_HEIGHT, false, $avatar_folder_dir . '/' . $full_filename );
+        $thumb_cropped = wp_crop_image( $original_file, (int)$crop_x, (int)$crop_y, (int)$crop_w, (int)$crop_h, BP_AVATAR_THUMB_WIDTH, BP_AVATAR_THUMB_HEIGHT, false, $avatar_folder_dir . '/' . $thumb_filename );
</ins><span class="cx"> 
</span><span class="cx">         /* Remove the original */
</span><del>-        @unlink( WP_CONTENT_DIR . $original_file );
</del><ins>+        @unlink( $original_file );
</ins><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="lines">@@ -413,23 +415,13 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_core_avatar_upload_path() {
</span><del>-        if ( bp_core_is_multisite() )
-                $path = ABSPATH . get_blog_option( BP_ROOT_BLOG, 'upload_path' );
-        else {
-                if ( !$path = get_option( 'upload_path' ) )
-                        $path = WP_CONTENT_DIR . '/uploads';
-                else
-                        $path = ABSPATH . $path;
-        }
-
-        return apply_filters( 'bp_core_avatar_upload_path', $path );
</del><ins>+        $upload_dir = wp_upload_dir();
+        return apply_filters( 'bp_core_avatar_upload_path', $upload_dir['basedir'] );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_core_avatar_url() {
</span><del>-        if ( !bp_core_is_multisite() )
-                return WP_CONTENT_URL;
-
-        return apply_filters( 'bp_core_avatar_url', get_blog_option( BP_ROOT_BLOG, 'siteurl' ) );
</del><ins>+        $upload_dir = wp_upload_dir();
+        return apply_filters( 'bp_core_avatar_url', $upload_dir['baseurl'] );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branches12bpcorebpcorecssjsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-cssjs.php (2983 => 2984)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-cssjs.php        2010-05-03 22:39:14 UTC (rev 2983)
+++ branches/1.2/bp-core/bp-core-cssjs.php        2010-05-03 23:28:51 UTC (rev 2984)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> function bp_core_add_cropper_inline_js() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        $image = apply_filters( 'bp_inline_cropper_image', getimagesize( $bp-&gt;avatar_admin-&gt;image-&gt;dir ) );
</del><ins>+        $image = apply_filters( 'bp_inline_cropper_image', getimagesize( BP_AVATAR_UPLOAD_PATH . $bp-&gt;avatar_admin-&gt;image-&gt;dir ) );
</ins><span class="cx">         $aspect_ratio = 1;
</span><span class="cx"> 
</span><span class="cx">         /* Calculate Aspect Ratio */
</span></span></pre></div>
<a id="branches12bpcorebpcoresignupphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-signup.php (2983 => 2984)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-signup.php        2010-05-03 22:39:14 UTC (rev 2983)
+++ branches/1.2/bp-core/bp-core-signup.php        2010-05-03 23:28:51 UTC (rev 2984)
</span><span class="lines">@@ -519,7 +519,7 @@
</span><span class="cx">         if ( !file_exists( $path ) )
</span><span class="cx">                 @wp_mkdir_p( $path );
</span><span class="cx"> 
</span><del>-        $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
</del><ins>+        $newurl = BP_AVATAR_URL . '/avatars/signups/' . $bp-&gt;signup-&gt;avatar_dir;
</ins><span class="cx">         $newburl = $newurl;
</span><span class="cx">         $newsubdir = '/avatars/signups/' . $bp-&gt;signup-&gt;avatar_dir;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpgroupsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-groups.php (2983 => 2984)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-groups.php        2010-05-03 22:39:14 UTC (rev 2983)
+++ branches/1.2/bp-groups.php        2010-05-03 23:28:51 UTC (rev 2984)
</span><span class="lines">@@ -1859,7 +1859,7 @@
</span><span class="cx">         if ( !file_exists( $path ) )
</span><span class="cx">                 @wp_mkdir_p( $path );
</span><span class="cx"> 
</span><del>-        $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
</del><ins>+        $newurl = BP_AVATAR_URL . '/group-avatars/' . $group_id;
</ins><span class="cx">         $newburl = $newurl;
</span><span class="cx">         $newsubdir = '/group-avatars/' . $group_id;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branches12bpxprofilephp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-xprofile.php (2983 => 2984)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-xprofile.php        2010-05-03 22:39:14 UTC (rev 2983)
+++ branches/1.2/bp-xprofile.php        2010-05-03 23:28:51 UTC (rev 2984)
</span><span class="lines">@@ -875,7 +875,7 @@
</span><span class="cx">         if ( !file_exists( $path ) )
</span><span class="cx">                 @wp_mkdir_p( $path );
</span><span class="cx"> 
</span><del>-        $newurl = str_replace( BP_AVATAR_UPLOAD_PATH, BP_AVATAR_URL, $path );
</del><ins>+        $newurl  = BP_AVATAR_URL . '/avatars/' . $user_id;
</ins><span class="cx">         $newburl = $newurl;
</span><span class="cx">         $newsubdir = '/avatars/' . $user_id;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>