From: kimitake Date: Mon, 17 Jul 2006 20:01:39 +0000 (+0000) Subject: merged 3.3 code X-Git-Tag: pre-release-3-3-b3~61 X-Git-Url: http://git.sourceforge.jp/view?p=nucleus-jp%2Fnucleus-jp-ancient.git;a=commitdiff_plain;h=240dbc5624f8a59422bff875bbb8acd97e5dc9ff merged 3.3 code git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@148 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- diff --git a/utf8/createaccount.html b/utf8/createaccount.html index bd5f621..1a3ca6c 100755 --- a/utf8/createaccount.html +++ b/utf8/createaccount.html @@ -37,4 +37,4 @@ - + \ No newline at end of file diff --git a/utf8/install.php b/utf8/install.php index 13854e4..a41b24a 100755 --- a/utf8/install.php +++ b/utf8/install.php @@ -1,988 +1,1077 @@ -
If you see this text in your browser when you open install.php, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there.
0) || (count($aConfSkinsToImport) > 0)) { - global $CONF; - $CONF['installscript']=1; - } - if (phpversion() >= '4.1.0') - include_once('nucleus/libs/vars4.1.0.php'); - else - include_once('nucleus/libs/vars4.0.6.php'); - - // check if mysql support is installed - if (!function_exists('mysql_query')) - _doError('Your PHP version does not have support for MySQL :('); - - if (postVar('action') == 'go') - doInstall(); - else - showInstallForm(); - exit; - - function showInstallForm() { - - // 0. pre check if all necessary files exist - doCheckFiles(); - - ?> - - - - - Nucleusのインストール - - - - - -
- -
- -

Install Nucleus

- -

- このスクリプトはNucleusのインストールを手助けします。MySQLテーブルのセットアップと、config.phpに入力するための情報を表示します(config.phpのパーミッションを0666にしておけば、後者の作業は自動的に行われます)。これをなす為に、いくつかの情報を入力する必要があります。 -

- -

- すべての欄の入力が必要です。オプション情報はインストールが完了したら、Nucleusの管理領域から設定可能です。 -

- -

PHP & MySQL Versions

- -

- 以下はあなたのウェブホストにおけるPHPインタープリターとMySQLサーバーのバージョンです。Nucleusのサポートフォーラムに問題を報告するときは、この情報を書き添えてください。 -

- -
    -
  • PHP: 注意: Nucleusの動作には少なくともバージョン ',$minVersion,' が必要とされます'; - ?>
  • -
  • MySQL: 0) { - $row = mysql_fetch_array($result); - $match = explode('.', $row['version']); - } else { - $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); - if ($result != FALSE && @mysql_num_rows($result) > 0){ - $row = mysql_fetch_row($result); - $match = explode('.', $row[1]); - } else { - $match[0] = '?'; - $match[1] = '?'; - $match[2] = '?'; - } - } - - if (!isset($match) || !isset($match[0])) { - $match[0] = 3; - } - if (!isset($match[1])) { - $match[1] = 21; - } - if (!isset($match[2])) { - $match[2] = 0; - } - - if ($match[0] != '?') { - $match[0] = intval($match[0]); - $match[1] = intval($match[1]); - } - - $mysqlVersion = implode($match, '.'); - $minVersion = '3.23'; - - echo $mysqlVersion; - - if ($mysqlVersion < $minVersion) - echo ' 注意: Nucleusの動作には少なくともバージョン ',$minVersion,' が必要とされます'; - ?>
  • -
- - -

config.phpの自動アップデート

- -

- もしconfig.phpを自動的に更新するようにしたいなら、書き込み可能にする必要があります。config.phpのパーミッションを666にしてください。Nucleusのインストール成功後に、パーミッションを444に戻さなければなりません(パーミッション変更の簡易ガイド)。 -

- -

- もしファイルに書き込まないという選択をした(あるいは行えない)場合:ご心配なく。インストールの過程でconfig.phpの中身が提供されます。ですから、それをご自身でアップロードしてください。 -

- - - -

MySQLのログインデータ

- -

- MySQLのデータを以下に入力してください。それらはデータベース・テーブルを作成し情報を入力するために必要なものです。後で、config.phpにも記入する必要があります(上記の自動アップデートを利用する場合、その手順は省略されます)。 -

- -

- もしこの情報がわからなければ、システム管理者かホスティング元に連絡をとってください。ほとんどの場合、ホスト名は'localhost'です。もしNucleusがあなたのサーバのPHP設定から'default MySQL host'を検知したなら、'ホスト名'に既に記入されているはずです。もっとも、この情報が正確であるという保証はありません。 -

- -
- 基本のデータベース設定 - - - - - - - - - - - - -
ホスト名:
ユーザー名:
パスワード:
データベース名: ()
-
- -
- 高等なデータベース設定 - - - -
-

一つのデータベースに複数のNucleusをインストールしており、自分が何をやっているのか理解されている場合を除いては、これを変更する必要はありません。

-

Nucleusによって生成されたすべてのデータベーステーブルは、このプリフィックスが頭につきます。

-
- -

ディレクトリとURL

- -

- このインストールスクリプトはNucleusがインストールされているディレクトリとURLを見つけようとしました。下の値をチェックして必要なら訂正してください。ファイルへのパスとURLはスラッシュ'/'で終わらなくてはなりません。 -

