diff --git a/e107_plugins/import/admin_import.php b/e107_plugins/import/admin_import.php
index 6818e0a92..653a77279 100644
--- a/e107_plugins/import/admin_import.php
+++ b/e107_plugins/import/admin_import.php
@@ -59,20 +59,24 @@ $import_class_comment = array(); // Descriptive comment
$import_class_support = array(); // Array of data types supported
// Definitions of available areas to import
-$db_import_blocks = array('users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'),
- 'news' => array('message' => LAN_CONVERT_28),
- 'forumdefs' => array('message' => LAN_CONVERT_26),
- 'forumposts' => array('message' => LAN_CONVERT_48),
- 'polls' => array('message' => LAN_CONVERT_27)
-
- );
+$db_import_blocks = array(
+ 'users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'),
+ 'news' => array('message' => LAN_CONVERT_28, 'classfile' => 'import_news_class.php', 'classname' => 'news_import'),
+ 'page' => array('message' => "Pages", 'classfile' => 'import_page_class.php', 'classname' => 'page_import'),
+ 'links' => array('message' => "Links", 'classfile' => 'import_links_class.php', 'classname' => 'links_import'),
+ 'media' => array('message' => "Media", 'classfile' => 'import_media_class.php', 'classname' => 'media_import'),
+ 'comments' => array('message'=> "Comments"),
+// 'forumdefs' => array('message' => LAN_CONVERT_26),
+// 'forumposts' => array('message' => LAN_CONVERT_48),
+// 'polls' => array('message' => LAN_CONVERT_27)
+);
// See what DB-based imports are available (don't really want it here, but gets it into the header script)
require_once(e_HANDLER.'file_class.php');
$fl = new e_file;
-$importClassList = $fl->get_files(e_PLUGIN.'import', "^.+?_import_class\.php$", "standard", 1);
+$importClassList = $fl->get_files(e_PLUGIN.'import/providers', "^.+?_import_class\.php$", "standard", 1);
foreach($importClassList as $file)
{
$tag = str_replace('_class.php','',$file['fname']);
@@ -98,6 +102,7 @@ if(varset($_POST['import_source']))
$current_db_type = varset($_POST['db_import_type'],key($import_class_names));
}
+
$db_blocks_to_import = array();
@@ -168,193 +173,245 @@ $msg = '';
//======================================================
if(isset($_POST['do_conversion']))
{
- $abandon = TRUE;
- switch ($import_source)
- {
- case 'csv' :
- if (!isset($csv_formats[$current_csv])) $msg = "CSV File format error
";
- if (!is_readable($csv_data_file)) $msg = LAN_CONVERT_31;
- if (!isset($csv_options[$current_csv])) $msg = LAN_CONVERT_37.' '.$current_csv;
- if (!isset($csv_option_settings[$csv_options[$current_csv]])) $msg = LAN_CONVERT_37.' '.$csv_options[$current_csv];
-
- if (!$msg)
- {
- $field_list = explode(',',$csv_formats[$current_csv]);
- $separator = $csv_option_settings[$csv_options[$current_csv]]['separator'];
- $enveloper = $csv_option_settings[$csv_options[$current_csv]]['envelope'];
- if (IMPORT_DEBUG) echo "CSV import: {$current_csv} Fields: {$csv_formats[$current_csv]}
";
- require_once('import_user_class.php');
- $usr = new user_import;
- $usr->overrideDefault('user_class',$checked_class_list);
- if (($source_data = file($csv_data_file)) === FALSE) $msg = LAN_CONVERT_32;
- if ($import_delete_existing_data) $usr->emptyTargetDB(); // Delete existing users - reasonably safe now
- $line_counter = 0;
- $error_counter = 0;
- $write_counter = 0;
- foreach ($source_data as $line)
- {
- $line_counter++;
- $line_error = FALSE;
- if ($line = trim($line))
- {
- $usr_data = $usr->getDefaults(); // Reset user data
- $line_data = csv_split($line, $separator, $enveloper);
- $field_data = current($line_data);
- foreach ($field_list as $f)
+ $abandon = TRUE;
+
+ switch ($import_source)
+ {
+ case 'csv' :
+ if (!isset($csv_formats[$current_csv])) $msg = "CSV File format error
";
+ if (!is_readable($csv_data_file)) $msg = LAN_CONVERT_31;
+ if (!isset($csv_options[$current_csv])) $msg = LAN_CONVERT_37.' '.$current_csv;
+ if (!isset($csv_option_settings[$csv_options[$current_csv]]))
{
- if ($field_data === FALSE) $line_error = TRUE;
- if ($f != 'dummy') $usr_data[$f] = $field_data;
- $field_data = next($line_data);
+ $msg = LAN_CONVERT_37.' '.$csv_options[$current_csv];
+ }
+
+ if (!$msg)
+ {
+ $field_list = explode(',',$csv_formats[$current_csv]);
+ $separator = $csv_option_settings[$csv_options[$current_csv]]['separator'];
+ $enveloper = $csv_option_settings[$csv_options[$current_csv]]['envelope'];
+ if (IMPORT_DEBUG) echo "CSV import: {$current_csv} Fields: {$csv_formats[$current_csv]}
";
+ require_once('import_user_class.php');
+ $usr = new user_import;
+ $usr->overrideDefault('user_class',$checked_class_list);
+ if (($source_data = file($csv_data_file)) === FALSE) $msg = LAN_CONVERT_32;
+ if ($import_delete_existing_data) $usr->emptyTargetDB(); // Delete existing users - reasonably safe now
+ $line_counter = 0;
+ $error_counter = 0;
+ $write_counter = 0;
+ foreach ($source_data as $line)
+ {
+ $line_counter++;
+ $line_error = FALSE;
+ if ($line = trim($line))
+ {
+ $usr_data = $usr->getDefaults(); // Reset user data
+ $line_data = csv_split($line, $separator, $enveloper);
+ $field_data = current($line_data);
+ foreach ($field_list as $f)
+ {
+ if ($field_data === FALSE) $line_error = TRUE;
+ if ($f != 'dummy') $usr_data[$f] = $field_data;
+ $field_data = next($line_data);
+ }
+ if ($line_error)
+ {
+ if ($msg) $msg .= "
";
+ $msg .= LAN_CONVERT_33.$line_counter;
+ $error_counter++;
+ }
+ else
+ {
+ if ($csv_pw_not_encrypted)
+ {
+ $usr_data['user_password'] = md5($usr_data['user_password']);
+ }
+ $line_error = $usr->saveData($usr_data);
+ if ($line_error === TRUE)
+ {
+ $write_counter++;
+ }
+ else
+ {
+ $line_error = $usr->getErrorText($line_error);
+ if ($msg) $msg .= "
";
+ $msg .= str_replace('--ERRNUM--',$line_error,LAN_CONVERT_34).$line_counter;
+ $error_counter++;
+ }
+ }
+ }
+ }
+
+ if ($msg) $msg .= "
";
+ if ($import_delete_existing_data) $msg .= LAN_CONVERT_40.'
';
+ $msg .= str_replace(array('--LINES--','--USERS--', '--ERRORS--'),array($line_counter,$write_counter,$error_counter),LAN_CONVERT_35);
}
- if ($line_error)
+ break;
+
+ case 'db' :
+ if(dbImport() == false)
{
- if ($msg) $msg .= "
";
- $msg .= LAN_CONVERT_33.$line_counter;
- $error_counter++;
- }
- else
+ $abandon = true;
+ };
+ break;
+
+ case 'rss' :
+ if(rssImport() == false)
{
- if ($csv_pw_not_encrypted)
- {
- $usr_data['user_password'] = md5($usr_data['user_password']);
- }
- $line_error = $usr->saveData($usr_data);
- if ($line_error === TRUE)
- {
- $write_counter++;
- }
- else
- {
- $line_error = $usr->getErrorText($line_error);
- if ($msg) $msg .= "
";
- $msg .= str_replace('--ERRNUM--',$line_error,LAN_CONVERT_34).$line_counter;
- $error_counter++;
- }
- }
- }
- }
- if ($msg) $msg .= "
";
- if ($import_delete_existing_data) $msg .= LAN_CONVERT_40.'
';
- $msg .= str_replace(array('--LINES--','--USERS--', '--ERRORS--'),array($line_counter,$write_counter,$error_counter),LAN_CONVERT_35);
- }
- break;
+ $abandon = true;
+ };
+ break;
+ }
- case 'db' :
+ if ($msg)
+ {
+ $emessage->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg);
+ $msg = '';
+ }
- if (IMPORT_DEBUG) echo "Importing: {$current_db_type}
";
- if (!isset($_POST['dbParamHost']) || !isset($_POST['dbParamUsername']) || !isset($_POST['dbParamPassword']) || !isset($_POST['dbParamDatabase']))
- {
- $msg = LAN_CONVERT_41;
- }
- if (!$msg)
- {
- if (class_exists($current_db_type))
+ if ($abandon)
+ {
+ // unset($_POST['do_conversion']);
+ $text = "
+
";
+ $ns -> tablerender(LAN_CONVERT_30,$emessage->render(). $text);
+ require_once(e_ADMIN."footer.php");
+ exit;
+ }
+}
+
+
+function rssImport()
+{
+ global $current_db_type, $db_import_blocks, $import_delete_existing_data,$db_blocks_to_import;
+
+ $mes = e107::getMessage();
+ $mes->addDebug("Loading: RSS");
+ $mes->addWarning("Under Construction");
+ return dbImport('xml');
+
+}
+
+function dbImport($mode='db')
+{
+ global $current_db_type, $db_import_blocks, $import_delete_existing_data,$db_blocks_to_import;
+
+ $mes = e107::getMessage();
+
+ // if (IMPORT_DEBUG) echo "Importing: {$current_db_type}
";
+ $mes->addDebug("Loading: ".$current_db_type);
+
+ if (class_exists($current_db_type))
+ {
+ $mes->addDebug("Class Available: ".$current_db_type);
+ $converter = new $current_db_type;
+ }
+ else
+ {
+ $mes->addError(LAN_CONVERT_42);
+ return false;
+ }
+
+ if($mode == 'db') // Don't do DB check on RSS/XML
+ {
+ if (!isset($_POST['dbParamHost']) || !isset($_POST['dbParamUsername']) || !isset($_POST['dbParamPassword']) || !isset($_POST['dbParamDatabase']))
{
- $converter = new $current_db_type;
+ $mes->addError(LAN_CONVERT_41);
+ return false;
}
- else
- {
- $msg = LAN_CONVERT_42;
- }
- }
- if (!$msg)
- {
-
+
$result = $converter->db_Connect($_POST['dbParamHost'], $_POST['dbParamUsername'], $_POST['dbParamPassword'], $_POST['dbParamDatabase'], $_POST['dbParamPrefix']);
-
-
-
if ($result !== TRUE)
{
- $msg = LAN_CONVERT_43.": ".$result; // db connect failed
- }
- }
- if (!$msg)
- {
- foreach ($db_import_blocks as $k => $v)
+ $mes->addError(LAN_CONVERT_43.": ".$result); // db connect failed
+ return false;
+ }
+ }
+
+
+ foreach ($db_import_blocks as $k => $v)
+ {
+ if (isset($db_blocks_to_import[$k]))
{
- if (isset($db_blocks_to_import[$k]))
- {
$loopCounter = 0;
$errorCounter = 0;
+
if (is_readable($v['classfile']))
{
require_once($v['classfile']);
}
else
{
- $msg = LAN_CONVERT_45.': '.$v['classfile']; // can't read class file.
+ $mes->addError(LAN_CONVERT_45.': '.$v['classfile']); // can't read class file.
+ return false;
}
- if (!$msg && (varset($_POST["import_block_{$k}"],0) == 1))
+
+ if (varset($_POST["import_block_{$k}"],0) == 1)
{
- if (IMPORT_DEBUG) echo "Importing: {$k}
";
- $result = $converter->setupQuery($k,!$import_delete_existing_data);
- if ($result !== TRUE)
- {
- $msg = LAN_CONVERT_44.' '.$k;
- // $msg .= "Prefix = ".$converter->DBPrefix;
- break;
- }
- $exporter = new $v['classname']; // Writes the output data
- // Do any type-specific default setting
- switch ($k)
- {
- case 'users' :
- $exporter->overrideDefault('user_class',$checked_class_list);
- break;
- }
- if ($import_delete_existing_data) $exporter->emptyTargetDB(); // Clean output DB - reasonably safe now
- while ($row = $converter->getNext($exporter->getDefaults()))
- {
- $loopCounter++;
- $result = $exporter->saveData($row);
- if ($result !== TRUE)
+ //if (IMPORT_DEBUG) echo "Importing: {$k}
";
+ $mes->addDebug("Importing: ".$k);
+
+ $result = $converter->setupQuery($k,!$import_delete_existing_data);
+
+ if ($result !== TRUE)
+ {
+ $mes->addError(LAN_CONVERT_44.' '.$k); // couldn't set query
+ // $msg .= "Prefix = ".$converter->DBPrefix;
+ break;
+ }
+
+ $exporter = new $v['classname']; // Writes the output data
+
+ switch ($k) // Do any type-specific default setting
{
- $errorCounter++;
- $line_error = $exporter->getErrorText($result);
- if ($msg) $msg .= "
";
- $msg .= str_replace(array('--ERRNUM--','--DB--'),array($line_error,$k),LAN_CONVERT_46).$loopCounter;
+ case 'users' :
+ $exporter->overrideDefault('user_class',$checked_class_list);
+ break;
}
- }
- $converter->endQuery;
- unset($exporter);
- if ($msg) $msg .= "
";
- $msg .= str_replace(array('--LINES--','--USERS--', '--ERRORS--','--BLOCK--'),
- array($loopCounter,$loopCounter-$errorCounter,$errorCounter, $k),LAN_CONVERT_47);
+
+ if ($import_delete_existing_data)
+ {
+ $exporter->emptyTargetDB(); // Clean output DB - reasonably safe now
+ }
+
+ while ($row = $converter->getNext($exporter->getDefaults(),$mode))
+ {
+ $loopCounter++;
+ $result = $exporter->saveData($row);
+ if ($result !== TRUE)
+ {
+ $errorCounter++;
+ $line_error = $exporter->getErrorText($result);
+ // if ($msg) $msg .= "
";
+ $msg = str_replace(array('--ERRNUM--','--DB--'),array($line_error,$k),LAN_CONVERT_46).$loopCounter;
+ $mes->addError($msg); // couldn't set query
+ }
+ }
+
+ $converter->endQuery();
+
+ unset($exporter);
+
+
+ $msg = str_replace(array('--LINES--','--USERS--', '--ERRORS--','--BLOCK--'),
+ array($loopCounter,$loopCounter-$errorCounter,$errorCounter, $k),LAN_CONVERT_47);
+ $mes->addSuccess($msg); // couldn't set query
}
}
}
- }
+
// $msg = LAN_CONVERT_29;
- $abandon = FALSE;
- break;
- }
-
- if ($msg)
- {
- $emessage->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg);
- $msg = '';
- }
-
- if ($abandon)
- {
-// unset($_POST['do_conversion']);
- $text = "
- ";
- $ns -> tablerender(LAN_CONVERT_30, $text);
- require_once(e_ADMIN."footer.php");
- exit;
- }
+ return true;
+ // $abandon = FALSE;
}
-
-
//======================================================
// Display front page
//======================================================
@@ -411,19 +468,25 @@ function showStartPage()
- CSV |
- ".ADMIN_TRUE_ICON." |
- |
- |
- |
- |
- ".$frm->radio('import_type', 'csv')." |
";
+ CSV |
+ ".ADMIN_TRUE_ICON." | ";
+
+ for ($i=0; $i < count($db_import_blocks)-1; $i++)
+ {
+ $text .= " | ";
+ }
+
+
+ $text .= "".$frm->radio('import_type', 'csv')." | ";
foreach ($import_class_names as $k => $title)
{
+ $iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png";
+ $icon = (file_exists($iconFile)) ? "
" : "";
+
$text .= "
- ".$title." ".$import_class_comment[$k]." | \n";
+
".$icon.$title." ".$import_class_comment[$k]." | \n";
foreach($db_import_blocks as $key=>$val)
{
@@ -500,6 +563,15 @@ function showImportOptions($mode='csv')
";
}
+ elseif($mode == 'rss_import')
+ {
+ $text .= "
+ Feed URL |
+
+
+ |
+
";
+ }
else
{
$importType = $import_class_names[$mode];
@@ -526,7 +598,13 @@ function showImportOptions($mode='csv')
|
-
+ ";
+
+ }
+
+ if($mode != 'csv')
+ {
+ $text .= "
$importType ".LAN_CONVERT_24." |
";
@@ -540,9 +618,10 @@ function showImportOptions($mode='csv')
$text .= " ";
}
}
- $text .= " |
";
+ $text .= "";
}
+
$text .= "".LAN_CONVERT_38." |
".LAN_CONVERT_39." |
diff --git a/e107_plugins/import/images/coppermine.png b/e107_plugins/import/images/coppermine.png
new file mode 100644
index 000000000..5fefbe501
Binary files /dev/null and b/e107_plugins/import/images/coppermine.png differ
diff --git a/e107_plugins/import/images/drupal.png b/e107_plugins/import/images/drupal.png
new file mode 100644
index 000000000..63ecb58f4
Binary files /dev/null and b/e107_plugins/import/images/drupal.png differ
diff --git a/e107_plugins/import/images/e107.png b/e107_plugins/import/images/e107.png
new file mode 100644
index 000000000..5ead55e21
Binary files /dev/null and b/e107_plugins/import/images/e107.png differ
diff --git a/e107_plugins/import/images/ikonboard.png b/e107_plugins/import/images/ikonboard.png
new file mode 100644
index 000000000..4081f1006
Binary files /dev/null and b/e107_plugins/import/images/ikonboard.png differ
diff --git a/e107_plugins/import/images/joomla.png b/e107_plugins/import/images/joomla.png
new file mode 100644
index 000000000..86a7136a2
Binary files /dev/null and b/e107_plugins/import/images/joomla.png differ
diff --git a/e107_plugins/import/images/mambo.png b/e107_plugins/import/images/mambo.png
new file mode 100644
index 000000000..918f257e0
Binary files /dev/null and b/e107_plugins/import/images/mambo.png differ
diff --git a/e107_plugins/import/images/phpbb2.png b/e107_plugins/import/images/phpbb2.png
new file mode 100644
index 000000000..afeef591e
Binary files /dev/null and b/e107_plugins/import/images/phpbb2.png differ
diff --git a/e107_plugins/import/images/phpnuke.png b/e107_plugins/import/images/phpnuke.png
new file mode 100644
index 000000000..0f55e0bff
Binary files /dev/null and b/e107_plugins/import/images/phpnuke.png differ
diff --git a/e107_plugins/import/images/smf.png b/e107_plugins/import/images/smf.png
new file mode 100644
index 000000000..4ad92b8ff
Binary files /dev/null and b/e107_plugins/import/images/smf.png differ
diff --git a/e107_plugins/import/images/wordpress.png b/e107_plugins/import/images/wordpress.png
new file mode 100644
index 000000000..22815daa6
Binary files /dev/null and b/e107_plugins/import/images/wordpress.png differ
diff --git a/e107_plugins/import/import_classes.php b/e107_plugins/import/import_classes.php
index d013f8a98..0acd36575 100644
--- a/e107_plugins/import/import_classes.php
+++ b/e107_plugins/import/import_classes.php
@@ -20,96 +20,169 @@ Root classes for import and saving of data. Application-specific classes build o
class base_import_class
{
- var $ourDB = NULL;
- var $DBPrefix = '';
- var $currentTask = '';
- var $copyUserInfo = TRUE;
+ var $ourDB = NULL;
+ var $DBPrefix = '';
+ var $currentTask = '';
+ var $copyUserInfo = TRUE;
+ var $arrayData = array();
-
- // Connect to the external DB if not already connected
- function db_Connect($server, $user, $password, $database, $prefix)
- {
- if ($this->ourDB == NULL)
+ /**
+ * Connect to the external DB if not already connected
+ */
+ function db_Connect($server, $user, $password, $database, $prefix)
{
- $this->ourDB = new db;
- $result = $this->ourDB->db_Connect($server, $user, $password, $database);
- $this->DBPrefix = $prefix;
- if ($result)
- {
- return $result;
- }
+ if ($this->ourDB == NULL)
+ {
+ $this->ourDB = new db;
+ $result = $this->ourDB->db_Connect($server, $user, $password, $database);
+ $this->DBPrefix = $prefix;
+ if ($result)
+ {
+ return $result;
+ }
+ }
+
+ return TRUE;
}
- return TRUE;
- }
-
- // Set up a query for the specified task. If $blank_user is TRUE, user ID Data in source data is ignored
- // Returns TRUE on success. FALSE on error
- function setupQuery($task, $blank_user=FALSE)
- {
- return FALSE;
- }
-
-
- function saveData($dataRecord)
- {
- switch($this->currentTask)
+ /**
+ * Set up a query for the specified task. If $blank_user is TRUE, user ID Data in source data is ignored
+ * @return boolean TRUE on success. FALSE on error
+ */
+ function setupQuery($task, $blank_user=FALSE)
{
- case 'users' :
- return $this->saveUserData($dataRecord);
- break;
- case 'forumdefs' :
- return $this->saveForumData($dataRecord);
- return FALSE;
- case 'forumposts' :
- return $this->savePostData($dataRecord);
- return FALSE;
- case 'polls' :
- return FALSE;
- case 'news' :
- return FALSE;
+ return FALSE;
}
- return FALSE;
+
+
+ function saveData($dataRecord)
+ {
+ switch($this->currentTask)
+ {
+ case 'users' :
+ return $this->saveUserData($dataRecord);
+ break;
+
+ case 'news' :
+ return $this->saveNewsData($dataRecord);
+ break;
+
+ case 'page' :
+ return $this->savePageData($dataRecord);
+ break;
+
+ case 'links' :
+ return $this->saveLinksData($dataRecord);
+ break;
+
+ case 'media' :
+ return $this->saveMediaData($dataRecord);
+ break;
+
+ case 'forumdefs' :
+ return $this->saveForumData($dataRecord);
+ break;
+
+ case 'forumposts' :
+ return $this->savePostData($dataRecord);
+ break;
+
+ case 'polls' :
+ break;
+ }
+
+ return FALSE;
}
// Return the next record as an array. All data has been converted to the appropriate E107 formats
// Return FALSE if no more data
// Its passed a record initialised with the default values
- function getNext($initial)
- {
- $result = $this->ourDB->db_Fetch();
- if (!$result) return FALSE;
- switch($this->currentTask)
+ function getNext($initial,$mode='db')
{
- case 'users' :
- return $this->copyUserData($initial, $result);
- break;
- case 'forumdefs' :
- return FALSE;
- case 'forumposts' :
- return FALSE;
- case 'polls' :
- return FALSE;
- case 'news' :
- return FALSE;
+ if($mode == 'db')
+ {
+ $result = $this->ourDB->db_Fetch();
+ }
+ else
+ {
+ $result = current($this->arrayData);
+ next($this->arrayData);
+ }
+
+
+ if (!$result) return FALSE;
+ switch($this->currentTask)
+ {
+ case 'users' :
+ return $this->copyUserData($initial, $result);
+ break;
+
+ case 'news' :
+ return $this->copyNewsData($initial, $result);
+ break;
+
+ case 'page' :
+ return $this->copyPageData($initial, $result);
+ break;
+
+ case 'links' :
+ return $this->copyLinksData($initial, $result);
+ break;
+
+ case 'media' :
+ return $this->copyMediaData($initial, $result);
+ break;
+
+ case 'forumdefs' :
+ break;
+
+ case 'forumposts' :
+ break;
+
+ case 'polls' :
+ break;
+
+
+ }
+
+ return FALSE;
}
- return FALSE;
- }
- // Called to signal that current task is complete; tidy up as required
- function endQuery()
- {
- $this->currentTask = '';
- }
+ // Called to signal that current task is complete; tidy up as required
+ function endQuery()
+ {
+ $this->currentTask = '';
+ }
- // Empty function which descendants can inherit from
- function copyUserData(&$target, &$source)
- {
- return $target;
- }
+ // Empty functions which descendants can inherit from
+
+ function copyUserData(&$target, &$source)
+ {
+ return $target;
+ }
+
+ function copyNewsData(&$target, &$source)
+ {
+ return $target;
+ }
+
+ function copyPageData(&$target, &$source)
+ {
+ return $target;
+ }
+
+ function copyLinksData(&$target, &$source)
+ {
+ return $target;
+ }
+
+ function copyMediaData(&$target, &$source)
+ {
+ return $target;
+ }
}
diff --git a/e107_plugins/import/languages/English_admin_import.php b/e107_plugins/import/languages/English_admin_import.php
index ebe184769..9ccbc74b3 100644
--- a/e107_plugins/import/languages/English_admin_import.php
+++ b/e107_plugins/import/languages/English_admin_import.php
@@ -73,5 +73,5 @@ define('LAN_CONVERT_43','Error connecting to source database');
define('LAN_CONVERT_44','Query setup error for ');
define('LAN_CONVERT_45','Cannot read import code file');
define('LAN_CONVERT_46','Error: --ERRNUM-- while writing to --DB-- database, line ');
-define('LAN_CONVERT_47','Block --BLOCK-- import completed. --LINES-- read, --USERS-- added, --ERRORS-- errors');
+define('LAN_CONVERT_47','Batch --BLOCK-- import completed. --LINES-- read, --USERS-- added, --ERRORS-- errors');
define('LAN_CONVERT_48','Forum posts');
diff --git a/e107_plugins/import/PHPFusion_import_class.php b/e107_plugins/import/providers/PHPFusion_import_class.php
similarity index 100%
rename from e107_plugins/import/PHPFusion_import_class.php
rename to e107_plugins/import/providers/PHPFusion_import_class.php
diff --git a/e107_plugins/import/PHPNuke_import_class.php b/e107_plugins/import/providers/PHPNuke_import_class.php
similarity index 100%
rename from e107_plugins/import/PHPNuke_import_class.php
rename to e107_plugins/import/providers/PHPNuke_import_class.php
diff --git a/e107_plugins/import/coppermine_import_class.php b/e107_plugins/import/providers/coppermine_import_class.php
similarity index 100%
rename from e107_plugins/import/coppermine_import_class.php
rename to e107_plugins/import/providers/coppermine_import_class.php
diff --git a/e107_plugins/import/drupal_import_class.php b/e107_plugins/import/providers/drupal_import_class.php
similarity index 100%
rename from e107_plugins/import/drupal_import_class.php
rename to e107_plugins/import/providers/drupal_import_class.php
diff --git a/e107_plugins/import/e107_import_class.php b/e107_plugins/import/providers/e107_import_class.php
similarity index 100%
rename from e107_plugins/import/e107_import_class.php
rename to e107_plugins/import/providers/e107_import_class.php
diff --git a/e107_plugins/import/ikonboard_import_class.php b/e107_plugins/import/providers/ikonboard_import_class.php
similarity index 100%
rename from e107_plugins/import/ikonboard_import_class.php
rename to e107_plugins/import/providers/ikonboard_import_class.php
diff --git a/e107_plugins/import/providers/joomla_import_class.php b/e107_plugins/import/providers/joomla_import_class.php
new file mode 100644
index 000000000..e8f37d4f0
--- /dev/null
+++ b/e107_plugins/import/providers/joomla_import_class.php
@@ -0,0 +1,83 @@
+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;
+ }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/import/mambo_import_class.php b/e107_plugins/import/providers/mambo_import_class.php
similarity index 100%
rename from e107_plugins/import/mambo_import_class.php
rename to e107_plugins/import/providers/mambo_import_class.php
diff --git a/e107_plugins/import/phpbb2_import_class.php b/e107_plugins/import/providers/phpbb2_import_class.php
similarity index 100%
rename from e107_plugins/import/phpbb2_import_class.php
rename to e107_plugins/import/providers/phpbb2_import_class.php
diff --git a/e107_plugins/import/providers/rss_import_class.php b/e107_plugins/import/providers/rss_import_class.php
new file mode 100644
index 000000000..94054db4a
--- /dev/null
+++ b/e107_plugins/import/providers/rss_import_class.php
@@ -0,0 +1,294 @@
+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 "
+
+
+
+ ".print_a($source,TRUE)." |
+ ".print_a($target,TRUE)." |
+
+
+
";
+ }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/import/smf_import_class.php b/e107_plugins/import/providers/smf_import_class.php
similarity index 100%
rename from e107_plugins/import/smf_import_class.php
rename to e107_plugins/import/providers/smf_import_class.php
diff --git a/e107_plugins/import/providers/wordpress_import_class.php b/e107_plugins/import/providers/wordpress_import_class.php
new file mode 100644
index 000000000..0f4b342cc
--- /dev/null
+++ b/e107_plugins/import/providers/wordpress_import_class.php
@@ -0,0 +1,354 @@
+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 "
+
+
+
+ ".print_a($source,TRUE)." |
+ ".print_a($target,TRUE)." |
+
+
+
";
+ }
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/e107_plugins/import/wordpress_import_class.php b/e107_plugins/import/wordpress_import_class.php
deleted file mode 100644
index 4fc467e63..000000000
--- a/e107_plugins/import/wordpress_import_class.php
+++ /dev/null
@@ -1,141 +0,0 @@
-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;
-
-
-
- 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)
- {
- $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'];
-
-
-// user_pass user_nicename user_email user_url user_registered user_activation_key user_status display_name
-
- return $target;
- }
-
-}
-
-
-?>