OSDN Git Service

Update history.html
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / bookmarklet.php
index ba30150..ad38d2f 100755 (executable)
@@ -1,7 +1,7 @@
 <?php
 /*
  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
- * Copyright (C) 2002-2009 The Nucleus Group
+ * 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
@@ -14,7 +14,7 @@
  * in order to use this.
  *
  * @license http://nucleuscms.org/license.txt GNU General Public License
- * @copyright Copyright (C) 2002-2009 The Nucleus Group
+ * @copyright Copyright (C) 2002-2010 The Nucleus Group
  * @version $Id$
  * $NucleusJP: bookmarklet.php,v 1.9.2.1 2007/09/07 07:16:39 kimitake Exp $
  */
@@ -68,22 +68,22 @@ switch ($action) {
                bm_doAddItem();
                break;
 
-       // shows the edit item form
+               // shows the edit item form
        case 'edit':
                bm_doEditForm();
                break;
 
-       // edits the item for real
+               // edits the item for real
        case 'edititem':
                bm_doEditItem();
                break;
 
-       // on login, 'action' gets changed to 'nextaction'
+               // on login, 'action' gets changed to 'nextaction'
        case 'login':
                bm_doError(_BOOKMARKLET_ERROR_SOMETHINGWRONG);
                break;
 
-       // shows the fill in form
+               // shows the fill in form
        case 'add':
        default:
                bm_doShowForm();
@@ -110,10 +110,6 @@ function bm_doAddItem() {
                $aTag      = ' <a href="' . $href . '" onclick="' . $onclick . '" title="' . $title . '">';
                $message   = _BOOKMARKLET_NEW_CATEGORY . $aTag . _BOOKMARKLET_NEW_CATEGORY_EDIT . '</a>';
                $extrahead = '';
-       } elseif ( (postVar('actiontype') == 'addnow') && $blog->sendPing() ) {
-               $message = _BOOKMARKLET_SEND_PING;
-               $pingUrl = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=sendping&blogid=' . intval($blogid) );
-               $extrahead = '<meta http-equiv="refresh" content="1; url=' . htmlspecialchars($pingUrl) . '" />';
        } else {
                $message = _ITEM_ADDED;
                $extrahead = '';
@@ -211,16 +207,16 @@ function bm_loginAndPassThrough() {
 
        ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-       <html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
-       <head>
-               <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
-               <title>Nucleus</title>
-               <?php bm_style(); ?>
-       </head>
-       <body>
-       <h1><?php echo _LOGIN_PLEASE ?></h1>
-
-       <form method="post" action="bookmarklet.php">
+<html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
+<title>Nucleus</title>
+       <?php bm_style(); ?>
+</head>
+<body>
+<h1><?php echo _LOGIN_PLEASE ?></h1>
+
+<form method="post" action="bookmarklet.php">
        <p>
                <input name="action" value="login" type="hidden" />
                <input name="blogid" value="<?php echo htmlspecialchars($blogid); ?>" type="hidden" />
@@ -234,10 +230,10 @@ function bm_loginAndPassThrough() {
                <br /><br />
                <br /><input type="submit" value="<?php echo _LOGIN ?>" />
        </p>
-       </form>
-       <p><a href="bookmarklet.php" onclick="window.close();"><?php echo _POPUP_CLOSE ?></a></p>
-       </body>
-       </html>
+</form>
+<p><a href="bookmarklet.php" onclick="window.close();"><?php echo _POPUP_CLOSE ?></a></p>
+</body>
+</html>
        <?php
 }
 
@@ -251,7 +247,7 @@ function bm_doShowForm() {
 
        $log_text = uniDecode($log_text,_CHARSET);
        $log_linktitle = uniDecode($log_linktitle,_CHARSET);
-       
+
        if (!BLOG::existsID($blogid) ) {
                bm_doError(_ERROR_NOSUCHBLOG);
        }
@@ -316,19 +312,19 @@ function bm_doError($msg) {
 function bm_message($title, $head, $msg, $extrahead = '') {
        ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-       <html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
-       <head>
-               <meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
-               <title><?php echo $title ?></title>
-               <?php bm_style(); ?>
-               <?php echo $extrahead; ?>
-       </head>
-       <body>
-       <h1><?php echo $head; ?></h1>
-       <p><?php echo $msg; ?></p>
-       <p><a href="bookmarklet.php" onclick="window.close();window.opener.location.reload();"><?php echo _POPUP_CLOSE ?></a></p>
-       </body>
-       </html>
+<html <?php echo _HTML_XML_NAME_SPACE_AND_LANG_CODE; ?>>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=<?php echo _CHARSET ?>" />
+<title><?php echo $title ?></title>
+       <?php bm_style(); ?>
+       <?php echo $extrahead; ?>
+</head>
+<body>
+<h1><?php echo $head; ?></h1>
+<p><?php echo $msg; ?></p>
+<p><a href="bookmarklet.php" onclick="window.close();window.opener.location.reload();"><?php echo _POPUP_CLOSE ?></a></p>
+</body>
+</html>
 
        <?php
 }
@@ -346,31 +342,31 @@ doc = external.menuArguments.document;
 lt = escape(doc.selection.createRange().text);
 loglink = escape(external.menuArguments.location.href);
 loglinktitle = escape(doc.title);
-wingm = window.open('<?php echo $CONF['AdminURL']?>bookmarklet.php?blogid=<?php echo intGetVar('blogid')?>&logtext=' + lt + '&loglink=' + loglink + '&loglinktitle=' + loglinktitle, 'nucleusbm', 'scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes');
+wingm = window.open('<?php echo $CONF['AdminURL']?>bookmarklet.php?blogid=<?php echo intGetVar('blogid')?>&logtext=' + lt + '&loglink=' + loglink + '&loglinktitle=' + loglinktitle, 'nucleusbm', 'scrollbars=yes,width=710,height=500,left=10,top=10,status=yes,resizable=yes');
 wingm.focus();
 </script>
        <?php
 }
 
 function uniDecode($str,$charcode){
-  $text = preg_replace_callback("/%u[0-9A-Za-z]{4}/", 'toUtf8', $str);
-  return mb_convert_encoding($text, $charcode, 'UTF-8');
+       $text = preg_replace_callback("/%u[0-9A-Za-z]{4}/", 'toUtf8', $str);
+       return mb_convert_encoding($text, $charcode, 'UTF-8');
 }
 function toUtf8($ar){
-  foreach($ar as $val){
-    $val = intval(substr($val,2),16);
-    if($val < 0x7F){        // 0000-007F
-        $c .= chr($val);
-    }elseif($val < 0x800) { // 0080-0800
-        $c .= chr(0xC0 | ($val / 64));
-        $c .= chr(0x80 | ($val % 64));
-    }else{                // 0800-FFFF
-        $c .= chr(0xE0 | (($val / 64) / 64));
-        $c .= chr(0x80 | (($val / 64) % 64));
-        $c .= chr(0x80 | ($val % 64));
-    }
-  }
-  return $c;
+       foreach($ar as $val){
+               $val = intval(substr($val,2),16);
+               if($val < 0x7F){        // 0000-007F
+                       $c .= chr($val);
+               }elseif($val < 0x800) { // 0080-0800
+                       $c .= chr(0xC0 | ($val / 64));
+                       $c .= chr(0x80 | ($val % 64));
+               }else{                // 0800-FFFF
+                       $c .= chr(0xE0 | (($val / 64) / 64));
+                       $c .= chr(0x80 | (($val / 64) % 64));
+                       $c .= chr(0x80 | ($val % 64));
+               }
+       }
+       return $c;
 }
 
 ?>
\ No newline at end of file