OSDN Git Service

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