- -
- URLs and directories - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Site URL: - " /> -
Admin-area URL: -
Admin-area path:" /> -
Media files URL: -
Media directory path:" /> -
Extra skin files URL: -
(インポートされたスキンが使用) -
Extra skin files directory path:" /> -
(インポートされたスキンのファイル類を置く場所) -
Plugin files URL: -
Action URL: -
(action.phpへのhttp://から始まるURL) -
-
- -

- 付記: 相対パスではなく絶対パスを使ってください。通常、絶対パスは/home/username/public_html/のような形をとります。Unixシステム(ほとんどのサーバーがそうです)において、パスはスラッシュから始まります。もしこれらの情報入力に問題が生じたら、あなたのサーバ管理者にたずねるべきです。 -

- -

管理権限をもつユーザー

- -

以下に、サイトの最初のユーザーを作成するためのいくつかの情報を入力してください。

- -
- 管理権限を持つユーザー - - - - - - - - - - - - - - - -
表示される名前: - - (許可される文字:a-z と 0-9、最初と最後以外のスペース) -
本名(ハンドル名):
パスワード:
パスワードの確認:
メールアドレス: - - (利用可能なメールアドレスを入れてください) -
-
- -

ウェブログのデータ

- -

以下に、デフォルトのweblogを作成するためにいくつかの情報を入力してください。このweblogの名前は、サイト名としても利用されます。

- -
- ウェブログのデータ - - - - - - -
Blog名:
Blogの短縮名: - - (許可される文字:a-z と 0-9、スペースは不可) -
-
- -

データの送信

- -

- 上に書いてきたデータが正しいか確かめてください。よければデータベース・テーブルと最初のデータを設定するために下のボタンを押してください。少し時間がかかるかもしれませんがご辛抱を。ボタンをクリックするのは一回だけにしてください。 -

- -

- - -

- -
- - - - - - 0) - showErrorMessages($errors); - - // 2. try to log in to mySQL - $connection = @mysql_connect($mysql_host, $mysql_user, $mysql_password); - if ($connection == false) - _doError("Could not connect to mySQL server: " . mysql_error()); - - // 3. try to create database (if needed) - if ($mysql_create == 1) { - mysql_query("CREATE DATABASE " . $mysql_database) or _doError("Could not create database. Make sure you have the rights to do so. SQL error was: " . mysql_error()); - } - - // 4. try to select database - mysql_select_db($mysql_database) or _doError("Could not select database. Make sure it exists"); - - // 5. execute queries - $filename = "install.sql"; - $fd = fopen ($filename, "r"); - $queries = fread ($fd, filesize ($filename)); - fclose ($fd); - - $queries = split("(;\n|;\r)",$queries); - - $aTableNames = array( - 'nucleus_actionlog', - 'nucleus_ban', - 'nucleus_blog', - 'nucleus_category', - 'nucleus_comment', - 'nucleus_config', - 'nucleus_item', - 'nucleus_karma', - 'nucleus_member', - 'nucleus_plugin', - 'nucleus_skin', - 'nucleus_template', - 'nucleus_team', - 'nucleus_activation', - 'nucleus_tickets' -// these are unneeded (one of the replacements above takes care of them) -// 'nucleus_plugin_event', -// 'nucleus_plugin_option', -// 'nucleus_plugin_option_desc', -// 'nucleus_skin_desc', -// 'nucleus_template_desc', - ); - $aTableNamesPrefixed = array( - $mysql_prefix . 'nucleus_actionlog', - $mysql_prefix . 'nucleus_ban', - $mysql_prefix . 'nucleus_blog', - $mysql_prefix . 'nucleus_category', - $mysql_prefix . 'nucleus_comment', - $mysql_prefix . 'nucleus_config', - $mysql_prefix . 'nucleus_item', - $mysql_prefix . 'nucleus_karma', - $mysql_prefix . 'nucleus_member', - $mysql_prefix . 'nucleus_plugin', - $mysql_prefix . 'nucleus_skin', - $mysql_prefix . 'nucleus_template', - $mysql_prefix . 'nucleus_team', - $mysql_prefix . 'nucleus_activation', - $mysql_prefix . 'nucleus_tickets' -// these are unneeded (one of the replacements above takes care of them) -// $mysql_prefix . 'nucleus_plugin_event', -// $mysql_prefix . 'nucleus_plugin_option', -// $mysql_prefix . 'nucleus_plugin_option_desc', -// $mysql_prefix . 'nucleus_skin_desc', -// $mysql_prefix . 'nucleus_template_desc', - ); - - for ($idx = 0;$idx" . htmlspecialchars($query) . "

"; - if ($query) { - if ($mysql_usePrefix == 1) - $query = str_replace($aTableNames, $aTableNamesPrefixed, $query); - mysql_query($query) or _doError("Error while executing query (" . htmlspecialchars($query) . "): " . mysql_error()); - } - - } - - // 6. update global settings - updateConfig('IndexURL', $config_indexurl); - updateConfig('AdminURL', $config_adminurl); - updateConfig('MediaURL', $config_mediaurl); - updateConfig('SkinsURL', $config_skinsurl); - updateConfig('PluginURL', $config_pluginurl); - updateConfig('ActionURL', $config_actionurl); - updateConfig('AdminEmail', $config_adminemail); - updateConfig('SiteName', $config_sitename); - - - // 7. update GOD member - $query = 'UPDATE ' . tableName('nucleus_member') - . " SET mname='" . addslashes($user_name) . "'," - . " mrealname='". addslashes($user_realname) . "'," - . " mpassword='". md5(addslashes($user_password)) . "'," - . " murl='" . addslashes($config_indexurl) . "'," - . " memail='" . addslashes($user_email) . "'," - . " madmin=1," - . " mcanlogin=1" - . " WHERE mnumber=1"; - mysql_query($query) or _doError("Error while setting member settings: " . mysql_error()); - - // 8. update weblog settings - $query = 'UPDATE ' . tableName('nucleus_blog') - . " SET bname='" . addslashes($blog_name) . "'," - . " bshortname='". addslashes($blog_shortname) . "'," - . " burl='" . addslashes($config_indexurl) . "'" - . " WHERE bnumber=1"; - mysql_query($query) or _doError("Error while setting weblog settings: " . mysql_error()); - - // 9. update item date - $query = 'UPDATE ' . tableName('nucleus_item') - . " SET itime='". date("Y-m-d H:i:s",time()) ."'" - . " WHERE inumber=1"; - mysql_query($query) or _doError("Error with query: " . mysql_error()); - - global $aConfPlugsToInstall, $aConfSkinsToImport; - $aSkinErrors = array(); - $aPlugErrors = array(); - if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0)) { - // 10. set global variables - global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX; - $MYSQL_HOST = $mysql_host; - $MYSQL_USER = $mysql_user; - $MYSQL_PASSWORD = $mysql_password; - $MYSQL_DATABASE = $mysql_database; - $MYSQL_PREFIX = ($mysql_usePrefix == 1)?$mysql_prefix:''; - global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS; - $DIR_NUCLEUS = $config_adminpath; - $DIR_MEDIA = $config_mediapath; - $DIR_SKINS = $config_skinspath; - $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/'; - $DIR_LANG = $DIR_NUCLEUS . 'language/'; - $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; - - // close database connection (needs to be closed if we want to include globalfunctions.php) - mysql_close(); - - $manager = ''; - include_once($DIR_LIBS . 'globalfunctions.php'); - - // 11. install custom skins - $aSkinErrors = installCustomSkins($manager); - - // 12. install custom plugins - $aPlugErrors = installCustomPlugs($manager); - - } - - - // 12. Write config file ourselves (if possible) - $bConfigWritten = 0; - if (@file_exists('config.php') && is_writable('config.php') && $fp = @fopen('config.php', 'w')) { - $config_data = "<" . "?php \n"; - $config_data .= "\n"; - $config_data .= " // mySQL connection information\n"; - $config_data .= " \$MYSQL_HOST = '" . $mysql_host . "';\n"; - $config_data .= " \$MYSQL_USER = '" . $mysql_user . "';\n"; - $config_data .= " \$MYSQL_PASSWORD = '" . $mysql_password . "';\n"; - $config_data .= " \$MYSQL_DATABASE = '" . $mysql_database . "';\n"; - $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1)?$mysql_prefix:'') . "';\n"; - $config_data .= "\n"; - $config_data .= " // main nucleus directory\n"; - $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; - $config_data .= "\n"; - $config_data .= " // path to media dir\n"; - $config_data .= " \$DIR_MEDIA = '" . $config_mediapath . "';\n"; - $config_data .= "\n"; - $config_data .= " // extra skin files for imported skins\n"; - $config_data .= " \$DIR_SKINS = '" . $config_skinspath . "';\n"; - $config_data .= "\n"; - $config_data .= " // these dirs are normally sub dirs of the nucleus dir, but \n"; - $config_data .= " // you can redefine them if you wish\n"; - $config_data .= " \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n"; - $config_data .= " \$DIR_LANG = \$DIR_NUCLEUS . 'language/';\n"; - $config_data .= " \$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n"; - $config_data .= "\n"; - $config_data .= " // include libs\n"; - $config_data .= " include(\$DIR_LIBS.'globalfunctions.php');\n"; - $config_data .= " if (!extension_loaded('mbstring')) {\n"; - $config_data .= " include(\$DIR_LIBS.'mb_emulator/mb-emulator.php');\n"; - $config_data .= " }\n"; - $config_data .= "?" . ">"; - - $result = @fputs($fp, $config_data, strlen($config_data)); - fclose($fp); - - if ($result) - $bConfigWritten = 1; - } - - ?> - - - - - Nucleusのインストール - - - -

