Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 635bdd2a3a1b2f6ccff1958eb1fed8109c884340 (tree) |
---|---|
Time | 2006-10-05 22:22:12 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
bug fix
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@420 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -27,12 +27,12 @@ | ||
27 | 27 | * |
28 | 28 | ****************************************************************************/ |
29 | 29 | |
30 | -class NP_ShowBlogsEX extends NucleusPlugin | |
30 | +class NP_ShowBlogs extends NucleusPlugin | |
31 | 31 | { |
32 | 32 | |
33 | 33 | function getName() |
34 | 34 | { |
35 | - return 'Show BlogsEX'; | |
35 | + return 'Show Blogs'; | |
36 | 36 | } |
37 | 37 | |
38 | 38 | function getMinNucleusVersion() |
@@ -222,7 +222,7 @@ $monthlimit = 0; | ||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - $hidden = ''; | |
225 | +// $hidden = ''; | |
226 | 226 | $temp = $y = $m = $d = ''; |
227 | 227 | if ($archive) { |
228 | 228 | sscanf($archive, '%d-%d-%d', $y, $m, $d); |
@@ -288,20 +288,21 @@ $monthlimit = 0; | ||
288 | 288 | $sh_query .= ' AND b.bnumber = c.cblog'; |
289 | 289 | } |
290 | 290 | |
291 | - if ($page_switch['startpos'] == 0 && !$catid && $sticky != '' && $skinType != 'item') { | |
291 | + if ($page_switch['startpos'] == 0 && !$catid && $sticky != '' && $skinType != 'item' && !$this->tagSelected) { | |
292 | 292 | $ads = 1; |
293 | + $sticky_query = $sh_query; | |
293 | 294 | foreach ($stickys as $stickynumber) { |
294 | 295 | $tempblogid = getBlogIDFromItemID($stickynumber); |
295 | 296 | if ($bmode != 'all') { |
296 | - $sh_query .= ' AND i.iblog = ' . $nowbid; | |
297 | + $sticky_query .= ' AND i.iblog = ' . $nowbid; | |
297 | 298 | } |
298 | - $sh_query .= ' AND i.inumber = ' . intval($stickynumber); | |
299 | - $sh_query .= ' AND i.itime <= ' . mysqldate($b->getCorrectTime()); | |
300 | - $sh_query .= ' AND i.idraft = 0'; | |
299 | + $sticky_query .= ' AND i.inumber = ' . intval($stickynumber); | |
300 | + $sticky_query .= ' AND i.itime <= ' . mysqldate($b->getCorrectTime()); | |
301 | + $sticky_query .= ' AND i.idraft = 0'; | |
301 | 302 | if ($this->getOption('stickmode') == 1 && intval($nowbid) == $tempblogid) { |
302 | - $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0); | |
303 | + $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0); | |
303 | 304 | } elseif (!$this->getOption('stickmode')) { |
304 | - $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0); | |
305 | + $b->showUsingQuery($sticktemplate, $sticky_query, 0, 1, 0); | |
305 | 306 | } |
306 | 307 | if ($ads == 1) { |
307 | 308 | echo $this->getOption('ads'); |
@@ -362,7 +363,7 @@ $monthlimit = 0; | ||
362 | 363 | |
363 | 364 | function event_InitSkinParse($data) |
364 | 365 | { |
365 | - global $CONF; | |
366 | + global $CONF, $manager; | |
366 | 367 | $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); |
367 | 368 | if (serverVar('REQUEST_URI') == '') { |
368 | 369 | $uri = (serverVar('QUERY_STRING')) ? |
@@ -370,10 +371,14 @@ $monthlimit = 0; | ||
370 | 371 | } else { |
371 | 372 | $uri = serverVar('REQUEST_URI'); |
372 | 373 | } |
373 | - $this->pagestr = ($usePathInfo) ? 'page/' : 'page='; | |
374 | - list($org_uri, $currentpage) = explode($this->pagestr, $uri, 2); | |
375 | - $_GET['page'] = intval($currentpage); | |
376 | - $this->currentpage = intval($currentpage); | |
374 | + $page_str = ($usePathInfo) ? 'page/' : 'page='; | |
375 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
376 | + $page_str = 'page_'; | |
377 | + } | |
378 | + list($org_uri, $currPage) = explode($page_str, $uri, 2); | |
379 | + $_GET['page'] = intval($currPage); | |
380 | + $this->currPage = intval($currPage); | |
381 | + $this->pagestr = $page_str; | |
377 | 382 | } |
378 | 383 | |
379 | 384 | function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '') |
@@ -398,7 +403,7 @@ $monthlimit = 0; | ||
398 | 403 | } |
399 | 404 | |
400 | 405 | $page_str = $this->pagestr; |
401 | - $currentpage = $this->currentpage; | |
406 | + $currentpage = $this->currPage; | |
402 | 407 | |
403 | 408 | // createBaseURL |
404 | 409 | if (!empty($catid)) { |
@@ -429,9 +434,25 @@ $monthlimit = 0; | ||
429 | 434 | $tplugin =& $manager->getPlugin('NP_TagEX'); |
430 | 435 | $requestTag = $tplugin->getNoDecodeQuery('tag'); |
431 | 436 | if (!empty($requestTag)) { |
432 | - $pagelink = $tplugin->creatTagLink($requestTag, $this->getOption('tagMode')); | |
437 | + $requestTarray = $tplugin->splitRequestTags($requestTag); | |
438 | + $tag = array_shift($requestTarray['and']); | |
439 | + $tag = $tplugin->_rawdecode($tag); | |
440 | + if (!empty($requestTarray['and'])) { | |
441 | + $requestT = implode('+', $requestTarray['and']); | |
442 | + } | |
443 | + if (!empty($requestTarray['or'])) { | |
444 | + $requestTor = implode(':', $requestTarray['or']); | |
445 | + } | |
446 | + if (!empty($requestT) && !empty($requestTor)) { | |
447 | + $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'), $requestT . ':' . $requestTor, '+'); | |
448 | + } elseif (empty($requestT) && !empty($requestTor)) { | |
449 | + $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode'), $requestTor, ':'); | |
450 | + } else { | |
451 | + $pagelink = $tplugin->creatTagLink($tag, $this->getOption('tagMode')); | |
452 | + } | |
433 | 453 | } |
434 | 454 | } |
455 | + | |
435 | 456 | $uri = parse_url($pagelink); |
436 | 457 | if (!$usePathInfo) { |
437 | 458 | if ($pagelink == $CONF['BlogURL']) { // add |
@@ -492,16 +513,22 @@ $monthlimit = 0; | ||
492 | 513 | $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0; |
493 | 514 | $nextpage = $currentpage + 1; |
494 | 515 | $firstpagelink = $pagelink . $page_str . '1'; |
495 | -// $firstpagelink .= '.html'; | |
516 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
517 | + $firstpagelink .= '.html'; | |
518 | + } | |
496 | 519 | $lastpagelink = $pagelink . $page_str . $totalpages; |
497 | -// $lastpagelink .= '.html'; | |
520 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
521 | + $lastpagelink .= '.html'; | |
522 | + } | |
498 | 523 | |
499 | 524 | if ($type >= 1) { |
500 | 525 | $buf .= '<div class="pageswitch">' . "\n"; |
501 | 526 | // $buf .= "<a rel=\"first\" title=\"first page\" href=\"{$firstpagelink}\"><TOP></a> | \n"; |
502 | 527 | if (!empty($prevpage)) { |
503 | 528 | $prevpagelink = $pagelink . $page_str . $prevpage; |
504 | -// $prevpagelink .= '.html'; | |
529 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
530 | + $prevpagelink .= '.html'; | |
531 | + } | |
505 | 532 | $buf .= "\n<a href=\"{$prevpagelink}\" title=\"Previous page\" rel=\"Prev\">«Prev</a> |"; |
506 | 533 | } elseif ($type >= 2) { |
507 | 534 | $buf .= "\n«Prev |"; |
@@ -511,9 +538,11 @@ $monthlimit = 0; | ||
511 | 538 | $buf .= "|"; |
512 | 539 | for ($i=1; $i<=$totalpages; $i++) { |
513 | 540 | $i_pagelink = $pagelink . $page_str . $i; |
514 | -// $i_pagelink .= '.html'; | |
541 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
542 | + $i_pagelink .= '.html'; | |
543 | + } | |
515 | 544 | if ($i == $currentpage) { |
516 | - $buf .= " <strong>{$currentpage}</strong> |\n"; | |
545 | + $buf .= " <strong>{$i}</strong> |\n"; | |
517 | 546 | } elseif ($totalpages<10 || $i<4 || $i>$totalpages-3) { |
518 | 547 | $buf .= " <a href=\"{$i_pagelink}\" title=\"Page No.{$i}\">{$i}</a> |\n"; |
519 | 548 | } else { |
@@ -534,10 +563,12 @@ $monthlimit = 0; | ||
534 | 563 | $sepstr = '·'; |
535 | 564 | for ($i=1; $i<=$totalpages; $i++) { |
536 | 565 | $i_pagelink = $pagelink . $page_str . $i; |
537 | -// $i_pagelink .= '.html'; | |
566 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
567 | + $i_pagelink .= '.html'; | |
568 | + } | |
538 | 569 | $paging = 5; |
539 | 570 | if ($i == $currentpage) { |
540 | - $buf .= " <strong>{$currentpage}</strong> {$sepstr}\n"; | |
571 | + $buf .= " <strong>{$i}</strong> {$sepstr}\n"; | |
541 | 572 | } elseif ($totalpages < 10 || (($i < ($currentpage + $paging)) && (($currentpage - $paging) < $i))) { |
542 | 573 | $buf .= " <a href=\"{$i_pagelink}\" title=\"Page No.{$i}\">{$i}</a> {$sepstr}\n"; |
543 | 574 | } elseif ($currentpage - $paging == $i) { |
@@ -552,7 +583,9 @@ $monthlimit = 0; | ||
552 | 583 | } |
553 | 584 | if ($totalpages >= $nextpage) { |
554 | 585 | $nextpagelink = $pagelink . $page_str . $nextpage; |
555 | -// $nextpagelink .= '.html'; | |
586 | + if ($manager->pluginInstalled('NP_CustomURL')) { | |
587 | + $nextpagelink .= '.html'; | |
588 | + } | |
556 | 589 | $buf .= "| <a href=\"{$nextpagelink}\" title=\"Next page\" rel=\"Next\">Next»</a>\n"; |
557 | 590 | } elseif ($type >= 2) { |
558 | 591 | $buf .= "| Next»\n"; |
@@ -631,6 +664,7 @@ $monthlimit = 0; | ||
631 | 664 | $tplugin =& $manager->getPlugin('NP_TagEX'); |
632 | 665 | $requestTag = $tplugin->getNoDecodeQuery('tag'); |
633 | 666 | if (!empty($requestTag) || $skin_type == 'item') { |
667 | + $this->tagSelected = TRUE; | |
634 | 668 | $allTags = ($bmode=='all') ? $tplugin->scanExistTags(0) : $tplugin->scanExistTags(2); |
635 | 669 | $arr = $tplugin->splitRequestTags($requestTag); |
636 | 670 | if ($skin_type == 'item') { |
@@ -703,7 +703,7 @@ function resetOlder(old){ | ||
703 | 703 | for ($i=0;$i<count($urlq);$i++) { |
704 | 704 | $tempq = explode('=', $urlq[$i]); |
705 | 705 | if ($tempq[0] == $q) { |
706 | - $str = preg_replace('|[^a-z0-9-~+_.#;,:@%]|i', '', rawurlencode($tempq[1])); | |
706 | + $str = preg_replace('|[^a-z0-9-~+_.#;,:@%]|i', '', $tempq[1]); | |
707 | 707 | return $str; |
708 | 708 | } |
709 | 709 | } |
@@ -1085,32 +1085,31 @@ tagIndexSeparator | ||
1085 | 1085 | $linkparams['catid'] = intval($catid); |
1086 | 1086 | } |
1087 | 1087 | if ($subcatid) { |
1088 | - $linkparams['subcatid'] = intval($subcatid); | |
1088 | + $subrequest = $mplugin->getRequestName(array()); | |
1089 | + $linkparams[$subrequest] = intval($subcatid); | |
1089 | 1090 | } |
1090 | 1091 | } |
1091 | 1092 | |
1092 | 1093 | // <mod by shizuki> |
1093 | 1094 | if (!empty($ready)) { |
1094 | - $ready = preg_replace('|[^a-z0-9-~+_.?#=&;,/:@%]|i', '', $ready); | |
1095 | - $reqReadyAND = explode('+', $ready); | |
1096 | - foreach ($reqReadyAND as $ANDkey => $ANDval) { | |
1097 | - if (strpos(':', $ANDval)) { | |
1098 | - $reqReadyOR = explode(':', $ANDval); | |
1099 | - foreach ($reqReadyOR as $ORkey => $ORval) { | |
1100 | - if (!$this->_isValidTag($ORval)) { | |
1101 | - $trush = array_splice($reqReadyOR, $ORkey, 1); | |
1102 | - } | |
1103 | - } | |
1104 | - $ANDval = implode(':', $reqReadyOR); | |
1105 | - } else { | |
1106 | - if (!$this->_isValidTag($ANDval)) { | |
1107 | - $trush = array_splice($reqReadyAND, $ANDkey, 1); | |
1095 | + $requestTagArray = $this->splitRequestTags($ready); | |
1096 | + foreach ($requestTagArray['and'] as $key => $val) { | |
1097 | + if (!$this->_isValidTag($val)) { | |
1098 | + $trush = array_splice($requestTagArray['and'], $key, 1); | |
1099 | + } | |
1100 | + } | |
1101 | + $reqAnd = implode('+', $requestTagArray['and']); | |
1102 | + if (!empty($requestTagArray['or'])) { | |
1103 | + foreach ($requestTagArray['or'] as $key => $val) { | |
1104 | + if (!$this->_isValidTag($val)) { | |
1105 | + $trush = array_splice($requestTagArray['and'], $key, 1); | |
1108 | 1106 | } |
1109 | 1107 | } |
1108 | + $reqOr = ':' . implode(':', $requestTagArray['or']); | |
1110 | 1109 | } |
1111 | - $ready = implode('+', $reqReadyAND); | |
1110 | + $ready = $reqAnd . $reqOr; | |
1112 | 1111 | } |
1113 | -// </mod by shizuki> | |
1112 | +// </mod by shizuki>*/ | |
1114 | 1113 | |
1115 | 1114 | if (!$ready) $sep = ''; |
1116 | 1115 | if ($CONF['URLMode'] == 'pathinfo') |
@@ -1118,7 +1117,7 @@ tagIndexSeparator | ||
1118 | 1117 | else |
1119 | 1118 | $link = $CONF['BlogURL'] . '?tag=' . $ready . $sep . $this->_rawencode($tag); |
1120 | 1119 | |
1121 | -/* <add for NP_CustomURL mod by shizuki> | |
1120 | +// <add for NP_CustomURL mod by shizuki> | |
1122 | 1121 | if ($manager->pluginInstalled('NP_CustomURL')) { |
1123 | 1122 | $urlplugin = $manager->getPlugin('NP_CustomURL'); |
1124 | 1123 | $link = 'tag/' . $ready . $sep . $this->_rawencode($tag); |