diff --git a/e107_plugins/import/admin_import.php b/e107_plugins/import/admin_import.php index f78c5cfbd..2b1a95d18 100644 --- a/e107_plugins/import/admin_import.php +++ b/e107_plugins/import/admin_import.php @@ -50,7 +50,794 @@ require_once(e_HANDLER.'message_handler.php'); $emessage = &eMessage::getInstance(); //nothing wrong with doing it twice + + + + include_lan(e_PLUGIN.'import/languages/'.e_LANGUAGE.'_admin_import.php'); + + + +//XXX A Fresh Start +class import_admin extends e_admin_dispatcher +{ + + protected $modes = array( + 'main' => array( + 'controller' => 'import_main_ui', + 'path' => null, + 'ui' => 'import_admin_form_ui', + 'uipath' => null + ), + 'cat' => array( + 'controller' => 'import_cat_ui', + 'path' => null, + 'ui' => 'import_cat_form_ui', + 'uipath' => null + ) + ); + + protected $adminMenu = array( + 'main/list' => array('caption'=> LAN_LIST, 'perm' => '0'), + // 'main/create' => array('caption'=> 'Create import', 'perm' => '0'), +// 'cat/list' => array('caption'=> 'Categories', 'perm' => '0'), +// 'cat/create' => array('caption'=> "Create Category", 'perm' => '0'), + // 'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => '0'), + // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => '0') + ); + + protected $adminMenuAliases = array( + 'main/edit' => 'main/list' + ); + + protected $menuTitle = LAN_PLUGIN_IMPORT_NAME; +} + + +class import_main_ui extends e_admin_ui +{ + + protected $pluginTitle = LAN_PLUGIN_IMPORT_NAME; + protected $pluginName = 'import'; + protected $table = false; + + protected $providers = array(); // the different types of import. + protected $deleteExisting = false; // delete content from existing table during import. + protected $selectedTables = array(); // User selection of what tables to import. eg. news, pages etc. + protected $importClass = null; + + + // Definitions of available areas to import + protected $importTables = 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) + ); + + // without any Order or Limit. + + + + function init() + { + $fl = e107::getFile(); + + $importClassList = $fl->get_files(e_PLUGIN.'import/providers', "^.+?_import_class\.php$", "standard", 1); + + foreach($importClassList as $file) + { + $tag = str_replace('_class.php','',$file['fname']); + + $key = str_replace("_import_class.php","",$file['fname']); + + $this->providers[$key] = $this->getMeta($tag); + + + include_once($file['path'].$file['fname']); // This will set up the variables + + + if(vartrue($_GET['type'])) + { + $this->importClass = $_GET['type']."_import"; + + } + + + + } + + + + + } + + + function getMeta($class_name) + { + if(class_exists($class_name)) + { + $obj = new $class_name; + return array('title' => vartrue($obj->title), 'description' => vartrue($obj->description), 'supported' => vartrue($obj->supported)); + } + + } + + + + + + // After selection - decide where to route things. + function importPage() + { + + print_a($_POST); + + + $this->deleteExisting = varset($_POST['import_delete_existing_data'],0); + + if($_POST['selectedTables']) + { + $this->selectedTables = $_POST['selectedTables']; + } + + if(vartrue($_POST['runConversion'])) // default method. + { + $this->runConversion($_POST['import_source']); + return; + } + + + + + $this->showImportOptions($_GET['type']); + + } + + + + + + + + + + function listPage() + { + $mes = e107::getMessage(); + $frm = e107::getForm(); + + + // $mes->addDebug(print_a($this->providers,true)); + + $text = " +
+
+ ".'DBLAN_10'." + ".$frm->hidden('mode','main')." + ".$frm->hidden('action','import')." + + + + + + + + + + + "; + foreach($this->importTables as $name) // 1 column for each of users, news, forum etc. + { + $text .= ""; + } + + $text.=" + + + + + + + + + "; + + for ($i=0; $i < count($this->importTables)-1; $i++) + { + $text .= ""; + } + + + $text .= ""; + + + foreach ($this->providers as $k=>$info) + { + $title = $info['title']; + + + $iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png"; + + $icon = (file_exists($iconFile)) ? "" : ""; + + $text .= " + \n"; + + foreach($this->importTables as $key=>$val) + { + $text .= "\n"; + } + + $text .= " + + "; + } + + + $text .= " + +
".LAN_CONVERT_06."".$name['message']."".LAN_OPTIONS."
CSV".ADMIN_TRUE_ICON." ".$frm->admin_button('import_type', 'csv', 'other',"Select")."
".$icon.$title."
".$info['description']."
".(in_array($key,$info['supported']) ? ADMIN_TRUE_ICON : " ").""; + + $text .= $frm->admin_button('type', $k, 'other',"Select"); + // $text .= $frm->admin_button('import_type', $k, 'other',"Select"); + + $text .= " +
+
+ ".$frm->hidden('trigger_import',1)." + +
+
+
"; + + echo $mes->render().$text; + // $ns->tablerender(LAN_PLUGIN_IMPORT_NAME, $mes->render().$text); + + } + + + + + + function runConversion($import_source) + { + $frm = e107::getForm(); + $ns = e107::getRender(); + $mes = e107::getMessage(); + + $abandon = TRUE; + + switch ($import_source) + { + case 'csv' : + + break; + + case 'db' : + if($this->dbImport() == false) + { + $abandon = true; + } + break; + + case 'rss' : + if($this->rssImport() == false) + { + $abandon = true; + } + break; + } + + + if ($msg) + { + $mes->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg); + $msg = ''; + } + + if ($abandon) + { + // unset($_POST['do_conversion']); + $text = " +
+
+ ".$frm->admin_button('dummy_continue',LAN_CONTINUE, 'execute')." +
+
"; + $ns -> tablerender(LAN_CONVERT_30,$mes->render(). $text); + + } + } + + + + + + + + + + + + + + function showImportOptions($type='csv') + { + global $csv_names, $e_userclass; + $mode = $this->importClass; + + $frm = e107::getForm(); + $ns = e107::getRender(); + + $mes = e107::getMessage(); + + if (class_exists($mode)) + { + $mes->addDebug("Class Available: ".$mode); + $proObj = new $mode; + if($proObj->init()===FALSE) + { + return; + } + } + + $message = "".LAN_CONVERT_05.""; + $mes->add($message, E_MESSAGE_WARNING); + + $text = " +
+ + + + + "; + + + + /* + if($mode == "csv") + { + $text .= " + + + + + + + + + + + + + + "; + + } + else + */ + + $importType = $proObj->title; + + if(method_exists($proObj,"config")) // Config Found in Class - render options from it. + { + $ops = $proObj->config(); + foreach($ops as $key=>$val) + { + $text .= " + + + \n"; + } + + if($proObj->sourceType) + { + $text .= "\n"; + } + + } + else // STANDARD db Setup + { + + + $text .= " + + + + + + + + + + + + + + + + + + + + "; + + } + + // if($mode != 'csv') + { + $text .= " + + + "; + } + + + $text .= " + + "; + + if(varset($proObj->defaultClass) !== false) + { + $text .= " + + "; + } + + $action = varset($proObj->action,'runConversion'); + $text .= "
".LAN_CONVERT_07."\n +
".LAN_CONVERT_36."
".LAN_CONVERT_17." + + + + + ".LAN_CONVERT_18."
".$val['caption']."".$val['html']; + $text .= (vartrue($val['help'])) ? "
".$val['help']."
" : ""; + $text .= "
$importType ".LAN_CONVERT_19."
$importType ".LAN_CONVERT_20."
$importType ".LAN_CONVERT_21."
$importType ".LAN_CONVERT_22."
$importType ".LAN_CONVERT_23."mprefix)."' maxlength='100' /> + +
$importType ".LAN_CONVERT_24.""; + + $defCheck = (count($proObj->supported==1)) ? true : false; + foreach ($this->importTables as $k => $v) + { + if(in_array($k, $proObj->supported)) // display only the options supported. + { + $text .= $frm->checkbox('selectedTables['.$k.']', $k, $defCheck)." ".$v['message']; + + + //$text .= " ".$v['message']; + $text .= "
"; + } + } + $text .= "
".LAN_CONVERT_38." + ".LAN_CONVERT_39."
".LAN_CONVERT_16.""; + $text .= $e_userclass->vetted_tree('classes_select',array($e_userclass,'checkbox'), varset($_POST['classes_select']),'main,admin,classes,matchclass, no-excludes'); + $text .= "
+
".$frm->admin_button($action,LAN_CONTINUE, 'execute'). + + $frm->admin_button('back',LAN_CANCEL, 'cancel')." + + +
+
"; + + // Now a little bit of JS to initialise some of the display divs etc + // $temp = ''; + // if(varset($import_source)) { $temp .= "disp('{$import_source}');"; } + // if (varset($current_db_type)) $temp .= " flagbits('{$current_db_type}');"; + // if (varset($temp)) $text .= ""; + + $ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $mes->render().$text); + + } + + + + + + + function rssImport() + { + global $current_db_type; + + $mes = e107::getMessage(); + $mes->addDebug("Loading: RSS"); + + if(!varset($_POST['runConversion'])) + { + $mes->addWarning("Under Construction"); + } + + return $this->dbImport('xml'); + + } + + + + /** MAIN IMPORT AREA */ + function dbImport($mode='db') + { + + $mes = e107::getMessage(); + + $mes->addDebug("dbImport(): Loading: ".$this->importClass); + + if(!is_array($this->importTables)) + { + $mes->addError("dbImport(): No areas selected for import"); // db connect failed + return false; + } + + if (class_exists($this->importClass)) + { + $mes->addDebug("dbImport(): Class Available: ".$this->importClass); + $converter = new $this->importClass; + $converter->init(); + } + else + { + $mes->addError(LAN_CONVERT_42. "[".$this->importClass."]"); + $mes->addDebug("dbImport(): Class NOT Available: ".$this->importClass); + + 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'])) + { + $mes->addError(LAN_CONVERT_41); + return false; + } + + $result = $converter->db_Connect($_POST['dbParamHost'], $_POST['dbParamUsername'], $_POST['dbParamPassword'], $_POST['dbParamDatabase'], $_POST['dbParamPrefix']); + if ($result !== TRUE) + { + $mes->addError(LAN_CONVERT_43.": ".$result); // db connect failed + return false; + } + } + + + if(vartrue($converter->override)) + { + $mes->addDebug("dbImport(): Override Active!" ); + return; + } + + + + // Return + foreach($this->selectedTables as $k => $tm) + { + $v = $this->importTables[$k]; + + $loopCounter = 0; + $errorCounter = 0; + + if (is_readable($v['classfile'])) // Load our class for either news, pages etc. + { + $mes->addDebug("dbImport(): Including File: ".$v['classfile']); + require_once($v['classfile']); + } + else + { + $mes->addError(LAN_CONVERT_45.': '.$v['classfile']); // can't read class file. + return false; + } + + $mes->addDebug("dbImport(): Importing: ".$k); + + $result = $converter->setupQuery($k, !$this->deleteExisting); + + if ($result !== TRUE) + { + $mes->addError(LAN_CONVERT_44.' '.$k); // couldn't set query + break; + } + + $exporter = new $v['classname']; // Writes the output data + + if(is_object($exporter)) + { + $mes->addDebug("dbImport(): Class Initiated: ".$v['classname']); + } + else + { + $mes->addDebug("dbImport(): Couldn't Initiate Class: ".$v['classname']); + } + + if($k == 'users') // Do any type-specific default setting + { + $exporter->overrideDefault('user_class', $checked_class_list); + break; + } + + if ($this->deleteExisting) + { + $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 + } + + + + + + + + + + + return true; + + /// - old BELOW ---------------------------------------- + + + foreach ($this->importTables as $k => $v) + { + if (isset($this->selectedTables[$k])) + { + $loopCounter = 0; + $errorCounter = 0; + + if (is_readable($v['classfile'])) + { + require_once($v['classfile']); + } + else + { + $mes->addError(LAN_CONVERT_45.': '.$v['classfile']); // can't read class file. + return false; + } + + if (varset($_POST["import_block_{$k}"],0) == 1) + { + //if (IMPORT_DEBUG) echo "Importing: {$k}
"; + $mes->addDebug("Importing: ".$k); + + $result = $converter->setupQuery($k,!$this->deleteExisting); + + 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 + { + case 'users' : + $exporter->overrideDefault('user_class',$checked_class_list); + break; + } + + if ($this->deleteExisting) + { + $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 + } + else + { + $mes->addDebug("Error: _POST['import_block_{$k}'] = ".$_POST['import_block_{$k}']); // cou + + } + } + else + { + $mes->addDebug("\$this->selectedTables doesn't contain key: ".$k); // cou + + } + } + + // $msg = LAN_CONVERT_29; + return true; + // $abandon = FALSE; + } + + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + // Source DB types (i.e. CMS types) supported. Key of each element is the 'short code' for the type @@ -115,7 +902,7 @@ foreach ($db_import_blocks as $k => $v) } } -require_once(e_ADMIN."auth.php"); +// require_once(e_ADMIN."auth.php"); if (!is_object($e_userclass)) { @@ -267,7 +1054,7 @@ if(isset($_POST['do_conversion'])) if ($msg) { - $emessage->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg); + $mes->add($msg, E_MESSAGE_INFO); // $ns -> tablerender(LAN_CONVERT_30, $msg); $msg = ''; } @@ -280,12 +1067,13 @@ if(isset($_POST['do_conversion'])) ".$frm->admin_button('dummy_continue',LAN_CONTINUE, 'execute')." "; - $ns -> tablerender(LAN_CONVERT_30,$emessage->render(). $text); + $ns -> tablerender(LAN_CONVERT_30,$mes->render(). $text); require_once(e_ADMIN."footer.php"); exit; } } +/* function rssImport() { @@ -437,24 +1225,17 @@ function dbImport($mode='db') return true; // $abandon = FALSE; } +*/ //====================================================== // Display front page //====================================================== +new import_admin(); +require_once(e_ADMIN."auth.php"); +e107::getAdminUI()->runPage(); - - -if(varset($_GET['import_type']) || varset($_POST['do_conversion'])) -{ - showImportOptions($_GET['import_type']); -} -else -{ - showStartPage(); -} - - require_once(e_ADMIN."footer.php"); - exit; +require_once(e_ADMIN."footer.php"); + exit; @@ -462,14 +1243,20 @@ else /* * Currently unused function - shows available import methods and capabilities */ +/* function showStartPage() { - global $ns, $emessage, $frm, $import_class_names, $import_class_support, $db_import_blocks, $import_class_comment; + global $emessage, $frm, $import_class_names, $import_class_support, $db_import_blocks, $import_class_comment; + + $frm = e107::getForm(); + $text = "
".'DBLAN_10'." + ".$frm->hidden('mode','main')." + ".$frm->hidden('action','import')." @@ -503,7 +1290,7 @@ function showStartPage() } - $text .= ""; + $text .= ""; foreach ($import_class_names as $k => $title) @@ -520,8 +1307,12 @@ function showStartPage() } $text .= " - "; } @@ -531,12 +1322,14 @@ function showStartPage()
".$frm->radio('import_type', 'csv')."
".$frm->admin_button('import_type', 'csv', 'other',"Select")."
- ".$frm->radio('import_type', $k)." + "; + + $text .= $frm->admin_button('type', $k, 'other',"Select"); + // $text .= $frm->admin_button('import_type', $k, 'other',"Select"); + + $text .= "
- ".$frm->admin_button('trigger_import',LAN_CONTINUE, 'execute')." + ".$frm->hidden('trigger_import',1)." +
"; - $ns->tablerender(LAN_PLUGIN_IMPORT_NAME, $emessage->render().$text); + echo $emessage->render().$text; + // $ns->tablerender(LAN_PLUGIN_IMPORT_NAME, $emessage->render().$text); } @@ -562,7 +1355,7 @@ function showImportOptions($mode='csv') } } - $message = LAN_CONVERT_02."
".LAN_CONVERT_05.""; + $message = "".LAN_CONVERT_05.""; $emessage->add($message, E_MESSAGE_WARNING); $text = " @@ -706,7 +1499,7 @@ function showImportOptions($mode='csv') $ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $emessage->render().$text); } - +*/ diff --git a/e107_plugins/import/providers/PHPFusion_import_class.php b/e107_plugins/import/providers/PHPFusion_import_class.php index 77d07d3ae..6258c3a32 100644 --- a/e107_plugins/import/providers/PHPFusion_import_class.php +++ b/e107_plugins/import/providers/PHPFusion_import_class.php @@ -18,34 +18,35 @@ // 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 { + + public $title = 'PHP Fusion'; + public $description = 'Based on V5.1'; + public $supported = array('users'); + public $mprefix = false; + // 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) + function setupQuery($task, $blank_user=FALSE) { - case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); - if ($result === FALSE) return FALSE; - break; - default : - return 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; } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; - } //------------------------------------ diff --git a/e107_plugins/import/providers/PHPNuke_import_class.php b/e107_plugins/import/providers/PHPNuke_import_class.php index 60e36c7b4..6cfc38f0f 100644 --- a/e107_plugins/import/providers/PHPNuke_import_class.php +++ b/e107_plugins/import/providers/PHPNuke_import_class.php @@ -18,34 +18,37 @@ // 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 { + + + public $title = 'PHP Nuke'; + public $description = 'Supports users only - uses PHPBB2'; + public $supported = array('users'); + public $mprefix = 'nuke_'; + + // 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) + function setupQuery($task, $blank_user=FALSE) { - 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; + 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; } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; - } //------------------------------------ diff --git a/e107_plugins/import/providers/blogger_import_class.php b/e107_plugins/import/providers/blogger_import_class.php index 511a88e85..02ad7d9cc 100644 --- a/e107_plugins/import/providers/blogger_import_class.php +++ b/e107_plugins/import/providers/blogger_import_class.php @@ -26,15 +26,24 @@ // require_once('import_classes.php'); require_once('rss_import_class.php'); -$import_class_names['blogger_import'] = 'Blogger'; -$import_class_comment['blogger_import'] = 'Import up to 500 items from yourblog.blogspot.com'; -$import_class_support['blogger_import'] = array('news'); -$import_default_prefix['blogger_import'] = ''; +//$import_class_names['blogger_import'] = 'Blogger'; +//$import_class_comment['blogger_import'] = 'Import up to 500 items from yourblog.blogspot.com'; +//$import_class_support['blogger_import'] = array('news'); +//$import_default_prefix['blogger_import'] = ''; class blogger_import extends rss_import -{ - var $cleanupHtml = false; - var $defaultClass = false; +{ + public $title = "Blogger"; + public $description = 'Import up to 500 items from yourblog.blogspot.com'; + public $supported = array('news'); + public $mprefix = false; + + public $cleanupHtml = false; + public $defaultClass = false; + + + + /* If the first 500 posts of your blog feed are here: diff --git a/e107_plugins/import/providers/coppermine_import_class.php b/e107_plugins/import/providers/coppermine_import_class.php index a5cedd5e5..0d64da3e2 100644 --- a/e107_plugins/import/providers/coppermine_import_class.php +++ b/e107_plugins/import/providers/coppermine_import_class.php @@ -19,16 +19,24 @@ // 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_'; +//$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 { + + public $title = 'Coppermine'; + public $description = 'Standalone gallery version'; + public $supported = array('users'); + public $mprefix = 'CPG_'; + + + // Set up a query for the specified task. // Returns TRUE on success. FALSE on error function setupQuery($task, $blank_user=FALSE) @@ -57,13 +65,14 @@ class coppermine_import extends base_import_class 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']); + $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 @@ -76,6 +85,7 @@ class coppermine_import extends base_import_class $target['user_ban'] = 2; break; } + return $target; /* Unused fields: diff --git a/e107_plugins/import/providers/drupal_import_class.php b/e107_plugins/import/providers/drupal_import_class.php index 8f183e867..8541573e6 100644 --- a/e107_plugins/import/providers/drupal_import_class.php +++ b/e107_plugins/import/providers/drupal_import_class.php @@ -20,42 +20,52 @@ // 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'] = ''; +//$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 { + + public $title = 'Drupal 5.7/6.1'; + public $description = 'Basic import'; + public $supported = array('users'); + public $mprefix = false; + + // 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) + function setupQuery($task, $blank_user=FALSE) { - 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; + 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; } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; - } @@ -64,22 +74,26 @@ class drupal_import extends base_import_class //------------------------------------ // 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; - } + 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; + } + } } diff --git a/e107_plugins/import/providers/e107_import_class.php b/e107_plugins/import/providers/e107_import_class.php index 7745b87b8..904d77fbb 100644 --- a/e107_plugins/import/providers/e107_import_class.php +++ b/e107_plugins/import/providers/e107_import_class.php @@ -20,38 +20,49 @@ // 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_'; +//$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 { + + + public $title = 'e107'; + public $description = 'Reads 0.7 and 0.8 version files'; + public $supported = array('users'); + public $mprefix = 'e107_'; + + + + // 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) + function setupQuery($task, $blank_user=FALSE) { - 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; - - + 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; - default : - return FALSE; - } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; + return TRUE; } @@ -60,49 +71,52 @@ class e107_import extends base_import_class //------------------------------------ // 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; - } - + 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; + } + } } -?> +?> \ No newline at end of file diff --git a/e107_plugins/import/providers/html_import_class.php b/e107_plugins/import/providers/html_import_class.php index 8874051ec..2538dd16d 100644 --- a/e107_plugins/import/providers/html_import_class.php +++ b/e107_plugins/import/providers/html_import_class.php @@ -14,15 +14,21 @@ * $Author: secretr $ */ -$import_class_names['html_import'] = 'HTML'; -$import_class_comment['html_import'] = 'Import content from an html website. eg. created with Frontpage, Dreamweaver or Notepad etc. '; -$import_class_support['html_import'] = array('news','page'); -$import_default_prefix['html_import'] = ''; +//$import_class_names['html_import'] = 'HTML'; +//$import_class_comment['html_import'] = 'Import content from an html website. eg. created with Frontpage, Dreamweaver or Notepad etc. '; +//$import_class_support['html_import'] = array('news','page'); +//$import_default_prefix['html_import'] = ''; require_once('import_classes.php'); class html_import extends base_import_class { + public $title = 'HTML'; + public $description = 'Import content from an html website. eg. created with Frontpage, Dreamweaver or Notepad etc. '; + public $supported = array('news','page'); + public $mprefix = false; + + public $override = true; var $sourceType = 'rss'; var $feedUrl = null; @@ -36,7 +42,6 @@ class html_import extends base_import_class function init() { $this->feedUrl = vartrue($_POST['siteUrl'],false); - $this->feedUrl = "http://drboylan.com/"; $this->feedUrl = rtrim($this->feedUrl,"/"); if($_POST['preview']) @@ -100,27 +105,10 @@ class html_import extends base_import_class $this->arrayData = array(); print_a($_POST); - - - - - - - - - - - - - - - - - - - + + $file = $this->feedUrl; - + switch ($task) { case 'news' : diff --git a/e107_plugins/import/providers/ikonboard_import_class.php b/e107_plugins/import/providers/ikonboard_import_class.php index ad4df2007..deba8097d 100644 --- a/e107_plugins/import/providers/ikonboard_import_class.php +++ b/e107_plugins/import/providers/ikonboard_import_class.php @@ -20,15 +20,18 @@ // 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 { + public $title = 'Ikonboard'; + public $description = 'About Sept 2007'; + public $supported = array('users'); + public $mprefix = 'ib_'; + + + // 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 diff --git a/e107_plugins/import/providers/joomla_import_class.php b/e107_plugins/import/providers/joomla_import_class.php index e8f37d4f0..8befab5b2 100644 --- a/e107_plugins/import/providers/joomla_import_class.php +++ b/e107_plugins/import/providers/joomla_import_class.php @@ -18,10 +18,10 @@ // 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_'; +//$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 @@ -29,24 +29,32 @@ require_once('import_classes.php'); class joomla_import extends base_import_class { + + public $title = 'Joomla'; + public $description = 'Untested - need feedback from users '; + public $supported = array('users'); + public $mprefix = 'jos_'; + + + // 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) + function setupQuery($task, $blank_user=FALSE) { - case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); - if ($result === FALSE) return FALSE; - break; - default : - return 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; } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; - } //------------------------------------ @@ -54,28 +62,31 @@ class joomla_import extends base_import_class //------------------------------------ // 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) + function copyUserData(&$target, &$source) { - $target['user_perms'] = '0.'; + 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; + } } - - $target['user_lastvisit'] = $source['lastvisitDate']; - $target['user_login'] = $source['name']; - $target['user_ban'] = ($source['block'] ? 2 : 0); - - return $target; - } } diff --git a/e107_plugins/import/providers/livejournal_import_class.php b/e107_plugins/import/providers/livejournal_import_class.php index 3be4134cb..67c9c480d 100644 --- a/e107_plugins/import/providers/livejournal_import_class.php +++ b/e107_plugins/import/providers/livejournal_import_class.php @@ -15,15 +15,23 @@ // require_once('import_classes.php'); require_once('rss_import_class.php'); -$import_class_names['livejournal_import'] = 'LiveJournal'; -$import_class_comment['livejournal_import'] = 'Import up to 500 items from yourblog.livejournal.com'; -$import_class_support['livejournal_import'] = array('news'); -$import_default_prefix['livejournal_import'] = ''; +//$import_class_names['livejournal_import'] = 'LiveJournal'; +//$import_class_comment['livejournal_import'] = 'Import up to 500 items from yourblog.livejournal.com'; +//$import_class_support['livejournal_import'] = array('news'); +//$import_default_prefix['livejournal_import'] = ''; class livejournal_import extends rss_import { - var $cleanupHtml = false; - var $defaultClass = false; + + + public $title = 'LiveJournal'; + public $description = 'Import up to 500 items from yourblog.livejournal.com'; + public $supported = array('news'); + public $mprefix = false; + + + var $cleanupHtml = false; + var $defaultClass = false; /* */ diff --git a/e107_plugins/import/providers/mambo_import_class.php b/e107_plugins/import/providers/mambo_import_class.php index 2b73ccf11..d89a76cab 100644 --- a/e107_plugins/import/providers/mambo_import_class.php +++ b/e107_plugins/import/providers/mambo_import_class.php @@ -18,10 +18,7 @@ // 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 @@ -29,24 +26,31 @@ require_once('import_classes.php'); class mambo_import extends base_import_class { + + public $title = 'Mambo'; + public $description = 'Import data from Mambo CMS'; + public $supported = array('users'); + public $mprefix = 'mos_'; + + // 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) + function setupQuery($task, $blank_user=FALSE) { - case 'users' : - $result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users"); - if ($result === FALSE) return FALSE; - break; - default : - return 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; } - $this->copyUserInfo = !$blank_user; - $this->currentTask = $task; - return TRUE; - } //------------------------------------ @@ -54,22 +58,22 @@ class mambo_import extends base_import_class //------------------------------------ // 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; - } + 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; + } } diff --git a/e107_plugins/import/providers/phpbb2_import_class.php b/e107_plugins/import/providers/phpbb2_import_class.php index 89d6a0cab..83ce8a2b1 100644 --- a/e107_plugins/import/providers/phpbb2_import_class.php +++ b/e107_plugins/import/providers/phpbb2_import_class.php @@ -28,19 +28,22 @@ To do: // 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 + public $title = 'PHPBB Version 2/3'; + public $description = 'Should do most versions, and Dragonfly'; + public $supported = array('users'); + public $mprefix = 'phpbb_'; + + + + 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. diff --git a/e107_plugins/import/providers/rss_import_class.php b/e107_plugins/import/providers/rss_import_class.php index 793f78b7d..7263bcad7 100644 --- a/e107_plugins/import/providers/rss_import_class.php +++ b/e107_plugins/import/providers/rss_import_class.php @@ -21,18 +21,26 @@ // 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'] = 'Import content via RSS v2.0 feeds from virtually any website.'; -$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 { - var $sourceType = 'rss'; - var $feedUrl = null; - var $defaultClass = false; + + public $title = 'RSS'; + public $description = 'Import content via RSS v2.0 feeds from virtually any website.'; + public $supported = array('news','page','links'); + public $mprefix = false; + public $sourceType = 'rss'; + + + + var $feedUrl = null; + var $defaultClass = false; + + + function init() { @@ -42,7 +50,7 @@ class rss_import extends base_import_class function config() { $var[0]['caption'] = "Feed URL"; - $var[0]['html'] = ""; + $var[0]['html'] = ""; return $var; } @@ -52,10 +60,15 @@ class rss_import extends base_import_class // Returns TRUE on success. FALSE on error function setupQuery($task, $blank_user=FALSE) { + $mes = e107::getMessage(); + $this->arrayData = array(); $xml = e107::getXml(); $file = $this->feedUrl; + + $mes->addDebug("rss_import::setupQuery - \$task: ".$task); + $mes->addDebug("rss_import::setupQuery - \$file: ".$file); switch ($task) { @@ -66,7 +79,15 @@ class rss_import extends base_import_class // $rawData = $xml->getRemoteFile($file); // print_a($rawData); $array = $xml->loadXMLfile($file,'advanced'); - if ($array === FALSE || $file === FALSE) return FALSE; + + // $mes->addDebug("rss - setupQuery - RSS array: ".print_a($array,true)); + + if ($array === FALSE || $file === FALSE) + { + $mes->addError("No data returned from : ".$file); + return FALSE; + } + foreach($array['channel']['item'] as $val) { @@ -119,10 +140,9 @@ class rss_import extends base_import_class $body = $content; } - $body = $this->saveImages($body,'news'); - $keywords = $this->process('category',$source); - - + $body = $this->saveImages($body,'news'); + $keywords = $this->process('category',$source); + if(!vartrue($source['title'][0])) { list($title,$newbody) = explode("
",$body,2); @@ -288,13 +308,15 @@ class rss_import extends base_import_class foreach($matches[0] as $link) { + $filename = basename($link); + if(file_exists($relPath."/".$filename)) { continue; } - $filename = basename($link); $fl->getRemoteFile($link,$relPath."/".$filename,'media'); + $search[] = $link; $replace[] = $tp->createConstants(e_MEDIA.$relPath."/".$filename,1); } diff --git a/e107_plugins/import/providers/smf_import_class.php b/e107_plugins/import/providers/smf_import_class.php index de4cf5b70..a919462aa 100644 --- a/e107_plugins/import/providers/smf_import_class.php +++ b/e107_plugins/import/providers/smf_import_class.php @@ -18,16 +18,21 @@ // 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 { + + public $title = 'SMF (Simple Machines Forum)'; + public $description = 'Supports users only'; + public $supported = array('news','page','links'); + public $mprefix = array('users'); + public $sourceType = 'db'; + + + // Set up a query for the specified task. // Returns TRUE on success. FALSE on error function setupQuery($task, $blank_user=FALSE) diff --git a/e107_plugins/import/providers/wordpress_import_class.php b/e107_plugins/import/providers/wordpress_import_class.php index 5681f76ce..6a21f5c49 100644 --- a/e107_plugins/import/providers/wordpress_import_class.php +++ b/e107_plugins/import/providers/wordpress_import_class.php @@ -21,15 +21,23 @@ // 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 3.4.x (salted passwords)'; -$import_class_support['wordpress_import'] = array('users','news','page','links'); -$import_default_prefix['wordpress_import'] = 'wp_'; +//$import_class_names['wordpress_import'] = 'Wordpress'; +//$import_class_comment['wordpress_import'] = 'Tested with version 3.4.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 { + public $title = 'Wordpress'; + public $description = 'Tested with version 3.4.x (salted passwords)'; + public $supported = array('users','news','page','links'); + public $mprefix = 'wp_'; + + + + // Set up a query for the specified task. // Returns TRUE on success. FALSE on error function setupQuery($task, $blank_user=FALSE)