- 0) { - echo '

Skin/Plugin Install errors

'; - echo '
  • '.implode('
  • ', $aAllErrors).'
'; - } - - if (!$bConfigWritten) { ?> -

インストールはほぼ完了しました!

-

- データベーステーブルの初期値入力が成功しました。後はconfig.phpを書き換えるだけです。以下に書き換えるべき内容を表示します(mysqlのパスワードはマスクされています。ここは実際のものに書き換えてください) -

- -
-<?php
-	// mySQL connection information
-	$MYSQL_HOST = '';
-	$MYSQL_USER = '';
-	$MYSQL_PASSWORD = 'xxxxxxxxxxx';
-	$MYSQL_DATABASE = '';
-	$MYSQL_PREFIX = '';
-
-	// main nucleus directory
-	$DIR_NUCLEUS = '';
-
-	// path to media dir
-	$DIR_MEDIA = '';
-
-	// extra skin files for imported skins
-	$DIR_SKINS = '';
-
-	// these dirs are normally sub dirs of the nucleus dir, but
-	// you can redefine them if you wish
-	$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
-	$DIR_LANG = $DIR_NUCLEUS . 'language/';
-	$DIR_LIBS = $DIR_NUCLEUS . 'libs/';
-
-	// include libs
-	include($DIR_LIBS.'globalfunctions.php');
-	if (!extension_loaded('mbstring')) {
-		include($DIR_LIBS.'mb_emulator/mb-emulator.php');
-	}
-?>
-			
- -

あなたのコンピュータ上のファイルを書き換えたら、FTPを使ってウェブサーバにアップロードしてください。ASCIIモードで送信してファイルを上書きします。 -

- -
- 付記: config.phpの最初や終わりにスペースを空けないようにしましょう。実行時にエラーを引き起こす原因となります。 -
- したがって、config.phpの最初の文字は "<"で最後の文字は">"としなければなりません。 -
- - -

インストールは完了しました!

- -

Nucleusはインストールされ、config.phpはアップデートされました。

- -

セキュリティのためconfig.phpのパーミッションを444に戻すことを忘れないでください(パーミッション変更の簡易ガイド)。

- -

インストールファイルの削除

- -

ウェブサーバから次のファイルを削除してください:

- -
    -
  • install.sql:テーブルの構造を内包するファイル
  • -
  • install.php:このファイル
  • -
- -

もしこれらのファイルを削除していなければ、管理領域を開くことが出来ません。

- -

ウェブサイトの確認

-

- ウェブサイトを使う準備が整いました。 -

-

- - - - getPlugin($plugName); - if (!$plugin) { - sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\''. addslashes($plugName).'\''); - $numCurrent--; - array_push($aErrors, 'Unable to install plugin ' . $plugName); - continue; - } - $plugin->install(); - } - - // SYNC PLUGIN EVENT LIST - sql_query('DELETE FROM '.sql_table('plugin_event')); - // loop over all installed plugins - $res = sql_query('SELECT pid, pfile FROM '.sql_table('plugin')); - while($o = mysql_fetch_object($res)) { - $pid = $o->pid; - $plug =& $manager->getPlugin($o->pfile); - if ($plug) - { - $eventList = $plug->getEventList(); - foreach ($eventList as $eventName) - sql_query('INSERT INTO '.sql_table('plugin_event').' (pid, event) VALUES ('.$pid.', \''.$eventName.'\')'); - } - } - - return $aErrors; - } - - function installCustomSkins(&$manager) { - global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS; - - $aErrors = array(); - - if (count($aConfSkinsToImport) == 0) - return $aErrors; - - // load skinie class - include_once($DIR_LIBS . 'skinie.php'); - - $importer = new SKINIMPORT(); - - foreach ($aConfSkinsToImport as $skinName) { - $importer->reset(); - - $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml'; - if (!@file_exists($skinFile)) { - array_push($aErrors, 'Unable to import ' . $skinFile . ' : file does not exist'); - continue; - } - $error = $importer->readFile($skinFile); - if ($error) { - array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); - continue; - } - $error = $importer->writeToDatabase(1); - if ($error) { - array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); - continue; - } - } - - return $aErrors; - } - - // give an error if one or more nucleus are not accessible - function doCheckFiles() { - $missingfiles = array(); - - if (!is_readable('install.sql')) - array_push($missingfiles, "File install.sql is missing or not readable"); - if (!is_readable('index.php')) - array_push($missingfiles, "File index.php is missing or not readable"); - if (!is_readable('action.php')) - array_push($missingfiles, "File action.php is missing or not readable"); - if (!is_readable('nucleus/index.php')) - array_push($missingfiles, "File nucleus/index.php is missing or not readable"); - if (!is_readable('nucleus/libs/globalfunctions.php')) - array_push($missingfiles, "File nucleus/libs/globalfunctions.php is missing or not readable"); - if (!is_readable('nucleus/libs/ADMIN.php')) - array_push($missingfiles, "File nucleus/libs/ADMIN.php is missing or not readable"); - if (!is_readable('nucleus/libs/BLOG.php')) - array_push($missingfiles, "File nucleus/libs/BLOG.php is missing or not readable"); - if (!is_readable('nucleus/libs/COMMENT.php')) - array_push($missingfiles, "File nucleus/libs/COMMENT.php is missing or not readable"); - if (!is_readable('nucleus/libs/COMMENTS.php')) - array_push($missingfiles, "File nucleus/libs/COMMENTS.php is missing or not readable"); - if (!is_readable('nucleus/libs/ITEM.php')) - array_push($missingfiles, "File nucleus/libs/ITEM.php is missing or not readable"); - if (!is_readable('nucleus/libs/MEMBER.php')) - array_push($missingfiles, "File nucleus/libs/MEMBER.php is missing or not readable"); - if (!is_readable('nucleus/libs/SKIN.php')) - array_push($missingfiles, "File nucleus/libs/SKIN.php is missing or not readable"); - if (!is_readable('nucleus/libs/TEMPLATE.php')) - array_push($missingfiles, "File nucleus/libs/TEMPLATE.php is missing or not readable"); - if (!is_readable('nucleus/libs/MEDIA.php')) - array_push($missingfiles, "File nucleus/libs/MEDIA.php is missing or not readable"); - if (!is_readable('nucleus/libs/ACTIONLOG.php')) - array_push($missingfiles, "File nucleus/libs/ACTIONLOG.php is missing or not readable"); - if (!is_readable('nucleus/media.php')) - array_push($missingfiles, "File nucleus/media.php is missing or not readable"); - - - if (sizeof($missingfiles) > 0) - showErrorMessages($missingfiles); - - - } - - function updateConfig($name, $val) { - $name = addslashes($name); - $val = trim(addslashes($val)); - - $query = 'UPDATE ' . tableName('nucleus_config') - . " SET value='$val'" - . " WHERE name='$name'"; - - mysql_query($query) or _doError("Query error while trying to update config: " . mysql_error()); - return mysql_insert_id(); - } - - function endsWithSlash($s) { - return (strrpos($s,'/') == strlen($s) - 1); - } - - /** - * Checks if email address is valid - */ - function _isValidMailAddress($address) { - if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address)) - return 1; - else - return 0; - } - - // returns true if the given string is a valid shortname - // (to check short blog names and nicknames) - // logic: starts and ends with a non space, can contain spaces in between - // min 2 chars - function _isValidShortName($name) { - if (eregi("^[a-z0-9]+$", $name)) - return 1; - else - return 0; - } - - - - // returns true if the given string is a valid display name - // (to check nicknames) - function _isValidDisplayName($name) { - if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name)) - return 1; - else - return 0; - } - - function _doError($msg) { - ?> - - - - - Nucleus Install - - - -
-

