• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

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


Commit MetaInfo

Revisionca8e79769f9162f9e5b0beaceb42bb8485c72c41 (tree)
Time2006-10-01 23:33:36
Authorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

function PageSwitch() への引数変更
動作未確認 多分問題ないはず
todo どうやったらDESC に警告出せるでしょう?

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

Change Summary

Incremental Difference

--- a/trunk/NP_ShowBlogs/NP_ShowBlogs.php
+++ b/trunk/NP_ShowBlogs/NP_ShowBlogs.php
@@ -4,6 +4,12 @@
44 * SHOWING BLOGS PLUG-IN FOR NucleusCMS
55 * PHP versions 4 and 5
66 *
7+ * This program is free software; you can redistribute it and/or
8+ * modify it under the terms of the GNU General Public License
9+ * as published by the Free Software Foundation; either version 2
10+ * of the License, or (at your option) any later version.
11+ * (see nucleus/documentation/index.html#license for more info)
12+ *
713 * @author Original Author nakahara21
814 * @copyright 2005-2006 nakahara21
915 * @license http://www.gnu.org/licenses/gpl.txt GNU GENERAL PUBLIC LICENSE Version 2, June 1991
@@ -14,35 +20,42 @@
1420 * 2.61 security fix
1521 * 2.6 security fix
1622 *
17- */
18-
19-/**
23+ ****************************************************************************
2024 *
2125 * THESE PLUG-INS ARE DEDICATED TO ALL THOSE NucleusCMS USERS
2226 * WHO FIGHT CORRUPTION AND IRRATIONAL IN EVERY DAY OF THEIR LIVES.
2327 *
24- */
28+ ****************************************************************************/
2529
2630 class NP_ShowBlogs extends NucleusPlugin
2731 {
2832 function getName()
2933 {
3034 return 'Show Blogs'; }
35+
36+ function getMinNucleusVersion()
37+ {
38+ return '322';
39+ }
40+
3141 function getAuthor()
3242 {
3343 return 'Taka + nakahara21 + kimitake + shizuki';
3444 }
45+
3546 function getURL()
3647 {
3748 return 'http://nakahara21.com/';
3849 }
50+
3951 function getVersion()
4052 {
41- return '2.62';
53+ return '2.63';
4254 }
55+
4356 function getDescription()
4457 {
45- return 'This plugin displays items of ALL or EACH blogs, and the link to other pages. <br />"MultipleCategories" supported! (NP_MultipleCategories v0.15 is required.)<br />Usage: &lt;%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%&gt;';
58+ return _SHOWB_DESC;
4659 }
4760
4861 function supportsFeature($what)
@@ -55,7 +68,7 @@ class NP_ShowBlogs extends NucleusPlugin
5568 }
5669 }
5770
58-/* function init()
71+ function init()
5972 {
6073 $language = ereg_replace( '[\\|/]', '', getLanguageName());
6174 if (file_exists($this->getDirectory() . $language . '.php')) {
@@ -63,20 +76,38 @@ class NP_ShowBlogs extends NucleusPlugin
6376 }else {
6477 include_once($this->getDirectory() . 'english.php');
6578 }
66- }*/
79+ }
6780
6881 function install()
6982 {
70- $this->createOption('catformat', 'category name disp format', 'text', '<%category%> on <%blogname%>');
7183 // $this->createOption('catnametoshow', '[allblog mode only] category name to show (0:catname on blogname, 1:catname only, 2:blogname only)','text','0');
72- $this->createOption('stickmode', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only', 'text', '1');
73- $this->createOption('ads', '[Ads code_1] code displayed under first and second item of the page', 'textarea', '' . "\n");
74-// $this->createOption('ads2', '[Ads code_2] code displayed under second and third item of the page', 'textarea', '' . "\n");
75-// $this->createOption('catformat', _CAT_FORMAT, 'text', '<%category%> on <%blogname%>'); // <mod by shizuki>
84+// $this->createOption('stickmode', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only', 'text', '1');
85+// $this->createOption('ads', '[Ads code] code displayed under first and second item of the page', 'textarea', '' . "\n");
86+// <mod by shizuki>
87+ $this->createOption('catformat', _CAT_FORMAT, 'text', '<%category%> on <%blogname%>');
7688 // $this->createOption('catnametoshow', _CATNAME_SHOW, 'text', '0');
77-// $this->createOption('stickmode', _STICKMODE, 'text', '1');
78-// $this->createOption('ads', _ADCODE_1, 'textarea', '' . "\n");
79-// $this->createOption('ads2', _ADCODE_2, 'textarea', '' . "\n"); // <mod by shizuki>
89+ $this->createOption('stickmode', _STICKMODE, 'text', '1');
90+ $this->createOption('ads', _ADCODE_1, 'textarea', '' . "\n");
91+// $this->createOption('ads2', _ADCODE_2, 'textarea', '' . "\n");
92+/* todo can't install ? only warning ?
93+ * douyatte 'desc' ni keikoku wo daseba iinoka wakaranai desu
94+ $ver_min = (getNucleusVersion() < $this->getMinNucleusVersion());
95+ $pat_min = ((getNucleusVersion() == $this->getMinNucleusVersion()) &&
96+ (getNucleusPatchLevel() < $this->getMinNucleusPatchLevel()));
97+ if ($ver_min) { // || $pat_min) {
98+ global $DIR_LIBS;
99+ // uninstall plugin again...
100+ include_once($DIR_LIBS . 'ADMIN.php');
101+ $admin = new ADMIN();
102+ $admin->deleteOnePlugin($this->getID());
103+
104+ // ...and show error
105+ $admin->error(_ERROR_NUCLEUSVERSIONREQ .
106+ $this->getMinNucleusVersion() . ' patch ' .
107+ $this->getMinNucleusPatchLevel());
108+ }
109+*/
110+// </mod by shizuki>
80111 }
81112
82113 function doSkinVar($skinType, $template = 'default/index', $amount = 10, $bmode = '', $type = 1, $sort = 'DESC', $sticky = '', $sticktemplate = '')
@@ -105,7 +136,7 @@ $pagelimit = 0;
105136 $monthlimit = 0;
106137 $catformat = $this->getOption('catformat');
107138
108-/**************************************/
139+/**************************************************************************************/
109140
110141 $type = (float) $type;
111142 $typeExp = intval(($type - floor($type))*10); //0 or 1 or 9
@@ -167,12 +198,11 @@ $monthlimit = 0;
167198
168199 if ($skinType == 'item' || $skinType == 'index' || $skinType == 'archive') {
169200 $catformat = '"' . addslashes($catformat) . '"';
170- $catformat = preg_replace(array('/<%category%>/','/<%blogname%>/', '/<%catdesc%>/'), array('",c.cname,"', '",b.bname,"', '",c.cdesc,"'), $catformat);
201+ $catformat = preg_replace(array('/<%category%>/', '/<%blogname%>/', '/<%catdesc%>/'), array('",c.cname,"', '",b.bname,"', '",c.cdesc,"'), $catformat);
171202 $mtable = "";
172203 if ($manager->pluginInstalled('NP_TagEX')) {
173204 $t_where = $this->_getTagsInum($where, $skinType, $bmode, $amount);
174205 $where .= $t_where['where'];
175- $inumsres = $t_where['inumsres'];
176206 }
177207
178208 if ($skinType == 'item') {
@@ -187,8 +217,9 @@ $monthlimit = 0;
187217 }
188218
189219 $hidden = '';
220+ $temp = $y = $m = $d = '';
190221 if ($archive) {
191-// $hidden .= '<input type="hidden" name="archive" value="'.htmlspecialchars($archive).'" />'."\n";
222+// $hidden .= '<input type="hidden" name="archive" value="' . htmlspecialchars($archive) . '" />' . "\n";
192223 sscanf($archive, '%d-%d-%d', $y, $m, $d);
193224 if ($d) {
194225 $timestamp_start = mktime(0, 0, 0, $m, $d, $y);
@@ -199,7 +230,8 @@ $monthlimit = 0;
199230 $timestamp_end = mktime(0, 0, 0, $m+1, 1, $y);
200231 $date_str = 'SUBSTRING(i.itime,1,7)';
201232 }
202- $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) . ' AND i.itime < ' . mysqldate($timestamp_end);
233+ $where .= ' AND i.itime >= ' . mysqldate($timestamp_start) .
234+ ' AND i.itime < ' . mysqldate($timestamp_end);
203235 } elseif (!empty($monthlimit)) {
204236 $timestamp_end = mysqldate($b->getCorrectTime());
205237 sscanf($timestamp_end, '"%d-%d-%d %s"', $y, $m, $d, $temp);
@@ -215,7 +247,8 @@ $monthlimit = 0;
215247 $where .= ' AND ((i.inumber = p.item_id AND (p.categories REGEXP "(^|,)'
216248 . intval($catid) . '(,|$)" OR i.icat = ' . intval($catid) . ')) OR (i.icat = '
217249 . intval($catid) . ' AND p.item_id IS NULL))';
218- $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') . ' as p ON i.inumber = p.item_id';
250+ $mtable = ' LEFT JOIN ' . sql_table('plug_multiple_categories') .
251+ ' as p ON i.inumber = p.item_id';
219252 $mplugin =& $manager->getPlugin('NP_MultipleCategories');
220253 if (method_exists($mplugin, 'getRequestName')) {
221254 $mplugin->event_PreSkinParse(array());
@@ -251,13 +284,15 @@ $monthlimit = 0;
251284 // }
252285
253286 if ($type >= 1) {
254- $page_switch = $this->PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable, $b, $hidden);
287+ $page_switch = $this->PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable);
255288 if ($typeExp != 9 && $skinType != 'item') {
256289 echo $page_switch['buf'];
257290 }
258291 }
259292
260- $sh_query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, UNIX_TIMESTAMP(i.itime) as timestamp, i.itime, i.imore as more, m.mnumber as authorid,';
293+ $sh_query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,' .
294+ ' m.mrealname as authorname, UNIX_TIMESTAMP(i.itime) as timestamp, i.itime,' .
295+ ' i.imore as more, m.mnumber as authorid,';
261296 if (!$catblogname) {
262297 $sh_query .= ' c.cname as category,';
263298 } else {
@@ -277,12 +312,12 @@ $monthlimit = 0;
277312 foreach ($stickys as $stickynumber) {
278313 $tempblogid = getBlogIDFromItemID($stickynumber);
279314 if ($bmode != 'all') {
280- $sh_query .= ' AND i.iblog = ' . intval($b->getID());
315+ $sh_query .= ' AND i.iblog = ' . $nowbid;
281316 }
282317 $sh_query .= ' AND i.inumber = ' . intval($stickynumber);
283318 $sh_query .= ' AND i.itime <= ' . mysqldate($b->getCorrectTime());
284319 $sh_query .= ' AND i.idraft = 0';
285- if ($this->getOption('stickmode') == 1 && intval($b->getID()) == $tempblogid) {
320+ if ($this->getOption('stickmode') == 1 && intval($nowbid) == $tempblogid) {
286321 $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0);
287322 } elseif (!$this->getOption('stickmode')) {
288323 $b->showUsingQuery($sticktemplate, $sh_query, 0, 1, 0);
@@ -300,13 +335,13 @@ $monthlimit = 0;
300335 $sh_query .= ' AND i.idraft = 0' . $where;
301336
302337 if ($skinType == 'item') {
303- $sh_query .= ' ORDER BY FIND_IN_SET(i.inumber,\'' . @join(',', $inumsres) . '\')';
338+ $sh_query .= ' ORDER BY FIND_IN_SET(i.inumber,\'' . @join(',', $t_where['inumsres']) . '\')';
304339 } else {
305340 $sh_query .= ' ORDER BY i.itime ' . $sort;
306341 }
307342
308343 if ($skinType != 'item') {
309- $this->_showUsingQuery($template, $sh_query, 0, $page_switch['startpos'], $pageamount, $b, $catid, $sticky);
344+ $this->_showUsingQuery($template, $sh_query, 0, $page_switch['startpos'], $pageamount, $b);
310345 if ($type >= 1 && $typeExp != 1) echo $page_switch['buf'];
311346 } elseif ($skinType == 'item') {
312347 $sh_query .= ' LIMIT 0, ' . $pageamount;
@@ -315,7 +350,9 @@ $monthlimit = 0;
315350 }
316351 }
317352
318- function _showUsingQuery($template, $showQuery, $q_startpos, $q_amount, $b, $catid, $sticky) {
353+ function _showUsingQuery($template, $showQuery, $q_startpos, $q_amount, $b, $sticky = '')
354+ {
355+ global $catid;
319356 $ads = 0;
320357 $stickys = count(explode('/', $sticky));
321358 $onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) .', 1';
@@ -343,7 +380,7 @@ $monthlimit = 0;
343380 $b->showUsingQuery($template, $second_query, 0, 1, 1);
344381 }
345382
346- function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '', $b, $hidden = '')
383+ function PageSwitch($type, $pageamount, $offset, $where, $sort, $mtable = '') //, $b) //, $hidden = '')
347384 {
348385 global $CONF, $manager, $archive;
349386 $startpos = 0;
@@ -378,10 +415,10 @@ $monthlimit = 0;
378415 } else {
379416 $currentpage = 1;
380417 $uri = parse_url($pagelink);
381- if ($pagelink == $CONF['IndexURL'] && $CONF['URLMode'] != 'pathinfo') { // add
382- $pagelink = $b->getURL();
418+ if ($pagelink == $CONF['BlogURL'] && $CONF['URLMode'] != 'pathinfo') { // add
419+// $pagelink = $b->getURL();
383420 if ($uri['query']) {
384- $pagelink .= '?'.$uri['query'];
421+ $pagelink .= '?' . $uri['query'];
385422 $uri['query'] = true;
386423 }
387424 }
@@ -390,7 +427,7 @@ $monthlimit = 0;
390427 $pagelink .= '&amp;';
391428 // $pagelink = str_replace('&&', '&', $pagelink);
392429 $pagelink = str_replace('&amp;&amp;','&amp;',$pagelink);
393- } elseif (strpos('?', $uri) && $CONF['URLMode'] != 'pathinfo') {
430+ } elseif (strpos('?', $pagelink) && $CONF['URLMode'] != 'pathinfo') {
394431 $pagelink .= '?';
395432 }
396433 }
--- a/trunk/NP_ShowBlogs/showblogs/english.php
+++ b/trunk/NP_ShowBlogs/showblogs/english.php
@@ -1,4 +1,7 @@
11 <?php
2+ define('_SHOWB_DESC', 'This plugin displays items of ALL or EACH blogs, and the link to other pages. <br />' .
3+ '"MultipleCategories" supported! (NP_MultipleCategories v0.15 is required.)<br />' .
4+ 'Usage: &lt;%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%&gt;');
25 define('_CAT_FORMAT', 'category name disp format');
36 define('_CATNAME_SHOW', '[allblog mode only] category name to show (0:catname on blogname, 1:catname only, 2:blogname only)');
47 define('_STICKMODE', '[currentblog mode only] 0:show all stickyID, 1:show current blog stickyID only');
--- a/trunk/NP_ShowBlogs/showblogs/japanese-euc.php
+++ b/trunk/NP_ShowBlogs/showblogs/japanese-euc.php
@@ -1,7 +1,11 @@
11 <?php
2+ define('_SHOWB_DESC', '&t;%blog%&gt;を置き換えるプラグインです。<br />' .
3+ '全ブログ、または任意のブログをページスイッチつきで表示します<br />' .
4+ 'NP_MultipleCategories v0.15 以降のマルチカテゴリ、およびNP_TagEX に対応しています<br />' .
5+ 'Usage: &lt;%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%&gt;');
26 define('_CAT_FORMAT', 'カテゴリー名の表示形式');
3- define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)');
7+ define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)');
48 define('_STICKMODE', 'オールブログモードの時に表示する固定表示アイテム(0:全て表示する, 1:表示中のブログに所属するもののみ)');
5- define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード');
6- define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード');
9+ define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード');
10+ define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード');
711 ?>
\ No newline at end of file
--- a/trunk/NP_ShowBlogs/showblogs/japanese-utf8.php
+++ b/trunk/NP_ShowBlogs/showblogs/japanese-utf8.php
@@ -1,7 +1,11 @@
11 <?php
2+ define('_SHOWB_DESC', '&t;%blog%&gt;を置き換えるプラグインです。<br />' .
3+ '全ブログ、または任意のブログをページスイッチつきで表示します<br />' .
4+ 'NP_MultipleCategories v0.15 以降のマルチカテゴリ、およびNP_TagEX に対応しています<br />' .
5+ 'Usage: &lt;%ShowBlogs(default/index, 15, all, 2, DESC, 6/15/56/186, default/stick)%&gt;');
26 define('_CAT_FORMAT', 'カテゴリー名の表示形式');
3- define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)');
7+ define('_CATNAME_SHOW', 'オールブログモードの時のカテゴリー名の表示形式(0:「カテゴリ名 on ブログ名」, 1:カテゴリ名のみ, 2:ブログ名のみ)');
48 define('_STICKMODE', 'オールブログモードの時に表示する固定表示アイテム(0:全て表示する, 1:表示中のブログに所属するもののみ)');
5- define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード');
6- define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード');
9+ define('_ADCODE_1', '1番目と2番目に表示されるアイテムの間に表示する広告のコード');
10+ define('_ADCODE_2', '2番目と3番目に表示されるアイテムの間に表示する広告のコード');
711 ?>
\ No newline at end of file
Show on old repository browser