OSDN Git Service

Unsupport PHP4.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / upgrades / index.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2010 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  * @license http://nucleuscms.org/license.txt GNU General Public License
14  * @copyright Copyright (C) 2002-2010 The Nucleus Group
15  * @version $Id$
16  * $NucleusJP: index.php,v 1.11 2007/04/26 08:45:26 kimitake Exp $
17  *
18  */
19
20 include('upgrade.functions.php');
21
22 // check if logged in etc
23 if (!$member->isLoggedIn()) {
24         upgrade_showLogin('index.php');
25 }
26
27 if (!$member->isAdmin()) {
28         upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
29 }
30
31 upgrade_head();
32
33 ?>
34
35 <h1>アップグレードスクリプト集</h1>
36
37 <div class="note">
38 <b>Note:</b> もし古いバージョンの Nuclues からアップグレードしようとしているのでなければ(つまりまっさらな状態からインストールしたのであれば)、これらのスクリプト集は必要ありません。
39 </div>
40
41 <p>Nucleus CMSはバージョンアップ毎に、データベースのテーブル構造を少しずつ変えています。このスクリプト集は、古いバージョンの Nucleus からアップグレードする際に必要な、データベーステーブルのアップグレードを行います。</p>
42
43 <?php   // calculate current version
44         if (!upgrade_checkinstall(96)) $current = 95;
45         else    if (!upgrade_checkinstall(100)) $current = 96;
46         else    if (!upgrade_checkinstall(110)) $current = 100;
47         else    if (!upgrade_checkinstall(150)) $current = 110;
48         else    if (!upgrade_checkinstall(200)) $current = 150;
49         else    if (!upgrade_checkinstall(250)) $current = 200;
50         else    if (!upgrade_checkinstall(300)) $current = 250;
51         else    if (!upgrade_checkinstall(310)) $current = 300;
52         else    if (!upgrade_checkinstall(320)) $current = 310;
53         else    if (!upgrade_checkinstall(330)) $current = 320;
54         else    if (!upgrade_checkinstall(331)) $current = 330;
55         else    if (!upgrade_checkinstall(340)) $current = 331;
56         else    if (!upgrade_checkinstall(350)) $current = 340;
57         else    if (!upgrade_checkinstall(360)) $current = 350;
58         else    $current = 360;
59         
60         if ($current == 360) {
61 ?>
62 <p class="ok">自動でできるアップグレードはありません。データベースは既に最新の Nucleus 用にアップデートされています。</p>         
63 <?php
64         } else if (phpversion() < '5') {
65 ?>              
66 <p class="deprecated">警告! 動作しているPHPのバージョンが古く、正常な動作を保証できません。アップグレード作業を中止して、PHP5以上が使えないかどうか、サーバ管理者に確認して下さい。</p>
67 <?php           
68         } else {
69 ?>
70 <p class="warning"><a href="upgrade.php?from=<?php echo $current?>">ここをクリックしてデータベースを Nucleus v3.62 用にアップグレードします</a></p>
71 <?php
72          }
73 ?>
74
75 <div class="note">
76 <b>注意:</b> 作業中、各ステップごとにデータベースのバックアップを忘れないようにして下さい。
77
78 </div>
79
80 <h1>手動変更</h1>
81
82 <p>いくつかの変更は手動で行う必要があります。下記にその手順を示します。</p>
83
84 <?php
85 $from = intGetVar('from');
86 if (!$from) 
87         $from = $current;
88
89 $sth = 0;
90 if (!$DIR_MEDIA) {
91         upgrade_manual_96();
92         $sth = 1;
93 }
94 if (!$DIR_SKINS) {
95         upgrade_manual_20();
96         $sth = 1;
97 }
98
99 // some manual code changes are needed in order to get Nucleus to work on php version
100 // lower than 4.0.6
101 if (phpversion() < '4.0.6') {
102         upgrade_manual_php405();
103         $sth = 1;
104 }
105
106 // from v3.3, atom feed supports 1.0 and blogsetting is added
107 $sth = upgrade_manual_atom1_0();
108
109 // upgrades from pre-340 version need to be told of recommended .htaccess files for the media and skins folders.
110 // these .htaccess files are included in new installs of 340 or higher
111 if (in_array($from,array(95,96)) || $from < 340) {
112         upgrade_manual_340();
113         $sth = 1;
114
115
116 // upgrades from pre-350 version need to be told of deprecation of PHP4 support and two new plugins 
117 // included with 3.51 and higher
118 if (in_array($from,array(95,96)) || $from < 350) {
119         upgrade_manual_350();
120         $sth = 1;
121
122
123 if ($sth == 0)
124         echo "<p class='ok'>手動変更は必要ありません。今日はラッキーな日ですね!</p>";
125
126
127
128 upgrade_foot();
129
130 function upgrade_todo($ver) {
131         return upgrade_checkinstall($ver) ? "(<span class='ok'>インストール済み</span>)" : "(<span class='warning'>インストールが必要</span>)";
132 }
133
134 function upgrade_manual_96() {
135         global $DIR_NUCLEUS;
136
137         $guess = str_replace("/nucleus/","/media/",$DIR_NUCLEUS);
138 ?>
139         <h2>Nucleus 0.96 用に必要な変更</h2>
140         <p>
141                 メディア機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
142         </p>
143         <pre>
144         // path to media dir
145         $DIR_MEDIA = '<b><?php echo htmlspecialchars($guess)?></b>';
146         </pre>
147
148         <p>
149         また、ディレクトリもあなた自身の手で作る必要があります。もしファイルのアップロードを可能にしたいのであれば、media/ ディレクトリのパーミッションを777にします。(Nucleus 0.96+ のためのパーミッションの設定に関するクイックガイドが documentation/tips.html にあります)
150         </p>
151
152 <?php }
153
154 function upgrade_manual_200() {
155         global $DIR_NUCLEUS;
156
157         $guess = str_replace("/nucleus/","/skins/",$DIR_NUCLEUS);
158 ?>
159         <h2>Nucleus 2.0 用に必要な変更</h2>
160         <p>
161                 スキンの取り込み機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
162         </p>
163         <pre>
164         // extra skin files for imported skins
165         $DIR_SKINS = '<b><?php echo htmlspecialchars($guess)?></b>';
166         </pre>
167
168         <p>また、ディレクトリもあなた自身の手で作る必要があります。これでダウンロードしたスキンを上記ディレクトリに展開したり、Nucleus 管理画面から取り込んだりできるようになります。</p>
169
170         <h3>RSS 2.0 と RSD スキン</h3>
171
172         <p>Nucleus 2.0 を新規にインストールしたとき、RSD(Really Simple Discovery) 用のスキンの他に、RSS 2.0(Really Simple Syndication)用のスキンもまたインストールされます。<code>xml-rss2.php</code> と <code>rsd.php</code> の両ファイルはアップグレードされますが、スキンに関しては手動でインストールする必要があります。<code>upgrade-files</code>の中身をアップロードしたあと、管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから両スキンをインストールすることができます(もしインストールするつもりがなければ、しなくても結構です)。</p>
173
174 <?php }
175
176 function upgrade_manual_340() {
177         global $DIR_NUCLEUS;
178
179 ?>
180         <h2>Nucleus 3.4 用に必要な変更</h2>
181         <p>
182                 <em>skins</em>ディレクトリと<em>media</em>ディレクトリに「.haccess」を設置して、アクセス制限をかけることが推奨されます。この変更は、Nucleusの機能やセキュリティに直接関係があるわけではありませんが、不正アクセスを防ぐ為の重要な助けになるでしょう。
183         </p>
184         
185         <p>
186                 手順は以下の2つのファイルに書いてありますので参考にしてください:
187                 <ul>
188                          <li><a href="../../extra/htaccess/media/readme.ja.txt">extra/htaccess/media/readme.ja.txt</a></li>
189                          <li><a href="../../extra/htaccess/skins/readme.ja.txt">extra/htaccess/skins/readme.ja.txt</a></li>
190                 </ul>
191         </p>
192         
193 <?php }
194
195 function upgrade_manual_350() {
196         global $DIR_NUCLEUS;
197
198 ?>
199         <h2>Nucleus 3.51に関する重要なお知らせ</h2>
200         
201 <?php   // Give user warning if they are running old version of PHP
202                                 if (phpversion() < '5') {
203                                                                 echo '<p>警告:サーバで稼動しているPHPのバージョンが、NucleusCMSの動作保障外の古いバージョンのようです。PHP5以上にアップグレードしてください!</p>';
204                                 }
205 }
206
207 function upgrade_manual_php405() {
208 ?>
209 <h2>PHP のバージョンが 4.0.3, 4.0.4 または 4.0.5 の場合に必要となる変更</h2>
210 <p>
211         PHP のバージョンが 4.0.6 より以前の場合、変更が必要なファイルが2つあります。PHP のバージョンを 4.0.6 や 4.2.2+以降のものにアップグレードした方がいいでしょう(4.0.6 や 4.2.2 以前のものにはセキュリティー問題があります)。もし PHP のアップグレードが困難もしくは、する予定がない場合は、以下のファイルを変更して下さい。
212 </p>
213 <ul>
214         <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(84行目から):
215                 <pre>
216
217         if (in_array($actionlc, $this-&gt;actions) || $this-&gt;norestrictions ) {
218                 <strong>$this-&gt;call_using_array($action, $this-&gt;handler, $params);</strong>
219         } else {
220                 // redirect to plugin action if possible
221                 if (in_array('plugin', $this-&gt;actions)
222                         && $manager-&gt;pluginInstalled('NP_'.$action))
223                         $this-&gt;doAction('plugin('.$action.
224                                 $this-&gt;pdelim.implode($this-&gt;pdelim,$params).')');
225                 else
226                         echo '&lt;b&gt;DISALLOWED (' , $action , ')&lt;/b&gt;';
227         }
228
229
230 }
231                  </pre>
232                 </li>
233                 <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(75行目から):
234                 <pre>
235 // $params = array_map('trim',$params);
236 foreach ($params as $key =&gt; $value) { $params[$key] = trim($value); }
237                 </pre>
238                 </li>
239         </ul>
240
241 <?php }
242
243 function upgrade_manual_atom1_0() {
244
245                 $sth = 0;
246
247                 // atom 1.0
248                 $query = 'SELECT sddesc FROM ' . sql_table('skin_desc')
249                                 . ' WHERE sdname="feeds/atom"';
250                 $res = mysql_query($query);
251                 while ($o = mysql_fetch_object($res)) {
252                                 if ($o->sddesc=='Atom 0.3 weblog syndication')
253                                 {
254                                                 $sth = 1;
255 ?>
256 <h2>Atom 1.0</h2>
257 <p>Nucleus 3.3 から atom feed が 1.0 対応になりましたので、次の手順でスキン・テンプレートのアップグレードをして下さい。</p>
258
259 <p>管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから atom を選択し、読み込みボタンを押して上書きインストールしてください。</p>
260
261 <p>もし atom のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/atom/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
262
263 <?php
264                                 }
265                 }
266
267                 // default skin
268                 $query = 'SELECT tdnumber FROM ' . sql_table('template_desc')
269                                          . ' WHERE tdname="default/index"';
270                 $res = mysql_query($query);
271                 $tdnumber = 0;
272                 while ($o = mysql_fetch_object($res)) {
273                                 $tdnumber = $o->tdnumber;
274                 }
275                 if ($tdnumber>0)
276                 {
277                                 $query = 'SELECT tpartname FROM ' . sql_table('template')
278                                                          . ' WHERE tdesc=' . $tdnumber . ' AND tpartname="BLOGLIST_LISTITEM"';
279                                 $res = mysql_query($query);
280                                 if (!mysql_fetch_object($res)) {
281
282                                                 $sth = 1;
283 ?>
284 <h2>Default スキン</h2>
285 <p>Nucleus 3.3 からいくつかのフォームの CSS が変更になっています。たとえば最初のページのログインフォームや、コメント投稿のためのフォームなど。このためフォームの表示が崩れるので、次の手順でDefault スキンのアップグレードをして下さい。</p>
286
287 <p>管理者画面を開き、管理ホームにあるスキンの「読込/書出」を開きます。そこから default を選択し、読み込みボタンを押して上書きインストールしてください。</p>
288
289 <p>もし default のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/default/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
290 <?php
291                                 }
292                 }
293
294                 return $sth;
295 }
296
297 ?>