OSDN Git Service

merged from v3.31sp1
[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-2007 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-2007 The Nucleus Group
17  * @version $Id: showlist.php,v 1.8 2008-02-08 09:31:22 kimitake Exp $
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 = mysql_num_rows($res);
45                 if ($numrows == 0)
46                         return 0;
47
48                 call_user_func('listplug_' . $type, $template, 'HEAD');
49
50                 while($template['current'] = mysql_fetch_object($res))
51                         call_user_func('listplug_' . $type, $template, 'BODY');
52
53                 call_user_func('listplug_' . $type, $template, 'FOOT');
54
55                 mysql_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 '</td>';
190                                 echo '<td>';
191                                         echo _LIST_PLUGS_DESC .'<br/>'. encode_desc($plug->getDescription());
192                                         if (sizeof($plug->getEventList()) > 0) {
193                                                 echo '<br /><br />',_LIST_PLUGS_SUBS,'<br />',htmlspecialchars(implode($plug->getEventList(),', '));
194                                                 // check the database to see if it is up-to-date and notice the user if not
195                                         }
196                                         if (!$plug->subscribtionListIsUptodate()) {
197                                                 echo '<br /><br /><strong>',_LIST_PLUG_SUBS_NEEDUPDATE,'</strong>';
198                                         }
199                                         if (sizeof($plug->getPluginDep()) > 0)
200                                                 echo '<br /><br />',_LIST_PLUGS_DEP,'<br />',htmlspecialchars(implode($plug->getPluginDep(),', '));
201                                 echo '</td>';
202                         } else {
203                                 echo '<td colspan="2">Error: plugin file <b>',htmlspecialchars($current->pfile),'.php</b> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)</td>';
204                         }
205                         echo '<td>';
206
207                                 $baseUrl = 'index.php?plugid=' . intval($current->pid) . '&action=';
208                                 $url = $manager->addTicketToUrl($baseUrl . 'pluginup');
209                                 echo "<a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UP,"</a>";
210                                 $url = $manager->addTicketToUrl($baseUrl . 'plugindown');
211                                 echo "<br /><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_DOWN,"</a>";
212                                 echo "<br /><a href='index.php?action=plugindelete&amp;plugid=$current->pid' tabindex='".$template['tabindex']."'>",_LIST_PLUGS_UNINSTALL,"</a>";
213                                 if ($plug && ($plug->hasAdminArea() > 0))
214                                         echo "<br /><a href='".htmlspecialchars($plug->getAdminURL())."'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_ADMIN,"</a>";
215                                 if ($plug && ($plug->supportsFeature('HelpPage') > 0))
216                                         echo "<br /><a href='index.php?action=pluginhelp&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_HELP,"</a>";
217                                 if (quickQuery('SELECT COUNT(*) AS result FROM '.sql_table('plugin_option_desc').' WHERE ocontext=\'global\' and opid='.$current->pid) > 0)
218                                         echo "<br /><a href='index.php?action=pluginoptions&amp;plugid=$current->pid'  tabindex='".$template['tabindex']."'>",_LIST_PLUGS_OPTIONS,"</a>";
219                         echo '</td>';
220                         break;
221         }
222 }
223
224 function listplug_table_plugoptionlist($template, $type) {
225         global $manager;
226         switch($type) {
227                 case 'HEAD':
228                         echo '<th>'._LISTS_INFO.'</th><th>'._LISTS_VALUE.'</th>';
229                         break;
230                 case 'BODY':
231                         $current = $template['current'];
232                         listplug_plugOptionRow($current);
233                         break;
234                 case 'FOOT':
235                         ?>
236                         <tr>
237                                 <th colspan="2"><?php echo _PLUGS_SAVE?></th>
238                         </tr><tr>
239                                 <td><?php echo _PLUGS_SAVE?></td>
240                                 <td><input type="submit" value="<?php echo _PLUGS_SAVE?>" /></td>
241                         </tr>
242                         <?php                   break;
243         }
244 }
245
246 function listplug_plugOptionRow($current) {
247         $varname = 'plugoption['.$current['oid'].']['.$current['contextid'].']';
248         // retreive the optionmeta
249         $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
250
251         // only if it is not a hidden option write the controls to the page
252         if (@$meta['access'] != 'hidden') {
253                 echo '<td>',htmlspecialchars($current['description']?$current['description']:$current['name']),'</td>';
254                 echo '<td>';
255                 switch($current['type']) {
256                         case 'yesno':
257                                 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
258                                 break;
259                         case 'password':
260                                 echo '<input type="password" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'" />';
261                                 break;
262                         case 'select':
263                                 echo '<select name="'.htmlspecialchars($varname).'">';
264                                 $aOptions = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
265                                 $aOptions = explode('|', $aOptions);
266                                 for ($i=0; $i<(count($aOptions)-1); $i+=2) {
267                                         echo '<option value="'.htmlspecialchars($aOptions[$i+1]).'"';
268                                         if ($aOptions[$i+1] == $current['value'])
269                                                 echo ' selected="selected"';
270                                         echo '>'.htmlspecialchars($aOptions[$i]).'</option>';
271                                 }
272                                 echo '</select>';
273                                 break;
274                         case 'textarea':
275                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
276                                 echo '<textarea class="pluginoption" cols="30" rows="5" name="',htmlspecialchars($varname),'"';
277                                 if (@$meta['access'] == 'readonly') {
278                                         echo ' readonly="readonly"';
279                                 }
280                                 echo '>',htmlspecialchars($current['value']),'</textarea>';
281                                 break;
282                         case 'text':
283                         default:
284                                 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
285
286                                 echo '<input type="text" size="40" maxlength="128" name="',htmlspecialchars($varname),'" value="',htmlspecialchars($current['value']),'"';
287                                 if (@$meta['datatype'] == 'numerical') {
288                                         echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
289                                 }
290                                 if (@$meta['access'] == 'readonly') {
291                                         echo ' readonly="readonly"';
292                                 }
293                                 echo ' />';
294                 }
295                 echo @$current['extra'];
296                 echo '</td>';
297         }
298 }
299
300 function listplug_table_itemlist($template, $type) {
301         $cssclass = null;
302
303         switch($type) {
304                 case 'HEAD':
305                         echo "<th>"._LIST_ITEM_INFO."</th><th>"._LIST_ITEM_CONTENT."</th><th style=\"white-space:nowrap\" colspan='1'>"._LISTS_ACTIONS."</th>";
306                         break;
307                 case 'BODY':
308                         $current = $template['current'];
309                         $current->itime = strtotime($current->itime);   // string -> unix timestamp
310
311                         if ($current->idraft == 1)
312                                 $cssclass = "class='draft'";
313
314                         // (can't use offset time since offsets might vary between blogs)
315                         if ($current->itime > $template['now'])
316                                 $cssclass = "class='future'";
317
318                         echo "<td $cssclass>",_LIST_ITEM_BLOG,' ', htmlspecialchars($current->bshortname);
319                         echo "    <br />",_LIST_ITEM_CAT,' ', htmlspecialchars($current->cname);
320                         echo "    <br />",_LIST_ITEM_AUTHOR, ' ', htmlspecialchars($current->mname);
321                         echo "    <br />",_LIST_ITEM_DATE," " . date("Y-m-d",$current->itime);
322                         echo "<br />",_LIST_ITEM_TIME," " . date("H:i",$current->itime);
323                         echo "</td>";
324                         echo "<td $cssclass>";
325
326                         $id = listplug_nextBatchId();
327
328                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->inumber,'" />';
329                         echo '<label for="batch',$id,'">';
330                         echo "<b>" . htmlspecialchars(strip_tags($current->ititle)) . "</b>";
331                         echo '</label>';
332                         echo "<br />";
333
334
335                         $current->ibody = strip_tags($current->ibody);
336                         $current->ibody = htmlspecialchars(shorten($current->ibody,300,'...'));
337
338                         echo "$current->ibody</td>";
339                         echo "<td  style=\"white-space:nowrap\" $cssclass>";
340                         echo    "<a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a>";
341                         echo    "<br /><a href='index.php?action=itemcommentlist&amp;itemid=$current->inumber'>"._LISTS_COMMENTS."</a>";
342                         echo    "<br /><a href='index.php?action=itemmove&amp;itemid=$current->inumber'>"._LISTS_MOVE."</a>";
343                         echo    "<br /><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a>";
344                         echo "</td>";
345                         break;
346         }
347 }
348
349 // for batch operations: generates the index numbers for checkboxes
350 function listplug_nextBatchId() {
351         static $id = 0;
352         return $id++;
353 }
354
355 function listplug_table_commentlist($template, $type) {
356         switch($type) {
357                 case 'HEAD':
358                         echo "<th>"._LISTS_INFO."</th><th>"._LIST_COMMENT."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
359                         break;
360                 case 'BODY':
361                         $current = $template['current'];
362                         $current->ctime = strtotime($current->ctime);   // string -> unix timestamp
363
364                         echo '<td>';
365                         echo date("Y-m-d@H:i",$current->ctime);
366                         echo '<br />';
367                         if ($current->mname)
368                                 echo htmlspecialchars($current->mname) ,' ', _LIST_COMMENTS_MEMBER;
369                         else
370                                 echo htmlspecialchars($current->cuser);
371                         if ($current->cmail != '') {
372                                 echo '<br />';
373                                 echo htmlspecialchars($current->cmail);
374                         }
375                         if ($current->cemail != '') {
376                                 echo '<br />';
377                                 echo htmlspecialchars($current->cemail);
378                         }
379                         echo '</td>';
380
381                         $current->cbody = strip_tags($current->cbody);
382                         $current->cbody = htmlspecialchars(shorten($current->cbody, 300, '...'));
383
384                         echo '<td>';
385                         $id = listplug_nextBatchId();
386                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->cnumber,'" />';
387                         echo '<label for="batch',$id,'">';
388                         echo $current->cbody;
389                         echo '</label>';
390                         echo '</td>';
391
392                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentedit&amp;commentid=$current->cnumber'>"._LISTS_EDIT."</a></td>";
393                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=commentdelete&amp;commentid=$current->cnumber'>"._LISTS_DELETE."</a></td>";
394                         if ($template['canAddBan'])
395                                 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>";
396                         break;
397         }
398 }
399
400
401 function listplug_table_bloglist($template, $type) {
402         switch($type) {
403                 case 'HEAD':
404                         echo "<th>" . _NAME . "</th><th colspan='7'>" ._LISTS_ACTIONS. "</th>";
405                         break;
406                 case 'BODY':
407                         $current = $template['current'];
408
409                         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>";
410                         echo "<td><a href='index.php?action=createitem&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_ADD ."'>" . _BLOGLIST_ADD . "</a></td>";
411                         echo "<td><a href='index.php?action=itemlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_EDIT."'>". _BLOGLIST_EDIT."</a></td>";
412                         echo "<td><a href='index.php?action=blogcommentlist&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_COMMENTS."'>". _BLOGLIST_COMMENTS."</a></td>";
413                         echo "<td><a href='index.php?action=bookmarklet&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_BMLET."'>". _BLOGLIST_BMLET . "</a></td>";
414
415                         if ($current->tadmin == 1) {
416                                 echo "<td><a href='index.php?action=blogsettings&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_SETTINGS . "'>" ._BLOGLIST_SETTINGS. "</a></td>";
417                                 echo "<td><a href='index.php?action=banlist&amp;blogid=$current->bnumber' title='" . _BLOGLIST_TT_BANS. "'>". _BLOGLIST_BANS."</a></td>";
418                         }
419
420                         if ($template['superadmin']) {
421                                 echo "<td><a href='index.php?action=deleteblog&amp;blogid=$current->bnumber' title='". _BLOGLIST_TT_DELETE."'>" ._BLOGLIST_DELETE. "</a></td>";
422                         }
423
424
425
426                         break;
427         }
428 }
429
430 function listplug_table_shortblognames($template, $type) {
431         switch($type) {
432                 case 'HEAD':
433                         echo "<th>" . _NAME . "</th><th>" . _NAME. "</th>";
434                         break;
435                 case 'BODY':
436                         $current = $template['current'];
437
438                         echo '<td>' , htmlspecialchars($current->bshortname) , '</td>';
439                         echo '<td>' , htmlspecialchars($current->bname) , '</td>';
440
441                         break;
442         }
443 }
444
445 function listplug_table_shortnames($template, $type) {
446         switch($type) {
447                 case 'HEAD':
448                         echo "<th>" . _NAME . "</th><th>" . _LISTS_DESC. "</th>";
449                         break;
450                 case 'BODY':
451                         $current = $template['current'];
452
453                         echo '<td>' , htmlspecialchars($current->name) , '</td>';
454                         echo '<td>' , htmlspecialchars($current->description) , '</td>';
455
456                         break;
457         }
458 }
459
460
461 function listplug_table_categorylist($template, $type) {
462         switch($type) {
463                 case 'HEAD':
464                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
465                         break;
466                 case 'BODY':
467                         $current = $template['current'];
468
469                         echo '<td>';
470                         $id = listplug_nextBatchId();
471                         echo '<input type="checkbox" id="batch',$id,'" name="batch[',$id,']" value="',$current->catid,'" />';
472                         echo '<label for="batch',$id,'">';
473                         echo htmlspecialchars($current->cname);
474                         echo '</label>';
475                         echo '</td>';
476
477                         echo '<td>', htmlspecialchars($current->cdesc), '</td>';
478                         echo "<td><a href='index.php?action=categorydelete&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
479                         echo "<td><a href='index.php?action=categoryedit&amp;blogid=$current->cblog&amp;catid=$current->catid' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
480
481                         break;
482         }
483 }
484
485
486 function listplug_table_templatelist($template, $type) {
487         global $manager;
488         switch($type) {
489                 case 'HEAD':
490                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
491                         break;
492                 case 'BODY':
493                         $current = $template['current'];
494
495                         echo "<td>" , htmlspecialchars($current->tdname), "</td>";
496                         echo "<td>" , htmlspecialchars($current->tddesc), "</td>";
497                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templateedit&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
498
499                         $url = $manager->addTicketToUrl('index.php?action=templateclone&templateid=' . intval($current->tdnumber));
500                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
501                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=templatedelete&amp;templateid=$current->tdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
502
503                         break;
504         }
505 }
506
507 function listplug_table_skinlist($template, $type) {
508         global $CONF, $DIR_SKINS, $manager;
509         switch($type) {
510                 case 'HEAD':
511                         echo "<th>"._LISTS_NAME."</th><th>"._LISTS_DESC."</th><th colspan='3'>"._LISTS_ACTIONS."</th>";
512                         break;
513                 case 'BODY':
514                         $current = $template['current'];
515
516                         echo '<td>';
517
518                         // use a special style for the default skin
519                         if ($current->sdnumber == $CONF['BaseSkin']) {
520                                 echo '<strong>',htmlspecialchars($current->sdname),'</strong>';
521                         } else {
522                                 echo htmlspecialchars($current->sdname);
523                         }
524
525                         echo '<br /><br />';
526                         echo _LISTS_TYPE ,': ' , htmlspecialchars($current->sdtype);
527                         echo '<br />', _LIST_SKINS_INCMODE , ' ' , (($current->sdincmode=='skindir') ?_PARSER_INCMODE_SKINDIR:_PARSER_INCMODE_NORMAL);
528                         if ($current->sdincpref) echo '<br />' , _LIST_SKINS_INCPREFIX , ' ', htmlspecialchars($current->sdincpref);
529
530                         // add preview image when present
531                         if ($current->sdincpref && @file_exists($DIR_SKINS . $current->sdincpref . 'preview.png'))
532                         {
533                                 echo '<br /><br />';
534
535                                 $hasEnlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
536                                 if ($hasEnlargement)
537                                         echo '<a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview-large.png" title="View larger">';
538
539                                 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'preview.png" width="100" height="75" alt="Preview for \'',htmlspecialchars($current->sdname),'\' skin" />';
540
541                                 if ($hasEnlargement)
542                                         echo '</a>';
543
544                                 if (@file_exists($DIR_SKINS . $current->sdincpref . 'readme.html'))
545                                 {
546                                         echo '<br /><a href="',$CONF['SkinsURL'], htmlspecialchars($current->sdincpref),'readme.html" title="More info on the \'',htmlspecialchars($current->sdname),'\' skin">Readme</a>';
547                                 }
548
549
550                         }
551
552                         echo "</td>";
553
554
555                         echo "<td>" , htmlspecialchars($current->sddesc);
556                                 // show list of defined parts
557                                 $r = sql_query('SELECT stype FROM '.sql_table('skin').' WHERE sdesc='.$current->sdnumber . ' ORDER BY stype');
558                                 $types = array();
559                                 while ($o = mysql_fetch_object($r))
560                                         array_push($types,$o->stype);
561                                 if (sizeof($types) > 0) {
562                                         $friendlyNames = SKIN::getFriendlyNames();
563                                         for ($i=0;$i<sizeof($types);$i++) {
564                                                 $type = $types[$i];
565                                                 if (in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup'))) {
566                                                         $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>";
567                                                 } else {
568                                                         $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>";
569                                                 }
570                                         }
571                                         echo '<br /><br />',_LIST_SKINS_DEFINED,' <ul>',implode($types,'') ,'</ul>';
572                                 }
573                         echo "</td>";
574                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skinedit&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_EDIT."</a></td>";
575
576                         $url = $manager->addTicketToUrl('index.php?action=skinclone&skinid=' . intval($current->sdnumber));
577                         echo "<td style=\"white-space:nowrap\"><a href='",htmlspecialchars($url),"' tabindex='".$template['tabindex']."'>"._LISTS_CLONE."</a></td>";
578                         echo "<td style=\"white-space:nowrap\"><a href='index.php?action=skindelete&amp;skinid=$current->sdnumber' tabindex='".$template['tabindex']."'>"._LISTS_DELETE."</a></td>";
579
580                         break;
581         }
582 }
583
584 function listplug_table_draftlist($template, $type) {
585         switch($type) {
586                 case 'HEAD':
587                         echo "<th>"._LISTS_BLOG."</th><th>"._LISTS_TITLE."</th><th colspan='2'>"._LISTS_ACTIONS."</th>";
588                         break;
589                 case 'BODY':
590                         $current = $template['current'];
591
592                         echo '<td>', htmlspecialchars($current->bshortname) , '</td>';
593                         echo '<td>', htmlspecialchars(strip_tags($current->ititle)) , '</td>';
594                         echo "<td><a href='index.php?action=itemedit&amp;itemid=$current->inumber'>"._LISTS_EDIT."</a></td>";
595                         echo "<td><a href='index.php?action=itemdelete&amp;itemid=$current->inumber'>"._LISTS_DELETE."</a></td>";
596
597                         break;
598         }
599 }
600
601
602 function listplug_table_actionlist($template, $type) {
603         switch($type) {
604                 case 'HEAD':
605                         echo '<th>'._LISTS_TIME.'</th><th>'._LIST_ACTION_MSG.'</th>';
606                         break;
607                 case 'BODY':
608                         $current = $template['current'];
609
610                         echo '<td>' , htmlspecialchars($current->timestamp), '</td>';
611                         echo '<td>' , htmlspecialchars($current->message), '</td>';
612
613                         break;
614         }
615 }
616
617 function listplug_table_banlist($template, $type) {
618         switch($type) {
619                 case 'HEAD':
620                         echo '<th>'._LIST_BAN_IPRANGE.'</th><th>'. _LIST_BAN_REASON.'</th><th>'._LISTS_ACTIONS.'</th>';
621                         break;
622                 case 'BODY':
623                         $current = $template['current'];
624
625                         echo '<td>' , htmlspecialchars($current->iprange) , '</td>';
626                         echo '<td>' , htmlspecialchars($current->reason) , '</td>';
627                         echo "<td><a href='index.php?action=banlistdelete&amp;blogid=", intval($current->blogid) , "&amp;iprange=" , htmlspecialchars($current->iprange) , "'>",_LISTS_DELETE,"</a></td>";
628                         break;
629         }
630 }
631
632 ?>