From e68c9a135bca5e1f54671ec0013714adb1d26f15 Mon Sep 17 00:00:00 2001 From: shizuki Date: Sat, 7 Feb 2009 03:28:37 +0000 Subject: [PATCH] =?utf8?q?=E7=BF=BB=E8=A8=B3=E5=BF=98=E3=82=8C=E9=83=A8?= =?utf8?q?=E5=88=86=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk/utf8@913 1ca29b6e-896d-4ea0-84a5-967f57386b96 --- nucleus/bookmarklet.php | 680 ++++++++++++++++++------------------- nucleus/forgotpassword.html | 35 +- nucleus/index.php | 34 +- nucleus/language/english.php | 3 + nucleus/language/japanese-utf8.php | 2 +- nucleus/media.php | 4 +- 6 files changed, 378 insertions(+), 380 deletions(-) diff --git a/nucleus/bookmarklet.php b/nucleus/bookmarklet.php index a59ddc5..0388874 100755 --- a/nucleus/bookmarklet.php +++ b/nucleus/bookmarklet.php @@ -15,362 +15,362 @@ * * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2009 The Nucleus Group - * @version $Id: bookmarklet.php,v 1.10 2008-02-08 09:31:22 kimitake Exp $ + * @version $Id$ * $NucleusJP: bookmarklet.php,v 1.9.2.1 2007/09/07 07:16:39 kimitake Exp $ */ -// bookmarklet is part of admin area (might need XML-RPC) -$CONF = array(); -$CONF['UsingAdminArea'] = 1; - -// include all classes and config data -include('../config.php'); - -$action = requestVar('action'); - -if ($action == 'contextmenucode') { - bm_doContextMenuCode(); - exit; -} - -if (!$member->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) { - // adds the item for real - case 'additem': - bm_doAddItem(); - break; - - // shows the edit item form - case 'edit': - bm_doEditForm(); - break; - - // edits the item for real - case 'edititem': - bm_doEditItem(); - break; - - // on login, 'action' gets changed to 'nextaction' - case 'login': - bm_doError('Something went wrong'); - break; - - // shows the fill in form - case 'add': - default: - bm_doShowForm(); - 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') { +// bookmarklet is part of admin area (might need XML-RPC) +$CONF = array(); +$CONF['UsingAdminArea'] = 1; + +// include all classes and config data +include('../config.php'); + +$action = requestVar('action'); + +if ($action == 'contextmenucode') { + bm_doContextMenuCode(); + exit; +} + +if (!$member->isLoggedIn() ) { + bm_loginAndPassThrough(); + exit; +} + +// on successfull login +if ( ($action == 'login') && ($member->isLoggedIn() ) ) { + $action = requestVar('nextaction'); +} + +if ($action == '') { + $action = 'add'; +} + +sendContentType('text/html', '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) { + // adds the item for real + case 'additem': + bm_doAddItem(); + break; + + // shows the edit item form + case 'edit': + bm_doEditForm(); + break; + + // edits the item for real + case 'edititem': + bm_doEditItem(); + break; + + // on login, 'action' gets changed to 'nextaction' + case 'login': + bm_doError('Something went wrong'); + break; + + // shows the fill in form + case 'add': + default: + bm_doShowForm(); + 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') { $href = 'index.php?action=categoryedit&blogid=' . $blogid . '&catid=' . $result['catid']; $onclick = 'if (event && event.preventDefault) event.preventDefault(); window.open(this.href); return false;'; $title = _BOOKMARKLET_NEW_WINDOW; $aTag = ' '; $message = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . ''; $extrahead = ''; - } elseif ( (postVar('actiontype') == 'addnow') && $blog->sendPing() ) { - $message = _BOOKMARKLET_SEND_PING; - $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(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year') ); - break; - case 'edit': - $publish = 1; - $wasdraft = 0; - $timestamp = 0; - break; + } elseif ( (postVar('actiontype') == 'addnow') && $blog->sendPing() ) { + $message = _BOOKMARKLET_SEND_PING; + $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(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year') ); + break; + case 'edit': + $publish = 1; + $wasdraft = 0; + $timestamp = 0; + break; case 'backtodrafts': $publish = 0; $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') ) { + 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') ) { $href = 'index.php?action=categoryedit&blogid=' . $blog->getID() . '&catid=' . $catid; $onclick = 'if (event && event.preventDefault) event.preventDefault(); window.open(this.href); return false;'; $title = _BOOKMARKLET_NEW_WINDOW; $aTag = ' '; $message = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . ''; - bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . '', ''); - } 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; - ?> - - + bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . '', ''); + } 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/nucleus/forgotpassword.html b/nucleus/forgotpassword.html index 00d8440..6ef15ce 100755 --- a/nucleus/forgotpassword.html +++ b/nucleus/forgotpassword.html @@ -1,7 +1,20 @@ - + - + + Nucleus - パスワードの紛失 @@ -10,22 +23,6 @@ @import url(styles/admin.css); --> -
@@ -40,7 +37,7 @@

-
+


