OSDN Git Service

本家Nucleus CMSの開発を補助するためにコミット
[nucleus-jp/nucleus-next.git] / nucleus / convert / weblog.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2006 The Nucleus Group
5  *
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)
11  */
12 /**
13  * This script will import a Blogger blog into a Nucleus blog, using
14  * a easy to use wizard.
15  *
16  * Notes:
17  *   - Templates are not converted
18  *   - Nucleus should already be installed
19  *       - Members should exist for all teammembers
20  *
21  * @license http://nucleuscms.org/license.txt GNU General Public License
22  * @copyright Copyright (C) 2002-2006 The Nucleus Group
23  * @version $Id: weblog.php 846 2005-12-30 10:38:32Z dekarma $
24  */
25
26 include("../../config.php");
27 include("functions.inc.php");
28 include($DIR_LIBS . "ADMIN.php");
29 include($DIR_LIBS . "MEDIA.php");
30
31 if (!$member->isLoggedIn()) {
32         convert_showLogin('weblog.php');
33 }
34
35 if (!$member->isAdmin()) {
36         convert_doError('Only Super-Admins are allowed to perform blog conversions');
37 }
38
39 $ver = convert_getNucleusVersion();
40 if ($ver > 210)
41         convert_doError("You should check the Nucleus website for updates to this convert tool. This one might not work with your current Nucleus installation.");
42
43 // include PRAX lib (to read XML files easily)
44 include ('PRAX.php');
45
46 switch($action) {
47         case "login": // drop through
48         default:
49                 bc_getBloggerBlogID();
50 }
51
52 // step 1: get the Blogger Blog ID
53 function bc_getBloggerBlogID() {
54         global $HTTP_SERVER_VARS, $PHP_SELF;
55
56         convert_head();
57
58         ?>
59                 <div class="note">
60                 <em>Thanks to <a href="http://www.gagaweb.com/">Eric Driesen</a> for providing this we::blog template.</em>
61                 <br :>
62                 <b>Note:</b> This conversion tool will <b>NOT</b> convert your comments.
63                 </div>
64
65                 <h1>Step 1: Exporting to a file</h1>
66
67                 <p>
68                 The first step in the conversion is to export all your <a href="http://www.danchan.com/weblog">we::blog</a> entries into one single file.
69                 <br />The full procedure is explained below:
70                 </p>
71
72                 <h2>Exporting</h2>
73
74                 <div class="note"><b>Note:</b> If you intend to keep using your weblog afterwards, write down the changes you made, so they can be undone afterwards. For the templates, copy paste the old ones in a textfile.</div>
75
76                 <ol>
77                         <li>
78                                 Change the template of your blog to the following:
79
80                                 <pre>&lt;!-- Your weblog template --&gt;
81 &lt;html&gt;
82 &lt;head&gt;
83 &lt;title&gt;GaGa WebCam Log&lt;/title&gt;
84 &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
85
86 &lt;!-- ********************************************************************************** --&gt;
87 &lt;!-- DO NOT REMOVE OR CHANGE ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING --&gt;
88 &lt;!-- ********************************************************************************** --&gt;
89 &lt;!--
90 &lt;weblog&gt;
91   translate          {:-)}                {&lt;img src="/weblog/image/emoticon/smiley.gif"&gt;}
92
93   translate_template {[#edit]}           {[IF $edit_link][&lt;a href="[$edit_link]"&gt;edit&lt;/a&gt;][ENDIF]}
94   translate_template {[#date_header]}    {[IF $date_header]&lt;p class="commentdateheader"&gt;[$post_day]/[$post_month]/[$post_year]&lt;/p&gt;[ENDIF]}
95   translate_template {[#comments_page]}  {[IF $generation]}
96   translate_template {[/#comments_page]} {[ENDIF]}
97   translate_template {[#main_page]}      {[IF $generation][ELSE]}
98   translate_template {[/#main_page]}     {[ENDIF]}
99   translate_template {[#messages]}       {[LOOP $messages]}
100   translate_template {[/#messages]}      {[ENDLOOP]}
101   translate_template {[#archives]}       {[LOOP $archives]}
102   translate_template {[/#archives]}      {[ENDLOOP]}
103   translate_template {[#hidden_message]}
104   {
105         [IF $message_status_hide]
106           [IF $is_owner]
107                 &lt;p class="commenttitle" id="[$message_id]"&gt;&lt;font color="#FF0000" face="tahoma"&gt;::HIDDEN::&lt;/font&gt;
108                 [IF $comment_link]&lt;a class="navigate" href="[$comment_link]"&gt;[ENDIF][$message_title][IF $comment_link]&lt;/a&gt;[ENDIF]
109                 [IF $edit_link][&lt;a class="navigate" href="[$edit_link]"&gt;edit&lt;/a&gt;][ENDIF]&lt;/p&gt;
110           [ENDIF]
111         [ENDIF]
112   }
113   translate_template {[#visible_message]}  {[IF $message_status_hide][ELSE]}
114   translate_template {[/#visible_message]} {[ENDIF]}
115   translate_template {[#post]} {[IF $add_comment_link]&lt;br&gt;&lt;p class="addcomment"&gt;[ &lt;a class="navigate" href="[$add_comment_link]"&gt;[IF $generation]add a comment[ELSE]post a message[ENDIF]&lt;/a&gt; ]&lt;/p&gt;[ENDIF]}
116   translate_template {[#comment]}
117   {
118         [IF $comment_link]
119         &lt;a class="navigate" href="[$comment_link]"&gt;&lt;nobr&gt;[$num_comments] comments&lt;/nobr&gt;&lt;/a&gt;
120         [ENDIF]
121   }
122   translate_template {[#post_datetime]} {[$post_month]/[$post_day]/[$post_year] [$post_hour]:[$post_minute] PM}
123   translate_template {[#mod_datetime]} {[$mod_month_abbrev] [$mod_day], [$mod_year] at [$mod_hour]:[$mod_minute]}
124
125   share        { template; }
126   generation.0 { comments: yes; show_depth: 1; max_comments: 1000; max_days: 365; sort_comments: new_to_old; sort_days: new_to_old; permissions: owner; }
127   generation.1 { comments: yes; show_depth: 1; max_comments: 1000; max_days: 365; sort_comments: new_to_old; sort_days: new_to_old; permissions: all; }
128   generation.2 { comments: no; }
129   generation.open { comments: yes; show_depth: 16; max_comments: 1000; }
130   timezone { +2 }
131 &lt;/weblog&gt;
132 --&gt;
133 &lt;!-- ********************************************************************************** --&gt;
134 &lt;!-- DO NOT REMOVE OR CHANGE ANYTHING ABOVE THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING --&gt;
135 &lt;!-- ********************************************************************************** --&gt;
136
137 &lt;/head&gt;
138
139 &lt;body&gt;
140 &lt;style type = "text/css"&gt;
141         &lt;!--
142           .pagetitle  { font-family: Comic Sans MS; font-size: 10pt; font-weight: bold; color: #000000; margin-top: 0px; margin-bottom: 0px;  margin-left: 0px; margin-right: 0px }
143           .pagebody   { font-family: Comic Sans MS; font-size: 9pt; color: #000000; margin-top: 0px; margin-bottom: 0px;  margin-left: 0px; margin-right: 0px }
144           .pagebyline   { font-family: Comic Sans MS; font-size: 8pt; color: #666666; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px }
145
146           .addcomment { font-family: Comic Sans MS; font-size: 8pt; font-weight: bold; color: #000000; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px }
147
148           .commenttitle  { font-family: Comic Sans MS; font-size: 10pt; font-weight: bold; color: #000000;  margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px }
149           .commentbody   { font-family: Comic Sans MS; font-size: 9pt; color: #000000; margin-top: 0px;  margin-bottom: 0px;   margin-left: 0px; margin-right: 0px }
150           .commentbyline { font-family: Comic Sans MS; font-size: 8pt; color: #666666; margin-top: 0px;  margin-bottom: 10px;  margin-left: 0px; margin-right: 0px }
151           .commentdateheader { font-family: Comic Sans MS; font-size: 8pt; color: #000000; margin-top: 0px; margin-bottom: 0px;   margin-left: 0px; margin-right: 0px }
152
153           .navigate { font-family: Comic Sans MS; font-size: 8pt; font-weight: bold; color: #000000 }
154
155           .responseto { font-family: Comic Sans MS; font-size: 8pt; color: #666666; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right:0px }
156
157           a.navigate:link     { color: rgb(0,102,153); text-decoration : underline; }
158           a.navigate:visited  { color: rgb(0,153,102); text-decoration : underline; }
159           a.navigate:hover    { color: rgb(0,102,102); text-decoration : underline; }
160         --&gt;
161   &lt;/style&gt;
162 &lt;!-- the contents of the weblog --&gt;
163
164 &lt;!-- main weblog page --&gt;
165
166
167
168
169
170 &lt;?xml version="1.0"?&gt;
171 [#main_page]
172 &lt;bloggerblog&gt;
173
174
175 [#messages][#visible_message]
176   &lt;blogentry&gt;
177    &lt;body&gt;&lt;![CDATA[[$message_body]]]&gt;&lt;/body&gt;
178    &lt;title&gt;[$message_title]&lt;/title&gt;
179    &lt;date&gt;[$post_month]/[$post_day]/[$post_year] [$post_hour_dd]:[$post_minute]:[$post_second] [$post_time_ap]m&lt;/date&gt;
180    &lt;author&gt;[$author_nickname]&lt;/author&gt;
181   &lt;/blogentry&gt;
182
183  [/#visible_message]
184 [/#messages]
185 &lt;/bloggerblog&gt;
186 [/#main_page]
187
188 &lt;/body&gt;
189 &lt;/html&gt;</pre>
190                                 Don't forget to save changes!
191                         </li>
192                         <li>Save the generated page as <tt>blogger.xml</tt></li>
193                         <li>Edit <tt>blogger.xml</tt> and remove the header and footer of the file (the file should start with <code>&lt;bloggerblog&gt;</code> and end with <code>&lt;/bloggerblog&gt;</code>)</li>
194                 </ol>
195
196                 <h2>Importing</h2>
197
198                 <p>
199                 Now you have a file called <b>blogger.xml</b>. Upload it in the same directory as the convert files (<tt>/nucleus/convert</tt>) and continue to the next step.
200                 </p>
201
202                 <p>
203                 <form method="post" action="blogger.php">
204                 <input type="submit" value="Next Step: Assign Members to Authors" />
205                 <input type="hidden" name="action" value="assignMembers" />
206                 </form>
207                 </p>
208
209                 <div class="note">Note: the next steps are the same as for Blogger.com blogs, so don't be surprised to see Blogger.com mentioned.</div>
210
211         <?php
212         convert_foot();
213 }
214
215
216
217 ?>