From 1ba47a0c756cdf75c418d25951d2a167340d4b29 Mon Sep 17 00:00:00 2001 From: e107steved Date: Sun, 16 Mar 2008 21:38:26 +0000 Subject: [PATCH] Updated import - files not required --- e107_files/import/import_mapper.php | 149 --------- e107_files/import/mambo.php | 157 ---------- e107_files/import/phpbb2.php | 471 ---------------------------- e107_files/import/phpnuke.php | 393 ----------------------- 4 files changed, 1170 deletions(-) delete mode 100644 e107_files/import/import_mapper.php delete mode 100644 e107_files/import/mambo.php delete mode 100644 e107_files/import/phpbb2.php delete mode 100644 e107_files/import/phpnuke.php diff --git a/e107_files/import/import_mapper.php b/e107_files/import/import_mapper.php deleted file mode 100644 index b6f22eb83..000000000 --- a/e107_files/import/import_mapper.php +++ /dev/null @@ -1,149 +0,0 @@ - toDB($dataArray[$convert['srcdata']]); -// $newvalue = $dataArray[$convert['srcdata']]; // USE IN PLACE OF PREVIOUS LINE FOR STANDALONE TEST - if (array_key_exists('sproc',$convert)) - { - if (strpos($convert['sproc'],"usebb") !== FALSE) $newvalue = proc_bb($newvalue,$convert['sproc'], $maptable); - if (strpos($convert['sproc'],"stripbb") !== FALSE) $newvalue = preg_replace("#\[.*\]#", "",$newvalue); - } - } - else - if ($convert['type'] == "INT") - { - $newvalue = intval($dataArray[$convert['srcdata']]); // intval added 25.05.06 - if (($newvalue == 0) && ((array_key_exists('sproc',$convert)) && (strpos($convert['sproc'],"zeronull") !== FALSE))) $newvalue = ''; - } - else - echo "Invalid field type: ".$convert['type']; - } - else - { // blank (undefined) value - if (array_key_exists('default', $convert)) - { - $newvalue = $convert['default']; - } - else - { - if (($convert['type'] == "INT") && ((array_key_exists('sproc',$convert)) && (strpos($convert['sproc'],"zeronull") === FALSE))) - $newvalue = "0"; // Should help mySQL5 - else - $newvalue = ''; - } - } - - $columns .= $convert['e107'].","; - $values .= "'".$newvalue."',"; - } - -// Knock off last comma of each line - $columns = substr($columns, 0, -1).")"; - $values = substr($values, 0, -1).")"; - - return "INSERT INTO $table $columns VALUES $values"; - -} - -// Process all bbcodes in the passed value; return the processed string. -// Works recursively -// Start by assembling matched pairs. Then map and otherwise process as required. -// Divide the value into five bits: -// Preamble - up to the identified bbcode (won't contain bbcode) -// BBCode start code -// Inner - text between the two bbcodes (may contain another bbcode) -// BBCode end code -// Trailer - remaining unprocessed text (may contain more bbcodes) -// (Note: preg_split might seem obvious, but doesn't pick out the actual codes -// Tested with various strings (see testdata.txt; also mapping table to see what is going on. - -function proc_bb($value, $options = "", $maptable = null) -{ - $nextchar = 0; - $loopcount = 0; -// echo "
starting match
"; - - while ($nextchar < strlen($value)) : - $firstbit = ''; - $middlebit = ''; - $lastbit = ''; - $loopcount++; - if ($loopcount > 10) return 'Max depth exceeded'; - unset($bbword); - $firstcode = strpos($value,'[',$nextchar); - if ($firstcode === FALSE) return $value; // Done if no square brackets - $firstend = strpos($value,']',$firstcode); - if ($firstend === FALSE) return $value; // Done if no closing bracket - $bbword = substr($value,$firstcode+1,$firstend - $firstcode - 1); // May need to process this more if parameter follows - $bbparam = ''; - $temp = strpos($bbword,'='); - if ($temp !== FALSE) - { - $bbparam = substr($bbword,$temp); - $bbword = substr($bbword,0,-strlen($bbparam)); - } -// echo $bbword."<<||>>".$bbparam; - if (($bbword) && ($bbword == trim($bbword))) - { - $laststart = strpos($value,'[/'.$bbword,$firstend); // Find matching end - $lastend = strpos($value,']',$laststart); - if (($laststart === FALSE) || ($lastend === FALSE)) - { // No matching end character - $nextchar = $firstend; // Just move scan pointer along -// echo " - no match
"; - } - else - { // Got a valid bbcode pair here - $firstbit = ''; - if ($firstcode > 0) $firstbit = substr($value,0,$firstcode); - $middlebit = substr($value,$firstend+1,$laststart - $firstend-1); - $lastbit = substr($value,$lastend+1,strlen($value) - $lastend); -// echo " - match||".$firstbit."||".$middlebit."||".$lastbit."
"; - // Process bbcodes here - if (strpos($options,'bblower') !== FALSE) $bbword = strtolower($bbword); - if ((strpos($options,'phpbb') !== FALSE) && (strpos($bbword,':') !== FALSE)) $bbword = substr($bbword,0,strpos($bbword,':')); - if ($maptable) - { // Do mapping - if (array_key_exists($bbword,$maptable)) $bbword = $maptable[$bbword]; - } - $bbbegin = '['.$bbword.$bbparam.']'; - $bbend = '[/'.$bbword.']'; - return $firstbit.$bbbegin.proc_bb($middlebit,$options,$maptable).$bbend.proc_bb($lastbit,$options,$maptable); - } - } - else - { - $nextchar = $firstend+1; - } -// echo " -->".$firstcode.", ".$firstend.", ".$laststart.", ".$lastend."
"; -// echo "
"; - endwhile; - -} - - - - -?> \ No newline at end of file diff --git a/e107_files/import/mambo.php b/e107_files/import/mambo.php deleted file mode 100644 index a7b412151..000000000 --- a/e107_files/import/mambo.php +++ /dev/null @@ -1,157 +0,0 @@ - - - - This script will import your Mambo database to e107. It will copy over users only.

