• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

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


Commit MetaInfo

Revisiond0b08f38463db797980affb2d2eacaee71402df5 (tree)
Time2006-10-03 19:11:44
Authorsatona <satona@1ca2...>
Commitersatona

Log Message

(none)

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

Change Summary

Incremental Difference

--- /dev/null
+++ b/trunk/NP_MultipleCategories/NP_MultipleCategories.php
@@ -0,0 +1,1058 @@
1+<?php
2+
3+/**
4+ * Plugin for Nucleus CMS (http://plugins.nucleuscms.org/)
5+ * Copyright (C) 2003 The Nucleus Plugins Project
6+ *
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+ *
12+ * see license.txt for the full license
13+ */
14+
15+/**
16+* Usage:
17+*
18+*
19+* Versions:
20+*
21+* TODO
22+* - documentation
23+* - etc
24+*/
25+
26+if (!function_exists('array_key_exists')){
27+ function array_key_exists($key, $array) {
28+ return key_exists($key, $array);
29+ }
30+}
31+
32+class NP_MultipleCategories extends NucleusPlugin {
33+
34+ function getName() { return 'Multiple Categories [Custom Edition]'; }
35+ function getAuthor() { return 'Anand + nakahara21 + Taka + sato(na)'; }
36+ function getURL() { return 'http://reverb.jp/vivian/download.php?itemid=NP_MultipleCategories'; }
37+ function getVersion() { return '0.403j'; }
38+ function getMinNucleusVersion() { return '220'; }
39+ function getDescription(){ return 'Multiple Categories, Sub Categories'; }
40+ function supportsFeature($what) {
41+ switch($what)
42+ {
43+ case 'SqlTablePrefix':
44+ return 1;
45+ default:
46+ return 0;
47+ }
48+ }
49+
50+ function install() {
51+ $this->createOption('addindex', '[When URL-Mode is normal] If a blog URL ends with "/", add "index.php" before query strings.', 'yesno', 'yes');
52+ $this->createOption('addblogid_def', 'Add blogid to default blog\'s category URLs.', 'yesno', 'no');
53+ $this->createOption('addblogid', 'When a blog URL is different from default blog URL, add blogid to its category URLs.', 'yesno', 'yes');
54+ $this->createOption("mainsep", "Separate character between a category and additional categories", "text", " , ");
55+ $this->createOption("addsep", "Separate character between additional categories", "text", " , ");
56+ $this->createOption("subformat", "Display form of a category name when the item belongs to one or more sub categories.", "text", "<%category%> ( <%subcategory%> )");
57+ $this->createOption("catheader", "[Category list] Header Template. You can use <%blogid%>, <%blogurl%>, <%self%>", "textarea",'<ul class="nobullets">'."\n");
58+ $this->createOption("catlist", "[Category list] List item Template. You can use <%catname%>, <%catdesc%>, <%catid%>, <%catlink%>, <%catflag%>, <%catamount%>, <%subcategorylist%>", "textarea",'<li<%catflag%>><a href="<%catlink%>"><%catname%></a>(<%catamount%>)<%subcategorylist%></li>'."\n");
59+ $this->createOption("catfooter", "[Category list] Footer Template. You can use <%blogid%>, <%blogurl%>, <%self%>", "textarea",'</ul>'."\n");
60+ $this->createOption("catflag", "[Category list] Flag Template", "textarea",' class="current"'."\n");
61+ $this->createOption("subheader", "[Category list] Sub-Category Header Template", "textarea",'<ul>'."\n");
62+ $this->createOption("sublist", "[Category list] Sub-Category List item Template. You can use <%subname%>, <%subdesc%>, <%subcatid%>, <%sublink%>, <%subflag%>, <%subamount%>", "textarea",'<li<%subflag%>><a href="<%sublink%>"><%subname%></a>(<%subamount%>)</li>'."\n");
63+ $this->createOption("subfooter", "[Category list] Sub-Category Footer Template", "textarea",'</ul>'."\n");
64+ $this->createOption("subflag", "[Category list] Sub-Category Flag Template", "textarea",' class="current"'."\n");
65+ $this->createOption("replace", '[Category list] a-1: When a category has sub categories, replace "<%amount%>" of category list template to another character.', 'yesno','no');
66+ $this->createOption("replacechar", '[Category list] a-2: The character to replace.', 'text','+');
67+ $this->createOption("archeader", "[Archive list] Header Template. You can use <%blogid%>", "textarea",'<ul>'."\n");
68+ $this->createOption("arclist", "[Archive list] List item Template. You can use <%archivelink%>,<%blogid%>, month/year/day like \"%B, %Y\"", "textarea",'<li><a href="<%archivelink%>">%Y-%m</a></li>'."\n");
69+ $this->createOption("arcfooter", "[Archive list] Footer Template. You can use <%blogid%>", "textarea",'</ul>'."\n");
70+ $this->createOption("locale", "[Archive list] Locale", "text",'ja_JP');
71+ $this->createOption("quickmenu", "Show in quick menu", "yesno", "no");
72+ $this->createOption("del_uninstall", "Delete tables on uninstall?", "yesno", "no");
73+
74+/*
75+
76+ALTER TABLE `000_nucleus_plug_multiple_categories_sub` ADD `parentid` INT( 11 ) DEFAULT '0' NOT NULL AFTER `scatid` ,
77+ADD `ordid` INT( 11 ) DEFAULT '100' NOT NULL AFTER `parentid` ;
78+
79+
80+*/
81+ // create the table that will keep track of notifications
82+ $query = 'CREATE TABLE IF NOT EXISTS '. sql_table('plug_multiple_categories'). '(';
83+ $query .= ' item_id int(11) NOT NULL,';
84+ $query .= ' categories varchar(255) not null,';
85+ $query .= ' subcategories varchar(255) not null,';
86+ $query .= ' PRIMARY KEY (item_id)';
87+ $query .= ') TYPE=MyISAM;';
88+ sql_query($query);
89+
90+ $check_column = sql_query('SELECT * FROM '. sql_table('plug_multiple_categories'). ' WHERE 1=0');
91+ for ($i=0; $i<mysql_num_fields($check_column); $i++) {
92+ if ($meta = mysql_fetch_field($check_column)) {
93+ $names[] = $meta->name;
94+ }
95+ }
96+ if (!in_array("subcategories",$names)) {
97+ sql_query ('ALTER TABLE '.sql_table('plug_multiple_categories').' ADD subcategories varchar(255) not null');
98+ sql_query('ALTER TABLE ' . sql_table('plug_multiple_categories'). ' MODIFY categories varchar(255) not null');
99+ }
100+ $query = 'CREATE TABLE IF NOT EXISTS '. sql_table('plug_multiple_categories_sub'). '('
101+ . 'scatid int(11) not null auto_increment,'
102+ . 'catid int(11) not null,'
103+ . 'sname varchar(40) not null,'
104+ . 'sdesc varchar(200) not null,'
105+ . ' PRIMARY KEY (scatid)'
106+ . ') TYPE=MyISAM;';
107+ sql_query($query);
108+ }
109+
110+ function unInstall() {
111+ if ($this->getOption('del_uninstall') == "yes") {
112+ sql_query('DROP TABLE ' .sql_table('plug_multiple_categories'));
113+ sql_query('DROP TABLE ' .sql_table('plug_multiple_categories_sub'));
114+ }
115+ }
116+
117+ function getTableList() {
118+ return array(sql_table('plug_multiple_categories'), sql_table('plug_multiple_categories_sub'));
119+ }
120+
121+ function hasAdminArea() { return 1; }
122+
123+ function getEventList() {
124+ return array('PreSkinParse','PostAddItem','AddItemFormExtras', 'EditItemFormExtras', 'PreUpdateItem', 'PostDeleteItem', 'PostDeleteCategory','QuickMenu');
125+ }
126+
127+ function event_QuickMenu(&$data) {
128+ // only show when option enabled
129+ if ($this->getOption('quickmenu') != 'yes') return;
130+ global $member;
131+ // only show to admins
132+ if (!($member->isLoggedIn() && $member->isAdmin())) return;
133+ array_push(
134+ $data['options'],
135+ array(
136+ 'title' => 'Multiple Categories',
137+ 'url' => $this->getAdminURL(),
138+ 'tooltip' => 'Edit sub categories'
139+ )
140+ );
141+ }
142+
143+ function getRequestName() {
144+ return "subcatid";
145+ }
146+
147+ function init() {
148+ $this->setglobal = 0;
149+ $this->subOrderArray = $this->_setSubOrder();//<sato(na)t1855 />
150+ }
151+
152+ function event_PreSkinParse($data) {
153+ global $catid, $subcatid, $CONF;
154+
155+ if ($this->setglobal == 1) return;
156+
157+ if ($CONF['URLMode'] == 'pathinfo') {
158+ if (!$subcatid) {
159+ $sid = 0;
160+ $pathdata = explode("/",serverVar('PATH_INFO'));
161+ for ($i=0;$i<sizeof($pathdata);$i++) {
162+ switch ($pathdata[$i]) {
163+ case $this->getRequestName():
164+ $i++;
165+ if ($i<sizeof($pathdata)) $sid = $pathdata[$i];
166+ break 2;
167+ }
168+ }
169+ if ($sid) $subcatid = intval($sid);
170+ }
171+ } else {
172+ $subcatid = intRequestVar($this->getRequestName());
173+ }
174+ if ($subcatid && !$catid) {
175+ $catid = intval($this->_getParentCatID($subcatid));
176+ if (!$catid) {
177+ $subcatid = null;
178+ $catid = null;
179+ }
180+ } elseif ($subcatid) {
181+ $pcatid = intval($this->_getParentCatID($subcatid));
182+ if ($pcatid != $catid) $subcatid = null;
183+ }
184+
185+ $this->setglobal = 1;
186+ }
187+
188+//modify start+++++++++
189+ function checkMSCVersion(){
190+ $res = sql_query("SHOW FIELDS from ".sql_table('plug_multiple_categories_sub') );
191+ $fieldnames = array();
192+ while ($co = mysql_fetch_assoc($res)) {
193+ $fieldnames[] = $co['Field'];
194+ }
195+ if(in_array('ordid',$fieldnames)) return 4;
196+ if(in_array('parentid',$fieldnames)) return 3;
197+ return 2;
198+ }
199+//modify end+++++++++
200+
201+ function _getCategories($id){
202+ $aResult = array();
203+ $query = 'SELECT catid, cname as name, cdesc FROM '.sql_table('category').' WHERE cblog=' . intval($id);
204+ $res = sql_query($query);
205+ while ($a = mysql_fetch_assoc($res)){
206+ array_push($aResult,$a);
207+ }
208+ return $aResult;
209+ }
210+
211+ function _getDefinedScats($id){
212+ $aResult = array();
213+ $query = 'SELECT * FROM '.sql_table('plug_multiple_categories_sub').' WHERE catid=' . intval($id);
214+ $res = sql_query($query);
215+ while ($a = mysql_fetch_assoc($res)){
216+ array_push($aResult,$a);
217+ }
218+ return $aResult;
219+ }
220+
221+ function _getScatIDs($id){
222+ $aResult = array();
223+ $query = 'SELECT scatid FROM '.sql_table('plug_multiple_categories_sub').' WHERE catid=' . intval($id);
224+ $res = sql_query($query);
225+ while ($row = mysql_fetch_row($res)){
226+ $aResult[] = $row[0];
227+ }
228+ return $aResult;
229+ }
230+
231+ function _getCatNameFromID($id){
232+ return quickQuery('SELECT cname as result FROM '.sql_table('category').' WHERE catid='.intval($id));
233+ }
234+
235+ function _getScatNameFromID($id) {
236+ return quickQuery('SELECT sname as result FROM '.sql_table('plug_multiple_categories_sub').' WHERE scatid='.intval($id));
237+ }
238+
239+ function _getScatDescFromID($id) {
240+ return quickQuery('SELECT sdesc as result FROM '.sql_table('plug_multiple_categories_sub').' WHERE scatid='.intval($id));
241+ }
242+
243+ function _getScatIDFromName($name) {
244+ return quickQuery('SELECT scatid as result FROM '.sql_table('plug_multiple_categories_sub').' WHERE sname="'.addslashes($name).'"');
245+ }
246+
247+ function _getParentCatID($id) {
248+ return quickQuery('SELECT catid as result FROM '.sql_table('plug_multiple_categories_sub').' WHERE scatid='.intval($id));
249+ }
250+
251+ function _getScatMap($numarray) {
252+ $aResult = array();
253+ $numstr = implode(",",array_map("intval",$numarray));
254+ //<sato(na)t1855>
255+ $numstr = $this->permuteSubcategories($numstr);
256+ //$res = sql_query("SELECT catid, scatid, sname FROM ". sql_table("plug_multiple_categories_sub") ." WHERE scatid in (".$numstr.")");
257+ $sql_str = "SELECT catid, scatid, sname FROM ". sql_table("plug_multiple_categories_sub").
258+ " WHERE scatid in (".$numstr.") ORDER BY FIND_IN_SET(scatid,'".$numstr."')";
259+ $res = sql_query($sql_str);
260+ //</sato(na)t1855>
261+ while ($o = mysql_fetch_object($res)) {
262+ if (!isset($aResult[$o->catid])) $aResult[$o->catid] = array();
263+ $aResult[$o->catid][$o->scatid] = $o->sname;
264+ }
265+ return $aResult;
266+ }
267+
268+ function _getMultiCategories($itemid){
269+ $query = "SELECT categories FROM ".sql_table('plug_multiple_categories')." WHERE item_id=".intval($itemid);
270+ $result = sql_query($query);
271+ if(mysql_num_rows($result)==0) return;
272+ $row = mysql_fetch_row($result);
273+ return $row[0];
274+ }
275+
276+ function _getSubCategories($itemid){
277+ $query = "SELECT subcategories FROM ".sql_table('plug_multiple_categories')." WHERE item_id=".intval($itemid);
278+ $result = sql_query($query);
279+ if(mysql_num_rows($result)==0) return;
280+ $row = mysql_fetch_row($result);
281+ return $row[0];
282+ }
283+ //<sato(na)t1855>
284+ function _setSubOrder(){
285+ $subOrderString = substr($this->_getSubOrder(0), 1);
286+ return explode(",", $subOrderString);
287+ }
288+ function _getSubOrder($pid){
289+ $sql_str = 'SELECT scatid FROM '.sql_table('plug_multiple_categories_sub').' WHERE parentid='.$pid.' ORDER BY ordid';
290+ $qid_scat = mysql_query($sql_str);
291+ if ($qid_scat === FALSE) return ''; //<sato(na)0.403j />
292+ $scat_str = '';
293+ while ($row_scat = mysql_fetch_object($qid_scat)) $scat_str .= ',' . $row_scat->scatid . $this->_getSubOrder($row_scat->scatid);
294+ return $scat_str;
295+ }
296+ function permuteSubcategories($subcategories){
297+ $itemScats = explode(",", $subcategories);
298+ $retArray = array_intersect($this->subOrderArray, $itemScats);
299+ $ret = implode(",", $retArray);
300+ return $ret;
301+ }
302+ //</sato(na)t1855>
303+ //<sato(na)0.402j>
304+ function doAction($type) {
305+ $catid = intRequestVar('catid');
306+ $subcatid = intRequestVar('subcatid');
307+ echo '
308+function orderKey(key, sequence) {
309+ var scatDat = new Array();';
310+ $query = "SELECT scatid, sname, sdesc FROM ".sql_table('plug_multiple_categories_sub')." WHERE parentid=$subcatid AND catid=$catid";
311+ $res = sql_query($query);
312+ $i = 0;
313+ while($row = mysql_fetch_array($res)) {
314+ echo 'scatDat['.($i++).'] = new setScatDat('.$row['scatid'].' , "'.$row['sname'].'", "'.$row['sdesc'].'");'."\n";
315+ }
316+ echo '
317+ scatDat.sort(eval("sort" + key + sequence));
318+ scatListRefresh(scatDat);
319+}';
320+ }
321+ //</sato(na)0.402j>
322+
323+ function _getItemObject($id) {
324+ $res = sql_query("SELECT inumber as itemid, icat as catid FROM ".sql_table('item')." WHERE inumber=".intval($id));
325+ if ($res) {
326+ return mysql_fetch_object($res);
327+ }
328+ }
329+
330+ function event_AddItemFormExtras($data) {
331+ $aCategories = $this->_getCategories($data['blog']->blogid);
332+ if(count($aCategories) > 1) {
333+ $this->showForm($aCategories,$data['itemid']);
334+ } elseif (count($aCategories) > 0) {
335+ $this->showSubForm($aCategories,$data['itemid']);
336+ }
337+ }
338+
339+ function event_EditItemFormExtras($data) {
340+ $aCategories = $this->_getCategories($data['blog']->blogid);
341+ if(count($aCategories) > 1) {
342+ $this->showForm($aCategories,$data['itemid']);
343+ } elseif (count($aCategories) > 0) {
344+ $this->showSubForm($aCategories,$data['itemid']);
345+ }
346+ }
347+
348+ function showSubForm($aCategories, $itemid) {
349+ $aDefinedScats = $this->_getDefinedScats($aCategories[0]['catid']);
350+ if (!count($aDefinedScats)) return;
351+
352+ $itemScats = array();
353+ if($subcatlist = $this->_getSubCategories($itemid))
354+ $itemScats = explode(",",$subcatlist);
355+
356+ //<sato(na)>$snum = 0;</sato(na)>
357+ echo '<h3>Multiple Categories</h3>';
358+ echo "<fieldset><legend>Sub Categories</legend>";
359+ //<sato(na)>
360+ $sql_str = 'SELECT * FROM '.sql_table('plug_multiple_categories_sub').' WHERE catid='.$aCategories[0]['catid'].' AND parentid=0';
361+ $qid = sql_query($sql_str);
362+ while ($aSub = mysql_fetch_assoc($qid)) {
363+ $schecked = (in_array($aSub['scatid'], $itemScats)) ? " checked=checked" : "";
364+ echo '<input type="checkbox" id="npmc_scat'.$aSub['scatid'].'" name="npmc_scat['.$aSub['scatid'].']"'.$schecked.' value="'.$aSub['scatid'].'" />';
365+ echo '<label for="npmc_scat'.$aSub['scatid'].'">'.htmlspecialchars($aSub['sname']).'</label><br />';
366+ echo $this->showFormHierarchical($aSub['scatid'], $itemScats);
367+ }
368+ //</sato(na)>
369+ echo "</fieldset>";
370+ }
371+
372+ function showForm($aCategories,$itemid) {
373+ $itemcats = array();
374+ $itemScats = array();
375+ if($multicatlist = $this->_getMultiCategories($itemid))
376+ $itemcats = explode(",",$multicatlist);
377+ if($subcatlist = $this->_getSubCategories($itemid))
378+ $itemScats = explode(",",$subcatlist);
379+
380+ echo '<h3 style="margin-bottom:0px;">Multiple Categories</h3>';
381+ $num = 0;
382+ //<sato(na)>
383+ //$snum = 0;
384+ echo '<div style="height: 300px;overflow: auto;"><table><tbody>';
385+ //</sato(na)>
386+ foreach ($aCategories as $aCategory){
387+ $checked = "";
388+ if(in_array($aCategory['catid'],$itemcats)) $checked = " checked=checked";
389+ echo '<tr><td>';
390+ echo '<input type="checkbox" id="npmc_cat'.$num.'" name="npmc_cat['.$num.']"'.$checked.' value="'.$aCategory['catid'].'" />';
391+ echo '<label for="npmc_cat'.$num.'">'.htmlspecialchars($aCategory['name']);
392+ if ($aCategory['cdesc']) echo "(".$aCategory['cdesc'].")";
393+ echo '</label>';
394+ $num ++;
395+ //<sato(na)>
396+ $sql_str = 'SELECT * FROM '.sql_table('plug_multiple_categories_sub').' WHERE catid='.$aCategory['catid'].' AND parentid=0';
397+ $qid = sql_query($sql_str);
398+ if (mysql_num_rows($qid)) {
399+ echo "<fieldset style=\"margin-left:1.5em;border:none\">";
400+ while ($aSub = mysql_fetch_assoc($qid)) {
401+ $schecked = (in_array($aSub['scatid'], $itemScats)) ? " checked=checked" : "";
402+ echo '<input type="checkbox" id="npmc_scat'.$aSub['scatid'].'" name="npmc_scat['.$aSub['scatid'].']"'.$schecked.' value="'.$aSub['scatid'].'" />';
403+ echo '<label for="npmc_scat'.$aSub['scatid'].'">'.htmlspecialchars($aSub['sname']).'</label><br />';
404+ echo $this->showFormHierarchical($aSub['scatid'], $itemScats);
405+ }
406+ echo "</fieldset>";
407+ }
408+ //</sato(na)>
409+ echo "</td></tr>";
410+ }
411+ echo "</tbody></table></div>";//<sato(na) />
412+ }
413+ //<sato(na)>
414+ function showFormHierarchical($parentid, $itemScats) {
415+ $qid = sql_query('SELECT * FROM '.sql_table('plug_multiple_categories_sub').' WHERE parentid='.intval($parentid));
416+ if (mysql_num_rows($qid)){
417+ echo "<div style=\"margin-left:3em;border:none\">";
418+ while ($aSub = mysql_fetch_assoc($qid)) {
419+ $schecked = (in_array($aSub['scatid'], $itemScats)) ? " checked=checked" : "";
420+ echo '<input type="checkbox" id="npmc_scat'.$aSub['scatid'].'" name="npmc_scat['.$aSub['scatid'].']"'.$schecked.' value="'.$aSub['scatid'].'" />';
421+ echo '<label for="npmc_scat'.$aSub['scatid'].'">'.htmlspecialchars($aSub['sname']).'</label><br />';
422+ echo $this->showFormHierarchical($aSub['scatid'], $itemScats);
423+ }
424+ echo "</div>";
425+ }
426+ }
427+ //</sato(na)>
428+
429+ function event_PostAddItem($data) {
430+ $selected = requestIntArray('npmc_cat');
431+ $s_selected = requestIntArray('npmc_scat');
432+ if (count($selected) == 0 && count($s_selected) == 0) return;
433+
434+ $pcatid = quickQuery("SELECT icat as result FROM ".sql_table('item')." WHERE inumber=".intval($data['itemid']));
435+
436+ $this->updateData($data['itemid'], $pcatid, $selected, $s_selected);
437+ }
438+
439+ function event_PreUpdateItem($data) {
440+ $selected = requestIntArray('npmc_cat');
441+ $s_selected = requestIntArray('npmc_scat');
442+
443+ if(($this->_getMultiCategories($data['itemid']) || $this->_getSubCategories($data['itemid'])) && count($selected) == 0 && count($s_selected) == 0 ){
444+ sql_query('DELETE FROM ' . sql_table('plug_multiple_categories') . ' WHERE item_id=' . intval($data['itemid']));
445+ return;
446+ } elseif (count($selected) == 0 && count($s_selected) == 0) {
447+ return;
448+ }
449+
450+ $this->updateData($data['itemid'],$data['catid'],$selected,$s_selected);
451+ }
452+
453+ function updateData($itemid, $pcatid, $selected, $s_selected) {
454+ $value = "";
455+ $aMulti = array();
456+ $aSub = array();
457+ if (is_array($selected) && count($selected) > 0) {
458+ $aMulti = $selected;
459+ }
460+
461+ if (is_array($s_selected) && count($s_selected) > 0) {
462+ foreach ($s_selected as $v) {
463+ $v = intval($v);
464+ $mycatid = $this->_getParentCatID($v);
465+ if ($mycatid) {
466+ $aSub[] = $v;
467+ if (!in_array($mycatid,$aMulti)) {
468+ $aMulti[] = $mycatid;
469+ }
470+ }
471+ }
472+ }
473+
474+ if (count($aMulti) > 0) {
475+ $aMulti = array_map("intval",$aMulti);
476+ $cat_string = join(",",$aMulti);
477+ $value .= ', "'.addslashes($cat_string).'"';
478+ } else {
479+ $value .= ', ""';
480+ }
481+
482+ if (count($aSub) > 0) {
483+ $scat_string = join(",",$aSub);
484+ $value .= ', "'.addslashes($scat_string).'"';
485+ } else {
486+ $value .= ', ""';
487+ }
488+
489+ $query = 'REPLACE INTO '.sql_table('plug_multiple_categories').' (item_id,categories,subcategories) VALUES('.intval($itemid).$value.');';
490+ sql_query($query);
491+ }
492+
493+ function event_PostDeleteItem($data){
494+ $query = 'DELETE FROM ' . sql_table('plug_multiple_categories') . ' WHERE item_id=' . intval($data['itemid']);
495+ sql_query($query);
496+ }
497+
498+ function event_PostDeleteCategory($data) {
499+ $catid = intval($data['catid']);
500+ $subcats = $this->_getScatIDs($catid);
501+ if (count($subcats > 0)) {
502+ sql_query("DELETE FROM ". sql_table("plug_multiple_categories_sub") ." WHERE catid=$catid");
503+ }
504+
505+ $query = "SELECT categories, subcategories, item_id FROM ". sql_table("plug_multiple_categories") ." WHERE categories REGEXP '(^|,)$catid(,|$)'";
506+ if (count($subcats > 0)) {
507+ $query .= " or subcategories REGEXP '(^|,)(".implode("|",$subcats).")(,|$)'";
508+ }
509+ $res = sql_query($query);
510+ $del = array();
511+ $up = array();
512+
513+ while ($o = mysql_fetch_object($res)) {
514+ $o->categories = preg_replace("/^(?:(.*),)?$catid(?:,(.*))?$/","$1,$2",$o->categories);
515+ $o->subcategories = preg_replace("/^(?:(.*),)?$catid(?:,(.*))?$/","$1,$2",$o->subcategories);
516+ if ((!$o->categories || $o->categories == ',') && (!$o->subcategories || $o->subcategories == ',')) {
517+ $del[] = $o->item_id;
518+ } else {
519+ $o->categories = preg_replace("/(^,+|(?<=,),+|,+$)/","",$o->categories);
520+ $o->subcategories = preg_replace("/(^,+|(?<=,),+|,+$)/","",$o->subcategories);
521+ $up[] = "UPDATE ". sql_table("plug_multiple_categories") ." SET categories='".addslashes($o->categories)."', subcategories='".addslashes($o->subcategories)."' WHERE item_id=".$o->item_id;
522+ }
523+ }
524+
525+ if (count($del) > 0) {
526+ sql_query("DELETE FROM ". sql_table("plug_multiple_categories") . " WHERE item_id in (".implode(",",$del).")");
527+ }
528+ if (count($up) > 0) {
529+ foreach ($up as $v) {
530+ sql_query($v);
531+ }
532+ }
533+ }
534+
535+ function doSKinVar(){
536+ global $blog, $catid, $CONF, $manager, $itemid, $subcatid, $startpos, $archive;
537+
538+ $params = func_get_args();
539+ // item skin
540+ if ($params[0] == 'item' && $params[1] != "1") {
541+ if ($itemid) $this->_parseItem($params[1], $itemid);
542+ return;
543+ }
544+
545+ if (intval($params[1]) == 1) {
546+ switch ($params[2]) {
547+ case 'id':
548+ if (!$subcatid || !$catid) return;
549+ echo $subcatid;
550+ return;
551+ break;
552+ case 'desc':
553+ if (!$subcatid || !$catid) return;
554+ echo htmlspecialchars($this->_getScatDescFromID($subcatid));
555+ return;
556+ break;
557+ case 'name':
558+ if (!$subcatid || !$catid) return;
559+ echo htmlspecialchars($this->_getScatNameFromID($subcatid));
560+ return;
561+ break;
562+ case 'url':
563+ if (!$subcatid || !$catid) return;
564+ if ($blog) {
565+ $b =& $blog;
566+ } else {
567+ $b =& $manager->getBlog($CONF['DefaultBlog']);
568+ }
569+ $this->_setCommonData($b->getID());
570+ $sparams = array_merge($this->param,array($this->getRequestName() => $subcatid));
571+ $url = createCategoryLink($catid, $sparams);
572+ if ($CONF['URLMode'] != 'pathinfo') {
573+ list(,$temp_param) = explode("?",$url);
574+ $url = $this->url. "?" . $temp_param;
575+ }
576+ echo $url;
577+ return;
578+ break;
579+ case 'link':
580+ if ($params[0] != 'item') return;
581+ $item = $this->_getItemObject($itemid);
582+ if ($item) {
583+ $this->doTemplateVar(&$item);
584+ }
585+ return;
586+ break;
587+ case 'archivelink':
588+ if ($blog) {
589+ $b =& $blog;
590+ } else {
591+ $b =& $manager->getBlog($CONF['DefaultBlog']);
592+ }
593+ $bid = $b->getID();
594+ $this->_setCommonData($bid);
595+ $cur_params = array();
596+ if ($catid) $cur_params['catid'] = $catid;
597+ if ($subcatid) {
598+ $rname = $this->getRequestName();
599+ $cur_params[$rname] = $subcatid;
600+ }
601+ $url = createArchiveListLink($bid, $cur_params);
602+ if ($CONF['URLMode'] != 'pathinfo') {
603+ list(,$temp_param) = explode("?",$url);
604+ $url = $this->url. "?" . $temp_param;
605+ }
606+ echo $url;
607+ return;
608+ break;
609+ case 'categorylist':
610+ $this->showCategoryList();
611+ return;
612+ break;
613+ case 'archivelist':
614+ $arcmode = 'month';
615+ if (isset($params[3]) && $params[3] == 'day') {
616+ $arcmode = 'day';
617+ }
618+ $limit = 0;
619+ if (isset($params[4]) && intval($params[4])) {
620+ $arclimit = intval($params[4]);
621+ }
622+ $this->showArchiveList($arcmode,$arclimit);
623+ return;
624+ break;
625+ }
626+ }
627+
628+ if ($blog) {
629+ $b =& $blog;
630+ } else {
631+ $b =& $manager->getBlog($CONF['DefaultBlog']);
632+ }
633+
634+ $mycatid = 0;
635+ if ($catid) $mycatid = $catid;
636+ $mysubcatid = 0;
637+ if ($subcatid) $mysubcatid = $subcatid;
638+ $templateName = $params[1];
639+ $amountEntries = 0;
640+ $offset = 0;
641+ if (isset($params[2])) {
642+ list($amountEntries, $offset) = sscanf($params[2], '%d(%d)');
643+ if ($offset) {
644+ $startpos += $offset;
645+ }
646+ }
647+ if (isset($params[3]) && $params[3])
648+ $mycatid = getCatIDFromName($params[3]);
649+ if (isset($params[4]) && $params[4])
650+ $mysubcatid = $this->_getScatIDFromName($params[4]);
651+
652+ if (!$templateName) $templateName = 'grey/short';
653+ if (!$amountEntries) $amountEntries = 10;
654+
655+ $mycatid = intval($mycatid);
656+ $mysubcatid = intval($mysubcatid);
657+ if (!$mycatid && $mysubcatid) $mysubcatid = 0;
658+
659+ $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, c.cname as category, i.icat as catid, i.iclosed as closed' ;
660+ $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c';
661+
662+ if ($mycatid) {
663+ $query .= ' LEFT JOIN '.sql_table('plug_multiple_categories').' as p ON i.inumber=p.item_id';
664+ }
665+
666+ $query .= ' WHERE i.iauthor=m.mnumber'
667+ . ' and i.iblog='.$b->getID()
668+ . ' and i.icat=c.catid'
669+ . ' and i.idraft=0';
670+ if ($params[0] == 'archive' && $archive) {
671+ sscanf($archive,'%d-%d-%d',$y,$m,$d);
672+ if ($d) {
673+ $timestamp_start = mktime(0,0,0,$m,$d,$y);
674+ $timestamp_end = mktime(0,0,0,$m,$d+1,$y);
675+ } else {
676+ $timestamp_start = mktime(0,0,0,$m,1,$y);
677+ $timestamp_end = mktime(0,0,0,$m+1,1,$y);
678+ }
679+
680+ $query .= ' and i.itime>=' . mysqldate($timestamp_start)
681+ . ' and i.itime<' . mysqldate($timestamp_end);
682+
683+ } else {
684+ $query .= ' and i.itime<=' . mysqldate($b->getCorrectTime());
685+ }
686+
687+ if ($mycatid) {
688+ $query .= ' and ((i.inumber=p.item_id and (p.categories REGEXP "(^|,)'.$mycatid.'(,|$)" or i.icat='.$mycatid.')) or (i.icat='.$mycatid.' and p.item_id IS NULL))';
689+ }
690+ if ($mysubcatid) {
691+ $query .= ' and p.subcategories REGEXP "(^|,)'.$mysubcatid.'(,|$)"';
692+ }
693+
694+ $query .= ' ORDER BY i.itime DESC';
695+
696+ $query .= ' LIMIT ' . intval($startpos).',' . intval($amountEntries);
697+
698+ $b->showUsingQuery($templateName, $query, 0, 1, 1);
699+ }
700+
701+
702+ function doTemplateCommentsVar(&$item, &$comment, $what='') {
703+ if ($what == 'itemlink') {
704+ $this->doTemplateVar(&$item, $what);
705+ }
706+ }
707+
708+ function doTemplateVar(&$item, $what='') {
709+ global $CONF, $catid, $subcatid;
710+
711+ $bid = getBlogIDFromItemID($item->itemid);
712+ if (!isset($this->defurl)) $this->_setCommonData($bid);
713+ if ($bid != $this->bid) $this->_setBlogData($bid);
714+
715+ if ($what == 'itemlink') {
716+ $sparams = array();
717+ if ($catid) {
718+ $sparams['catid'] = $catid;
719+ if ($subcatid) {
720+ $sparams[$this->getRequestName()] = $subcatid;
721+ }
722+ }
723+ $url = createItemLink($item->itemid, $sparams);
724+ if ($CONF['URLMode'] != 'pathinfo') {
725+ list(,$temp_param) = explode("?",$url);
726+ $url = $this->url. "?" . $temp_param;
727+ }
728+ echo $url;
729+ return;
730+ }
731+
732+ $url = createCategoryLink($item->catid, $this->param);
733+ if ($CONF['URLMode'] != 'pathinfo') {
734+ list(,$temp_param) = explode("?",$url);
735+ $url = $this->url. "?" . $temp_param;
736+ }
737+ $mcat_string = '<a href="'.$url.'">'.htmlspecialchars($this->_getCatNameFromID($item->catid)).'</a>';
738+
739+ $itemScats = array();
740+ if ($itemscatstr = $this->_getSubCategories($item->itemid)) {
741+ $itemScats = explode(",",$itemscatstr);
742+ $scatMaps = $this->_getScatMap($itemScats);
743+ }
744+ if ($itemscatstr && array_key_exists($item->catid,$scatMaps)) {
745+ $extra_scat_string = array();
746+ foreach ($scatMaps[$item->catid] as $id => $name) {
747+ if ($CONF['URLMode'] == 'pathinfo') {
748+ $sparams = array_merge($this->param, array($this->getRequestName() => $id));
749+ $surl = createCategoryLink($item->catid, $sparams);
750+ } else {
751+ $surl = addLinkParams($url,array($this->getRequestName() => $id));
752+ }
753+ $extra_scat_string[] = '<a href="'.$surl.'">'.htmlspecialchars($name).'</a>';
754+ }
755+ $scat_string = implode($this->ssep,$extra_scat_string);
756+ $cat_string = str_replace(array("<%category%>","<%subcategory%>"), array($mcat_string,$scat_string), $this->sform);
757+ } else {
758+ $cat_string = $mcat_string;
759+ }
760+
761+ if ($multicatstr = $this->_getMultiCategories($item->itemid)) {
762+ $itemcats = explode(",",$multicatstr);
763+ $extra_cat_string = array();
764+ foreach ($itemcats as $icat){
765+ if ($icat != $item->catid) {
766+ $url = createCategoryLink($icat,$this->param);
767+ if ($CONF['URLMode'] != 'pathinfo') {
768+ list(,$temp_param) = explode("?",$url);
769+ $url = $this->url. "?" . $temp_param;
770+ }
771+ $mcat_string = '<a href="'.$url.'">'.htmlspecialchars($this->_getCatNameFromID($icat)).'</a>';
772+
773+ if (count($itemScats) > 0 && array_key_exists($icat,$scatMaps)) {
774+ $extra_scat_string = array();
775+ foreach ($scatMaps[$icat] as $id => $name) {
776+ if ($CONF['URLMode'] == 'pathinfo') {
777+ $sparams = array_merge($this->param, array($this->getRequestName() => $id));
778+ $surl = createCategoryLink($icat,$sparams);
779+ } else {
780+ $surl = addLinkParams($url,array($this->getRequestName() => $id));
781+ }
782+ $extra_scat_string[] = '<a href="'.$surl.'">'.htmlspecialchars($name).'</a>';
783+ }
784+ $scat_string = implode($this->ssep,$extra_scat_string);
785+ $extra_cat_string[] = str_replace(array("<%category%>","<%subcategory%>"), array($mcat_string,$scat_string), $this->sform);
786+ } else {
787+ $extra_cat_string[] = $mcat_string;
788+ }
789+ }
790+ }
791+ if (count($extra_cat_string) > 0) {
792+ $cat_string .= $this->msep . join($this->ssep,$extra_cat_string);
793+ }
794+ }
795+ echo $cat_string;
796+ }
797+
798+ function _setCommonData($bid) {
799+ global $CONF;
800+ $this->msep = $this->getOption('mainsep');
801+ $this->ssep = $this->getOption('addsep');
802+ $this->sform = $this->getOption('subformat');
803+ $this->addindex = ($this->getOption('addindex') == 'yes');
804+ $this->addbiddef = ($this->getOption('addblogid_def') == 'yes');
805+ $this->addbid = ($this->getOption('addblogid') == 'yes');
806+ $this->defurl = quickQuery("SELECT burl as result from ".sql_table('blog')." WHERE bnumber=".$CONF['DefaultBlog']);
807+ if (!$this->defurl) $this->defurl = $CONF['Self'];
808+ $this->_setBlogData($bid);
809+ }
810+
811+ function _setBlogData($bid) {
812+ global $CONF;
813+ $this->param = array();
814+ $this->bid = intval($bid);
815+ if ($bid != $CONF['DefaultBlog']) {
816+ $this->url = quickQuery("SELECT burl as result from ".sql_table('blog')." WHERE bnumber=".$this->bid);
817+ if (!$this->url) $this->url = $this->defurl;
818+ } else {
819+ $this->url = $this->defurl;
820+ }
821+ if ($CONF['URLMode'] == 'normal' && substr($this->url,-1) == "/" && $this->addindex) {
822+ $this->url .= "index.php";
823+ }
824+ if ($this->bid == $CONF['DefaultBlog'] && $this->addbiddef) {
825+ $this->param['blogid'] = $this->bid;
826+ } elseif ($this->bid != $CONF['DefaultBlog'] && ($this->url == $this->defurl || $this->addbid)){
827+ $this->param['blogid'] = $this->bid;
828+ }
829+ }
830+
831+ function _parseItem($template, $itemid) {
832+ global $manager;
833+
834+ $b =& $manager->getBlog(getBlogIDFromItemID($itemid));
835+
836+ $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';
837+
838+ $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
839+ . ' WHERE i.iblog='.$b->getID()
840+ . ' and i.iauthor=m.mnumber'
841+ . ' and i.icat=c.catid'
842+ . ' and i.idraft=0' // exclude drafts
843+ // don't show future items
844+ . ' and i.itime<=' . mysqldate($b->getCorrectTime())
845+ . ' and i.inumber='.intval($itemid)
846+ . ' ORDER BY i.itime DESC LIMIT 0,1';
847+
848+ $b->showUsingQuery($template, $query, 0, 0, 0);
849+
850+ }
851+
852+ function showCategoryList() {
853+ global $CONF, $manager, $blog, $catid, $subcatid;
854+ global $archive, $archivelist;
855+
856+ if ($blog) {
857+ $b =& $blog;
858+ } else {
859+ $b =& $manager->getBlog($CONF['DefaultBlog']);
860+ }
861+ $blogid = $b->getID();
862+
863+ if (!isset($this->defurl)) $this->_setCommonData($blogid);
864+
865+ $linkparams = array();
866+ if ($archive) {
867+ $blogurl = createArchiveLink($blogid, $archive, '');
868+ if ($CONF['URLMode'] != 'pathinfo') {
869+ list(,$temp_param) = explode("?",$url);
870+ $blogurl = $this->url. "?" . $temp_param;
871+ }
872+ $linkparams['blogid'] = $blogid;
873+ $linkparams['archive'] = $archive;
874+ } else if ($archivelist) {
875+ $blogurl = createArchiveListLink($blogid, '');
876+ if ($CONF['URLMode'] != 'pathinfo') {
877+ list(,$temp_param) = explode("?",$blogurl);
878+ $blogurl = $this->url. "?" . $temp_param;
879+ }
880+ $linkparams['archivelist'] = $archivelist;
881+ } else {
882+ $blogurl = $this->url;
883+ $linkparams = $this->param;
884+ }
885+
886+
887+ echo TEMPLATE::fill($this->getOption('catheader'),
888+ array(
889+ 'blogid' => $blogid,
890+ 'blogurl' => $blogurl,
891+ 'self' => $CONF['Self']
892+ ));
893+
894+ $query = 'SELECT c.catid, c.cdesc as catdesc, c.cname as catname FROM '.sql_table('category').' as c WHERE c.cblog=' . $blogid . ' GROUP BY c.cname ORDER BY c.cname ASC';
895+ $res = sql_query($query);
896+
897+ $tp = array();
898+ $tp['catlist'] = $this->getOption('catlist');
899+ $tp['subheader'] = $this->getOption('subheader');
900+ $tp['sublist'] = $this->getOption('sublist');
901+ $tp['subfooter'] = $this->getOption('subfooter');
902+ $replace = ($this->getOption('replace') == 'yes');
903+ if ($replace) {
904+ $rchar = $this->getOption('replacechar');
905+ }
906+
907+ while ($data = mysql_fetch_assoc($res)) {
908+ $data['blogid'] = $blogid;
909+ $data['blogurl'] = $blogurl;
910+ $data['catlink'] = createCategoryLink($data['catid'], $linkparams);
911+ if ($CONF['URLMode'] != 'pathinfo') {
912+ list(,$temp_param) = explode("?",$data['catlink']);
913+ $data['catlink'] = $this->url. "?" . $temp_param;
914+ }
915+ $data['self'] = $CONF['Self'];
916+ if ($data['catid'] == $catid) {
917+ $data['catflag'] = $this->getOption('catflag');
918+ }
919+ $cq = 'SELECT count(*) as result FROM '.sql_table('item').' as i';
920+ $cq .= ' LEFT JOIN '.sql_table('plug_multiple_categories').' as p ON i.inumber=p.item_id';
921+ $cq .= ' WHERE ((i.inumber=p.item_id and (p.categories REGEXP "(^|,)'.$data['catid'].'(,|$)" or i.icat='.$data['catid'].')) or (p.item_id IS NULL and i.icat='.$data['catid'].'))';
922+ $cq .= ' and i.itime<=' . mysqldate($b->getCorrectTime()) . ' and i.idraft=0';
923+
924+ $data['catamount'] = quickQuery($cq);
925+ if (intval($data['catamount']) < 1) {
926+ continue;
927+ }
928+
929+ $query = 'SELECT scatid as subcatid, sname as subname, sdesc as subdesc FROM '.sql_table('plug_multiple_categories_sub').' WHERE catid='.$data['catid']. ' ORDER BY sname ASC';
930+ $sres = sql_query($query);
931+ if (mysql_num_rows($sres) > 0) {
932+ $subliststr = "";
933+
934+ while ($sdata = mysql_fetch_assoc($sres)) {
935+ $ares = sql_query(
936+ 'SELECT count(i.inumber) FROM '
937+ . sql_table('item').' as i, '
938+ . sql_table('plug_multiple_categories').' as p'
939+ . ' WHERE i.idraft=0 and i.itime<='.mysqldate($b->getCorrectTime())
940+ . ' and i.inumber=p.item_id'
941+ . ' and p.subcategories REGEXP "(^|,)'.$sdata['subcatid'].'(,|$)"'
942+ );
943+ if ($ares && $row = mysql_fetch_row($ares)) {
944+ $sdata['subamount'] = $row[0];
945+ if ($sdata['subamount'] > 0) {
946+ if ($CONF['URLMode'] == 'pathinfo') {
947+ $sparams = array_merge($linkparams, array($this->getRequestName() => $sdata['subcatid']));
948+ $sdata['sublink'] = createCategoryLink($data['catid'],$sparams);
949+ } else {
950+ $sdata['sublink'] = addLinkParams($data['catlink'], array($this->getRequestName() => $sdata['subcatid']));
951+ }
952+ if ($sdata['subcatid'] == $subcatid) {
953+ $sdata['subflag']= $this->getOption('subflag');
954+ }
955+ $subliststr .= TEMPLATE::fill($tp['sublist'],$sdata);
956+ }
957+ }
958+ }
959+ if ($subliststr) {
960+ $data['subcategorylist'] = $tp['subheader'];
961+ $data['subcategorylist'] .= $subliststr;
962+ $data['subcategorylist'] .= $tp['subfooter'];
963+ if ($replace) {
964+ $data['amount'] = $rchar;
965+ }
966+ }
967+ }
968+ mysql_free_result($sres);
969+
970+ echo TEMPLATE::fill($tp['catlist'],$data);
971+
972+ }
973+
974+ mysql_free_result($res);
975+
976+ echo TEMPLATE::fill($this->getOption('catfooter'),
977+ array(
978+ 'blogid' => $blogid,
979+ 'blogurl' => $blogurl,
980+ 'self' => $CONF['Self']
981+ ));
982+ }
983+
984+ function showArchiveList($mode = 'month', $limit = 0) {
985+ global $CONF, $manager, $blog, $catid, $subcatid;
986+
987+ if ($blog) {
988+ $b =& $blog;
989+ } else {
990+ $b =& $manager->getBlog($CONF['DefaultBlog']);
991+ }
992+
993+ if ($catid) $linkparams = array('catid' => $catid);
994+ if ($subcatid) $linkparams['subcatid'] = $subcatid;
995+ if ($lc = $this->getOption('locale')) {
996+ setlocale(LC_TIME,$lc);
997+ }
998+
999+ $template['header'] = $this->getOption('archeader');
1000+ $template['list'] = $this->getOption('arclist');
1001+ $template['footer'] = $this->getOption('arcfooter');
1002+
1003+ echo TEMPLATE::fill($template['header'],array('blogid'=>$b->getID()));
1004+
1005+ $query = 'SELECT i.itime, SUBSTRING(i.itime,1,4) AS Year, SUBSTRING(i.itime,6,2) AS Month, SUBSTRING(i.itime,9,2) as Day FROM '.sql_table('item').' as i';
1006+ if ($catid) {
1007+ $query .= ' LEFT JOIN '.sql_table('plug_multiple_categories').' as p ON i.inumber=p.item_id';
1008+ }
1009+ $query .= ' WHERE i.iblog=' . $b->getID()
1010+ . ' and i.itime <=' . mysqldate($b->getCorrectTime()) // don't show future items!
1011+ . ' and i.idraft=0'; // don't show draft items
1012+
1013+ if ($catid) {
1014+ $query .= ' and ((i.inumber=p.item_id and (p.categories REGEXP "(^|,)'.intval($catid).'(,|$)" or i.icat='.intval($catid).')) or (i.icat='.intval($catid).' and p.item_id IS NULL))';
1015+ }
1016+ if ($subcatid) {
1017+ $query .= ' and p.subcategories REGEXP "(^|,)'.intval($subcatid).'(,|$)"';
1018+ }
1019+
1020+ $query .= ' GROUP BY Year, Month';
1021+ if ($mode == 'day')
1022+ $query .= ', Day';
1023+
1024+ $query .= ' ORDER BY i.itime DESC';
1025+
1026+ if ($limit > 0)
1027+ $query .= ' LIMIT ' . intval($limit);
1028+
1029+ $res = sql_query($query);
1030+
1031+ while ($current = mysql_fetch_object($res)) {
1032+ $current->itime = strtotime($current->itime); // string time -> unix timestamp
1033+ $data = array('blogid'=>$b->getID());
1034+
1035+ if ($mode == 'day') {
1036+ $archivedate = date('Y-m-d',$current->itime);
1037+ $data['day'] = date('d',$current->itime);
1038+ } else {
1039+ $archivedate = date('Y-m',$current->itime);
1040+ }
1041+ $data['month'] = date('m',$current->itime);
1042+ $data['year'] = date('Y',$current->itime);
1043+ $data['archivelink'] = createArchiveLink($b->getID(),$archivedate,$linkparams);
1044+ if ($CONF['URLMode'] != 'pathinfo') {
1045+ list(,$temp_param) = explode("?",$data['archivelink']);
1046+ $data['archivelink'] = $this->url. "?" . $temp_param;
1047+ }
1048+
1049+ $temp = TEMPLATE::fill($template['list'], $data);
1050+ echo strftime($temp,$current->itime);
1051+ }
1052+ mysql_free_result($res);
1053+
1054+ echo TEMPLATE::fill($template['footer'],array('blogid'=>$b->getID()));
1055+ }
1056+
1057+}
1058+?>
\ No newline at end of file
Show on old repository browser