OSDN Git Service

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