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 1662 2012-02-12 12:18:37Z 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 = sql_query($query);
47 // don't do anything if there are no results
48 $numrows = sql_num_rows($res);
53 call_user_func("listplug_{$type}", $template, 'HEAD');
55 while( $template['current'] = sql_fetch_object($res) )
57 call_user_func("listplug_{$type}", $template, 'BODY');
60 call_user_func("listplug_{$type}", $template, 'FOOT');
62 sql_free_result($res);
64 // return amount of results
69 function listplug_select($template, $type)
74 echo '<select name="' . ifset($template['name']) . '" tabindex="' . ifset($template['tabindex']) . '" ' . ifset($template['javascript']) . ">\n";
76 // add extra row if needed
77 if ( ifset($template['extra']) )
79 echo '<option value="', ifset($template['extraval']), '">', $template['extra'], "</option>\n";
84 $current = $template['current'];
86 echo '<option value="' . ENTITY::hsc($current->value) . '"';
87 if ( $template['selected'] == $current->value )
89 echo ' selected="selected" ';
91 if ( isset($template['shorten']) && $template['shorten'] > 0 )
93 echo ' title="'. ENTITY::hsc($current->text).'"';
94 $current->text = ENTITY::hsc(ENTITY::shorten($current->text, $template['shorten'], $template['shortenel']));
96 echo '>' . ENTITY::hsc($current->text) . "</option>\n";
105 function listplug_table($template, $type)
111 echo "<table frame=\"box\" rules=\"all\" summary=\"{$template['content']}\">\n";
115 call_user_func("listplug_table_{$template['content']}" , $template, 'HEAD');
121 // print tabletype specific thingies
123 call_user_func("listplug_table_{$template['content']}" , $template, 'BODY');
127 call_user_func("listplug_table_{$template['content']}" , $template, 'FOOT');
136 function listplug_table_memberlist($template, $type)
141 echo '<th>' . _LIST_MEMBER_NAME . "</th>\n";
142 echo '<th>' . _LIST_MEMBER_RNAME . "</th>\n";
143 echo '<th>' . _LIST_MEMBER_URL . "</th>\n";
144 echo '<th>' . _LIST_MEMBER_ADMIN . "</th>\n";
147 echo '<th>' . _LIST_MEMBER_LOGIN;
150 echo '<th colspan="2">' . _LISTS_ACTIONS. "</th>\n";
153 $current = $template['current'];
155 $id = listplug_nextBatchId();
156 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->mnumber}\" />\n";
157 echo "<label for=\"batch{$id}\">\n";
158 echo '<a href="mailto:' . ENTITY::hsc($current->memail) . '" tabindex="' . $template['tabindex'] . '">' . ENTITY::hsc($current->mname), "</a>\n";
161 echo "<td>" . ENTITY::hsc($current->mrealname) . "</td>\n";
162 echo '<td><a href="' . ENTITY::hsc($current->murl) . '" tabindex="' . $template['tabindex'] . '">' . ENTITY::hsc($current->murl) . "</a></td>\n";
163 echo '<td>' . ($current->madmin ? _YES : _NO) . "</td>\n";
164 echo '<td>' . ($current->mcanlogin ? _YES : _NO) . "</td>\n";
165 echo '<td><a href="index.php?action=memberedit&memberid=$current->mnumber" tabindex="' . $template['tabindex'] . '">' . _LISTS_EDIT . "</a></td>\n";
166 echo '<td><a href="index.php?action=memberdelete&memberid=$current->mnumber" tabindex="' . $template['tabindex'].'">' . _LISTS_DELETE . "</a></td>\n";
172 function listplug_table_teamlist($template, $type)
178 echo "<th>" . _LIST_MEMBER_NAME . "</th>\n";
179 echo "<th>" . _LIST_MEMBER_RNAME . "</th>\n";
180 echo "<th>" . _LIST_TEAM_ADMIN . "</th>\n";
183 echo "<th colspan=\"2\">"._LISTS_ACTIONS."</th>\n";
186 $current = $template['current'];
189 $id = listplug_nextBatchId();
190 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->tmember}\" />\n";
191 echo '<label for="batch',$id,'">';
192 echo '<a href="mailto:' . ENTITY::hsc($current->memail) . '" tabindex="' . $template['tabindex'] . '">' . ENTITY::hsc($current->mname), "</a>\n";
195 echo '<td>', ENTITY::hsc($current->mrealname), "</td>\n";
196 echo '<td>', ($current->tadmin ? _YES : _NO) , "</td>\n";
197 echo "<td><a href=\"index.php?action=teamdelete&memberid=$current->tmember&blogid={$current->tblog}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
199 $url = "index.php?action=teamchangeadmin&memberid={$current->tmember}&blogid={$current->tblog}";
200 $url = $manager->addTicketToUrl($url);
201 echo '<td><a href="' . ENTITY::hsc($url) . '" tabindex="' . $template['tabindex'] . '">' . _LIST_TEAM_CHADMIN . "</a></td>\n";
207 function listplug_table_pluginlist($template, $type)
213 echo '<th>' . _LISTS_INFO . "</th>\n";
214 echo '<th>' . _LISTS_DESC . "</th>\n";
215 echo '<th>' . _LISTS_ACTIONS . "</th>\n";
218 $current = $template['current'];
220 $plug =& $manager->getPlugin($current->pfile);
224 echo '<h3>' . ENTITY::hsc($plug->getName()) . "</h3>\n";
227 if ( $plug->getAuthor() )
229 echo '<dt>' . _LIST_PLUGS_AUTHOR . "</dt>\n";
230 echo '<dd>' . ENTITY::hsc($plug->getAuthor()) , "</dd>\n";
233 if ( $plug->getVersion() )
235 echo '<dt>' . _LIST_PLUGS_VER, "</dt>\n";
236 echo '<dd>' . ENTITY::hsc($plug->getVersion()) . "</dd>\n";
239 if ( $plug->getURL() )
241 echo '<dt>' . _LIST_PLUGS_SITE . "<dt>\n";
242 echo '<dd><a href="' . ENTITY::hsc($plug->getURL()) . '" tabindex="' . $template['tabindex'] . '">リンク</a></dd>' . "\n";
249 echo '<dt>' . _LIST_PLUGS_DESC ."</dt>\n";
250 echo '<dd>' . ENTITY::hen($plug->getDescription()) ."</dd>\n";
251 if ( sizeof($plug->getEventList()) > 0 )
253 echo '<dt>' . _LIST_PLUGS_SUBS ."</dt>\n";
254 echo '<dd>' . ENTITY::hsc(implode(', ', $plug->getEventList())) ."</dd>\n";
257 if ( sizeof($plug->getPluginDep()) > 0 )
259 echo '<dt>' . _LIST_PLUGS_DEP ."</dt>\n";
260 echo '<dd>' . ENTITY::hsc(implode(', ', $plug->getPluginDep())) ."</dd>\n";
263 /* check dependency */
265 $res = sql_query('SELECT pfile FROM ' . sql_table('plugin'));
266 while( $o = sql_fetch_object($res) )
268 $preq =& $manager->getPlugin($o->pfile);
271 $depList = $preq->getPluginDep();
272 foreach ( $depList as $depName )
274 if ( $current->pfile == $depName )
282 if ( count($req) > 0 )
284 echo '<dt>' . _LIST_PLUGS_DEPREQ . "</dt>\n";
285 echo '<dd>' . ENTITY::hsc(implode(', ', $req)) . "</dd>\n";
288 /* check the database to see if it is up-to-date and notice the user if not */
289 if ( !$plug->subscribtionListIsUptodate() )
291 echo '<dt>' . 'NOTICE:' . "</dt>\n";
292 echo '<dd>' . _LIST_PLUG_SUBS_NEEDUPDATE . "</dd>\n";
300 echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, ENTITY::hsc($current->pfile)) . "</td>\n";
305 $current->pid = (integer) $current->pid;
307 $url = ENTITY::hsc($manager->addTicketToUrl("index.php?plugid={$current->pid}&action=pluginup"));
308 echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" , _LIST_PLUGS_UP , "</a></li>\n";
310 $url = ENTITY::hsc($manager->addTicketToUrl("index.php?plugid={$current->pid}&action=plugindown"));
311 echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_DOWN , "</a></li>\n";
312 echo "<li><a href=\"index.php?action=plugindelete&plugid={$current->pid}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_UNINSTALL , "</a></li>\n";
314 if ( $plug && ($plug->hasAdminArea() > 0) )
316 echo '<li><a href="' , ENTITY::hsc($plug->getAdminURL()) , '" tabindex="' , $template['tabindex'] , '">' , _LIST_PLUGS_ADMIN , "</a></li>\n";
319 if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
321 echo "<li><a href=\"index.php?action=pluginhelp&plugid={$current->pid}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_HELP , "</a></li>\n";
324 $query = "SELECT COUNT(*) AS result FROM %s WHERE ocontext='global' and opid=%s;";
325 $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $current->pid);
326 if ( quickQuery($query) > 0 )
328 echo "<li><a href=\"index.php?action=pluginoptions&plugid={$current->pid}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_OPTIONS . "</a></li>\n";
337 function listplug_table_plugoptionlist($template, $type)
343 echo '<th>' . _LISTS_INFO . "</th>\n";
344 echo '<th>' . _LISTS_VALUE . "</th>\n";
347 listplug_plugOptionRow($template['current']);
351 echo '<th colspan=\"2\">' . _PLUGS_SAVE . "</th>\n";
354 echo "<td>" . _PLUGS_SAVE . "</td>\n";
355 echo "<td><input type=\"submit\" value=\"". _PLUGS_SAVE . "\" /></td>\n";
362 function listplug_plugOptionRow($current)
364 $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
366 // retreive the optionmeta
367 $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
369 // only if it is not a hidden option write the controls to the page
370 if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
375 if ( !$current['description'] )
377 echo '<td>' , ENTITY::hsc($current['name']) . "</td>\n";
381 if ( !defined($current['description']) )
383 echo '<td>' , ENTITY::hsc($current['description']) . "</td>\n";
387 echo '<td>' , ENTITY::hsc(constant($current['description'])) . "</td>\n";
391 switch($current['type'])
394 ADMIN::input_yesno($varname, $current['value'], 0, 'yes', 'no');
397 echo '<input type="password" size="40" maxlength="128" name="',ENTITY::hsc($varname),'" value="',ENTITY::hsc($current['value']),"\" />\n";
400 echo '<select name="'.ENTITY::hsc($varname)."\">\n";
401 $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
402 $options = i18n::explode('|', $options);
404 for ( $i=0; $i<(count($options)-1); $i+=2 )
406 if ($options[$i+1] == $current['value'])
408 echo '<option value="' . ENTITY::hsc($options[$i+1]) . '" selected="selected">';
412 echo '<option value="' . ENTITY::hsc($options[$i+1]) . '">';
414 if ( defined($options[$i]) )
416 echo ENTITY::hsc(constant($options[$i]));
420 echo ENTITY::hsc($options[$i]);
428 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
429 if ( array_key_exists('access', $meta) && $meta['access'] == 'readonly' )
431 echo '<textarea class="pluginoption" cols="30" rows="5" name="' . ENTITY::hsc($varname) . "\" readonly=\"readonly\">\n";
435 echo '<textarea class="pluginoption" cols="30" rows="5" name="' . ENTITY::hsc($varname) . "\">\n";
437 echo ENTITY::hsc($current['value']) . "\n";
438 echo "</textarea>\n";
442 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
443 echo '<input type="text" size="40" maxlength="128" name="',ENTITY::hsc($varname),'" value="',ENTITY::hsc($current['value']),'"';
444 if ( array_key_exists('datatype', $meta) && $meta['datatype'] == 'numerical' )
446 echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
448 if ( array_key_exists('access', $current) && $meta['access'] == 'readonly')
450 echo ' readonly="readonly"';
454 if ( array_key_exists('extra', $current) )
456 echo $current['extra'];
463 function listplug_table_itemlist($template, $type)
470 echo "<th>"._LIST_ITEM_INFO."</th>\n";
471 echo "<th>"._LIST_ITEM_CONTENT."</th>\n";
472 echo "<th colspan='1'>"._LISTS_ACTIONS."</th>";
475 $current = $template['current'];
476 // string -> unix timestamp
477 $current->itime = strtotime($current->itime);
479 if ( $current->idraft == 1 )
481 $cssclass = " class='draft'";
484 // (can't use offset time since offsets might vary between blogs)
485 if ( $current->itime > $template['now'] )
487 $cssclass = " class='future'";
490 echo "<td{$cssclass}>\n";
492 echo '<dt>' . _LIST_ITEM_BLOG . "</dt>\n";
493 echo '<dd>' . ENTITY::hsc($current->bshortname) . "</dd>\n";
494 echo '<dt>' . _LIST_ITEM_CAT . "</dt>\n";
495 echo '<dd>' . ENTITY::hsc($current->cname) . "</dd>\n";
496 echo '<dt>' . _LIST_ITEM_AUTHOR . "</dt>\n";
497 echo '<dd>' . ENTITY::hsc($current->mname) . "</dd>\n";
498 echo '<dt>' . _LIST_ITEM_DATE . "</dt>\n";
499 echo '<dd>' . date("Y-m-d",$current->itime) . "</dd>\n";
500 echo '<dt>' . _LIST_ITEM_TIME . "</dt>\n";
501 echo '<dd>' . date("H:i",$current->itime) . "</dd>\n";
505 $id = listplug_nextBatchId();
507 echo "<td{$cssclass}>\n";
509 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->inumber}\" />\n";
510 echo "<label for=\"batch{$id}\">" . ENTITY::hsc(strip_tags($current->ititle)) . "</label>\n";
513 $current->ibody = strip_tags($current->ibody);
514 $current->ibody = ENTITY::hsc(ENTITY::shorten($current->ibody, 300, '...'));
515 echo "<p>$current->ibody</p>\n";
518 echo "<td{$cssclass}>\n";
520 echo "<li><a href=\"index.php?action=itemedit&itemid={$current->inumber}\">" . _LISTS_EDIT . "</a></li>\n";
522 // evaluate amount of comments for the item
523 $COMMENTS = new COMMENTS($current->inumber);
524 $camount = $COMMENTS->amountComments();
527 echo "<li><a href=\"index.php?action=itemcommentlist&itemid=$current->inumber\">( ";
528 echo sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments()) . " )</a></li>\n";
532 echo '<li>' . _LIST_ITEM_NOCONTENT . "</li>\n";
535 echo "<li><a href=\"index.php?action=itemmove&itemid={$current->inumber}\">" . _LISTS_MOVE . "</a></li>\n";
536 echo "<li><a href=\"index.php?action=itemdelete&itemid={$current->inumber}\">" . _LISTS_DELETE . "</a></li>\n";
544 // for batch operations: generates the index numbers for checkboxes
545 function listplug_nextBatchId()
551 function listplug_table_commentlist($template, $type)
556 echo '<th>' . _LISTS_INFO . "</th>\n";
557 echo '<th>' . _LIST_COMMENT . "</th>\n";
558 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>";
561 $current = $template['current'];
562 $current->ctime = strtotime($current->ctime); // string -> unix timestamp
566 echo '<li>' . date("Y-m-d@H:i",$current->ctime) . "</li>\n";
567 if ( isset($current->mname) )
569 echo '<li>' . ENTITY::hsc($current->mname) ,' ', _LIST_COMMENTS_MEMBER . "</li>\n";
573 echo '<li>' . ENTITY::hsc($current->cuser) . "</li>\n";
575 if ( isset($current->cmail) && $current->cmail )
577 echo '<li>' . ENTITY::hsc($current->cmail) . "</li>\n";
579 if ( isset($current->cemail) && $current->cemail )
581 echo '<li>' . ENTITY::hsc($current->cemail) . "</li>\n";
586 $id = listplug_nextBatchId();
589 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}\" value=\"{$current->cnumber}\" />\n";
590 echo "<label for=\"batch{$id}\">\n";
591 $current->cbody = strip_tags($current->cbody);
592 $current->cbody = ENTITY::hsc(ENTITY::shorten($current->cbody, 300, '...'));
593 echo $current->cbody;
597 echo '<td><a href="index.php?action=commentedit&commentid=' . $current->cnumber . '">' . _LISTS_EDIT . "</a></td>\n";
598 echo '<td><a href="index.php?action=commentdelete&commentid=' . $current->cnumber . '">' . _LISTS_DELETE . "</a></td>\n";
599 if ( $template['canAddBan'] )
601 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";
608 function listplug_table_bloglist($template, $type)
613 echo '<th>' . _NAME . "</th>\n";
614 echo '<th colspan="7">' . _LISTS_ACTIONS . "</th>\n";
617 $current = $template['current'];
618 $current->bname = ENTITY::hsc($current->bname);
620 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";
621 echo "<td><a href=\"index.php?action=createitem&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_ADD ."\">" . _BLOGLIST_ADD . "</a></td>\n";
622 echo "<td><a href=\"index.php?action=itemlist&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_EDIT."\">". _BLOGLIST_EDIT."</a></td>\n";
623 echo "<td><a href=\"index.php?action=blogcommentlist&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_COMMENTS."\">". _BLOGLIST_COMMENTS."</a></td>\n";
624 echo "<td><a href=\"index.php?action=bookmarklet&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_BMLET."\">". _BLOGLIST_BMLET . "</a></td>\n";
626 if ( $current->tadmin == 1 )
628 echo "<td><a href=\"index.php?action=blogsettings&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_SETTINGS . "\">" . _BLOGLIST_SETTINGS . "</a></td>\n";
629 echo "<td><a href=\"index.php?action=banlist&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_BANS . "\">" . _BLOGLIST_BANS . "</a></td>\n";
632 if ( $template['superadmin'] )
634 echo "<td><a href=\"index.php?action=deleteblog&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_DELETE."\">" ._BLOGLIST_DELETE. "</a></td>\n";
641 function listplug_table_shortblognames($template, $type)
646 echo '<th>' . _EBLOG_SHORTNAME . "</th>\n";
647 echo '<th>' . _EBLOG_NAME. "</th>";
650 $current = $template['current'];
651 $current->bshortname = ENTITY::hsc($current->bshortname);
652 $current->bname = ENTITY::hsc($current->bname);
654 echo "<td>{$current->bshortname}</td>\n";
655 echo "<td>{$current->bname}</td>\n";
661 function listplug_table_shortnames($template, $type)
666 echo '<th>' . _NAME . "</th>\n";
667 echo '<th>' . _LISTS_DESC. "</th>\n";
670 $current = $template['current'];
671 $current->name = ENTITY::hsc($current->name);
672 $current->description = ENTITY::hsc($current->description);
674 echo "<td>{$current->name}</td>\n";
675 echo "<td>{$current->description}</td>\n";
682 function listplug_table_categorylist($template, $type)
687 echo '<th>' . _LISTS_NAME . "</th>";
688 echo '<th>' . _LISTS_DESC."</th>\n";
689 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
692 $id = listplug_nextBatchId();
694 $current = $template['current'];
695 $current->cname = ENTITY::hsc($current->cname);
696 $current->cdesc = ENTITY::hsc($current->cdesc);
699 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->catid}\" />\n";
700 echo "<label for=\"batch{$id}\">{$current->cname}</label>\n";
702 echo "<td>{$current->cdesc}</td>\n";
703 echo "<td><a href=\"index.php?action=categoryedit&blogid={$current->cblog}&catid={$current->catid}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a></td>\n";
704 echo "<td><a href=\"index.php?action=categorydelete&blogid={$current->cblog}&catid={$current->catid}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
710 function listplug_table_templatelist($template, $type)
716 echo '<th>' . _LISTS_NAME . "</th>\n";
717 echo '<th>' . _LISTS_DESC . "</th>\n";
718 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
721 $current = $template['current'];
722 $current->tdnumber = (integer) $current->tdnumber;
723 $current->tdname = ENTITY::hsc($current->tdname);
724 $current->tddesc = ENTITY::hsc($current->tddesc);
726 $url = "index.php?action=templateclone&templateid={$current->tdnumber}";
727 $url = ENTITY::hsc($manager->addTicketToUrl($url));
729 echo "<td>{$current->tdname}</td>\n";
730 echo "<td>{$current->tddesc}</td>\n";
732 echo "<a href=\"index.php?action=templateedit&templateid={$current->tdnumber}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a>\n";
735 echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
738 echo "<a href=\"index.php?action=templatedelete&templateid={$current->tdnumber}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a>\n";
745 function listplug_table_skinlist($template, $type)
747 global $CONF, $DIR_SKINS, $manager;
751 echo '<th>' . _LISTS_NAME . "</th>\n";
752 echo '<th>' . _LISTS_DESC . "</th>\n";
753 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
756 $current = $template['current'];
757 $current->sdnumber = (integer) $current->sdnumber;
758 $current->sdname = ENTITY::hsc($current->sdname);
759 $current->sdtype = ENTITY::hsc($current->sdtype);
763 // use a special style for the default skin
764 if ( $current->sdnumber == $CONF['BaseSkin'] )
766 echo '<h3 id="base_skin">' . $current->sdname . "</h3>\n";
770 echo '<h3>' . $current->sdname . "</h3>\n";
774 echo '<dt>' . _LISTS_TYPE . "</dt>\n";
775 echo '<dd>' . $current->sdtype . "</dd>\n";
777 echo '<dt>' . _LIST_SKINS_INCMODE . "</dt>\n";
779 if ( $current->sdincmode == 'skindir' )
781 echo '<dd>' . _PARSER_INCMODE_SKINDIR . "</dd>\n";
785 echo '<dd>' . _PARSER_INCMODE_NORMAL . "</dd>\n";
788 if ( $current->sdincpref )
790 echo '<dt>' . _LIST_SKINS_INCPREFIX . "</dt>\n";
791 echo '<dd>' . ENTITY::hsc($current->sdincpref) . "</dd>\n";
795 // add preview image when present
796 if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") )
800 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
801 $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
802 if ( $has_enlargement )
804 echo '<a href="',$CONF['SkinsURL'], ENTITY::hsc($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
805 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], ENTITY::hsc($current->sdincpref),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
810 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], ENTITY::hsc($current->sdincpref),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" /><br />\n";
813 if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
815 $url = $CONF['SkinsURL'] . ENTITY::hsc($current->sdincpref) . 'readme.html';
816 $title = sprintf(_LIST_SKIN_README, $current->sdname);
817 echo "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
826 echo '<p>' . ENTITY::hsc($current->sddesc) . "</p>\n";
828 /* show list of defined parts */
829 $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
830 $query = sprintf($query, sql_table('skin'), $current->sdnumber);
831 $r = sql_query($query);
834 while ( $o = sql_fetch_object($r) )
836 array_push($types, $o->stype);
838 if ( sizeof($types) > 0 )
840 $friendlyNames = SKIN::getFriendlyNames();
841 for ( $i = 0; $i < sizeof($types); $i++ )
844 if ( !in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup')) )
846 $article = 'skinpartspecial';
850 $article = "skinpart{$type}";
852 $types[$i] = "<li>\n";
853 $types[$i] .= helpHtml($article) . "\n";
854 $types[$i] .= "<a href=\"index.php?action=skinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$template['tabindex']}\">" . ENTITY::hsc($friendlyNames[$type]) . "</a>\n";
855 $types[$i] .= "</li>\n";
857 echo _LIST_SKINS_DEFINED;
858 echo '<ul>' . implode('', $types) . "</ul>\n";
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";