Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの
Revision | 0916b6738c2d338692102e98dc90a20cec0ed29a (tree) |
---|---|
Time | 2006-11-28 02:21:51 |
Author | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
バージョン番号変え忘れ
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@498 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -10,11 +10,11 @@ | ||
10 | 10 | * of the License, or (at your option) any later version. |
11 | 11 | * (see nucleus/documentation/index.html#license for more info) |
12 | 12 | * |
13 | - * @author Original Author nakahara21 | |
14 | - * @copyright 2005-2006 nakahara21 | |
15 | - * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 | |
16 | - * @version 2.62 | |
17 | - * @link http://nakahara21.com | |
13 | + * @author Original Author nakahara21 | |
14 | + * @copyright 2005-2006 nakahara21 | |
15 | + * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991 | |
16 | + * @version 2.65 | |
17 | + * @link http://nakahara21.com | |
18 | 18 | * |
19 | 19 | * 2.65 add AD code control |
20 | 20 | * add Category mode |
@@ -22,7 +22,7 @@ | ||
22 | 22 | * 2.64 fix page switch URL generate |
23 | 23 | * 2.62 security fix and tag related |
24 | 24 | * 2.61 security fix |
25 | - * 2.6 security fix | |
25 | + * 2.6 security fix | |
26 | 26 | * |
27 | 27 | **************************************************************************** |
28 | 28 | * |
@@ -153,14 +153,14 @@ class NP_ShowBlogs extends NucleusPlugin | ||
153 | 153 | //show blogID |
154 | 154 | $show = array(); |
155 | 155 | // limit number of pages(months) |
156 | -$pagelimit = 0; | |
157 | -$monthlimit = 0; | |
156 | + $pagelimit = 0; | |
157 | + $monthlimit = 0; | |
158 | 158 | $catformat = $this->getOption('catformat'); |
159 | 159 | |
160 | 160 | /**************************************************************************************/ |
161 | 161 | |
162 | - $type = (float) $type; | |
163 | - $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9 | |
162 | + $type = (float) $type; | |
163 | + $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9 | |
164 | 164 | $this->showAdCode = $showAdCode; |
165 | 165 | |
166 | 166 | list ($pageamount, $offset) = sscanf($amount, '%d(%d)'); |
@@ -169,8 +169,8 @@ $monthlimit = 0; | ||
169 | 169 | } |
170 | 170 | if ($sort != 'ASC' && $sort != 'DESC') { |
171 | 171 | $sticktemplate = $sticky; |
172 | - $sticky = $sort; | |
173 | - $sort = 'DESC'; | |
172 | + $sticky = $sort; | |
173 | + $sort = 'DESC'; | |
174 | 174 | } |
175 | 175 | if (!empty($sticky) && empty($sticktemplate)) { |
176 | 176 | $sticktemplate = $template; |
@@ -205,7 +205,7 @@ $monthlimit = 0; | ||
205 | 205 | } |
206 | 206 | $this->nowbid = $nowbid = intval($b->getID()); |
207 | 207 | |
208 | - $where = ''; | |
208 | + $where = ''; | |
209 | 209 | $catblogname = 0; |
210 | 210 | |
211 | 211 | if ($bmode != 'all') { |
@@ -262,7 +262,7 @@ $monthlimit = 0; | ||
262 | 262 | '/<%catdesc%>/' |
263 | 263 | ); |
264 | 264 | $catformat = preg_replace($fArr, $nArr, $catformat); |
265 | - $mtable = ""; | |
265 | + $mtable = ""; | |
266 | 266 | if ($manager->pluginInstalled('NP_TagEX')) { |
267 | 267 | $t_where = $this->_getTagsInum($where, $skinType, $bmode, $amount); |
268 | 268 | $where .= $t_where['where']; |
@@ -286,18 +286,18 @@ $monthlimit = 0; | ||
286 | 286 | if ($archive) { |
287 | 287 | sscanf($archive, '%d-%d-%d', $y, $m, $d); |
288 | 288 | if ($d) { |
289 | - $timestamp_start = mktime(0, 0, 0, $m, $d, $y); | |
290 | - $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y); | |
291 | - $date_str = 'SUBSTRING(i.itime, 1, 10)'; | |
289 | + $timestamp_start = mktime(0, 0, 0, $m, $d, $y); | |
290 | + $timestamp_end = mktime(0, 0, 0, $m, $d+1, $y); | |
291 | + $date_str = 'SUBSTRING(i.itime, 1, 10)'; | |
292 | 292 | } else { |
293 | - $timestamp_start = mktime(0, 0, 0, $m, 1, $y); | |
294 | - $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y); | |
295 | - $date_str = 'SUBSTRING(i.itime,1,7)'; | |
293 | + $timestamp_start = mktime(0, 0, 0, $m, 1, $y); | |
294 | + $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y); | |
295 | + $date_str = 'SUBSTRING(i.itime,1,7)'; | |
296 | 296 | } |
297 | - $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) . | |
298 | - ' AND i.itime < ' . mysqldate($timestamp_end); | |
297 | + $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) | |
298 | + . ' AND i.itime < ' . mysqldate($timestamp_end); | |
299 | 299 | } elseif (!empty($monthlimit)) { |
300 | - $timestamp_end = mysqldate($b->getCorrectTime()); | |
300 | + $timestamp_end = mysqldate($b->getCorrectTime()); | |
301 | 301 | sscanf($timestamp_end, '"%d-%d-%d %s"', $y, $m, $d, $temp); |
302 | 302 | $timestamp_start = mktime(0, 0, 0, $m-$monthlimit, $d, $y); |
303 | 303 | $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) |
@@ -309,10 +309,10 @@ $monthlimit = 0; | ||
309 | 309 | if (!empty($catid)) { |
310 | 310 | if ($manager->pluginInstalled('NP_MultipleCategories')) { |
311 | 311 | $mcat_query = $this->_getSubcategoriesWhere($catid); |
312 | - $mtable = $mcat_query['m']; | |
313 | - $where .= $mcat_query['w']; | |
312 | + $mtable = $mcat_query['m']; | |
313 | + $where .= $mcat_query['w']; | |
314 | 314 | } else { |
315 | - $where .= ' AND i.icat=' . intval($catid); | |
315 | + $where .= ' AND i.icat=' . intval($catid); | |
316 | 316 | } |
317 | 317 | $linkparams['catid'] = $todayparams['catid'] = intval($catid); |
318 | 318 | } |
@@ -325,42 +325,50 @@ $monthlimit = 0; | ||
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
328 | - $sh_query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body,' . | |
329 | - ' m.mname as author, m.mrealname as authorname,' . | |
330 | - ' UNIX_TIMESTAMP(i.itime) as timestamp, i.itime,' . | |
331 | - ' i.imore as more, m.mnumber as authorid,'; | |
328 | + $sh_query = 'SELECT ' | |
329 | + . 'i.inumber as itemid, ' | |
330 | + . 'i.ititle as title, ' | |
331 | + . 'i.ibody as body, ' | |
332 | + . 'm.mname as author, ' | |
333 | + . 'm.mrealname as authorname, ' | |
334 | + . 'UNIX_TIMESTAMP(i.itime) as timestamp, ' | |
335 | + . 'i.itime, ' | |
336 | + . 'i.imore as more, ' | |
337 | + . 'm.mnumber as authorid,'; | |
332 | 338 | if (!$catblogname) { |
333 | 339 | $sh_query .= ' c.cname as category,'; |
334 | 340 | } else { |
335 | 341 | $sh_query .= ' concat(' . $catformat . ') as category,'; |
336 | 342 | } |
337 | - $sh_query .= ' i.icat as catid, i.iclosed as closed' | |
343 | + $sh_query .= ' i.icat as catid,' | |
344 | + . ' i.iclosed as closed' | |
338 | 345 | . ' FROM ' |
339 | - . sql_table('member') . ' as m, ' | |
346 | + . sql_table('member') . ' as m, ' | |
340 | 347 | . sql_table('category') . ' as c, ' |
341 | - . sql_table('item') . ' as i' | |
348 | + . sql_table('item') . ' as i' | |
342 | 349 | . $mtable; |
343 | 350 | if ($bmode == 'all') { |
344 | 351 | $sh_query .= ', ' . sql_table('blog') . ' as b '; |
345 | 352 | } |
346 | - $sh_query .= ' WHERE i.iauthor = m.mnumber AND i.icat = c.catid'; | |
353 | + $sh_query .= ' WHERE i.iauthor = m.mnumber' | |
354 | + . ' AND i.icat = c.catid'; | |
347 | 355 | if ($bmode == 'all') { |
348 | 356 | $sh_query .= ' AND b.bnumber = c.cblog'; |
349 | 357 | } |
350 | 358 | |
351 | 359 | // if ($page_switch['startpos'] == 0 && !$catid && $sticky != '' && $skinType != 'item' && !$this->tagSelected) { |
352 | - $ads = 0; | |
360 | + $ads = 0; | |
353 | 361 | $sticCatFlag = ($page_switch['startpos'] == 0 && (!$catid || (!empty($catStick) && $sticktemplate != ''))); |
354 | 362 | if ($sticCatFlag && $sticky != '' && $skinType != 'item' && !$this->tagSelected) { |
355 | 363 | foreach ($stickys as $stickynumber) { |
356 | 364 | $sticky_query = $sh_query; |
357 | - $tempblogid = getBlogIDFromItemID($stickynumber); | |
365 | + $tempblogid = getBlogIDFromItemID($stickynumber); | |
358 | 366 | if ($bmode != 'all') { |
359 | 367 | $sticky_query .= ' AND i.iblog = ' . $nowbid; |
360 | 368 | } |
361 | 369 | $sticky_query .= ' AND i.inumber = ' . intval($stickynumber) |
362 | - . ' AND i.itime <= ' . mysqldate($b->getCorrectTime()) | |
363 | - . ' AND i.idraft = 0'; | |
370 | + . ' AND i.itime <= ' . mysqldate($b->getCorrectTime()) | |
371 | + . ' AND i.idraft = 0'; | |
364 | 372 | if ($catid) { |
365 | 373 | $sticky_query .= ' AND i.icat = ' . intval($catid); |
366 | 374 | } |
@@ -450,9 +458,9 @@ $monthlimit = 0; | ||
450 | 458 | if (getVar('page')) { |
451 | 459 | $currPage = intGetVar('page'); |
452 | 460 | } |
453 | - $_GET['page'] = intval($currPage); | |
461 | + $_GET['page'] = intval($currPage); | |
454 | 462 | $this->currPage = intval($currPage); |
455 | - $this->pagestr = $page_str; | |
463 | + $this->pagestr = $page_str; | |
456 | 464 | } |
457 | 465 | |
458 | 466 | function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '') |
@@ -460,12 +468,12 @@ $monthlimit = 0; | ||
460 | 468 | global $CONF, $manager, $archive, $catid, $subcatid; |
461 | 469 | |
462 | 470 | // initialize |
463 | - $startpos = 0; | |
464 | - $catid = intval($catid); | |
465 | - $subcatid = intval($subcatid); | |
471 | + $startpos = 0; | |
472 | + $catid = intval($catid); | |
473 | + $subcatid = intval($subcatid); | |
466 | 474 | $usePathInfo = ($CONF['URLMode'] == 'pathinfo'); |
467 | - $pageamount = intval($pageamount); | |
468 | - $offset = intval($offset); | |
475 | + $pageamount = intval($pageamount); | |
476 | + $offset = intval($offset); | |
469 | 477 | if ($archive) { |
470 | 478 | $y = $m = $d = ''; |
471 | 479 | sscanf($archive, '%d-%d-%d', $y, $m, $d); |
@@ -476,7 +484,7 @@ $monthlimit = 0; | ||
476 | 484 | } |
477 | 485 | } |
478 | 486 | |
479 | - $page_str = $this->pagestr; | |
487 | + $page_str = $this->pagestr; | |
480 | 488 | $currentpage = $this->currPage; |
481 | 489 | |
482 | 490 | // createBaseURL |
@@ -495,7 +503,7 @@ $monthlimit = 0; | ||
495 | 503 | $linkParam = array( |
496 | 504 | $subrequest => $subcatid |
497 | 505 | ); |
498 | - $pagelink = createCategoryLink($catid, $linkParam); | |
506 | + $pagelink = createCategoryLink($catid, $linkParam); | |
499 | 507 | } |
500 | 508 | } else { |
501 | 509 | if (!empty($archive)) { |
@@ -504,7 +512,7 @@ $monthlimit = 0; | ||
504 | 512 | ); |
505 | 513 | $pagelink = createArchiveLink($archive, $linkParam); |
506 | 514 | } else { |
507 | - $pagelink = createCategoryLink($catid); | |
515 | + $pagelink = createCategoryLink($catid); | |
508 | 516 | } |
509 | 517 | } |
510 | 518 | } else { |
@@ -556,7 +564,7 @@ $monthlimit = 0; | ||
556 | 564 | } elseif ($usePathInfo && substr($pagelink, -1) != '/') { |
557 | 565 | if ($uri['query']) { |
558 | 566 | $pagelink .= '&'; |
559 | - $page_str = 'page='; | |
567 | + $page_str = 'page='; | |
560 | 568 | } else { |
561 | 569 | $pagelink .= '/'; |
562 | 570 | if (strstr ($pagelink, '//')) $link = preg_replace("/([^:])\/\//", "$1/", $pagelink); |
@@ -598,7 +606,7 @@ $monthlimit = 0; | ||
598 | 606 | $totalpages = intval($totalpages); |
599 | 607 | if ($startpos > $totalamount) { |
600 | 608 | $currentpage = $totalpages; |
601 | - $startpos = $totalamount-$pageamount; | |
609 | + $startpos = $totalamount-$pageamount; | |
602 | 610 | } |
603 | 611 | if ($offset) { |
604 | 612 | $startpos += $offset; |
@@ -607,10 +615,10 @@ $monthlimit = 0; | ||
607 | 615 | $totalpages = ceil($totalamount/$pageamount); |
608 | 616 | if ($startpos > $totalamount) { |
609 | 617 | $currentpage = $totalpages; |
610 | - $startpos = $totalamount-$pageamount; | |
618 | + $startpos = $totalamount-$pageamount; | |
611 | 619 | } |
612 | - $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0; | |
613 | - $nextpage = $currentpage + 1; | |
620 | + $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0; | |
621 | + $nextpage = $currentpage + 1; | |
614 | 622 | $firstpagelink = $pagelink . $page_str . '1'; |
615 | 623 | if ($page_str == 'page_') { |
616 | 624 | $firstpagelink .= '.html'; |
@@ -649,7 +657,7 @@ $monthlimit = 0; | ||
649 | 657 | } else { |
650 | 658 | if ($i<$currentpage-1 || $i>$currentpage+1) { |
651 | 659 | if (($i == 4 && ($currentpage > 5 || $currentpage == 1)) || $i == $currentpage + 2) { |
652 | - $buf = rtrim($buf); | |
660 | + $buf = rtrim($buf); | |
653 | 661 | $buf .= "...|\n"; |
654 | 662 | } |
655 | 663 | } else { |
@@ -702,28 +710,30 @@ $monthlimit = 0; | ||
702 | 710 | function _getSubcategoriesWhere($catid) |
703 | 711 | { |
704 | 712 | global $manager; |
705 | - $mwhere = ''; | |
706 | - $mwhere = ' AND ((i.inumber = p.item_id' | |
707 | - . ' AND (p.categories REGEXP "(^|,)' . intval($catid) . '(,|$)"' | |
708 | - . ' OR i.icat = ' . intval($catid) . '))' | |
709 | - . ' OR (i.icat = ' . intval($catid) | |
710 | - . ' AND p.item_id IS NULL))'; | |
711 | - $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p' | |
712 | - . ' ON i.inumber = p.item_id'; | |
713 | - $mplugin =& $manager->getPlugin('NP_MultipleCategories'); | |
713 | + $subcatTable = sql_table('plug_multiple_categories_sub'); | |
714 | + $mwhere = ''; | |
715 | + $mwhere = ' AND ((i.inumber = p.item_id' | |
716 | + . ' AND (p.categories REGEXP "(^|,)' . intval($catid) . '(,|$)"' | |
717 | + . ' OR i.icat = ' . intval($catid) . '))' | |
718 | + . ' OR (i.icat = ' . intval($catid) | |
719 | + . ' AND p.item_id IS NULL))'; | |
720 | + $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p' | |
721 | + . ' ON i.inumber = p.item_id'; | |
722 | + $mplugin =& $manager->getPlugin('NP_MultipleCategories'); | |
714 | 723 | if (method_exists($mplugin, 'getRequestName')) { |
715 | 724 | $mplugin->event_PreSkinParse(array()); |
716 | 725 | global $subcatid; |
717 | 726 | if ($subcatid) { |
727 | + $subcatid = intval($subcatid); | |
718 | 728 | |
719 | 729 | $mque = 'SELECT * FROM %s WHERE scatid = %d'; |
720 | - $tres = sql_query(sprintf($mque, sql_table('plug_multiple_categories_sub'), intval($subcatid))); | |
730 | + $tres = sql_query(sprintf($mque, $subcatTable, $subcatid)); | |
721 | 731 | // $tres = sql_query('SELECT * FROM ' . sql_table('plug_multiple_categories_sub') . |
722 | 732 | // ' WHERE scatid = ' . intval($subcatid)); |
723 | - $ra = mysql_fetch_array($tres, MYSQL_ASSOC); | |
733 | + $ra = mysql_fetch_array($tres, MYSQL_ASSOC); | |
724 | 734 | if (array_key_exists('parentid', $ra)) { |
725 | 735 | $Children = array(); |
726 | - $Children = explode('/', intval($subcatid) . $this->getChildren(intval($subcatid))); | |
736 | + $Children = explode('/', $subcatid . $this->getChildren($subcatid)); | |
727 | 737 | } |
728 | 738 | if ($Children[1]) { |
729 | 739 | for ($i=0;$i<count($Children);$i++) { |
@@ -733,11 +743,14 @@ $monthlimit = 0; | ||
733 | 743 | $mwhere .= implode(' OR ', $temp_whr); |
734 | 744 | $mwhere .= ' )'; |
735 | 745 | } else { |
736 | - $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . intval($subcatid) . '(,|$)"'; | |
746 | + $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . $subcatid . '(,|$)"'; | |
737 | 747 | } |
738 | 748 | } |
739 | 749 | } |
740 | - return array(w => $mwhere, m => $mtable); | |
750 | + return array( | |
751 | + 'w' => $mwhere, | |
752 | + 'm' => $mtable | |
753 | + ); | |
741 | 754 | } |
742 | 755 | |
743 | 756 | function getParents($subcat_id) |