Error!

-

- Error message was: ""; -

- -

- Go Back -

- - - - - - - - Nucleus Install - - - -
-

Errors!

-

- Errors were found: -

- -
    - $msg"; - ?> -
- -

- Go Back -

- - -
+
If you see this text in your browser when you open install.php, your web server is not able to run PHP-scripts, and therefor Nucleus will not be able to run there.
0) || (count($aConfSkinsToImport) > 0) ) { + global $CONF; + $CONF['installscript'] = 1; +} + +if (phpversion() >= '4.1.0') { + include_once('nucleus/libs/vars4.1.0.php'); +} else { + include_once('nucleus/libs/vars4.0.6.php'); +} + +include_once('nucleus/libs/mysql.php'); + +// check if mysql support is installed + if (!function_exists('mysql_query') ) { + _doError('Your PHP version does not have support for MySQL :('); + } + + if (postVar('action') == 'go') { + doInstall(); + } else { + showInstallForm(); + } + + exit; + +function showInstallForm() { + // 0. pre check if all necessary files exist + doCheckFiles(); + + ?> + + + + + Nucleusのインストール + + + + +
+
+ +

Install Nucleus

+ +

このスクリプトはNucleusのインストールを手助けします。MySQLテーブルのセットアップと、config.phpに入力するための情報を表示します(config.phpのパーミッションを0666にしておけば、後者の作業は自動的に行われます)。これをなす為に、いくつかの情報を入力する必要があります。

+ +

すべての欄の入力が必要です。オプション情報はインストールが完了したら、Nucleusの管理領域から設定可能です。

+ +

PHP & MySQL Versions

+ +

以下はあなたのウェブホストにおけるPHPインタープリターとMySQLサーバーのバージョンです。Nucleusのサポートフォーラムに問題を報告するときは、この情報を書き添えてください。

+ +
    +
  • PHP: + +注意: Nucleusの動作には少なくともバージョン ',$minVersion,' が必要とされます'; + } +?> + +
  • +
  • MySQL: + + 0) { + $row = mysql_fetch_array($result); + $match = explode('.', $row['version']); + } else { + $result = @mysql_query('SHOW VARIABLES LIKE \'version\''); + + if ($result != FALSE && @mysql_num_rows($result) > 0) { + $row = mysql_fetch_row($result); + $match = explode('.', $row[1]); + } else { + $match[0] = '?'; + $match[1] = '?'; + $match[2] = '?'; + } + } + + if (!isset($match) || !isset($match[0]) ) { + $match[0] = 3; + } + + if (!isset($match[1]) ) { + $match[1] = 21; + } + + if (!isset($match[2]) ) { + $match[2] = 0; + } + + if ($match[0] != '?') { + $match[0] = intval($match[0]); + $match[1] = intval($match[1]); + } + + $mysqlVersion = implode($match, '.'); + $minVersion = '3.23'; + + echo $mysqlVersion; + + if ($mysqlVersion < $minVersion) { + echo ' 注意: Nucleusの動作には少なくともバージョン ',$minVersion,' が必要とされます'; + } +?> + +
  • +
+ + + +

config.phpの自動アップデート

+ +

もしconfig.phpを自動的に更新するようにしたいなら、書き込み可能にする必要があります。config.phpのパーミッションを666にしてください。Nucleusのインストール成功後に、パーミッションを444に戻さなければなりません(パーミッション変更の簡易ガイド)。

+ +

もしファイルに書き込まないという選択をした(あるいは行えない)場合:ご心配なく。インストールの過程でconfig.phpの中身が提供されます。ですから、それをご自身でアップロードしてください。

+ + + +

MySQLのログインデータ

+ +

MySQLのデータを以下に入力してください。それらはデータベース・テーブルを作成し情報を入力するために必要なものです。後で、config.phpにも記入する必要があります(上記の自動アップデートを利用する場合、その手順は省略されます)。

+ +

もしこの情報がわからなければ、システム管理者かホスティング元に連絡をとってください。ほとんどの場合、ホスト名は'localhost'です。もしNucleusがあなたのサーバのPHP設定から'default MySQL host'を検知したなら、'ホスト名'に既に記入されているはずです。もっとも、この情報が正確であるという保証はありません。

+ +
+ 基本のデータベース設定 + + + + + + + + + + + + + + + + + +
ホスト名:
ユーザー名:
パスワード:
データベース名: ()
+
+ +
+ 高等なデータベース設定 + + + + + +
+ +

一つのデータベースに複数のNucleusをインストールしており、自分が何をやっているのか理解されている場合を除いては、これを変更する必要はありません。

+

Nucleusによって生成されたすべてのデータベーステーブルは、このプリフィックスが頭につきます。

+
+ +

ディレクトリとURL

+ +

このインストールスクリプトはNucleusがインストールされているディレクトリとURLを見つけようとしました。下の値をチェックして必要なら訂正してください。ファイルへのパスとURLはスラッシュ'/'で終わらなくてはなりません。

