OSDN Git Service

This commit was generated by cvs2svn to compensate for changes in r4,
[nucleus-jp/nucleus-jp-ancient.git] / euc / nucleus / upgrades / index.php
1 <?php\r
2 /**\r
3   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) \r
4   * Copyright (C) 2002-2004 The Nucleus Group\r
5   *\r
6   * This program is free software; you can redistribute it and/or\r
7   * modify it under the terms of the GNU General Public License\r
8   * as published by the Free Software Foundation; either version 2\r
9   * of the License, or (at your option) any later version.\r
10   * (see nucleus/documentation/index.html#license for more info)\r
11   *\r
12   * $Id: index.php,v 1.1.1.1 2005-02-28 07:14:24 kimitake Exp $\r
13   */\r
14 \r
15 include('upgrade.functions.php'); \r
16   \r
17 // check if logged in etc\r
18 if (!$member->isLoggedIn()) {\r
19   upgrade_showLogin('index.php');\r
20 }\r
21 \r
22 if (!$member->isAdmin()) {\r
23   upgrade_error('Only Super-Admins are allowed to perform upgrades');\r
24 }\r
25 \r
26 upgrade_head();\r
27 \r
28 ?>\r
29 \r
30 <h1>Upgrade Scripts</h1>\r
31 \r
32 <div class="note">\r
33 <b>Note:</b> If you aren't upgrading from an old Nucleus version (you installed Nucleus from scratch), you won't need these files.\r
34 </div>\r
35 \r
36 <p>\r
37 When upgrading from an older Nucleus version, upgrades to the database tables are required. This upgrade script allows you to automate these changes.\r
38 </p>\r
39 \r
40 <?php  // calculate current version\r
41       if (!upgrade_checkinstall(96)) $current = 95;\r
42   else  if (!upgrade_checkinstall(10)) $current = 96;\r
43   else  if (!upgrade_checkinstall(11)) $current = 10;\r
44   else  if (!upgrade_checkinstall(15)) $current = 11;  \r
45   else  if (!upgrade_checkinstall(20)) $current = 15;    \r
46   else  if (!upgrade_checkinstall(25)) $current = 20;      \r
47   else  if (!upgrade_checkinstall(30)) $current = 25;      \r
48   else  if (!upgrade_checkinstall(31)) $current = 30;      \r
49   else  if (!upgrade_checkinstall(32)) $current = 31;      \r
50   else  $current = 32;\r
51 \r
52   if ($current == 32) {\r
53     ?>\r
54       <p class="ok">No automatic upgrades required! The database tables have already been updated to the latest version of Nucleus.</p>\r
55     <?php  } else {\r
56     ?>\r
57       <p class="warning"><a href="upgrade.php?from=<?php echo $current?>">Click here to upgrade the database to Nucleus v3.1+</a></p>\r
58     <?php  }\r
59 ?>\r
60 \r
61 <div class="note">\r
62 <b>Note:</b> Don't forget to make a backup of your database every once in a while!\r
63 </div>\r
64 \r
65 <h1>Manual changes</h1>\r
66 \r
67 <p>Some changes need to be done manually. Instructions are given below (if any)</p>\r
68 \r
69 <?php\r
70 $sth = 0;\r
71 if (!$DIR_MEDIA) {\r
72   upgrade_manual_96();\r
73   $sth = 1;\r
74 }\r
75 if (!$DIR_SKINS) {\r
76   upgrade_manual_20();\r
77   $sth = 1;\r
78 }\r
79 \r
80 // some manual code changes are needed in order to get Nucleus to work on php version\r
81 // lower than 4.0.6\r
82 if (phpversion() < '4.0.6') {\r
83   upgrade_manual_php405();\r
84   $sth = 1;\r
85 }\r
86 \r
87 if ($sth == 0)\r
88   echo "<p class='ok'>No manual changes needed. This must be your lucky day!</p>";  \r
89 \r
90 \r
91 \r
92 upgrade_foot();\r
93 \r
94 function upgrade_todo($ver) {\r
95   return upgrade_checkinstall($ver) ? "(<span class='ok'>installed</span>)" : "(<span class='warning'>not yet installed</span>)";\r
96 }\r
97 \r
98 function upgrade_manual_96() {\r
99   global $DIR_NUCLEUS;\r
100   \r
101   $guess = str_replace("/nucleus/","/media/",$DIR_NUCLEUS);\r
102 ?>\r
103   <h2>Changes needed for Nucleus 0.96</h2>\r
104   <p>\r
105     A manual addition needs to be made to <i>config.php</i>, in order to get the media functions to work. Here's what to add:\r
106   </p>\r
107   <pre>\r
108   // path to media dir\r
109   $DIR_MEDIA = '<b><?php echo htmlspecialchars($guess)?></b>';\r
110   </pre>\r
111   \r
112   <p>\r
113   Also, it will be necessary to create that directory yourself. If you want to make file upload possible, you should set the permissions of the media/ directory to 777 (see the documentation/tips.html in Nucleus 0.96+ for a quick guide on setting permissions).\r
114   </p>\r
115   \r
116 <?php }\r
117 \r
118 function upgrade_manual_20() {\r
119   global $DIR_NUCLEUS;\r
120   \r
121   $guess = str_replace("/nucleus/","/skins/",$DIR_NUCLEUS);\r
122 ?>\r
123   <h2>Changes needed for Nucleus 2.0</h2>\r
124   <p>\r
125     A manual addition needs to be made to <i>config.php</i>, in order to get imported skins to work correctly. Here's what to add:\r
126   </p>\r
127   <pre>\r
128   // extra skin files for imported skins\r
129   $DIR_SKINS = '<b><?php echo htmlspecialchars($guess)?></b>';\r
130   </pre>\r
131   \r
132   <p>Also, it will be necessary to create this directory yourself. Downloaded skins can then be expanded into that directory and be imported from inside the Nucleus admin area.</p>\r
133   \r
134   <h3>RSS 2.0 and RSD skin</h3>\r
135   \r
136   <p>When a fresh version of Nucleus 2.0 is installed, an RSS 2.0 (Really Simple Syndication) syndication skin is also installed, as well as an RSD skin (Really Simple Discovery). The files <code>xml-rss2.php</code> and <code>rsd.php</code> are available in the upgrade, however the skin itself needs to be installed manually. After you've uploaded the contents of the <code>upgrade-files</code>, open <code>admin area &gt; nucleus management &gt; skin import</code>. From there, you can install both skins. (Unless you don't want them installed, that is)</p>\r
137   \r
138 <?php }\r
139 \r
140 function upgrade_manual_php405() {\r
141 ?>\r
142 <h2>Changes needed when running PHP versions 4.0.3, 4.0.4 and 4.0.5</h2>\r
143 <p>\r
144   There are two files that need to be changed when running PHP versions lower than 4.0.6. Even better would be to upgrade to PHP 4.0.6 or PHP 4.2.2+ (there are security issues with all PHP versions &lt; 4.0.6 and 4.2.2). If you're not able or not willing to upgrade, here's what to change:\r
145 </p>\r
146 <ul>\r
147   <li>Make sure the code in nucleus/libs/PARSER.php is as follows (starting from line 84):\r
148     <pre>\r
149 \r
150   if (in_array($actionlc, $this-&gt;actions) || $this-&gt;norestrictions ) {\r
151     <strong>$this-&gt;call_using_array($action, $this-&gt;handler, $params);</strong>\r
152   } else {\r
153     // redirect to plugin action if possible\r
154     if (in_array('plugin', $this-&gt;actions) \r
155       && $manager-&gt;pluginInstalled('NP_'.$action))\r
156       $this-&gt;doAction('plugin('.$action.\r
157         $this-&gt;pdelim.implode($this-&gt;pdelim,$params).')');\r
158     else\r
159       echo '&lt;b&gt;DISALLOWED (' , $action , ')&lt;/b&gt;';\r
160   }\r
161 \r
162 \r
163 }\r
164      </pre>\r
165     </li>\r
166     <li>Make sure the code in nucleus/libs/PARSER.php is as follows (starting from line 75):\r
167     <pre>\r
168 // $params = array_map('trim',$params);\r
169 foreach ($params as $key =&gt; $value) { $params[$key] = trim($value); }\r
170     </pre>\r
171     </li>\r
172   </ul>\r
173   \r
174 <?php }\r
175 \r
176 ?>\r