diff --git a/nucleus/index.php b/nucleus/index.php index 8773b9f..fffd6d7 100755 --- a/nucleus/index.php +++ b/nucleus/index.php @@ -12,7 +12,7 @@ /** * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2009 The Nucleus Group - * @version $Id: index.php,v 1.9 2008-02-08 09:31:22 kimitake Exp $ + * @version $Id$ * $NucleusJP: index.php,v 1.8.2.1 2007/09/07 07:36:09 kimitake Exp $ */ // we are using admin stuff: @@ -22,26 +22,23 @@ // include the admin code include('../config.php'); - if ($CONF['alertOnSecurityRisk'] == 1) - { + if ($CONF['alertOnSecurityRisk'] == 1) { // check if files exist and generate an error if so $aFiles = array( '../install.sql' => _ERRORS_INSTALLSQL, '../install.php' => _ERRORS_INSTALLPHP, - 'upgrades' => _ERRORS_UPGRADESDIR, - 'convert' => _ERRORS_CONVERTDIR + 'upgrades' => _ERRORS_UPGRADESDIR, + 'convert' => _ERRORS_CONVERTDIR ); $aFound = array(); - foreach($aFiles as $fileName => $fileDesc) - { + foreach($aFiles as $fileName => $fileDesc) { if (@file_exists($fileName)) array_push($aFound, $fileDesc); } if (@is_writable('../config.php')) { - array_push($aFound, 'config.php should be non-writable (chmod to 444)'); + array_push($aFound, _ERRORS_CONFIGPHP); } - if (sizeof($aFound) > 0) - { + if (sizeof($aFound) > 0) { startUpError( _ERRORS_STARTUPERROR1. implode($aFound, '

  • ')._ERRORS_STARTUPERROR2, _ERRORS_STARTUPERROR3 @@ -49,23 +46,24 @@ } } - $bNeedsLogin = false; + $bNeedsLogin = false; $bIsActivation = in_array($action, array('activate', 'activatesetpwd')); - if ($action == 'logout') - $bNeedsLogin = true; + if ($action == 'logout') { + $bNeedsLogin = true; + } - if (!$member->isLoggedIn() && !$bIsActivation) - $bNeedsLogin = true; + if (!$member->isLoggedIn() && !$bIsActivation) { + $bNeedsLogin = true; + } // show error if member cannot login to admin if ($member->isLoggedIn() && !$member->canLogin() && !$bIsActivation) { - $error = _ERROR_LOGINDISALLOWED; + $error = _ERROR_LOGINDISALLOWED; $bNeedsLogin = true; } - if ($bNeedsLogin) - { + if ($bNeedsLogin) { setOldAction($action); // see ADMIN::login() (sets old action in POST vars) $action = 'showlogin'; } diff --git a/nucleus/language/english.php b/nucleus/language/english.php index d8db205..6c32a2c 100755 --- a/nucleus/language/english.php +++ b/nucleus/language/english.php @@ -1234,6 +1234,9 @@ define('_LIST_SKIN_README_TXT', 'Read me'); define('_CREATED_NEW_CATEGORY_NAME', 'newcat'); define('_CREATED_NEW_CATEGORY_DESC', 'New category'); +// HTML outputs +define('_HTML_XML_NAME_SPACE_AND_LANG_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"'); + // Language Files define('_LANGUAGEFILES_JAPANESE-UTF8', 'Japanese - 日本語 (UTF-8)'); define('_LANGUAGEFILES_JAPANESE-EUC', 'Japanese - 日本語 (EUC)'); diff --git a/nucleus/language/japanese-utf8.php b/nucleus/language/japanese-utf8.php index 3cce5ac..4975b22 100755 --- a/nucleus/language/japanese-utf8.php +++ b/nucleus/language/japanese-utf8.php @@ -1251,7 +1251,7 @@ define('_CREATED_NEW_CATEGORY_NAME', '新しいカテゴリ'); define('_CREATED_NEW_CATEGORY_DESC', '新しいカテゴリの説明'); // HTML outputs -define('_HTML_XML_NAME_SPACE_AND_COUNTRY_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja-JP" lang="ja-JP"'); +define('_HTML_XML_NAME_SPACE_AND_LANG_CODE', 'xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"'); // Language Files define('_LANGUAGEFILES_JAPANESE-UTF8', '日本語 - 日本語 (UTF-8)'); diff --git a/nucleus/media.php b/nucleus/media.php index ce79af5..271a816 100755 --- a/nucleus/media.php +++ b/nucleus/media.php @@ -21,7 +21,7 @@ * * @license http://nucleuscms.org/license.txt GNU General Public License * @copyright Copyright (C) 2002-2009 The Nucleus Group - * @version $Id: media.php,v 1.9 2008-02-08 09:31:22 kimitake Exp $ + * @version $Id$ * $NucleusJP: media.php,v 1.8.2.1 2007/09/07 07:36:44 kimitake Exp $ * */ @@ -381,7 +381,7 @@ function media_doError($msg) { function media_head() { ?> - + > Nucleus Media -- 2.11.0