+ + + +
+ URLs and directories + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Site URL:
Admin-area URL:
Admin-area path:
Media files URL:
Media directory path:
Extra skin files URL: +
(インポートされたスキンが使用) +
Extra skin files directory path: +
(インポートされたスキンのファイル類を置く場所) +
Plugin files URL:
Action URL: +
(action.phpへのhttp://から始まるURL) +
+
+ +

付記: 相対パスではなく絶対パスを使ってください。通常、絶対パスは/home/username/public_html/のような形をとります。Unixシステム(ほとんどのサーバーがそうです)において、パスはスラッシュから始まります。もしこれらの情報入力に問題が生じたら、あなたのサーバ管理者にたずねるべきです。

+ +

管理権限をもつユーザー

+ +

以下に、サイトの最初のユーザーを作成するためのいくつかの情報を入力してください。

+ +
+ 管理権限を持つユーザー + + + + + + + + + + + + + + + + + + + + + +
表示される名前: (許可される文字:a-z と 0-9、最初と最後以外のスペース)
本名(ハンドル名):
パスワード:
パスワードの確認:
メールアドレス: (利用可能なメールアドレスを入れてください)
+
+ +

ウェブログのデータ

+ +

以下に、デフォルトのweblogを作成するためにいくつかの情報を入力してください。このweblogの名前は、サイト名としても利用されます。

+ +
+ ウェブログのデータ + + + + + + + + + +
Blog名:
Blogの短縮名: (許可される文字:a-z と 0-9、スペースは不可)
+
+ +

データの送信

+ +

上に書いてきたデータが正しいか確かめてください。よければデータベース・テーブルと最初のデータを設定するために下のボタンを押してください。少し時間がかかるかもしれませんがご辛抱を。ボタンをクリックするのは一回だけにしてください。

+ +

+ +
+ + + + 0) { + showErrorMessages($errors); + } + + // 2. try to log in to mySQL + global $MYSQL_CONN; + $MYSQL_CONN = @mysql_connect($mysql_host, $mysql_user, $mysql_password); + + if ($MYSQL_CONN == false) { + _doError('Could not connect to mySQL server: ' . mysql_error() ); + } + + // 3. try to create database (if needed) + if ($mysql_create == 1) { + mysql_query('CREATE DATABASE ' . $mysql_database) or _doError('Could not create database. Make sure you have the rights to do so. SQL error was: ' . mysql_error() ); + } + + // 4. try to select database + mysql_select_db($mysql_database) or _doError('Could not select database. Make sure it exists'); + + // 5. execute queries + $filename = 'install.sql'; + $fd = fopen($filename, 'r'); + $queries = fread($fd, filesize($filename) ); + fclose($fd); + + $queries = split("(;\n|;\r)", $queries); + + $aTableNames = array( + 'nucleus_actionlog', + 'nucleus_ban', + 'nucleus_blog', + 'nucleus_category', + 'nucleus_comment', + 'nucleus_config', + 'nucleus_item', + 'nucleus_karma', + 'nucleus_member', + 'nucleus_plugin', + 'nucleus_skin', + 'nucleus_template', + 'nucleus_team', + 'nucleus_activation', + 'nucleus_tickets' + ); +// these are unneeded (one of the replacements above takes care of them) +// 'nucleus_plugin_event', +// 'nucleus_plugin_option', +// 'nucleus_plugin_option_desc', +// 'nucleus_skin_desc', +// 'nucleus_template_desc', + + $aTableNamesPrefixed = array( + $mysql_prefix . 'nucleus_actionlog', + $mysql_prefix . 'nucleus_ban', + $mysql_prefix . 'nucleus_blog', + $mysql_prefix . 'nucleus_category', + $mysql_prefix . 'nucleus_comment', + $mysql_prefix . 'nucleus_config', + $mysql_prefix . 'nucleus_item', + $mysql_prefix . 'nucleus_karma', + $mysql_prefix . 'nucleus_member', + $mysql_prefix . 'nucleus_plugin', + $mysql_prefix . 'nucleus_skin', + $mysql_prefix . 'nucleus_template', + $mysql_prefix . 'nucleus_team', + $mysql_prefix . 'nucleus_activation', + $mysql_prefix . 'nucleus_tickets' + ); +// these are unneeded (one of the replacements above takes care of them) +// $mysql_prefix . 'nucleus_plugin_event', +// $mysql_prefix . 'nucleus_plugin_option', +// $mysql_prefix . 'nucleus_plugin_option_desc', +// $mysql_prefix . 'nucleus_skin_desc', +// $mysql_prefix . 'nucleus_template_desc', + + $count = count($queries); + + for ($idx = 0; $idx < $count; $idx++) { + $query = trim($queries[$idx]); + // echo "QUERY = " . htmlspecialchars($query) . "

"; + + if ($query) { + + if ($mysql_usePrefix == 1) { + $query = str_replace($aTableNames, $aTableNamesPrefixed, $query); + } + + mysql_query($query) or _doError('Error while executing query (' . htmlspecialchars($query) . '): ' . mysql_error() ); + } + } + + // 6. update global settings + updateConfig('IndexURL', $config_indexurl); + updateConfig('AdminURL', $config_adminurl); + updateConfig('MediaURL', $config_mediaurl); + updateConfig('SkinsURL', $config_skinsurl); + updateConfig('PluginURL', $config_pluginurl); + updateConfig('ActionURL', $config_actionurl); + updateConfig('AdminEmail', $config_adminemail); + updateConfig('SiteName', $config_sitename); + + // 7. update GOD member + $query = 'UPDATE ' . tableName('nucleus_member') + . " SET mname='" . addslashes($user_name) . "'," + . " mrealname='" . addslashes($user_realname) . "'," + . " mpassword='" . md5(addslashes($user_password) ) . "'," + . " murl='" . addslashes($config_indexurl) . "'," + . " memail='" . addslashes($user_email) . "'," + . " madmin=1, mcanlogin=1" + . " WHERE mnumber=1"; + + mysql_query($query) or _doError('Error while setting member settings: ' . mysql_error() ); + + // 8. update weblog settings + $query = 'UPDATE ' . tableName('nucleus_blog') + . " SET bname='" . addslashes($blog_name) . "'," + . " bshortname='" . addslashes($blog_shortname) . "'," + . " burl='" . addslashes($config_indexurl) . "'" + . " WHERE bnumber=1"; + + mysql_query($query) or _doError('Error while setting weblog settings: ' . mysql_error() ); + + // 9. update item date + $query = 'UPDATE ' . tableName('nucleus_item') + . " SET itime='" . date('Y-m-d H:i:s', time() ) ."'" + . " WHERE inumber=1"; + + mysql_query($query) or _doError('Error with query: ' . mysql_error() ); + + global $aConfPlugsToInstall, $aConfSkinsToImport; + $aSkinErrors = array(); + $aPlugErrors = array(); + + if ((count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) ) { + // 10. set global variables + global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX; + + $MYSQL_HOST = $mysql_host; + $MYSQL_USER = $mysql_user; + $MYSQL_PASSWORD = $mysql_password; + $MYSQL_DATABASE = $mysql_database; + $MYSQL_PREFIX = ($mysql_usePrefix == 1)?$mysql_prefix:''; + + global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS; + + $DIR_NUCLEUS = $config_adminpath; + $DIR_MEDIA = $config_mediapath; + $DIR_SKINS = $config_skinspath; + $DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/'; + $DIR_LANG = $DIR_NUCLEUS . 'language/'; + $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; + + // close database connection (needs to be closed if we want to include globalfunctions.php) + mysql_close(); + + $manager = ''; + include_once($DIR_LIBS . 'globalfunctions.php'); + + // 11. install custom skins + $aSkinErrors = installCustomSkins($manager); + + // 12. install custom plugins + $aPlugErrors = installCustomPlugs($manager); + } + + // 12. Write config file ourselves (if possible) + $bConfigWritten = 0; + + if (@file_exists('config.php') && is_writable('config.php') && $fp = @fopen('config.php', 'w') ) { + $config_data = '<' . '?php' . "\n\n"; + //$config_data .= "\n"; (extraneous, just added extra \n to previous line + $config_data .= " // mySQL connection information\n"; + $config_data .= " \$MYSQL_HOST = '" . $mysql_host . "';\n"; + $config_data .= " \$MYSQL_USER = '" . $mysql_user . "';\n"; + $config_data .= " \$MYSQL_PASSWORD = '" . $mysql_password . "';\n"; + $config_data .= " \$MYSQL_DATABASE = '" . $mysql_database . "';\n"; + $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1)?$mysql_prefix:'') . "';\n"; + $config_data .= "\n"; + $config_data .= " // main nucleus directory\n"; + $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; + $config_data .= "\n"; + $config_data .= " // path to media dir\n"; + $config_data .= " \$DIR_MEDIA = '" . $config_mediapath . "';\n"; + $config_data .= "\n"; + $config_data .= " // extra skin files for imported skins\n"; + $config_data .= " \$DIR_SKINS = '" . $config_skinspath . "';\n"; + $config_data .= "\n"; + $config_data .= " // these dirs are normally sub dirs of the nucleus dir, but \n"; + $config_data .= " // you can redefine them if you wish\n"; + $config_data .= " \$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n"; + $config_data .= " \$DIR_LANG = \$DIR_NUCLEUS . 'language/';\n"; + $config_data .= " \$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n"; + $config_data .= "\n"; + $config_data .= " // include libs\n"; + $config_data .= " include(\$DIR_LIBS.'globalfunctions.php');\n"; + $config_data .= " if (!extension_loaded('mbstring')) {\n"; + $config_data .= " include(\$DIR_LIBS.'mb_emulator/mb-emulator.php');\n"; + $config_data .= " }\n"; + $config_data .= "?" . ">"; + + $result = @fputs($fp, $config_data, strlen($config_data) ); + fclose($fp); + + if ($result) { + $bConfigWritten = 1; + } + } + +?> + + + + + Nucleusのインストール + + + +