- -

\n - - -
- Please enter the details for your Mambo database ...

- - - - - - - - - - - - - - - - - -
Host   -
Username   -
Password   -
Database   -
Table Prefix   -
-

- - - - "; - - $ns -> tablerender("mambo to e107 Conversion Script", $text); - require_once(e_ADMIN."footer.php"); - exit; -} - -if(!isset($_POST['mamboHost']) || !isset($_POST['mamboUsername']) || !isset($_POST['mamboPassword']) || !isset($_POST['mamboDatabase'])){ - echo "Field(s) left blank, please go back and re-enter values."; - require_once(e_ADMIN."footer.php"); - exit; -} - -extract($_POST); - -$text .= " - -
-Attempting to connect to Mambo database [ {$mamboDatabase} @ {$mamboHost} ] ...
\n"; -flush(); - -$phpbbConnection = mysql_connect($mamboHost, $mamboUsername, $mamboPassword, TRUE); -if(!mysql_select_db($mamboDatabase, $phpbbConnection)){ - goError("Error! Cound not connect to Mambo database. Please go back to the previous page and check your settings"); -} - -$e107Connection = mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword, TRUE); -if(!mysql_select_db($mySQLdefaultdb, $e107Connection)){ - goError("Error! Cound not connect to e107 database."); -} - -echo "Successfully connected to Mambo and e107 databases ...

"; - - -$phpbb_res = mysql_query("SELECT * FROM {$mamboPrefix}users", $phpbbConnection); -if(!$phpbb_res){ - goError("Error! Unable to access ".$mamboPrefix."users table."); -} - - - -$text = "
"; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; - -$result = mysql_query("SELECT name,username,email,block,sendEmail,gid,password,usertype,UNIX_TIMESTAMP(registerDate) AS regDate,UNIX_TIMESTAMP(lastvisitDate) AS lvDate FROM mos_users", $phpbbConnection); -while ($mos = mysql_fetch_array($result, MYSQL_ASSOC)) { -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; -$text .= ""; - -$block = ($mos['block']) ? 2 : 0; -$admin = ($mos['usertype'] == "superadministrator") ? 1 : 0; -$class = ''; // Potential class allocation - can edit to list class numbers here -$query = "INSERT INTO ".$mySQLprefix."user VALUES ("; -$query .= "0, '".$mos['name']."', '".$mos['username']."', '', '".$mos['password']."', '', '".$mos['email']."', '', '', '', '1', '".$mos['regDate']."', '".$mos['lvDate']."', 0, 0, 0, 0, 0, '', '{$block}', '', '', '', 0, '{$admin}', '".$mos['name']."', '{$class}', '', '', 0, '' "; -$query .= ")"; -$message = mysql_query($query, $e107Connection) ? LAN_CREATED: LAN_CREATED_FAILED; - -} -$text .= "
nameusernameemailpasswordusertypeblocksendEmailgidregDatelvDate
".$mos['name']."".$mos['username']."".$mos['email']."".$mos['password']."".$mos['usertype']."".$mos['block']."".$mos['sendEmail']."".$mos['gid']."".$mos['regDate']."".$mos['lvDate']."
"; - -echo $text."

