3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2006 The Nucleus Group
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * (see nucleus/documentation/index.html#license for more info)
13 * This script is intended to be used in conjunction with one
14 * of the specific convert tools that exist for different
17 * Here's how everything works together
19 * - bloggerToXml.php: Blogger -> generic XML
20 * - pMachineToXml.php pMachine -> generic XML
21 * - MovableTypeToXml.php MT -> generic XML
23 * - genericImport.php generic XML -> Nucleus
25 * @license http://nucleuscms.org/license.txt GNU General Public License
26 * @copyright Copyright (C) 2002-2006 The Nucleus Group
27 * @version $Id: genericImport.php 846 2005-12-30 10:38:32Z dekarma $
30 include("../../config.php");
31 include("functions.inc.php");
32 include($DIR_LIBS . "ADMIN.php");
33 include($DIR_LIBS . "MEDIA.php");
35 if (!$member->isLoggedIn()) {
36 convert_showLogin('genericImport.php');
39 if (!$member->isAdmin()) {
40 convert_doError('Only Super-Admins are allowed to perform blog conversions');
43 $ver = convert_getNucleusVersion();
45 convert_doError("You should check the Nucleus website for updates to this convert tool. This one might not work with your current Nucleus installation.");
47 // include PRAX lib (to read XML files easily)
52 gi_assignMembers(); break;
54 gi_doConversion(); break;
55 case "login": // drop through
60 // step 1: Let the user choose which XML file she wants to import
61 function gi_chooseXmlFile() {
62 global $HTTP_SERVER_VARS, $PHP_SELF;
68 <h1>Step 1: Choose File To Import</h1>
71 You're about to import the contents of a weblog that was created with another blogging tool than Nucleus.
74 <h2>Export to generic XML</h2>
77 Before you can start the actual import process, you'll need to export the contents from your (non-Nucleus) weblog into a generic XML file using one of the conversion scripts listed below. Such scripts are available for a variety of blog scripts:
81 <li><a href="bloggerToXml.php">Blogger</a> <strong>(not implemented yet)</strong></li>
82 <li><a href="pMachineToXml.php">pMachine</a> <strong>(not implemented yet)</strong></li>
83 <li><strong>(to be worked out)</strong></li>
86 <h2>Import from generic XML</h2>
89 You'll end up with an XML file (e.g. <code>export.xml</code>). Upload this file to the same directory as the convert files (<code>/nucleus/convert/</code>) and reload this page. Your file should appear in the selection box below.
93 <strong>(to be worked out)</strong>
95 <form method="post" action="genericImport.php"><div>
96 <input type="submit" value="Next Step: Assign Members to Authors" />
97 <input type="hidden" name="action" value="assignMembers" />
106 function gi_assignMembers() {
110 if (!file_exists('export.xml'))
111 convert_doError("export.xml not found. Make sure it is in the correct directory");
112 if (!is_readable('export.xml'))
113 convert_doError("The export.xml file is not readable. Make sure the file permissions are set correctly so PHP can access it.");
118 <form method="post" action="genericImport.php">
121 <h1>Step 2: Assign Members to Authors</h1>
124 Below is a list of all the authors that Nucleus could discover (only authors that have posted at least one entry are listed). Please assign a Nucleus Member to all of these authors.
131 <th>Nucleus Member</th>
140 <h1>Choose Destination Weblog</h1>
143 There are two options: you can either choose an existing blog to add the imported entries into, or you can choose to create a new weblog.
147 <input name="createnew" value="0" type="radio" checked='checked' id="createnew_no" /><label for="createnew_no">Choose existing weblog to add to:</label>
149 <?php $query = 'SELECT bname as text, bnumber as value FROM '.sql_table('blog');
150 $template['name'] = 'blogid';
151 $template['selected'] = $CONF['DefaultBlog'];
152 echo showlist($query,'select',$template);
156 <input name="createnew" value="1" type="radio" id="createnew_yes" /><label for="createnew_yes">Create new weblog</label>
158 <li>New blog name: <input name="newblogname" /></li>
160 <?php $query = 'SELECT mname as text, mnumber as value FROM '.sql_table('member');
162 $template['name'] = 'newowner';
163 echo showlist($query,'select',$template);
169 <h1>Do the conversion!</h1>
171 <input type="hidden" name="authorcount" value="<?php echo $idx?>" />
172 <input type="submit" value="Step 3: Do the conversion!" />
173 <input type="hidden" name="action" value="doConversion" />
177 <b>Note:</b> Clicking the button once is enough, even if it takes a while to complete.
187 function gi_doConversion() {