+ + 0) { + echo '

Skin/Plugin Install errors

'; + echo ''; + } + + if (!$bConfigWritten) { ?> +

インストールはほぼ完了しました!

+ +

データベーステーブルの初期値入力が成功しました。後はconfig.phpを書き換えるだけです。以下に書き換えるべき内容を表示します(mysqlのパスワードはマスクされています。ここは実際のものに書き換えてください)

+ +
<?php
+	// mySQL connection information
+	$MYSQL_HOST = '';
+	$MYSQL_USER = '';
+	$MYSQL_PASSWORD = 'xxxxxxxxxxx';
+	$MYSQL_DATABASE = '';
+	$MYSQL_PREFIX = '';
+
+	// main nucleus directory
+	$DIR_NUCLEUS = '';
+
+	// path to media dir
+	$DIR_MEDIA = '';
+
+	// extra skin files for imported skins
+	$DIR_SKINS = '';
+
+	// these dirs are normally sub dirs of the nucleus dir, but
+	// you can redefine them if you wish
+	$DIR_PLUGINS = $DIR_NUCLEUS . 'plugins/';
+	$DIR_LANG = $DIR_NUCLEUS . 'language/';
+	$DIR_LIBS = $DIR_NUCLEUS . 'libs/';
+
+	// include libs
+	include($DIR_LIBS.'globalfunctions.php');
+	if (!extension_loaded('mbstring')) {
+		include($DIR_LIBS.'mb_emulator/mb-emulator.php');
+	}
+?>
+ +

あなたのコンピュータ上のファイルを書き換えたら、FTPを使ってウェブサーバにアップロードしてください。ASCIIモードで送信してファイルを上書きします。

+ +
+ 付記: config.phpの最初や終わりにスペースを空けないようにしましょう。実行時にエラーを引き起こす原因となります。
+ したがって、config.phpの最初の文字は "<"で最後の文字は">"としなければなりません。 +
+ + + +

インストールは完了しました!

+ +

Nucleusはインストールされ、config.phpはアップデートされました。

+ +

セキュリティのためconfig.phpのパーミッションを444に戻すことを忘れないでください(パーミッション変更の簡易ガイド)。

+ + + +

インストールファイルの削除

+ +

ウェブサーバから次のファイルを削除してください:

+ + + +

もしこれらのファイルを削除していなければ、管理領域を開くことが出来ません。

+ +

ウェブサイトの確認

+ +

ウェブサイトを使う準備が整いました。 +

+

+ + + + +getPlugin($plugName); + + if (!$plugin) { + sql_query('DELETE FROM ' . sql_table('plugin') . ' WHERE pfile=\'' . addslashes($plugName) . '\''); + $numCurrent--; + array_push($aErrors, 'Unable to install plugin ' . $plugName); + continue; + } + + $plugin->install(); + } + + // SYNC PLUGIN EVENT LIST + sql_query('DELETE FROM ' . sql_table('plugin_event') ); + + // loop over all installed plugins + $res = sql_query('SELECT pid, pfile FROM ' . sql_table('plugin') ); + + while($o = mysql_fetch_object($res) ) { + $pid = $o->pid; + $plug =& $manager->getPlugin($o->pfile); + + if ($plug) { + $eventList = $plug->getEventList(); + + foreach ($eventList as $eventName) { + sql_query('INSERT INTO ' . sql_table('plugin_event') . ' (pid, event) VALUES (' . $pid . ', \'' . $eventName . '\')'); + } + } + } + + return $aErrors; +} + +function installCustomSkins(&$manager) { + global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS; + + $aErrors = array(); + + if (count($aConfSkinsToImport) == 0) { + return $aErrors; + } + + // load skinie class + include_once($DIR_LIBS . 'skinie.php'); + + $importer = new SKINIMPORT(); + + foreach ($aConfSkinsToImport as $skinName) { + $importer->reset(); + $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml'; + + if (!@file_exists($skinFile) ) { + array_push($aErrors, 'Unable to import ' . $skinFile . ' : file does not exist'); + continue; + } + + $error = $importer->readFile($skinFile); + + if ($error) { + array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); + continue; + } + + $error = $importer->writeToDatabase(1); + + if ($error) { + array_push($aErrors, 'Unable to import ' . $skinName . ' : ' . $error); + continue; + } + } + + return $aErrors; +} + +// give an error if one or more nucleus are not accessible +function doCheckFiles() { + $missingfiles = array(); + $files = array( + 'install.sql', + 'index.php', + 'action.php', + 'nucleus/index.php', + 'nucleus/libs/globalfunctions.php', + 'nucleus/libs/ADMIN.php', + 'nucleus/libs/BLOG.php', + 'nucleus/libs/COMMENT.php', + 'nucleus/libs/COMMENTS.php', + 'nucleus/libs/ITEM.php', + 'nucleus/libs/MEMBER.php', + 'nucleus/libs/SKIN.php', + 'nucleus/libs/TEMPLATE.php', + 'nucleus/libs/MEDIA.php', + 'nucleus/libs/ACTIONLOG.php', + 'nucleus/media.php' + ); + + $count = count($files); + + for ($i = 0; $i < $count; $i++) { + if (!is_readable($files[$i]) ) { + array_push($missingfiles, 'File ' . $files[$i] . ' is missing or not readable.'); + } + } + +// The above code replaces several if statements of the form: + +// if (!is_readable('install.sql') ) { +// array_push($missingfiles, 'File install.sql is missing or not readable'); +// } + + if (count($missingfiles) > 0) { + showErrorMessages($missingfiles); + } +} + +function updateConfig($name, $val) { + $name = addslashes($name); + $val = trim(addslashes($val) ); + + $query = 'UPDATE ' . tableName('nucleus_config') + . " SET value='$val'" + . " WHERE name='$name'"; + + mysql_query($query) or _doError('Query error while trying to update config: ' . mysql_error() ); + return mysql_insert_id(); +} + +function replaceDoubleBackslash($input) { + return str_replace('\\', '/', $input); +} + +function endsWithSlash($s) { + return (strrpos($s, '/') == strlen($s) - 1); +} + +/** + * Checks if email address is valid + */ +function _isValidMailAddress($address) { + if (preg_match("/^[a-zA-Z0-9\._-]+@+[A-Za-z0-9\._-]+\.+[A-Za-z]{2,4}$/", $address) ) { + return 1; + } else { + return 0; + } +} + +// returns true if the given string is a valid shortname +// (to check short blog names and nicknames) +// logic: starts and ends with a non space, can contain spaces in between +// min 2 chars +function _isValidShortName($name) { + if (eregi("^[a-z0-9]+$", $name) ) { + return 1; + } else { + return 0; + } +} + + + +// returns true if the given string is a valid display name +// (to check nicknames) +function _isValidDisplayName($name) { + if (eregi("^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$", $name) ) { + return 1; + } else { + return 0; + } +} + +function _doError($msg) { + ?> + + + + + Nucleus Install + + + +
+

