OSDN Git Service

Update project date from '2002 - 2009' to '2002 - 2010'.
[nucleus-jp/nucleus-jp-ancient.git] / utf8 / nucleus / libs / showlist.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2010 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12 /**
13  * Functions to create lists of things inside the admin are
14  *
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-2010 The Nucleus Group
17  * @version $Id$
18  * @version $NucleusJP: showlist.php,v 1.7.2.3 2007/12/03 00:01:48 kmorimatsu Exp $
19  */
20
21
22 // can take either an array of objects, or an SQL query
23 function showlist($query, $type, $template) {
24
25         if (is_array($query)) {
26                 if (sizeof($query) == 0)
27                         return 0;
28
29                 call_user_func('listplug_' . $type, $template, 'HEAD');
30
31                 foreach ($query as $currentObj) {
32                         $template['current'] = $currentObj;
33                         call_user_func('listplug_' . $type, $template, 'BODY');
34                 }
35
36                 call_user_func('listplug_' . $type, $template, 'FOOT');
37
38                 return sizeof($query);
39
40         } else {
41                 $res = sql_query($query);
42
43                 // don't do anything if there are no results
44                 $numrows = sql_num_rows($res);
45                 if ($numrows == 0)
46                         return 0;
47
48                 call_user_func('listplug_' . $type, $template, 'HEAD');
49
50                 while($template['current'] = sql_fetch_object($res))
51                         call_user_func('listplug_' . $type, $template, 'BODY');
52
53                 call_user_func('listplug_' . $type, $template, 'FOOT');
54
55                 sql_free_result($res);
56
57                 // return amount of results
58                 return $numrows;
59         }
60 }
61
62 function listplug_select($template, $type) {
63         switch($type) {
64                 case 'HEAD':
65                         echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . '>';
66
67                         // add extra row if needed
68                         if (ifset($template['extra'])) {
69                                 echo '<option value="', ifset($template['extraval']), '">', $template['extra'], '</option>';
70                         }
71
72                         break;
73                 case 'BODY':
74                         $current = $template['current'];
75
76                         echo '<option value="' . htmlspecialchars($current->value) . '"';
77                         if ($template['selected'] == $current->value)
78                                 echo ' selected="selected" ';
79                         if (isset($template['shorten']) && $template['shorten'] > 0) {
80                                 echo ' title="'. htmlspecialchars($current->text).'"';
81                                 $current->text = shorten($current->text, $template['shorten'], $template['shortenel']);
82                         }
83                         echo '>' . htmlspecialchars($current->text) . '</option>';
84                         break;
85                 case 'FOOT':
86                         echo '</select>';
87                         break;
88         }
89 }
90
91 function listplug_table($template, $type) {
92         switch($type) {
93                 case 'HEAD':
94                         echo "<table>";
95                         echo "<thead><tr>";
96                         // print head
97                         call_user_func("listplug_table_" . $template['content'] , $template, 'HEAD');
98                         echo "</tr></thead><tbody>";
99                         break;
100                 case 'BODY':
101                         // print tabletype specific thingies
102                         echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
103                         call_user_func("listplug_table_" . $template['content'] , $template,  'BODY');
104                         echo "</tr>";
105                         break;
106                 case 'FOOT':
107                         call_user_func("listplug_table_" . $template['content'] , $template,  'FOOT');
108                         echo "</tbody></table>";
109                         break;
110         }
111 }
112
113 function listplug_table_memberlist($template, $type) {
114         switch($type) {
115                 case 'HEAD':
116                         echo '<th>' . _LIST_MEMBER_NAME . '</th><th>' . _LIST_MEMBER_RNAME . '</th><th>' . _LIST_MEMBER_URL . '</th><th>' . _LIST_MEMBER_ADMIN;
117                         help('superadmin');
118                         echo "</th><th>" . _LIST_MEMBER_LOGIN;
119                         help('canlogin');
120                         echo "</th><th colspan='2'>" . _LISTS_ACTIONS. "</th>";
121                         break;
122                 case 'BODY':
123                         $current = $template['current'];
124
125                         echo '<td>';
126                         $id = listplug_nextBatchId();
127                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->mnumber,'" />';
128                         echo '<label for="batch',$id,'">';
129                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
130                         echo '</label>';
131                         echo '</td>';
132                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
133                         echo "<td><a href='", htmlspecialchars($current->murl), "' tabindex='", $template['tabindex'] , "'>", htmlspecialchars($current->murl), "</a></td>";
134                         echo '<td>', ($current->madmin ? _YES : _NO),'</td>';
135                         echo '<td>', ($current->mcanlogin ? _YES : _NO), '</td>';
136                         echo "<td><a href='index.php?action=memberedit&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
137                         echo "<td><a href='index.php?action=memberdelete&amp;memberid=$current->mnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
138                         break;
139         }
140 }
141
142 function listplug_table_teamlist($template, $type) {
143         global $manager;
144         switch($type) {
145                 case 'HEAD':
146                         echo "<th>"._LIST_MEMBER_NAME."</th><th>"._LIST_MEMBER_RNAME."</th><th>"._LIST_TEAM_ADMIN;
147                         help('teamadmin');
148                         echo "</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
149                         break;
150                 case 'BODY':
151                         $current = $template['current'];
152
153                         echo '<td>';
154                         $id = listplug_nextBatchId();
155                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->tmember,'" />';
156                         echo '<label for="batch',$id,'">';
157                         echo "<a href='mailto:", htmlspecialchars($current->memail), "' tabindex='".$template['tabindex']."'>", htmlspecialchars($current->mname), "</a>";
158                         echo '</label>';
159                         echo '</td>';
160                         echo '<td>', htmlspecialchars($current->mrealname), '</td>';
161                         echo '<td>', ($current->tadmin ? _YES : _NO) , '</td>';
162                         echo "<td><a href='index.php?action=teamdelete&amp;memberid=$current->tmember&amp;blogid=$current->tblog' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
163
164                         $url = 'index.php?action=teamchangeadmin&memberid=' . intval($current->tmember) . '&blogid=' . intval($current->tblog);
165                         $url = $manager->addTicketToUrl($url);
166                         echo "<td><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LIST_TEAM_CHADMIN."</a></td>";
167                         break;
168         }
169 }
170
171 function listplug_table_pluginlist($template, $type) {
172         global $manager;
173         switch($type) {
174                 case 'HEAD':
175                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_DESC.'</th>';
176                         echo '<th style="white-space:nowrap">'._LISTS_ACTIONS.'</th>';
177                         break;
178                 case 'BODY':
179                         $current = $template['current'];
180
181                         $plug =& $manager->getPlugin($current->pfile);
182                         if ($plug) {
183                                 echo '<td>';
184                                         echo '<strong>' , htmlspecialchars($plug->getName()) , '</strong><br />';
185                                         echo _LIST_PLUGS_AUTHOR, ' ' , htmlspecialchars($plug->getAuthor()) , '<br />';
186                                         echo _LIST_PLUGS_VER, ' ' , htmlspecialchars($plug->getVersion()) , '<br />';
187                                         if ($plug->getURL())
188                                         echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">',_LIST_PLUGS_SITE,'</a><br />';
189 //                                      echo '<a href="',htmlspecialchars($plug->getURL()),'" tabindex="'.$template['tabindex'].'">'.htmlspecialchars(shorten($plug->getURL(), 25, '...')),'</a><br />';
190                                 echo '</td>';
191                                 echo '<td>';
192                                         echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
193                                         if (sizeof($plug->getEventList()) > 0) {
194                                                 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
195                                                 // check the database to see if it is up-to-date and notice the user if not
196                                         }
197                                         if (!$plug->subscribtionListIsUptodate()) {
198                                                 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
199                                         }
200                                         if (sizeof($plug->getPluginDep()) > 0) {
201                                                 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
202                                         }
203 // <add by shizuki>
204                                 // check dependency require
205                                 $req = array();
206                                 $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
207                                 while($o = sql_fetch_object($res)) {
208                                         $preq =& $manager->getPlugin($o->pfile);
209                                         if ($preq) {
210                                                 $depList = $preq->getPluginDep();
211                                                 foreach ($depList as $depName) {
212                                                         if ($current->pfile == $depName) {
213                                                                 $req[] = $o->pfile;
214                                                         }
215                                                 }
216                                         }
217                                 }
218                                 if (count($req) > 0) {
219                                         echo '<h4 class="plugin_dependreq_title">' . _LIST_PLUGS_DEPREQ . "</h4>\n";
220                                         echo '<p class="plugin_dependreq_text">';
221                                         echo htmlspecialchars(implode(', ', $req), ENT_QUOTES);
222                                         echo "</p>\n";
223                                 }
224 // </add by shizuki>
225                                 echo '</td>';
226                         } else {
227                                 echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, htmlspecialchars($current->pfile, ENT_QUOTES)) . '</td>';
228                         }
229                         echo '<td>';
230
231                                 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
232                                 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
233                                 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
234                                 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
235                                 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
236                                 echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
237                                 if ($plug && ($plug->hasAdminArea() > 0))
238                                         echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
239                                 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
240                                         echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
241                                 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
242                                         echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
243                         echo '</td>';
244                         break;
245         }
246 }
247
248 function listplug_table_plugoptionlist($template, $type) {
249         global $manager;
250         switch($type) {
251                 case 'HEAD':
252                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
253                         break;
254                 case 'BODY':
255                         $current = $template['current'];
256                         listplug_plugOptionRow($current);
257                         break;
258                 case 'FOOT':
259                         ?>
260                         <tr>
261                                 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
262                         </tr><tr>
263                                 <td><?php echo _PLUGS_SAVE?></td>
264                                 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
265                         </tr>
266                         <?php                   break;
267         }
268 }
269
270 function listplug_plugOptionRow($current) {
271         $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
272         // retreive the optionmeta
273         $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
274
275         // only if it is not a hidden option write the controls to the page
276         if (@$meta['access'] != 'hidden') {
277                 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
278                 echo '<td>';
279                 switch($current['type']) {
280                         case 'yesno':
281                                 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
282                                 break;
283                         case 'password':
284                                 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
285                                 break;
286                         case 'select':
287                                 echo '<select name="'.htmlspecialchars($varname).'">';
288                                 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
289                                 $aOptions = explode('|', $aOptions);
290                                 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
291                                         echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
292                                         if ($aOptions[$i+1] == $current['value'])
293                                                 echo ' selected="selected"';
294                                         echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
295                                 }
296                                 echo '</select>';
297                                 break;
298                         case 'textarea':
299                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
300                                 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
301                                 if (@$meta['access'] == 'readonly') {
302                                         echo ' readonly="readonly"';
303                                 }
304                                 echo '>',htmlspecialchars($current['value']),'</textarea>';
305                                 break;
306                         case 'text':
307                         default:
308                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
309
310                                 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
311                                 if (@$meta['datatype'] == 'numerical') {
312                                         echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
313                                 }
314                                 if (@$meta['access'] == 'readonly') {
315                                         echo ' readonly="readonly"';
316                                 }
317                                 echo ' />';
318                 }
319                 echo @$current['extra'];
320                 echo '</td>';
321         }
322 }
323
324 function listplug_table_itemlist($template, $type) {
325         $cssclass = null;
326
327         switch($type) {
328                 case 'HEAD':
329                         echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
330                         break;
331                 case 'BODY':
332                         $current = $template['current'];
333                         $current->itime = strtotime($current->itime);   // string -> unix timestamp
334
335                         if ($current->idraft == 1)
336                                 $cssclass = "class='draft'";
337
338                         // (can't use offset time since offsets might vary between blogs)
339                         if ($current->itime > $template['now'])
340                                 $cssclass = "class='future'";
341                         
342                         $action = requestVar('action');
343                         
344                         echo '<td ' . $cssclass . ' style="white-space:nowrap;">';
345                         if ($action !== 'itemlist')
346                         echo _LIST_ITEM_BLOG . ' ', htmlspecialchars($current->bshortname) . '    <br />';
347                         echo _LIST_ITEM_CAT,' ', htmlspecialchars($current->cname) . '    <br />';
348                         if ($action !== 'browseownitems')
349                         echo _LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname) . '    <br />';
350                         echo date("Y-m-d",$current->itime) , " " . date("H:i",$current->itime);
351                         echo "</td>";
352                         echo "<td $cssclass>";
353
354                         $id = listplug_nextBatchId();
355
356                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
357                         echo '<label for="batch',$id,'">';
358                         echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
359                         echo '</label>';
360                         echo "<br />";
361
362
363                         $current->ibody = strip_tags($current->ibody);
364                         $current->ibody = htmlspecialchars(shorten($current->ibody,200,'...'));
365
366                         $COMMENTS = new COMMENTS($current->inumber);
367                         echo "$current->ibody</td>";
368                         echo "<td  style=\"white-space:nowrap\" $cssclass>";
369                         echo "<a href='index.php?action=itemedit&amp;itemid={$current->inumber}'>" . _LISTS_EDIT . "</a>";
370                         echo " / <a href='index.php?action=itemmove&amp;itemid={$current->inumber}'>" . _LISTS_MOVE . "</a>";
371                         echo " / <a href='index.php?action=itemdelete&amp;itemid={$current->inumber}'>" . _LISTS_DELETE . "</a><br />";
372                         // evaluate amount of comments for the item
373                         $camount = $COMMENTS->amountComments();
374                         if ($camount>0)
375                         {
376                                 echo "<a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>";
377                                 echo "( " . sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments())." )</a>";
378                         }
379                         else
380                         {
381                                 echo _LIST_ITEM_NOCONTENT;
382                         }
383                         echo "</td>";
384                         break;
385         }
386 }
387
388 // for batch operations: generates the index numbers for checkboxes
389 function listplug_nextBatchId() {
390         static $id = 0;
391         return $id++;
392 }
393
394 function listplug_table_commentlist($template, $type) {
395         switch($type) {
396                 case 'HEAD':
397                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
398                         break;
399                 case 'BODY':
400                         $current = $template['current'];
401                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp
402
403                         echo '<td>';
404                         echo date("Y-m-d@H:i",$current->ctime);
405                         echo '<br />';
406                         if ($current->mname)
407                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
408                         else
409                                 echo htmlspecialchars($current->cuser);
410                         if ($current->cmail != '') {
411                                 echo '<br />';
412                                 echo htmlspecialchars($current->cmail);
413                         }
414                         if ($current->cemail != '') {
415                                 echo '<br />';
416                                 echo htmlspecialchars($current->cemail);
417                         }
418                         echo '</td>';
419
420                         $current->cbody = strip_tags($current->cbody);
421                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
422
423                         echo '<td>';
424                         $id = listplug_nextBatchId();
425                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
426                         echo '<label for="batch',$id,'">';
427                         echo $current->cbody;
428                         echo '</label>';
429                         echo '</td>';
430
431                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
432                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
433                         if ($template['canAddBan'])
434                                 echo "<td style=\"white-space:nowrap\"><a href='index.php?action=banlistnewfromitem&amp;itemid=$current->citem&amp;ip=", htmlspecialchars($current->cip), "' title='", htmlspecialchars($current->chost), "'>"._LIST_COMMENT_BANIP."</a></td>";
435                         break;
436         }
437 }
438
439
440 function listplug_table_bloglist($template, $type) {
441         switch($type) {
442                 case 'HEAD':
443                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
444                         break;
445                 case 'BODY':
446                         $current = $template['current'];
447
448                         echo "<td title='blogid:$current->bnumber shortname:$current->bshortname'><a href='$current->burl'><img src='images/globe.gif' width='13' height='13' alt='". _BLOGLIST_TT_VISIT."' /></a> " . htmlspecialchars($current->bname) . "</td>";
449                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
450                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
451                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
452                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
453
454                         if ($current->tadmin == 1) {
455                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
456                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
457                         }
458
459                         if ($template['superadmin']) {
460                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
461                         }
462
463
464
465                         break;
466         }
467 }
468
469 function listplug_table_shortblognames($template, $type) {
470         switch($type) {
471                 case 'HEAD':
472                         echo "<th>" . _EBLOG_SHORTNAME . "</th><th>" . _EBLOG_NAME. "</th>";
473                         break;
474                 case 'BODY':
475                         $current = $template['current'];
476
477                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
478                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';
479
480                         break;
481         }
482 }
483
484 function listplug_table_shortnames($template, $type) {
485         switch($type) {
486                 case 'HEAD':
487                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
488                         break;
489                 case 'BODY':
490                         $current = $template['current'];
491
492                         echo '<td>' , htmlspecialchars($current->name) , '</td>';
493                         echo '<td>' , htmlspecialchars($current->description) , '</td>';
494
495                         break;
496         }
497 }
498
499
500 function listplug_table_categorylist($template, $type) {
501         switch($type) {
502                 case 'HEAD':
503                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
504                         break;
505                 case 'BODY':
506                         $current = $template['current'];
507
508                         echo '<td>';
509                         $id = listplug_nextBatchId();
510                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
511                         echo '<label for="batch',$id,'">';
512                         echo htmlspecialchars($current->cname);
513                         echo '</label>';
514                         echo '</td>';
515
516                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';
517                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
518                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
519
520                         break;
521         }
522 }
523
524
525 function listplug_table_templatelist($template, $type) {
526         global $manager;
527         switch($type) {
528                 case 'HEAD':
529                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
530                         break;
531                 case 'BODY':
532                         $current = $template['current'];
533
534                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";
535                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
536                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
537
538                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
539                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
540                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
541
542                         break;
543         }
544 }
545
546 function listplug_table_skinlist($template, $type) {
547         global $CONF, $DIR_SKINS, $manager;
548         switch($type) {
549                 case 'HEAD':
550                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
551                         break;
552                 case 'BODY':
553                         $current = $template['current'];
554
555                         echo '<td>';
556
557                         // use a special style for the default skin
558                         if ($current->sdnumber == $CONF['BaseSkin']) {
559                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
560                         } else {
561                                 echo htmlspecialchars($current->sdname);
562                         }
563
564                         echo '<br /><br />';
565                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
566                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
567                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
568
569                         // add preview image when present
570                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
571                         {
572                                 echo '<br /><br />';
573
574                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
575                                 if ($hasEnlargement)
576                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . '">';
577
578                                 $imgAlt = sprintf(_LIST_SKIN_PREVIEW, htmlspecialchars($current->sdname, ENT_QUOTES));
579                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="' . $imgAlt . '" />';
580
581                                 if ($hasEnlargement)
582                                         echo '</a>';
583
584                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
585                                 {
586                                         $url         = $CONF['SkinsURL'] . htmlspecialchars($current->sdincpref, ENT_QUOTES) . 'readme.html';
587                                         $readmeTitle = sprintf(_LIST_SKIN_README, htmlspecialchars($current->sdname, ENT_QUOTES));
588                                         echo '<br /><a href="' . $url . '" title="' . $readmeTitle . '">' . _LIST_SKIN_README_TXT . '</a>';
589                                 }
590
591
592                         }
593
594                         echo "</td>";
595
596
597                         echo '<td class="availableSkinTypes">' . htmlspecialchars($current->sddesc);
598                                 // show list of defined parts
599                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
600                                 $types = array();
601                                 while ($o = sql_fetch_object($r))
602                                         array_push($types,$o->stype);
603                                 if (sizeof($types) > 0) {
604                                         $friendlyNames = SKIN::getFriendlyNames();
605                                         for ($i=0;$i<sizeof($types);$i++) {
606                                                 $type = $types[$i];
607                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
608                                                         $types[$i] = '<li>' . helpHtml('skinpart'.$type) . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
609                                                 } else {
610                                                         $types[$i] = '<li>' . helpHtml('skinpartspecial') . ' <a href="index.php?action=skinedittype&amp;skinid='.$current->sdnumber.'&amp;type='.$type.'" tabindex="'.$template['tabindex'].'">' . htmlspecialchars($friendlyNames[$type]) . "</a></li>";
611                                                 }
612                                         }
613                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
614                                 }
615                         echo "</td>";
616                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
617
618                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
619                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
620                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
621
622                         break;
623         }
624 }
625
626 function listplug_table_draftlist($template, $type) {
627         switch($type) {
628                 case 'HEAD':
629                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
630                         break;
631                 case 'BODY':
632                         $current = $template['current'];
633
634                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
635                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
636                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
637                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
638
639                         break;
640         }
641 }
642
643
644 function listplug_table_actionlist($template, $type) {
645         switch($type) {
646                 case 'HEAD':
647                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
648                         break;
649                 case 'BODY':
650                         $current = $template['current'];
651
652                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
653                         echo '<td>' , htmlspecialchars($current->message), '</td>';
654
655                         break;
656         }
657 }
658
659 function listplug_table_banlist($template, $type) {
660         switch($type) {
661                 case 'HEAD':
662                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
663                         break;
664                 case 'BODY':
665                         $current = $template['current'];
666
667                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
668                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';
669                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
670                         break;
671         }
672 }
673
674 ?>