• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision0916b6738c2d338692102e98dc90a20cec0ed29a (tree)
Time2006-11-28 02:21:51
Authorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

バージョン番号変え忘れ

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

Change Summary

Incremental Difference

--- a/trunk/NP_ShowBlogs/NP_ShowBlogs.php
+++ b/trunk/NP_ShowBlogs/NP_ShowBlogs.php
@@ -10,11 +10,11 @@
1010 * of the License, or (at your option) any later version.
1111 * (see nucleus/documentation/index.html#license for more info)
1212 *
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
1818 *
1919 * 2.65 add AD code control
2020 * add Category mode
@@ -22,7 +22,7 @@
2222 * 2.64 fix page switch URL generate
2323 * 2.62 security fix and tag related
2424 * 2.61 security fix
25- * 2.6 security fix
25+ * 2.6 security fix
2626 *
2727 ****************************************************************************
2828 *
@@ -153,14 +153,14 @@ class NP_ShowBlogs extends NucleusPlugin
153153 //show blogID
154154 $show = array();
155155 // limit number of pages(months)
156-$pagelimit = 0;
157-$monthlimit = 0;
156+ $pagelimit = 0;
157+ $monthlimit = 0;
158158 $catformat = $this->getOption('catformat');
159159
160160 /**************************************************************************************/
161161
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
164164 $this->showAdCode = $showAdCode;
165165
166166 list ($pageamount, $offset) = sscanf($amount, '%d(%d)');
@@ -169,8 +169,8 @@ $monthlimit = 0;
169169 }
170170 if ($sort != 'ASC' && $sort != 'DESC') {
171171 $sticktemplate = $sticky;
172- $sticky = $sort;
173- $sort = 'DESC';
172+ $sticky = $sort;
173+ $sort = 'DESC';
174174 }
175175 if (!empty($sticky) && empty($sticktemplate)) {
176176 $sticktemplate = $template;
@@ -205,7 +205,7 @@ $monthlimit = 0;
205205 }
206206 $this->nowbid = $nowbid = intval($b->getID());
207207
208- $where = '';
208+ $where = '';
209209 $catblogname = 0;
210210
211211 if ($bmode != 'all') {
@@ -262,7 +262,7 @@ $monthlimit = 0;
262262 '/<%catdesc%>/'
263263 );
264264 $catformat = preg_replace($fArr, $nArr, $catformat);
265- $mtable = "";
265+ $mtable = "";
266266 if ($manager->pluginInstalled('NP_TagEX')) {
267267 $t_where = $this->_getTagsInum($where, $skinType, $bmode, $amount);
268268 $where .= $t_where['where'];
@@ -286,18 +286,18 @@ $monthlimit = 0;
286286 if ($archive) {
287287 sscanf($archive, '%d-%d-%d', $y, $m, $d);
288288 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)';
292292 } 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)';
296296 }
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);
299299 } elseif (!empty($monthlimit)) {
300- $timestamp_end = mysqldate($b->getCorrectTime());
300+ $timestamp_end = mysqldate($b->getCorrectTime());
301301 sscanf($timestamp_end, '"%d-%d-%d %s"', $y, $m, $d, $temp);
302302 $timestamp_start = mktime(0, 0, 0, $m-$monthlimit, $d, $y);
303303 $where .= ' AND i.itime >= ' . mysqldate($timestamp_start)
@@ -309,10 +309,10 @@ $monthlimit = 0;
309309 if (!empty($catid)) {
310310 if ($manager->pluginInstalled('NP_MultipleCategories')) {
311311 $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'];
314314 } else {
315- $where .= ' AND i.icat=' . intval($catid);
315+ $where .= ' AND i.icat=' . intval($catid);
316316 }
317317 $linkparams['catid'] = $todayparams['catid'] = intval($catid);
318318 }
@@ -325,42 +325,50 @@ $monthlimit = 0;
325325 }
326326 }
327327
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,';
332338 if (!$catblogname) {
333339 $sh_query .= ' c.cname as category,';
334340 } else {
335341 $sh_query .= ' concat(' . $catformat . ') as category,';
336342 }
337- $sh_query .= ' i.icat as catid, i.iclosed as closed'
343+ $sh_query .= ' i.icat as catid,'
344+ . ' i.iclosed as closed'
338345 . ' FROM '
339- . sql_table('member') . ' as m, '
346+ . sql_table('member') . ' as m, '
340347 . sql_table('category') . ' as c, '
341- . sql_table('item') . ' as i'
348+ . sql_table('item') . ' as i'
342349 . $mtable;
343350 if ($bmode == 'all') {
344351 $sh_query .= ', ' . sql_table('blog') . ' as b ';
345352 }
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';
347355 if ($bmode == 'all') {
348356 $sh_query .= ' AND b.bnumber = c.cblog';
349357 }
350358
351359 // if ($page_switch['startpos'] == 0 && !$catid && $sticky != '' && $skinType != 'item' && !$this->tagSelected) {
352- $ads = 0;
360+ $ads = 0;
353361 $sticCatFlag = ($page_switch['startpos'] == 0 && (!$catid || (!empty($catStick) && $sticktemplate != '')));
354362 if ($sticCatFlag && $sticky != '' && $skinType != 'item' && !$this->tagSelected) {
355363 foreach ($stickys as $stickynumber) {
356364 $sticky_query = $sh_query;
357- $tempblogid = getBlogIDFromItemID($stickynumber);
365+ $tempblogid = getBlogIDFromItemID($stickynumber);
358366 if ($bmode != 'all') {
359367 $sticky_query .= ' AND i.iblog = ' . $nowbid;
360368 }
361369 $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';
364372 if ($catid) {
365373 $sticky_query .= ' AND i.icat = ' . intval($catid);
366374 }
@@ -450,9 +458,9 @@ $monthlimit = 0;
450458 if (getVar('page')) {
451459 $currPage = intGetVar('page');
452460 }
453- $_GET['page'] = intval($currPage);
461+ $_GET['page'] = intval($currPage);
454462 $this->currPage = intval($currPage);
455- $this->pagestr = $page_str;
463+ $this->pagestr = $page_str;
456464 }
457465
458466 function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '')
@@ -460,12 +468,12 @@ $monthlimit = 0;
460468 global $CONF, $manager, $archive, $catid, $subcatid;
461469
462470 // initialize
463- $startpos = 0;
464- $catid = intval($catid);
465- $subcatid = intval($subcatid);
471+ $startpos = 0;
472+ $catid = intval($catid);
473+ $subcatid = intval($subcatid);
466474 $usePathInfo = ($CONF['URLMode'] == 'pathinfo');
467- $pageamount = intval($pageamount);
468- $offset = intval($offset);
475+ $pageamount = intval($pageamount);
476+ $offset = intval($offset);
469477 if ($archive) {
470478 $y = $m = $d = '';
471479 sscanf($archive, '%d-%d-%d', $y, $m, $d);
@@ -476,7 +484,7 @@ $monthlimit = 0;
476484 }
477485 }
478486
479- $page_str = $this->pagestr;
487+ $page_str = $this->pagestr;
480488 $currentpage = $this->currPage;
481489
482490 // createBaseURL
@@ -495,7 +503,7 @@ $monthlimit = 0;
495503 $linkParam = array(
496504 $subrequest => $subcatid
497505 );
498- $pagelink = createCategoryLink($catid, $linkParam);
506+ $pagelink = createCategoryLink($catid, $linkParam);
499507 }
500508 } else {
501509 if (!empty($archive)) {
@@ -504,7 +512,7 @@ $monthlimit = 0;
504512 );
505513 $pagelink = createArchiveLink($archive, $linkParam);
506514 } else {
507- $pagelink = createCategoryLink($catid);
515+ $pagelink = createCategoryLink($catid);
508516 }
509517 }
510518 } else {
@@ -556,7 +564,7 @@ $monthlimit = 0;
556564 } elseif ($usePathInfo && substr($pagelink, -1) != '/') {
557565 if ($uri['query']) {
558566 $pagelink .= '&amp;';
559- $page_str = 'page=';
567+ $page_str = 'page=';
560568 } else {
561569 $pagelink .= '/';
562570 if (strstr ($pagelink, '//')) $link = preg_replace("/([^:])\/\//", "$1/", $pagelink);
@@ -598,7 +606,7 @@ $monthlimit = 0;
598606 $totalpages = intval($totalpages);
599607 if ($startpos > $totalamount) {
600608 $currentpage = $totalpages;
601- $startpos = $totalamount-$pageamount;
609+ $startpos = $totalamount-$pageamount;
602610 }
603611 if ($offset) {
604612 $startpos += $offset;
@@ -607,10 +615,10 @@ $monthlimit = 0;
607615 $totalpages = ceil($totalamount/$pageamount);
608616 if ($startpos > $totalamount) {
609617 $currentpage = $totalpages;
610- $startpos = $totalamount-$pageamount;
618+ $startpos = $totalamount-$pageamount;
611619 }
612- $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0;
613- $nextpage = $currentpage + 1;
620+ $prevpage = ($currentpage > 1) ? $currentpage - 1 : 0;
621+ $nextpage = $currentpage + 1;
614622 $firstpagelink = $pagelink . $page_str . '1';
615623 if ($page_str == 'page_') {
616624 $firstpagelink .= '.html';
@@ -649,7 +657,7 @@ $monthlimit = 0;
649657 } else {
650658 if ($i<$currentpage-1 || $i>$currentpage+1) {
651659 if (($i == 4 && ($currentpage > 5 || $currentpage == 1)) || $i == $currentpage + 2) {
652- $buf = rtrim($buf);
660+ $buf = rtrim($buf);
653661 $buf .= "...|\n";
654662 }
655663 } else {
@@ -702,28 +710,30 @@ $monthlimit = 0;
702710 function _getSubcategoriesWhere($catid)
703711 {
704712 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');
714723 if (method_exists($mplugin, 'getRequestName')) {
715724 $mplugin->event_PreSkinParse(array());
716725 global $subcatid;
717726 if ($subcatid) {
727+ $subcatid = intval($subcatid);
718728
719729 $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));
721731 // $tres = sql_query('SELECT * FROM ' . sql_table('plug_multiple_categories_sub') .
722732 // ' WHERE scatid = ' . intval($subcatid));
723- $ra = mysql_fetch_array($tres, MYSQL_ASSOC);
733+ $ra = mysql_fetch_array($tres, MYSQL_ASSOC);
724734 if (array_key_exists('parentid', $ra)) {
725735 $Children = array();
726- $Children = explode('/', intval($subcatid) . $this->getChildren(intval($subcatid)));
736+ $Children = explode('/', $subcatid . $this->getChildren($subcatid));
727737 }
728738 if ($Children[1]) {
729739 for ($i=0;$i<count($Children);$i++) {
@@ -733,11 +743,14 @@ $monthlimit = 0;
733743 $mwhere .= implode(' OR ', $temp_whr);
734744 $mwhere .= ' )';
735745 } else {
736- $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . intval($subcatid) . '(,|$)"';
746+ $mwhere .= ' AND p.subcategories REGEXP "(^|,)' . $subcatid . '(,|$)"';
737747 }
738748 }
739749 }
740- return array(w => $mwhere, m => $mtable);
750+ return array(
751+ 'w' => $mwhere,
752+ 'm' => $mtable
753+ );
741754 }
742755
743756 function getParents($subcat_id)
Show on old repository browser