Error!

+ +

Error message was: "";

+ +

Go Back

+ + + + + + + + + Nucleus Install + + + +
+

Errors!

+ +

Errors were found:

+ + + +

Go Back

+ + + +
\ No newline at end of file diff --git a/utf8/nucleus/bookmarklet.php b/utf8/nucleus/bookmarklet.php index da8ef99..0f51b87 100755 --- a/utf8/nucleus/bookmarklet.php +++ b/utf8/nucleus/bookmarklet.php @@ -1,326 +1,336 @@ -isLoggedIn()) { - bm_loginAndPassThrough(); - exit; -} - -// on successfull login -if (($action == 'login') && ($member->isLoggedIn())) - $action = requestVar('nextaction'); -if ($action == '') - $action = 'add'; - -sendContentType('application/xhtml+xml', 'bookmarklet-'.$action); - -// check ticket -$action = strtolower($action); -$aActionsNotToCheck = array('login', 'add', 'edit'); -if (!in_array($action, $aActionsNotToCheck)) -{ - if (!$manager->checkTicket()) - bm_doError(_ERROR_BADTICKET); -} - - -// find out what to do -switch ($action) { - case 'additem': - bm_doAddItem(); // adds the item for real - break; - case 'edit': - bm_doEditForm(); // shows the edit item form - break; - case 'edititem': // edits the item for real - bm_doEditItem(); - break; - case 'login': // on login, 'action' gets changed to 'nextaction' - bm_doError('Something went wrong'); - break; - case 'add': - default: - bm_doShowForm(); // shows the fill in form - break; -} - -function bm_doAddItem() { - global $member, $manager, $CONF; - - $manager->loadClass('ITEM'); - $result = ITEM::createFromRequest(); - - if ($result['status'] == 'error') - bm_doError($result['message']); - - $blogid = getBlogIDFromItemID($result['itemid']); - $blog =& $manager->getBlog($blogid); - - if ($result['status'] == 'newcategory') { - $message = _BOOKMARKLET_NEW_CATEGORY ここをクリックしてカテゴリーの名前と説明を編集してください。'; - $extrahead = ''; - } elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland()) { - $message = _BOOKMARKLET_SEND_PING; - $extrahead = ''; - } else { - $message = _ITEM_ADDED; - $extrahead = ''; - } - - bm_message(_ITEM_ADDED, _ITEM_ADDED, $message,$extrahead); -} - -function bm_doEditItem() { - global $member, $manager, $CONF; - - $itemid = intRequestVar('itemid'); - $catid = postVar('catid'); - - // only allow if user is allowed to alter item - if (!$member->canUpdateItem($itemid, $catid)) - bm_doError(_ERROR_DISALLOWED); - - $body = postVar('body'); - $title = postVar('title'); - $more = postVar('more'); - $closed = intPostVar('closed'); - $actiontype = postVar('actiontype'); - - // redirect to admin area on delete (has delete confirmation) - if ($actiontype == 'delete') { - redirect('index.php?action=itemdelete&itemid='.$itemid); - exit; - } - - // create new category if needed (only on edit/changedate) - if (strstr($catid,'newcat')) { - // get blogid - list($blogid) = sscanf($catid,"newcat-%d"); - - // create - $blog =& $manager->getBlog($blogid); - $catid = $blog->createNewCategory(); - - // show error when sth goes wrong - if (!$catid) - bm_doError('Could not create new category'); - } - - // only edit action is allowed for bookmarklet edit - switch ($actiontype) { - case 'changedate': - $publish = 1; - $wasdraft = 0; - $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year')); - break; - case 'edit': - $publish = 1; - $wasdraft = 0; - $timestamp = 0; - break; - default: - bm_doError('Something went wrong'); - } - - // update item for real - ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp); - - // show success message - if ($catid != intPostVar('catid')) - bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _BOOKMARKLET_NEW_CATEGORYここをクリックしてカテゴリーの名前と説明を編集してください。', ''); - else - bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _ITEM_UPDATED, ''); -} - -function bm_loginAndPassThrough() { - - $blogid = intRequestVar('blogid'); - $log_text = requestVar('logtext'); - $log_link = requestVar('loglink'); - $log_linktitle = requestVar('loglinktitle'); - - ?> - - - - - Nucleus - - - -

- -
-

- - - - - - : -
-
: -
-

-
-

-
-

- - - isTeamMember($blogid)) - bm_doError(_ERROR_NOTONTEAM); - - $logje = ''; - if ($log_text) - $logje .= '
"' . htmlspecialchars($log_text) .'"
' . "\n"; - if (!$log_linktitle) - $log_linktitle = $log_link; - if ($log_link) - $logje .= ''. htmlspecialchars($log_linktitle).''; - - - $item['body'] = $logje; - $item['title'] = htmlspecialchars($log_linktitle); - - $factory = new PAGEFACTORY($blogid); - $factory->createAddForm('bookmarklet',$item); -} - -function bm_doEditForm() { - global $member, $manager; - - $itemid = intRequestVar('itemid'); - - if (!$manager->existsItem($itemid, 0, 0)) - bm_doError(_ERROR_NOSUCHITEM); - - if (!$member->canAlterItem($itemid)) - bm_doError(_ERROR_DISALLOWED); - - $item =& $manager->getItem($itemid,1,1); - $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); - - $manager->notify('PrepareItemForEdit', array('item' => &$item)); - - if ($blog->convertBreaks()) { - $item['body'] = removeBreaks($item['body']); - $item['more'] = removeBreaks($item['more']); - } - - $formfactory = new PAGEFACTORY($blog->getID()); - $formfactory->createEditForm('bookmarklet',$item); - -} - -function bm_doError($msg) { - bm_message(_ERROR,_ERRORMSG,$msg); - die; -} - -function bm_message($title, $head, $msg, $extrahead = '') { - ?> - - - - - <?php echo $title ?> - - - - -

