OSDN Git Service

modified for multi-blog
authorkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sat, 19 Mar 2005 09:06:10 +0000 (09:06 +0000)
committerkimitake <kimitake@1ca29b6e-896d-4ea0-84a5-967f57386b96>
Sat, 19 Mar 2005 09:06:10 +0000 (09:06 +0000)
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@69 1ca29b6e-896d-4ea0-84a5-967f57386b96

euc/nucleus/libs/globalfunctions.php
utf8/nucleus/libs/globalfunctions.php

index e635ba7..9017c12 100755 (executable)
@@ -10,8 +10,8 @@
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
   *\r
-  * $Id: globalfunctions.php,v 1.5 2005-03-16 08:10:35 kimitake Exp $\r
-  * $NucleusJP: globalfunctions.php,v 1.4 2005/03/15 07:59:27 kimitake Exp $\r
+  * $Id: globalfunctions.php,v 1.6 2005-03-19 09:06:10 kimitake Exp $\r
+  * $NucleusJP: globalfunctions.php,v 1.5 2005/03/16 08:10:35 kimitake Exp $\r
   */\r
 \r
 // needed if we include globalfunctions from install.php\r
@@ -558,9 +558,28 @@ function selector() {
                $obj = mysql_fetch_object($res);\r
 \r
                // if a different blog id has been set through the request or selectBlog(),\r
-               // deny access\r
-               if ($blogid && (intval($blogid) != $obj->iblog))\r
-                       doError(_ERROR_NOSUCHITEM);\r
+               // jump to correct url\r
+//             if ($blogid && (intval($blogid) != $obj->iblog))\r
+//                     doError(_ERROR_NOSUCHITEM);\r
+               if ($blogid && (intval($blogid) != $obj->iblog)) {\r
+                  if (!headers_sent()) {\r
+                         $b =& $manager->getBlog($obj->iblog);\r
+                         $correctURL = $b->getURL();\r
+\r
+                         if ($CONF['URLMode'] == 'pathinfo') {\r
+                                if (substr($correctURL,strlen($correctURL)-1,1)=='/')\r
+                                       $correctURL .= 'item/' . $itemid;\r
+                                else\r
+                                       $correctURL .= '/item/' . $itemid;\r
+                         }\r
+                         else\r
+                                $correctURL .= '?itemid=' . $itemid;\r
+\r
+                         redirect('Location: ' . $correctURL);\r
+                         exit;\r
+                  }\r
+                  else doError(_ERROR_NOSUCHITEM);\r
+               }\r
 \r
                $blogid = $obj->iblog;\r
                $timestamp = strtotime($obj->itime);\r
index 0434808..3a8a522 100755 (executable)
@@ -10,8 +10,8 @@
   * of the License, or (at your option) any later version.\r
   * (see nucleus/documentation/index.html#license for more info)\r
   *\r
-  * $Id: globalfunctions.php,v 1.4 2005-03-15 07:59:27 kimitake Exp $\r
-  * $NucleusJP$\r
+  * $Id: globalfunctions.php,v 1.5 2005-03-19 09:05:40 kimitake Exp $\r
+  * $NucleusJP: globalfunctions.php,v 1.4 2005/03/15 07:59:27 kimitake Exp $\r
   */\r
 \r
 // needed if we include globalfunctions from install.php\r
@@ -558,9 +558,28 @@ function selector() {
                $obj = mysql_fetch_object($res);\r
 \r
                // if a different blog id has been set through the request or selectBlog(),\r
-               // deny access\r
-               if ($blogid && (intval($blogid) != $obj->iblog))\r
-                       doError(_ERROR_NOSUCHITEM);\r
+               // jump to correct url\r
+//             if ($blogid && (intval($blogid) != $obj->iblog))\r
+//                     doError(_ERROR_NOSUCHITEM);\r
+               if ($blogid && (intval($blogid) != $obj->iblog)) {\r
+                  if (!headers_sent()) {\r
+                         $b =& $manager->getBlog($obj->iblog);\r
+                         $correctURL = $b->getURL();\r
+\r
+                         if ($CONF['URLMode'] == 'pathinfo') {\r
+                                if (substr($correctURL,strlen($correctURL)-1,1)=='/')\r
+                                       $correctURL .= 'item/' . $itemid;\r
+                                else\r
+                                       $correctURL .= '/item/' . $itemid;\r
+                         }\r
+                         else\r
+                                $correctURL .= '?itemid=' . $itemid;\r
+\r
+                         redirect('Location: ' . $correctURL);\r
+                         exit;\r
+                  }\r
+                  else doError(_ERROR_NOSUCHITEM);\r
+               }\r
 \r
                $blogid = $obj->iblog;\r
                $timestamp = strtotime($obj->itime);\r