Changeset 424085
- Timestamp:
- 08/16/2011 07:14:42 AM (14 years ago)
- Location:
- forumconverter
- Files:
-
- 14 added
- 2 edited
-
tags/1.07 (added)
-
tags/1.07/Forum.php (added)
-
tags/1.07/ForumConverter.php (added)
-
tags/1.07/PhpbbAuth.php (added)
-
tags/1.07/PhpbbToBbpress.php (added)
-
tags/1.07/PhpbbToBpforums.php (added)
-
tags/1.07/fc-auth.php (added)
-
tags/1.07/fc-main.php (added)
-
tags/1.07/fc-options.php (added)
-
tags/1.07/license.txt (added)
-
tags/1.07/readme.txt (added)
-
tags/1.07/screenshot-1.png (added)
-
tags/1.07/wp-db-ex.php (added)
-
tags/1.07/wp-pass-ex.php (added)
-
trunk/PhpbbToBbpress.php (modified) (11 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
forumconverter/trunk/PhpbbToBbpress.php
r423205 r424085 25 25 private $processAttachments; 26 26 private $siteurl; 27 private $dstAvatarPath; 27 28 28 29 public function __construct($forumSrc,$forumDst = NULL) … … 40 41 //timeouts - this may require adjusting based on amount of posts that need to be converted 41 42 set_time_limit(3600); 42 43 44 $this->dstAvatarPath = ''; 43 45 if (file_exists(WP_PLUGIN_DIR.'/buddypress/bp-core/bp-core-avatars.php')) 44 46 { … … 46 48 include_once(WP_PLUGIN_DIR.'/buddypress/bp-core/bp-core-avatars.php'); 47 49 bp_core_set_avatar_constants(); 50 51 if (defined('BP_AVATAR_UPLOAD_PATH')) 52 $this->dstAvatarPath = BP_AVATAR_UPLOAD_PATH; //BuddyPress 1.2.9 53 if (function_exists('bp_core_avatar_upload_path')); 54 $this->dstAvatarPath = bp_core_avatar_upload_path(); //BuddyPress 1.5-beta-2 48 55 } 49 50 56 } 51 57 … … 640 646 if ($this->processAttachments) 641 647 { 642 //create a folder to dump the attachments643 $dir = wp_upload_dir();644 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE)645 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true);646 647 648 if (strpos($postText, '[attachment=') !== FALSE) 648 649 { … … 655 656 if (strpos($v,'[attachment=') !== FALSE) 656 657 { 657 $this->fc_echo('adding inline attachment<br/>');658 659 658 //grab the filename 660 659 //$a = array($v); … … 663 662 if ($data->post_attachment) 664 663 { 664 $this->fc_echo('adding inline attachment<br/>'); 665 666 //create a folder to dump the attachments 667 $dir = wp_upload_dir(); 668 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE) 669 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true); 670 665 671 //insert as attachment 666 672 $attachment = $fdb->get_row('SELECT * FROM '.$this->forumLoginSrc->prefix.'attachments WHERE post_msg_id='.$data->post_id.' AND real_filename="'.$filename.'"'); … … 760 766 foreach ($attachments as $attachment) 761 767 { 762 $this->fc_echo('adding post/reply attachment<br/>');763 764 768 //add download link 765 769 if ($data->post_attachment) 766 770 { 771 $this->fc_echo('adding post/reply attachment<br/>'); 772 773 //create a folder to dump the attachments 774 $dir = wp_upload_dir(); 775 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE) 776 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true); 777 767 778 //try to maintain the original filename name without any extra fancy script 768 779 //copy attachment to wordpress uploads folder … … 1750 1761 1751 1762 //buddypress avatar transfer 1752 if ( defined('BP_AVATAR_UPLOAD_PATH'))1763 if (strlen($this->dstAvatarPath) > 0) 1753 1764 { 1754 1765 //find the file … … 1772 1783 $this->fc_echo('transfering avatar<br/>'); 1773 1784 1774 if (is_dir ( BP_AVATAR_UPLOAD_PATH.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId) == FALSE)1775 mkdir( BP_AVATAR_UPLOAD_PATH.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId,0644,true);1785 if (is_dir ($this->dstAvatarPath.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId) == FALSE) 1786 mkdir($this->dstAvatarPath.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId,0644,true); 1776 1787 1777 1788 //large … … 1780 1791 $filename = str_replace('.gif', '-bpfull.gif', $filename); 1781 1792 $filename = str_replace('.png', '-bpfull.png', $filename); 1782 $status = copy($this->forumLoginSrc->avatarpath.DIRECTORY_SEPARATOR.$found, BP_AVATAR_UPLOAD_PATH.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename);1793 $status = copy($this->forumLoginSrc->avatarpath.DIRECTORY_SEPARATOR.$found, $this->dstAvatarPath.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename); 1783 1794 if ($status == FALSE) 1784 1795 $this->fc_echo('failed to copy file<br/>'); … … 1789 1800 $filename = str_replace('.gif', '-bpthumb.gif', $filename); 1790 1801 $filename = str_replace('.png', '-bpthumb.png', $filename); 1791 $status = copy($this->forumLoginSrc->avatarpath.DIRECTORY_SEPARATOR.$found, BP_AVATAR_UPLOAD_PATH.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename);1802 $status = copy($this->forumLoginSrc->avatarpath.DIRECTORY_SEPARATOR.$found, $this->dstAvatarPath.DIRECTORY_SEPARATOR.'avatars'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename); 1792 1803 if ($status == FALSE) 1793 1804 $this->fc_echo('failed to copy file<br/>'); -
forumconverter/trunk/readme.txt
r423205 r424085 5 5 Requires at least: 3.2.1 6 6 Tested up to: 3.2.1 7 Stable tag: 1.0 67 Stable tag: 1.07 8 8 9 9 Migrates a phpBB forum into a bbPress forum. … … 119 119 120 120 == Upgrade Notice == 121 = 1.07 = 122 None 123 124 = 1.06 = 125 None 126 121 127 = 1.05 = 122 128 None … … 138 144 139 145 == Changelog == 146 = 1.07 = 147 * Update avatar support for BuddyPress 1.5 beta 2 148 * Prevent empty folder creation for posts without attachments 149 140 150 = 1.06 = 141 151 * Add buddypress avatar support
Note: See TracChangeset
for help on using the changeset viewer.