-

-

- - - - '; - echo ''; -} - -function bm_doContextMenuCode() { - global $CONF; - ?> - - +isLoggedIn()) { + bm_loginAndPassThrough(); + exit; +} + +// on successfull login +if (($action == 'login') && ($member->isLoggedIn())) + $action = requestVar('nextaction'); +if ($action == '') + $action = 'add'; + +sendContentType('application/xhtml+xml', 'bookmarklet-'.$action); + +// check ticket +$action = strtolower($action); +$aActionsNotToCheck = array('login', 'add', 'edit'); +if (!in_array($action, $aActionsNotToCheck)) +{ + if (!$manager->checkTicket()) + bm_doError(_ERROR_BADTICKET); +} + + +// find out what to do +switch ($action) { + case 'additem': + bm_doAddItem(); // adds the item for real + break; + case 'edit': + bm_doEditForm(); // shows the edit item form + break; + case 'edititem': // edits the item for real + bm_doEditItem(); + break; + case 'login': // on login, 'action' gets changed to 'nextaction' + bm_doError('Something went wrong'); + break; + case 'add': + default: + bm_doShowForm(); // shows the fill in form + break; +} + +function bm_doAddItem() { + global $member, $manager, $CONF; + + $manager->loadClass('ITEM'); + $result = ITEM::createFromRequest(); + + if ($result['status'] == 'error') + bm_doError($result['message']); + + $blogid = getBlogIDFromItemID($result['itemid']); + $blog =& $manager->getBlog($blogid); + + if ($result['status'] == 'newcategory') { + $message = 'Item was added, and a new category was created. Click here to edit the name and description of the category.'; + $extrahead = ''; + } elseif ((postVar('actiontype') == 'addnow') && $blog->pingUserland()) { + $message = 'Item was added successfully. Now pinging weblogs.com. Please hold on... (can take a while)'; + $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid)); + $extrahead = ''; + } else { + $message = _ITEM_ADDED; + $extrahead = ''; + } + + bm_message(_ITEM_ADDED, _ITEM_ADDED, $message,$extrahead); +} + +function bm_doEditItem() { + global $member, $manager, $CONF; + + $itemid = intRequestVar('itemid'); + $catid = postVar('catid'); + + // only allow if user is allowed to alter item + if (!$member->canUpdateItem($itemid, $catid)) + bm_doError(_ERROR_DISALLOWED); + + $body = postVar('body'); + $title = postVar('title'); + $more = postVar('more'); + $closed = intPostVar('closed'); + $actiontype = postVar('actiontype'); + + $draftid = intPostVar('draftid'); + + // redirect to admin area on delete (has delete confirmation) + if ($actiontype == 'delete') { + redirect('index.php?action=itemdelete&itemid='.$itemid); + exit; + } + + // create new category if needed (only on edit/changedate) + if (strstr($catid,'newcat')) { + // get blogid + list($blogid) = sscanf($catid,"newcat-%d"); + + // create + $blog =& $manager->getBlog($blogid); + $catid = $blog->createNewCategory(); + + // show error when sth goes wrong + if (!$catid) + bm_doError('Could not create new category'); + } + + // only edit action is allowed for bookmarklet edit + switch ($actiontype) { + case 'changedate': + $publish = 1; + $wasdraft = 0; + $timestamp = mktime(postVar('hour'), postVar('minutes'), 0, postVar('month'), postVar('day'), postVar('year')); + break; + case 'edit': + $publish = 1; + $wasdraft = 0; + $timestamp = 0; + break; + default: + bm_doError('Something went wrong'); + } + + // update item for real + ITEM::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp); + + if ($draftid > 0) { + ITEM::delete($draftid); + } + + // show success message + if ($catid != intPostVar('catid')) + bm_message(_ITEM_UPDATED, _ITEM_UPDATED, 'Item was added, and a new category was created. Click here to edit the name and description of the category.', ''); + else + bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _ITEM_UPDATED, ''); +} + +function bm_loginAndPassThrough() { + + $blogid = intRequestVar('blogid'); + $log_text = requestVar('logtext'); + $log_link = requestVar('loglink'); + $log_linktitle = requestVar('loglinktitle'); + + ?> + + + + + Nucleus + + + +

+ +
+

+ + + + + + : +
+
: +
+

+
+

+
+

+ + + isTeamMember($blogid)) + bm_doError(_ERROR_NOTONTEAM); + + $logje = ''; + if ($log_text) + $logje .= '
"' . htmlspecialchars($log_text) .'"
' . "\n"; + if (!$log_linktitle) + $log_linktitle = $log_link; + if ($log_link) + $logje .= ''. htmlspecialchars($log_linktitle).''; + + + $item['body'] = $logje; + $item['title'] = htmlspecialchars($log_linktitle); + + $factory = new PAGEFACTORY($blogid); + $factory->createAddForm('bookmarklet',$item); +} + +function bm_doEditForm() { + global $member, $manager; + + $itemid = intRequestVar('itemid'); + + if (!$manager->existsItem($itemid, 0, 0)) + bm_doError(_ERROR_NOSUCHITEM); + + if (!$member->canAlterItem($itemid)) + bm_doError(_ERROR_DISALLOWED); + + $item =& $manager->getItem($itemid,1,1); + $blog =& $manager->getBlog(getBlogIDFromItemID($itemid)); + + $manager->notify('PrepareItemForEdit', array('item' => &$item)); + + if ($blog->convertBreaks()) { + $item['body'] = removeBreaks($item['body']); + $item['more'] = removeBreaks($item['more']); + } + + $formfactory = new PAGEFACTORY($blog->getID()); + $formfactory->createEditForm('bookmarklet',$item); + +} + +function bm_doError($msg) { + bm_message(_ERROR,_ERRORMSG,$msg); + die; +} + +function bm_message($title, $head, $msg, $extrahead = '') { + ?> + + + + + <?php echo $title ?> + + + + +

+

+

+ + + + '; + echo ''; +} + +function bm_doContextMenuCode() { + global $CONF; + ?> + + \ No newline at end of file diff --git a/utf8/nucleus/forgotpassword.html b/utf8/nucleus/forgotpassword.html index e051702..47494b9 100755 --- a/utf8/nucleus/forgotpassword.html +++ b/utf8/nucleus/forgotpassword.html @@ -1,8 +1,8 @@ - - + + Nucleus - パスワードの紛失