"; -echo "
$message
"; - - - -function goError($error){ - echo "{$error}
"; - require_once(e_ADMIN."footer.php"); - exit; -} - - -require_once(e_ADMIN."footer.php"); -?> \ No newline at end of file diff --git a/e107_files/import/phpbb2.php b/e107_files/import/phpbb2.php deleted file mode 100644 index a7cc10952..000000000 --- a/e107_files/import/phpbb2.php +++ /dev/null @@ -1,471 +0,0 @@ - - - - This script will import your phpBB2 database to e107. It will copy over users, forums, forum posts and polls.


*** IMPORTANT ***
Running this script will empty your e107 forum, users and polls table - make sure you have a backup before continuing!
- -


\n - - - - Please enter the details for your phpBB2 database ...

- - - - - - - - - - - - - - - - - -
Host   -
Username   -
Password   -
Database   -
Table Prefix   -
-

- - - - "; - - $ns -> tablerender("phpBB2 to e107 Conversion Script", $text); - require_once(e_ADMIN."footer.php"); - exit; -} - -if(!isset($_POST['phpbb2Host']) || !isset($_POST['phpbb2Username']) || !isset($_POST['phpbb2Password']) || !isset($_POST['phpbb2Database'])) -{ - echo "Field(s) left blank, please go back and re-enter values."; - require_once(e_ADMIN."footer.php"); - exit; -} - -if(!isset($_POST['phpbb2Prefix'])) -{ - $phpbb2Prefix = ""; -} - -extract($_POST); - -echo " - -
-Attempting to connect to phpBB database [ {$phpbb2Database} @ {$phpbb2Host} ] ...
\n"; -flush(); - -$phpbbConnection = mysql_connect($phpbb2Host, $phpbb2Username, $phpbb2Password, TRUE); -if(!mysql_select_db($phpbb2Database, $phpbbConnection)) -{ - goError("Error! Could not connect to phpBB database. Please go back to the previous page and check your settings"); -} - -$e107Connection = mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword, TRUE); -if(!mysql_select_db($mySQLdefaultdb, $e107Connection)) -{ - goError("Error! Could not connect to e107 database."); -} - -echo "Successfully connected to phpBB and e107 databases ...

