3 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4 * Copyright (C) 2002-2009 The Nucleus Group
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)
13 * Functions to create lists of things inside the admin are
15 * @license http://nucleuscms.org/license.txt GNU General Public License
16 * @copyright Copyright (C) 2002-2009 The Nucleus Group
17 * @version $Id: showlist.php 1785 2012-04-22 11:25:14Z sakamocchi $
21 // can take either an array of objects, or an SQL query
22 function showlist($query, $type, $template)
24 if ( is_array($query) )
26 if ( sizeof($query) == 0 )
31 call_user_func("listplug_{$type}", $template, 'HEAD');
33 foreach ( $query as $currentObj )
35 $template['current'] = $currentObj;
36 call_user_func("listplug_{$type}", $template, 'BODY');
39 call_user_func("listplug_{$type}", $template, 'FOOT');
41 return sizeof($query);
45 $res = DB::getResult($query);
47 // don't do anything if there are no results
48 $numrows = $res->rowCount();
53 call_user_func("listplug_{$type}", $template, 'HEAD');
55 foreach ( $res as $row )
57 $template['current'] = $row;
58 call_user_func("listplug_{$type}", $template, 'BODY');
61 call_user_func("listplug_{$type}", $template, 'FOOT');
65 // return amount of results
70 function listplug_select($template, $type)
75 echo "<select name=\"{$template['name']}\" tabindex=\"{$template['tabindex']}\"";
76 if ( array_key_exists('javascript', $template) && !empty($template['javascript']) )
78 echo " {$template['javascript']}";
82 // add extra row if needed
83 if ( array_key_exists('extra', $template) && !empty($template['extra']) )
85 echo "<option value=\"{$template['extraval']}\">{$template['extra']}</option>\n";
90 $current = $template['current'];
92 echo '<option value="' . Entity::hsc($current['value']) . '"';
93 if ( array_key_exists('selected', $template) && $template['selected'] == $current['value'] )
95 echo ' selected="selected" ';
97 if ( isset($template['shorten']) && $template['shorten'] > 0 )
99 echo ' title="'. Entity::hsc($current['text']).'"';
100 $current['text'] = Entity::hsc(Entity::shorten($current['text'], $template['shorten'], $template['shortenel']));
102 echo '>' . Entity::hsc($current['text']) . "</option>\n";
111 function listplug_table($template, $type)
117 echo "<table frame=\"box\" rules=\"all\" summary=\"{$template['content']}\">\n";
121 call_user_func("listplug_table_{$template['content']}" , $template, 'HEAD');
127 // print tabletype specific thingies
129 call_user_func("listplug_table_{$template['content']}" , $template, 'BODY');
133 call_user_func("listplug_table_{$template['content']}" , $template, 'FOOT');
142 function listplug_table_memberlist($template, $type)
147 echo '<th>' . _LIST_MEMBER_NAME . "</th>\n";
148 echo '<th>' . _LIST_MEMBER_RNAME . "</th>\n";
149 echo '<th>' . _LIST_MEMBER_URL . "</th>\n";
150 echo '<th>' . _LIST_MEMBER_ADMIN;
153 echo '<th>' . _LIST_MEMBER_LOGIN;
156 echo '<th colspan="2">' . _LISTS_ACTIONS. "</th>\n";
159 $current = $template['current'];
161 $id = listplug_nextBatchId();
162 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['mnumber']}\" />\n";
163 echo "<label for=\"batch{$id}\">\n";
164 echo '<a href="mailto:' . Entity::hsc($current['memail']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['mname']), "</a>\n";
167 echo "<td>" . Entity::hsc($current['mrealname']) . "</td>\n";
168 echo '<td><a href="' . Entity::hsc($current['murl']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['murl']) . "</a></td>\n";
169 echo '<td>' . ($current['madmin'] ? _YES : _NO) . "</td>\n";
170 echo '<td>' . ($current['mcanlogin'] ? _YES : _NO) . "</td>\n";
171 echo '<td><a href="index.php?action=memberedit&memberid=' . $current['mnumber'] . '" tabindex="' . $template['tabindex'] . '">' . _LISTS_EDIT . "</a></td>\n";
172 echo '<td><a href="index.php?action=memberdelete&memberid=' . $current['mnumber'] . '" tabindex="' . $template['tabindex'].'">' . _LISTS_DELETE . "</a></td>\n";
178 function listplug_table_teamlist($template, $type)
184 echo "<th>" . _LIST_MEMBER_NAME . "</th>\n";
185 echo "<th>" . _LIST_MEMBER_RNAME . "</th>\n";
186 echo "<th>" . _LIST_TEAM_ADMIN;
189 echo "<th colspan=\"2\">"._LISTS_ACTIONS."</th>\n";
192 $current = $template['current'];
195 $id = listplug_nextBatchId();
196 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['tmember']}\" />\n";
197 echo '<label for="batch',$id,'">';
198 echo '<a href="mailto:' . Entity::hsc($current['memail']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['mname']), "</a>\n";
201 echo '<td>', Entity::hsc($current['mrealname']), "</td>\n";
202 echo '<td>', ($current['tadmin'] ? _YES : _NO) , "</td>\n";
203 echo '<td><a href="index.php?action=teamdelete&memberid=' . $current['tmember'] . '&blogid=' . $current['tblog'] . '" tabindex="' . $template['tabindex'] . '">' . _LISTS_DELETE . "</a></td>\n";
205 $url = "index.php?action=teamchangeadmin&memberid={$current['tmember']}&blogid={$current['tblog']}";
206 $url = $manager->addTicketToUrl($url);
207 echo '<td><a href="' . Entity::hsc($url) . '" tabindex="' . $template['tabindex'] . '">' . _LIST_TEAM_CHADMIN . "</a></td>\n";
213 function listplug_table_pluginlist($template, $type)
219 echo '<th>' . _LISTS_INFO . "</th>\n";
220 echo '<th>' . _LISTS_DESC . "</th>\n";
221 echo '<th>' . _LISTS_ACTIONS . "</th>\n";
224 $current = $template['current'];
226 $plug =& $manager->getPlugin($current['pfile']);
230 echo '<h3>' . Entity::hsc($plug->getName()) . "</h3>\n";
233 if ( $plug->getAuthor() )
235 echo '<dt>' . _LIST_PLUGS_AUTHOR . "</dt>\n";
236 echo '<dd>' . Entity::hsc($plug->getAuthor()) , "</dd>\n";
239 if ( $plug->getVersion() )
241 echo '<dt>' . _LIST_PLUGS_VER, "</dt>\n";
242 echo '<dd>' . Entity::hsc($plug->getVersion()) . "</dd>\n";
245 if ( $plug->getURL() )
247 echo '<dt>' . _LIST_PLUGS_SITE . "<dt>\n";
248 echo '<dd><a href="' . Entity::hsc($plug->getURL()) . '" tabindex="' . $template['tabindex'] . '">リンク</a></dd>' . "\n";
255 echo '<dt>' . _LIST_PLUGS_DESC ."</dt>\n";
256 echo '<dd>' . Entity::hen($plug->getDescription()) ."</dd>\n";
257 if ( sizeof($plug->getEventList()) > 0 )
259 echo '<dt>' . _LIST_PLUGS_SUBS ."</dt>\n";
260 echo '<dd>' . Entity::hsc(implode(', ', $plug->getEventList())) ."</dd>\n";
263 if ( sizeof($plug->getPluginDep()) > 0 )
265 echo '<dt>' . _LIST_PLUGS_DEP ."</dt>\n";
266 echo '<dd>' . Entity::hsc(implode(', ', $plug->getPluginDep())) ."</dd>\n";
269 /* check dependency */
271 $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
272 foreach ( $res as $row )
274 $preq =& $manager->getPlugin($row['pfile']);
277 $depList = $preq->getPluginDep();
278 foreach ( $depList as $depName )
280 if ( $current['pfile'] == $depName )
282 $req[] = $row['pfile'];
288 if ( count($req) > 0 )
290 echo '<dt>' . _LIST_PLUGS_DEPREQ . "</dt>\n";
291 echo '<dd>' . Entity::hsc(implode(', ', $req)) . "</dd>\n";
294 /* check the database to see if it is up-to-date and notice the user if not */
295 if ( !$plug->subscribtionListIsUptodate() )
297 echo '<dt>' . 'NOTICE:' . "</dt>\n";
298 echo '<dd>' . _LIST_PLUG_SUBS_NEEDUPDATE . "</dd>\n";
306 echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])) . "</td>\n";
311 $current['pid'] = (integer) $current['pid'];
313 $url = Entity::hsc($manager->addTicketToUrl("index.php?plugid={$current['pid']}&action=pluginup"));
314 echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" , _LIST_PLUGS_UP , "</a></li>\n";
316 $url = Entity::hsc($manager->addTicketToUrl("index.php?plugid={$current['pid']}&action=plugindown"));
317 echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_DOWN , "</a></li>\n";
318 echo "<li><a href=\"index.php?action=plugindelete&plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_UNINSTALL , "</a></li>\n";
320 if ( $plug && ($plug->hasAdminArea() > 0) )
322 echo '<li><a href="' , Entity::hsc($plug->getAdminURL()) , '" tabindex="' , $template['tabindex'] , '">' , _LIST_PLUGS_ADMIN , "</a></li>\n";
325 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
327 echo "<li><a href=\"index.php?action=pluginhelp&plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_HELP , "</a></li>\n";
330 $query = "SELECT COUNT(*) AS result FROM %s WHERE ocontext='global' and opid=%s;";
331 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $current['pid']);
332 if ( DB::getValue($query) > 0 )
334 echo "<li><a href=\"index.php?action=pluginoptions&plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_OPTIONS . "</a></li>\n";
343 function listplug_table_plugoptionlist($template, $type)
349 echo '<th>' . _LISTS_INFO . "</th>\n";
350 echo '<th>' . _LISTS_VALUE . "</th>\n";
353 listplug_plugOptionRow($template['current']);
357 echo '<th colspan="2">' . _PLUGS_SAVE . "</th>\n";
360 echo "<td>" . _PLUGS_SAVE . "</td>\n";
361 echo "<td><input type=\"submit\" value=\"". _PLUGS_SAVE . "\" /></td>\n";
368 function listplug_plugOptionRow($current)
370 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
372 // retreive the optionmeta
373 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
375 // only if it is not a hidden option write the controls to the page
376 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
381 if ( !$current['description'] )
383 echo '<td>' , Entity::hsc($current['name']) . "</td>\n";
387 if ( !defined($current['description']) )
389 echo '<td>' , Entity::hsc($current['description']) . "</td>\n";
393 echo '<td>' , Entity::hsc(constant($current['description'])) . "</td>\n";
397 switch($current['type'])
400 Admin::input_yesno($varname, $current['value'], 0, 'yes', 'no');
403 echo '<input type="password" size="40" maxlength="128" name="',Entity::hsc($varname),'" value="',Entity::hsc($current['value']),"\" />\n";
406 echo '<select name="'.Entity::hsc($varname)."\">\n";
407 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
408 $options = preg_split('/\|/', $options);
410 for ( $i=0; $i<(count($options)-1); $i+=2 )
412 if ($options[$i+1] == $current['value'])
414 echo '<option value="' . Entity::hsc($options[$i+1]) . '" selected="selected">';
418 echo '<option value="' . Entity::hsc($options[$i+1]) . '">';
420 if ( defined($options[$i]) )
422 echo Entity::hsc(constant($options[$i]));
426 echo Entity::hsc($options[$i]);
434 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
435 if ( array_key_exists('access', $meta) && $meta['access'] == 'readonly' )
437 echo '<textarea class="pluginoption" cols="30" rows="5" name="' . Entity::hsc($varname) . "\" readonly=\"readonly\">\n";
441 echo '<textarea class="pluginoption" cols="30" rows="5" name="' . Entity::hsc($varname) . "\">\n";
443 echo Entity::hsc($current['value']) . "\n";
444 echo "</textarea>\n";
448 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
449 echo '<input type="text" size="40" maxlength="128" name="',Entity::hsc($varname),'" value="',Entity::hsc($current['value']),'"';
450 if ( array_key_exists('datatype', $meta) && $meta['datatype'] == 'numerical' )
452 echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
454 if ( array_key_exists('access', $current) && $meta['access'] == 'readonly')
456 echo ' readonly="readonly"';
460 if ( array_key_exists('extra', $current) )
462 echo $current['extra'];
469 function listplug_table_itemlist($template, $type)
476 echo "<th>"._LIST_ITEM_INFO."</th>\n";
477 echo "<th>"._LIST_ITEM_CONTENT."</th>\n";
478 echo "<th colspan='1'>"._LISTS_ACTIONS."</th>";
481 $current = $template['current'];
482 // string -> unix timestamp
483 $current['itime'] = strtotime($current['itime']);
485 if ( $current['idraft'] == 1 )
487 $cssclass = " class='draft'";
490 // (can't use offset time since offsets might vary between blogs)
491 if ( $current['itime'] > $template['now'] )
493 $cssclass = " class='future'";
496 echo "<td{$cssclass}>\n";
498 echo '<dt>' . _LIST_ITEM_BLOG . "</dt>\n";
499 echo '<dd>' . Entity::hsc($current['bshortname']) . "</dd>\n";
500 echo '<dt>' . _LIST_ITEM_CAT . "</dt>\n";
501 echo '<dd>' . Entity::hsc($current['cname']) . "</dd>\n";
502 echo '<dt>' . _LIST_ITEM_AUTHOR . "</dt>\n";
503 echo '<dd>' . Entity::hsc($current['mname']) . "</dd>\n";
504 echo '<dt>' . _LIST_ITEM_DATE . "</dt>\n";
505 echo '<dd>' . date("Y-m-d",$current['itime']) . "</dd>\n";
506 echo '<dt>' . _LIST_ITEM_TIME . "</dt>\n";
507 echo '<dd>' . date("H:i",$current['itime']) . "</dd>\n";
511 $id = listplug_nextBatchId();
513 echo "<td{$cssclass}>\n";
515 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['inumber']}\" />\n";
516 echo "<label for=\"batch{$id}\">" . Entity::hsc(strip_tags($current['ititle'])) . "</label>\n";
519 $current['ibody'] = strip_tags($current['ibody']);
520 $current['ibody'] = Entity::hsc(Entity::shorten($current['ibody'], 300, '...'));
521 echo "<p>{$current['ibody']}</p>\n";
524 echo "<td{$cssclass}>\n";
526 echo "<li><a href=\"index.php?action=itemedit&itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></li>\n";
528 // evaluate amount of comments for the item
529 $COMMENTS = new Comments($current['inumber']);
530 $camount = $COMMENTS->amountComments();
533 echo "<li><a href=\"index.php?action=itemcommentlist&itemid={$current['inumber']}\">( ";
534 echo sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments()) . " )</a></li>\n";
538 echo '<li>' . _LIST_ITEM_NOCONTENT . "</li>\n";
541 echo "<li><a href=\"index.php?action=itemmove&itemid={$current['inumber']}\">" . _LISTS_MOVE . "</a></li>\n";
542 echo "<li><a href=\"index.php?action=itemdelete&itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></li>\n";
550 // for batch operations: generates the index numbers for checkboxes
551 function listplug_nextBatchId()
557 function listplug_table_commentlist($template, $type)
562 echo '<th>' . _LISTS_INFO . "</th>\n";
563 echo '<th>' . _LIST_COMMENT . "</th>\n";
564 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>";
567 $current = $template['current'];
568 $current['ctime'] = strtotime($current['ctime']); // string -> unix timestamp
572 echo '<li>' . date("Y-m-d@H:i",$current['ctime']) . "</li>\n";
573 if ( isset($current['mname']) )
575 echo '<li>' . Entity::hsc($current['mname']) ,' ', _LIST_COMMENTS_MEMBER . "</li>\n";
579 echo '<li>' . Entity::hsc($current['cuser']) . "</li>\n";
581 if ( isset($current['cmail']) && $current['cmail'] )
583 echo '<li>' . Entity::hsc($current['cmail']) . "</li>\n";
585 if ( isset($current['cemail']) && $current['cemail'] )
587 echo '<li>' . Entity::hsc($current['cemail']) . "</li>\n";
592 $id = listplug_nextBatchId();
595 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}\" value=\"{$current['cnumber']}\" />\n";
596 echo "<label for=\"batch{$id}\">\n";
597 $current['cbody'] = strip_tags($current['cbody']);
598 $current['cbody'] = Entity::hsc(Entity::shorten($current['cbody'], 300, '...'));
599 echo $current['cbody'];
603 echo '<td><a href="index.php?action=commentedit&commentid=' . $current['cnumber'] . '">' . _LISTS_EDIT . "</a></td>\n";
604 echo '<td><a href="index.php?action=commentdelete&commentid=' . $current['cnumber'] . '">' . _LISTS_DELETE . "</a></td>\n";
605 if ( $template['canAddBan'] )
607 echo '<td><a href="index.php?action=banlistnewfromitem&itemid=' . $current['citem'] . '&ip=' . Entity::hsc($current['cip']), '" title="' . Entity::hsc($current['chost']) . '">' . _LIST_COMMENT_BANIP . "</a></td>\n";
614 function listplug_table_bloglist($template, $type)
619 echo '<th>' . _NAME . "</th>\n";
620 echo '<th colspan="7">' . _LISTS_ACTIONS . "</th>\n";
623 $current = $template['current'];
624 $current['bname'] = Entity::hsc($current['bname']);
626 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>{$current['bname']}</td>\n";
627 echo "<td><a href=\"index.php?action=createitem&blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_ADD ."\">" . _BLOGLIST_ADD . "</a></td>\n";
628 echo "<td><a href=\"index.php?action=itemlist&blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_EDIT."\">". _BLOGLIST_EDIT."</a></td>\n";
629 echo "<td><a href=\"index.php?action=blogcommentlist&blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_COMMENTS."\">". _BLOGLIST_COMMENTS."</a></td>\n";
630 echo "<td><a href=\"index.php?action=bookmarklet&blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_BMLET."\">". _BLOGLIST_BMLET . "</a></td>\n";
632 if ( $current['tadmin'] == 1 )
634 echo "<td><a href=\"index.php?action=blogsettings&blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_SETTINGS . "\">" . _BLOGLIST_SETTINGS . "</a></td>\n";
635 echo "<td><a href=\"index.php?action=banlist&blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_BANS . "\">" . _BLOGLIST_BANS . "</a></td>\n";
638 if ( $template['superadmin'] )
640 echo "<td><a href=\"index.php?action=deleteblog&blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_DELETE."\">" ._BLOGLIST_DELETE. "</a></td>\n";
647 function listplug_table_shortblognames($template, $type)
652 echo '<th>' . _EBLOG_SHORTNAME . "</th>\n";
653 echo '<th>' . _EBLOG_NAME. "</th>";
656 $current = $template['current'];
657 $current['bshortname'] = Entity::hsc($current['bshortname']);
658 $current['bname'] = Entity::hsc($current['bname']);
660 echo "<td>{$current['bshortname']}</td>\n";
661 echo "<td>{$current['bname']}</td>\n";
667 function listplug_table_shortnames($template, $type)
672 echo '<th>' . _NAME . "</th>\n";
673 echo '<th>' . _LISTS_DESC. "</th>\n";
676 $current = $template['current'];
677 $current['name'] = Entity::hsc($current['name']);
678 $current['description'] = Entity::hsc($current['description']);
680 echo "<td>{$current['name']}</td>\n";
681 echo "<td>{$current['description']}</td>\n";
688 function listplug_table_categorylist($template, $type)
693 echo '<th>' . _LISTS_NAME . "</th>";
694 echo '<th>' . _LISTS_DESC."</th>\n";
695 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
698 $id = listplug_nextBatchId();
700 $current = $template['current'];
701 $current['cname'] = Entity::hsc($current['cname']);
702 $current['cdesc'] = Entity::hsc($current['cdesc']);
705 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['catid']}\" />\n";
706 echo "<label for=\"batch{$id}\">{$current['cname']}</label>\n";
708 echo "<td>{$current['cdesc']}</td>\n";
709 echo "<td><a href=\"index.php?action=categoryedit&blogid={$current['cblog']}&catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a></td>\n";
710 echo "<td><a href=\"index.php?action=categorydelete&blogid={$current['cblog']}&catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
716 function listplug_table_templatelist($template, $type)
722 echo '<th>' . _LISTS_NAME . "</th>\n";
723 echo '<th>' . _LISTS_DESC . "</th>\n";
724 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
727 $current = $template['current'];
728 $current['tdnumber'] = (integer) $current['tdnumber'];
729 $current['tdname'] = Entity::hsc($current['tdname']);
730 $current['tddesc'] = Entity::hsc($current['tddesc']);
732 $url = "index.php?action=templateclone&templateid={$current['tdnumber']}";
733 $url = Entity::hsc($manager->addTicketToUrl($url));
735 echo "<td>{$current['tdname']}</td>\n";
736 echo "<td>{$current['tddesc']}</td>\n";
738 echo "<a href=\"index.php?action=templateedit&templateid={$current['tdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a>\n";
741 echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
744 echo "<a href=\"index.php?action=templatedelete&templateid={$current['tdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a>\n";
751 function listplug_table_skinlist($template, $type)
753 global $CONF, $DIR_SKINS, $manager;
757 echo '<th>' . _LISTS_NAME . "</th>\n";
758 echo '<th>' . _LISTS_DESC . "</th>\n";
759 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
762 $current = $template['current'];
763 $current['sdnumber'] = (integer) $current['sdnumber'];
764 $current['sdname'] = Entity::hsc($current['sdname']);
765 $current['sdtype'] = Entity::hsc($current['sdtype']);
769 // use a special style for the default skin
770 if ( $current['sdnumber'] == $CONF['BaseSkin'] )
772 echo '<h3 id="base_skin">' . $current['sdname'] . "</h3>\n";
776 echo '<h3>' . $current['sdname'] . "</h3>\n";
780 echo '<dt>' . _LISTS_TYPE . "</dt>\n";
781 echo '<dd>' . $current['sdtype'] . "</dd>\n";
783 echo '<dt>' . _LIST_SKINS_INCMODE . "</dt>\n";
785 if ( $current['sdincmode'] == 'skindir' )
787 echo '<dd>' . _PARSER_INCMODE_SKINDIR . "</dd>\n";
791 echo '<dd>' . _PARSER_INCMODE_NORMAL . "</dd>\n";
794 if ( $current['sdincpref'] )
796 echo '<dt>' . _LIST_SKINS_INCPREFIX . "</dt>\n";
797 echo '<dd>' . Entity::hsc($current['sdincpref']) . "</dd>\n";
801 // add preview image when present
802 if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
806 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
807 $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
808 if ( $has_enlargement )
810 echo '<a href="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
811 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
816 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" /><br />\n";
819 if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
821 $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
822 $title = sprintf(_LIST_SKIN_README, $current['sdname']);
823 echo "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
832 echo '<p>' . Entity::hsc($current['sddesc']) . "</p>\n";
834 /* make list of defined skins */
835 $skin = new Skin($current['sdnumber']);
836 $available_skin_types = $skin->getAvailableTypes();
838 echo _LIST_SKINS_DEFINED;
840 foreach ( $available_skin_types as $type => $friendlyName )
842 if ( $friendlyName === FALSE )
844 $friendlyName = ucfirst($type);
845 $article = 'skinpartspecial';
849 $article = "skinpart{$type}";
852 echo helpHtml($article) . "\n";
853 echo "<a href=\"index.php?action=skinedittype&skinid={$current['sdnumber']}&type={$type}\" tabindex=\"{$template['tabindex']}\">";
854 echo Entity::hsc($friendlyName);
862 echo "<a href=\nindex.php?action=skinedit&skinid={$current['sdnumber']}\n tabindex=\n{$template['tabindex']}>" . _LISTS_EDIT . "</a>\n";
865 $url = "index.php?action=skinclone&skinid={$current['sdnumber']}";
866 $url = Entity::hsc($manager->addTicketToUrl($url));
868 echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
871 echo "<a href=\"index.php?action=skindelete&skinid={$current['sdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
877 function listplug_table_draftlist($template, $type)
882 echo '<th>' . _LISTS_BLOG . "</th>\n";
883 echo '<th>' . _LISTS_TITLE . "</th>\n";
884 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
887 $current = $template['current'];
888 $current['bshortname'] = Entity::hsc($current['bshortname']);
889 $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
891 echo "<td>{$current['bshortname']}</td>\n";
892 echo "<td>{$current['ititle']}</td>\n";
893 echo "<td><a href=\"index.php?action=itemedit&itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
894 echo "<td><a href=\"index.php?action=itemdelete&itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
900 function listplug_table_otherdraftlist($template, $type)
905 echo '<th>' . _LISTS_BLOG . "</th>\n";
906 echo '<th>' . _LISTS_TITLE . "</th>\n";
907 echo '<th>' . _LISTS_AUTHOR . "</th>\n";
908 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
911 $current = $template['current'];
912 $current['bshortname'] = Entity::hsc($current['bshortname']);
913 $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
914 $current['mname'] = Entity::hsc($current['mname']);
916 echo "<td>{$current['bshortname']}</td>\n";
917 echo "<td>{$current['ititle']}</td>\n";
918 echo "<td>{$current['mname']}</td>\n";
919 echo "<td><a href=\"index.php?action=itemedit&itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
920 echo "<td><a href=\"index.php?action=itemdelete&itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
926 function listplug_table_actionlist($template, $type)
931 echo '<th>' . _LISTS_TIME . "</th>\n";
932 echo '<th>' . _LIST_ACTION_MSG . "</th>\n";
935 $current = $template['current'];
936 $current['timestamp'] = Entity::hsc($current['timestamp']);
937 $current['message'] = Entity::hsc($current['message']);
939 echo "<td>{$current['timestamp']}</td>\n";
940 echo "<td>{$current['message']}</td>\n";
946 function listplug_table_banlist($template, $type)
951 echo '<th>' . _LIST_BAN_IPRANGE . "</th>\n";
952 echo '<th>' . _LIST_BAN_REASON."</th>\n";
953 echo '<th>' . _LISTS_ACTIONS . "</th>\n";
956 $current = $template['current'];
957 $current['blogid'] = (integer) $current['blogid'];
958 $current['iprange'] = Entity::hsc($current['iprange']);
959 $current['reason'] = Entity::hsc($current['reason']);
961 echo "<td>{$current['iprange']}</td>\n";
962 echo "<td>{$current['reason']}</td>\n";
963 echo '<td><a href="index.php?action=banlistdelete&blogid=' . $current['blogid'] . '&iprange=' . Entity::hsc($current['iprange']) . '">' . _LISTS_DELETE . "</a></td>\n";