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