mirror of
https://github.com/e107inc/e107.git
synced 2025-07-27 01:40:22 +02:00
Import: PHP-Nuke News items and Categories. PHPFusion userclasses added. Template added for easily adding other systems.
This commit is contained in:
@@ -94,19 +94,21 @@ class import_main_ui extends e_admin_ui
|
|||||||
// Definitions of available areas to import
|
// Definitions of available areas to import
|
||||||
protected $importTables = array(
|
protected $importTables = array(
|
||||||
'users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'),
|
'users' => array('message' => LAN_CONVERT_25, 'classfile' => 'import_user_class.php', 'classname' => 'user_import'),
|
||||||
|
'userclass' => array('message' => "Userclasses", 'nolist'=>true, 'classfile' => 'import_user_class.php', 'classname' => 'userclass_import'),
|
||||||
|
|
||||||
'news' => array('message' => LAN_CONVERT_28, 'classfile' => 'import_news_class.php', 'classname' => 'news_import'),
|
'news' => array('message' => LAN_CONVERT_28, 'classfile' => 'import_news_class.php', 'classname' => 'news_import'),
|
||||||
|
'newscategory' => array('message' => "News Categories", 'nolist'=>true, 'classfile' => 'import_news_class.php', 'classname' => 'newscategory_import'),
|
||||||
|
|
||||||
'page' => array('message' => "Pages", 'classfile' => 'import_page_class.php', 'classname' => 'page_import'),
|
'page' => array('message' => "Pages", 'classfile' => 'import_page_class.php', 'classname' => 'page_import'),
|
||||||
'pagechapter' => array('message' => "Page Chapters", 'classfile' => 'import_pagechapter_class.php', 'classname' => 'pagechapter_import'),
|
'pagechapter' => array('message' => "Page Chapters", 'nolist'=>true, 'classfile' => 'import_page_class.php', 'classname' => 'pagechapter_import'),
|
||||||
'links' => array('message' => "Links", 'classfile' => 'import_links_class.php', 'classname' => 'links_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'),
|
'media' => array('message' => "Media", 'classfile' => 'import_media_class.php', 'classname' => 'media_import'),
|
||||||
'forum' => array('message' => "Forum", 'classfile' => 'import_forum_class.php', 'classname' => 'forum_import'),
|
'forum' => array('message' => "Forum", 'classfile' => 'import_forum_class.php', 'classname' => 'forum_import'),
|
||||||
'forumthread' => array('message' => "Forum Topics/Threads", 'classfile' => 'import_forum_class.php', 'classname' => 'forumthread_import', 'nolist'=>true),
|
'forumthread' => array('message' => "Forum Topics/Threads", 'classfile' => 'import_forum_class.php', 'classname' => 'forumthread_import', 'nolist'=>true),
|
||||||
'forumpost' => array('message' => "Forum Posts", 'classfile' => 'import_forum_class.php', 'classname' => 'forumpost_import', 'nolist'=>true),
|
'forumpost' => array('message' => "Forum Posts", 'classfile' => 'import_forum_class.php', 'classname' => 'forumpost_import', 'nolist'=>true),
|
||||||
'forumtrack' => array('message' => "Forum Track", 'classfile' => 'import_forum_class.php', 'classname' => 'forumtrack_import', 'nolist'=>true),
|
'forumtrack' => array('message' => "Forum Track", 'classfile' => 'import_forum_class.php', 'classname' => 'forumtrack_import', 'nolist'=>true),
|
||||||
// 'forumpost' => array('message' => "Media", 'classfile' => 'import_media_class.php', 'classname' => 'media_import'),
|
// 'comments' => array('message'=> LAN_COMMENTS),
|
||||||
'comments' => array('message'=> LAN_COMMENTS),
|
|
||||||
// 'forumdefs' => array('message' => LAN_CONVERT_26),
|
|
||||||
// 'forumposts' => array('message' => LAN_CONVERT_48),
|
|
||||||
// 'polls' => array('message' => LAN_CONVERT_27)
|
// 'polls' => array('message' => LAN_CONVERT_27)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -122,26 +124,31 @@ class import_main_ui extends e_admin_ui
|
|||||||
|
|
||||||
foreach($importClassList as $file)
|
foreach($importClassList as $file)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$tag = str_replace('_class.php','',$file['fname']);
|
$tag = str_replace('_class.php','',$file['fname']);
|
||||||
|
|
||||||
$key = str_replace("_import_class.php","",$file['fname']);
|
$key = str_replace("_import_class.php","",$file['fname']);
|
||||||
|
|
||||||
|
if($key === 'template')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
include_once($file['path'].$file['fname']); // This will set up the variables
|
include_once($file['path'].$file['fname']); // This will set up the variables
|
||||||
|
|
||||||
$this->providers[$key] = $this->getMeta($tag);
|
$this->providers[$key] = $this->getMeta($tag);
|
||||||
|
|
||||||
if(vartrue($_GET['type']))
|
if(!empty($_GET['type']))
|
||||||
{
|
{
|
||||||
$this->importClass = $_GET['type']."_import";
|
$this->importClass = filter_var($_GET['type'])."_import";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uksort($this->providers,'strcasecmp');
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
natsort($this->providers);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,13 +243,20 @@ class import_main_ui extends e_admin_ui
|
|||||||
<legend class='e-hideme'>".'DBLAN_10'."</legend>
|
<legend class='e-hideme'>".'DBLAN_10'."</legend>
|
||||||
".$frm->hidden('mode','main')."
|
".$frm->hidden('mode','main')."
|
||||||
".$frm->hidden('action','import')."
|
".$frm->hidden('action','import')."
|
||||||
<table class='table adminlist table-striped table-bordered'>
|
<table class='table table-striped table-bordered'>
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
<col />";
|
||||||
|
|
||||||
|
foreach($this->importTables as $key=>$val)
|
||||||
|
{
|
||||||
|
if(!empty($val['nolist'])){ continue; }
|
||||||
|
$text .= "<col style='width:5%' />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$text .= "
|
||||||
<col />
|
<col />
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
<col />
|
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -282,7 +296,7 @@ class import_main_ui extends e_admin_ui
|
|||||||
|
|
||||||
$iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png";
|
$iconFile = e_PLUGIN."import/images/".str_replace("_import","",strtolower($k)).".png";
|
||||||
|
|
||||||
$icon = (file_exists($iconFile)) ? "<img src='{$iconFile}' alt='' style='float:left;height:32px;width:32px;margin-right:4px'>" : "";
|
$icon = (file_exists($iconFile)) ? "<img src='{$iconFile}' alt='' style='float:left;height:32px;width:32px;margin-right:8px'>" : "";
|
||||||
|
|
||||||
$text .= "<!-- $title -->
|
$text .= "<!-- $title -->
|
||||||
<tr><td >".$icon.$title."<div class='smalltext'>".$info['description']."</div></td>\n";
|
<tr><td >".$icon.$title."<div class='smalltext'>".$info['description']."</div></td>\n";
|
||||||
|
@@ -64,10 +64,18 @@ class base_import_class
|
|||||||
return $this->saveUserData($dataRecord);
|
return $this->saveUserData($dataRecord);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'userclass' :
|
||||||
|
return $this->saveUserClassData($dataRecord);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'news' :
|
case 'news' :
|
||||||
return $this->saveNewsData($dataRecord);
|
return $this->saveNewsData($dataRecord);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'newscategory' :
|
||||||
|
return $this->saveNewsCategoryData($dataRecord);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'page' :
|
case 'page' :
|
||||||
return $this->savePageData($dataRecord);
|
return $this->savePageData($dataRecord);
|
||||||
break;
|
break;
|
||||||
@@ -131,10 +139,18 @@ class base_import_class
|
|||||||
return $this->copyUserData($initial, $result);
|
return $this->copyUserData($initial, $result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'userclass' :
|
||||||
|
return $this->copyUserClassData($initial, $result);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'news' :
|
case 'news' :
|
||||||
return $this->copyNewsData($initial, $result);
|
return $this->copyNewsData($initial, $result);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'newscategory' :
|
||||||
|
return $this->copyNewsCategoryData($initial, $result);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'page' :
|
case 'page' :
|
||||||
return $this->copyPageData($initial, $result);
|
return $this->copyPageData($initial, $result);
|
||||||
break;
|
break;
|
||||||
@@ -197,11 +213,21 @@ class base_import_class
|
|||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyUserClassData(&$target, &$source)
|
||||||
|
{
|
||||||
|
return $target;
|
||||||
|
}
|
||||||
|
|
||||||
function copyNewsData(&$target, &$source)
|
function copyNewsData(&$target, &$source)
|
||||||
{
|
{
|
||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyNewsCategoryData(&$target, &$source)
|
||||||
|
{
|
||||||
|
return $target;
|
||||||
|
}
|
||||||
|
|
||||||
function copyPageData(&$target, &$source)
|
function copyPageData(&$target, &$source)
|
||||||
{
|
{
|
||||||
return $target;
|
return $target;
|
||||||
@@ -242,7 +268,44 @@ class base_import_class
|
|||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $source
|
||||||
|
* @param $target
|
||||||
|
*/
|
||||||
|
public function debug($source,$target)
|
||||||
|
{
|
||||||
|
echo "<table style='width:100%'>
|
||||||
|
<tr><th>Source CMS</th><th>Target e107</th></tr>
|
||||||
|
<tr>
|
||||||
|
<td style='vertical-align:top'>".$this->renderTable($source)."</td>
|
||||||
|
<td style='vertical-align:top'>".$this->renderTable($target)."</td>
|
||||||
|
</tr>
|
||||||
|
</table>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renderTable($source)
|
||||||
|
{
|
||||||
|
$text = "<table class='table table-striped table-bordered'>
|
||||||
|
<tr><th>Field</th><th>Data</th></tr>";
|
||||||
|
|
||||||
|
foreach($source as $k=>$v)
|
||||||
|
{
|
||||||
|
$text .= "<tr>
|
||||||
|
<td style='width:50%;'>".$k."</td>
|
||||||
|
<td>".htmlentities($v)."</td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= "
|
||||||
|
</table>
|
||||||
|
";
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================
|
//===========================================================
|
||||||
// UTILITY ROUTINES
|
// UTILITY ROUTINES
|
||||||
|
@@ -66,16 +66,14 @@ class news_import
|
|||||||
// Constructor
|
// Constructor
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
global $sql;
|
$this->newsDB = e107::getDb('news'); // Have our own database object to write to the news table
|
||||||
$this->newsDB = new db; // Have our own database object to write to the news table
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Empty the news DB
|
// Empty the news DB
|
||||||
function emptyTargetDB($inc_admin = FALSE)
|
function emptyTargetDB($inc_admin = FALSE)
|
||||||
{
|
{
|
||||||
// leave existing
|
$this->newsDB->truncate('news');
|
||||||
// $this->newsDB->db_Delete('news');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +101,7 @@ class news_import
|
|||||||
*/
|
*/
|
||||||
function saveData($row)
|
function saveData($row)
|
||||||
{
|
{
|
||||||
if(!$result = $this->newsDB->db_Insert('news',$row))
|
if(!$result = $this->newsDB->insert('news',$row))
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
@@ -135,6 +133,90 @@ class news_import
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class newscategory_import
|
||||||
|
{
|
||||||
|
var $newsDB = NULL;
|
||||||
|
var $blockMainAdmin = TRUE;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
var $default = array(
|
||||||
|
|
||||||
|
// 'category_id' => '', // auto-increment
|
||||||
|
'category_name' => '',
|
||||||
|
'category_sef' => '',
|
||||||
|
'category_meta_description' => '',
|
||||||
|
'category_meta_keywords' => '',
|
||||||
|
'category_manager' => e_UC_ADMIN,
|
||||||
|
'category_icon' => '',
|
||||||
|
'category_order' => 0,
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Fields which must be set up by the caller. */
|
||||||
|
var $mandatory = array(
|
||||||
|
'category_id',
|
||||||
|
'category_name',
|
||||||
|
);
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->newsDB = e107::getDb('newscat'); // Have our own database object to write to the news table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Empty the news DB
|
||||||
|
function emptyTargetDB($inc_admin = FALSE)
|
||||||
|
{
|
||||||
|
$this->newsDB->truncate('news_category');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set a new default for a particular field
|
||||||
|
function overrideDefault($key, $value)
|
||||||
|
{
|
||||||
|
// echo "Override: {$key} => {$value}<br />";
|
||||||
|
if (!isset($this->default[$key])) return FALSE;
|
||||||
|
$this->default[$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns an array with all relevant fields set to the current default
|
||||||
|
function getDefaults()
|
||||||
|
{
|
||||||
|
return $this->default;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert data into e107 DB
|
||||||
|
* @param row - array of table data
|
||||||
|
* @return integer, boolean - error code on failure, TRUE on success
|
||||||
|
*/
|
||||||
|
function saveData($row)
|
||||||
|
{
|
||||||
|
if(!$result = $this->newsDB->insert('news_category',$row))
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
||||||
|
{
|
||||||
|
return $this->newsDB->getLastErrorText();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -109,6 +109,122 @@ class page_import
|
|||||||
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
||||||
{
|
{
|
||||||
return $this->pageDB->getLastErrorText();
|
return $this->pageDB->getLastErrorText();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class pagechapter_import
|
||||||
|
{
|
||||||
|
var $pageDB = null;
|
||||||
|
var $blockMainAdmin = true;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
var $defaults = array(
|
||||||
|
'chapter_id' => '',
|
||||||
|
'chapter_parent' => 1,
|
||||||
|
'chapter_name' => '',
|
||||||
|
'chapter_sef' => '',
|
||||||
|
'chapter_meta_description' => '',
|
||||||
|
'chapter_meta_keywords' => '',
|
||||||
|
'chapter_manager' => e_UC_ADMIN,
|
||||||
|
'chapter_icon' => '',
|
||||||
|
'chapter_order' => 0,
|
||||||
|
'chapter_template' => 'default',
|
||||||
|
'chapter_visibility' => 0,
|
||||||
|
'chapter_fields' => null
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
// Fields which must be set up by the caller.
|
||||||
|
var $mandatory = array(
|
||||||
|
'chapter_name'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->pageDB = e107::getDb('pagechapter'); // Have our own database object to write to the table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Empty the DB
|
||||||
|
function emptyTargetDB($inc_admin = FALSE)
|
||||||
|
{
|
||||||
|
$this->pageDB->truncate('page_chapters');
|
||||||
|
|
||||||
|
$insert = array(
|
||||||
|
'chapter_id' => '1',
|
||||||
|
'chapter_parent' => '0',
|
||||||
|
'chapter_name' => 'General',
|
||||||
|
'chapter_sef' => 'general',
|
||||||
|
'chapter_meta_description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et tempor odio. Quisque volutpat lorem nec lectus congue suscipit. In hac habitasse platea dictumst. Etiam odio nisi, egestas vitae amet.',
|
||||||
|
'chapter_meta_keywords' => '',
|
||||||
|
'chapter_manager' => '0',
|
||||||
|
'chapter_icon' => '',
|
||||||
|
'chapter_order' => '0',
|
||||||
|
'chapter_template' => 'default',
|
||||||
|
'chapter_visibility' => '0',
|
||||||
|
'chapter_fields' => null
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
$this->pageDB->insert('page_chapters',$insert); // insert a default book.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set a new default for a particular field
|
||||||
|
function overrideDefault($key, $value)
|
||||||
|
{
|
||||||
|
// echo "Override: {$key} => {$value}<br />";
|
||||||
|
if (!isset($this->defaults[$key])) return FALSE;
|
||||||
|
$this->defaults[$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns an array with all relevant fields set to the current default
|
||||||
|
function getDefaults()
|
||||||
|
{
|
||||||
|
return $this->defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert data into e107 DB
|
||||||
|
* @param row - array of table data
|
||||||
|
* @return integer, boolean - error code on failure, TRUE on success
|
||||||
|
*/
|
||||||
|
function saveData($row)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(empty($row['chapter_name']))
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!$result = $this->pageDB->insert('page_chapters',$row))
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ($result === FALSE) return 6;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
||||||
|
{
|
||||||
$errorTexts = array(
|
$errorTexts = array(
|
||||||
0 => 'No error',
|
0 => 'No error',
|
||||||
1 => 'Can\'t change main admin data',
|
1 => 'Can\'t change main admin data',
|
||||||
@@ -121,7 +237,7 @@ class page_import
|
|||||||
|
|
||||||
if (isset($errorTexts[$errnum])) return $errorTexts[$errnum];
|
if (isset($errorTexts[$errnum])) return $errorTexts[$errnum];
|
||||||
|
|
||||||
return 'Unknown: '.$errnum;
|
return $this->pageDB->getLastErrorText();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,154 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* e107 website system
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
|
||||||
* Released under the terms and conditions of the
|
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/import_user_class.php,v $
|
|
||||||
* $Revision: 11315 $
|
|
||||||
* $Date: 2010-02-10 10:18:01 -0800 (Wed, 10 Feb 2010) $
|
|
||||||
* $Author: secretr $
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Class intended to simplify importing of user information from outside.
|
|
||||||
It ensures that each user record has appropriate defaults
|
|
||||||
|
|
||||||
To use:
|
|
||||||
1. Create one instance of the class
|
|
||||||
2. Call emptyUserDB() to delete existing users
|
|
||||||
3. If necessary, call overrideDefault() as necessary to modify the defaults
|
|
||||||
4. For each record:
|
|
||||||
a) Call getDefaults() to get a record with all the defaults filled in
|
|
||||||
b) Update the record from the source database
|
|
||||||
c) Call saveUser($userRecord) to write the record to the DB
|
|
||||||
*/
|
|
||||||
|
|
||||||
class pagechapter_import
|
|
||||||
{
|
|
||||||
var $pageDB = null;
|
|
||||||
var $blockMainAdmin = true;
|
|
||||||
var $error;
|
|
||||||
|
|
||||||
var $defaults = array(
|
|
||||||
'chapter_id' => '',
|
|
||||||
'chapter_parent' => 1,
|
|
||||||
'chapter_name' => '',
|
|
||||||
'chapter_sef' => '',
|
|
||||||
'chapter_meta_description' => '',
|
|
||||||
'chapter_meta_keywords' => '',
|
|
||||||
'chapter_manager' => e_UC_ADMIN,
|
|
||||||
'chapter_icon' => '',
|
|
||||||
'chapter_order' => 0,
|
|
||||||
'chapter_template' => 'default',
|
|
||||||
'chapter_visibility' => 0,
|
|
||||||
'chapter_fields' => null
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
// Fields which must be set up by the caller.
|
|
||||||
var $mandatory = array(
|
|
||||||
'chapter_name'
|
|
||||||
);
|
|
||||||
|
|
||||||
// Constructor
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
$this->pageDB = e107::getDb('pagechapter'); // Have our own database object to write to the table
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Empty the DB
|
|
||||||
function emptyTargetDB($inc_admin = FALSE)
|
|
||||||
{
|
|
||||||
$this->pageDB->truncate('page_chapters');
|
|
||||||
|
|
||||||
$insert = array(
|
|
||||||
'chapter_id' => '1',
|
|
||||||
'chapter_parent' => '0',
|
|
||||||
'chapter_name' => 'General',
|
|
||||||
'chapter_sef' => 'general',
|
|
||||||
'chapter_meta_description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et tempor odio. Quisque volutpat lorem nec lectus congue suscipit. In hac habitasse platea dictumst. Etiam odio nisi, egestas vitae amet.',
|
|
||||||
'chapter_meta_keywords' => '',
|
|
||||||
'chapter_manager' => '0',
|
|
||||||
'chapter_icon' => '',
|
|
||||||
'chapter_order' => '0',
|
|
||||||
'chapter_template' => 'default',
|
|
||||||
'chapter_visibility' => '0',
|
|
||||||
'chapter_fields' => null
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
$this->pageDB->insert('page_chapters',$insert); // insert a default book.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set a new default for a particular field
|
|
||||||
function overrideDefault($key, $value)
|
|
||||||
{
|
|
||||||
// echo "Override: {$key} => {$value}<br />";
|
|
||||||
if (!isset($this->defaults[$key])) return FALSE;
|
|
||||||
$this->defaults[$key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Returns an array with all relevant fields set to the current default
|
|
||||||
function getDefaults()
|
|
||||||
{
|
|
||||||
return $this->defaults;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert data into e107 DB
|
|
||||||
* @param row - array of table data
|
|
||||||
* @return integer, boolean - error code on failure, TRUE on success
|
|
||||||
*/
|
|
||||||
function saveData($row)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(empty($row['chapter_name']))
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(!$result = $this->pageDB->insert('page_chapters',$row))
|
|
||||||
{
|
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
//if ($result === FALSE) return 6;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
|
||||||
{
|
|
||||||
$errorTexts = array(
|
|
||||||
0 => 'No error',
|
|
||||||
1 => 'Can\'t change main admin data',
|
|
||||||
2 => 'invalid field passed',
|
|
||||||
3 => 'Mandatory field not set',
|
|
||||||
4 => 'Entry already exists',
|
|
||||||
5 => 'Invalid characters in user or login name',
|
|
||||||
6 => 'Error saving extended user fields'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (isset($errorTexts[$errnum])) return $errorTexts[$errnum];
|
|
||||||
|
|
||||||
return 'Unknown: '.$errnum;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@@ -253,4 +253,111 @@ class user_import
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class userclass_import
|
||||||
|
{
|
||||||
|
var $ucdb = null;
|
||||||
|
var $blockMainAdmin = true;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
var $defaults = array(
|
||||||
|
'userclass_id' => 0,
|
||||||
|
'userclass_name' => 0,
|
||||||
|
'userclass_description' => 0,
|
||||||
|
'userclass_editclass' => 0,
|
||||||
|
'userclass_parent' => 0,
|
||||||
|
'userclass_accum' => 0,
|
||||||
|
'userclass_visibility' => 0,
|
||||||
|
'userclass_type' => 0,
|
||||||
|
'userclass_icon' => 0,
|
||||||
|
'userclass_perms' => 0,
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
// Fields which must be set up by the caller.
|
||||||
|
var $mandatory = array(
|
||||||
|
'userclass_name'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->ucdb = e107::getDb('pagechapter'); // Have our own database object to write to the table
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Empty the DB
|
||||||
|
function emptyTargetDB($inc_admin = FALSE)
|
||||||
|
{
|
||||||
|
$this->ucdb->truncate('userclass_classes');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set a new default for a particular field
|
||||||
|
function overrideDefault($key, $value)
|
||||||
|
{
|
||||||
|
// echo "Override: {$key} => {$value}<br />";
|
||||||
|
if (!isset($this->defaults[$key])) return FALSE;
|
||||||
|
$this->defaults[$key] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns an array with all relevant fields set to the current default
|
||||||
|
function getDefaults()
|
||||||
|
{
|
||||||
|
return $this->defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert data into e107 DB
|
||||||
|
* @param row - array of table data
|
||||||
|
* @return integer, boolean - error code on failure, TRUE on success
|
||||||
|
*/
|
||||||
|
function saveData($row)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(empty($row['userclass_name']))
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!$result = $this->ucdb->insert('userclass_classes',$row))
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if ($result === FALSE) return 6;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getErrorText($errnum) // these errors are presumptuous and misleading. especially '4' .
|
||||||
|
{
|
||||||
|
$errorTexts = array(
|
||||||
|
0 => 'No error',
|
||||||
|
1 => 'Can\'t change main admin data',
|
||||||
|
2 => 'invalid field passed',
|
||||||
|
3 => 'Mandatory field not set',
|
||||||
|
4 => 'Entry already exists',
|
||||||
|
5 => 'Invalid characters in user or login name',
|
||||||
|
6 => 'Error saving extended user fields'
|
||||||
|
);
|
||||||
|
|
||||||
|
if (isset($errorTexts[$errnum])) return $errorTexts[$errnum];
|
||||||
|
|
||||||
|
return $this->ucdb->getLastErrorText();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@@ -25,9 +25,9 @@ class PHPFusion_import extends base_import_class
|
|||||||
{
|
{
|
||||||
|
|
||||||
public $title = 'PHP Fusion';
|
public $title = 'PHP Fusion';
|
||||||
public $description = 'Based on V5.1';
|
public $description = 'Based on v9';
|
||||||
public $supported = array('users');
|
public $supported = array('users', 'userclass');
|
||||||
public $mprefix = false;
|
public $mprefix = 'fusion_';
|
||||||
|
|
||||||
// Set up a query for the specified task.
|
// Set up a query for the specified task.
|
||||||
// Returns TRUE on success. FALSE on error
|
// Returns TRUE on success. FALSE on error
|
||||||
@@ -37,9 +37,17 @@ class PHPFusion_import extends base_import_class
|
|||||||
switch ($task)
|
switch ($task)
|
||||||
{
|
{
|
||||||
case 'users' :
|
case 'users' :
|
||||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users");
|
$result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users");
|
||||||
if ($result === FALSE) return FALSE;
|
if ($result === FALSE) return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'userclass' :
|
||||||
|
$result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}user_groups");
|
||||||
|
if ($result === FALSE) return FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -80,9 +88,266 @@ class PHPFusion_import extends base_import_class
|
|||||||
// $target['user_'] = $source[''];
|
// $target['user_'] = $source[''];
|
||||||
|
|
||||||
// $target['user_ban'] = ($source['user_status'] ? 2 : 0); // Guess
|
// $target['user_ban'] = ($source['user_status'] ? 2 : 0); // Guess
|
||||||
return $target;
|
|
||||||
|
|
||||||
|
|
||||||
|
//return $target;
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 copyUserClassData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['userclass_id'] = $source['group_id'];
|
||||||
|
$target['userclass_name'] = $source['group_name'];
|
||||||
|
$target['userclass_description'] = $source['group_description'];
|
||||||
|
$target['userclass_editclass'] = e_UC_ADMIN;
|
||||||
|
$target['userclass_parent'] = 0;
|
||||||
|
$target['userclass_accum'] = '';
|
||||||
|
$target['userclass_visibility'] = e_UC_ADMIN;
|
||||||
|
$target['userclass_type'] = '';
|
||||||
|
$target['userclass_icon'] = '';
|
||||||
|
$target['userclass_perms'] = '';
|
||||||
|
|
||||||
|
// return $target;
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data with e107 News Table
|
||||||
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyNewsData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['news_id'] = $source['']; // leave empty to auto-increment.
|
||||||
|
$target['news_title'] = $source[''];
|
||||||
|
$target['news_sef'] = $source[''];
|
||||||
|
$target['news_body'] = $source['']; // wrap in [html] tags if required.
|
||||||
|
$target['news_extended'] = $source['']; // wrap in [html] tags if required.
|
||||||
|
$target['news_meta_keywords'] = $source[''];
|
||||||
|
$target['news_meta_description'] = $source[''];
|
||||||
|
$target['news_datestamp'] = $source['datestamp'];
|
||||||
|
$target['news_author'] = $source[''];
|
||||||
|
$target['news_category'] = $source[''];
|
||||||
|
$target['news_allow_comments'] = $source[''];
|
||||||
|
$target['news_start'] = $source[''];
|
||||||
|
$target['news_end'] = $source[''];
|
||||||
|
$target['news_class'] = $source[''];
|
||||||
|
$target['news_render_type'] = $source[''];
|
||||||
|
$target['news_comment_total'] = $source[''];
|
||||||
|
$target['news_summary'] = $source[''];
|
||||||
|
$target['news_thumbnail'] = $source[''];
|
||||||
|
$target['news_sticky'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
// $this->renderDebug($source,$target);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data with e107 News Table
|
||||||
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyNewsCategoryData(&$target, &$source)
|
||||||
|
{
|
||||||
|
$target['category_id'] = $source[''];
|
||||||
|
$target['category_name'] = $source[''];
|
||||||
|
$target['category_sef'] = $source[''];
|
||||||
|
$target['category_meta_description'] = $source[''];
|
||||||
|
$target['category_meta_keywords'] = $source[''];
|
||||||
|
$target['category_manager'] = $source[''];
|
||||||
|
$target['category_icon'] = $source[''];
|
||||||
|
$target['category_order'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data to e107 Page Table
|
||||||
|
* @param $target array - default e107 target values for e107_page table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyPageData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$target['page_id'] = $source[''];
|
||||||
|
$target['page_title'] = $source[''];
|
||||||
|
$target['page_sef'] = $source[''];
|
||||||
|
$target['page_text'] = $source[''];
|
||||||
|
$target['page_metakeys'] = $source[''];
|
||||||
|
$target['page_metadscr'] = $source[''];
|
||||||
|
$target['page_datestamp'] = $source[''];
|
||||||
|
$target['page_author'] = $source[''];
|
||||||
|
$target['page_category'] = $source[''];
|
||||||
|
$target['page_comment_flag'] = $source[''];
|
||||||
|
$target['page_password'] = $source[''];
|
||||||
|
$target['page_class'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['forum_id'] = $source[''];
|
||||||
|
$target['forum_name'] = $source[''];
|
||||||
|
$target['forum_description'] = $source[''];
|
||||||
|
$target['forum_parent'] = $source[''];
|
||||||
|
$target['forum_sub'] = $source[''];
|
||||||
|
$target['forum_datestamp'] = $source[''];
|
||||||
|
$target['forum_moderators'] = $source[''];
|
||||||
|
|
||||||
|
$target['forum_threads'] = $source[''];
|
||||||
|
$target['forum_replies'] = $source[''];
|
||||||
|
$target['forum_lastpost_user'] = $source[''];
|
||||||
|
$target['forum_lastpost_user_anon'] = $source[''];
|
||||||
|
$target['forum_lastpost_info'] = $source[''];
|
||||||
|
$target['forum_class'] = $source[''];
|
||||||
|
$target['forum_order'] = $source[''];
|
||||||
|
$target['forum_postclass'] = $source[''];
|
||||||
|
$target['forum_threadclass'] = $source[''];
|
||||||
|
$target['forum_options'] = $source[''];
|
||||||
|
$target['forum_sef'] = $source[''];
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107 forum_threads
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumThreadData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['thread_id'] = $source[''];
|
||||||
|
$target['thread_name'] = $source[''];
|
||||||
|
$target['thread_forum_id'] = $source[''];
|
||||||
|
$target['thread_views'] = $source[''];
|
||||||
|
$target['thread_active'] = $source[''];
|
||||||
|
$target['thread_lastpost'] = $source[''];
|
||||||
|
$target['thread_sticky'] = $source[''];
|
||||||
|
$target['thread_datestamp'] = $source[''];
|
||||||
|
$target['thread_user'] = $source[''];
|
||||||
|
$target['thread_user_anon'] = $source[''];
|
||||||
|
$target['thread_lastuser'] = $source[''];
|
||||||
|
$target['thread_lastuser_anon'] = $source[''];
|
||||||
|
$target['thread_total_replies'] = $source[''];
|
||||||
|
$target['thread_options'] = $source[''];
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum_post table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumPostData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['post_id'] = $source[''];
|
||||||
|
$target['post_entry'] = $source[''];
|
||||||
|
$target['post_thread'] = $source[''];
|
||||||
|
$target['post_forum'] = $source[''];
|
||||||
|
$target['post_status'] = $source[''];
|
||||||
|
$target['post_datestamp'] = $source[''];
|
||||||
|
$target['post_user'] = $source[''];
|
||||||
|
$target['post_edit_datestamp'] = $source[''];
|
||||||
|
$target['post_edit_user'] = $source[''];
|
||||||
|
$target['post_ip'] = $source[''];
|
||||||
|
$target['post_user_anon'] = $source[''];
|
||||||
|
$target['post_attachments'] = $source[''];
|
||||||
|
$target['post_options'] = $source[''];
|
||||||
|
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
$this->debug($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)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* e107 Link Targets.
|
||||||
|
0 => LCLAN_20, // 0 = same window
|
||||||
|
1 => LCLAN_23, // new window
|
||||||
|
4 => LCLAN_24, // 4 = miniwindow 600x400
|
||||||
|
5 => LINKLAN_1 // 5 = miniwindow 800x600
|
||||||
|
*/
|
||||||
|
|
||||||
|
$target['link_id'] = $source['']; // leave blank to auto-increment
|
||||||
|
$target['link_name'] = $source[''];
|
||||||
|
$target['link_url'] = $source[''];
|
||||||
|
$target['link_description'] = $source['']; // wrap with [html] [/html] if necessary.
|
||||||
|
$target['link_button'] = $source['']; // image file.
|
||||||
|
$target['link_category'] = $source['']; // integer
|
||||||
|
$target['link_order'] = $source['']; // integer
|
||||||
|
$target['link_parent'] = $source['']; // integer
|
||||||
|
$target['link_open'] = $source['']; // link_target
|
||||||
|
$target['link_class'] = $source[''];
|
||||||
|
$target['link_sefurl'] = $source[''];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -26,25 +26,95 @@ class PHPNuke_import extends base_import_class
|
|||||||
|
|
||||||
|
|
||||||
public $title = 'PHP Nuke 8.2';
|
public $title = 'PHP Nuke 8.2';
|
||||||
public $description = 'Supports users only';
|
public $description = '';
|
||||||
public $supported = array('users'); // add news and page to test.
|
public $supported = array('users', 'news', 'newscategory'); // add news and page to test.
|
||||||
public $mprefix = 'nuke_';
|
public $mprefix = 'nuke_';
|
||||||
|
|
||||||
|
|
||||||
// Set up a query for the specified task.
|
// Set up a query for the specified task.
|
||||||
// Returns TRUE on success. FALSE on error
|
// Returns TRUE on success. false on error
|
||||||
function setupQuery($task, $blank_user=FALSE)
|
function setupQuery($task, $blank_user=false)
|
||||||
{
|
{
|
||||||
if ($this->ourDB == NULL) return FALSE;
|
if ($this->ourDB == NULL) return false;
|
||||||
switch ($task)
|
switch ($task)
|
||||||
{
|
{
|
||||||
case 'users' :
|
case 'users' :
|
||||||
$result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`=1");
|
$result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users WHERE `user_active`=1");
|
||||||
if ($result === FALSE) return FALSE;
|
if ($result === false) return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'news' :
|
||||||
|
$query = "SELECT *, UNIX_TIMESTAMP(time) as datestamp FROM {$this->DBPrefix}stories ORDER BY sid";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'newscategory' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}topics ORDER BY topicid";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'userclass' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'page' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pagechapter' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'media' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'links':
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'forum' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumthread' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumpost' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumtrack' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyUserInfo = !$blank_user;
|
$this->copyUserInfo = !$blank_user;
|
||||||
$this->currentTask = $task;
|
$this->currentTask = $task;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -91,113 +161,16 @@ class PHPNuke_import extends base_import_class
|
|||||||
$target['user_homepage'] = $source['user_website'];
|
$target['user_homepage'] = $source['user_website'];
|
||||||
$target['user_ip'] = $source['last_ip'];
|
$target['user_ip'] = $source['last_ip'];
|
||||||
|
|
||||||
return $target;
|
return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
// Php Nuke Field Reference.
|
|
||||||
$source['user_id'];
|
|
||||||
$source['name'];
|
|
||||||
$source['username'];
|
|
||||||
$source['user_email'];
|
|
||||||
$source['femail'];
|
|
||||||
$source['user_website'];
|
|
||||||
$source['user_avatar'];
|
|
||||||
$source['user_regdate'];
|
|
||||||
$source['user_icq'];
|
|
||||||
$source['user_occ'];
|
|
||||||
$source['user_from'];
|
|
||||||
$source['user_interests'];
|
|
||||||
$source['user_sig'];
|
|
||||||
$source['user_viewemail'];
|
|
||||||
$source['user_theme'];
|
|
||||||
$source['user_aim'];
|
|
||||||
$source['user_yim'];
|
|
||||||
$source['user_msnm'];
|
|
||||||
$source['user_password'];
|
|
||||||
$source['storynum'];
|
|
||||||
$source['umode'];
|
|
||||||
$source['uorder'];
|
|
||||||
$source['thold'];
|
|
||||||
$source['noscore'];
|
|
||||||
$source['bio'];
|
|
||||||
$source['ublockon'];
|
|
||||||
$source['ublock'];
|
|
||||||
$source['theme'];
|
|
||||||
$source['commentmax'];
|
|
||||||
$source['counter'];
|
|
||||||
$source['newsletter'];
|
|
||||||
$source['user_posts'];
|
|
||||||
$source['user_attachsig'];
|
|
||||||
$source['user_rank'];
|
|
||||||
$source['user_level'];
|
|
||||||
$source['broadcast'];
|
|
||||||
$source['popmeson'];
|
|
||||||
$source['user_active'];
|
|
||||||
$source['user_session_time'];
|
|
||||||
$source['user_session_page'];
|
|
||||||
$source['user_lastvisit'];
|
|
||||||
$source['user_timezone'];
|
|
||||||
$source['user_style'];
|
|
||||||
$source['user_lang'];
|
|
||||||
$source['user_dateformat'];
|
|
||||||
$source['user_new_privmsg'];
|
|
||||||
$source['user_unread_privmsg'];
|
|
||||||
$source['user_last_privmsg'];
|
|
||||||
$source['user_emailtime'];
|
|
||||||
$source['user_allowhtml'];
|
|
||||||
$source['user_allowbbcode'];
|
|
||||||
$source['user_allowsmile'];
|
|
||||||
$source['user_allowavatar'];
|
|
||||||
$source['user_allow_pm'];
|
|
||||||
$source['user_allow_viewonline'];
|
|
||||||
$source['user_notify'];
|
|
||||||
$source['user_notify_pm'];
|
|
||||||
$source['user_popup_pm'];
|
|
||||||
$source['user_avatar_type'];
|
|
||||||
$source['user_sig_bbcode_uid'];
|
|
||||||
$source['user_actkey'];
|
|
||||||
$source['user_newpasswd'];
|
|
||||||
$source['points'];
|
|
||||||
$source['last_ip'];
|
|
||||||
$source['karma'];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// old data.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->copyUserInfo) $target['user_id'] = $source['user_id'];
|
|
||||||
$target['user_name'] = $source['username'];
|
|
||||||
$target['user_loginname'] = $source['username'];
|
|
||||||
$target['user_loginname'] = $source['name'];
|
|
||||||
$target['user_password'] = $source['user_password'];
|
|
||||||
$target['user_join'] = strtotime($source['user_regdate']);
|
|
||||||
$target['user_email'] = $source['user_email'];
|
|
||||||
$target['user_hideemail'] = $source['user_viewemail'];
|
|
||||||
$target['user_image'] = $source['user_avatar'];
|
|
||||||
$target['user_signature'] = $source['user_sig'];
|
|
||||||
$target['user_forums'] = $source['user_posts'];
|
|
||||||
$target['user_lastvisit'] = $source['user_lastvisit'];
|
|
||||||
$target['user_image'] = $source['user_avatar'];
|
|
||||||
|
|
||||||
$target['user_timezone'] = $source['user_timezone']; // source is decimal(5,2)
|
|
||||||
$target['user_language'] = $source['user_lang']; // May need conversion
|
|
||||||
$target['user_location'] = $source['user_from'];
|
|
||||||
$target['user_icq'] = $source['user_icq'];
|
|
||||||
$target['user_aim'] = $source['user_aim'];
|
|
||||||
$target['user_yahoo'] = $source['user_yim'];
|
|
||||||
$target['user_msn'] = $source['user_msnm'];
|
|
||||||
$target['user_homepage'] = $source['user_website'];
|
|
||||||
$target['user_ip'] = $source['last_ip'];
|
|
||||||
// $target['user_'] = $source[''];
|
|
||||||
|
|
||||||
// $source['user_rank'];
|
|
||||||
// $target['user_admin'] = ($source['user_level'] == 1) ? 1 : 0; // Guess
|
|
||||||
// if ($target['user_admin'] != 0) $target['user_perms'] = '0.';
|
|
||||||
// $target['user_ban'] = ($source['ublockon'] ? 2 : 0); // Guess
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,35 +179,57 @@ class PHPNuke_import extends base_import_class
|
|||||||
/**
|
/**
|
||||||
* Align source data with e107 News Table
|
* Align source data with e107 News Table
|
||||||
* @param $target array - default e107 target values for e107_news table.
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
* @param $source array - RSS data
|
* @param $source array - other cms table data
|
||||||
*/
|
*/
|
||||||
function copyNewsData(&$target, &$source)
|
function copyNewsData(&$target, &$source)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$target['news_id'] = (int) $source['sid'];
|
||||||
// $target['news_title'] = '';
|
$target['news_title'] = $source['title'];
|
||||||
// $target['news_sef'] = '';
|
$target['news_sef'] = '';
|
||||||
// $target['news_body'] = "[html]something[/html]";
|
$target['news_body'] = "[html]".$source['hometext']."[/html]";
|
||||||
// $target['news_extended'] = '';
|
$target['news_extended'] = "[html]".$source['bodytext']."[/html]";
|
||||||
//$target['news_meta_keywords'] = implode(",",$keywords);
|
$target['news_meta_keywords'] = '';
|
||||||
// $target['news_meta_description'] = '';
|
$target['news_meta_description'] = '';
|
||||||
// $target['news_datestamp'] = strtotime($source['pubDate'][0]);
|
$target['news_datestamp'] = $source['datestamp'];
|
||||||
// $target['news_author'] = $source['post_author'];
|
$target['news_author'] = $source[''];
|
||||||
// $target['news_category'] = '';
|
$target['news_category'] = (int) $source['topic'];
|
||||||
// $target['news_allow_comments'] = ($source['comment_status']=='open') ? 1 : 0;
|
$target['news_allow_comments'] = (int) $source['acomm'];
|
||||||
// $target['news_start'] = '';
|
$target['news_start'] = '';
|
||||||
// $target['news_end'] = '';
|
$target['news_end'] = '';
|
||||||
/// $target['news_class'] = '';
|
// $target['news_class'] = '';
|
||||||
// $target['news_render_type'] = '';
|
// $target['news_render_type'] = '';
|
||||||
// $target['news_comment_total'] = $source['comment_count'];
|
$target['news_comment_total'] = $source['comments'];
|
||||||
// $target['news_summary'] = $source['post_excerpt'];
|
// $target['news_summary'] = $source[''];
|
||||||
// $target['news_thumbnail'] = '';
|
$target['news_thumbnail'] = '';
|
||||||
// $target['news_sticky'] = '';
|
$target['news_sticky'] = '';
|
||||||
|
|
||||||
return $target; // comment out to debug
|
return $target; // comment out to debug.
|
||||||
|
|
||||||
// $this->renderDebug($source,$target);
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data with e107 News Table
|
||||||
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyNewsCategoryData(&$target, &$source)
|
||||||
|
{
|
||||||
|
$target['category_id'] = (int) $source['topicid'];
|
||||||
|
$target['category_name'] = $source['topictext'];
|
||||||
|
$target['category_sef'] = eHelper::title2sef($source['topicname'],'dashl');
|
||||||
|
// $target['category_meta_description'] = $source[''];
|
||||||
|
// $target['category_meta_keywords'] = $source[''];
|
||||||
|
$target['category_manager'] = e_UC_ADMIN;
|
||||||
|
$target['category_icon'] = $source['topicimage'];
|
||||||
|
// $target['category_order'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,31 +238,129 @@ class PHPNuke_import extends base_import_class
|
|||||||
/**
|
/**
|
||||||
* Align source data to e107 Page Table
|
* Align source data to e107 Page Table
|
||||||
* @param $target array - default e107 target values for e107_page table.
|
* @param $target array - default e107 target values for e107_page table.
|
||||||
* @param $source array - WordPress table data
|
* @param $source array - other cms table data
|
||||||
*/
|
*/
|
||||||
function copyPageData(&$target, &$source)
|
function copyPageData(&$target, &$source)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// $target['page_id'] = $source['ID']; // auto increment
|
$target['page_id'] = $source[''];
|
||||||
// $target['page_title'] = $source['post_title']);
|
$target['page_title'] = $source[''];
|
||||||
// $target['page_sef'] = $source['post_name'];
|
$target['page_sef'] = $source[''];
|
||||||
// $target['page_text'] = (vartrue($source['post_content'])) ? "[html]".$source['post_content']."[/html]" : "";
|
$target['page_text'] = $source[''];
|
||||||
// $target['page_metakeys'] = '';
|
$target['page_metakeys'] = $source[''];
|
||||||
// $target['page_metadscr'] = '';
|
$target['page_metadscr'] = $source[''];
|
||||||
// $target['page_datestamp'] = strtotime($source['post_date']);
|
$target['page_datestamp'] = $source[''];
|
||||||
// $target['page_author'] = $source['post_author'];
|
$target['page_author'] = $source[''];
|
||||||
// $target['page_category'] = '',
|
$target['page_category'] = $source[''];
|
||||||
// $target['page_comment_flag'] = ($source['comment_status']=='open') ? 1 : 0;
|
$target['page_comment_flag'] = $source[''];
|
||||||
// $target['page_password'] = $source['post_password'];
|
$target['page_password'] = $source[''];
|
||||||
// $target['page_class'] = e_UC_ADMIN;
|
$target['page_class'] = $source[''];
|
||||||
|
|
||||||
return $target; // comment out to debug
|
// return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['forum_id'] = $source[''];
|
||||||
|
$target['forum_name'] = $source[''];
|
||||||
|
$target['forum_description'] = $source[''];
|
||||||
|
$target['forum_parent'] = $source[''];
|
||||||
|
$target['forum_sub'] = $source[''];
|
||||||
|
$target['forum_datestamp'] = $source[''];
|
||||||
|
$target['forum_moderators'] = $source[''];
|
||||||
|
|
||||||
|
$target['forum_threads'] = $source[''];
|
||||||
|
$target['forum_replies'] = $source[''];
|
||||||
|
$target['forum_lastpost_user'] = $source[''];
|
||||||
|
$target['forum_lastpost_user_anon'] = $source[''];
|
||||||
|
$target['forum_lastpost_info'] = $source[''];
|
||||||
|
$target['forum_class'] = $source[''];
|
||||||
|
$target['forum_order'] = $source[''];
|
||||||
|
$target['forum_postclass'] = $source[''];
|
||||||
|
$target['forum_threadclass'] = $source[''];
|
||||||
|
$target['forum_options'] = $source[''];
|
||||||
|
$target['forum_sef'] = $source[''];
|
||||||
|
|
||||||
|
// return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107 forum_threads
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumThreadData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['thread_id'] = $source[''];
|
||||||
|
$target['thread_name'] = $source[''];
|
||||||
|
$target['thread_forum_id'] = $source[''];
|
||||||
|
$target['thread_views'] = $source[''];
|
||||||
|
$target['thread_active'] = $source[''];
|
||||||
|
$target['thread_lastpost'] = $source[''];
|
||||||
|
$target['thread_sticky'] = $source[''];
|
||||||
|
$target['thread_datestamp'] = $source[''];
|
||||||
|
$target['thread_user'] = $source[''];
|
||||||
|
$target['thread_user_anon'] = $source[''];
|
||||||
|
$target['thread_lastuser'] = $source[''];
|
||||||
|
$target['thread_lastuser_anon'] = $source[''];
|
||||||
|
$target['thread_total_replies'] = $source[''];
|
||||||
|
$target['thread_options'] = $source[''];
|
||||||
|
|
||||||
|
// return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum_post table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumPostData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['post_id'] = $source[''];
|
||||||
|
$target['post_entry'] = $source[''];
|
||||||
|
$target['post_thread'] = $source[''];
|
||||||
|
$target['post_forum'] = $source[''];
|
||||||
|
$target['post_status'] = $source[''];
|
||||||
|
$target['post_datestamp'] = $source[''];
|
||||||
|
$target['post_user'] = $source[''];
|
||||||
|
$target['post_edit_datestamp'] = $source[''];
|
||||||
|
$target['post_edit_user'] = $source[''];
|
||||||
|
$target['post_ip'] = $source[''];
|
||||||
|
$target['post_user_anon'] = $source[''];
|
||||||
|
$target['post_attachments'] = $source[''];
|
||||||
|
$target['post_options'] = $source[''];
|
||||||
|
|
||||||
|
|
||||||
|
// return $target; // comment out to debug.
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
466
e107_plugins/import/providers/template_import_class.php
Normal file
466
e107_plugins/import/providers/template_import_class.php
Normal file
@@ -0,0 +1,466 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2017 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
require_once('import_classes.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @usage replace 'template' with the name of the other cms and rename this file.
|
||||||
|
*/
|
||||||
|
class template_import extends base_import_class
|
||||||
|
{
|
||||||
|
public $title = 'Template';
|
||||||
|
public $description = 'Import Users, News, Content and Links';
|
||||||
|
public $supported = array('users','news','page','links'); // import methods which are completed.
|
||||||
|
public $mprefix = 'template_'; // default prefix used by other CMS.
|
||||||
|
|
||||||
|
private $myparam = false; // custom param.
|
||||||
|
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
// check $_POST; from config() if required.
|
||||||
|
|
||||||
|
$this->myparam = intval($_POST['news_author']);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
$mylist = array(1=>'Param 1', 2=>'Param 2');
|
||||||
|
|
||||||
|
$var[0]['caption'] = "Optional Parameter";
|
||||||
|
$var[0]['html'] = $frm->select('myparam',$mylist);
|
||||||
|
$var[0]['help'] = "Change the author of the news items";
|
||||||
|
|
||||||
|
// $var[1]['caption'] = "Include revisions";
|
||||||
|
// $var[1]['html'] = $frm->checkbox('news_revisions',1);
|
||||||
|
// $var[1]['help'] = "Change the author of the news items";
|
||||||
|
|
||||||
|
return $var;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up a query for the specified task.
|
||||||
|
* @param $task
|
||||||
|
* @param bool|false $blank_user
|
||||||
|
* @return bool TRUE on success. false on error
|
||||||
|
*/
|
||||||
|
function setupQuery($task, $blank_user=false)
|
||||||
|
{
|
||||||
|
if ($this->ourDB == NULL) return false;
|
||||||
|
|
||||||
|
switch ($task)
|
||||||
|
{
|
||||||
|
case 'users' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'userclass' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'news' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'newschapter' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'page' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pagechapter' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'media' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'links':
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'forum' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumthread' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumpost' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->gen($query);
|
||||||
|
if ($result === false) return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'forumtrack' :
|
||||||
|
$query = "SELECT * FROM {$this->DBPrefix}mytable ORDER BY my_id";
|
||||||
|
$result = $this->ourDB->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)
|
||||||
|
{
|
||||||
|
$target['user_name'] = $source[''];
|
||||||
|
$target['user_loginname'] = $source[''];
|
||||||
|
$target['user_password'] = $source[''];
|
||||||
|
$target['user_email'] = $source[''];
|
||||||
|
$target['user_hideemail'] = $source[''];
|
||||||
|
$target['user_join'] = $source[''];
|
||||||
|
$target['user_admin'] = $source[''];
|
||||||
|
$target['user_lastvisit'] = $source[''];
|
||||||
|
$target['user_login'] = $source[''];
|
||||||
|
$target['user_ban'] = $source[''];
|
||||||
|
$target['user_customtitle'] = $source[''];
|
||||||
|
$target['user_sess'] = $source['']; // Photo
|
||||||
|
$target['user_signature'] = $source[''];
|
||||||
|
$target['user_image'] = $source['']; // Avatar
|
||||||
|
$target['user_currentvisit'] = $source[''];
|
||||||
|
$target['user_lastpost'] = $source[''];
|
||||||
|
$target['user_chats'] = $source[''];
|
||||||
|
$target['user_comments'] = $source[''];
|
||||||
|
|
||||||
|
$target['user_ip'] = $source[''];
|
||||||
|
$target['user_prefs'] = $source[''];
|
||||||
|
$target['user_visits'] = $source[''];
|
||||||
|
$target['user_class'] = $source[''];
|
||||||
|
$target['user_perms'] = $source[''];
|
||||||
|
$target['user_xup'] = $source[''];
|
||||||
|
$target['user_language'] = $source[''];
|
||||||
|
$target['user_country'] = $source[''];
|
||||||
|
$target['user_location'] = $source[''];
|
||||||
|
$target['user_aim'] = $source[''];
|
||||||
|
$target['user_icq'] = $source[''];
|
||||||
|
$target['user_yahoo'] = $source[''];
|
||||||
|
$target['user_msn'] = $source[''];
|
||||||
|
$target['user_homepage'] = $source[''];
|
||||||
|
$target['user_birthday'] = $source[''];
|
||||||
|
$target['user_timezone'] = $source[''];
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
//return $target;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 copyUserClassData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['userclass_id'] = $source[''];
|
||||||
|
$target['userclass_name'] = $source[''];
|
||||||
|
$target['userclass_description'] = $source[''];
|
||||||
|
$target['userclass_editclass'] = $source[''];
|
||||||
|
$target['userclass_parent'] = $source[''];
|
||||||
|
$target['userclass_accum'] = $source[''];
|
||||||
|
$target['userclass_visibility'] = $source[''];
|
||||||
|
$target['userclass_type'] = $source[''];
|
||||||
|
$target['userclass_icon'] = $source[''];
|
||||||
|
$target['userclass_perms'] = $source[''];
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data with e107 News Table
|
||||||
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyNewsData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['news_id'] = $source['']; // leave empty to auto-increment.
|
||||||
|
$target['news_title'] = $source[''];
|
||||||
|
$target['news_sef'] = $source[''];
|
||||||
|
$target['news_body'] = $source['']; // wrap in [html] tags if required.
|
||||||
|
$target['news_extended'] = $source['']; // wrap in [html] tags if required.
|
||||||
|
$target['news_meta_keywords'] = $source[''];
|
||||||
|
$target['news_meta_description'] = $source[''];
|
||||||
|
$target['news_datestamp'] = $source['datestamp'];
|
||||||
|
$target['news_author'] = $source[''];
|
||||||
|
$target['news_category'] = $source[''];
|
||||||
|
$target['news_allow_comments'] = $source[''];
|
||||||
|
$target['news_start'] = $source[''];
|
||||||
|
$target['news_end'] = $source[''];
|
||||||
|
$target['news_class'] = $source[''];
|
||||||
|
$target['news_render_type'] = $source[''];
|
||||||
|
$target['news_comment_total'] = $source[''];
|
||||||
|
$target['news_summary'] = $source[''];
|
||||||
|
$target['news_thumbnail'] = $source[''];
|
||||||
|
$target['news_sticky'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
// $this->renderDebug($source,$target);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data with e107 News Table
|
||||||
|
* @param $target array - default e107 target values for e107_news table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyNewsCategoryData(&$target, &$source)
|
||||||
|
{
|
||||||
|
$target['category_id'] = $source[''];
|
||||||
|
$target['category_name'] = $source[''];
|
||||||
|
$target['category_sef'] = $source[''];
|
||||||
|
$target['category_meta_description'] = $source[''];
|
||||||
|
$target['category_meta_keywords'] = $source[''];
|
||||||
|
$target['category_manager'] = $source[''];
|
||||||
|
$target['category_icon'] = $source[''];
|
||||||
|
$target['category_order'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Align source data to e107 Page Table
|
||||||
|
* @param $target array - default e107 target values for e107_page table.
|
||||||
|
* @param $source array - other cms table data
|
||||||
|
*/
|
||||||
|
function copyPageData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$target['page_id'] = $source[''];
|
||||||
|
$target['page_title'] = $source[''];
|
||||||
|
$target['page_sef'] = $source[''];
|
||||||
|
$target['page_text'] = $source[''];
|
||||||
|
$target['page_metakeys'] = $source[''];
|
||||||
|
$target['page_metadscr'] = $source[''];
|
||||||
|
$target['page_datestamp'] = $source[''];
|
||||||
|
$target['page_author'] = $source[''];
|
||||||
|
$target['page_category'] = $source[''];
|
||||||
|
$target['page_comment_flag'] = $source[''];
|
||||||
|
$target['page_password'] = $source[''];
|
||||||
|
$target['page_class'] = $source[''];
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['forum_id'] = $source[''];
|
||||||
|
$target['forum_name'] = $source[''];
|
||||||
|
$target['forum_description'] = $source[''];
|
||||||
|
$target['forum_parent'] = $source[''];
|
||||||
|
$target['forum_sub'] = $source[''];
|
||||||
|
$target['forum_datestamp'] = $source[''];
|
||||||
|
$target['forum_moderators'] = $source[''];
|
||||||
|
|
||||||
|
$target['forum_threads'] = $source[''];
|
||||||
|
$target['forum_replies'] = $source[''];
|
||||||
|
$target['forum_lastpost_user'] = $source[''];
|
||||||
|
$target['forum_lastpost_user_anon'] = $source[''];
|
||||||
|
$target['forum_lastpost_info'] = $source[''];
|
||||||
|
$target['forum_class'] = $source[''];
|
||||||
|
$target['forum_order'] = $source[''];
|
||||||
|
$target['forum_postclass'] = $source[''];
|
||||||
|
$target['forum_threadclass'] = $source[''];
|
||||||
|
$target['forum_options'] = $source[''];
|
||||||
|
$target['forum_sef'] = $source[''];
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107 forum_threads
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumThreadData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['thread_id'] = $source[''];
|
||||||
|
$target['thread_name'] = $source[''];
|
||||||
|
$target['thread_forum_id'] = $source[''];
|
||||||
|
$target['thread_views'] = $source[''];
|
||||||
|
$target['thread_active'] = $source[''];
|
||||||
|
$target['thread_lastpost'] = $source[''];
|
||||||
|
$target['thread_sticky'] = $source[''];
|
||||||
|
$target['thread_datestamp'] = $source[''];
|
||||||
|
$target['thread_user'] = $source[''];
|
||||||
|
$target['thread_user_anon'] = $source[''];
|
||||||
|
$target['thread_lastuser'] = $source[''];
|
||||||
|
$target['thread_lastuser_anon'] = $source[''];
|
||||||
|
$target['thread_total_replies'] = $source[''];
|
||||||
|
$target['thread_options'] = $source[''];
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* $target - e107_forum_post table
|
||||||
|
* $source - other cms
|
||||||
|
*/
|
||||||
|
function copyForumPostData(&$target, &$source)
|
||||||
|
{
|
||||||
|
|
||||||
|
$target['post_id'] = $source[''];
|
||||||
|
$target['post_entry'] = $source[''];
|
||||||
|
$target['post_thread'] = $source[''];
|
||||||
|
$target['post_forum'] = $source[''];
|
||||||
|
$target['post_status'] = $source[''];
|
||||||
|
$target['post_datestamp'] = $source[''];
|
||||||
|
$target['post_user'] = $source[''];
|
||||||
|
$target['post_edit_datestamp'] = $source[''];
|
||||||
|
$target['post_edit_user'] = $source[''];
|
||||||
|
$target['post_ip'] = $source[''];
|
||||||
|
$target['post_user_anon'] = $source[''];
|
||||||
|
$target['post_attachments'] = $source[''];
|
||||||
|
$target['post_options'] = $source[''];
|
||||||
|
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
$this->debug($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)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* e107 Link Targets.
|
||||||
|
0 => LCLAN_20, // 0 = same window
|
||||||
|
1 => LCLAN_23, // new window
|
||||||
|
4 => LCLAN_24, // 4 = miniwindow 600x400
|
||||||
|
5 => LINKLAN_1 // 5 = miniwindow 800x600
|
||||||
|
*/
|
||||||
|
|
||||||
|
$target['link_id'] = $source['']; // leave blank to auto-increment
|
||||||
|
$target['link_name'] = $source[''];
|
||||||
|
$target['link_url'] = $source[''];
|
||||||
|
$target['link_description'] = $source['']; // wrap with [html] [/html] if necessary.
|
||||||
|
$target['link_button'] = $source['']; // image file.
|
||||||
|
$target['link_category'] = $source['']; // integer
|
||||||
|
$target['link_order'] = $source['']; // integer
|
||||||
|
$target['link_parent'] = $source['']; // integer
|
||||||
|
$target['link_open'] = $source['']; // link_target
|
||||||
|
$target['link_class'] = $source[''];
|
||||||
|
$target['link_sefurl'] = $source[''];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $target; // comment out to debug
|
||||||
|
|
||||||
|
$this->debug($source,$target);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom Method if needed.
|
||||||
|
* @param $text
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function convertText($text)
|
||||||
|
{
|
||||||
|
//$text = e107::getParser()->toDb($text);
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
$text = html_entity_decode($text,ENT_QUOTES,'UTF-8');
|
||||||
|
|
||||||
|
$detected = mb_detect_encoding($text); // 'ISO-8859-1'
|
||||||
|
$text = iconv($detected,'UTF-8',$text);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@@ -25,6 +25,7 @@
|
|||||||
<stylesheets>
|
<stylesheets>
|
||||||
<css file="style.css" name="Default"/>
|
<css file="style.css" name="Default"/>
|
||||||
<css file="css/bootstrap-dark.min.css" name="Bootstrap3 Dark Admin" scope='admin' exclude='bootstrap'/>
|
<css file="css/bootstrap-dark.min.css" name="Bootstrap3 Dark Admin" scope='admin' exclude='bootstrap'/>
|
||||||
|
<css file="css/corporate.css" name="Corporate" scope='admin' exclude='bootstrap' />
|
||||||
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css" name="Flatly" scope='admin' exclude='bootstrap'/>
|
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/flatly/bootstrap.min.css" name="Flatly" scope='admin' exclude='bootstrap'/>
|
||||||
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/sandstone/bootstrap.min.css" name="Sandstone" scope='admin' exclude='bootstrap'/>
|
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/sandstone/bootstrap.min.css" name="Sandstone" scope='admin' exclude='bootstrap'/>
|
||||||
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/superhero/bootstrap.min.css" name="Superhero" scope='admin' exclude='bootstrap'/>
|
<css file="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.7/superhero/bootstrap.min.css" name="Superhero" scope='admin' exclude='bootstrap'/>
|
||||||
|
Reference in New Issue
Block a user