OSDN Git Service

encode_desc is modified to apply JP hack
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 31 Aug 2006 21:00:21 +0000 (21:00 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Thu, 31 Aug 2006 21:00:21 +0000 (21:00 +0000)
$archivelist and $blogid should be checked with is_numeric instead of intVal

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@163 1ca29b6e-896d-4ea0-84a5-967f57386b96

utf8/nucleus/libs/globalfunctions.php

index 4862274..abdaa3b 100755 (executable)
@@ -13,8 +13,8 @@
 /**
  * @license http://nucleuscms.org/license.txt GNU General Public License
  * @copyright Copyright (C) 2002-2006 The Nucleus Group
- * @version $Id: globalfunctions.php,v 1.8 2006-07-18 08:42:04 kimitake Exp $
- * $NucleusJP: globalfunctions.php,v 1.7 2006/07/17 20:03:44 kimitake Exp $
+* @version $Id: globalfunctions.php,v 1.9 2006-08-31 21:00:21 kimitake Exp $
+ * $NucleusJP: globalfunctions.php,v 1.8 2006/07/18 08:42:04 kimitake Exp $
  */
 
 // needed if we include globalfunctions from install.php
@@ -786,8 +786,8 @@ function selector() {
        } elseif ($archivelist) {
                $type = 'archivelist';
 
-               if (intval($archivelist) != 0) {
-                       $blogid = $archivelist;
+               if (is_numeric($archivelist)) {
+                       $blogid = intVal($archivelist);
                } else {
                        $blogid = getBlogIDFromName($archivelist);
                }
@@ -805,7 +805,9 @@ function selector() {
                }
                $order = (_CHARSET == 'EUC-JP') ? 'EUC-JP, UTF-8,' : 'UTF-8, EUC-JP,';
                $query = mb_convert_encoding($query, _CHARSET, $order.' JIS, SJIS, ASCII');
-               if (intval($blogid) == 0) {
+               if (is_numeric($blogid)) {
+                       $blogid = intVal($blogid);
+               } else {
                        $blogid = getBlogIDFromName($blogid);
                }
 
@@ -1502,14 +1504,17 @@ function _links_list() {
 /**
  * @todo document this
  */
-function encode_desc($data)
-       {   $to_entities = get_html_translation_table(HTML_ENTITIES);
-               $from_entities = array_flip($to_entities);
-               $data = strtr($data,$from_entities);
-               $data = strtr($data,$to_entities);
-               return $data;
-       }
-
+function encode_desc(&$data)
+    {   //_$to_entities = get_html_translation_table(HTML_ENTITIES);
+        $to_entities = get_html_translation_table(HTML_SPECIALCHARS);
+        $from_entities = array_flip($to_entities);
+        $data = str_replace('<br />','\n',$data); //hack
+        $data = strtr($data,$from_entities);
+        $data = strtr($data,$to_entities);
+        $data = str_replace('\n','<br />',$data); //hack
+        return $data;
+    }
 /**
  * Returns the Javascript code for a bookmarklet that works on most modern browsers
  *