3 class NP_ArchiveListEX extends NucleusPlugin {
7 return 'ArchiveListEX';
11 function getAuthor() {
15 // an URL to the plugin website
18 return 'http://xx.nakahara21.net/';
21 // version of the plugin
22 function getVersion() {
26 // a description to be shown on the installed plugins listing
27 function getDescription() {
28 return 'Show all item title on each archive list. <br />[Required] template: name of the template to use <br />[Optional] mode: [month]shows an entry for each month , [day]shows an entry for each day <br />[Optional] limit: limits the amount of links shown (e.g. if you only want to show links to the past 3 months)<br /><br />Usage1: <%ArchiveListEX(default)%> or <%ArchiveListEX(default,month)%> instead of <%archivelist(default)%>,<br />Usage2: <%ArchiveListEX(default,day,5)%> instead of <%archivedaylist(default,5)%>,<br />Usage3: <%ArchiveListEX(default,5)%>';
31 function doSkinVar($skinType, $template = 'default', $mode = 'month', $limit = 0) {
32 global $manager, $blog, $CONF, $catid, $itemid;
34 $params = func_get_args();
35 if ($params[1]){ $template = $params[1]; }
37 if ($params[2] == 'month' | $params[2] == 'day'){ $mode = $params[2]; }
38 else{ $limit = intval($params[2]); }
40 if ($params[3]){ $limit = intval($params[3]); }
45 $b =& $manager->getBlog($CONF['DefaultBlog']);
47 $blogid = $b->getID();
50 $this->linkparams = array('catid' => $catid);
56 //**********************************************
57 if($_REQUEST['mode'] == "remarks"){
59 $numberOfWritebacks = 50; // defaults to 50
62 $query = "SELECT c.cnumber, c.cuser, c.cbody, c.citem, c.cmember, c.ctime ,UNIX_TIMESTAMP(c.ctime) as ctimest ,i.inumber, i.ititle
63 FROM nucleus_comment c ,nucleus_item i
64 WHERE c.citem = i.inumber
66 LIMIT 0,".$numberOfWritebacks;
68 $comments = mysql_query($query);
69 // echo ' <ul class="nobullets"> ';
71 while($row = mysql_fetch_object($comments)) {
73 $ititle = htmlspecialchars(strip_tags($row->ititle));
75 $ctst = date("Y-m-d H:i",$ct);
77 // $ctext = strip_tags($text);
78 // $ctext = substr($text, 0, $numberOfCharacters);
79 // $ctext = mb_substr($ctext, 0, -1);
81 if (!$row->cmember) $myname = $row->cuser;
84 $mem->readFromID(intval($row->cmember));
85 $myname = $mem->getDisplayName();
88 $itemlink = createItemLink($row->citem, '');
89 $l_comments = "<li class=itembody>¢£ <span class=\"iteminfo\"><a href=\"".$b->getURL().$itemlink."#c".$cid."\">¡Ø".$ititle."¡Ù ¤Ø¤Î¥³¥á¥ó¥È</a></span><br />".$ctext."<br /><span class=\"iteminfo\">".$myname." posted on $ctst</span></li>" ;
92 if(!$arr_res){$arr_res = array();}
93 // array_push($arr_res,array($ct => $l_comments));
94 $arr_res[$ct] = $l_comments;
99 //=========================
101 $query = "SELECT t.title, t.excerpt, t.tb_id, t.blog_name, t.timestamp ,UNIX_TIMESTAMP(t.timestamp) as ttimest ,t.url ,i.inumber, i.ititle
102 FROM nucleus_plugin_tb t ,nucleus_item i
103 WHERE t.tb_id = i.inumber
104 ORDER by timestamp DESC
105 LIMIT 0,".$numberOfWritebacks;
107 $comments = mysql_query($query);
109 while($row = mysql_fetch_object($comments)) {
110 $text = $row->excerpt;
111 // $text = strip_tags($text);
112 // $ctext = mb_substr($text, 0, $numberOfCharacters);
114 $title = $row->title;
115 // $ctitle = substr($title, 0, $numberOfTitleCharacters+1);
116 // $ctitle = mb_substr($ctitle, 0, -1);
118 $blogname = $row->blog_name;
119 $tbtime = $row->ttimest;
120 $ititle = htmlspecialchars(strip_tags($row->ititle));
122 $ttst = date("Y-m-d H:i",$tbtime);
124 $itemlink = createItemLink($row->tb_id, '');
125 // echo "<li><a href=\"".$b->getURL().$itemlink."#trackback\">¢£".$tbtime.":";
126 // echo $blogname."¤«¤é";
127 // echo $ctitle.$ctext;
128 // echo "....</a></li>";
130 $l_tbs = "<li class=itembody>¢¡ <span class=\"iteminfo\"><a href=\"".$b->getURL().$itemlink."#trackback\">¡Ø".$ititle."¡Ù¤Ø¤Î¥È¥é¥Ã¥¯¥Ð¥Ã¥¯</a></span><br />## ".$title." ##<br />".$text."<br /><span class=\"iteminfo\">¡Ø<a href=\"$url\">{$blogname}</a>¡Ù pinged on ".$ttst."</span></li>";
132 // if(!$arr_res){$arr_res = array();}
133 // array_push($arr_res,$l_tbs);
134 $arr_res[$tbtime] = $l_tbs;
139 //=========================
144 $output = array_slice ($arr_res, 0, $numberOfWritebacks);
147 echo '<h3>¥³¥á¥ó¥È¤È¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ ºÇ¿·'.$numberOfWritebacks.'·ï</h3>';
148 echo ' <ul class="nobullets"> ';
150 foreach($output as $key => $value){
155 //**********************************************
158 $template = TEMPLATE::read($template);
159 $data['blogid'] = $blogid;
160 //===================================
161 echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);
162 //===================================
163 echo '<a href="http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'">HOME</a> ';
165 $catName = $blog->getCategoryName($catid); //¥«¥Æ¥´¥ê¤Î̾Á°¤òget
166 // $catName = $blog->getCategoryDesc($catid); //¥«¥Æ¥´¥ê¤ÎÀâÌÀ¤òget
167 $archivealllistlink = createArchiveListLink($blogid,"");
168 echo ' > <a href="'.$archivealllistlink.'">Archive List</a>';
169 echo ' > Category : <u> '.$catName.' </u> ';
171 // echo 'Category : ÁªÂò¤·¤Æ¤¤¤Þ¤»¤ó';
172 echo ' > Archive List';
175 //===================================
176 echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);
177 //===================================
178 echo TEMPLATE::fill($template['ARCHIVELIST_HEADER'],$data);
180 $query = 'SELECT UNIX_TIMESTAMP(itime) as itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) as Day FROM nucleus_item'
181 . ' WHERE iblog=' . $blogid
182 . ' and UNIX_TIMESTAMP(itime)<=' . $now // don't show future items!
183 . ' and idraft=0'; // don't show draft items
186 $query .= ' and icat=' . intval($catid);
188 $query .= ' GROUP BY Year, Month';
193 // $query .= ' ORDER BY itime ASC'; //¥¢¡¼¥«¥¤¥Ö¥ê¥¹¥È¾º½ç
194 $query .= ' ORDER BY itime DESC'; //¥¢¡¼¥«¥¤¥Ö¥ê¥¹¥È¹ß½ç
197 $query .= ' LIMIT ' . $limit;
199 $res = sql_query($query);
201 while ($current = mysql_fetch_object($res)) {
202 if ($mode == 'day') {
203 $archivedate = date('Y-m-d',$current->itime);
204 $archive['day'] = date('d',$current->itime);
206 $archivedate = date('Y-m',$current->itime);
208 $data['month'] = date('m',$current->itime);
209 $data['year'] = date('Y',$current->itime);
210 $data['archivelink'] = createArchiveLink($blogid,$archivedate,$this->linkparams);
212 $temp = TEMPLATE::fill($template['ARCHIVELIST_LISTITEM'],$data);
213 echo strftime($temp,$current->itime);
215 //======================================================
217 $adquery = 'SELECT inumber, ititle, icat FROM nucleus_item'
218 . ' WHERE iblog=' . $blogid
219 . ' and UNIX_TIMESTAMP(itime)<=' . $now // don't show future items!
220 . ' and idraft=0' // don't show draft items
221 . ' and SUBSTRING(itime,1,4)=' . $data['year'] // year
222 . ' and SUBSTRING(itime,6,2)=' . $data['month']; // month
224 $adquery .= ' and SUBSTRING(itime,9,2)=' . $archive['day']; //day
227 $adquery .= ' and icat=' . intval($catid);
229 // $adquery .= ' ORDER BY itime ASC'; //¥¿¥¤¥È¥ë°ìÍ÷¾º½ç
230 $adquery .= ' ORDER BY itime DESC'; //¥¿¥¤¥È¥ë°ìÍ÷¹ß½ç
233 // $adquery .= ' LIMIT ' . $limit;
235 $adres = sql_query($adquery);
237 while ($adcurrent = mysql_fetch_object($adres)) {
238 $ititle = htmlspecialchars(strip_tags($adcurrent->ititle));
239 $inumber = $adcurrent->inumber;
240 $itemlink = createItemLink($inumber,$this->linkparams);
243 echo '<li><a href="'.$itemlink.'">'. $ititle . '</a></li>'."\n";
245 $icatName = $blog->getCategoryName($adcurrent->icat); //¥«¥Æ¥´¥ê¤Î̾Á°¤òget
246 // $icatName = $blog->getCategoryDesc($adcurrent->icat); //¥«¥Æ¥´¥ê¤ÎÀâÌÀ¤òget
247 //¥¿¥¤¥È¥ë°ìÍ÷¤Ë³¤¤¤Æ¥«¥Æ¥´¥ê̾¤òɽ¼¨
248 // echo '<li><a href="'.$itemlink.'">'. $ititle . ' <small>::' . $icatName .'</small></a></li>'."\n";
249 //¥¿¥¤¥È¥ë°ìÍ÷¤Ë¥Þ¥¦¥¹¤ò¤¢¤ï¤»¤ë¤È¥«¥Æ¥´¥ê̾¤ò¥Õ¥í¡¼¥Èɽ¼¨
250 echo '<li><a href="'.$itemlink.'" title="Category:'.$icatName.'">'. $ititle . '</a></li>'."\n";
253 mysql_free_result($adres);
255 //======================================================
257 mysql_free_result($res);
258 echo TEMPLATE::fill($template['ARCHIVELIST_FOOTER'],$data);
263 //===================================