"; - - -$phpbb_res = mysql_query("SELECT * FROM {$phpbb2Prefix}users", $phpbbConnection); -if(!$phpbb_res) -{ - goError("Error! Unable to access ".$phpbb2Prefix."users table."); -} - -require_once('import_mapper.php'); - - -//------------------------------------------------------ -// Convert users -//------------------------------------------------------ -while($user = mysql_fetch_array($phpbb_res)) -{ - $userArray = convertUsers(); -// if($user['user_level'] != 1 && $user['user_id'] != -1) -// Convert any user other than ID=1 (which will be E107 main admin) - if($user['user_id'] > 1) - { - $query = createQuery($userArray, $user, $mySQLprefix."user"); - echo (mysql_query($query, $e107Connection) ? "Successfully inserted user: ".$user['user_id'].": ".$user['username'] : "Unable to insert user: ".$user['user_id'].": ".$user['username']."
".mysql_errno() . ": " . mysql_error())."
"; - flush(); - } -} - - -//----------------------------------------------------------- -// ### get phpbb categories and insert them as forum parents -//----------------------------------------------------------- - -mysql_query("TRUNCATE TABLE {$mySQLprefix}forum", $e107Connection); - - -$phpbb_res = mysql_query("SELECT * FROM {$phpbb2Prefix}categories", $phpbbConnection); -if(!$phpbb_res) -{ - goError("Error! Unable to access ".$phpbb2Prefix."categories table."); -} - -$catcount = 500; -while($parent = mysql_fetch_array($phpbb_res)) -{ - - $parentArray = convertParents($catcount); - - $query = createQuery($parentArray, $parent, $mySQLprefix."forum"); - echo (mysql_query($query, $e107Connection) ? "Successfully inserted parent: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert parent: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; - flush(); - - $phpbb_res2 = mysql_query("SELECT * FROM {$phpbb2Prefix}forums WHERE cat_id = ".$parent['cat_id'], $phpbbConnection); - if($phpbb_res2) - { - while($forum = mysql_fetch_array($phpbb_res2)) - { - $forumArray = convertForums($catcount); - $query = createQuery($forumArray, $forum, $mySQLprefix."forum"); - echo (mysql_query($query, $e107Connection) ? "Successfully inserted forum: ".$parent['cat_id'].": ".$parent['cat_title'] : "Unable to insert forum: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; - flush(); - } - } - else - { - echo "Didn't find any forums for parent '".$parent['cat_title']."'
"; - } - $catcount ++; -} - - -//------------------------------------------------------ -// Read in forum topics -//------------------------------------------------------ - -mysql_query("TRUNCATE TABLE {$mySQLprefix}forum_t", $e107Connection); -mysql_query("TRUNCATE TABLE {$mySQLprefix}polls", $e107Connection); - -$query = "SELECT * FROM {$phpbb2Prefix}topics -LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}topics.topic_title = {$phpbb2Prefix}posts_text.post_subject) -LEFT JOIN {$phpbb2Prefix}posts ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) -ORDER BY topic_time ASC"; - -$phpbb_res = mysql_query($query, $phpbbConnection); -if(!$phpbb_res) -{ - goError("Error! Unable to access ".$phpbb2Prefix."topics table."); -} -while($topic = mysql_fetch_array($phpbb_res)) -{ - - //echo "
"; print_r($topic); echo "
"; - - if($topic['topic_vote']) - { - // poll attached to this topic ... - $topic['topic_title'] = "[poll] ".$topic['topic_title']; - $query = "SELECT * FROM {$phpbb2Prefix}vote_desc WHERE topic_id=".$topic['topic_id']; - $phpbb_res3 = mysql_query($query, $phpbbConnection); - $pollQ = mysql_fetch_array($phpbb_res3); - - $query = "SELECT * FROM {$phpbb2Prefix}vote_results WHERE vote_id=".$pollQ['vote_id']; - $phpbb_res3 = mysql_query($query, $phpbbConnection); - $options = ""; - $votes = ""; - while($pollO = mysql_fetch_array($phpbb_res3)) - { - $options .= $pollO['vote_option_text'].chr(1); - $votes .= $pollO['vote_result'].chr(1); - } - - extract($pollQ); - $vote_text = $tp->toDB($vote_text); // McFly added 25/5/06 - $options = $tp->toDB($options); // McFly added 25/5/06 - $query = "INSERT INTO ".$mySQLprefix."polls VALUES ('0', {$vote_start}, {$vote_start}, 0, 0, '{$vote_text}', '{$options}', '{$votes}', '', 2, 0, 0, 0, 255, 0)"; - echo (mysql_query($query, $e107Connection) ? "Poll successfully inserted" : "Unable to insert poll ({$query})")."
"; - } - - - if($topic['topic_poster'] == 2) - { - $topic['topic_poster'] = 1; - } - - if($topic['topic_poster'] == -1) - { - $poster = ($topic['post_username'] ? $topic['post_username'] : "Anonymous"); - $topic['topic_poster'] = "0.".$poster; // McFly moved, edited 25/5/06 - } - - $topicArray = convertTopics(); // McFly edited 25/5/06 - $query = createQuery($topicArray, $topic, $mySQLprefix."forum_t"); - - if(!mysql_query($query, $e107Connection)) - { - echo "Unable to insert topic: ".$topic['topic_id']."
"; - flush(); - } - else - { - echo "Successfully inserted topic: ".$topic['topic_id']."
"; - flush(); - $parent_id = mysql_insert_id(); - $topic_id = $topic['topic_id']; - - //echo "PARENT: $parent_id, TOPIC: $topic_id
"; - - $query = "SELECT * FROM {$phpbb2Prefix}posts LEFT JOIN {$phpbb2Prefix}posts_text ON ({$phpbb2Prefix}posts.post_id = {$phpbb2Prefix}posts_text.post_id) WHERE topic_id='{$topic_id}' AND post_subject = '' ORDER BY post_time DESC"; - $phpbb_res2 = mysql_query($query, $phpbbConnection); - if(!$phpbb_res2) - { - goError("Error! Unable to access ".$phpbb2Prefix."posts / ".$phpbb2Prefix."posts_text table."); - } - while($post = mysql_fetch_array($phpbb_res2)) - { - - if($post['poster_id'] == 2) - { - $post['poster_id'] = 1; - } - if($post['poster_id'] == -1) - { - $poster = ($post['post_username'] ? $post['post_username'] : "Anonymous"); - $post['poster_id'] = "0.".$poster; // McFly moved, edited 25/5/06 - } - - - $postArray = convertForumPosts($parent_id, $poster); - $query = createQuery($postArray, $post, $mySQLprefix."forum_t",$mapdata); - echo (mysql_query($query, $e107Connection) ? "Successfully inserted thread: ".$post['post_id'] : "Unable to insert thread: ".$parent['cat_id'].": ".$parent['cat_title']."
".mysql_errno() . ": " . mysql_error())."
"; - flush(); - } - } -} - -//------------------------------------------------------ -// Consider polls here later -//------------------------------------------------------ - -echo "
"; - -require_once(e_ADMIN."footer.php"); - - -function goError($error) -{ - echo "{$error}"; - require_once(e_ADMIN."footer.php"); - exit; -} - -//----------------------------------------------------------- -// Table to convert selected bbcodes to lower case -//----------------------------------------------------------- -//$mapdata = array("URL" => "url","IMG" => "img"); -$mapdata = array(); - -function convertUsers() -{ - $usersArray = array( - array("srcdata" => "user_id", "e107" => "user_id", "type" => "INT"), - array("srcdata" => "username", "e107" => "user_name", "type" => "STRING"), - array("srcdata" => "username", "e107" => "user_loginname", "type" => "STRING"), - array("srcdata" => "user_password", "e107" => "user_password", "type" => "STRING"), - array("srcdata" => "user_email", "e107" => "user_email", "type" => "STRING"), - array("srcdata" => "user_sig", "e107" => "user_signature", "type" => "STRING", "sproc" => "usebb,phpbb,bblower"), - array("srcdata" => "user_viewemail", "e107" => "user_hideemail", "type" => "INT"), - array("srcdata" => "user_regdate", "e107" => "user_join", "type" => "INT"), - array("srcdata" => "user_posts", "e107" => "user_forums", "type" => "INT"), - array("srcdata" => "user_level", "e107" => "user_admin", "type" => "INT"), - array("srcdata" => "user_lastvisit","e107" => "user_lastvisit", "type" => "INT"), -// Rest of these added by McFly - array("srcdata" => "null", "e107" => "user_prefs", "type" => "INT", "value" => 0), - array("srcdata" => "null", "e107" => "user_new", "type" => "INT", "value" => 0), - array("srcdata" => "null", "e107" => "user_realm", "type" => "INT", "value" => 0), - array("srcdata" => "null", "e107" => "user_class", "type" => "INT", "value" => 0), - array("srcdata" => "null", "e107" => "user_viewed", "type" => "INT", "value" => 0), -// This one changed from McFly's code to try and get null string if non-admin - array("srcdata" => "user_level", "e107" => "user_perms", "type" => "INT", "sproc" => "zeronull") ); - return $usersArray; -} - -function convertParents($catid) -{ - $parentArray = array( - array("srcdata" => "cat_id", "e107" => "forum_id", "type" => "INT", "value" => $catid), - array("srcdata" => "cat_title", "e107" => "forum_name", "type" => "STRING"), - array("srcdata" => "cat_order", "e107" => "forum_order", "type" => "INT"), -// Rest of these added by McFly - array("srcdata" => "cat_desc", "e107" => "forum_description", "type" => "STRING"), - array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254) - ); - return $parentArray; -} - -function convertForums($catid) -{ - $forumArray = array( - array("srcdata" => "forum_id", "e107" => "forum_id", "type" => "INT"), - array("srcdata" => "cat_id", "e107" => "forum_parent", "type" => "STRING", "value" => $catid), - array("srcdata" => "forum_name", "e107" => "forum_name", "type" => "STRING"), - array("srcdata" => "forum_desc", "e107" => "forum_description", "type" => "STRING"), - array("srcdata" => "forum_order", "e107" => "forum_order", "type" => "INT"), - array("srcdata" => "forum_topics", "e107" => "forum_threads", "type" => "INT"), - array("srcdata" => "forum_posts", "e107" => "forum_replies", "type" => "INT"), -// array("srcdata" => "null", "e107" => "forum_moderators", "type" => "STRING") -// Previous line replaced with this on the basis that McFly knows best - array("srcdata" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 254) - ); - return $forumArray; -} - - -//function convertTopics($poster) -// Changed by McFly -function convertTopics() -{ - $topicArray = array( - array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"), - array("srcdata" => "topic_title", "e107" => "thread_name", "type" => "STRING"), - array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"), -// array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "INT"), -// Previous line replaced by next - GAT McFly - array("srcdata" => "topic_poster", "e107" => "thread_user", "type" => "STRING"), - array("srcdata" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1), - array("srcdata" => "topic_time", "e107" => "thread_datestamp", "type" => "INT"), - array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"), - array("srcdata" => "topic_replies", "e107" => "thread_total_replies", "type" => "INT"), - array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => 0), - ); - return $topicArray; -} - - - - -function convertForumPosts($parent_id, $poster) -{ - $postArray = array( - array("srcdata" => "post_text", "e107" => "thread_thread", "type" => "STRING", "default" => "", "sproc" => "usebb,phpbb,bblower"), - array("srcdata" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"), - array("srcdata" => "post_time", "e107" => "thread_datestamp", "type" => "INT"), - array("srcdata" => "topic_views", "e107" => "thread_views", "type" => "INT"), - array("srcdata" => "post_time", "e107" => "thread_lastpost", "type" => "INT"), -// array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "INT"), -// Previous line replaced by next - GAT McFly - array("srcdata" => "poster_id", "e107" => "thread_user", "type" => "STRING"), - array("srcdata" => "post_subject", "e107" => "thread_name", "type" => "STRING"), - array("srcdata" => "null", "e107" => "thread_parent", "type" => "INT", "value" => $parent_id), - ); - return $postArray; -} - - -/* --- -------------------------------------------------------- -PHPBB uses three tables to record a poll. Looks wildly different to E107! --- --- Table structure for table `_phpbb_vote_desc` --- - -CREATE TABLE `_phpbb_vote_desc` ( - `vote_id` mediumint(8) unsigned NOT NULL auto_increment, - `topic_id` mediumint(8) unsigned NOT NULL default '0', - `vote_text` text NOT NULL, - `vote_start` int(11) NOT NULL default '0', - `vote_length` int(11) NOT NULL default '0', - PRIMARY KEY (`vote_id`), - KEY `topic_id` (`topic_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ; - --- -------------------------------------------------------- - --- --- Table structure for table `_phpbb_vote_results` --- - -CREATE TABLE `_phpbb_vote_results` ( - `vote_id` mediumint(8) unsigned NOT NULL default '0', - `vote_option_id` tinyint(4) unsigned NOT NULL default '0', - `vote_option_text` varchar(255) NOT NULL default '', - `vote_result` int(11) NOT NULL default '0', - KEY `vote_option_id` (`vote_option_id`), - KEY `vote_id` (`vote_id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- -------------------------------------------------------- - --- --- Table structure for table `_phpbb_vote_voters` --- - -CREATE TABLE `_phpbb_vote_voters` ( - `vote_id` mediumint(8) unsigned NOT NULL default '0', - `vote_user_id` mediumint(8) NOT NULL default '0', - `vote_user_ip` char(8) NOT NULL default '', - KEY `vote_id` (`vote_id`), - KEY `vote_user_id` (`vote_user_id`), - KEY `vote_user_ip` (`vote_user_ip`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - -*/ - -?> \ No newline at end of file diff --git a/e107_files/import/phpnuke.php b/e107_files/import/phpnuke.php deleted file mode 100644 index 381761c4e..000000000 --- a/e107_files/import/phpnuke.php +++ /dev/null @@ -1,393 +0,0 @@ - - - - This script will import your ".ASYSTEM." database to e107.


*** IMPORTANT ***
Running this script will empty most of your e107 tables - make sure you have a backup before continuing!
- -


\n - - - - Please enter the details for your ".ASYSTEM." database ...

- - - - - - - - - - - - - - - - - -
Host   -
Username   -
Password   -
Database   -
Table Prefix   -
-

- - - - "; - - $ns -> tablerender(ASYSTEM." to e107 Conversion Script", $text); - require_once(e_ADMIN."footer.php"); - exit; -} - -if(!isset($_POST['dbHost']) || !isset($_POST['dbUsername']) || !isset($_POST['dbPassword']) || !isset($_POST['dbDatabase'])) -{ - echo "Field(s) left blank, please go back and re-enter values."; - require_once(e_ADMIN."footer.php"); - exit; -} - -if(!isset($_POST['dbPrefix'])) -{ - $nukePrefix = ""; -} - -extract($_POST); - -echo " - -
-Attempting to connect to ".ASYSTEM." database [ {$dbDatabase} @ {$dbHost} ] ...
\n"; -flush(); - -$ASystemConnection = mysql_connect($dbHost, $dbUsername, $dbPassword, TRUE); -if(!mysql_select_db($dbDatabase, $ASystemConnection)) -{ - goError("Error! Cound not connect to ".ASYSTEM." database. Please go back to the previous page and check your settings"); -} - -$e107Connection = mysql_connect($mySQLserver, $mySQLuser, $mySQLpassword, TRUE); -if(!mysql_select_db($mySQLdefaultdb, $e107Connection)) -{ - goError("Error! Cound not connect to e107 database."); -} - -echo "Successfully connected to ".ASYSTEM." and e107 databases ...

"; - -/* ++++++++++++++ USERS ++++++++++++++ */ -$result = mysql_query("SELECT * FROM {$dbPrefix}users", $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."users table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertUsers(); - $query = createQuery($aArray, $aResult, $mySQLprefix."user"); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} -echo "Inserted $pass users into database ($fail fails).
"; -/* +++++++++++++++ END +++++++++++++++ */ - -/* ++++++++++++++ NEWS ++++++++++++++ */ -$query = "SELECT * FROM {$dbPrefix}stories -LEFT JOIN {$dbPrefix}users ON {$dbPrefix}stories.aid={$dbPrefix}users.username -ORDER BY {$dbPrefix}stories.sid ASC"; - -$result = mysql_query($query, $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."stories table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertNews(); - $query = createQuery($aArray, $aResult, $mySQLprefix."news"); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} -echo "Inserted $pass news items into database ($fail fails).
"; -/* +++++++++++++++ END +++++++++++++++ */ - -/* ++++++++++++++ BANLIST ++++++++++++++ */ -$result = mysql_query("SELECT * FROM {$dbPrefix}banned_ip", $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."banned_ip table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertBans(); - $query = createQuery($aArray, $aResult, $mySQLprefix."banlist"); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} -echo "Inserted $pass banned IP addresses into database ($fail fails).
"; -/* +++++++++++++++ END +++++++++++++++ */ - -/* ++++++++++++++ CUSTOM PAGES ++++++++++++++ */ -$result = mysql_query("SELECT * FROM {$dbPrefix}pages", $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."pages table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertPages(); - $query = createQuery($aArray, $aResult, $mySQLprefix."page"); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} -echo "Inserted $pass custom pages into database ($fail fails).
"; -/* +++++++++++++++ END +++++++++++++++ */ - - -/* ++++++++++++++ FORUMS ++++++++++++++ - -$result = mysql_query("SHOW COLUMNS FROM {$mySQLprefix}forum", $e107Connection); -if(!$result) -{ - goError("Error! Unable to access the e107 'forum' table - have you installed the e107 Forum System plugin?"); -} -$result = mysql_query("SELECT * FROM {$dbPrefix}bbforums ORDER BY forum_order ASC", $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."bbforums table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertForums(); - $query = createQuery($aArray, $aResult, $mySQLprefix."forum"); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} - - $query = "INSERT INTO {$mySQLprefix}forum VALUES (0, 'Default Forum Parent', 'This parent has been created by the ".ASYSTEM." conversion script, you can edit it from admin -> forums', '0', '0', '".time()."', '', '0', '0', '', '', '', '0', '0')"; - mysql_query($query, $e107Connection); - $id = mysql_insert_id(); - $query = "UPDATE {$mySQLprefix}forum SET forum_parent='$id' WHERE forum_name!='Default Forum Parent'"; - mysql_query($query, $e107Connection); - -echo "Inserted $pass forums into database ($fail fails).
"; -/* +++++++++++++++ END +++++++++++++++ */ - - -/* ++++++++++++++ FORUM POSTS ++++++++++++++ -$query = "SELECT * FROM {$dbPrefix}bbposts -LEFT JOIN {$dbPrefix}bbposts_text ON {$dbPrefix}bbposts.post_id={$dbPrefix}bbposts_text.post_id -LEFT JOIN {$dbPrefix}users ON {$dbPrefix}bbposts.poster_id={$dbPrefix}users.user_id -ORDER BY {$dbPrefix}bbposts.post_id ASC"; - -$result = mysql_query($query, $ASystemConnection); -if(!$result) -{ - goError("Error! Unable to access ".$dbPrefix."stories table."); -} -$pass = 0; $fail = 0; -while($aResult = mysql_fetch_array($result)) -{ - $aArray = convertForumPosts(); - $query = createQuery($aArray, $aResult, $mySQLprefix."forum_t"); - $poster = ($aResult['poster_id'] == -1 ? "0.".($aResult['username'] ? $aResult['username'] : "Anonymous") : $aResult['poster_id'].".".$aResult['username']); - $query = str_replace("''", "'$poster'", $query); - if(mysql_query($query, $e107Connection)){$pass++;}else{$fail++;} - flush(); -} -echo "Inserted $pass forum posts into database ($fail fails).
"; - +++++++++++++++ END +++++++++++++++ */ - - - -echo "
"; - -require_once(e_ADMIN."footer.php"); - - -function goError($error) -{ - echo "{$error}"; - require_once(e_ADMIN."footer.php"); - exit; -} - - -function convertUsers() -{ - $rArray = array( - array("asystem" => "user_id", "e107" => "user_id", "type" => "INT"), - array("asystem" => "name", "e107" => "user_login", "type" => "STRING"), - array("asystem" => "username", "e107" => "user_name", "type" => "STRING"), - array("asystem" => "username", "e107" => "user_loginname", "type" => "STRING"), - array("asystem" => "user_password", "e107" => "user_password", "type" => "STRING"), - array("asystem" => "user_email", "e107" => "user_email", "type" => "STRING"), - array("asystem" => "user_avatar", "e107" => "user_image", "type" => "STRING"), - array("asystem" => "user_regdate", "e107" => "user_join", "type" => "STRTOTIME"), - array("asystem" => "user_sig", "e107" => "user_signature", "type" => "STRING"), - array("asystem" => "user_viewemail", "e107" => "user_hideemail", "type" => "INT"), - array("asystem" => "user_posts", "e107" => "user_forums", "type" => "INT"), - array("asystem" => "user_lastvisit", "e107" => "user_lastvisit", "type" => "INT"), - array("asystem" => "user_timezone", "e107" => "user_timezone", "type" => "STRING") - ); - return $rArray; -} - -function convertNews() -{ - $rArray = array( - array("asystem" => "sid", "e107" => "news_id", "type" => "INT"), - array("asystem" => "user_id", "e107" => "news_author", "type" => "INT"), - array("asystem" => "title", "e107" => "news_title", "type" => "STRING"), - array("asystem" => "time", "e107" => " news_datestamp", "type" => "STRTOTIME"), - array("asystem" => "hometext", "e107" => " news_body", "type" => "STRING"), - array("asystem" => "bodytext", "e107" => " news_extended", "type" => "STRING"), - array("asystem" => "comments", "e107" => " news_comment_total", "type" => "INT"), - array("asystem" => "catid", "e107" => " news_category", "type" => "INT") - ); - return $rArray; -} - -function convertBans() -{ - $rArray = array( - array("asystem" => "ip_address", "e107" => " banlist_ip", "type" => "STRING"), - array("asystem" => "reason", "e107" => "banlist_reason", "type" => "STRING") - ); - return $rArray; -} - - -function convertPages() -{ - $rArray = array( - array("asystem" => "pid", "e107" => "page_id", "type" => "INT"), - array("asystem" => "title", "e107" => "page_title", "type" => "STRING"), - array("asystem" => "text", "e107" => "page_text", "type" => "STRING"), - array("asystem" => "date", "e107" => "page_datestamp", "type" => "STRTOTIME") - ); - return $rArray; -} - -/* -function convertForums() -{ - $rArray = array( - array("asystem" => "forum_id", "e107" => "forum_id", "type" => "INT"), - array("asystem" => "forum_name", "e107" => "forum_name", "type" => "STRING"), - array("asystem" => "forum_desc", "e107" => "forum_description", "type" => "STRING"), - array("asystem" => "forum_topics", "e107" => "forum_threads", "type" => "INT"), - array("asystem" => "forum_posts", "e107" => "forum_replies", "type" => "INT"), - array("asystem" => "null", "e107" => "forum_postclass", "type" => "INT", "value" => 253), - array("asystem" => "null", "e107" => "forum_moderators", "type" => "INT", "value" => 2), - array("asystem" => "null", "e107" => "forum_class", "type" => "INT", "value" => 0) - ); - return $rArray; -} - - - function convertForumPosts() -{ - $rArray = array( - array("asystem" => "post_id", "e107" => "thread_id", "type" => "INT"), - array("asystem" => "topic_id", "e107" => "thread_parent", "type" => "INT"), - array("asystem" => "forum_id", "e107" => "thread_forum_id", "type" => "INT"), - array("asystem" => "null", "e107" => "thread_active", "type" => "INT", "value" => 1), - array("asystem" => "poster", "e107" => "thread_user", "type" => "STRING"), - array("asystem" => "post_time", "e107" => "thread_datestamp", "type" => "INT"), - array("asystem" => "post_subject", "e107" => "thread_name", "type" => "STRING"), - array("asystem" => "post_text", "e107" => "thread_thread", "type" => "STRING") - ); - return $rArray; -} -*/ - - - - - - - - - - - - - - -function createQuery($convertArray, $dataArray, $table) -{ - global $tp; - - $columns = "("; - $values = "("; - - - foreach($convertArray as $convert) - { - if($convert['type'] == "STRING") - { - $dataArray[$convert['asystem']] = preg_replace("#\[.*\]#", "", $tp -> toDB($dataArray[$convert['asystem']])); - } - else if($convert['type'] == "STRTOTIME") - { - $dataArray[$convert['asystem']] = strtotime($dataArray[$convert['asystem']]); - } - - $columns .= $convert['e107'].","; - $values .= (array_key_exists("value", $convert) ? "'".$convert['value']."'," : "'".$dataArray[$convert['asystem']]."',"); - } - - - $columns = substr($columns, 0, -1).")"; - $values = substr($values, 0, -1).")"; - - return "INSERT INTO $table $columns VALUES $values"; - -} - - - - - - - - - - -?> \ No newline at end of file