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 1661 2012-02-12 11:55:39Z 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="' . i18n::hsc($current->value) . '"';
87 if ( $template['selected'] == $current->value )
89 echo ' selected="selected" ';
91 if ( isset($template['shorten']) && $template['shorten'] > 0 )
93 echo ' title="'. i18n::hsc($current->text).'"';
94 $current->text = i18n::hsc(shorten($current->text, $template['shorten'], $template['shortenel']));
96 echo '>' . i18n::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:' . i18n::hsc($current->memail) . '" tabindex="' . $template['tabindex'] . '">' . i18n::hsc($current->mname), "</a>\n";
161 echo "<td>" . i18n::hsc($current->mrealname) . "</td>\n";
162 echo '<td><a href="' . i18n::hsc($current->murl) . '" tabindex="' . $template['tabindex'] . '">' . i18n::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:' . i18n::hsc($current->memail) . '" tabindex="' . $template['tabindex'] . '">' . i18n::hsc($current->mname), "</a>\n";
195 echo '<td>', i18n::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="' . i18n::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>' . i18n::hsc($plug->getName()) . "</h3>\n";
227 if ( $plug->getAuthor() )
229 echo '<dt>' . _LIST_PLUGS_AUTHOR . "</dt>\n";
230 echo '<dd>' . i18n::hsc($plug->getAuthor()) , "</dd>\n";
233 if ( $plug->getVersion() )
235 echo '<dt>' . _LIST_PLUGS_VER, "</dt>\n";
236 echo '<dd>' . i18n::hsc($plug->getVersion()) . "</dd>\n";
239 if ( $plug->getURL() )
241 echo '<dt>' . _LIST_PLUGS_SITE . "<dt>\n";
242 echo '<dd><a href="' . i18n::hsc($plug->getURL()) . '" tabindex="' . $template['tabindex'] . '">リンク</a></dd>' . "\n";
249 echo '<dt>' . _LIST_PLUGS_DESC ."</dt>\n";
250 echo '<dd>' . i18n::hen($plug->getDescription()) ."</dt>\n";
251 if ( sizeof($plug->getEventList()) > 0 )
253 echo '<dt>' . _LIST_PLUGS_SUBS ."</dt>\n";
254 echo '<dd>' . i18n::hsc(implode(', ', $plug->getEventList())) ."</dt>\n";
257 if ( sizeof($plug->getPluginDep()) > 0 )
259 echo '<dt>' . _LIST_PLUGS_DEP ."</dt>\n";
260 echo '<dd>' . i18n::hsc(implode(', ', $plug->getPluginDep())) ."</dt>\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>' . i18n::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, i18n::hsc($current->pfile)) . "</td>\n";
305 $current->pid = (integer) $current->pid;
307 $url = i18n::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 = i18n::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="' , i18n::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>' , i18n::hsc($current['name']) . "</td>\n";
381 if ( !defined($current['description']) )
383 echo '<td>' , i18n::hsc($current['description']) . "</td>\n";
387 echo '<td>' , i18n::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="',i18n::hsc($varname),'" value="',i18n::hsc($current['value']),"\" />\n";
400 echo '<select name="'.i18n::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="' . i18n::hsc($options[$i+1]) . '" selected="selected">';
412 echo '<option value="' . i18n::hsc($options[$i+1]) . '">';
414 if ( defined($options[$i]) )
416 echo i18n::hsc(constant($options[$i]));
420 echo i18n::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="' . i18n::hsc($varname) . "\" readonly=\"readonly\">\n";
435 echo '<textarea class="pluginoption" cols="30" rows="5" name="' . i18n::hsc($varname) . "\">\n";
437 echo i18n::hsc($current['value']) . "\n";
438 echo "</textarea>\n";
442 //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
443 echo '<input type="text" size="40" maxlength="128" name="',i18n::hsc($varname),'" value="',i18n::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";
491 echo '<dt>' . _LIST_ITEM_BLOG . "</dt>\n";
492 echo i18n::hsc($current->bshortname) . "</dd>\n";
493 echo '<dt>' . _LIST_ITEM_CAT . "</dt>\n";
494 echo i18n::hsc($current->cname) . "</dd>\n";
495 echo '<dt>' . _LIST_ITEM_AUTHOR . "</dt>\n";
496 echo i18n::hsc($current->mname) . "</dd>\n";
497 echo '<dt>' . _LIST_ITEM_DATE . "</dt>\n";
498 echo date("Y-m-d",$current->itime) . "</dd>\n";
499 echo '<dt>' . _LIST_ITEM_TIME . "</dt>\n";
500 echo date("H:i",$current->itime) . "</dd>\n";
503 $id = listplug_nextBatchId();
505 echo "<td {$cssclass}>\n";
507 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->inumber}\" />\n";
508 echo "<label for=\"batch{$id}\">" . i18n::hsc(strip_tags($current->ititle)) . "</label>\n";
511 $current->ibody = strip_tags($current->ibody);
512 $current->ibody = i18n::hsc(shorten($current->ibody, 300, '...'));
513 echo "<p>$current->ibody</p>\n";
516 echo "<td {$cssclass}>\n";
518 echo "<li><a href=\"index.php?action=itemedit&itemid={$current->inumber}\">" . _LISTS_EDIT . "</a></li>\n";
520 // evaluate amount of comments for the item
521 $COMMENTS = new COMMENTS($current->inumber);
522 $camount = $COMMENTS->amountComments();
525 echo "<li><a href=\"index.php?action=itemcommentlist&itemid=$current->inumber\">( ";
526 echo sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments()) . " )</a></li>\n";
530 echo '<li>' . _LIST_ITEM_NOCONTENT . "</li>\n";
533 echo "<li><a href=\"index.php?action=itemmove&itemid={$current->inumber}\">" . _LISTS_MOVE . "</a></li>\n";
534 echo "<li><a href=\"index.php?action=itemdelete&itemid={$current->inumber}\">" . _LISTS_DELETE . "</a></li>\n";
542 // for batch operations: generates the index numbers for checkboxes
543 function listplug_nextBatchId()
549 function listplug_table_commentlist($template, $type)
554 echo '<th>' . _LISTS_INFO . "</th>\n";
555 echo '<th>' . _LIST_COMMENT . "</th>\n";
556 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>";
559 $current = $template['current'];
560 $current->ctime = strtotime($current->ctime); // string -> unix timestamp
564 echo '<li>' . date("Y-m-d@H:i",$current->ctime) . "</li>\n";
565 if ( isset($current->mname) )
567 echo '<li>' . i18n::hsc($current->mname) ,' ', _LIST_COMMENTS_MEMBER . "</li>\n";
571 echo '<li>' . i18n::hsc($current->cuser) . "</li>\n";
573 if ( isset($current->cmail) && $current->cmail )
575 echo '<li>' . i18n::hsc($current->cmail) . "</li>\n";
577 if ( isset($current->cemail) && $current->cemail )
579 echo '<li>' . i18n::hsc($current->cemail) . "</li>\n";
584 $id = listplug_nextBatchId();
587 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}\" value=\"{$current->cnumber}\" />\n";
588 echo "<label for=\"batch{$id}\">\n";
589 $current->cbody = strip_tags($current->cbody);
590 $current->cbody = i18n::hsc(shorten($current->cbody, 300, '...'));
591 echo $current->cbody;
595 echo '<td><a href="index.php?action=commentedit&commentid=' . $current->cnumber . '">' . _LISTS_EDIT . "</a></td>\n";
596 echo '<td><a href="index.php?action=commentdelete&commentid=' . $current->cnumber . '">' . _LISTS_DELETE . "</a></td>\n";
597 if ( $template['canAddBan'] )
599 echo '<td><a href="index.php?action=banlistnewfromitem&itemid=' . $current->citem . '&ip=' . i18n::hsc($current->cip), '" title="' . i18n::hsc($current->chost) . '">' . _LIST_COMMENT_BANIP . "</a></td>\n";
606 function listplug_table_bloglist($template, $type)
611 echo '<th>' . _NAME . "</th>\n";
612 echo '<th colspan="7">' . _LISTS_ACTIONS . "</th>\n";
615 $current = $template['current'];
616 $current->bname = i18n::hsc($current->bname);
618 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";
619 echo "<td><a href=\"index.php?action=createitem&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_ADD ."\">" . _BLOGLIST_ADD . "</a></td>\n";
620 echo "<td><a href=\"index.php?action=itemlist&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_EDIT."\">". _BLOGLIST_EDIT."</a></td>\n";
621 echo "<td><a href=\"index.php?action=blogcommentlist&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_COMMENTS."\">". _BLOGLIST_COMMENTS."</a></td>\n";
622 echo "<td><a href=\"index.php?action=bookmarklet&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_BMLET."\">". _BLOGLIST_BMLET . "</a></td>\n";
624 if ( $current->tadmin == 1 )
626 echo "<td><a href=\"index.php?action=blogsettings&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_SETTINGS . "\">" . _BLOGLIST_SETTINGS . "</a></td>\n";
627 echo "<td><a href=\"index.php?action=banlist&blogid={$current->bnumber}\" title=\"" . _BLOGLIST_TT_BANS . "\">" . _BLOGLIST_BANS . "</a></td>\n";
630 if ( $template['superadmin'] )
632 echo "<td><a href=\"index.php?action=deleteblog&blogid={$current->bnumber}\" title=\"". _BLOGLIST_TT_DELETE."\">" ._BLOGLIST_DELETE. "</a></td>\n";
639 function listplug_table_shortblognames($template, $type)
644 echo '<th>' . _EBLOG_SHORTNAME . "</th>\n";
645 echo '<th>' . _EBLOG_NAME. "</th>";
648 $current = $template['current'];
649 $current->bshortname = i18n::hsc($current->bshortname);
650 $current->bname = i18n::hsc($current->bname);
652 echo "<td>{$current->bshortname}</td>\n";
653 echo "<td>{$current->bname}</td>\n";
659 function listplug_table_shortnames($template, $type)
664 echo '<th>' . _NAME . "</th>\n";
665 echo '<th>' . _LISTS_DESC. "</th>\n";
668 $current = $template['current'];
669 $current->name = i18n::hsc($current->name);
670 $current->description = i18n::hsc($current->description);
672 echo "<td>{$current->name}</td>\n";
673 echo "<td>{$current->description}</td>\n";
680 function listplug_table_categorylist($template, $type)
685 echo '<th>' . _LISTS_NAME . "</th>";
686 echo '<th>' . _LISTS_DESC."</th>\n";
687 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
690 $id = listplug_nextBatchId();
692 $current = $template['current'];
693 $current->cname = i18n::hsc($current->cname);
694 $current->cdesc = i18n::hsc($current->cdesc);
697 echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current->catid}\" />\n";
698 echo "<label for=\"batch{$id}\">{$current->cname}</label>\n";
700 echo "<td>{$current->cdesc}</td>\n";
701 echo "<td><a href=\"index.php?action=categorydelete&blogid={$current->cblog}&catid={$current->catid}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
702 echo "<td><a href=\"index.php?action=categoryedit&blogid=}$current->cblog}&catid={$current->catid}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a></td>\n";
708 function listplug_table_templatelist($template, $type)
714 echo '<th>' . _LISTS_NAME . "</th>\n";
715 echo '<th>' . _LISTS_DESC . "</th>\n";
716 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
719 $current = $template['current'];
720 $current->tdnumber = (integer) $current->tdnumber;
721 $current->tdname = i18n::hsc($current->tdname);
722 $current->tddesc = i18n::hsc($current->tddesc);
724 $url = "index.php?action=templateclone&templateid={$current->tdnumber}";
725 $url = i18n::hsc($manager->addTicketToUrl($url));
727 echo "<td>{$current->tdname}</td>\n";
728 echo "<td>{$current->tddesc}</td>\n";
730 echo "<a href=\"index.php?action=templateedit&templateid={$current->tdnumber}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a>\n";
733 echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
736 echo "<a href=\"index.php?action=templatedelete&templateid={$current->tdnumber}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a>\n";
743 function listplug_table_skinlist($template, $type)
745 global $CONF, $DIR_SKINS, $manager;
749 echo '<th>' . _LISTS_NAME . "</th>\n";
750 echo '<th>' . _LISTS_DESC . "</th>\n";
751 echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
754 $current = $template['current'];
755 $current->sdnumber = (integer) $current->sdnumber;
756 $current->sdname = i18n::hsc($current->sdname);
757 $current->sdtype = i18n::hsc($current->sdtype);
761 // use a special style for the default skin
762 if ( $current->sdnumber == $CONF['BaseSkin'] )
764 echo '<h3 id="base_skin">' . $current->sdname . "</h3>\n";
768 echo '<h3>' . $current->sdname . "</h3>\n";
772 echo '<dt>' . _LISTS_TYPE . "</dt>\n";
773 echo '<dd>' . $current->sdtype . "</dd>\n";
775 echo '<dt>' . _LIST_SKINS_INCMODE . "</dt>\n";
777 if ( $current->sdincmode == 'skindir' )
779 echo '<dd>' . _PARSER_INCMODE_SKINDIR . "</dd>\n";
783 echo '<dd>' . _PARSER_INCMODE_NORMAL . "</dd>\n";
786 if ( $current->sdincpref )
788 echo '<dt>' . _LIST_SKINS_INCPREFIX . "</dt>\n";
789 echo '<dd>' . i18n::hsc($current->sdincpref) . "</dd>\n";
793 // add preview image when present
794 if ( $current->sdincpref && @file_exists("{$DIR_SKINS}{$current->sdincpref}preview.png") )
798 $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current->sdname);
799 $has_enlargement = @file_exists($DIR_SKINS . $current->sdincpref . 'preview-large.png');
800 if ( $has_enlargement )
802 echo '<a href="',$CONF['SkinsURL'], i18n::hsc($current->sdincpref),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
803 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], i18n::hsc($current->sdincpref),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
808 echo '<img class="skinpreview" src="',$CONF['SkinsURL'], i18n::hsc($current->sdincpref),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" /><br />\n";
811 if ( @file_exists("{$DIR_SKINS}{$current->sdincpref}readme.html") )
813 $url = $CONF['SkinsURL'] . i18n::hsc($current->sdincpref) . 'readme.html';
814 $title = sprintf(_LIST_SKIN_README, $current->sdname);
815 echo "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
824 echo '<p>' . i18n::hsc($current->sddesc) . "</p>\n";
826 /* show list of defined parts */
827 $query = "SELECT stype FROM %s WHERE sdesc=%d ORDER BY stype";
828 $query = sprintf($query, sql_table('skin'), $current->sdnumber);
829 $r = sql_query($query);
832 while ( $o = sql_fetch_object($r) )
834 array_push($types, $o->stype);
836 if ( sizeof($types) > 0 )
838 $friendlyNames = SKIN::getFriendlyNames();
839 for ( $i = 0; $i < sizeof($types); $i++ )
842 if ( !in_array($type, array('index', 'item', 'archivelist', 'archive', 'search', 'error', 'member', 'imagepopup')) )
844 $article = 'skinpartspecial';
848 $article = "skinpart{$type}";
850 $types[$i] = "<li>\n";
851 $types[$i] .= helpHtml($article) . "\n";
852 $types[$i] .= "<a href=\"index.php?action=skinedittype&skinid={$current->sdnumber}&type={$type}\" tabindex=\"{$template['tabindex']}\">" . i18n::hsc($friendlyNames[$type]) . "</a>\n";
853 $types[$i] .= "</li>\n";
855 echo _LIST_SKINS_DEFINED;
856 echo '<ul>' . implode('', $types) . "</ul>\n";
860 echo "<a href=\nindex.php?action=skinedit&skinid={$current->sdnumber}\n tabindex=\n{$template['tabindex']}>" . _LISTS_EDIT . "</a>\n";
863 $url = "index.php?action=skinclone&skinid={$current->sdnumber}";
864 $url = i18n::hsc($manager->addTicketToUrl($url));
866 echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
869 echo "<a href=\"index.php?action=skindelete&skinid={$current->sdnumber}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
875 function listplug_table_draftlist($template, $type)
880 echo '<th>' . _LISTS_BLOG . "</th>\n";
881 echo '<th>' . _LISTS_TITLE . "</th>\n";
882 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
885 $current = $template['current'];
886 $current->bshortname = i18n::hsc($current->bshortname);
887 $current->ititle = i18n::hsc(strip_tags($current->ititle));
889 echo "<td>{$current->bshortname}</td>\n";
890 echo "<td>{$current->ititle}</td>\n";
891 echo "<td><a href=\"index.php?action=itemedit&itemid={$current->inumber}\">" . _LISTS_EDIT . "</a></td>\n";
892 echo "<td><a href=\"index.php?action=itemdelete&itemid={$current->inumber}\">" . _LISTS_DELETE . "</a></td>\n";
898 function listplug_table_otherdraftlist($template, $type)
903 echo '<th>' . _LISTS_BLOG . "</th>\n";
904 echo '<th>' . _LISTS_TITLE . "</th>\n";
905 echo '<th>' . _LISTS_AUTHOR . "</th>\n";
906 echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
909 $current = $template['current'];
910 $current->bshortname = i18n::hsc($current->bshortname);
911 $current->ititle = i18n::hsc(strip_tags($current->ititle));
912 $current->mname = i18n::hsc($current->mname);
914 echo "<td>{$current->bshortname}</td>\n";
915 echo "<td>{$current->ititle}</td>\n";
916 echo "<td>{$current->mname}</td>\n";
917 echo "<td><a href=\"index.php?action=itemedit&itemid={$current->inumber}\">" . _LISTS_EDIT . "</a></td>\n";
918 echo "<td><a href=\"index.php?action=itemdelete&itemid={$current->inumber}\">" . _LISTS_DELETE . "</a></td>\n";
924 function listplug_table_actionlist($template, $type)
929 echo '<th>' . _LISTS_TIME . "</th>\n";
930 echo '<th>' . _LIST_ACTION_MSG . "</th>\n";
933 $current = $template['current'];
934 $current->timestamp = i18n::hsc($current->timestamp);
935 $current->message = i18n::hsc($current->message);
937 echo "<td>{$current->timestamp}</td>\n";
938 echo "<td>{$current->message}</td>\n";
944 function listplug_table_banlist($template, $type)
949 echo '<th>' . _LIST_BAN_IPRANGE . "</th>\n";
950 echo '<th>' . _LIST_BAN_REASON."</th>\n";
951 echo '<th>' . _LISTS_ACTIONS . "</th>\n";
954 $current = $template['current'];
955 $current->blogid = (integer) $current->blogid;
956 $current->iprange = i18n::hsc($current->iprange);
957 $current->reason = i18n::hsc($current->reason);
959 echo "<td>{$current->iprange}</td>\n";
960 echo "<td>{$current->reason}</td>\n";
961 echo "<td><a href=\"index.php?action=banlistdelete&blogid=\"{$current->blogid}&iprange=\"i18n::hsc($current->iprange}\">" . _LISTS_DELETE . "</a></td>\n";