mirror of
https://github.com/e107inc/e107.git
synced 2025-08-13 01:54:12 +02:00
Work on import routines.
This commit is contained in:
88
e107_plugins/import/providers/PHPFusion_import_class.php
Normal file
88
e107_plugins/import/providers/PHPFusion_import_class.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/PHPFusion_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['PHPFusion_import'] = 'PHP Fusion';
|
||||
$import_class_comment['PHPFusion_import'] = 'Based on V5.1';
|
||||
$import_class_support['PHPFusion_import'] = array('users');
|
||||
$import_default_prefix['PHPFusion_import'] = '';
|
||||
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class PHPFusion_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
||||
$target['user_name'] = $source['user_name'];
|
||||
$target['user_loginname'] = $source['user_name'];
|
||||
$target['user_password'] = $source['user_password'];
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_hideemail'] = $source['user_hide_email'];
|
||||
$target['user_image'] = $source['user_avatar'];
|
||||
$target['user_signature'] = $source['user_sig'];
|
||||
$target['user_forums'] = $source['user_posts'];
|
||||
$target['user_join'] = $source['user_joined'];
|
||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
||||
$target['user_location'] = $source['user_location'];
|
||||
$target['user_birthday'] = $source['user_birthdate'];
|
||||
$target['user_aim'] = $source['user_aim'];
|
||||
$target['user_icq'] = $source['user_icq'];
|
||||
$target['user_msn'] = $source['user_msn'];
|
||||
$target['user_yahoo'] = $source['user_yahoo'];
|
||||
$target['user_homepage'] = $source['user_web'];
|
||||
$target['user_timezone'] = $source['user_offset']; // guess - may need conversion
|
||||
$target['user_ip'] = $source['user_ip'];
|
||||
// $target['user_'] = $source[''];
|
||||
// $target['user_'] = $source[''];
|
||||
|
||||
// $target['user_ban'] = ($source['user_status'] ? 2 : 0); // Guess
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
98
e107_plugins/import/providers/PHPNuke_import_class.php
Normal file
98
e107_plugins/import/providers/PHPNuke_import_class.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/PHPNuke_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['PHPNuke_import'] = 'PHP Nuke';
|
||||
$import_class_comment['PHPNuke_import'] = 'Supports users only - uses PHPBB2';
|
||||
$import_class_support['PHPNuke_import'] = array('users');
|
||||
$import_default_prefix['PHPNuke_import'] = 'nuke_';
|
||||
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class PHPNuke_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`=1");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
// Very similar to PHPBB fields (as far as the bits we can convert are concerned)
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
||||
$target['user_name'] = $source['username'];
|
||||
$target['user_loginname'] = $source['username'];
|
||||
$target['user_loginname'] = $source['name'];
|
||||
$target['user_password'] = $source['user_password'];
|
||||
$target['user_join'] = strtotime($source['user_regdate']);
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_hideemail'] = $source['user_viewemail'];
|
||||
$target['user_image'] = $source['user_avatar'];
|
||||
$target['user_signature'] = $source['user_sig'];
|
||||
$target['user_forums'] = $source['user_posts'];
|
||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
||||
|
||||
switch ($source['user_avatar_type'])
|
||||
{
|
||||
default:
|
||||
$target['user_image'] = $source['user_avatar'];
|
||||
}
|
||||
$target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2)
|
||||
$target['user_language'] = $source['user_lang']; // May need conversion
|
||||
$target['user_location'] = $source['user_from'];
|
||||
$target['user_icq'] = $source['user_icq'];
|
||||
$target['user_aim'] = $source['user_aim'];
|
||||
$target['user_yahoo'] = $source['user_yim'];
|
||||
$target['user_msn'] = $source['user_msnm'];
|
||||
$target['user_homepage'] = $source['user_website'];
|
||||
$target['user_ip'] = $source['last_ip'];
|
||||
// $target['user_'] = $source[''];
|
||||
|
||||
// $source['user_rank'];
|
||||
// $target['user_admin'] = ($source['user_level'] == 1) ? 1 : 0; // Guess
|
||||
// if ($target['user_admin'] != 0) $target['user_perms'] = '0.';
|
||||
// $target['user_ban'] = ($source['ublockon'] ? 2 : 0); // Guess
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
89
e107_plugins/import/providers/coppermine_import_class.php
Normal file
89
e107_plugins/import/providers/coppermine_import_class.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/coppermine_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
// Info derived from version 1.4.16
|
||||
$import_class_names['coppermine_import'] = 'Coppermine';
|
||||
$import_class_comment['coppermine_import'] = 'Standalone gallery version';
|
||||
$import_class_support['coppermine_import'] = array('users');
|
||||
$import_default_prefix['coppermine_import'] = 'CPG_';
|
||||
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class coppermine_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`='YES' ");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
||||
$target['user_name'] = $source['user_name'];
|
||||
$target['user_loginname'] = $source['user_name'];
|
||||
$target['user_login'] = $source['user_name'];
|
||||
$target['user_password'] = $source['user_password'];
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_join'] = strtotime($source['user_regdate']);
|
||||
$target['user_lastvisit'] = strtotime($source['user_lastvisit']);
|
||||
switch ($source['user_group'])
|
||||
{
|
||||
case 1 : // Admin
|
||||
$target['user_admin'] = 1;
|
||||
break;
|
||||
case 2 : // Ordinary member
|
||||
case 3 : // Anonymous
|
||||
break;
|
||||
case 4 : // Banned
|
||||
$target['user_ban'] = 2;
|
||||
break;
|
||||
}
|
||||
return $target;
|
||||
|
||||
/* Unused fields:
|
||||
user_group int(11) NOT NULL default '2', 2 = 'member'.
|
||||
user_group_list varchar(255) NOT NULL default '',
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
86
e107_plugins/import/providers/drupal_import_class.php
Normal file
86
e107_plugins/import/providers/drupal_import_class.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/drupal_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
// Module based on Drupal 5.7 and 6.1 schemas; may well work with other versions
|
||||
$import_class_names['drupal_import'] = 'Drupal 5.7/6.1';
|
||||
$import_class_comment['drupal_import'] = 'Basic import';
|
||||
$import_class_support['drupal_import'] = array('users');
|
||||
$import_default_prefix['drupal_import'] = '';
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class drupal_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
// If $blank_user is true, certain cross-referencing user info is to be zeroed
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `status`=1");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
case 'forumdefs' :
|
||||
return FALSE;
|
||||
case 'forumposts' :
|
||||
return FALSE;
|
||||
case 'polls' :
|
||||
return FALSE;
|
||||
case 'news' :
|
||||
return FALSE;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['uid'];
|
||||
$target['user_name'] = $source['name'];
|
||||
$target['user_loginname'] = $source['name'];
|
||||
$target['user_password'] = $source['pass'];
|
||||
$target['user_email'] = $source['mail'];
|
||||
$target['user_signature'] = $source['signature'];
|
||||
$target['user_join'] = $source['created'];
|
||||
$target['user_lastvisit'] = $source['login']; // Could use $source['access']
|
||||
$target['user_image'] = $source['picture'];
|
||||
// $source['init'] is email address used to sign up from
|
||||
$target['user_timezone'] = $source['timezone']; // May need conversion varchar(8)
|
||||
$target['user_language'] = $source['language']; // May need conversion varchar(12)
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
108
e107_plugins/import/providers/e107_import_class.php
Normal file
108
e107_plugins/import/providers/e107_import_class.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/e107_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// This must be an incredibly pointless file! But it does allow testing of the basic plugin structure.
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['e107_import'] = 'E107';
|
||||
$import_class_comment['e107_import'] = 'Reads 0.7 and 0.8 version files';
|
||||
$import_class_support['e107_import'] = array('users');
|
||||
$import_default_prefix['e107_import'] = 'e107_';
|
||||
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class e107_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$query = "SELECT * FROM {$this->DBPrefix}user WHERE `user_id` != 1";
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
||||
$target['user_name'] = $source['user_name'];
|
||||
$target['user_loginname'] = $source['user_loginname'];
|
||||
$target['user_password'] = $source['user_password'];
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_hideemail'] = $source['user_hideemail'];
|
||||
$target['user_join'] = $source['user_join'];
|
||||
$target['user_admin'] = $source['user_admin'];
|
||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
||||
$target['user_login'] = $source['user_login'];
|
||||
$target['user_ban'] = $source['user_ban'];
|
||||
$target['user_customtitle'] = $source['user_customtitle'];
|
||||
$target['user_sess'] = $source['user_sess']; // Photo
|
||||
$target['user_signature'] = $source['user_signature'];
|
||||
$target['user_image'] = $source['user_image']; // Avatar
|
||||
$target['user_currentvisit'] = $source['user_currentvisit'];
|
||||
$target['user_lastpost'] = $source['user_lastpost'];
|
||||
$target['user_chats'] = $source['user_chats'];
|
||||
$target['user_comments'] = $source['user_comments'];
|
||||
// $target['user_forums'] = $source['user_forums'];
|
||||
$target['user_ip'] = $source['user_ip'];
|
||||
$target['user_prefs'] = $source['user_prefs'];
|
||||
// $target['user_viewed'] = $source['user_viewed'];
|
||||
$target['user_visits'] = $source['user_visits'];
|
||||
$target['user_class'] = $source['user_class'];
|
||||
$target['user_perms'] = $source['user_perms'];
|
||||
$target['user_xup'] = $source['user_xup'];
|
||||
$target['user_language'] = $source['user_language'];
|
||||
$target['user_country'] = $source['user_country'];
|
||||
$target['user_location'] = $source['user_location'];
|
||||
$target['user_aim'] = $source['user_aim'];
|
||||
$target['user_icq'] = $source['user_icq'];
|
||||
$target['user_yahoo'] = $source['user_yahoo'];
|
||||
$target['user_msn'] = $source['user_msn'];
|
||||
$target['user_homepage'] = $source['user_homepage'];
|
||||
$target['user_birthday'] = $source['user_birthday'];
|
||||
$target['user_timezone'] = $source['user_timezone'];
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
102
e107_plugins/import/providers/ikonboard_import_class.php
Normal file
102
e107_plugins/import/providers/ikonboard_import_class.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/ikonboard_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
// Module based on ikonboard version current about September 2007 - may well support other versions
|
||||
$import_class_names['ikonboard_import'] = 'Ikonboard';
|
||||
$import_class_comment['ikonboard_import'] = 'About Sept 2007';
|
||||
$import_class_support['ikonboard_import'] = array('users');
|
||||
$import_default_prefix['ikonboard_import'] = 'ib_';
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class ikonboard_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
// If $blank_user is true, certain cross-referencing user info is to be zeroed
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}member_profiles");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
case 'forumdefs' :
|
||||
return FALSE;
|
||||
case 'forumposts' :
|
||||
return FALSE;
|
||||
case 'polls' :
|
||||
return FALSE;
|
||||
case 'news' :
|
||||
return FALSE;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['MEMBER_ID'];
|
||||
$target['user_name'] = $source['MEMBER_NAME'];
|
||||
$target['user_loginname'] = $source['MEMBER_NAME'];
|
||||
$target['user_password'] = $source['MEMBER_PASSWORD'];
|
||||
$target['user_email'] = $source['MEMBER_EMAIL'];
|
||||
$target['user_signature'] = $source['SIGNATURE'];
|
||||
$target['user_join'] = $source['MEMBER_JOINED'];
|
||||
$target['user_lastvisit'] = $source['LAST_LOG_IN'];
|
||||
$target['user_image'] = $source['MEMBER_AVATAR'];
|
||||
$target['user_forums'] = $source['MEMBER_POSTS'];
|
||||
$target['user_sess'] = $source['PHOTO'];
|
||||
$target['user_hideemail'] = $source['HIDE_EMAIL'];
|
||||
$target['user_login'] = $source['MEMBER_NAME_R']; // Guessing on this one
|
||||
$target['user_ip'] = $source['MEMBER_IP'];
|
||||
$target['user_aim'] = $source['AOLNAME'];
|
||||
$target['user_icq'] = $source['ICQNUMBER'];
|
||||
$target['user_location'] = $source['LOCATION'];
|
||||
$target['user_homepage'] = $source['WEBSITE'];
|
||||
$target['user_yahoo'] = $source['YAHOONAME'];
|
||||
$target['user_customtitle'] = $source['MEMBER_TITLE'];
|
||||
$target['user_timezone'] = $source['TIME_ADJUST']; // May need conversion
|
||||
$target['user_language'] = $source['LANGUAGE']; // May need conversion
|
||||
$target['user_msn'] = $source['MSNNAME'];
|
||||
$target['user_lastpost'] = $source['LAST_POST']; // May need conversion
|
||||
// $target['user_'] = $source[''];
|
||||
// $target['user_'] = $source[''];
|
||||
// $target['user_'] = $source[''];
|
||||
// $source['MEMBER_LEVEL'] may be an admin indicator
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
83
e107_plugins/import/providers/joomla_import_class.php
Normal file
83
e107_plugins/import/providers/joomla_import_class.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/mambo_import_class.php,v $
|
||||
* $Revision: 11315 $
|
||||
* $Date: 2010-02-10 10:18:01 -0800 (Wed, 10 Feb 2010) $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['joomla_import'] = 'Joomla';
|
||||
$import_class_comment['joomla_import'] = 'Untested - need feedback from users ';
|
||||
$import_class_support['joomla_import'] = array('users');
|
||||
$import_default_prefix['joomla_import'] = 'jos_';
|
||||
|
||||
// Mambo and joomla have the same DB format apart from the default prefix - 'jos_' for Joomla
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class joomla_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['id'];
|
||||
$target['user_name'] = $source['name'];
|
||||
$target['user_loginname'] = $source['username'];
|
||||
$target['user_password'] = $source['password'];
|
||||
$target['user_email'] = $source['email'];
|
||||
// $target['user_hideemail'] = $source['user_viewemail'];
|
||||
$target['user_join'] = $source['registerDate'];
|
||||
$target['user_admin'] = ($source['usertype'] == 'superadministrator') ? 1 : 0;
|
||||
|
||||
if ($target['user_admin'] != 0)
|
||||
{
|
||||
$target['user_perms'] = '0.';
|
||||
}
|
||||
|
||||
$target['user_lastvisit'] = $source['lastvisitDate'];
|
||||
$target['user_login'] = $source['name'];
|
||||
$target['user_ban'] = ($source['block'] ? 2 : 0);
|
||||
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
77
e107_plugins/import/providers/mambo_import_class.php
Normal file
77
e107_plugins/import/providers/mambo_import_class.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/mambo_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['mambo_import'] = 'Mambo';
|
||||
$import_class_comment['mambo_import'] = 'Should also work for Joomla';
|
||||
$import_class_support['mambo_import'] = array('users');
|
||||
$import_default_prefix['mambo_import'] = 'mos_';
|
||||
|
||||
// Mambo and joomla have the same DB format apart from the default prefix - 'jos_' for Joomla
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class mambo_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['id'];
|
||||
$target['user_name'] = $source['name'];
|
||||
$target['user_loginname'] = $source['username'];
|
||||
$target['user_password'] = $source['password'];
|
||||
$target['user_email'] = $source['email'];
|
||||
// $target['user_hideemail'] = $source['user_viewemail'];
|
||||
$target['user_join'] = $source['registerDate'];
|
||||
$target['user_admin'] = ($source['usertype'] == 'superadministrator') ? 1 : 0;
|
||||
if ($target['user_admin'] != 0) $target['user_perms'] = '0.';
|
||||
$target['user_lastvisit'] = $source['lastvisitDate'];
|
||||
$target['user_login'] = $source['name'];
|
||||
$target['user_ban'] = ($source['block'] ? 2 : 0);
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
413
e107_plugins/import/providers/phpbb2_import_class.php
Normal file
413
e107_plugins/import/providers/phpbb2_import_class.php
Normal file
@@ -0,0 +1,413 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/phpbb2_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
/*
|
||||
To do:
|
||||
1. Forum config import (once McFly's finished updated forums)
|
||||
2. Forum topic import
|
||||
Check that thread_parent set correctly
|
||||
3. Polls import
|
||||
4. News import
|
||||
*/
|
||||
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['phpbb2_import'] = 'PHPBB Version 2/3';
|
||||
$import_class_comment['phpbb2_import'] = 'Should do most versions, and Dragonfly';
|
||||
//$import_class_support['phpbb2_import'] = array('users','forumdefs', 'forumposts');
|
||||
$import_class_support['phpbb2_import'] = array('users');
|
||||
$import_default_prefix['phpbb2_import'] = 'phpbb_';
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class phpbb2_import extends base_import_class
|
||||
{
|
||||
|
||||
var $catcount = 0; // Counts forum IDs
|
||||
var $id_map = array(); // Map of PHPBB forum IDs ==> E107 forum IDs
|
||||
|
||||
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
// If $blank_user is true, certain cross-referencing user info is to be zeroed
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active` = 1");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
case 'forumdefs' :
|
||||
return FALSE;
|
||||
case 'forumposts' :
|
||||
return FALSE;
|
||||
case 'polls' :
|
||||
return FALSE;
|
||||
case 'news' :
|
||||
return FALSE;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
||||
$target['user_name'] = $source['username'];
|
||||
$target['user_loginname'] = $source['username'];
|
||||
if ((substr($source['user_password']) == '$H$') && (strlen($source['user_password']) == 34))
|
||||
{ // Convert salted password to E107 style (they use the same basic coding)
|
||||
$target['user_password'] = substr_replace($source['user_password'], '$E$',0,3);
|
||||
}
|
||||
else
|
||||
{ // Probably an old md5 password
|
||||
$target['user_password'] = $source['user_password'];
|
||||
}
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_signature'] = $this->proc_bb($source['user_sig'],'phpbb,bblower');
|
||||
$target['user_hideemail'] = $source['user_viewemail'];
|
||||
$target['user_join'] = $source['user_regdate'];
|
||||
$target['user_forums'] = $source['user_posts'];
|
||||
$target['user_admin'] = $source['user_level'];
|
||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
||||
switch ($source['user_avatar_type'])
|
||||
{
|
||||
default:
|
||||
$target['user_image'] = $source['user_avatar'];
|
||||
}
|
||||
$target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2)
|
||||
$target['user_language'] = $source['user_lang']; // May need conversion
|
||||
$target['user_location'] = $source['user_from'];
|
||||
$target['user_icq'] = $source['user_icq'];
|
||||
$target['user_aim'] = $source['user_aim'];
|
||||
$target['user_yahoo'] = $source['user_yim'];
|
||||
$target['user_msn'] = $source['user_msnm'];
|
||||
$target['user_homepage'] = $source['user_website'];
|
||||
// $target['user_'] = $source[''];
|
||||
// $target[] = $source['user_active]; // PHPBB2
|
||||
// $target['user_lastpost'] = $source['user_lastpost_time']; // PHPBB3
|
||||
return $target;
|
||||
}
|
||||
|
||||
|
||||
function convertForumParent(&$target, &$source)
|
||||
{
|
||||
$this->catcount++;
|
||||
$this->id_map[$source['cat_id']] = $this->catcount;
|
||||
$target['forum_id'] = $this->catcount; // Create new IDs for parent forums
|
||||
$target['forum_name'] = $source['cat_title'];
|
||||
$target['forum_order'] = $source['cat_order'];
|
||||
$target['forum_description'] = $source['cat_desc'];
|
||||
$target['forum_moderators'] = e_UC_ADMIN;
|
||||
// $target['forum_'] = $source[''];
|
||||
// $target['forum_'] = $source[''];
|
||||
}
|
||||
|
||||
|
||||
function convertForum(&$target, &$source, $catid)
|
||||
{
|
||||
$this->catcount++;
|
||||
$this->id_map[$source['forum_id']] = $this->catcount;
|
||||
$target['forum_id'] = $this->catcount;
|
||||
$target['forum_parent'] = $this->id_map[$source['cat_id']]; // Map to the new E107 ID, rather than directly use the one from the DB
|
||||
$target['forum_name'] = $source['forum_name'];
|
||||
$target['forum_description'] = $source['forum_desc'];
|
||||
$target['forum_order'] = $source['forum_order'];
|
||||
$target['forum_threads'] = $source['forum_topics'];
|
||||
$target['forum_replies'] = $source['forum_posts'];
|
||||
$target['forum_moderators'] = e_UC_ADMIN;
|
||||
// $target['forum_'] = $source[''];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Historical info for conversion below here
|
||||
|
||||
function convertParents($catid)
|
||||
{
|
||||
$parentArray = array(
|
||||
array("srcdata" => "cat_id", "e107" => "forum_id", "type" => "INT", "value" => $catid),
|
||||
array("srcdata" => "cat_title", "e107" => "forum_name", "type" => "STRING"),
|
||||
array("srcdata" => "cat_order", "e107" => "forum_order", "type" => "INT"),
|
||||
array("srcdata" => "cat_desc", "e107" => "forum_description", "type" => "STRING"),
|
||||
array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254)
|
||||
);
|
||||
return $parentArray;
|
||||
}
|
||||
|
||||
function convertForums($catid)
|
||||
{
|
||||
$forumArray = array(
|
||||
array("srcdata" => "forum_id", "e107" => "forum_id", "type" => "INT"),
|
||||
array("srcdata" => "cat_id", "e107" => "forum_parent", "type" => "STRING", "value" => $catid),
|
||||
array("srcdata" => "forum_name", "e107" => "forum_name", "type" => "STRING"),
|
||||
array("srcdata" => "forum_desc", "e107" => "forum_description", "type" => "STRING"),
|
||||
array("srcdata" => "forum_order", "e107" => "forum_order", "type" => "INT"),
|
||||
array("srcdata" => "forum_topics", "e107" => "forum_threads", "type" => "INT"),
|
||||
array("srcdata" => "forum_posts", "e107" => "forum_replies", "type" => "INT"),
|
||||
array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254)
|
||||
);
|
||||
return $forumArray;
|
||||
}
|
||||
|
||||
|
||||
//function convertTopics($poster)
|
||||
function convertTopics()
|
||||
{
|
||||
$topicArray = array(
|
||||
array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
|
||||
array("srcdata" => "topic_title", "e107" => "thread_name", "type" => "STRING"),
|
||||
array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"),
|
||||
array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "STRING"),
|
||||
array("srcdata" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1),
|
||||
array("srcdata" => "topic_time", "e107" => "thread_datestamp", "type" => "INT"),
|
||||
array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"),
|
||||
array("srcdata" => "topic_replies", "e107" => "thread_total_replies", "type" => "INT"),
|
||||
array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => 0),
|
||||
);
|
||||
return $topicArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function convertForumPosts($parent_id, $poster)
|
||||
{
|
||||
$postArray = array(
|
||||
array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"),
|
||||
array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"),
|
||||
array("srcdata" => "post_time", "e107" => "thread_datestamp", "type" => "INT"),
|
||||
array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"),
|
||||
array("srcdata" => "post_time", "e107" => "thread_lastpost", "type" => "INT"),
|
||||
array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "STRING"),
|
||||
array("srcdata" => "post_subject", "e107" => "thread_name", "type" => "STRING"),
|
||||
array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => $parent_id),
|
||||
);
|
||||
return $postArray;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
-- --------------------------------------------------------
|
||||
PHPBB uses three tables to record a poll. Looks wildly different to E107!
|
||||
--
|
||||
-- Table structure for table `_phpbb_vote_desc`
|
||||
CREATE TABLE `_phpbb_vote_desc` (
|
||||
`vote_id` mediumint(8) unsigned NOT NULL auto_increment,
|
||||
`topic_id` mediumint(8) unsigned NOT NULL default '0',
|
||||
`vote_text` text NOT NULL,
|
||||
`vote_start` int(11) NOT NULL default '0',
|
||||
`vote_length` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`vote_id`),
|
||||
KEY `topic_id` (`topic_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `_phpbb_vote_results`
|
||||
CREATE TABLE `_phpbb_vote_results` (
|
||||
`vote_id` mediumint(8) unsigned NOT NULL default '0',
|
||||
`vote_option_id` tinyint(4) unsigned NOT NULL default '0',
|
||||
`vote_option_text` varchar(255) NOT NULL default '',
|
||||
`vote_result` int(11) NOT NULL default '0',
|
||||
KEY `vote_option_id` (`vote_option_id`),
|
||||
KEY `vote_id` (`vote_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
--
|
||||
-- Table structure for table `_phpbb_vote_voters`
|
||||
CREATE TABLE `_phpbb_vote_voters` (
|
||||
`vote_id` mediumint(8) unsigned NOT NULL default '0',
|
||||
`vote_user_id` mediumint(8) NOT NULL default '0',
|
||||
`vote_user_ip` char(8) NOT NULL default '',
|
||||
KEY `vote_id` (`vote_id`),
|
||||
KEY `vote_user_id` (`vote_user_id`),
|
||||
KEY `vote_user_ip` (`vote_user_ip`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// ### get phpbb categories and insert them as forum parents
|
||||
//-----------------------------------------------------------
|
||||
|
||||
mysql_query("TRUNCATE TABLE {$mySQLprefix}forum", $e107Connection);
|
||||
|
||||
|
||||
$phpbb_res = mysql_query("SELECT * FROM {$phpbb2Prefix}categories", $phpbbConnection);
|
||||
if(!$phpbb_res)
|
||||
{
|
||||
goError("Error! Unable to access ".$phpbb2Prefix."categories table.");
|
||||
}
|
||||
|
||||
$catcount = 500;
|
||||
while($parent = mysql_fetch_array($phpbb_res))
|
||||
{
|
||||
|
||||
$parentArray = convertParents($catcount);
|
||||
|
||||
$query = createQuery($parentArray, $parent, $mySQLprefix."forum");
|
||||
echo (mysql_query($query, $e107Connection) ? "Successfully inserted parent: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert parent: ".$parent['cat_id'].": ".$parent['cat_title']."<br />".mysql_errno() . ": " . mysql_error())."<br />";
|
||||
flush();
|
||||
|
||||
$phpbb_res2 = mysql_query("SELECT * FROM {$phpbb2Prefix}forums WHERE cat_id = ".$parent['cat_id'], $phpbbConnection);
|
||||
if($phpbb_res2)
|
||||
{
|
||||
while($forum = mysql_fetch_array($phpbb_res2))
|
||||
{
|
||||
$forumArray = convertForums($catcount);
|
||||
$query = createQuery($forumArray, $forum, $mySQLprefix."forum");
|
||||
echo (mysql_query($query, $e107Connection) ? "Successfully inserted forum: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert forum: ".$parent['cat_id'].": ".$parent['cat_title']."<br />".mysql_errno() . ": " . mysql_error())."<br />";
|
||||
flush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Didn't find any forums for parent '".$parent['cat_title']."'<br />";
|
||||
}
|
||||
$catcount ++;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------
|
||||
// Read in forum topics
|
||||
//------------------------------------------------------
|
||||
|
||||
mysql_query("TRUNCATE TABLE {$mySQLprefix}forum_t", $e107Connection);
|
||||
mysql_query("TRUNCATE TABLE {$mySQLprefix}polls", $e107Connection);
|
||||
|
||||
$query = "SELECT * FROM {$phpbb2Prefix}topics
|
||||
LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}topics.topic_title = {$phpbb2Prefix}posts_text.post_subject)
|
||||
LEFT JOIN {$phpbb2Prefix}posts ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id)
|
||||
ORDER BY topic_time ASC";
|
||||
|
||||
$phpbb_res = mysql_query($query, $phpbbConnection);
|
||||
if(!$phpbb_res)
|
||||
{
|
||||
goError("Error! Unable to access ".$phpbb2Prefix."topics table.");
|
||||
}
|
||||
while($topic = mysql_fetch_array($phpbb_res))
|
||||
{
|
||||
|
||||
//echo "<pre>"; print_r($topic); echo "</pre>";
|
||||
|
||||
if($topic['topic_vote'])
|
||||
{
|
||||
// poll attached to this topic ...
|
||||
$topic['topic_title'] = "[poll] ".$topic['topic_title'];
|
||||
$query = "SELECT * FROM {$phpbb2Prefix}vote_desc WHERE topic_id=".$topic['topic_id'];
|
||||
$phpbb_res3 = mysql_query($query, $phpbbConnection);
|
||||
$pollQ = mysql_fetch_array($phpbb_res3);
|
||||
|
||||
$query = "SELECT * FROM {$phpbb2Prefix}vote_results WHERE vote_id=".$pollQ['vote_id'];
|
||||
$phpbb_res3 = mysql_query($query, $phpbbConnection);
|
||||
$options = "";
|
||||
$votes = "";
|
||||
while($pollO = mysql_fetch_array($phpbb_res3))
|
||||
{
|
||||
$options .= $pollO['vote_option_text'].chr(1);
|
||||
$votes .= $pollO['vote_result'].chr(1);
|
||||
}
|
||||
|
||||
extract($pollQ);
|
||||
$vote_text = $tp->toDB($vote_text); // McFly added 25/5/06
|
||||
$options = $tp->toDB($options); // McFly added 25/5/06
|
||||
$query = "INSERT INTO ".$mySQLprefix."polls VALUES ('0', {$vote_start}, {$vote_start}, 0, 0, '{$vote_text}', '{$options}', '{$votes}', '', 2, 0, 0, 0, 255, 0)";
|
||||
echo (mysql_query($query, $e107Connection) ? "Poll successfully inserted" : "Unable to insert poll ({$query})")."<br />";
|
||||
}
|
||||
|
||||
|
||||
if($topic['topic_poster'] == 2)
|
||||
{
|
||||
$topic['topic_poster'] = 1;
|
||||
}
|
||||
|
||||
if($topic['topic_poster'] == -1)
|
||||
{
|
||||
$poster = ($topic['post_username'] ? $topic['post_username'] : "Anonymous");
|
||||
$topic['topic_poster'] = "0.".$poster; // McFly moved, edited 25/5/06
|
||||
}
|
||||
|
||||
$topicArray = convertTopics(); // McFly edited 25/5/06
|
||||
$query = createQuery($topicArray, $topic, $mySQLprefix."forum_t");
|
||||
|
||||
if(!mysql_query($query, $e107Connection))
|
||||
{
|
||||
echo "Unable to insert topic: ".$topic['topic_id']."<br />";
|
||||
flush();
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Successfully inserted topic: ".$topic['topic_id']."<br />";
|
||||
flush();
|
||||
$parent_id = mysql_insert_id();
|
||||
$topic_id = $topic['topic_id'];
|
||||
|
||||
//echo "PARENT: $parent_id, TOPIC: $topic_id<br />";
|
||||
|
||||
// Not checking post_subject might work better
|
||||
$query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' ORDER BY post_time DESC";
|
||||
// $query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' AND post_subject = '' ORDER BY post_time DESC";
|
||||
$phpbb_res2 = mysql_query($query, $phpbbConnection);
|
||||
if(!$phpbb_res2)
|
||||
{
|
||||
goError("Error! Unable to access ".$phpbb2Prefix."posts / ".$phpbb2Prefix."posts_text table.");
|
||||
}
|
||||
while($post = mysql_fetch_array($phpbb_res2))
|
||||
{
|
||||
|
||||
if($post['poster_id'] == 2)
|
||||
{
|
||||
$post['poster_id'] = 1;
|
||||
}
|
||||
if($post['poster_id'] == -1)
|
||||
{
|
||||
$poster = ($post['post_username'] ? $post['post_username'] : "Anonymous");
|
||||
$post['poster_id'] = "0.".$poster; // McFly moved, edited 25/5/06
|
||||
}
|
||||
|
||||
|
||||
$postArray = convertForumPosts($parent_id, $poster);
|
||||
$query = createQuery($postArray, $post, $mySQLprefix."forum_t",$mapdata);
|
||||
echo (mysql_query($query, $e107Connection) ? "Successfully inserted thread: ".$post['post_id'] : "Unable to insert thread: ".$parent['cat_id'].": ".$parent['cat_title']."<br />".mysql_errno() . ": " . mysql_error())."<br />";
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
?>
|
294
e107_plugins/import/providers/rss_import_class.php
Normal file
294
e107_plugins/import/providers/rss_import_class.php
Normal file
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/wordpress_import_class.php,v $
|
||||
* $Revision: 11315 $
|
||||
* $Date: 2010-02-10 10:18:01 -0800 (Wed, 10 Feb 2010) $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
// This must be an incredibly pointless file! But it does allow testing of the basic plugin structure.
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
|
||||
$import_class_names['rss_import'] = 'RSS';
|
||||
$import_class_comment['rss_import'] = '(work in progress)';
|
||||
$import_class_support['rss_import'] = array('news','page','links');
|
||||
$import_default_prefix['rss_import'] = '';
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class rss_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
|
||||
$xml = e107::getXml();
|
||||
require_once(e_HANDLER."magpie_rss.php");
|
||||
|
||||
// $file = "http://www.e107.org/releases.php"; //pluginfeed.php or similar.
|
||||
// $file = "http://localhost:8080/e107_0.8/e107_plugins/release/release.php"; // temporary testing
|
||||
$file = "http://raelianews.org/rss";
|
||||
|
||||
$xml->setOptArrayTags('plugin'); // make sure 'plugin' tag always returns an array
|
||||
|
||||
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
//$query = "SELECT * FROM {$this->DBPrefix}users WHERE `user_id` != 1";
|
||||
|
||||
break;
|
||||
|
||||
case 'news' :
|
||||
// $result = $xml->loadXMLfile($file,true);
|
||||
// $rawData = $xml->getRemoteFile($file);
|
||||
// $rss = new MagpieRSS( $rawData );
|
||||
// $array = $xml->xml2array($rss);
|
||||
|
||||
$xml->setOptArrayTags('item'); // make sure 'plugin' tag always returns an array
|
||||
$array = $xml->loadXMLfile($file,'advanced');
|
||||
$this->arrayData = $array['channel']['item'];
|
||||
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
case 'page' :
|
||||
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
case 'media' :
|
||||
|
||||
break;
|
||||
|
||||
case 'links':
|
||||
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
/**
|
||||
* Align source data to e107 User Table
|
||||
* @param $target array - default e107 target values for e107_user table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Align source data to e107 News Table
|
||||
* @param $target array - default e107 target values for e107_news table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyNewsData(&$target, &$source)
|
||||
{
|
||||
/* Example:
|
||||
[ID] => 88
|
||||
[post_author] => 1
|
||||
[post_date] => 2012-01-25 04:11:22
|
||||
[post_date_gmt] => 2012-01-25 09:11:22
|
||||
[post_content] => [gallery itemtag="div" icontag="span" captiontag="p" link="file"]
|
||||
[post_title] => Media Gallery
|
||||
[post_excerpt] =>
|
||||
[post_status] => inherit
|
||||
[comment_status] => open
|
||||
[ping_status] => open
|
||||
[post_password] =>
|
||||
[post_name] => 10-revision-6
|
||||
[to_ping] =>
|
||||
[pinged] =>
|
||||
[post_modified] => 2012-01-25 04:11:22
|
||||
[post_modified_gmt] => 2012-01-25 09:11:22
|
||||
[post_content_filtered] =>
|
||||
[post_parent] => 10
|
||||
[guid] => http://siteurl.com/2012/01/25/10-revision-6/
|
||||
[menu_order] => 0
|
||||
[post_type] => post
|
||||
[post_mime_type] =>
|
||||
[comment_count] => 0
|
||||
*/
|
||||
|
||||
// $target['news_id'] = $source['ID'];
|
||||
$target['news_title'] = $source['post_title'];
|
||||
$target['news_sef'] = $source['post_name'];
|
||||
$target['news_body'] = $source['post_content'];
|
||||
// $target['news_extended'] = '';
|
||||
// $target['news_meta_keywords'] = '';
|
||||
// $target['news_meta_description'] = '';
|
||||
$target['news_datestamp'] = strtotime($source['post_date']);
|
||||
$target['news_author'] = $source['post_author'];
|
||||
// $target['news_category'] = '';
|
||||
$target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0;
|
||||
$target['news_start'] = '';
|
||||
$target['news_end'] = '';
|
||||
$target['news_class'] = '';
|
||||
$target['news_render_type'] = '';
|
||||
$target['news_comment_total'] = $source['comment_count'];
|
||||
$target['news_summary'] = $source['post_excerpt'];
|
||||
$target['news_thumbnail'] = '';
|
||||
$target['news_sticky'] = '';
|
||||
|
||||
// return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Align source data to e107 Page Table
|
||||
* @param $target array - default e107 target values for e107_page table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyPageData(&$target, &$source)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
/* post_status:
|
||||
publish - A published post or page
|
||||
inherit - a revision
|
||||
pending - post is pending review
|
||||
private - a private post
|
||||
future - a post to publish in the future
|
||||
draft - a post in draft status
|
||||
trash - post is in trashbin (available with 2.9)
|
||||
*/
|
||||
|
||||
if($source['post_status']=='private' || $source['post_status']=='future' || $source['post_status'] == 'draft')
|
||||
{
|
||||
$target['page_class'] = e_UC_ADMIN;
|
||||
}
|
||||
|
||||
// $target['page_id'] = $source['ID']; // auto increment
|
||||
$target['page_title'] = $source['post_title'];
|
||||
$target['page_sef'] = $source['post_name'];
|
||||
$target['page_text'] = "[html]".$source['post_content']."[/html]";
|
||||
$target['page_metakeys'] = '';
|
||||
$target['page_metadscr'] = '';
|
||||
$target['page_datestamp'] = strtotime($source['post_date']);
|
||||
$target['page_author'] = $source['post_author'];
|
||||
// $target['page_category'] = '',
|
||||
$target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0;
|
||||
$target['page_password'] = $source['post_password'];
|
||||
|
||||
return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Align source data to e107 Links Table
|
||||
* @param $target array - default e107 target values for e107_links table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyLinksData(&$target, &$source)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
/* WP
|
||||
link_id
|
||||
link_url
|
||||
link_name
|
||||
link_image
|
||||
link_target
|
||||
link_description
|
||||
link_visible
|
||||
link_owner
|
||||
link_rating
|
||||
link_updated
|
||||
link_rel
|
||||
link_notes
|
||||
link_rss
|
||||
*
|
||||
* e107
|
||||
* link_id
|
||||
link_name
|
||||
link_url
|
||||
link_description
|
||||
link_button
|
||||
link_category
|
||||
link_order
|
||||
link_parent
|
||||
link_open
|
||||
link_class
|
||||
link_function
|
||||
link_sefurl
|
||||
*/
|
||||
|
||||
|
||||
// $target['page_id'] = $source['ID']; // auto increment
|
||||
$target['link_name'] = $source['post_title'];
|
||||
$target['link_url'] = $source['post_name'];
|
||||
$target['link_description'] = "[html]".$source['post_content']."[/html]";
|
||||
$target['link_button'] = '';
|
||||
$target['link_category'] = '';
|
||||
$target['link_order'] = strtotime($source['post_date']);
|
||||
$target['link_parent'] = $source['post_author'];
|
||||
$target['link_open'] = '';
|
||||
$target['link_class'] = '';
|
||||
$target['link_sefurl'] = $source['post_password'];
|
||||
|
||||
// return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function renderDebug($source,$target)
|
||||
{
|
||||
echo "
|
||||
<div style='width:1000px'>
|
||||
<table style='width:100%'>
|
||||
<tr>
|
||||
<td style='width:500px;padding:10px'>".print_a($source,TRUE)."</td>
|
||||
<td style='border-left:1px solid black;padding:10px'>".print_a($target,TRUE)."</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
90
e107_plugins/import/providers/smf_import_class.php
Normal file
90
e107_plugins/import/providers/smf_import_class.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/smf_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
$import_class_names['smf_import'] = 'SMF (Simple Machines Forum)';
|
||||
$import_class_comment['smf_import'] = 'Supports users only';
|
||||
$import_class_support['smf_import'] = array('users');
|
||||
$import_default_prefix['smf_import'] = '';
|
||||
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class smf_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}members WHERE `is_activated`=1");
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
// Copy data read from the DB into the record to be returned.
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
if ($this->copyUserInfo) $target['user_id'] = $source['ID_MEMBER'];
|
||||
$target['user_name'] = $source['realName'];
|
||||
$target['user_login'] = $source['realName'];
|
||||
$target['user_loginname'] = $source['memberName'];
|
||||
$target['user_password'] = $source['passwd']; // Check - could be plaintext
|
||||
$target['user_email'] = $source['emailAddress'];
|
||||
$target['user_hideemail'] = $source['hideEmail'];
|
||||
$target['user_image'] = $source['avatar'];
|
||||
$target['user_signature'] = $source['signature'];
|
||||
$target['user_forums'] = $source['posts'];
|
||||
$target['user_chats'] = $source['instantMessages'];
|
||||
$target['user_join'] = $source['dateRegistered'];
|
||||
$target['user_lastvisit'] = $source['lastLogin'];
|
||||
$target['user_homepage'] = $source['websiteUrl'];
|
||||
$target['user_location'] = $source['location'];
|
||||
$target['user_icq'] = $source['ICQ'];
|
||||
$target['user_aim'] = $source['AIM'];
|
||||
$target['user_yahoo'] = $source['YIM'];
|
||||
$target['user_msn'] = $source['MSN'];
|
||||
$target['user_timezone'] = $source['timeOffset']; // Probably needs formatting
|
||||
$target['user_customtitle'] = $source['usertitle'];
|
||||
$target['user_ip'] = $source['memberIP'];
|
||||
// $target['user_'] = $source[''];
|
||||
// $target['user_'] = $source[''];
|
||||
|
||||
// $target['user_language'] = $source['lngfile']; // Guess to verify
|
||||
return $target;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
354
e107_plugins/import/providers/wordpress_import_class.php
Normal file
354
e107_plugins/import/providers/wordpress_import_class.php
Normal file
@@ -0,0 +1,354 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/wordpress_import_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
// This must be an incredibly pointless file! But it does allow testing of the basic plugin structure.
|
||||
|
||||
// Each import file has an identifier which must be the same for:
|
||||
// a) This file name - add '_class.php' to get the file name
|
||||
// b) The array index of certain variables
|
||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
||||
|
||||
$import_class_names['wordpress_import'] = 'Wordpress';
|
||||
$import_class_comment['wordpress_import'] = 'Tested with version 2.8.x (salted passwords)';
|
||||
$import_class_support['wordpress_import'] = array('users','news','page','links');
|
||||
$import_default_prefix['wordpress_import'] = 'wp_';
|
||||
|
||||
require_once('import_classes.php');
|
||||
|
||||
class wordpress_import extends base_import_class
|
||||
{
|
||||
// Set up a query for the specified task.
|
||||
// Returns TRUE on success. FALSE on error
|
||||
function setupQuery($task, $blank_user=FALSE)
|
||||
{
|
||||
if ($this->ourDB == NULL) return FALSE;
|
||||
|
||||
switch ($task)
|
||||
{
|
||||
case 'users' :
|
||||
//$query = "SELECT * FROM {$this->DBPrefix}users WHERE `user_id` != 1";
|
||||
|
||||
$query = "SELECT u.*,
|
||||
w.meta_value AS admin,
|
||||
f.meta_value as firstname,
|
||||
l.meta_value as lastname
|
||||
FROM {$this->DBPrefix}users AS u
|
||||
LEFT JOIN {$this->DBPrefix}usermeta AS w ON (u.ID = w.user_id AND w.meta_key = 'wp_capabilities')
|
||||
LEFT JOIN {$this->DBPrefix}usermeta AS f ON (u.ID = f.user_id AND f.meta_key = 'first_name')
|
||||
LEFT JOIN {$this->DBPrefix}usermeta AS l ON (u.ID = l.user_id AND l.meta_key = 'last_name')
|
||||
GROUP BY u.ID";
|
||||
|
||||
// $this->ourDB -> db_Select_gen($query);
|
||||
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
|
||||
if ($result === FALSE) return FALSE;
|
||||
|
||||
break;
|
||||
|
||||
case 'userclass' :
|
||||
/* For reference: (stored in usermeta -> wp_capabilities
|
||||
* Administrator - Somebody who has access to all the administration features
|
||||
* Editor - Somebody who can publish posts, manage posts as well as manage other people's posts, etc.
|
||||
* Author - Somebody who can publish and manage their own posts
|
||||
* Contributor - Somebody who can write and manage their posts but not publish posts
|
||||
* Subscriber - Somebody who can read comments/comment/receive news letters, etc.
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
case 'news' :
|
||||
$query = "SELECT * FROM {$this->DBPrefix}posts WHERE post_type = 'post' AND post_status !='trash' ORDER BY ID";
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
case 'page' :
|
||||
$query = "SELECT * FROM {$this->DBPrefix}posts WHERE post_type = 'page' AND post_status !='trash' ORDER BY ID";
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
case 'media' :
|
||||
$query = "SELECT * FROM {$this->DBPrefix}posts WHERE post_type = 'attachment' AND post_status !='trash' ORDER BY ID";
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
case 'links':
|
||||
$query = "SELECT * FROM {$this->DBPrefix}links WHERE link_id !='' ORDER BY link_id";
|
||||
$result = $this->ourDB->db_Select_gen($query);
|
||||
if ($result === FALSE) return FALSE;
|
||||
break;
|
||||
|
||||
default :
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->copyUserInfo = !$blank_user;
|
||||
$this->currentTask = $task;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------
|
||||
// Internal functions below here
|
||||
//------------------------------------
|
||||
|
||||
/**
|
||||
* Align source data to e107 User Table
|
||||
* @param $target array - default e107 target values for e107_user table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyUserData(&$target, &$source)
|
||||
{
|
||||
$user_meta = unserialize($source['admin']);
|
||||
|
||||
if ($this->copyUserInfo)
|
||||
{
|
||||
$target['user_id'] = $source['ID'];
|
||||
}
|
||||
|
||||
$target['user_name'] = $source['user_nicename'];
|
||||
$target['user_loginname'] = $source['user_login'];
|
||||
$target['user_password'] = $source['user_pass']; // needs to be salted!!!!
|
||||
$target['user_email'] = $source['user_email'];
|
||||
$target['user_hideemail'] = $source['user_hideemail'];
|
||||
$target['user_join'] = strtotime($source['user_registered']);
|
||||
$target['user_admin'] = ($user_meta['administrator'] == 1) ? 1 : 0;
|
||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
||||
$target['user_login'] = $source['firstname']." ".$source['lastname'];
|
||||
$target['user_ban'] = $source['user_ban'];
|
||||
$target['user_customtitle'] = $source['display_name'];
|
||||
$target['user_sess'] = $source['user_sess']; // Photo
|
||||
$target['user_signature'] = $source['user_signature'];
|
||||
$target['user_image'] = $source['user_image']; // Avatar
|
||||
$target['user_currentvisit'] = $source['user_currentvisit'];
|
||||
$target['user_lastpost'] = $source['user_lastpost'];
|
||||
$target['user_chats'] = $source['user_chats'];
|
||||
$target['user_comments'] = $source['user_comments'];
|
||||
|
||||
$target['user_ip'] = $source['user_ip'];
|
||||
$target['user_prefs'] = $source['user_prefs'];
|
||||
$target['user_visits'] = $source['user_visits'];
|
||||
$target['user_class'] = $source['user_class'];
|
||||
$target['user_perms'] = $source['user_perms'];
|
||||
$target['user_xup'] = $source['user_xup'];
|
||||
$target['user_language'] = $source['user_language'];
|
||||
$target['user_country'] = $source['user_country'];
|
||||
$target['user_location'] = $source['user_location'];
|
||||
$target['user_aim'] = $source['user_aim'];
|
||||
$target['user_icq'] = $source['user_icq'];
|
||||
$target['user_yahoo'] = $source['user_yahoo'];
|
||||
$target['user_msn'] = $source['user_msn'];
|
||||
$target['user_homepage'] = $source['user_url'];
|
||||
$target['user_birthday'] = $source['user_birthday'];
|
||||
$target['user_timezone'] = $source['user_timezone'];
|
||||
|
||||
$this->renderDebug($source,$target);
|
||||
|
||||
//return $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Align source data to e107 News Table
|
||||
* @param $target array - default e107 target values for e107_news table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyNewsData(&$target, &$source)
|
||||
{
|
||||
/* Example:
|
||||
[ID] => 88
|
||||
[post_author] => 1
|
||||
[post_date] => 2012-01-25 04:11:22
|
||||
[post_date_gmt] => 2012-01-25 09:11:22
|
||||
[post_content] => [gallery itemtag="div" icontag="span" captiontag="p" link="file"]
|
||||
[post_title] => Media Gallery
|
||||
[post_excerpt] =>
|
||||
[post_status] => inherit
|
||||
[comment_status] => open
|
||||
[ping_status] => open
|
||||
[post_password] =>
|
||||
[post_name] => 10-revision-6
|
||||
[to_ping] =>
|
||||
[pinged] =>
|
||||
[post_modified] => 2012-01-25 04:11:22
|
||||
[post_modified_gmt] => 2012-01-25 09:11:22
|
||||
[post_content_filtered] =>
|
||||
[post_parent] => 10
|
||||
[guid] => http://siteurl.com/2012/01/25/10-revision-6/
|
||||
[menu_order] => 0
|
||||
[post_type] => post
|
||||
[post_mime_type] =>
|
||||
[comment_count] => 0
|
||||
*/
|
||||
|
||||
// $target['news_id'] = $source['ID'];
|
||||
$target['news_title'] = $source['post_title'];
|
||||
$target['news_sef'] = $source['post_name'];
|
||||
$target['news_body'] = $source['post_content'];
|
||||
// $target['news_extended'] = '';
|
||||
// $target['news_meta_keywords'] = '';
|
||||
// $target['news_meta_description'] = '';
|
||||
$target['news_datestamp'] = strtotime($source['post_date']);
|
||||
$target['news_author'] = $source['post_author'];
|
||||
// $target['news_category'] = '';
|
||||
$target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0;
|
||||
$target['news_start'] = '';
|
||||
$target['news_end'] = '';
|
||||
$target['news_class'] = '';
|
||||
$target['news_render_type'] = '';
|
||||
$target['news_comment_total'] = $source['comment_count'];
|
||||
$target['news_summary'] = $source['post_excerpt'];
|
||||
$target['news_thumbnail'] = '';
|
||||
$target['news_sticky'] = '';
|
||||
|
||||
return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Align source data to e107 Page Table
|
||||
* @param $target array - default e107 target values for e107_page table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyPageData(&$target, &$source)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
/* post_status:
|
||||
publish - A published post or page
|
||||
inherit - a revision
|
||||
pending - post is pending review
|
||||
private - a private post
|
||||
future - a post to publish in the future
|
||||
draft - a post in draft status
|
||||
trash - post is in trashbin (available with 2.9)
|
||||
*/
|
||||
|
||||
if($source['post_status']=='private' || $source['post_status']=='future' || $source['post_status'] == 'draft')
|
||||
{
|
||||
$target['page_class'] = e_UC_ADMIN;
|
||||
}
|
||||
|
||||
// $target['page_id'] = $source['ID']; // auto increment
|
||||
$target['page_title'] = $source['post_title'];
|
||||
$target['page_sef'] = $source['post_name'];
|
||||
$target['page_text'] = "[html]".$source['post_content']."[/html]";
|
||||
$target['page_metakeys'] = '';
|
||||
$target['page_metadscr'] = '';
|
||||
$target['page_datestamp'] = strtotime($source['post_date']);
|
||||
$target['page_author'] = $source['post_author'];
|
||||
// $target['page_category'] = '',
|
||||
$target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0;
|
||||
$target['page_password'] = $source['post_password'];
|
||||
|
||||
return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Align source data to e107 Links Table
|
||||
* @param $target array - default e107 target values for e107_links table.
|
||||
* @param $source array - WordPress table data
|
||||
*/
|
||||
function copyLinksData(&$target, &$source)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
/* WP
|
||||
link_id
|
||||
link_url
|
||||
link_name
|
||||
link_image
|
||||
link_target
|
||||
link_description
|
||||
link_visible
|
||||
link_owner
|
||||
link_rating
|
||||
link_updated
|
||||
link_rel
|
||||
link_notes
|
||||
link_rss
|
||||
*
|
||||
* e107
|
||||
* link_id
|
||||
link_name
|
||||
link_url
|
||||
link_description
|
||||
link_button
|
||||
link_category
|
||||
link_order
|
||||
link_parent
|
||||
link_open
|
||||
link_class
|
||||
link_function
|
||||
link_sefurl
|
||||
*/
|
||||
|
||||
|
||||
// $target['page_id'] = $source['ID']; // auto increment
|
||||
$target['link_name'] = $source['post_title'];
|
||||
$target['link_url'] = $source['post_name'];
|
||||
$target['link_description'] = "[html]".$source['post_content']."[/html]";
|
||||
$target['link_button'] = '';
|
||||
$target['link_category'] = '';
|
||||
$target['link_order'] = strtotime($source['post_date']);
|
||||
$target['link_parent'] = $source['post_author'];
|
||||
$target['link_open'] = '';
|
||||
$target['link_class'] = '';
|
||||
$target['link_sefurl'] = $source['post_password'];
|
||||
|
||||
// return $target; // comment out to debug
|
||||
|
||||
// DEBUG INFO BELOW.
|
||||
$this->renderDebug($source,$target);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function renderDebug($source,$target)
|
||||
{
|
||||
echo "
|
||||
<div style='width:1000px'>
|
||||
<table style='width:100%'>
|
||||
<tr>
|
||||
<td style='width:500px;padding:10px'>".print_a($source,TRUE)."</td>
|
||||
<td style='border-left:1px solid black;padding:10px'>".print_a($target,TRUE)."</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user