$conn = sql_connect_args('localhost','','');\r
$result = @sql_query('SELECT VERSION() AS version', $conn);\r
\r
- if ($result != FALSE && @sql_num_rows($result) > 0) {\r
+ if ($result != FALSE && sql_num_rows($result) > 0) {\r
$row = sql_fetch_array($result);\r
$match = explode('.', $row['version']);\r
} else {\r
\r
// 7. update GOD member\r
$query = 'UPDATE ' . tableName('nucleus_member')\r
- . " SET mname = '" . sql_real_escape_string($user_name) . "',"\r
- . " mrealname = '" . sql_real_escape_string($user_realname) . "',"\r
- . " mpassword = '" . md5(sql_real_escape_string($user_password) ) . "',"\r
- . " murl = '" . sql_real_escape_string($config_indexurl) . "',"\r
- . " memail = '" . sql_real_escape_string($user_email) . "',"\r
+ . " SET mname = '" . addslashes($user_name) . "',"\r
+ . " mrealname = '" . addslashes($user_realname) . "',"\r
+ . " mpassword = '" . md5(addslashes($user_password) ) . "',"\r
+ . " murl = '" . addslashes($config_indexurl) . "',"\r
+ . " memail = '" . addslashes($user_email) . "',"\r
. " madmin = 1,"\r
. " mcanlogin = 1"\r
. " WHERE"\r
\r
// 8. update weblog settings\r
$query = 'UPDATE ' . tableName('nucleus_blog')\r
- . " SET bname = '" . sql_real_escape_string($blog_name) . "',"\r
- . " bshortname = '" . sql_real_escape_string($blog_shortname) . "',"\r
- . " burl = '" . sql_real_escape_string($config_indexurl) . "'"\r
+ . " SET bname = '" . addslashes($blog_name) . "',"\r
+ . " bshortname = '" . addslashes($blog_shortname) . "',"\r
+ . " burl = '" . addslashes($config_indexurl) . "'"\r
. " WHERE"\r
. " bnumber = 1";\r
\r
\r
foreach ($aConfPlugsToInstall as $plugName) {\r
// do this before calling getPlugin (in case the plugin id is used there)\r
- $query = 'INSERT INTO ' . sql_table('plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ', "' . sql_real_escape_string($plugName) . '")';\r
+ $query = 'INSERT INTO ' . sql_table('plugin') . ' (porder, pfile) VALUES (' . (++$numCurrent) . ', "' . addslashes($plugName) . '")';\r
sql_query($query);\r
\r
// get and install the plugin\r
$plugin->plugid = $numCurrent;\r
\r
if (!$plugin) {\r
- sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\'' . sql_real_escape_string($plugName) . '\'');\r
+ sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\'' . addslashes($plugName) . '\'');\r
$numCurrent--;\r
array_push($aErrors, _ERROR22 . $plugName);\r
continue;\r
\r
function updateConfig($name, $val) {\r
global $MYSQL_CONN;\r
- $name = sql_real_escape_string($name);\r
- $val = trim(sql_real_escape_string($val) );\r
+ $name = addslashes($name);\r
+ $val = trim(addslashes($val) );\r
\r
$query = 'UPDATE ' . tableName('nucleus_config')\r
. " SET value = '$val'"\r
`bcomments` tinyint(2) NOT NULL default '1',
`bmaxcomments` int(11) NOT NULL default '0',
`btimeoffset` decimal(3,1) NOT NULL default '0.0',
- `bnotify` varchar(60) default NULL,
+ `bnotify` varchar(128) default NULL,
`burl` varchar(100) default NULL,
`bupdate` varchar(60) default NULL,
`bdefskin` int(11) NOT NULL default '1',
global $CONF, $blog, $query, $amount;
// TODO: Move request uri to linkparams. this is ugly. sorry for that.
$startpos = intval($startpos); // will be 0 when empty.
- $path = $parsed['path'];
+ $path = $parsed['path'];
$parsed = parse_url(serverVar('REQUEST_URI'));
$parsed = $parsed['query'];
$url = '';
}\r
\r
// check length\r
- if (strlen($body) < 3) {\r
+ if (strlen($body) < 3)\r
+ {\r
$this->error(_ERROR_COMMENT_NOCOMMENT);\r
}\r
if (strlen($body)>5000)\r
// begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.\r
if (!preg_match('#^https?://#', $url) )\r
{\r
- $url = "http://" . $url;\r
+ $url = 'http://' . $url;\r
}\r
$admin = postVar('admin');\r
$canlogin = postVar('canlogin');\r
'extra' => $this->commentsObj->itemActions->linkparams
)
);
- // else: non-member comment
}
+ // else: non-member comment
else
{
// create smart links
// check if there exists a item for this date
$item =& $manager->getItem($this->itemid,0,0);
- if (!$item) {
+ if (!$item)
+ {
return _ERROR_NOSUCHITEM;
}
- if ($item['closed']) {
+ if ($item['closed'])
+ {
return _ERROR_ITEMCLOSED;
}
}
// check lengths of comment
- if (strlen($comment['body'])<3) {
+ if (strlen($comment['body'])<3)
+ {
return _ERROR_COMMENT_NOCOMMENT;
}
- if (strlen($comment['body'])>5000) {
+ if (strlen($comment['body'])>5000)
+ {
return _ERROR_COMMENT_TOOLONG;
}
// only check username if no member logged in
- if (!$member->isLoggedIn()) {
+ if (!$member->isLoggedIn())
+ {
if (strlen($comment['user'])<2)
return _ERROR_COMMENT_NOUSERNAME;
}
if ((strlen($comment['email']) != 0) && !(isValidMailAddress(trim($comment['email']) ) ) )
+ {
return _ERROR_BADMAILADDRESS;
}
// can change 'error' to something other than '1')
$result = 1;
$manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck));
-
return $result;
}
-
}
-
?>
\ No newline at end of file
// leaving the keys in the database is not a real problem, since they're member-specific and
// only valid for a period of one hour
// ]
- // sql_query('DELETE FROM '.sql_table('tickets').' WHERE member=' . intval($memberId). ' and ticket=\''.sql_real_escape_string($ticket).'\'');
+ // sql_query('DELETE FROM '.sql_table('tickets').' WHERE member=' . intval($memberId). ' and ticket=\''.addslashes($ticket).'\'');
return true;
} else {
// not a valid ticket
}\r
\r
/* Return if not index.php */\r
- if ( $phppath!=strtolower($plugin_name).'/' && $phppath!=strtolower($plugin_name).'/index.php' ) {\r
+ if ( ($phppath != strtolower($plugin_name) . '/') && ($phppath != strtolower($plugin_name) . '/index.php') )\r
+ {\r
return;\r
}\r
\r
/* Exit if not logged in. */\r
- if ( !$member->isLoggedIn() ) {\r
+ if ( !$member->isLoggedIn() )\r
+ {\r
exit(_GFUNCTIONS_YOU_AERNT_LOGGEDIN);\r
}\r
\r
global $manager,$DIR_LIBS,$DIR_LANG,$HTTP_GET_VARS,$HTTP_POST_VARS;\r
\r
/* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */\r
- if (!($p_translated=serverVar('PATH_TRANSLATED'))) {\r
+ if (!($p_translated=serverVar('PATH_TRANSLATED')))\r
+ {\r
$p_translated=serverVar('SCRIPT_FILENAME');\r
}\r
if ($file=@file($p_translated))\r
$prevline='';\r
foreach($file as $line)\r
{\r
- if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line)) {\r
+ if (preg_match('/[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]/i',$prevline.$line))\r
+ {\r
return;\r
}\r
$prevline=$line;\r
if ($uri=serverVar('REQUEST_URI'))\r
{\r
list($uri,$qstring)=explode('?',$uri);\r
- } else {\r
+ }\r
+ else\r
+ {\r
if ( !($uri=serverVar('PHP_SELF')) ) {\r
$uri=serverVar('SCRIPT_NAME');\r
}\r
$qstring=serverVar('QUERY_STRING');\r
}\r
- if ($qstring) {\r
+ if ($qstring)\r
+ {\r
$qstring='?'.$qstring;\r
}\r
echo '<p>'._SETTINGS_UPDATE.' : '._QMENU_PLUGINS.' <span style="color:red;">'.htmlspecialchars($plugin_name)."</span> ?</p>\n";\r
<?xml version="1.0" encoding="<%text(_CHARSET)%>"?>\r
-<!-- %xmldeclaration% -->\r
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
<html <%text(_HTML_XML_NAME_SPACE_AND_LANG_CODE)%>>\r
<head>\r
<?xml version="1.0" encoding="<%text(_CHARSET)%>"?>\r
-<!-- %xmldeclaration% -->\r
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
<html <%text(_HTML_XML_NAME_SPACE_AND_LANG_CODE)%>>\r
<head>\r
echo "<a href='index.php?action=itemcommentlist&itemid=$current->inumber'>";
echo "( " . sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())." )</a>";
}
- else
- {
+ else {
echo _LIST_ITEM_NOCONTENT;
}
echo "</td>";
<input name="collection" type="hidden" value="<?php echo htmlspecialchars(requestVar('collection'))?>" />
<?php } // if sizeof
?>
- <br /><br />
- <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />
+ <br /><br />
+ <?php
+ $manager->notify(
+ 'MediaUploadFormExtras',
+ array()
+ );
+ ?>
+ <br /><br />
+ <input type="submit" value="<?php echo _UPLOAD_BUTTON?>" />
</div>
</form>
*/
function media_upload() {
global $DIR_MEDIA, $member, $CONF;
-
+
$uploadInfo = postFileInfo('uploadfile');
-
+
$filename = $uploadInfo['name'];
$filetype = $uploadInfo['type'];
$filesize = $uploadInfo['size'];
$filetempname = $uploadInfo['tmp_name'];
$fileerror = intval($uploadInfo['error']);
-
+
+ // clean filename of characters that may cause trouble in a filename using cleanFileName() function from globalfunctions.php
+ $filename = cleanFileName($filename);
+ if ($filename === false)
+ media_doError(_ERROR_BADFILETYPE);
+
switch ($fileerror)
{
case 0: // = UPLOAD_ERR_OK
<div>
<input name="action" value="login" type="hidden" />
<input name="collection" value="<?php echo htmlspecialchars(requestVar('collection'))?>" type="hidden" />
- <?php echo _LOGINFORM_NAME?> <input name="login" />
- <br /><?php echo _LOGINFORM_PWD?> <input name="password" type="password" />
+ <?php echo _LOGINFORM_NAME?>: <input name="login" />
+ <br /><?php echo _LOGINFORM_PWD?>: <input name="password" type="password" />
<br /><input type="submit" value="<?php echo _LOGIN?>" />
</div>
</form>
*/\r
\r
body {\r
- background: #fff url(background.png) repeat-x;\r
+ background: #ffffff url(background.png) repeat-x;\r
\r
}\r
\r
// check if logged in etc
if (!$member->isLoggedIn()) {
- upgrade_showLogin('index.php');
+ upgrade_showLogin('index.php');
}
if (!$member->isAdmin()) {
- upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
+ upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
}
upgrade_head();
このアップグレードスクリプトを実行することでそれが可能となります。
</p>
-<?php // calculate current version
- if (!upgrade_checkinstall(96)) $current = 95;
- else if (!upgrade_checkinstall(100)) $current = 96;
- else if (!upgrade_checkinstall(110)) $current = 100;
- else if (!upgrade_checkinstall(150)) $current = 110;
- else if (!upgrade_checkinstall(200)) $current = 150;
- else if (!upgrade_checkinstall(250)) $current = 200;
- else if (!upgrade_checkinstall(300)) $current = 250;
- else if (!upgrade_checkinstall(310)) $current = 300;
- else if (!upgrade_checkinstall(320)) $current = 310;
- else if (!upgrade_checkinstall(330)) $current = 320;
- else if (!upgrade_checkinstall(331)) $current = 330;
- else if (!upgrade_checkinstall(340)) $current = 331;
- else if (!upgrade_checkinstall(350)) $current = 340;
- else $current = 350;
-
- if ($current == 350) {
- ?>
- <p class="ok">自動でできるアップグレードはありません。データベースは既に最新の Nucleus 用にアップデートされています。</p>
- <?php
- } else {
- ?>
- <p class="warning"><a href="upgrade.php?from=<?php echo $current?>">ここをクリックしてデータベースを Nucleus v3.51 用にアップグレードします</a></p>
- <?php
- }
- ?>
+<?php // calculate current version
+ if (!upgrade_checkinstall(96)) $current = 95;
+ else if (!upgrade_checkinstall(100)) $current = 96;
+ else if (!upgrade_checkinstall(110)) $current = 100;
+ else if (!upgrade_checkinstall(150)) $current = 110;
+ else if (!upgrade_checkinstall(200)) $current = 150;
+ else if (!upgrade_checkinstall(250)) $current = 200;
+ else if (!upgrade_checkinstall(300)) $current = 250;
+ else if (!upgrade_checkinstall(310)) $current = 300;
+ else if (!upgrade_checkinstall(320)) $current = 310;
+ else if (!upgrade_checkinstall(330)) $current = 320;
+ else if (!upgrade_checkinstall(331)) $current = 330;
+ else if (!upgrade_checkinstall(340)) $current = 331;
+ else if (!upgrade_checkinstall(350)) $current = 340;
+ else if (!upgrade_checkinstall(360)) $current = 350;
+ else $current = 360;
+
+ if ($current == 360) {
+?>
+<p class="ok">自動でできるアップグレードはありません。データベースは既に最新の Nucleus 用にアップデートされています。</p>
+<?php
+ } else {
+?>
+<p class="warning"><a href="upgrade.php?from=<?php echo $current?>">ここをクリックしてデータベースを Nucleus v3.51 用にアップグレードします</a></p>
+<?php
+ }
+?>
<div class="note">
<b>注意:</b> 作業中、各ステップごとにデータベースのバックアップを忘れないようにして下さい。
<?php
$from = intGetVar('from');
if (!$from)
- $from = $current;
+ $from = $current;
$sth = 0;
if (!$DIR_MEDIA) {
- upgrade_manual_96();
- $sth = 1;
+ upgrade_manual_96();
+ $sth = 1;
}
if (!$DIR_SKINS) {
- upgrade_manual_20();
- $sth = 1;
+ upgrade_manual_20();
+ $sth = 1;
}
// some manual code changes are needed in order to get Nucleus to work on php version
// lower than 4.0.6
if (phpversion() < '4.0.6') {
- upgrade_manual_php405();
- $sth = 1;
+ upgrade_manual_php405();
+ $sth = 1;
}
// from v3.3, atom feed supports 1.0 and blogsetting is added
// upgrades from pre-340 version need to be told of recommended .htaccess files for the media and skins folders.
// these .htaccess files are included in new installs of 340 or higher
if (in_array($from,array(95,96)) || $from < 340) {
- upgrade_manual_340();
- $sth = 1;
+ upgrade_manual_340();
+ $sth = 1;
}
// upgrades from pre-350 version need to be told of deprecation of PHP4 support and two new plugins
// included with 3.51 and higher
if (in_array($from,array(95,96)) || $from < 350) {
- upgrade_manual_350();
- $sth = 1;
+ upgrade_manual_350();
+ $sth = 1;
}
if ($sth == 0)
- echo "<p class='ok'>手動変更は必要ありません。今日はラッキーな日ですね!</p>";
+ echo "<p class='ok'>手動変更は必要ありません。今日はラッキーな日ですね!</p>";
upgrade_foot();
function upgrade_todo($ver) {
- return upgrade_checkinstall($ver) ? "(<span class='ok'>インストール済み</span>)" : "(<span class='warning'>インストールが必要</span>)";
+ return upgrade_checkinstall($ver) ? "(<span class='ok'>インストール済み</span>)" : "(<span class='warning'>インストールが必要</span>)";
}
function upgrade_manual_96() {
- global $DIR_NUCLEUS;
+ global $DIR_NUCLEUS;
- $guess = str_replace("/nucleus/","/media/",$DIR_NUCLEUS);
+ $guess = str_replace("/nucleus/","/media/",$DIR_NUCLEUS);
?>
- <h2>Nucleus 0.96 用に必要な変更</h2>
- <p>
- メディア機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
- </p>
- <pre>
- // path to media dir
- $DIR_MEDIA = '<b><?php echo htmlspecialchars($guess)?></b>';
- </pre>
-
- <p>
- また、ディレクトリもあなた自身の手で作る必要があります。もしファイルのアップロードを可能にしたいのであれば、media/ ディレクトリのパーミッションを777にします。(Nucleus 0.96+ のためのパーミッションの設定に関するクイックガイドが documentation/tips.html にあります)
- </p>
+ <h2>Nucleus 0.96 用に必要な変更</h2>
+ <p>
+ メディア機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
+ </p>
+ <pre>
+ // path to media dir
+ $DIR_MEDIA = '<b><?php echo htmlspecialchars($guess)?></b>';
+ </pre>
+
+ <p>
+ また、ディレクトリもあなた自身の手で作る必要があります。もしファイルのアップロードを可能にしたいのであれば、media/ ディレクトリのパーミッションを777にします。(Nucleus 0.96+ のためのパーミッションの設定に関するクイックガイドが documentation/tips.html にあります)
+ </p>
<?php }
function upgrade_manual_200() {
- global $DIR_NUCLEUS;
+ global $DIR_NUCLEUS;
- $guess = str_replace("/nucleus/","/skins/",$DIR_NUCLEUS);
+ $guess = str_replace("/nucleus/","/skins/",$DIR_NUCLEUS);
?>
- <h2>Nucleus 2.0 用に必要な変更</h2>
- <p>
- スキンの取り込み機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
- </p>
- <pre>
- // extra skin files for imported skins
- $DIR_SKINS = '<b><?php echo htmlspecialchars($guess)?></b>';
- </pre>
+ <h2>Nucleus 2.0 用に必要な変更</h2>
+ <p>
+ スキンの取り込み機能を使用するために<i>config.php</i>を手動で変更する必要があります。下記の通り追加します:
+ </p>
+ <pre>
+ // extra skin files for imported skins
+ $DIR_SKINS = '<b><?php echo htmlspecialchars($guess)?></b>';
+ </pre>
- <p>また、ディレクトリもあなた自身の手で作る必要があります。これでダウンロードしたスキンを上記ディレクトリに展開したり、Nucleus 管理画面から取り込んだりできるようになります。</p>
+ <p>また、ディレクトリもあなた自身の手で作る必要があります。これでダウンロードしたスキンを上記ディレクトリに展開したり、Nucleus 管理画面から取り込んだりできるようになります。</p>
- <h3>RSS 2.0 と RSD スキン</h3>
+ <h3>RSS 2.0 と RSD スキン</h3>
- <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>
+ <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>
<?php }
function upgrade_manual_340() {
- global $DIR_NUCLEUS;
+ global $DIR_NUCLEUS;
?>
- <h2>Nucleus 3.4 用に必要な変更</h2>
- <p>
- <em>skins</em>ディレクトリと<em>media</em>ディレクトリに「.haccess」を設置して、アクセス制限をかけることが推奨されます。この変更は、Nucleusの機能やセキュリティに直接関係があるわけではありませんが、不正アクセスを防ぐ為の重要な助けになるでしょう。
- </p>
-
- <p>
- 手順は以下の2つのファイルに書いてありますので参考にしてください:
- <ul>
- <li><a href="../../extra/htaccess/media/readme.ja.txt">extra/htaccess/media/readme.ja.txt</a></li>
- <li><a href="../../extra/htaccess/skins/readme.ja.txt">extra/htaccess/skins/readme.ja.txt</a></li>
- </ul>
- </p>
-
+ <h2>Nucleus 3.4 用に必要な変更</h2>
+ <p>
+ <em>skins</em>ディレクトリと<em>media</em>ディレクトリに「.haccess」を設置して、アクセス制限をかけることが推奨されます。この変更は、Nucleusの機能やセキュリティに直接関係があるわけではありませんが、不正アクセスを防ぐ為の重要な助けになるでしょう。
+ </p>
+
+ <p>
+ 手順は以下の2つのファイルに書いてありますので参考にしてください:
+ <ul>
+ <li><a href="../../extra/htaccess/media/readme.ja.txt">extra/htaccess/media/readme.ja.txt</a></li>
+ <li><a href="../../extra/htaccess/skins/readme.ja.txt">extra/htaccess/skins/readme.ja.txt</a></li>
+ </ul>
+ </p>
+
<?php }
function upgrade_manual_350() {
- global $DIR_NUCLEUS;
+ global $DIR_NUCLEUS;
?>
- <h2>Nucleus 3.51に関する重要なお知らせ</h2>
-
+ <h2>Nucleus 3.51に関する重要なお知らせ</h2>
+
<?php // Give user warning if they are running old version of PHP
- if (phpversion() < '5') {
- echo '<p>警告:サーバで稼動しているPHPのバージョンが、NucleusCMSの動作保障外の古いバージョンのようです。PHP5以上にアップグレードしてください!</p>';
- }
+ if (phpversion() < '5') {
+ echo '<p>警告:サーバで稼動しているPHPのバージョンが、NucleusCMSの動作保障外の古いバージョンのようです。PHP5以上にアップグレードしてください!</p>';
+ }
}
function upgrade_manual_php405() {
?>
<h2>PHP のバージョンが 4.0.3, 4.0.4 または 4.0.5 の場合に必要となる変更</h2>
<p>
- PHP のバージョンが 4.0.6 より以前の場合、変更が必要なファイルが2つあります。PHP のバージョンを 4.0.6 や 4.2.2+以降のものにアップグレードした方がいいでしょう(4.0.6 や 4.2.2 以前のものにはセキュリティー問題があります)。もし PHP のアップグレードが困難もしくは、する予定がない場合は、以下のファイルを変更して下さい。
+ PHP のバージョンが 4.0.6 より以前の場合、変更が必要なファイルが2つあります。PHP のバージョンを 4.0.6 や 4.2.2+以降のものにアップグレードした方がいいでしょう(4.0.6 や 4.2.2 以前のものにはセキュリティー問題があります)。もし PHP のアップグレードが困難もしくは、する予定がない場合は、以下のファイルを変更して下さい。
</p>
<ul>
- <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(84行目から):
- <pre>
-
- if (in_array($actionlc, $this->actions) || $this->norestrictions ) {
- <strong>$this->call_using_array($action, $this->handler, $params);</strong>
- } else {
- // redirect to plugin action if possible
- if (in_array('plugin', $this->actions)
- && $manager->pluginInstalled('NP_'.$action))
- $this->doAction('plugin('.$action.
- $this->pdelim.implode($this->pdelim,$params).')');
- else
- echo '<b>DISALLOWED (' , $action , ')</b>';
- }
+ <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(84行目から):
+ <pre>
+
+ if (in_array($actionlc, $this->actions) || $this->norestrictions ) {
+ <strong>$this->call_using_array($action, $this->handler, $params);</strong>
+ } else {
+ // redirect to plugin action if possible
+ if (in_array('plugin', $this->actions)
+ && $manager->pluginInstalled('NP_'.$action))
+ $this->doAction('plugin('.$action.
+ $this->pdelim.implode($this->pdelim,$params).')');
+ else
+ echo '<b>DISALLOWED (' , $action , ')</b>';
+ }
}
- </pre>
- </li>
- <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(75行目から):
- <pre>
+ </pre>
+ </li>
+ <li>nucleus/libs/PARSER.php のコードが下記のようになっていることを確認して下さい。(75行目から):
+ <pre>
// $params = array_map('trim',$params);
foreach ($params as $key => $value) { $params[$key] = trim($value); }
- </pre>
- </li>
- </ul>
+ </pre>
+ </li>
+ </ul>
<?php }
function upgrade_manual_atom1_0() {
- $sth = 0;
+ $sth = 0;
- // atom 1.0
- $query = 'SELECT sddesc FROM ' . sql_table('skin_desc')
- . ' WHERE sdname="feeds/atom"';
- $res = mysql_query($query);
- while ($o = mysql_fetch_object($res)) {
- if ($o->sddesc=='Atom 0.3 weblog syndication')
- {
- $sth = 1;
+ // atom 1.0
+ $query = 'SELECT sddesc FROM ' . sql_table('skin_desc')
+ . ' WHERE sdname="feeds/atom"';
+ $res = mysql_query($query);
+ while ($o = mysql_fetch_object($res)) {
+ if ($o->sddesc=='Atom 0.3 weblog syndication')
+ {
+ $sth = 1;
?>
<h2>Atom 1.0</h2>
<p>Nucleus 3.3 から atom feed が 1.0 対応になりましたので、次の手順でスキン・テンプレートのアップグレードをして下さい。</p>
<p>もし atom のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/atom/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
<?php
- }
- }
-
- // default skin
- $query = 'SELECT tdnumber FROM ' . sql_table('template_desc')
- . ' WHERE tdname="default/index"';
- $res = mysql_query($query);
- $tdnumber = 0;
- while ($o = mysql_fetch_object($res)) {
- $tdnumber = $o->tdnumber;
- }
- if ($tdnumber>0)
- {
- $query = 'SELECT tpartname FROM ' . sql_table('template')
- . ' WHERE tdesc=' . $tdnumber . ' AND tpartname="BLOGLIST_LISTITEM"';
- $res = mysql_query($query);
- if (!mysql_fetch_object($res)) {
-
- $sth = 1;
+ }
+ }
+
+ // default skin
+ $query = 'SELECT tdnumber FROM ' . sql_table('template_desc')
+ . ' WHERE tdname="default/index"';
+ $res = mysql_query($query);
+ $tdnumber = 0;
+ while ($o = mysql_fetch_object($res)) {
+ $tdnumber = $o->tdnumber;
+ }
+ if ($tdnumber>0)
+ {
+ $query = 'SELECT tpartname FROM ' . sql_table('template')
+ . ' WHERE tdesc=' . $tdnumber . ' AND tpartname="BLOGLIST_LISTITEM"';
+ $res = mysql_query($query);
+ if (!mysql_fetch_object($res)) {
+
+ $sth = 1;
?>
<h2>Default スキン</h2>
<p>Nucleus 3.3 からいくつかのフォームの CSS が変更になっています。たとえば最初のページのログインフォームや、コメント投稿のためのフォームなど。このためフォームの表示が崩れるので、次の手順でDefault スキンのアップグレードをして下さい。</p>
<p>もし default のスキンやテンプレートを変更している場合は、既存の内容をファイルに書き出して(skinbackup.xml というファイルが作成されます)、/skins/default/skinbackup.xml (これが新しいファイル)と比較し、この新しいファイルを更新します。その後、前述の通り管理者画面からスキンの「読込/書出」を開いて同様にして上書きインストールして下さい。</p>
<?php
- }
- }
+ }
+ }
- return $sth;
+ return $sth;
}
?>
<?php
- /*
- * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2010 The Nucleus Group
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * (see nucleus/documentation/index.html#license for more info)
- */
- /**
- * Some functions common to all upgrade scripts
- *
- * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2010 The Nucleus Group
- * @version $Id$
- * $NucleusJP: upgrade.functions.php,v 1.10 2007/04/26 06:20:19 kimitake Exp $
- */
+/*
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+ * Copyright (C) 2002-2010 The Nucleus Group
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * (see nucleus/documentation/index.html#license for more info)
+ */
+/**
+ * Some functions common to all upgrade scripts
+ *
+ * @license http://nucleuscms.org/license.txt GNU General Public License
+ * @copyright Copyright (C) 2002-2010 The Nucleus Group
+ * @version $Id$
+ * $NucleusJP: upgrade.functions.php,v 1.10 2007/04/26 06:20:19 kimitake Exp $
+ */
/*************************************************************
- * NOTE: With upgrade to 3.6, need to set this to use sql_* API *
+ * NOTE: With upgrade to 3.6, need to set this to use sql_* API *
**************************************************************/
- include('../../config.php');
-
- // sql_table function did not exists in nucleus <= 2.0
- if (!function_exists('sql_table'))
- {
- function sql_table($name) {
- return 'nucleus_' . $name;
- }
- }
-
- //intGetVar did not exist in very early versions
- if (!function_exists('intGetVar')) {
- function intGetVar($name) {
- if (defined($_GET)) {
- return intval($_GET[$name]);
- } else {
- global $HTTP_GET_VARS;
- return intval($HTTP_GET_VARS[$name]);
- }
- }
- }
-
- function upgrade_checkinstall($version) {
- $installed = 0;
-
- switch($version) {
- case '95':
- $query = 'SELECT bconvertbreaks FROM '.sql_table('blog').' LIMIT 1';
- $minrows = -1;
- break;
- case '96':
- $query = 'SELECT cip FROM '.sql_table('comment').' LIMIT 1';
- $minrows = -1;
- break;
- case '100':
- $query = 'SELECT mcookiekey FROM '.sql_table('member').' LIMIT 1';
- $minrows = -1;
- break;
- case '110':
- $query = 'SELECT bnotifytype FROM '.sql_table('blog').' LIMIT 1';
- $minrows = -1;
- break;
- case '150':
- $query = 'SELECT * FROM '.sql_table('plugin_option').' LIMIT 1';
- $minrows = -1;
- break;
- case '200':
- $query = 'SELECT sdincpref FROM '.sql_table('skin_desc').' LIMIT 1';
- $minrows = -1;
- break;
- // dev only (v2.2)
- case '220':
- $query = 'SELECT oid FROM '.sql_table('plugin_option_desc').' LIMIT 1';
- $minrows = -1;
- break;
- // v2.5 beta
- case '240':
- $query = 'SELECT bincludesearch FROM ' . sql_table('blog') . ' LIMIT 1';
- $minrows = -1;
- break;
- case '250':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 250 LIMIT 1';
- $minrows = 1;
- break;
- case '300':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 300 LIMIT 1';
- $minrows = 1;
- break;
- case '310':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 310 LIMIT 1';
- $minrows = 1;
- break;
- case '320':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 320 LIMIT 1';
- $minrows = 1;
- break;
- case '330':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 330 LIMIT 1';
- $minrows = 1;
- break;
- case '331':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 331 LIMIT 1';
- $minrows = 1;
- break;
- case '340':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 340 LIMIT 1';
- $minrows = 1;
- break;
- case '350':
- $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 350 LIMIT 1';
- $minrows = 1;
- break;
- }
-
- $res = mysql_query($query);
- $installed = ($res != 0) && (mysql_num_rows($res) >= $minrows);
-
- return $installed;
- }
-
-
- /** this function gets the nucleus version, even if the getNucleusVersion
- * function does not exist yet
- * return 96 for all versions < 100
- */
- function upgrade_getNucleusVersion() {
- if (!function_exists('getNucleusVersion')) return 96;
- return getNucleusVersion();
- }
-
- function upgrade_showLogin($type) {
- upgrade_head();
- ?>
- <h1>まずはログインして下さい</h1>
- <p>下記の情報を入力して下さい:</p>
-
- <form method="post" action="<?php echo $type?>">
-
- <ul>
- <li>名前: <input name="login" /></li>
- <li>パスワード <input name="password" type="password" /></li>
- </ul>
-
- <p>
- <input name="action" value="login" type="hidden" />
- <input type="submit" value="ログイン" />
- </p>
-
- </form>
- <?php upgrade_foot();
- exit;
- }
-
- function upgrade_head() {
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
- <title>Nucleus アップグレード</title>
+ include('../../config.php');
+
+ // sql_table function did not exists in nucleus <= 2.0
+ if (!function_exists('sql_table'))
+ {
+ function sql_table($name) {
+ return 'nucleus_' . $name;
+ }
+ }
+
+ //intGetVar did not exist in very early versions
+ if (!function_exists('intGetVar')) {
+ function intGetVar($name) {
+ if (defined($_GET)) {
+ return intval($_GET[$name]);
+ } else {
+ global $HTTP_GET_VARS;
+ return intval($HTTP_GET_VARS[$name]);
+ }
+ }
+ }
+
+ function upgrade_checkinstall($version) {
+ $installed = 0;
+
+ switch($version) {
+ case '95':
+ $query = 'SELECT bconvertbreaks FROM '.sql_table('blog').' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '96':
+ $query = 'SELECT cip FROM '.sql_table('comment').' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '100':
+ $query = 'SELECT mcookiekey FROM '.sql_table('member').' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '110':
+ $query = 'SELECT bnotifytype FROM '.sql_table('blog').' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '150':
+ $query = 'SELECT * FROM '.sql_table('plugin_option').' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '200':
+ $query = 'SELECT sdincpref FROM '.sql_table('skin_desc').' LIMIT 1';
+ $minrows = -1;
+ break;
+ // dev only (v2.2)
+ case '220':
+ $query = 'SELECT oid FROM '.sql_table('plugin_option_desc').' LIMIT 1';
+ $minrows = -1;
+ break;
+ // v2.5 beta
+ case '240':
+ $query = 'SELECT bincludesearch FROM ' . sql_table('blog') . ' LIMIT 1';
+ $minrows = -1;
+ break;
+ case '250':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 250 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '300':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 300 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '310':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 310 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '320':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 320 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '330':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 330 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '331':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 331 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '340':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 340 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '350':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 350 LIMIT 1';
+ $minrows = 1;
+ break;
+ case '360':
+ $query = 'SELECT * FROM '.sql_table('config').' WHERE name=\'DatabaseVersion\' and value >= 360 LIMIT 1';
+ $minrows = 1;
+ break;
+ }
+
+ $res = mysql_query($query);
+ $installed = ($res != 0) && (mysql_num_rows($res) >= $minrows);
+
+ return $installed;
+ }
+
+
+ /** this function gets the nucleus version, even if the getNucleusVersion
+ * function does not exist yet
+ * return 96 for all versions < 100
+ */
+ function upgrade_getNucleusVersion() {
+ if (!function_exists('getNucleusVersion')) return 96;
+ return getNucleusVersion();
+ }
+
+ function upgrade_showLogin($type) {
+ upgrade_head();
+ ?>
+ <h1>まずはログインして下さい</h1>
+ <p>下記の情報を入力して下さい:</p>
+
+ <form method="post" action="<?php echo $type?>">
+
+ <ul>
+ <li>名前: <input name="login" /></li>
+ <li>パスワード <input name="password" type="password" /></li>
+ </ul>
+
+ <p>
+ <input name="action" value="login" type="hidden" />
+ <input type="submit" value="ログイン" />
+ </p>
+
+ </form>
+ <?php upgrade_foot();
+ exit;
+ }
+
+ function upgrade_head() {
+ ?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
+ <title>Nucleus アップグレード</title>
<?php if (file_exists("../styles/manual.css")) { ?>
- <link rel="stylesheet" href="../styles/manual.css" type="text/css" />
+ <link rel="stylesheet" href="../styles/manual.css" type="text/css" />
<?php }else{ ?>
- <style type="text/css"><!--
- .warning {
- color: red;
- }
- .ok {
- color: green;
- }
- --></style>
+ <style type="text/css"><!--
+ .warning {
+ color: red;
+ }
+ .ok {
+ color: green;
+ }
+ --></style>
<?php } ?>
- </head>
- <body>
- <?php }
-
- function upgrade_foot() {
- ?>
- </body>
- </html>
- <?php }
-
- function upgrade_error($msg) {
- upgrade_head();
- ?>
- <h1>エラー!</h1>
-
- <p>メッセージは以下の通り:</p>
-
- <blockquote><div>
- <?php echo $msg?>
- </div></blockquote>
-
- <p><a href="index.php" onclick="history.back();">戻る</a></p>
- <?php
- upgrade_foot();
- exit;
- }
-
-
- function upgrade_start() {
- global $upgrade_failures;
- $upgrade_failures = 0;
-
- upgrade_head();
- ?>
- <h1>アップグレードの実行</h1>
- <ul>
- <?php }
-
- function upgrade_end($msg = "") {
- global $upgrade_failures;
- $from = intGetVar('from');
- if ($upgrade_failures > 0)
- $msg = "いくつかのデータベース操作に失敗しました。もし以前にこのアップグレードスクリプトを実行していたのであれば、問題ないと思われます。";
-
- ?>
- </ul>
-
- <h1>アップグレード完了!</h1>
-
- <p><?php echo $msg?></p>
-
- <p><a href="index.php?from=<?php echo $from; ?>">アップグレード最初のページ</a>にもどる</p>
-
- <?php
- upgrade_foot();
- exit;
- }
-
- /**
- * Tries to execute a query, gives a message when failed
- *
- * @param friendly name
- * @param query
- */
- function upgrade_query($friendly, $query) {
- global $upgrade_failures;
-
- echo "<li>$friendly ... ";
- $res = mysql_query($query);
- if (!$res) {
- echo "<span style='color:red'>失敗</span>\n";
- echo "<blockquote>失敗の理由: " . mysql_error() . " </blockquote>";
- $upgrade_failures++;
- } else {
- echo "<span style='color:green'>成功!</span><br />\n";
- }
- echo "</li>";
- return $res;
- }
-
- /**
- * Tries to update database version, gives a message when failed
- *
- * @param $version
- * Schema version the database has been upgraded to
- */
- function update_version($version) {
- global $upgrade_failures;
- $message='Updating DatabaseVersion in config table to '.$version;
- if(0==$upgrade_failures){
- $query = 'UPDATE ' . sql_table('config') . ' set value=\''.$version.'\' where name=\'DatabaseVersion\'';
- upgrade_query($message, $query);
- }else
- echo '<li>'.$message.' ... <span class="warning">NOT EXECUTED</span>\n<blockquote>Errors occurred during upgrade process.</blockquote>';
- }
-
- /**
- * @param $table
- * table to check (without prefix)
- * @param $aColumns
- * array of column names included
- */
- function upgrade_checkIfIndexExists($table, $aColumns) {
- // get info for indices from database
-
- $aIndices = array();
- $query = 'show index from ' . sql_table($table);
- $res = mysql_query($query);
- while ($o = mysql_fetch_object($res)) {
- if (!$aIndices[$o->Key_name]) {
- $aIndices[$o->Key_name] = array();
- }
- array_push($aIndices[$o->Key_name], $o->Column_name);
- }
-
- // compare each index with parameter
- foreach ($aIndices as $keyName => $aIndexColumns) {
- $aDiff = array_diff($aIndexColumns, $aColumns);
- if (count($aDiff) == 0) return 1;
- }
-
- return 0;
-
- }
-
- /**
- * Checks to see if a given table exists
- *
- * @param $table
- * Name of table to check for existance of
- * Uses sql_table internally
- * @return true if table exists, false otherwise.
- */
- function upgrade_checkIfTableExists($table){
- $query = 'SHOW TABLES LIKE \''.sql_table($table).'\'';
- $res = mysql_query($query);
- return ($res != 0) && (mysql_num_rows($res) == 1);
- }
-
- /**
- * Checks to see if a given configuration value exists
- *
- * @param $value
- * Config value to check for existance of.
- * Paramater must be MySQL escaped
- * @return true if configuration value exists, false otherwise.
- */
- function upgrade_checkIfCVExists($value){
- $query = 'SELECT name from '.sql_table('config').' WHERE name = \''.$value.'\'';
- $res = mysql_query($query);
- return ($res != 0) && (mysql_num_rows($res) == 1);
- }
-
- /**
- * Checks to see if a given column exists
- *
- * @param $table
- * Name of table to check for column in
- * Uses sql_table internally
- * @param $col
- * Name of column to check for existance of
- * @return true if column exists, false otherwise.
- */
- function upgrade_checkIfColumnExists($table, $col){
- $query = 'DESC `'.sql_table($table).'` `'.$col.'`';
- $res = mysql_query($query);
- return ($res != 0) && (mysql_num_rows($res) == 1);
- }
+ </head>
+ <body>
+ <?php }
+
+ function upgrade_foot() {
+ ?>
+ </body>
+ </html>
+ <?php }
+
+ function upgrade_error($msg) {
+ upgrade_head();
+ ?>
+ <h1>エラー!</h1>
+
+ <p>メッセージは以下の通り:</p>
+
+ <blockquote><div>
+ <?php echo $msg?>
+ </div></blockquote>
+
+ <p><a href="index.php" onclick="history.back();">戻る</a></p>
+ <?php
+ upgrade_foot();
+ exit;
+ }
+
+
+ function upgrade_start() {
+ global $upgrade_failures;
+ $upgrade_failures = 0;
+
+ upgrade_head();
+ ?>
+ <h1>アップグレードの実行</h1>
+ <ul>
+ <?php }
+
+ function upgrade_end($msg = "") {
+ global $upgrade_failures;
+ $from = intGetVar('from');
+ if ($upgrade_failures > 0)
+ $msg = "いくつかのデータベース操作に失敗しました。もし以前にこのアップグレードスクリプトを実行していたのであれば、問題ないと思われます。";
+
+ ?>
+ </ul>
+
+ <h1>アップグレード完了!</h1>
+
+ <p><?php echo $msg?></p>
+
+ <p><a href="index.php?from=<?php echo $from; ?>">アップグレード最初のページ</a>にもどる</p>
+
+ <?php
+ upgrade_foot();
+ exit;
+ }
+
+ /**
+ * Tries to execute a query, gives a message when failed
+ *
+ * @param friendly name
+ * @param query
+ */
+ function upgrade_query($friendly, $query) {
+ global $upgrade_failures;
+
+ echo "<li>$friendly ... ";
+ $res = mysql_query($query);
+ if (!$res) {
+ echo "<span style='color:red'>失敗</span>\n";
+ echo "<blockquote>失敗の理由: " . mysql_error() . " </blockquote>";
+ $upgrade_failures++;
+ } else {
+ echo "<span style='color:green'>成功!</span><br />\n";
+ }
+ echo "</li>";
+ return $res;
+ }
+
+ /**
+ * Tries to update database version, gives a message when failed
+ *
+ * @param $version
+ * Schema version the database has been upgraded to
+ */
+ function update_version($version) {
+ global $upgrade_failures;
+ $message='Updating DatabaseVersion in config table to '.$version;
+ if(0==$upgrade_failures){
+ $query = 'UPDATE ' . sql_table('config') . ' set value=\''.$version.'\' where name=\'DatabaseVersion\'';
+ upgrade_query($message, $query);
+ }else
+ echo '<li>'.$message.' ... <span class="warning">NOT EXECUTED</span>\n<blockquote>Errors occurred during upgrade process.</blockquote>';
+ }
+
+ /**
+ * @param $table
+ * table to check (without prefix)
+ * @param $aColumns
+ * array of column names included
+ */
+ function upgrade_checkIfIndexExists($table, $aColumns) {
+ // get info for indices from database
+
+ $aIndices = array();
+ $query = 'show index from ' . sql_table($table);
+ $res = mysql_query($query);
+ while ($o = mysql_fetch_object($res)) {
+ if (!$aIndices[$o->Key_name]) {
+ $aIndices[$o->Key_name] = array();
+ }
+ array_push($aIndices[$o->Key_name], $o->Column_name);
+ }
+
+ // compare each index with parameter
+ foreach ($aIndices as $keyName => $aIndexColumns) {
+ $aDiff = array_diff($aIndexColumns, $aColumns);
+ if (count($aDiff) == 0) return 1;
+ }
+
+ return 0;
+
+ }
+
+ /**
+ * Checks to see if a given table exists
+ *
+ * @param $table
+ * Name of table to check for existance of
+ * Uses sql_table internally
+ * @return true if table exists, false otherwise.
+ */
+ function upgrade_checkIfTableExists($table){
+ $query = 'SHOW TABLES LIKE \''.sql_table($table).'\'';
+ $res = mysql_query($query);
+ return ($res != 0) && (mysql_num_rows($res) == 1);
+ }
+
+ /**
+ * Checks to see if a given configuration value exists
+ *
+ * @param $value
+ * Config value to check for existance of.
+ * Paramater must be MySQL escaped
+ * @return true if configuration value exists, false otherwise.
+ */
+ function upgrade_checkIfCVExists($value){
+ $query = 'SELECT name from '.sql_table('config').' WHERE name = \''.$value.'\'';
+ $res = mysql_query($query);
+ return ($res != 0) && (mysql_num_rows($res) == 1);
+ }
+
+ /**
+ * Checks to see if a given column exists
+ *
+ * @param $table
+ * Name of table to check for column in
+ * Uses sql_table internally
+ * @param $col
+ * Name of column to check for existance of
+ * @return true if column exists, false otherwise.
+ */
+ function upgrade_checkIfColumnExists($table, $col){
+ $query = 'DESC `'.sql_table($table).'` `'.$col.'`';
+ $res = mysql_query($query);
+ return ($res != 0) && (mysql_num_rows($res) == 1);
+ }
?>
// check if logged in etc
if (!$member->isLoggedIn()) {
- upgrade_showLogin('upgrade.php?from=' . intGetVar('from'));
+ upgrade_showLogin('upgrade.php?from=' . intGetVar('from'));
}
if (!$member->isAdmin()) {
- upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
+ upgrade_error('Super-admin(最高管理者)のみがアップグレードを実行できます。');
}
include('upgrade0.95.php');
include('upgrade3.31.php');
include('upgrade3.4.php');
include('upgrade3.5.php');
+include('upgrade3.6.php');
$from = intGetVar('from');
upgrade_start();
switch($from) {
- case 95:
- upgrade_do95();
- upgrade_do96();
- case 96:
- upgrade_do100();
- case 10:
- upgrade_do110();
- case 11:
- upgrade_do150();
- case 15:
- upgrade_do200();
- case 20:
- upgrade_do250();
- case 25:
- upgrade_do300();
- case 30:
- upgrade_do310();
- case 31:
- upgrade_do320();
+ case 95:
+ upgrade_do95();
+ upgrade_do96();
+ case 96:
+ upgrade_do100();
+ case 100:
+ upgrade_do110();
+ case 110:
+ upgrade_do150();
+ case 150:
+ upgrade_do200();
+ case 200:
+ upgrade_do250();
+ case 250:
+ upgrade_do300();
+ case 300:
+ upgrade_do310();
+ case 310:
+ upgrade_do320();
// break;
- case 32:
- upgrade_do330();
+ case 320:
+ upgrade_do330();
// break;
- case 33:
- upgrade_do331();
+ case 330:
+ upgrade_do331();
// break;
- case 331:
- upgrade_do340();
- break;
- case 340:
- upgrade_do350();
- break;
- default:
- echo "<li>エラー! 実行すべきアップデートはありません</li>";
- break;
+ case 331:
+ upgrade_do340();
+ break;
+ case 340:
+ upgrade_do350();
+ break;
+ case 350:
+ upgrade_do360();
+ break;
+ default:
+ echo "<li>エラー! 実行すべきアップデートはありません</li>";
+ break;
}
$res = sql_query('SELECT * FROM '.sql_table('template').' WHERE tpartname=\'DATE_HEADER\'');
while ($o = mysql_fetch_object($res)) {
$newval = str_replace('<%daylink%>','<%%daylink%%>',$o->tcontent);
- $query = 'UPDATE '.sql_table('template').' SET tcontent=\''. sql_real_escape_string($newval).'\' WHERE tdesc=' . $o->tdesc . ' AND tpartname=\'DATE_HEADER\'';
+ $query = 'UPDATE '.sql_table('template').' SET tcontent=\''. addslashes($newval).'\' WHERE tdesc=' . $o->tdesc . ' AND tpartname=\'DATE_HEADER\'';
upgrade_query('Updating DATE_HEADER part in template ' . $o->tdesc, $query);
}
while ($o = mysql_fetch_object($res)) {
if (!strstr($o->tcontent,'<%comments%>')) {
$newval = $o->tcontent . '<%comments%>';
- $query = 'UPDATE '.sql_table('template').' SET tcontent=\''. sql_real_escape_string($newval).'\' WHERE tdesc=' . $o->tdesc . ' AND tpartname=\'ITEM\'';
+ $query = 'UPDATE '.sql_table('template').' SET tcontent=\''. addslashes($newval).'\' WHERE tdesc=' . $o->tdesc . ' AND tpartname=\'ITEM\'';
upgrade_query('Updating ITEM part in template ' . $o->tdesc, $query);
}
}
// add SkinsURL setting
if (!upgrade_checkIfCVExists('SkinsURL')) {
$skinsurl = str_replace('/media/','/skins/',$CONF['MediaURL']);
- $query = 'INSERT INTO '.sql_table('config')." VALUES ('SkinsURL', '".sql_real_escape_string($skinsurl)."');";
+ $query = 'INSERT INTO '.sql_table('config')." VALUES ('SkinsURL', '".addslashes($skinsurl)."');";
upgrade_query("Adding setting SkinsURL",$query);
}
// add ActionURL setting
if (!upgrade_checkIfCVExists('ActionURL')) {
$actionurl = str_replace('/media/','/action.php',$CONF['MediaURL']);
- $query = 'INSERT INTO '.sql_table('config')." VALUES ('ActionURL', '".sql_real_escape_string($actionurl)."');";
+ $query = 'INSERT INTO '.sql_table('config')." VALUES ('ActionURL', '".addslashes($actionurl)."');";
upgrade_query("Adding setting ActionURL",$query);
}
$query = 'INSERT INTO ' . sql_table('plugin_option_desc')
.' (opid, oname, ocontext, odesc, otype)'
." VALUES ("
- ."'".sql_real_escape_string($o->opid)."',"
- ."'".sql_real_escape_string($o->oname) ."',"
+ ."'".addslashes($o->opid)."',"
+ ."'".addslashes($o->oname) ."',"
."'global',"
- ."'".sql_real_escape_string($o->odesc) ."',"
- ."'".sql_real_escape_string($o->otype) ."')";
+ ."'".addslashes($o->odesc) ."',"
+ ."'".addslashes($o->otype) ."')";
upgrade_query('Moving option description for '.htmlspecialchars($o->oname).' to ' . sql_table('plugin_option_desc'), $query);
// store new id
foreach ($aValues as $aInfo) {
$query = 'INSERT INTO ' . sql_table('plugin_option')
.' (oid, ocontextid, ovalue)'
- ." VALUES (".$aInfo['id'].",'0','".sql_real_escape_string($aInfo['value'])."')";
+ ." VALUES (".$aInfo['id'].",'0','".addslashes($aInfo['value'])."')";
upgrade_query('Re-filling ' . sql_table('plugin_option') . ' ('.$aInfo['id'].')', $query);
}
}
--- /dev/null
+<?php\r
+/*\r
+ * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
+ * Copyright (C) 2002-2009 The Nucleus Group\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * (see nucleus/documentation/index.html#license for more info)\r
+ */\r
+/**\r
+ * @license http://nucleuscms.org/license.txt GNU General Public License\r
+ * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
+ * @version $Id: upgrade3.5.php 1416 2009-09-24 15:58:08Z ftruscot $\r
+ */\r
+\r
+function upgrade_do360() {\r
+\r
+ if (upgrade_checkinstall(360))\r
+ return 'インストール済みです';\r
+ \r
+ // Give user warning if they are running old version of PHP\r
+ if (phpversion() < '5') {\r
+ echo '警告:サーバで稼動しているPHPのバージョンが、NucleusCMSの動作保障外の古いバージョンのようです。PHP5以上にアップグレードしてください!';\r
+ }\r
+ \r
+ // changing the blog table to lengthen bnotify field \r
+ $query = " ALTER TABLE `" . sql_table('blog') . "`\r
+ MODIFY `bnotify` varchar(128) default NULL ;";\r
+ \r
+ upgrade_query('Altering ' . sql_table('blog') . ' table', $query);\r
+ \r
+ // 3.4 -> 3.5\r
+ // update database version\r
+ update_version('360');\r
+ \r
+ // Remind user to re-install NP_Ping \r
+ // Remind user to re-install NP_Ping \r
+ echo '<p>注意: バージョン3.50よりNP_Pingに変更があるので、使用中の方は管理画面より再インストールしてください。</p>';\r
+}\r
+?>\r