blogs ORDER BY blog_id" ); foreach ( $results as $row ) { switch_to_blog( $row->blog_id ); if ( $results = ScoperAnalyst::identify_protected_attachments() ) { $file_filtered_sites []= $row->blog_id; // WP-mu content rules are only inserted if defined uploads path matches this default structure $dir = ABSPATH . UPLOADBLOGSDIR . "/{$row->blog_id}/files/"; $url = trailingslashit( $siteurl ) . UPLOADBLOGSDIR . "/{$row->blog_id}/files/"; $uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => '', 'basedir' => $dir, 'baseurl' => $url, 'error' => false ) ); $content_base = str_replace( $strip_path, '', str_replace( '\\', '/', $uploads['basedir'] ) ); $path = trailingslashit($row->path); if ( $base && ( '/' != $base ) ) if ( 0 === strpos( $path, $base ) ) $path = substr( $path, strlen($base) ); // If a filter has changed basedir, don't filter file attachments for this blog if ( strpos( $content_base, "/blogs.dir/{$row->blog_id}/files/" ) ) $new_rules .= "RewriteRule ^{$path}files/(.*) {$content_base}$1 [L]\n"; //RewriteRule ^blog1/files/(.*) wp-content/blogs.dir/2/files/$1 [L] } } update_site_option( 'scoper_file_filtered_sites', $file_filtered_sites ); switch_to_blog( $orig_blog_id ); return $new_rules; } // remove RS rules from every .htaccess file in the wp-MU "files" folders function clear_all_file_rules() { global $wpdb, $blog_id; $blog_ids = scoper_get_col( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id" ); $orig_blog_id = $blog_id; foreach ( $blog_ids as $id ) { switch_to_blog( $id ); require_once( dirname(__FILE__).'/uploads_rs.php' ); $uploads = scoper_get_upload_info(); $htaccess_path = trailingslashit($uploads['basedir']) . '.htaccess'; if ( file_exists( $htaccess_path ) ) ScoperRewrite::insert_with_markers( $htaccess_path, 'Role Scoper', '' ); } switch_to_blog( $orig_blog_id ); } } ?>