Permalink
Browse files

Added kunena, webwiz, yaf support.

  • Loading branch information...
1 parent bda79db commit 7243b2cf4e0d013c75ee184178020be626c37db6 @tburry tburry committed Nov 13, 2012
Showing with 851 additions and 0 deletions.
  1. +163 −0 class.kunena.php
  2. +348 −0 class.webwiz.php
  3. +340 −0 class.yaf.php
View
@@ -0,0 +1,163 @@
+<?php
+/**
+ * Joomla Kunena exporter tool
+ *
+ * @copyright Vanilla Forums Inc. 2010
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU GPL2
+ * @package VanillaPorter
+ */
+
+$Supported['kunena'] = array('name'=> 'Joomla Kunena', 'prefix'=>'jos_');
+
+class Kunena extends ExportController {
+ /**
+ * @param ExportModel $Ex
+ */
+ public function ForumExport($Ex) {
+ $Ex->DestPrefix = 'jos';
+
+ $Ex->BeginExport('', 'Joomla Kunena', array('HashMethod' => 'joomla'));
+
+ // User.
+ $User_Map = array(
+ 'id'=>'UserID',
+ 'name'=>'Name',
+ 'email'=>'Email',
+ 'registerDate'=>'DateInserted',
+ 'lastvisitDate'=>'DateLastActive',
+ 'password' => 'Password',
+ 'showemail'=>'ShowEmail',
+ 'birthdate'=>'DateOfBirth',
+ 'banned'=>'Banned',
+// 'DELETED'=>'Deleted',
+ 'admin'=>array('Column'=>'Admin','Type'=>'tinyint(1)'),
+ 'Photo'=>'Photo'
+ );
+ $Ex->ExportTable('User', "
+ SELECT
+ u.*,
+ case when ku.avatar <> '' then concat('kunena/avatars/', ku.avatar) else null end as `Photo`,
+ case u.usertype when 'superadministrator' then 1 else 0 end as admin,
+ coalesce(ku.banned, 0) as banned,
+ ku.birthdate,
+ !ku.hideemail as showemail
+ FROM jos_users u
+ left join jos_kunena_users ku
+ on ku.userid = u.id", $User_Map);
+
+ // Role.
+ $Role_Map = array(
+ 'rank_id'=>'RoleID',
+ 'rank_title'=>'Name',
+ );
+ $Ex->ExportTable('Role', "select * from jos_kunena_ranks", $Role_Map);
+
+ // UserRole.
+ $UserRole_Map = array(
+ 'id' => 'UserID',
+ 'rank' => 'RoleID');
+ $Ex->ExportTable('UserRole', "
+ select *
+ from jos_users u", $UserRole_Map);
+
+ // Permission.
+// $Ex->ExportTable('Permission',
+// "select 2 as RoleID, 'View' as _Permissions
+// union
+// select 3 as RoleID, 'View' as _Permissions
+// union
+// select 16 as RoleID, 'All' as _Permissions", array('_Permissions' => array('Column' => '_Permissions', 'Type' => 'varchar(20)')));
+
+ // Category.
+ $Category_Map = array(
+ 'id' => 'CategoryID',
+ 'parent' => 'ParentCategoryID',
+ 'name' => 'Name',
+ 'ordering' => 'Sort',
+ 'description' => 'Description',
+
+ );
+ $Ex->ExportTable('Category', "
+ select * from jos_kunena_categories", $Category_Map);
+
+ // Discussion.
+ $Discussion_Map = array(
+ 'id' => 'DiscussionID',
+ 'catid' => 'CategoryID',
+ 'userid' => 'InsertUserID',
+ 'subject' => array('Column' => 'Name', 'Filter' => array($Ex, 'HTMLDecoder')),
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'ip' => 'InsertIPAddress',
+ 'locked' => 'Closed',
+ 'hits' => 'CountViews',
+ 'modified_by' => 'UpdateUserID',
+ 'modified_time' => array('Column' => 'DateUpdated', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'message' => 'Body',
+ 'Format' => 'Format'
+ );
+ $Ex->ExportTable('Discussion', "
+ select
+ t.*,
+ txt.message,
+ 'BBCode' as Format
+ from jos_kunena_messages t
+ left join jos_kunena_messages_text txt
+ on t.id = txt.mesid
+ where t.thread = t.id", $Discussion_Map);
+
+ // Comment.
+ $Comment_Map = array(
+ 'id' => 'CommentID',
+ 'thread' => 'DiscussionID',
+ 'userid' => 'InsertUserID',
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'ip' => 'InsertIPAddress',
+ 'modified_by' => 'UpdateUserID',
+ 'modified_time' => array('Column' => 'DateUpdated', 'Filter' => array($Ex, 'TimestampToDate')),
+ 'message' => 'Body',
+ 'Format' => 'Format'
+ );
+ $Ex->ExportTable('Comment', "
+ select
+ t.*,
+ txt.message,
+ 'BBCode' as Format
+ from jos_kunena_messages t
+ left join jos_kunena_messages_text txt
+ on t.id = txt.mesid
+ where t.thread <> t.id", $Comment_Map);
+
+ // UserDiscussion.
+ $UserDiscussion_Map = array(
+ 'thread' => 'DiscussionID',
+ 'userid' => 'UserID');
+ $Ex->ExportTable('UserDiscussion', "
+ select t.*, 1 as Bookmarked
+ from jos_kunena_subscriptions t", $UserDiscussion_Map);
+
+ // Media.
+ $Media_Map = array(
+ 'id' => 'MediaID',
+ 'mesid' => 'ForeignID',
+ 'userid' => 'InsertUserID',
+ 'size' => 'Size',
+ 'path2' => array('Column' => 'Path', 'Filter' => array($Ex, 'UrlDecode')),
+ 'filetype' => 'Type',
+ 'filename' => array('Column' => 'Name', 'Filter' => array($Ex, 'UrlDecode')),
+ 'time' => array('Column' => 'DateInserted', 'Filter' => array($Ex, 'TimestampToDate')),
+ );
+ $Ex->ExportTable('Media', "
+ select
+ a.*,
+ concat(a.folder, '/', a.filename) as path2,
+ 'local' as StorageMethod,
+ case when m.id = m.thread then 'discussion' else 'comment' end as ForeignTable,
+ m.time
+ from jos_kunena_attachments a
+ join jos_kunena_messages m
+ on m.id = a.mesid", $Media_Map);
+
+ $Ex->EndExport();
+ }
+}
+?>
Oops, something went wrong.

0 comments on commit 7243b2c

Please sign in to comment.